/* ==========================================================================
   CalzAI — shared styles
   Design tokens mirror the iOS app's Theme.swift for one consistent system.
   ========================================================================== */

:root {
  /* Brand */
  --brand:        #26b885;   /* fresh green   (0.15, 0.72, 0.52) */
  --brand-dark:   #1c9d70;
  --brand-2:      #1a8ccc;   /* secondary blue */
  --calorie:      #f57339;
  --protein:      #e6476b;
  --carbs:        #f2ad2e;
  --fat:          #4d9ee6;

  /* Neutrals — light */
  --bg:           #ffffff;
  --bg-soft:      #f6f8f7;
  --bg-elev:      #ffffff;
  --border:       #e7ebe9;
  --ink:          #14201b;
  --ink-soft:     #4c5a54;
  --ink-faint:    #7d8a84;

  --shadow-sm: 0 1px 2px rgba(20, 32, 27, .05), 0 2px 8px rgba(20, 32, 27, .04);
  --shadow-md: 0 6px 24px rgba(20, 32, 27, .08), 0 2px 6px rgba(20, 32, 27, .05);
  --shadow-lg: 0 24px 60px rgba(20, 32, 27, .12), 0 8px 24px rgba(20, 32, 27, .06);

  --radius-sm: 10px;
  --radius:    16px;
  --radius-lg: 24px;
  --radius-xl: 32px;

  --maxw: 1120px;
  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --serif: "Fraunces", Georgia, "Times New Roman", serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:        #0c110f;
    --bg-soft:   #121a16;
    --bg-elev:   #141d18;
    --border:    #223029;
    --ink:       #eef4f0;
    --ink-soft:  #aebbb4;
    --ink-faint: #7c8b83;
    --shadow-sm: 0 1px 2px rgba(0,0,0,.4);
    --shadow-md: 0 6px 24px rgba(0,0,0,.45);
    --shadow-lg: 0 24px 60px rgba(0,0,0,.55);
  }
}

/* ---------- Reset / base ---------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.65;
  font-size: 17px;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
h1, h2, h3 { line-height: 1.12; letter-spacing: -0.025em; font-weight: 700; margin: 0; }
p { margin: 0 0 1em; }

.wrap { width: 100%; max-width: var(--maxw); margin: 0 auto; padding: 0 24px; }
.eyebrow {
  display: inline-block; font-size: .8rem; font-weight: 650; letter-spacing: .08em;
  text-transform: uppercase; color: var(--brand); margin-bottom: 14px;
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 10px;
  font-weight: 600; font-size: 1rem; padding: 14px 26px;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: transform .15s ease, box-shadow .2s ease, background .2s ease;
  white-space: nowrap;
}
.btn:active { transform: translateY(1px) scale(.99); }
.btn-primary { background: var(--brand); color: #fff; box-shadow: 0 8px 22px rgba(38,184,133,.35); }
.btn-primary:hover { background: var(--brand-dark); box-shadow: 0 10px 28px rgba(38,184,133,.45); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--border); }
.btn-ghost:hover { background: var(--bg-soft); }

/* ---------- Header ---------- */
.site-header {
  position: sticky; top: 0; z-index: 50;
  backdrop-filter: saturate(180%) blur(14px);
  -webkit-backdrop-filter: saturate(180%) blur(14px);
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  border-bottom: 1px solid transparent;
  transition: border-color .3s ease;
}
.site-header.scrolled { border-bottom-color: var(--border); }
.nav { display: flex; align-items: center; justify-content: space-between; height: 68px; }
.brand { display: flex; align-items: center; gap: 11px; font-weight: 700; font-size: 1.16rem; letter-spacing: -.02em; }
.brand .logo { width: 34px; height: 34px; border-radius: 9px; display: block; }
.nav-links { display: flex; align-items: center; gap: 30px; }
.nav-links a { color: var(--ink-soft); font-size: .96rem; font-weight: 500; transition: color .2s; }
.nav-links a:hover { color: var(--ink); }
.nav-cta { display: flex; align-items: center; gap: 14px; }
.menu-btn { display: none; }

/* ---------- Hero ---------- */
.hero { position: relative; overflow: hidden; padding: 84px 0 72px; }
.hero::before {
  content: ""; position: absolute; inset: -20% -10% auto -10%; height: 620px; z-index: -1;
  background:
    radial-gradient(60% 60% at 20% 0%, rgba(38,184,133,.16), transparent 70%),
    radial-gradient(50% 55% at 90% 10%, rgba(26,140,204,.14), transparent 70%);
  filter: blur(4px);
}
.hero-grid {
  display: grid; grid-template-columns: 1.05fr .95fr; gap: 56px; align-items: center;
}
.hero h1 { font-size: clamp(2.6rem, 5.2vw, 4rem); margin-bottom: 22px; }
.hero h1 .accent {
  background: linear-gradient(120deg, var(--brand), var(--brand-2));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.hero .lead { font-size: 1.22rem; color: var(--ink-soft); max-width: 32ch; margin-bottom: 30px; }
.hero-cta { display: flex; gap: 14px; flex-wrap: wrap; align-items: center; }
.hero-note { margin-top: 20px; font-size: .92rem; color: var(--ink-faint); display: flex; align-items: center; gap: 8px; }

.badge-row { display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 26px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px; font-size: .84rem; font-weight: 550;
  color: var(--ink-soft); background: var(--bg-soft); border: 1px solid var(--border);
  padding: 7px 13px; border-radius: 999px;
}
.chip .dot { width: 7px; height: 7px; border-radius: 999px; background: var(--brand); }

/* ---------- Phone mockup ---------- */
.phone-stage { display: flex; justify-content: center; perspective: 1400px; }
.phone {
  position: relative; width: 300px; aspect-ratio: 300 / 620;
  border-radius: 46px; background: linear-gradient(160deg, #1b2620, #0d1310);
  padding: 12px; box-shadow: var(--shadow-lg);
  transform: rotateY(-16deg) rotateX(5deg) rotate(1deg);
  transition: transform .5s cubic-bezier(.2,.8,.2,1);
}
.phone:hover { transform: rotateY(-6deg) rotateX(2deg); }
.phone .screen {
  width: 100%; height: 100%; border-radius: 36px; overflow: hidden;
  background: var(--bg-elev); position: relative;
  display: flex; flex-direction: column;
}
.phone .notch {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  width: 96px; height: 26px; background: #0d1310; border-radius: 999px; z-index: 5;
}
/* Home dashboard, mirroring the app's HomeView */
.phone .screen { background: var(--bg-soft); }
.scr-top { padding: 40px 16px 4px; }
.scr-greeting { font-size: 1.16rem; font-weight: 800; letter-spacing: -.02em; }
.scr-card {
  margin: 10px 13px 0; padding: 12px 14px; border-radius: 16px;
  background: var(--bg-elev); box-shadow: var(--shadow-sm);
}
.scr-h { font-size: .82rem; font-weight: 700; margin-bottom: 8px; }

.ring-wrap { display: flex; justify-content: center; padding: 4px 0 2px; }
.ring {
  --p: 68%;
  width: 128px; height: 128px; border-radius: 999px;
  background: conic-gradient(var(--calorie) 0 var(--p), var(--border) var(--p) 100%);
  display: grid; place-items: center; position: relative;
}
.ring::after { content: ""; position: absolute; inset: 13px; border-radius: 999px; background: var(--bg-elev); }
.ring .val { position: relative; text-align: center; z-index: 1; line-height: 1.18; }
.ring .val b { font-size: 1.5rem; font-weight: 800; display: block; letter-spacing: -.03em; }
.ring .val span { font-size: .62rem; color: var(--ink-faint); display: block; }
.ring .val em { font-size: .6rem; font-weight: 700; font-style: normal; color: var(--brand); }

.mbar { margin-bottom: 10px; }
.mbar:last-child { margin-bottom: 2px; }
.mbar-top { display: flex; justify-content: space-between; align-items: baseline; font-size: .68rem; margin-bottom: 5px; }
.mbar-top .mn { font-weight: 600; color: var(--ink); }
.mbar-top .mv { color: var(--ink-faint); }
.mbar .track { height: 6px; border-radius: 999px; overflow: hidden; }
.mbar .track i { display: block; height: 100%; border-radius: 999px; }

.scr-meals { margin: 12px 13px 0; }
.meal {
  display: flex; align-items: center; gap: 10px; margin-top: 8px;
  padding: 9px 12px; border-radius: 14px; background: var(--bg-elev); box-shadow: var(--shadow-sm);
}
.meal .thumb {
  width: 38px; height: 38px; border-radius: 10px; flex: none; display: grid; place-items: center;
  background: rgba(38,184,133,.13); color: var(--brand); font-size: 1rem;
}
.meal .meta { min-width: 0; }
.meal .meta .mt { font-size: .6rem; color: var(--ink-faint); }
.meal .meta .mn { font-size: .8rem; font-weight: 700; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.meal .meta .mm { font-size: .58rem; color: var(--ink-faint); }
.meal .kc { margin-left: auto; font-size: .74rem; font-weight: 700; color: var(--calorie); white-space: nowrap; }

.scr-scan {
  margin: 12px 13px 14px; padding: 11px; border-radius: 13px; background: var(--brand); color: #fff;
  font-weight: 700; font-size: .82rem; display: flex; align-items: center; justify-content: center; gap: 7px;
}

/* ---------- Sections ---------- */
section { padding: 88px 0; }
.section-head { max-width: 620px; margin: 0 auto 56px; text-align: center; }
.section-head h2 { font-size: clamp(2rem, 3.6vw, 2.7rem); margin-bottom: 16px; }
.section-head p { font-size: 1.12rem; color: var(--ink-soft); margin: 0; }

/* Feature grid */
.features { background: var(--bg-soft); }
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; }
.card {
  background: var(--bg-elev); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: 30px; box-shadow: var(--shadow-sm); transition: transform .25s ease, box-shadow .25s ease;
}
.card:hover { transform: translateY(-4px); box-shadow: var(--shadow-md); }
.card .ic {
  width: 50px; height: 50px; border-radius: 14px; display: grid; place-items: center;
  margin-bottom: 18px; font-size: 1.4rem;
}
.card h3 { font-size: 1.22rem; margin-bottom: 10px; }
.card p { color: var(--ink-soft); font-size: .98rem; margin: 0; }

.ic-green { background: rgba(38,184,133,.14); }
.ic-blue  { background: rgba(26,140,204,.14); }
.ic-orange{ background: rgba(245,115,57,.14); }
.ic-pink  { background: rgba(230,71,107,.14); }
.ic-amber { background: rgba(242,173,46,.16); }
.ic-fat   { background: rgba(77,158,230,.16); }

/* How it works */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 20px; counter-reset: step; }
.step { position: relative; padding: 30px 26px; border-radius: var(--radius-lg); border: 1px solid var(--border); background: var(--bg-elev); }
.step::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 12px;
  font-weight: 700; font-size: 1.1rem; color: #fff; background: var(--brand); margin-bottom: 18px;
}
.step:nth-child(2)::before { background: var(--brand-2); }
.step:nth-child(3)::before { background: var(--calorie); }
.step h3 { font-size: 1.18rem; margin-bottom: 9px; }
.step p { color: var(--ink-soft); font-size: .97rem; margin: 0; }

/* Privacy band */
.privacy-band { background: linear-gradient(135deg, #10231b, #0c1a2a); color: #eaf4ef; }
@media (prefers-color-scheme: light) {
  .privacy-band { background: linear-gradient(135deg, #103326, #0c2233); }
}
.privacy-band .section-head h2, .privacy-band .section-head p { color: #eaf4ef; }
.privacy-band .eyebrow { color: #6fe3b6; }
.privacy-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 20px; margin-top: 12px; }
.pfact { text-align: center; padding: 26px 16px; border-radius: var(--radius); background: rgba(255,255,255,.05); border: 1px solid rgba(255,255,255,.09); }
.pfact b { display: block; font-size: 2rem; letter-spacing: -.03em; color: #fff; margin-bottom: 6px; }
.pfact span { font-size: .92rem; color: #b6ccc2; }

/* FAQ */
.faq { max-width: 760px; margin: 0 auto; }
details {
  border: 1px solid var(--border); border-radius: var(--radius); background: var(--bg-elev);
  padding: 4px 22px; margin-bottom: 12px; transition: box-shadow .2s;
}
details[open] { box-shadow: var(--shadow-sm); }
summary {
  cursor: pointer; list-style: none; padding: 18px 0; font-weight: 600; font-size: 1.05rem;
  display: flex; justify-content: space-between; align-items: center; gap: 16px;
}
summary::-webkit-details-marker { display: none; }
summary::after { content: "+"; font-size: 1.4rem; color: var(--brand); font-weight: 400; transition: transform .2s; }
details[open] summary::after { transform: rotate(45deg); }
details p { color: var(--ink-soft); padding-bottom: 20px; margin: 0; font-size: .99rem; }

/* CTA */
.cta { text-align: center; }
.cta-box {
  background: linear-gradient(135deg, var(--brand), var(--brand-2));
  border-radius: var(--radius-xl); padding: 64px 32px; color: #fff; box-shadow: var(--shadow-lg);
}
.cta-box h2 { font-size: clamp(2rem, 3.6vw, 2.7rem); margin-bottom: 14px; }
.cta-box p { font-size: 1.15rem; opacity: .92; margin: 0 auto 30px; max-width: 46ch; }
.cta-box .btn-primary { background: #fff; color: var(--brand-dark); box-shadow: 0 10px 30px rgba(0,0,0,.2); }
.cta-box .btn-primary:hover { background: #f2fbf7; }

/* Footer */
.site-footer { background: var(--bg-soft); border-top: 1px solid var(--border); padding: 56px 0 34px; }
.footer-grid { display: flex; justify-content: space-between; gap: 40px; flex-wrap: wrap; margin-bottom: 36px; }
.footer-brand { max-width: 300px; }
.footer-brand p { color: var(--ink-soft); font-size: .94rem; margin-top: 14px; }
.footer-cols { display: flex; gap: 64px; flex-wrap: wrap; }
.fcol h4 { font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); margin: 0 0 14px; }
.fcol a { display: block; color: var(--ink-soft); font-size: .95rem; margin-bottom: 10px; transition: color .2s; }
.fcol a:hover { color: var(--brand); }
.footer-bottom { border-top: 1px solid var(--border); padding-top: 24px; display: flex; justify-content: space-between; gap: 16px; flex-wrap: wrap; color: var(--ink-faint); font-size: .88rem; }

/* ---------- Legal pages ---------- */
.legal { padding: 60px 0 90px; }
.legal-wrap { max-width: 800px; margin: 0 auto; }
.legal h1 { font-size: clamp(2.1rem, 4vw, 3rem); margin-bottom: 10px; }
.legal .updated { color: var(--ink-faint); font-size: .95rem; margin-bottom: 14px; }
.legal .intro { font-size: 1.12rem; color: var(--ink-soft); margin-bottom: 20px; }
.legal h2 { font-size: 1.5rem; margin: 42px 0 12px; padding-top: 8px; }
.legal h3 { font-size: 1.15rem; margin: 26px 0 8px; }
.legal p, .legal li { color: var(--ink-soft); }
.legal ul { padding-left: 22px; margin: 0 0 1em; }
.legal li { margin-bottom: 8px; }
.legal a { color: var(--brand); text-decoration: underline; text-underline-offset: 3px; }
.legal strong { color: var(--ink); }
.callout {
  background: var(--bg-soft); border: 1px solid var(--border); border-left: 4px solid var(--brand);
  border-radius: 12px; padding: 18px 22px; margin: 24px 0;
}
.callout p { margin: 0; color: var(--ink); }
.toc { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius); padding: 22px 26px; margin: 28px 0 36px; }
.toc h4 { margin: 0 0 12px; font-size: .82rem; text-transform: uppercase; letter-spacing: .07em; color: var(--ink-faint); }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; }
.toc li { margin-bottom: 7px; }
.toc a { color: var(--ink-soft); text-decoration: none; }
.toc a:hover { color: var(--brand); }

/* ---------- Reveal animation ----------
   Hidden only when JS is present to animate them back in, so a no-JS
   (or failed-observer) load still shows all content. */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.8,.2,1); }
.js .reveal.in { opacity: 1; transform: none; }
@media (prefers-reduced-motion: reduce) {
  .reveal { opacity: 1; transform: none; transition: none; }
  html { scroll-behavior: auto; }
  .phone { transform: none; }
}

/* ---------- Responsive ---------- */
@media (max-width: 900px) {
  .hero-grid { grid-template-columns: 1fr; gap: 44px; text-align: center; }
  .hero .lead { margin-left: auto; margin-right: auto; }
  .hero-cta, .badge-row, .hero-note { justify-content: center; }
  .feature-grid { grid-template-columns: repeat(2, 1fr); }
  .privacy-grid { grid-template-columns: repeat(2, 1fr); }
  .steps { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
  body { font-size: 16px; }
  section { padding: 64px 0; }
  .nav-links { display: none; }
  .menu-btn {
    display: inline-flex; background: transparent; border: 1px solid var(--border);
    border-radius: 10px; padding: 8px 12px; color: var(--ink); font-weight: 600; cursor: pointer;
  }
  .feature-grid, .privacy-grid { grid-template-columns: 1fr; }
  .toc ol { columns: 1; }
  .cta-box { padding: 44px 22px; }
  .hero { padding: 56px 0 48px; }
}
