/* Keto Cal — site styles.
   Tokens mirror the app (src/theme/tokens.ts) so the site and the product
   read as one thing. Light is the hero look; dark follows the device. */

:root {
  --bg: #F3F8F6;
  --surface: #FFFFFF;
  --surface-alt: #E9F3EF;
  --text: #10201C;
  --text-dim: #6E8079;
  --on-accent: #FFFFFF;
  --accent: #0FB9A0;
  --accent-dark: #0A8F7C;
  --accent-soft: #E3F6F2;
  --accent-muted: #C6EDE4;
  --hairline: #E1EBE7;
  --warn: #F5A524;
  --over: #E5484D;
  --g-a: #0A8F7C;
  --g-b: #4F8F2E;
  --g-c: #B06E00;
  --g-d: #C25A14;
  --g-f: #D13239;
  --protein: #5B7CFA;
  --fat: #F2994A;
  --calories: #8B93A7;
  --shadow: 0 1px 2px rgba(16,32,28,.05), 0 12px 32px -12px rgba(16,32,28,.14);
  --shadow-lg: 0 2px 4px rgba(16,32,28,.06), 0 40px 80px -24px rgba(16,32,28,.28);
  --radius: 18px;
  --radius-sm: 12px;
  --maxw: 1080px;
  --gutter: 20px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0F1A17;
    --surface: #17241F;
    --surface-alt: #1E2D28;
    --text: #F1F7F4;
    --text-dim: #9AAFA7;
    --accent: #3AD6BC;
    --accent-dark: #6FE7D2;
    --accent-soft: #14312B;
    --accent-muted: #1B463D;
    --hairline: #24352F;
    --on-accent: #06211C;
    --g-a: #3AD6BC;
    --g-b: #96DD6A;
    --g-c: #FFC24D;
    --g-d: #FF9E5E;
    --g-f: #FF7B80;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 12px 32px -12px rgba(0,0,0,.6);
    --shadow-lg: 0 2px 4px rgba(0,0,0,.5), 0 40px 80px -24px rgba(0,0,0,.7);
  }
}

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

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: .001ms !important; transition-duration: .001ms !important; }
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 17px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 var(--gutter); }
.narrow { max-width: 760px; }

h1, h2, h3, h4 { line-height: 1.15; letter-spacing: -0.022em; margin: 0 0 .5em; font-weight: 700; }
h1 { font-size: clamp(2.1rem, 6.4vw, 3.6rem); letter-spacing: -0.032em; }
h2 { font-size: clamp(1.55rem, 4.2vw, 2.25rem); letter-spacing: -0.026em; }
h3 { font-size: 1.12rem; }
p { margin: 0 0 1.1em; }
a { color: var(--accent-dark); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: var(--accent); }
img { max-width: 100%; display: block; }
:focus-visible { outline: 2.5px solid var(--accent); outline-offset: 3px; border-radius: 6px; }

.eyebrow {
  display: inline-block; font-size: .75rem; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--accent-dark);
  background: var(--accent-soft); border-radius: 999px; padding: 6px 13px; margin-bottom: 18px;
}
.lede { font-size: clamp(1.02rem, 2.3vw, 1.2rem); color: var(--text-dim); }
.center { text-align: center; }
.muted { color: var(--text-dim); }
.small { font-size: .875rem; }

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

.site-header {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(16px);
  -webkit-backdrop-filter: saturate(180%) blur(16px);
  border-bottom: 1px solid var(--hairline);
}
.site-header .wrap { display: flex; align-items: center; gap: 16px; height: 62px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; letter-spacing: -.02em; color: var(--text); text-decoration: none; font-size: 1.02rem; }
.brand img { width: 30px; height: 30px; border-radius: 8px; box-shadow: 0 1px 3px rgba(16,32,28,.18); }
.nav { margin-left: auto; display: flex; align-items: center; gap: 22px; }
.nav a { color: var(--text-dim); text-decoration: none; font-size: .94rem; font-weight: 500; }
.nav a:hover { color: var(--text); }
@media (max-width: 640px) { .nav a.hide-sm { display: none; } }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  padding: 14px 26px; border-radius: 999px; font-weight: 650; font-size: 1rem;
  text-decoration: none; border: 1px solid transparent; cursor: pointer;
  transition: transform .14s ease, box-shadow .14s ease, background-color .14s ease;
}
.btn-primary { background: var(--accent); color: var(--on-accent); box-shadow: 0 6px 18px -6px color-mix(in srgb, var(--accent) 70%, transparent); }
.btn-primary:hover { background: var(--accent-dark); color: var(--on-accent); transform: translateY(-1px); }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--hairline); box-shadow: var(--shadow); }
.btn-ghost:hover { color: var(--text); border-color: var(--accent-muted); transform: translateY(-1px); }
.btn[aria-disabled="true"] { opacity: .62; cursor: default; pointer-events: none; }
.btn-row { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }

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

.hero { padding: clamp(48px, 8vw, 92px) 0 clamp(40px, 6vw, 72px); overflow: hidden; }
.hero .wrap { display: grid; grid-template-columns: 1.05fr .95fr; gap: clamp(28px, 5vw, 64px); align-items: center; }
@media (max-width: 880px) { .hero .wrap { grid-template-columns: 1fr; } .hero-art { order: -1; } }
.hero h1 { margin-bottom: 18px; }
.hero .lede { max-width: 30ch; }
.hero-note { font-size: .875rem; color: var(--text-dim); margin: 16px 0 0; }

/* phone mockup */
.hero-art { display: flex; justify-content: center; }
.phone {
  width: min(300px, 78vw); aspect-ratio: 9 / 18.6; background: var(--surface);
  border-radius: 42px; border: 1px solid var(--hairline);
  box-shadow: var(--shadow-lg); padding: 14px 14px 18px;
  display: flex; flex-direction: column; gap: 12px; position: relative;
}
.phone::before {
  content: ""; position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 78px; height: 20px; background: var(--text); opacity: .9; border-radius: 999px;
}
.phone-head { display: flex; justify-content: space-between; align-items: baseline; padding: 30px 6px 0; }
.phone-head strong { font-size: .95rem; }
.ring-wrap { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 2px 0 6px; }
.ring { width: 172px; height: 172px; position: relative; }
.ring svg { transform: rotate(-90deg); overflow: visible; }
.ring-track { stroke: var(--accent-soft); }
.ring-fill { stroke: var(--accent); stroke-linecap: round; stroke-dasharray: 427; stroke-dashoffset: 427; animation: ring-in 1.5s cubic-bezier(.22,1,.36,1) .25s forwards; }
@keyframes ring-in { to { stroke-dashoffset: 171; } }
.ring-label { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 1px; }
.ring-label b { font-size: 2.5rem; font-weight: 700; letter-spacing: -.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.ring-label span { font-size: .72rem; color: var(--text-dim); font-weight: 600; letter-spacing: .01em; }

.bars { display: grid; gap: 9px; padding: 0 6px; }
.bar-row { display: grid; grid-template-columns: 52px 1fr auto; align-items: center; gap: 10px; font-size: .74rem; color: var(--text-dim); font-weight: 600; }
.bar { height: 6px; background: var(--surface-alt); border-radius: 999px; overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: 999px; }

.meal { display: flex; align-items: center; gap: 10px; padding: 9px 10px; background: var(--surface-alt); border-radius: 13px; }
.meal-emoji { width: 32px; height: 32px; display: grid; place-items: center; background: var(--surface); border-radius: 9px; font-size: 1.05rem; }
.meal-txt { min-width: 0; flex: 1; }
.meal-txt b { display: block; font-size: .8rem; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal-txt span { font-size: .68rem; color: var(--text-dim); }
.grade {
  width: 24px; height: 24px; flex: none; display: grid; place-items: center; border-radius: 7px;
  font-size: .72rem; font-weight: 800; background: var(--accent-soft); color: var(--accent-dark);
}
.grade.f { background: color-mix(in srgb, var(--over) 16%, transparent); color: var(--over); }

/* ---------------------------------------------------------------- sections */

section { padding: clamp(46px, 7vw, 82px) 0; }
section.tint { background: var(--surface-alt); }
.section-head { max-width: 640px; margin: 0 auto clamp(30px, 5vw, 48px); text-align: center; }
.section-head p:last-child { margin-bottom: 0; }

.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(255px, 1fr)); }
.card {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow);
}
.card h3 { margin-bottom: 7px; }
.card p:last-child { margin-bottom: 0; color: var(--text-dim); font-size: .95rem; }
.card .ico {
  width: 42px; height: 42px; border-radius: 12px; background: var(--accent-soft);
  display: grid; place-items: center; font-size: 1.28rem; margin-bottom: 15px;
}

/* numbered steps */
.steps { counter-reset: step; display: grid; gap: 18px; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.step { position: relative; padding-top: 6px; }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font-weight: 700; font-size: .95rem; margin-bottom: 13px;
}
.step h3 { margin-bottom: 6px; }
.step p { color: var(--text-dim); font-size: .95rem; margin: 0; }

/* keto grade scale */
.scale { display: grid; gap: 10px; grid-template-columns: repeat(5, 1fr); margin-top: 8px; }
@media (max-width: 720px) { .scale { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 380px) { .scale { grid-template-columns: 1fr; } }
.scale div {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 14px 16px; box-shadow: var(--shadow);
}
.scale b { display: block; font-size: 1.5rem; font-weight: 800; letter-spacing: -.03em; line-height: 1.1; }
.scale span { font-size: .84rem; color: var(--text-dim); }
.g-a b { color: var(--g-a); } .g-b b { color: var(--g-b); } .g-c b { color: var(--g-c); }
.g-d b { color: var(--g-d); } .g-f b { color: var(--g-f); }

/* pricing */
.plans { display: grid; gap: 16px; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); max-width: 760px; margin: 0 auto; }
.plan { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius); padding: 26px; box-shadow: var(--shadow); position: relative; }
.plan.featured { border-color: var(--accent); border-width: 2px; }
.plan .tag {
  position: absolute; top: -12px; left: 26px; background: var(--accent); color: var(--on-accent);
  font-size: .7rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  padding: 5px 12px; border-radius: 999px;
}
.price { font-size: 2.3rem; font-weight: 750; letter-spacing: -.035em; line-height: 1.1; }
.price small { font-size: .95rem; font-weight: 500; color: var(--text-dim); letter-spacing: 0; }
.plan ul { list-style: none; padding: 0; margin: 16px 0 0; display: grid; gap: 9px; font-size: .93rem; }
.plan li { padding-left: 25px; position: relative; color: var(--text-dim); }
.plan li::before { content: "✓"; position: absolute; left: 0; color: var(--accent); font-weight: 700; }

/* faq */
.faq { max-width: 740px; margin: 0 auto; display: grid; gap: 10px; }
details {
  background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm);
  padding: 4px 20px; box-shadow: var(--shadow);
}
details[open] { border-color: var(--accent-muted); }
summary { cursor: pointer; font-weight: 650; padding: 15px 0; list-style: none; display: flex; justify-content: space-between; gap: 16px; align-items: center; }
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; color: var(--accent); font-size: 1.4rem; font-weight: 400; line-height: 1; flex: none; }
details[open] summary::after { content: "−"; }
details > p { margin: 0 0 16px; color: var(--text-dim); font-size: .95rem; }

/* callout */
.callout {
  background: var(--surface); border: 1px solid var(--hairline); border-left: 3px solid var(--accent);
  border-radius: var(--radius-sm); padding: 18px 20px; margin: 26px 0; box-shadow: var(--shadow);
}
.callout p:last-child { margin-bottom: 0; }
.callout strong { color: var(--text); }

/* cta band */
.cta-band { background: var(--accent); color: var(--on-accent); text-align: center; }
.cta-band h2, .cta-band p { color: var(--on-accent); }
.cta-band p { opacity: .92; }
.cta-band .btn-ghost { background: var(--on-accent); color: var(--accent-dark); border-color: transparent; }
.cta-band .btn-ghost:hover { color: var(--accent-dark); }

/* ---------------------------------------------------------------- legal pages */

.legal { padding: clamp(36px, 6vw, 60px) 0 clamp(50px, 8vw, 80px); }
.legal h1 { font-size: clamp(1.9rem, 5vw, 2.6rem); margin-bottom: 8px; }
.legal .updated { color: var(--text-dim); font-size: .9rem; margin-bottom: 34px; }
.legal h2 {
  font-size: 1.28rem; letter-spacing: -.018em; margin: 42px 0 12px;
  padding-top: 20px; border-top: 1px solid var(--hairline);
}
.legal h2:first-of-type { border-top: 0; padding-top: 0; margin-top: 30px; }
.legal h3 { font-size: 1.02rem; margin: 22px 0 8px; }
.legal p, .legal li { color: var(--text-dim); }
.legal strong { color: var(--text); font-weight: 650; }
.legal ul, .legal ol { padding-left: 22px; margin: 0 0 1.1em; }
.legal li { margin-bottom: .5em; }
.legal table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: .93rem; }
.legal th, .legal td { text-align: left; padding: 11px 12px; border-bottom: 1px solid var(--hairline); vertical-align: top; color: var(--text-dim); }
.legal th { color: var(--text); font-weight: 650; font-size: .82rem; text-transform: uppercase; letter-spacing: .05em; }
.legal td:first-child { color: var(--text); font-weight: 550; white-space: nowrap; }
@media (max-width: 560px) { .legal td:first-child { white-space: normal; } }

.toc { background: var(--surface); border: 1px solid var(--hairline); border-radius: var(--radius-sm); padding: 20px 24px; box-shadow: var(--shadow); margin-bottom: 8px; }
.toc p { font-size: .78rem; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--text); margin: 0 0 10px; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 28px; font-size: .92rem; }
@media (max-width: 560px) { .toc ol { columns: 1; } }
.toc li { margin-bottom: 5px; break-inside: avoid; }

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

.site-footer { border-top: 1px solid var(--hairline); padding: 44px 0 56px; background: var(--bg); }
.site-footer .cols { display: flex; flex-wrap: wrap; gap: 36px 56px; justify-content: space-between; }
.site-footer h4 { font-size: .78rem; text-transform: uppercase; letter-spacing: .08em; color: var(--text-dim); font-weight: 700; margin-bottom: 12px; }
.site-footer ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 9px; }
.site-footer a { color: var(--text); text-decoration: none; font-size: .94rem; }
.site-footer a:hover { color: var(--accent-dark); text-decoration: underline; }
.footer-brand { max-width: 270px; }
.footer-brand p { font-size: .9rem; color: var(--text-dim); margin: 12px 0 0; }
.legal-line { margin-top: 40px; padding-top: 22px; border-top: 1px solid var(--hairline); font-size: .84rem; color: var(--text-dim); }
.legal-line p { margin: 0 0 .6em; }
.legal-line p:last-child { margin: 0; }
