/* ============================================================
   GLP 1 Tracker App - "Warm Paper" design system
   The app's own palette, expressed as a website: warm paper,
   quiet ink, periwinkle accent, and the metric colors used for
   protein / water / weight. Self-contained: no external fonts,
   no CDNs, no trackers. Light-first with a native dark mode,
   both generated from BrandPalette.swift.
   ============================================================ */

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

:root {
  /* Paper + surfaces */
  --paper:      #FFFDF9;
  --surface:    #FFFFFF;
  --recessed:   #F2F0ED;
  --line:       #E5E3DC;
  --line-soft:  rgba(15,15,15,0.06);

  /* Ink */
  --ink:        #0F0F0F;
  --ink-2:      #57565B;
  --ink-3:      #8A8890;
  --text:       #232227;
  --text-soft:  #57565B;
  --text-mute:  #8A8890;

  /* Accents (BrandPalette) */
  --accent:      #7776EC;
  --accent-deep: #5A59C9;
  --accent-soft: rgba(119,118,236,0.10);
  --on-accent:   #FFFFFF;
  --positive:    #3F9E85;
  --positive-soft: rgba(63,158,133,0.10);
  --critical:    #D5453C;
  --critical-soft: rgba(213,69,60,0.08);
  --protein:     #D9772F;
  --water:       #3F92D2;
  --weight:      #C43FC5;

  --shadow-1: 0 1px 2px rgba(28,25,18,0.05), 0 6px 22px rgba(28,25,18,0.06);
  --shadow-2: 0 2px 4px rgba(28,25,18,0.06), 0 16px 44px rgba(28,25,18,0.10);

  --sans:  system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
  --mono:  ui-monospace, 'SF Mono', SFMono-Regular, Menlo, Consolas, monospace;

  --maxw:  1120px;
  --prose: 70ch;
  --radius: 16px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper:      #121216;
    --surface:    #1B1B21;
    --recessed:   #23232A;
    --line:       #2E2E36;
    --line-soft:  rgba(242,241,238,0.07);

    --ink:        #F2F1EE;
    --ink-2:      #A9A7B0;
    --ink-3:      #6E6C77;
    --text:       #E4E3E7;
    --text-soft:  #A9A7B0;
    --text-mute:  #83818C;

    --accent:      #AFAFFA;
    --accent-deep: #8B8AF0;
    --accent-soft: rgba(175,175,250,0.12);
    --on-accent:   #17172E;
    --positive:    #6FD3BC;
    --positive-soft: rgba(111,211,188,0.12);
    --critical:    #FF8078;
    --critical-soft: rgba(255,128,120,0.10);
    --protein:     #F0A163;
    --water:       #74B8ED;
    --weight:      #E58BE6;

    --shadow-1: 0 1px 2px rgba(0,0,0,0.4), 0 6px 22px rgba(0,0,0,0.35);
    --shadow-2: 0 2px 4px rgba(0,0,0,0.45), 0 16px 44px rgba(0,0,0,0.5);
  }
}

html {
  background: var(--paper);
  scroll-behavior: smooth;
  color-scheme: light dark;
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  font-family: var(--sans);
  font-size: 1rem;
  line-height: 1.62;
  color: var(--text);
  background: var(--paper);
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

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

a { color: var(--accent-deep); text-decoration: none; transition: color .15s ease, opacity .15s ease; }
a:hover { color: var(--accent); }
@media (prefers-color-scheme: dark) {
  a { color: var(--accent); }
  a:hover { color: #C9C8FF; }
}

::selection { background: rgba(119,118,236,0.25); }

/* ---- Display type ---- */
h1, h2, h3, h4 { font-weight: 750; line-height: 1.12; letter-spacing: -.014em; color: var(--ink); }
.eyebrow {
  font-size: .72rem; font-weight: 700; letter-spacing: .22em; text-transform: uppercase;
  color: var(--accent-deep); display: inline-block;
}
@media (prefers-color-scheme: dark) { .eyebrow { color: var(--accent); } }
.em { color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .em { color: var(--accent); } }

/* ---- Skip link / focus ---- */
.skip-link {
  position: absolute; top: -120%; left: 14px; z-index: 400;
  padding: 9px 16px; background: var(--accent); color: var(--on-accent); font-weight: 700;
  border-radius: 0 0 10px 10px; transition: top .2s ease;
}
.skip-link:focus { top: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 3px; }

.sr-only {
  position: absolute !important; width: 1px; height: 1px;
  padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; border: 0;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px;
  font-family: var(--sans); font-size: .95rem; font-weight: 700; letter-spacing: .01em;
  color: var(--on-accent); text-decoration: none;
  padding: 13px 26px; min-height: 48px; border-radius: 999px;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  border: 0;
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 8px 20px rgba(119,118,236,0.32);
  cursor: pointer; transition: transform .14s ease, box-shadow .14s ease, filter .14s ease;
}
.btn:hover { transform: translateY(-2px); filter: brightness(1.05); color: var(--on-accent); }
.btn:active { transform: translateY(0) scale(.97); }

.btn-ghost {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: .92rem; font-weight: 700;
  color: var(--ink); padding: 11px 22px; min-height: 46px; border-radius: 999px;
  background: var(--surface);
  border: 1.5px solid var(--line);
  cursor: pointer; transition: transform .12s ease, border-color .15s ease, background .15s ease;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--ink); }
.btn-ghost:active { transform: scale(.96); }
.btn-ghost:disabled { opacity: .4; cursor: not-allowed; transform: none; }

/* App Store badge */
.appstore {
  display: inline-flex; align-items: center; gap: 11px;
  padding: 9px 20px; min-height: 54px; border-radius: 13px;
  background: #000; border: 1px solid rgba(0,0,0,0.9);
  color: #fff; text-decoration: none;
  transition: transform .14s ease, box-shadow .14s ease;
  box-shadow: var(--shadow-1);
}
.appstore:hover { transform: translateY(-2px); color: #fff; box-shadow: var(--shadow-2); }
.appstore:active { transform: translateY(0) scale(.98); }
.appstore svg { width: 25px; height: 25px; fill: #fff; flex: none; }
.appstore .lbl { display: flex; flex-direction: column; line-height: 1.12; text-align: left; }
.appstore .lbl small { font-size: .64rem; font-weight: 500; opacity: .92; letter-spacing: .01em; }
.appstore .lbl b { font-size: 1.06rem; font-weight: 600; letter-spacing: .01em; }
@media (prefers-color-scheme: dark) {
  .appstore { border-color: rgba(255,255,255,0.28); }
}

.nav-cta {
  display: inline-flex; align-items: center; justify-content: center;
  padding: 9px 18px; min-height: 42px; border-radius: 999px;
  font-size: .86rem; font-weight: 700;
  color: var(--on-accent); text-decoration: none;
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 5px 14px rgba(119,118,236,0.3);
  transition: transform .14s ease, filter .14s ease;
  white-space: nowrap;
}
.nav-cta:hover { transform: translateY(-1px); filter: brightness(1.05); color: var(--on-accent); }
.nav-cta:active { transform: translateY(0) scale(.97); }

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky; top: 0; z-index: 100;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  height: 64px; padding: 0 18px;
  padding-left: max(18px, env(safe-area-inset-left));
  padding-right: max(18px, env(safe-area-inset-right));
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: blur(14px) saturate(1.2); -webkit-backdrop-filter: blur(14px) saturate(1.2);
  border-bottom: 1px solid var(--line);
}
.brand { display: inline-flex; align-items: center; gap: 11px; color: var(--ink); }
.brand .mark { width: 34px; height: 34px; flex: none; border-radius: 22%; box-shadow: var(--shadow-1); }
.brand-name { font-weight: 750; font-size: 1.05rem; letter-spacing: -.01em; color: var(--ink); }
.nav-links { display: none; gap: 26px; align-items: center; }
.nav-links a { font-size: .9rem; font-weight: 600; letter-spacing: .02em; color: var(--text-soft); }
.nav-links a:hover { color: var(--ink); }
@media (min-width: 900px) {
  .nav { padding-left: max(36px, env(safe-area-inset-left)); padding-right: max(36px, env(safe-area-inset-right)); }
  .nav-links { display: flex; }
}

/* ============================================================
   HERO + dose-day demo card
   ============================================================ */
.hero { position: relative; isolation: isolate; padding: 72px 18px 60px; text-align: center; }
.hero::before {
  content: ''; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(70% 44% at 50% 0%, var(--accent-soft), transparent 62%),
    radial-gradient(46% 34% at 12% 20%, var(--positive-soft), transparent 70%);
}
.hero-inner { max-width: 800px; margin: 0 auto; }
.hero .eyebrow { margin-bottom: 16px; }
.hero h1 { font-size: clamp(2.35rem, 1.5rem + 3.6vw, 3.9rem); }
.hero-sub { margin: 18px auto 0; max-width: 580px; font-size: 1.08rem; color: var(--text-soft); line-height: 1.55; }

.dosecard {
  max-width: 560px; margin: 32px auto 0; padding: 20px 18px 16px;
  border-radius: 22px; position: relative; text-align: left;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
}
.dose-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 6px; }
.dose-head .who { display: flex; align-items: center; gap: 10px; min-width: 0; }
.dose-head .gigi { width: 38px; height: 38px; flex: none; }
.dose-head .t { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.dose-head .t b { font-size: .98rem; color: var(--ink); }
.dose-head .t span { font-size: .8rem; color: var(--text-mute); }
.dose-pill {
  font-size: .74rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent-deep); background: var(--accent-soft);
  border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding: 4px 11px; border-radius: 999px; flex: none;
}
.dose-pill.done { color: var(--positive); background: var(--positive-soft); border-color: color-mix(in srgb, var(--positive) 45%, transparent); }
@media (prefers-color-scheme: dark) { .dose-pill { color: var(--accent); } }

.dose-chart { margin-top: 8px; border-radius: 14px; background: var(--recessed); border: 1px solid var(--line-soft); padding: 10px 8px 4px; }
.dose-chart svg { width: 100%; height: auto; display: block; }
.dose-chart .axis { font-family: var(--mono); font-size: 9px; fill: var(--text-mute); }
.dose-curve { fill: none; stroke: var(--accent); stroke-width: 2.5; stroke-linecap: round; }
.dose-fill { fill: var(--accent-soft); stroke: none; }
.dose-tick { stroke: var(--accent-deep); stroke-width: 2; stroke-linecap: round; }
.dose-dot { fill: var(--accent-deep); }
.dose-now { stroke: var(--positive); stroke-width: 1.5; stroke-dasharray: 3 4; }

.dose-stats { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 12px; }
.dstat {
  flex: 1 1 100px; display: flex; flex-direction: column; gap: 1px;
  padding: 9px 12px; border-radius: 12px; background: var(--recessed); border: 1px solid var(--line-soft);
}
.dstat b { font-size: .98rem; color: var(--ink); font-variant-numeric: tabular-nums; }
.dstat span { font-size: .7rem; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--text-mute); }
.dstat.protein b { color: var(--protein); }
.dstat.water b { color: var(--water); }

.dose-controls { display: flex; gap: 10px; justify-content: center; flex-wrap: wrap; margin-top: 14px; }
.hero-caption {
  margin: 16px auto 0; max-width: 480px; font-size: .82rem; color: var(--text-mute); line-height: 1.5; text-align: center;
}
.hero-caption b { color: var(--text-soft); font-weight: 700; }

.hero-foot { margin-top: 30px; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.hero-foot .micro { font-size: .8rem; color: var(--text-mute); }

/* ============================================================
   SECTION scaffolding
   ============================================================ */
.section { padding: 84px 20px; }
.wrap { max-width: var(--maxw); margin: 0 auto; }
.section-head { text-align: center; max-width: 660px; margin: 0 auto 46px; }
.section-head h2 { font-size: clamp(1.85rem, 1.35rem + 1.9vw, 2.7rem); }
.section-head p { margin-top: 14px; color: var(--text-soft); font-size: 1.05rem; }

.divider { display: flex; align-items: center; justify-content: center; gap: 16px; padding: 4px 20px 0; }
.divider .rule { height: 1px; width: min(180px, 30vw); background: linear-gradient(90deg, transparent, var(--line), transparent); }
.divider .dots { display: inline-flex; gap: 5px; }
.divider .dots i { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.divider .dots i:nth-child(1) { background: var(--accent); }
.divider .dots i:nth-child(2) { background: var(--positive); }
.divider .dots i:nth-child(3) { background: var(--protein); }

/* ============================================================
   FEATURE cards
   ============================================================ */
.features { background: linear-gradient(180deg, var(--paper), var(--recessed) 140%); }
.grid { display: grid; grid-template-columns: 1fr; gap: 18px; }
.fcard {
  position: relative; border-radius: var(--radius); padding: 26px 22px 24px;
  background: var(--surface);
  border: 1px solid var(--line); overflow: hidden;
  box-shadow: var(--shadow-1);
  transition: transform .25s cubic-bezier(.16,1,.3,1), border-color .25s ease, box-shadow .25s ease;
}
.fcard:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-2); }
.fcard .ico { width: 40px; height: 40px; margin-bottom: 14px; color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .fcard .ico { color: var(--accent); } }
.fcard h3 { font-size: 1.24rem; margin-bottom: 8px; }
.fcard p { font-size: .95rem; color: var(--text-soft); line-height: 1.56; }
.fcard .note { margin-top: 10px; font-size: .8rem; color: var(--text-mute); font-style: italic; }
.fcard .pro-tag {
  position: absolute; top: 14px; right: 14px;
  font-size: .62rem; font-weight: 800; letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent-deep); background: var(--accent-soft); border: 1px solid color-mix(in srgb, var(--accent) 40%, transparent);
  padding: 3px 9px; border-radius: 999px;
}
@media (prefers-color-scheme: dark) { .fcard .pro-tag { color: var(--accent); } }
@media (min-width: 640px) { .grid { grid-template-columns: 1fr 1fr; gap: 20px; } }
@media (min-width: 960px) { .grid { grid-template-columns: repeat(3, 1fr); gap: 22px; } }

/* ============================================================
   MEDICATIONS band
   ============================================================ */
.meds { text-align: center; }
.med-chips { display: flex; flex-wrap: wrap; justify-content: center; gap: 10px; max-width: 860px; margin: 0 auto; }
.med-chip {
  display: inline-flex; flex-direction: column; align-items: flex-start; gap: 0;
  padding: 10px 18px; border-radius: 14px; text-align: left;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
}
.med-chip b { font-size: .95rem; color: var(--ink); }
.med-chip span { font-size: .74rem; color: var(--text-mute); }
.meds .micro { margin-top: 22px; font-size: .82rem; color: var(--text-mute); }

/* ============================================================
   PROMISE placard (privacy)
   ============================================================ */
.promise { text-align: center; }
.placard {
  max-width: 780px; margin: 0 auto; padding: 44px 30px 40px;
  border-radius: 20px; position: relative;
  background: linear-gradient(180deg, var(--surface), color-mix(in srgb, var(--accent-soft) 45%, var(--surface)));
  border: 1px solid color-mix(in srgb, var(--accent) 30%, var(--line));
  box-shadow: var(--shadow-2);
}
.placard .eyebrow { margin-bottom: 12px; }
.placard h2 { font-size: clamp(1.7rem, 1.3rem + 1.6vw, 2.4rem); margin-bottom: 8px; }
.placard > p { color: var(--text-soft); max-width: 540px; margin: 0 auto 26px; }
.rules { display: grid; gap: 2px; max-width: 620px; margin: 0 auto; text-align: left; }
.rule-line { display: flex; align-items: flex-start; gap: 14px; padding: 13px 6px; border-bottom: 1px dashed color-mix(in srgb, var(--accent) 24%, transparent); }
.rule-line:last-child { border-bottom: 0; }
.rule-line .mark { color: var(--accent-deep); font-weight: 700; flex: none; line-height: 1.5; }
@media (prefers-color-scheme: dark) { .rule-line .mark { color: var(--accent); } }
.rule-line .t { color: var(--text); font-size: .98rem; }
.rule-line .t b { color: var(--ink); font-weight: 700; }

/* ============================================================
   FREE-FIRST band
   ============================================================ */
.freeband { background: var(--recessed); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.freeband-inner { max-width: 900px; margin: 0 auto; display: grid; gap: 30px; align-items: center; }
.freeband h2 { font-size: clamp(1.8rem, 1.35rem + 1.7vw, 2.5rem); margin-bottom: 12px; }
.freeband p { color: var(--text-soft); font-size: 1.04rem; margin-bottom: 14px; }
.freeband ul { list-style: none; display: grid; gap: 12px; }
.freeband li { position: relative; padding-left: 30px; color: var(--text); font-size: 1rem; }
.freeband li::before { content: '✓'; position: absolute; left: 0; top: 0; color: var(--positive); font-weight: 700; }
.free-badge { display: inline-block; margin-bottom: 16px; padding: 5px 14px; border-radius: 999px; background: var(--positive-soft); border: 1px solid color-mix(in srgb, var(--positive) 45%, transparent); color: var(--positive); font-size: .76rem; font-weight: 700; letter-spacing: .12em; text-transform: uppercase; }
@media (min-width: 840px) { .freeband-inner { grid-template-columns: 1.1fr 1fr; gap: 46px; } }

/* ============================================================
   STAT band (product facts only)
   ============================================================ */
.stat-row { display: flex; flex-wrap: wrap; justify-content: center; gap: 26px 40px; }
.stat { text-align: center; min-width: 130px; }
.stat b { display: block; font-size: clamp(1.9rem, 1.4rem + 1.6vw, 2.6rem); font-weight: 800; letter-spacing: -.02em; color: var(--accent-deep); line-height: 1; }
@media (prefers-color-scheme: dark) { .stat b { color: var(--accent); } }
.stat span { display: block; margin-top: 8px; font-size: .84rem; color: var(--text-soft); letter-spacing: .02em; }

/* ============================================================
   ARTICLE cards (hub + homepage teaser)
   ============================================================ */
.acard {
  display: flex; flex-direction: column; border-radius: var(--radius); overflow: hidden;
  background: var(--surface); border: 1px solid var(--line); box-shadow: var(--shadow-1);
  transition: transform .25s cubic-bezier(.16,1,.3,1), border-color .25s ease, box-shadow .25s ease;
  color: inherit;
}
.acard:hover { transform: translateY(-5px); border-color: color-mix(in srgb, var(--accent) 45%, var(--line)); box-shadow: var(--shadow-2); color: inherit; }
.acard img { aspect-ratio: 16 / 9; object-fit: cover; width: 100%; border-bottom: 1px solid var(--line-soft); background: var(--recessed); }
.acard .pad { padding: 18px 18px 20px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.acard h3 { font-size: 1.08rem; line-height: 1.3; }
.acard p { font-size: .88rem; color: var(--text-soft); line-height: 1.5; }
.acard .meta { margin-top: auto; padding-top: 8px; font-size: .76rem; color: var(--text-mute); }
.hub-head { text-align: center; max-width: 680px; margin: 0 auto 40px; padding-top: 64px; }
.hub-head h1 { font-size: clamp(2rem, 1.5rem + 2vw, 3rem); }
.hub-head p { margin-top: 14px; color: var(--text-soft); font-size: 1.05rem; }
.hub-section { padding: 26px 20px 6px; }
.hub-section h2 { font-size: 1.3rem; margin: 0 0 18px; }
.more-cta { text-align: center; margin-top: 34px; }

/* ============================================================
   ARTICLE page
   ============================================================ */
.article-wrap { max-width: 760px; margin: 0 auto; padding: 40px 20px 40px; }
.crumbs { font-size: .82rem; color: var(--text-mute); margin-bottom: 20px; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.crumbs a { color: var(--text-soft); }
.crumbs a:hover { color: var(--accent-deep); }
.crumbs .sep { color: var(--line); }
.article-head h1 { font-size: clamp(1.8rem, 1.35rem + 1.9vw, 2.6rem); margin-bottom: 14px; }
.article-meta { display: flex; flex-wrap: wrap; gap: 8px 18px; font-size: .84rem; color: var(--text-mute); margin-bottom: 24px; }
.article-hero { border-radius: var(--radius); border: 1px solid var(--line); box-shadow: var(--shadow-1); width: 100%; aspect-ratio: 16 / 9; object-fit: cover; background: var(--recessed); margin-bottom: 8px; }
.article-body { padding-top: 20px; }

.callout.medical { background: var(--accent-soft); border-left: 3px solid var(--accent); border-radius: 14px; padding: 16px 20px; margin: 0 0 28px; font-size: .88rem; color: var(--text-soft); }
.callout.medical b { color: var(--ink); }

/* In-article app CTA panel */
.cta-panel {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  margin: 36px 0; padding: 20px 22px;
  border-radius: var(--radius); background: var(--surface);
  border: 1px solid color-mix(in srgb, var(--accent) 35%, var(--line));
  box-shadow: var(--shadow-1);
}
.cta-panel img { width: 54px; height: 54px; border-radius: 22%; flex: none; box-shadow: var(--shadow-1); }
.cta-panel .txt { flex: 1 1 220px; min-width: 0; }
.cta-panel .txt b { display: block; color: var(--ink); font-size: 1.02rem; }
.cta-panel .txt span { font-size: .86rem; color: var(--text-soft); }
.cta-panel .btn { flex: none; }

.related { margin: 40px 0 8px; padding: 22px 24px; border-radius: var(--radius); background: var(--recessed); border: 1px solid var(--line); }
.related h2 { font-size: 1.05rem; margin-bottom: 12px; }
.related ul { list-style: none; display: grid; gap: 9px; }
.related li { position: relative; padding-left: 20px; font-size: .94rem; }
.related li::before { content: '→'; position: absolute; left: 0; color: var(--accent-deep); }
@media (prefers-color-scheme: dark) { .related li::before { color: var(--accent); } }

/* ============================================================
   CLOSING
   ============================================================ */
.closing { position: relative; isolation: isolate; text-align: center; padding: 92px 20px; }
.closing::before { content: ''; position: absolute; inset: 0; z-index: -1; background: radial-gradient(60% 60% at 50% 40%, var(--accent-soft), transparent 62%); }
.closing h2 { font-size: clamp(2rem, 1.5rem + 2.2vw, 3.1rem); margin-bottom: 10px; }
.closing p { color: var(--text-soft); margin-bottom: 26px; font-size: 1.06rem; }

/* ============================================================
   COMPLIANCE / medical disclaimer
   ============================================================ */
.disclaimer { padding: 52px 20px 8px; }
.disclaimer-inner { max-width: 720px; margin: 0 auto; padding: 26px; border: 1px solid var(--line); border-radius: 14px; background: var(--recessed); }
.disclaimer h3 { font-size: .78rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--text-soft); margin-bottom: 14px; text-align: center; }
.disclaimer ul { list-style: none; display: grid; gap: 8px; }
.disclaimer li { position: relative; padding-left: 22px; font-size: .87rem; color: var(--text-soft); line-height: 1.5; }
.disclaimer li::before { content: ''; position: absolute; left: 6px; top: 8px; width: 6px; height: 6px; border-radius: 50%; background: color-mix(in srgb, var(--accent) 55%, transparent); }

/* ============================================================
   FOOTER
   ============================================================ */
.footer { padding: 42px 20px 120px; border-top: 1px solid var(--line); background: var(--recessed); }
.footer-inner { max-width: var(--maxw); margin: 0 auto; display: flex; flex-direction: column; align-items: center; gap: 18px; text-align: center; }
.footer-links { display: flex; flex-wrap: wrap; justify-content: center; gap: 14px 24px; }
.footer-links a { font-size: .88rem; color: var(--text-soft); min-height: 44px; display: inline-flex; align-items: center; }
.footer-links a:hover { color: var(--ink); }
.footer-note { font-size: .78rem; color: var(--text-mute); max-width: 620px; line-height: 1.55; }
.footer-copy { font-size: .78rem; color: var(--text-mute); }

/* ============================================================
   PROSE (legal, articles) + support
   ============================================================ */
.page { min-height: 68vh; }
.prose { max-width: var(--prose); margin: 0 auto; padding: 84px 20px 72px; font-size: 1.02rem; line-height: 1.75; color: var(--text); }
.article-body.prose { padding: 20px 0 0; max-width: none; }
.prose h1 { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.6rem); margin-bottom: 6px; }
.prose .updated { font-size: .86rem; color: var(--accent-deep); font-weight: 600; margin-bottom: 8px; }
@media (prefers-color-scheme: dark) { .prose .updated { color: var(--accent); } }
.prose .intro { color: var(--text-soft); margin-bottom: 34px; }
.prose h2 { font-size: 1.42rem; margin: 2.3em 0 .7em; scroll-margin-top: 80px; }
.prose h3 { font-size: 1.12rem; margin: 1.6em 0 .5em; }
.prose p { margin-bottom: 1.1em; }
.prose ul, .prose ol { margin: 0 0 1.1em 1.3em; }
.prose li { margin-bottom: .5em; }
.prose strong { color: var(--ink); }
.prose table { width: 100%; border-collapse: collapse; margin: 0 0 1.4em; font-size: .92rem; }
.prose th, .prose td { text-align: left; padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.prose th { font-size: .78rem; letter-spacing: .06em; text-transform: uppercase; color: var(--text-mute); }
.prose .tablewrap { overflow-x: auto; }
.callout { padding: 20px 24px; margin: 28px 0; border-radius: 14px; background: var(--accent-soft); border-left: 3px solid var(--accent); }
.callout p:last-child, .callout ul:last-child { margin-bottom: 0; }
.callout.plain { background: var(--positive-soft); border-left-color: var(--positive); }
.callout.warn { background: var(--critical-soft); border-left-color: var(--critical); }
.callout .tag { display: block; font-size: .72rem; font-weight: 700; letter-spacing: .14em; text-transform: uppercase; color: var(--accent-deep); margin-bottom: 8px; }
@media (prefers-color-scheme: dark) { .callout .tag { color: var(--accent); } }
.callout.plain .tag { color: var(--positive); }
.callout.warn .tag { color: var(--critical); }
.toc { margin: 0 0 34px; padding: 16px 18px; background: var(--surface); border: 1px solid var(--line); border-radius: 12px; }
.toc summary { font-weight: 700; cursor: pointer; color: var(--ink); font-size: .9rem; letter-spacing: .03em; }
.toc ol { margin: 14px 0 0 1.3em; columns: 2; column-gap: 26px; }
.toc li { margin-bottom: 7px; break-inside: avoid; }
.toc a { font-size: .9rem; color: var(--text-soft); }
.toc a:hover { color: var(--accent-deep); }
@media (max-width: 560px) { .toc ol { columns: 1; } }
.to-top { display: inline-block; margin-top: 8px; font-size: .84rem; color: var(--text-mute); }
.to-top:hover { color: var(--accent-deep); }

/* Support: FAQ + contact */
.support-wrap { max-width: var(--prose); margin: 0 auto; padding: 84px 20px 72px; }
.support-wrap > h1 { font-size: clamp(2rem, 1.6rem + 1.6vw, 2.6rem); }
.support-wrap > .lede { color: var(--text-soft); margin: 8px 0 42px; font-size: 1.04rem; }
.faq { margin-bottom: 56px; }
.faq h2, .contact h2 { font-size: 1.55rem; margin-bottom: 16px; }
.faq details { border-bottom: 1px solid var(--line); }
.faq details[open] { border-left: 2px solid var(--accent); padding-left: 16px; margin-left: -2px; }
.faq summary { list-style: none; cursor: pointer; padding: 17px 0; font-weight: 600; color: var(--text); display: flex; justify-content: space-between; align-items: center; gap: 16px; min-height: 44px; }
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: '+'; color: var(--accent-deep); font-size: 1.3rem; font-weight: 400; transition: transform .2s ease; flex: none; }
@media (prefers-color-scheme: dark) { .faq summary::after { color: var(--accent); } }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq details p { font-size: .95rem; color: var(--text-soft); padding-bottom: 17px; }
.faq details p:first-of-type { padding-top: 2px; }

.contact { border-top: 1px solid var(--line); padding-top: 40px; }
.contact > p { color: var(--text-soft); margin-bottom: 22px; }
.contact-form { display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field label { font-size: .86rem; font-weight: 600; color: var(--text-soft); }
.field input, .field select, .field textarea {
  font-family: var(--sans); font-size: 16px; color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 11px; padding: 12px 14px; min-height: 48px;
  transition: border-color .15s ease;
}
.field textarea { min-height: 140px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; }
.field select {
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg width='12' height='8' viewBox='0 0 12 8' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M1 1l5 5 5-5' stroke='%237776EC' stroke-width='1.5' fill='none' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 14px center; padding-right: 34px;
}
.form-actions { display: flex; flex-wrap: wrap; gap: 12px; align-items: center; }
.form-actions .btn { flex: 1 1 auto; }
.copy-btn { background: none; border: 1px solid var(--line); color: var(--text-soft); border-radius: 999px; min-height: 48px; padding: 0 18px; font-size: .88rem; font-weight: 600; cursor: pointer; font-family: var(--sans); transition: border-color .15s ease, color .15s ease; }
.copy-btn:hover { border-color: var(--accent); color: var(--ink); }
.form-hint { font-size: .82rem; color: var(--text-mute); margin-top: 4px; }
.toast { position: fixed; left: 50%; bottom: 96px; transform: translateX(-50%) translateY(20px); background: var(--surface); border: 1px solid var(--accent); color: var(--ink); padding: 11px 20px; border-radius: 999px; font-size: .9rem; font-weight: 600; box-shadow: var(--shadow-2); opacity: 0; pointer-events: none; transition: opacity .2s ease, transform .2s ease; z-index: 400; }
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.noscript-contact { padding: 16px 18px; border-radius: 12px; background: var(--surface); border: 1px solid var(--line); margin-top: 18px; color: var(--text-soft); font-size: .92rem; }

/* ============================================================
   STICKY INSTALL BANNER
   ------------------------------------------------------------
   A native-feeling "Install now" bar, fixed to the bottom.
   Safari on iOS also gets Apple's real Smart App Banner from the
   apple-itunes-app meta; main.js hides this custom one there so
   the two never stack. Dismissal is remembered in localStorage.
   ============================================================ */
.install-bar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 300;
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  padding-left: max(14px, env(safe-area-inset-left));
  padding-right: max(14px, env(safe-area-inset-right));
  padding-bottom: max(10px, env(safe-area-inset-bottom));
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: blur(16px) saturate(1.3); -webkit-backdrop-filter: blur(16px) saturate(1.3);
  border-top: 1px solid var(--line);
  box-shadow: 0 -8px 30px rgba(28,25,18,0.12);
  transform: translateY(110%);
  transition: transform .35s cubic-bezier(.16,1,.3,1);
}
.install-bar.show { transform: translateY(0); }
.install-bar .ib-icon { width: 44px; height: 44px; border-radius: 22%; flex: none; box-shadow: var(--shadow-1); }
.install-bar .ib-txt { display: flex; flex-direction: column; line-height: 1.3; min-width: 0; flex: 1; }
.install-bar .ib-txt b { font-size: .92rem; color: var(--ink); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-bar .ib-txt span { font-size: .76rem; color: var(--text-mute); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.install-bar .ib-btn {
  flex: none; display: inline-flex; align-items: center; justify-content: center;
  min-height: 40px; padding: 8px 22px; border-radius: 999px;
  font-size: .9rem; font-weight: 700; color: var(--on-accent);
  background: linear-gradient(180deg, var(--accent), var(--accent-deep));
  box-shadow: 0 1px 0 rgba(255,255,255,0.25) inset, 0 5px 14px rgba(119,118,236,0.3);
  transition: transform .14s ease, filter .14s ease;
}
.install-bar .ib-btn:hover { transform: translateY(-1px); filter: brightness(1.05); color: var(--on-accent); }
.install-bar .ib-close {
  flex: none; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center;
  background: none; border: 0; color: var(--text-mute); font-size: 1.25rem; line-height: 1;
  cursor: pointer; transition: background .15s ease, color .15s ease;
}
.install-bar .ib-close:hover { background: var(--recessed); color: var(--ink); }
@media (prefers-color-scheme: dark) {
  .install-bar { box-shadow: 0 -8px 30px rgba(0,0,0,0.5); }
}

/* ============================================================
   404
   ============================================================ */
.notfound { min-height: 76vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; padding: 40px 24px; }
.notfound .big { font-size: clamp(3.4rem, 2.6rem + 6vw, 6rem); font-weight: 800; letter-spacing: -.02em; color: var(--accent); line-height: 1; }
.notfound .sub { color: var(--text-soft); margin: 14px 0 30px; max-width: 420px; }

/* ============================================================
   Reveal + reduced motion + forced colors + print
   ------------------------------------------------------------
   Progressive enhancement: content is visible by default; the
   hidden pre-reveal state applies only under html.js.
   ============================================================ */
.js .reveal { opacity: 0; transform: translateY(22px); transition: opacity .6s ease, transform .6s ease; }
.js .reveal.in { opacity: 1; transform: none; }
.js .reveal.d1 { transition-delay: .06s; } .js .reveal.d2 { transition-delay: .14s; } .js .reveal.d3 { transition-delay: .22s; }
.js .reveal.d4 { transition-delay: .30s; } .js .reveal.d5 { transition-delay: .38s; } .js .reveal.d6 { transition-delay: .46s; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
  .js .reveal { opacity: 1; transform: none; }
  .install-bar { transition: none; }
}

@media (forced-colors: active) {
  .btn, .appstore, .nav-cta, .fcard, .placard, .acard, .install-bar, .med-chip { border: 1px solid CanvasText; }
  .fcard .ico { forced-color-adjust: none; }
}

@media print {
  html, body { background: #fff; color: #111; }
  .nav, .footer, .to-top, .toc, .skip-link, .install-bar, .cta-panel, .related { display: none; }
  .prose, .article-wrap { max-width: 100%; padding: 0; color: #111; }
  .prose h1, .prose h2, .prose h3, .prose strong { color: #000; }
  a { color: #000; text-decoration: underline; }
  .callout { border: 1px solid #999; background: #f6f6f6; }
}
