/* MacroSnap website — tokens mirror src/theme/tokens.ts */
:root {
  --bg: #F8FAF7;
  --surface: #FFFFFF;
  --surface-muted: #F2F5F1;
  --primary: #3FA962;
  --primary-pressed: #328C50;
  --primary-dark: #237A42;
  --primary-light: #EAF6EE;
  --primary-soft: #DDF0E3;
  --primary-border: #BFE3CA;
  --text: #111827;
  --text-2: #6B7280;
  --text-3: #9CA3AF;
  --border: #E8ECE7;
  --protein: #2A974E;
  --carbs: #F08A24;
  --fat: #F2B530;
  --calories: #F07B2A;
  --warning-bg: #FDF1D6;
  --warning: #B7791F;
  --radius-card: 16px;
  --radius-lg: 20px;
  --radius-xl: 28px;
  --shadow-card: 0 2px 10px rgba(31, 42, 31, 0.05);
  --shadow-raised: 0 18px 50px rgba(31, 42, 31, 0.12);
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --max: 1120px;
}

*, *::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: 16px;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; max-width: 100%; }

a { color: var(--primary-dark); text-decoration-thickness: 1px; text-underline-offset: 3px; }
a:hover { color: var(--primary-pressed); }

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

.container { width: 100%; max-width: var(--max); margin: 0 auto; padding: 0 20px; }

/* ---------- header ---------- */
.site-header {
  position: sticky;
  top: 0;
  z-index: 10;
  background: rgba(248, 250, 247, 0.88);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid transparent;
}
.site-header.is-scrolled { border-bottom-color: var(--border); }
.site-header .container { display: flex; align-items: center; justify-content: space-between; height: 68px; gap: 16px; }

.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; font-weight: 800; font-size: 19px; letter-spacing: -0.3px; }
.brand:hover { color: var(--text); }
.brand svg { width: 36px; height: auto; }

.nav { display: flex; align-items: center; gap: 28px; }
.nav a { color: var(--text-2); text-decoration: none; font-size: 15px; font-weight: 500; white-space: nowrap; }
.nav a:hover { color: var(--text); }
@media (max-width: 760px) { .nav .nav-optional { display: none; } .nav { gap: 18px; } }

/* ---------- language switcher ---------- */
.visually-hidden {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.site-header .nav { margin-left: auto; }
.lang { position: relative; flex: none; }
.lang summary {
  display: inline-flex; align-items: center; gap: 6px;
  height: 38px; padding: 0 12px; border-radius: 999px;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2); font-size: 14px; font-weight: 500;
  cursor: pointer; list-style: none; user-select: none;
}
.lang summary::-webkit-details-marker { display: none; }
.lang summary:hover, .lang[open] summary { color: var(--text); border-color: var(--primary-border); }
.lang-globe { width: 17px; height: 17px; }
.lang-chevron { width: 14px; height: 14px; transition: transform 0.15s ease; }
.lang[open] .lang-chevron { transform: rotate(180deg); }
.lang-code { display: none; }
.lang-menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20;
  min-width: 210px; max-height: calc(100vh - 90px); overflow-y: auto;
  margin: 0; padding: 6px; list-style: none;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-card); box-shadow: var(--shadow-raised);
}
.lang-menu a {
  display: block; padding: 8px 12px; border-radius: 10px;
  color: var(--text); text-decoration: none; font-size: 15px; line-height: 1.35;
}
.lang-menu a:hover { background: var(--primary-light); color: var(--primary-dark); }
.lang-menu a[aria-current="page"] { color: var(--primary-dark); font-weight: 600; background: var(--surface-muted); }
.en-note { font-size: 0.9em; color: var(--text-3); }
@media (max-width: 760px) {
  .lang summary { padding: 0 10px; }
  .lang-name { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .lang-code { display: inline; font-weight: 600; }
}
@media (max-width: 400px) {
  .site-header .container { gap: 10px; }
  .brand { font-size: 17px; gap: 8px; }
  .brand svg { width: 30px; }
  .nav { gap: 12px; }
  .nav a { font-size: 14px; }
  .lang summary { gap: 4px; padding: 0 8px; }
  .lang-chevron { display: none; }
}

/* ---------- buttons & badges ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 52px; padding: 0 22px; border-radius: 16px;
  font: 600 16px/1 var(--font); text-decoration: none; border: 1px solid transparent;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-pressed); color: #fff; }
.btn-ghost { background: var(--surface); color: var(--text); border-color: var(--border); }
.btn-ghost:hover { color: var(--text); background: var(--surface-muted); }

.store-badges { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 28px; }
.store-badge {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 16px; border-radius: 14px;
  background: var(--text); color: #fff; line-height: 1.15;
}
.store-badge svg { width: 22px; height: 22px; flex: none; }
.store-badge small { display: block; font-size: 11px; opacity: 0.75; }
.store-badge strong { font-size: 15px; font-weight: 600; }
.soon-note { margin: 12px 0 0; font-size: 13px; color: var(--text-3); }

.eyebrow {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 6px 12px; border-radius: 999px;
  background: var(--primary-light); color: var(--primary-dark);
  font-size: 13px; font-weight: 600;
}

/* ---------- hero ---------- */
.hero { padding: 56px 0 80px; overflow: hidden; }
.hero .container { display: grid; grid-template-columns: 1.05fr 0.95fr; align-items: center; gap: 48px; }
.hero h1 { margin: 18px 0 16px; font-size: clamp(38px, 5.4vw, 60px); line-height: 1.05; letter-spacing: -1.6px; font-weight: 800; }
.hero h1 span { color: var(--primary); }
.hero .lead { margin: 0; max-width: 520px; font-size: 19px; color: var(--text-2); }
@media (max-width: 900px) {
  .hero { padding-top: 32px; }
  .hero .container { grid-template-columns: 1fr; }
  .hero-visual { order: 2; }
}

.hero-visual { position: relative; display: flex; justify-content: center; padding: 20px 0; }
.hero-visual::before {
  content: ""; position: absolute; inset: 8% 4% 4%;
  background: radial-gradient(closest-side, var(--primary-soft), transparent);
  z-index: 0;
}

/* ---------- phone mockup (pure CSS rebuild of the Today screen) ---------- */
.phone {
  position: relative; z-index: 1;
  width: 300px; max-width: 100%;
  padding: 12px; border-radius: 46px;
  background: #0F1512; box-shadow: var(--shadow-raised);
}
.phone-screen { border-radius: 36px; background: var(--bg); overflow: hidden; padding: 18px 16px 20px; min-height: 560px; }
.phone-status { display: flex; justify-content: space-between; font-size: 12px; font-weight: 600; padding: 0 8px 14px; }
.phone-notch { width: 90px; height: 24px; margin: -6px auto 0; border-radius: 999px; background: #0F1512; }
.phone h3 { margin: 4px 4px 2px; font-size: 22px; letter-spacing: -0.4px; }
.phone .muted { margin: 0 4px 14px; font-size: 12px; color: var(--text-2); }

.m-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 14px; box-shadow: var(--shadow-card); }
.m-card + .m-card { margin-top: 10px; }

.ring-row { display: flex; align-items: center; gap: 14px; }
.ring {
  --p: 58;
  width: 108px; height: 108px; border-radius: 50%; flex: none;
  background: conic-gradient(var(--primary) calc(var(--p) * 1%), var(--primary-light) 0);
  display: grid; place-items: center;
}
.ring::after {
  content: attr(data-label);
  width: 84px; height: 84px; border-radius: 50%; background: var(--surface);
  display: grid; place-items: center; text-align: center;
  font-size: 11px; line-height: 1.25; color: var(--text-2); white-space: pre-line;
}
.ring-stats { font-size: 12px; color: var(--text-2); }
.ring-stats strong { display: block; font-size: 20px; color: var(--text); letter-spacing: -0.4px; line-height: 1.2; }
.ring-stats div + div { margin-top: 8px; }

.macro { font-size: 12px; }
.macro + .macro { margin-top: 10px; }
.macro-top { display: flex; justify-content: space-between; margin-bottom: 5px; }
.macro-top span:last-child { color: var(--text-2); }
.bar { height: 7px; border-radius: 999px; background: var(--surface-muted); overflow: hidden; }
.bar i { display: block; height: 100%; border-radius: inherit; }

.meal-row { display: flex; align-items: center; gap: 12px; }
.meal-thumb {
  width: 44px; height: 44px; border-radius: 12px; flex: none;
  display: grid; place-items: center; font-size: 22px;
  background: linear-gradient(135deg, #FDF1D6, #EAF6EE);
}
.meal-row div { flex: 1; font-size: 13px; line-height: 1.3; }
.meal-row div small { display: block; color: var(--text-2); font-size: 11px; }
.meal-row b { font-size: 13px; }

.float-chip {
  position: absolute; z-index: 2;
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px; border-radius: 16px;
  background: var(--surface); border: 1px solid var(--border); box-shadow: var(--shadow-raised);
  font-size: 13px; line-height: 1.25;
}
.float-chip small { display: block; color: var(--text-2); font-size: 11px; }
.float-chip .dot { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary-dark); }
.float-chip .dot svg { width: 18px; height: 18px; }
/* Chips sit mostly outside the 300px phone so they never cover its content. */
.chip-scan { top: 7%; left: 50%; transform: translateX(-150%); }
.chip-protein { bottom: 9%; left: 50%; transform: translateX(62%); }
@media (max-width: 700px) {
  .chip-scan { top: 0; left: 0; transform: none; }
  .chip-protein { bottom: 0; left: auto; right: 0; transform: none; }
}

/* ---------- sections ---------- */
section { scroll-margin-top: 80px; }
.section { padding: 84px 0; }
.section-alt { background: var(--surface); border-top: 1px solid var(--border); border-bottom: 1px solid var(--border); }
.section-head { max-width: 640px; margin: 0 auto 48px; text-align: center; }
.section-head h2 { margin: 12px 0 12px; font-size: clamp(30px, 3.6vw, 42px); line-height: 1.12; letter-spacing: -1px; }
.section-head p { margin: 0; color: var(--text-2); font-size: 18px; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 900px) { .grid-3 { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .grid-3 { grid-template-columns: 1fr; } }

.feature { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 24px; box-shadow: var(--shadow-card); }
.section-alt .feature { background: var(--bg); box-shadow: none; }
.feature-icon { width: 46px; height: 46px; border-radius: 14px; display: grid; place-items: center; background: var(--primary-light); color: var(--primary); margin-bottom: 16px; }
.feature-icon svg { width: 24px; height: 24px; }
.feature h3 { margin: 0 0 6px; font-size: 18px; letter-spacing: -0.2px; }
.feature p { margin: 0; color: var(--text-2); font-size: 15px; }

.steps { counter-reset: step; }
.step { position: relative; padding-top: 64px; }
.step::before {
  counter-increment: step; content: counter(step);
  position: absolute; top: 24px; left: 24px;
  width: 44px; height: 44px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--primary); color: #fff; font-weight: 700;
}
.step.feature { padding-top: 84px; }

/* ---------- plans ---------- */
.plans { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; max-width: 860px; margin: 0 auto; }
@media (max-width: 720px) { .plans { grid-template-columns: 1fr; } }
.plan { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-xl); padding: 28px; }
.plan-premium { border: 2px solid var(--primary); background: linear-gradient(180deg, var(--primary-light), var(--surface) 45%); }
.plan h3 { margin: 0; font-size: 22px; letter-spacing: -0.3px; display: flex; align-items: center; gap: 10px; }
.plan .tag { font-size: 12px; font-weight: 700; padding: 3px 10px; border-radius: 999px; background: var(--primary); color: #fff; }
.plan > p { margin: 6px 0 18px; color: var(--text-2); }
.checks { list-style: none; margin: 0; padding: 0; }
.checks li { position: relative; padding-left: 30px; margin-top: 10px; }
.checks li::before {
  content: ""; position: absolute; left: 0; top: 4px; width: 18px; height: 18px; border-radius: 50%;
  background: var(--primary) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3.2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M5 12.5l4.5 4.5L19 7.5'/%3E%3C/svg%3E") center / 12px no-repeat;
}
.plan-note { text-align: center; color: var(--text-3); font-size: 14px; margin: 20px 0 0; }

/* ---------- honesty note & FAQ ---------- */
.note {
  display: flex; gap: 16px; align-items: flex-start;
  max-width: 860px; margin: 0 auto;
  padding: 22px 24px; border-radius: var(--radius-lg);
  background: var(--warning-bg); color: #5B4410;
}
.note svg { width: 26px; height: 26px; flex: none; color: var(--warning); margin-top: 2px; }
.note p { margin: 0; }
.note strong { color: #3D2E0B; }

.faq { max-width: 760px; margin: 0 auto; }
.faq details { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-card); padding: 0 20px; }
.faq details + details { margin-top: 10px; }
.faq summary { cursor: pointer; list-style: none; padding: 18px 28px 18px 0; font-weight: 600; position: relative; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; position: absolute; right: 0; top: 14px; font-size: 22px; color: var(--text-3); font-weight: 400; }
.faq details[open] summary::after { content: "–"; }
.faq details p { margin: 0 0 18px; color: var(--text-2); }

.cta { text-align: center; }
.cta h2 { margin: 0 0 12px; font-size: clamp(28px, 3.4vw, 40px); letter-spacing: -1px; line-height: 1.15; }
.cta p { margin: 0 auto; max-width: 520px; color: var(--text-2); font-size: 18px; }
.cta .store-badges { justify-content: center; }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--border); padding: 32px 0 40px; color: var(--text-2); font-size: 14px; }
.site-footer .container { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 20px; }
.site-footer a { color: var(--text-2); text-decoration: none; }
.site-footer a:hover { color: var(--text); }

/* ---------- legal pages ---------- */
.legal { padding: 48px 0 80px; }
.legal .container { max-width: 780px; }
.legal-head { margin-bottom: 32px; }
.legal-head h1 { margin: 12px 0 8px; font-size: clamp(34px, 4.4vw, 46px); line-height: 1.1; letter-spacing: -1.2px; }
.legal-head p { margin: 0; color: var(--text-2); }
.summary {
  background: var(--primary-light); border: 1px solid var(--primary-border);
  border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 36px;
}
.summary h2 { margin: 0 0 6px; font-size: 17px; }
.summary ul { margin: 0; padding-left: 20px; }
.summary li { margin-top: 4px; }
.toc { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px 24px; margin-bottom: 36px; }
.toc h2 { margin: 0 0 8px; font-size: 15px; color: var(--text-2); text-transform: uppercase; letter-spacing: 0.08em; }
.toc ol { margin: 0; padding-left: 20px; columns: 2; column-gap: 32px; }
.toc li { break-inside: avoid; margin-top: 4px; }
@media (max-width: 600px) { .toc ol { columns: 1; } }
.prose h2 { margin: 44px 0 10px; font-size: 24px; letter-spacing: -0.4px; line-height: 1.25; scroll-margin-top: 84px; }
.prose h3 { margin: 24px 0 6px; font-size: 18px; }
.prose p, .prose li { color: #374151; }
.prose ul { padding-left: 22px; }
.prose li { margin-top: 6px; }
.table-wrap { overflow-x: auto; margin: 16px 0; border: 1px solid var(--border); border-radius: var(--radius-card); background: var(--surface); }
.prose table { width: 100%; border-collapse: collapse; font-size: 15px; min-width: 560px; }
.prose th, .prose td { text-align: left; vertical-align: top; padding: 12px 14px; border-bottom: 1px solid var(--border); }
.prose th { background: var(--surface-muted); font-weight: 600; color: var(--text); }
.prose tr:last-child td { border-bottom: 0; }
.callout { border-left: 4px solid var(--primary); background: var(--surface); padding: 14px 18px; border-radius: 0 12px 12px 0; margin: 18px 0; }
.callout p { margin: 0; }
