/* PlatePilot — platepilot.xyz
   Tokens mirror the iOS asset catalog (ios/PlatePilot/Assets.xcassets) so the
   site and the app read as one product. Light values first, dark overrides in
   the prefers-color-scheme block. No build step, no external requests. */

:root {
  color-scheme: light dark;

  /* Brand — from AccentColor / RhythmSleep / RhythmAwake colorsets */
  --accent: #25a260;
  --accent-strong: #1c8a3e;
  --navy: #1a2b66;
  --navy-deep: #050a33;
  --gold: #c99a18;

  /* Macro tokens — MacroProtein / MacroCarb / MacroFat */
  --protein: #2e7cc4;
  --carb: #c99a18;
  --fat: #d06a15;

  /* Surfaces */
  --bg: #ffffff;
  --bg-soft: #f5f7f9;
  --card: #ffffff;
  --border: #dfe4ea;
  --text: #16191d;
  --text-dim: #5b6572;
  --shadow: 0 1px 2px rgb(16 24 40 / 6%), 0 8px 24px rgb(16 24 40 / 6%);

  --radius: 14px;
  --radius-lg: 22px;
  --measure: 68ch;
  --wrap: 1080px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
    Arial, sans-serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --accent: #3eb479;
    --accent-strong: #16c752;
    --navy: #101a3d;
    --navy-deep: #04061c;
    --gold: #f5c544;

    --protein: #4fa8e8;
    --carb: #f5c544;
    --fat: #f2913d;

    --bg: #0e1013;
    --bg-soft: #15181d;
    --card: #171b21;
    --border: #2a3038;
    --text: #eef1f4;
    --text-dim: #a3adba;
    --shadow: 0 1px 2px rgb(0 0 0 / 40%), 0 8px 24px rgb(0 0 0 / 30%);
  }
}

/* ---------- base ---------- */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img,
svg {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

a:hover {
  color: var(--accent);
}

h1,
h2,
h3 {
  line-height: 1.2;
  letter-spacing: -0.015em;
  margin: 0 0 0.5em;
  text-wrap: balance;
}

h1 {
  font-size: clamp(2rem, 1.4rem + 2.6vw, 3.2rem);
}

h2 {
  font-size: clamp(1.4rem, 1.15rem + 1.1vw, 1.95rem);
}

h3 {
  font-size: 1.12rem;
}

p,
li {
  text-wrap: pretty;
}

code {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.1em 0.35em;
}

:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--card);
  color: var(--text);
  padding: 0.6rem 1rem;
  z-index: 100;
  border-radius: 0 0 var(--radius) 0;
}

.skip-link:focus {
  left: 0;
}

/* ---------- layout ---------- */

.wrap {
  width: min(100% - 2.5rem, var(--wrap));
  margin-inline: auto;
}

/* Constrain the line length of the children, not the container, so a prose
   column lines up with the left edge of a full-width .wrap on the same page
   instead of floating into the middle of the viewport. */
.prose > * {
  max-width: var(--measure);
}

.prose h2 {
  margin-top: 2.2em;
  padding-top: 0.2em;
}

.prose h3 {
  margin-top: 1.8em;
}

.prose ul,
.prose ol {
  padding-left: 1.25rem;
}

.prose li + li {
  margin-top: 0.35em;
}

section {
  padding-block: clamp(2.75rem, 6vw, 4.5rem);
}

.section-soft {
  background: var(--bg-soft);
  border-block: 1px solid var(--border);
}

/* ---------- header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(14px);
  border-bottom: 1px solid var(--border);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: 60px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  font-weight: 650;
  letter-spacing: -0.02em;
  color: var(--text);
  text-decoration: none;
  font-size: 1.05rem;
}

.brand svg {
  width: 28px;
  height: 28px;
  flex: none;
}

.site-nav {
  margin-left: auto;
  display: flex;
  gap: 0.35rem 1.1rem;
  flex-wrap: wrap;
  font-size: 0.95rem;
}

.site-nav a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 0.2rem 0;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  color: var(--text);
}

.site-nav a[aria-current="page"] {
  box-shadow: inset 0 -2px 0 var(--accent);
}

/* ---------- hero ---------- */

.hero {
  background: linear-gradient(165deg, var(--navy) 0%, var(--accent-strong) 100%);
  color: #fff;
  padding-block: clamp(3rem, 8vw, 5.5rem);
}

.hero h1 {
  color: #fff;
  max-width: 16ch;
}

.hero p {
  color: rgb(255 255 255 / 88%);
  font-size: 1.14rem;
  max-width: 54ch;
}

.hero-grid {
  display: grid;
  gap: clamp(2rem, 5vw, 3.5rem);
  grid-template-columns: 1fr;
  align-items: center;
}

@media (min-width: 800px) {
  .hero-grid {
    grid-template-columns: 1.15fr 0.85fr;
  }
}

.hero-art {
  display: flex;
  justify-content: center;
}

.hero-art img {
  width: min(240px, 60vw);
  border-radius: 24%;
  box-shadow: 0 18px 48px rgb(0 0 0 / 35%);
}

/* Device screenshots. The phone corner radius is a fixed physical curve, so it is a
   px value rather than a percentage — a percentage skews as the image scales. */
.shot {
  border-radius: 28px;
  box-shadow: 0 18px 48px rgb(0 0 0 / 35%);
  display: block;
}

.hero-art img.shot {
  width: min(280px, 66vw);
  border-radius: 28px;
}

.shots {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  align-items: start;
  margin: 1.85rem 0 0;
  max-width: none;
}

.shots figure {
  margin: 0;
}

.shots img {
  width: 100%;
  max-width: 300px;
  height: auto;
  border: 1px solid var(--border);
}

.shots img.shot-wide {
  max-width: 480px;
}

.shots figcaption {
  margin-top: 0.7rem;
  font-size: 0.92rem;
  color: var(--text-dim);
  max-width: 34ch;
}

.eyebrow {
  display: inline-block;
  font-size: 0.78rem;
  font-weight: 650;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: rgb(255 255 255 / 16%);
  border: 1px solid rgb(255 255 255 / 26%);
  margin-bottom: 1rem;
}

/* ---------- buttons ---------- */

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-top: 1.75rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font: inherit;
  font-weight: 600;
  padding: 0.7rem 1.25rem;
  border-radius: 999px;
  text-decoration: none;
  border: 1px solid transparent;
  transition: transform 0.12s ease, background-color 0.12s ease;
}

.btn:active {
  transform: translateY(1px);
}

.btn-primary {
  background: #fff;
  color: var(--navy-deep);
}

.btn-primary:hover {
  background: #eef4f0;
  color: var(--navy-deep);
}

.btn-ghost {
  border-color: rgb(255 255 255 / 45%);
  color: #fff;
}

.btn-ghost:hover {
  background: rgb(255 255 255 / 12%);
  color: #fff;
}

.btn-solid {
  background: var(--accent-strong);
  color: #fff;
}

.btn-solid:hover {
  background: var(--accent);
  color: #fff;
}

.btn-outline {
  border-color: var(--border);
  color: var(--text);
  background: var(--card);
}

.btn-outline:hover {
  border-color: var(--accent);
  color: var(--text);
}

/* ---------- cards ---------- */

.cards {
  display: grid;
  gap: 1.1rem;
  grid-template-columns: repeat(auto-fit, minmax(255px, 1fr));
}

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.4rem 1.4rem 1.5rem;
  box-shadow: var(--shadow);
}

.card h3 {
  margin-bottom: 0.35em;
}

.card p:last-child {
  margin-bottom: 0;
}

.card .dot {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  margin-bottom: 0.9rem;
  background: color-mix(in srgb, var(--accent) 16%, transparent);
  color: var(--accent-strong);
  font-weight: 700;
}

.card .dot.protein {
  background: color-mix(in srgb, var(--protein) 16%, transparent);
  color: var(--protein);
}

.card .dot.carb {
  background: color-mix(in srgb, var(--carb) 18%, transparent);
  color: var(--carb);
}

.card .dot.fat {
  background: color-mix(in srgb, var(--fat) 16%, transparent);
  color: var(--fat);
}

/* ---------- misc blocks ---------- */

.mt-2 {
  margin-top: 1.85rem;
}

.lede {
  font-size: 1.12rem;
  color: var(--text-dim);
  max-width: 60ch;
}

.note {
  border-left: 3px solid var(--accent);
  background: var(--bg-soft);
  padding: 0.9rem 1.1rem;
  border-radius: 0 var(--radius) var(--radius) 0;
  margin: 1.5rem 0;
}

.note strong {
  display: block;
  margin-bottom: 0.2rem;
}

.note.warn {
  border-left-color: var(--fat);
}

.placeholder {
  background: color-mix(in srgb, var(--carb) 22%, transparent);
  border-radius: 4px;
  padding: 0 0.25em;
  font-style: normal;
}

.steps {
  counter-reset: step;
  list-style: none;
  padding: 0;
  display: grid;
  gap: 1rem;
}

.steps li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 2rem 1fr;
  gap: 0.9rem;
  align-items: start;
}

.steps li::before {
  content: counter(step);
  width: 2rem;
  height: 2rem;
  border-radius: 999px;
  background: var(--accent-strong);
  color: #fff;
  display: grid;
  place-items: center;
  font-weight: 700;
  font-size: 0.9rem;
}

.faq {
  border-top: 1px solid var(--border);
}

.faq details {
  border-bottom: 1px solid var(--border);
  padding: 0.35rem 0;
}

.faq summary {
  cursor: pointer;
  font-weight: 600;
  padding: 0.85rem 0;
  list-style: none;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}

.faq summary::-webkit-details-marker {
  display: none;
}

.faq summary::after {
  content: "+";
  color: var(--accent-strong);
  font-weight: 700;
  flex: none;
}

.faq details[open] summary::after {
  content: "\2013";
}

.faq details > *:not(summary) {
  margin-top: 0;
  color: var(--text-dim);
  max-width: var(--measure);
}

.faq details > *:last-child {
  margin-bottom: 1rem;
}

.table-scroll {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin: 1.5rem 0;
}

table {
  border-collapse: collapse;
  width: 100%;
  min-width: 420px;
  font-size: 0.95rem;
}

th,
td {
  text-align: left;
  padding: 0.7rem 0.9rem;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

th {
  background: var(--bg-soft);
  font-weight: 650;
}

tr:last-child td {
  border-bottom: 0;
}

.meta {
  color: var(--text-dim);
  font-size: 0.92rem;
}

.toc {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 1.5rem 0 2.5rem;
}

.toc h2 {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin: 0 0 0.6rem;
}

.toc ol {
  margin: 0;
  columns: 2;
  column-gap: 2rem;
  font-size: 0.95rem;
}

@media (max-width: 620px) {
  .toc ol {
    columns: 1;
  }
}

/* ---------- footer ---------- */

.site-footer {
  border-top: 1px solid var(--border);
  background: var(--bg-soft);
  padding-block: 2.5rem;
  font-size: 0.94rem;
}

.site-footer .cols {
  display: grid;
  gap: 1.75rem;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
}

.site-footer h2 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
  margin-bottom: 0.6rem;
}

.site-footer ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

.site-footer li + li {
  margin-top: 0.35rem;
}

.site-footer a {
  color: var(--text);
  text-decoration: none;
}

.site-footer a:hover {
  color: var(--accent-strong);
  text-decoration: underline;
}

.colophon {
  margin-top: 2rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
  color: var(--text-dim);
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem 1.25rem;
  justify-content: space-between;
}

.colophon p {
  margin: 0;
  max-width: 62ch;
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}
