/* ============================================================================
   Rx101 — Showcase landing page
   "The Apothecary Vault" — deep-forest + champagne-gold, mirroring the app's
   brand tokens (src/theme/brand.ts, colors.ts, darkColors.ts).
   ========================================================================== */

/* ---- Fonts ----------------------------------------------------------------
   Hanken Grotesk — the app's own typeface (src/assets/fonts). Self-hosted,
   subset to Latin + typographic punctuation. No CDN. */
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 400;
  font-display: swap; src: url("assets/fonts/HankenGrotesk-Regular.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 600;
  font-display: swap; src: url("assets/fonts/HankenGrotesk-SemiBold.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 700;
  font-display: swap; src: url("assets/fonts/HankenGrotesk-Bold.woff2") format("woff2");
}
@font-face {
  font-family: "Hanken Grotesk"; font-style: normal; font-weight: 800;
  font-display: swap; src: url("assets/fonts/HankenGrotesk-ExtraBold.woff2") format("woff2");
}

/* ---- Tokens ---------------------------------------------------------------
   Ported 1:1 from the app palette. Style everything through these vars so the
   light/dark themes stay in sync with the product. */
:root {
  /* Grounds */
  --ink:        #08130C;   /* near-black forest — hero + vault ground */
  --ink-2:      #123024;
  --forest:     #0E3A26;
  --paper:      #F4F7F5;   /* page bg (tint 2) */
  --surface:    #FFFFFF;
  --surface-alt:#EDF4EF;

  /* Brand green */
  --primary:      #2E7D52;
  --primary-dark: #1B5038;
  --primary-tint: #D4EDE0;

  /* Champagne gold — the single accent */
  --gold:       #B08A2E;   /* icons / borders / large accents on light */
  --gold-text:  #8A6B1E;   /* readable gold text on light (WCAG AA) */
  --gold-soft:  #F7EFD8;   /* pale champagne fill */
  --gold-border:#E4D3A0;
  --gold-on-dark:      #EBD9A6;  /* champagne on dark ground */
  --gold-on-dark-deep: #D8BC77;

  /* Text — forest hierarchy */
  --text:      #0F2D1A;
  --text-2:    #2D5C3A;
  --text-3:    #5C8A64;
  --on-ink:    #EAF3EC;    /* text on the dark ground */
  --on-ink-2:  #A7C6B2;

  /* Lines */
  --border:      #DCE8E0;
  --border-strong:#B7D4C2;
  --hairline-gold: rgba(235, 217, 166, 0.32);

  /* Type roles — one family, differentiated by weight, case & spacing (as the
     app does). `--serif` / `--mono` names kept so the cascade below is stable. */
  --sans:  "Hanken Grotesk", system-ui, -apple-system, "Segoe UI", Roboto,
           Helvetica, Arial, sans-serif;
  --serif: var(--sans);  /* display headings — set heavy weights, not a serif */
  --mono:  var(--sans);  /* labels/eyebrows — set uppercase + letter-spacing */

  /* Rhythm (8pt) */
  --sp-1: 8px;  --sp-2: 16px; --sp-3: 24px; --sp-4: 32px;
  --sp-5: 48px; --sp-6: 64px; --sp-7: 96px; --sp-8: 128px;
  --radius:   18px;
  --radius-lg:28px;

  --shadow: 0 1px 2px rgba(15, 45, 26, .06), 0 12px 32px -12px rgba(15, 45, 26, .18);
  --maxw: 1120px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --ink:        #05100A;
    --ink-2:      #0E241A;
    --forest:     #0E3A26;
    --paper:      #0A160F;
    --surface:    #111F17;
    --surface-alt:#152317;
    --primary:      #4CAF78;
    --primary-dark: #2E4D38;
    --primary-tint: #1B3A2A;
    --gold:       #EBD9A6;
    --gold-text:  #EBD9A6;
    --gold-soft:  #2A2414;
    --gold-border:#4A3F22;
    --text:      #E8F5E9;
    --text-2:    #A5D6A7;
    --text-3:    #6E9B78;
    --on-ink:    #EAF3EC;
    --on-ink-2:  #A7C6B2;
    --border:      #233A2C;
    --border-strong:#365446;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.6);
  }
}
/* Explicit toggle overrides (viewer's theme switch stamps data-theme) */
:root[data-theme="light"] {
  --ink:#08130C; --ink-2:#123024; --paper:#F4F7F5; --surface:#FFFFFF;
  --surface-alt:#EDF4EF; --primary:#2E7D52; --primary-dark:#1B5038;
  --primary-tint:#D4EDE0; --gold:#B08A2E; --gold-text:#8A6B1E; --gold-soft:#F7EFD8;
  --gold-border:#E4D3A0; --text:#0F2D1A; --text-2:#2D5C3A; --text-3:#5C8A64;
  --border:#DCE8E0; --border-strong:#B7D4C2;
  --shadow: 0 1px 2px rgba(15,45,26,.06), 0 12px 32px -12px rgba(15,45,26,.18);
}
:root[data-theme="dark"] {
  --ink:#05100A; --ink-2:#0E241A; --paper:#0A160F; --surface:#111F17;
  --surface-alt:#152317; --primary:#4CAF78; --primary-dark:#2E4D38;
  --primary-tint:#1B3A2A; --gold:#EBD9A6; --gold-text:#EBD9A6; --gold-soft:#2A2414;
  --gold-border:#4A3F22; --text:#E8F5E9; --text-2:#A5D6A7; --text-3:#6E9B78;
  --border:#233A2C; --border-strong:#365446;
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 18px 40px -16px rgba(0,0,0,.6);
}

/* ---- Base ----------------------------------------------------------------- */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--sans);
  color: var(--text);
  background: var(--paper);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img, svg { max-width: 100%; display: block; }
a { color: inherit; }

.wrap { width: 100%; max-width: var(--maxw); margin-inline: auto; padding-inline: var(--sp-3); }

.eyebrow {
  font-family: var(--mono);
  font-size: .72rem;
  letter-spacing: .22em;
  text-transform: uppercase;
  color: var(--gold-text);
  margin: 0 0 var(--sp-2);
  display: inline-flex;
  align-items: center;
  gap: .6em;
}
.eyebrow::before {
  content: "";
  width: 22px; height: 1px;
  background: var(--gold);
}
h1, h2, h3 { font-family: var(--serif); font-weight: 800; text-wrap: balance; letter-spacing: -.022em; }

/* ---- Nav ------------------------------------------------------------------ */
.nav {
  position: sticky; top: 0; z-index: 50;
  background: color-mix(in srgb, var(--paper) 82%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
}
.nav__inner { display: flex; align-items: center; justify-content: space-between; height: 64px; }
.brand { display: inline-flex; align-items: center; gap: 12px; text-decoration: none; }
.brand__mark { width: 34px; height: 34px; border-radius: 9px; flex: none; }
.brand__word { font-family: var(--serif); font-size: 1.28rem; font-weight: 600; letter-spacing: -.01em; color: var(--text); }
.brand__word b { color: var(--primary); font-weight: 600; }
.brand__word i { font-style: normal; font-weight: 600; color: var(--text-3); margin-left: .34em; letter-spacing: .005em; }
.nav__links { display: flex; align-items: center; gap: var(--sp-3); }
.nav__links a { font-size: .92rem; text-decoration: none; color: var(--text-2); transition: color .2s; }
.nav__links a:hover { color: var(--text); }
.theme-toggle {
  border: 1px solid var(--border-strong); background: transparent; color: var(--text-2);
  width: 38px; height: 38px; border-radius: 10px; cursor: pointer; font-size: 1rem;
  display: inline-grid; place-items: center; transition: border-color .2s, color .2s;
}
.theme-toggle:hover { color: var(--text); border-color: var(--gold); }
@media (max-width: 720px) { .nav__links a:not(.theme-toggle) { display: none; } }

/* ---- Hero (the vault) ----------------------------------------------------- */
.hero {
  position: relative;
  background:
    radial-gradient(120% 90% at 78% 8%, rgba(235,217,166,.10), transparent 55%),
    linear-gradient(180deg, var(--ink-2), var(--ink) 62%);
  color: var(--on-ink);
  overflow: hidden;
  isolation: isolate;
}
/* champagne hairline inset frame — echoes the app icon */
.hero::before {
  content: "";
  position: absolute; inset: 18px;
  border: 1px solid var(--hairline-gold);
  border-radius: 34px;
  pointer-events: none;
  z-index: 0;
}
.hero__grid {
  position: relative; z-index: 1;
  display: grid; grid-template-columns: 1.05fr .95fr; gap: var(--sp-6);
  align-items: center;
  padding-block: var(--sp-8) var(--sp-7);
}
.hero .eyebrow { color: var(--gold-on-dark); }
.hero .eyebrow::before { background: var(--gold-on-dark); }
.hero h1 {
  font-size: clamp(2.5rem, 5.4vw, 4.1rem);
  line-height: 1.04; margin: 0 0 var(--sp-3); color: #fff;
}
.hero h1 .g { color: var(--gold-on-dark); }
.hero__sub { font-size: clamp(1.02rem, 1.6vw, 1.18rem); color: var(--on-ink-2); max-width: 33ch; margin: 0 0 var(--sp-4); }
.hero__meta { display: flex; flex-wrap: wrap; gap: var(--sp-1) var(--sp-3); font-family: var(--mono); font-size: .74rem; letter-spacing: .1em; text-transform: uppercase; color: var(--on-ink-2); }
.hero__meta span { display: inline-flex; align-items: center; gap: .5em; }
.hero__meta span::before { content: ""; width: 5px; height: 5px; border-radius: 50%; background: var(--gold-on-dark); }

/* Device frame — the screenshots already carry their own bezel, so we just
   float them with a soft shadow and a faint champagne halo behind. */
.device { margin: 0; position: relative; }
.device img { width: 100%; height: auto; border-radius: 30px; display: block; }
.device--hero {
  width: min(300px, 82%); margin-inline: auto;
}
.device--hero::before {
  content: ""; position: absolute; inset: -8% -12% -4%;
  background: radial-gradient(60% 55% at 50% 30%, rgba(235,217,166,.22), transparent 70%);
  z-index: -1; filter: blur(6px);
}
.device--hero img {
  box-shadow: 0 44px 100px -34px rgba(0,0,0,.7), 0 0 0 1px rgba(235,217,166,.14);
}

@media (max-width: 900px) {
  .hero__grid { grid-template-columns: 1fr; gap: var(--sp-5); padding-block: var(--sp-6) var(--sp-6); text-align: center; }
  .hero .eyebrow, .hero__sub { margin-inline: auto; }
  .hero__meta { justify-content: center; }
  .hero::before { inset: 10px; border-radius: 24px; }
}

/* ---- Section shell -------------------------------------------------------- */
.section { padding-block: var(--sp-7); }
.section__head { max-width: 60ch; margin: 0 0 var(--sp-5); }
.section__head h2 { font-size: clamp(1.8rem, 3.4vw, 2.6rem); margin: 0 0 var(--sp-2); color: var(--text); line-height: 1.1; }
.section__head p { font-size: 1.08rem; color: var(--text-2); margin: 0; }

/* ---- Features grid -------------------------------------------------------- */
.features { background: var(--paper); }
.grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-2); }
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  padding: var(--sp-3); box-shadow: var(--shadow);
  transition: transform .3s cubic-bezier(.2,.7,.2,1), border-color .3s;
}
.card:hover { transform: translateY(-4px); border-color: var(--gold-border); }
.card__icon {
  width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center;
  background: var(--primary-tint); color: var(--primary); margin-bottom: var(--sp-2);
}
.card--gold .card__icon { background: var(--gold-soft); color: var(--gold-text); }
.card__icon svg { width: 22px; height: 22px; }
.card h3 { font-size: 1.1rem; margin: 0 0 6px; color: var(--text); font-family: var(--sans); font-weight: 700; letter-spacing: 0; }
.card p { font-size: .92rem; color: var(--text-2); margin: 0; line-height: 1.55; }
.card__tag { display: inline-block; margin-top: var(--sp-2); font-family: var(--mono); font-size: .64rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-text); }
.grid--span2 { grid-column: span 2; }
@media (max-width: 900px) { .grid { grid-template-columns: repeat(2, 1fr); } .grid--span2 { grid-column: span 2; } }
@media (max-width: 560px) { .grid { grid-template-columns: 1fr; } .grid--span2 { grid-column: span 1; } }

/* ---- Everything (capabilities) -------------------------------------------- */
.capabilities { background: var(--surface-alt); }
.cap-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--sp-5) var(--sp-3); }
.cap-group__title {
  display: flex; align-items: center; gap: 10px; margin: 0 0 var(--sp-3);
  padding-bottom: var(--sp-2); border-bottom: 1px solid var(--border);
  font-family: var(--sans); font-size: 1.02rem; font-weight: 800;
  letter-spacing: -.01em; color: var(--text);
}
.cap-group__ic {
  width: 30px; height: 30px; border-radius: 9px; flex: none;
  background: var(--primary-tint); color: var(--primary);
  display: grid; place-items: center;
}
.cap-group__ic svg { width: 17px; height: 17px; }
.cap-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-2); }
.cap-list li { display: flex; flex-direction: column; gap: 1px; }
.cap-list b { font-size: .95rem; font-weight: 700; color: var(--text); }
.cap-list span { font-size: .82rem; color: var(--text-3); line-height: 1.4; }
@media (max-width: 900px) { .cap-grid { grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); } }
@media (max-width: 520px) { .cap-grid { grid-template-columns: 1fr; } }

/* ---- Inside the app (screens gallery) ------------------------------------- */
.screens { background: var(--paper); }
.screens__row { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-5); align-items: start; }
.screens__row .device { max-width: 300px; margin-inline: auto; }
.screens__row .device img {
  box-shadow: 0 30px 64px -30px rgba(15,45,26,.5), 0 0 0 1px rgba(15,45,26,.06);
  transition: transform .35s cubic-bezier(.2,.7,.2,1);
}
.screens__row .device:hover img { transform: translateY(-6px); }
.screens figcaption { margin-top: var(--sp-3); text-align: center; color: var(--text-2); font-size: .92rem; line-height: 1.5; }
.screens figcaption b { display: block; font-family: var(--sans); color: var(--text); font-size: 1.02rem; margin-bottom: 4px; }
@media (max-width: 860px) {
  .screens__row { grid-template-columns: repeat(2, 1fr); gap: var(--sp-4); }
  .screens__row .device:last-child { grid-column: 1 / -1; }
}
@media (max-width: 560px) { .screens__row { grid-template-columns: 1fr; } .screens__row .device:last-child { grid-column: auto; } }

/* ---- Story (founder's letter) --------------------------------------------- */
.story { background: var(--gold-soft); position: relative; }
.story__inner { max-width: 640px; margin-inline: auto; text-align: center; }
.story__mark { display: block; font-size: 4.5rem; line-height: 1; height: 2.6rem; color: var(--gold); font-weight: 800; }
.story .eyebrow { color: var(--gold-text); }
.story .eyebrow::before { background: var(--gold); }
.story h2 { color: var(--text); font-size: clamp(1.9rem, 4vw, 2.7rem); margin: 0 0 var(--sp-4); }
.story__body { display: flex; flex-direction: column; gap: var(--sp-3); text-align: left; }
.story__body p { font-size: 1.12rem; line-height: 1.72; color: var(--text-2); margin: 0; }
.story__body b { color: var(--text); font-weight: 700; }
.story__pull { font-size: clamp(1.35rem, 3vw, 1.85rem); font-weight: 800; letter-spacing: -.02em; color: var(--primary); margin: var(--sp-5) 0 var(--sp-2); text-wrap: balance; }
.story__sign { font-size: 1.05rem; color: var(--text-2); margin: 0 0 var(--sp-4); }
.story__origin {
  display: inline-flex; align-items: center; gap: .55em;
  font-family: var(--mono); font-size: .74rem; font-weight: 600;
  letter-spacing: .14em; text-transform: uppercase; color: var(--gold-text);
  border: 1px solid var(--gold-border); border-radius: 999px; padding: .6em 1.2em;
  background: color-mix(in srgb, var(--surface) 55%, transparent);
}
.story__origin svg { width: 15px; height: 15px; color: var(--gold); flex: none; }

/* ---- Privacy vault -------------------------------------------------------- */
.vault {
  position: relative;
  background:
    radial-gradient(100% 80% at 20% 0%, rgba(235,217,166,.08), transparent 55%),
    linear-gradient(180deg, var(--ink), var(--ink-2));
  color: var(--on-ink);
  overflow: hidden; isolation: isolate;
}
.vault::before {
  content: ""; position: absolute; inset: 20px; border: 1px solid var(--hairline-gold);
  border-radius: 32px; pointer-events: none;
}
.vault .wrap { position: relative; z-index: 1; }
.vault .section__head h2 { color: #fff; }
.vault .eyebrow { color: var(--gold-on-dark); }
.vault .eyebrow::before { background: var(--gold-on-dark); }
.vault__head { display: grid; grid-template-columns: 1.15fr .85fr; gap: var(--sp-3) var(--sp-6); align-items: end; margin-bottom: var(--sp-6); }
.vault__lead { font-size: clamp(2rem, 4.4vw, 3rem); line-height: 1.1; letter-spacing: -.025em; font-weight: 800; color: #fff; margin: var(--sp-2) 0 0; text-wrap: balance; }
.vault__lead em { color: var(--gold-on-dark); font-style: normal; }
.vault__intro { color: var(--on-ink-2); max-width: 46ch; font-size: 1.08rem; line-height: 1.66; margin: 0; padding-bottom: 4px; }
.vault__intro b { color: #fff; font-weight: 700; }
@media (max-width: 820px) { .vault__head { grid-template-columns: 1fr; align-items: start; gap: var(--sp-3); margin-bottom: var(--sp-5); } }
.privacy-list { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-2); list-style: none; padding: 0; margin: 0; }
.privacy-item {
  border: 1px solid rgba(235,217,166,.18); border-radius: var(--radius);
  padding: var(--sp-3); background: rgba(255,255,255,.02);
}
.privacy-item__label { font-family: var(--mono); font-size: .68rem; letter-spacing: .12em; text-transform: uppercase; color: var(--gold-on-dark); display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.privacy-item__label svg { width: 18px; height: 18px; flex: none; }
.privacy-item h3 { font-family: var(--sans); font-weight: 700; font-size: 1.02rem; color: #fff; margin: 0 0 5px; letter-spacing: 0; }
.privacy-item p { font-size: .9rem; color: var(--on-ink-2); margin: 0; line-height: 1.55; }
@media (max-width: 900px) { .privacy-list { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 600px) { .privacy-list { grid-template-columns: 1fr; } }

/* ---- How it works --------------------------------------------------------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--sp-4); counter-reset: step; }
.step { position: relative; padding-top: var(--sp-3); border-top: 1px solid var(--border); }
.step__n { font-family: var(--mono); font-size: .78rem; color: var(--gold-text); letter-spacing: .1em; }
.step h3 { font-family: var(--sans); font-weight: 700; font-size: 1.15rem; margin: 10px 0 6px; color: var(--text); letter-spacing: 0; }
.step p { font-size: .95rem; color: var(--text-2); margin: 0; }
@media (max-width: 760px) { .steps { grid-template-columns: 1fr; gap: var(--sp-3); } }

/* ---- FAQ ------------------------------------------------------------------ */
.faq { display: grid; gap: var(--sp-1); max-width: 760px; }
.faq details { border: 1px solid var(--border); border-radius: 14px; background: var(--surface); overflow: hidden; }
.faq summary {
  cursor: pointer; padding: var(--sp-2) var(--sp-3); font-weight: 600; color: var(--text);
  list-style: none; display: flex; justify-content: space-between; align-items: center; gap: var(--sp-2);
  font-size: 1rem;
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after { content: "+"; font-family: var(--mono); color: var(--gold-text); font-size: 1.3rem; transition: transform .25s; }
.faq details[open] summary::after { transform: rotate(45deg); }
.faq p { padding: 0 var(--sp-3) var(--sp-3); margin: 0; color: var(--text-2); font-size: .95rem; }
.faq p b { color: var(--text); font-weight: 700; }

/* ---- Footer --------------------------------------------------------------- */
.footer { background: var(--ink); color: var(--on-ink-2); padding-block: var(--sp-6) var(--sp-4); }
.footer__grid { display: flex; flex-wrap: wrap; gap: var(--sp-4); justify-content: space-between; align-items: flex-start; }
.footer .brand__word { color: #fff; }
.footer .brand__word b { color: var(--gold-on-dark); }
.footer .brand__word i { color: var(--on-ink-2); }
.footer__tag { max-width: 32ch; margin: var(--sp-2) 0 0; font-size: .9rem; }
.footer__tag b { color: #fff; font-weight: 700; }
.footer__links { display: flex; gap: var(--sp-4); flex-wrap: wrap; }
.footer__col h4 { font-family: var(--mono); font-size: .68rem; letter-spacing: .14em; text-transform: uppercase; color: var(--gold-on-dark); margin: 0 0 var(--sp-2); }
.footer__col a { display: block; text-decoration: none; color: var(--on-ink-2); font-size: .92rem; padding: 3px 0; transition: color .2s; }
.footer__col a:hover { color: #fff; }
.footer__bar { border-top: 1px solid rgba(235,217,166,.14); margin-top: var(--sp-5); padding-top: var(--sp-3); display: flex; justify-content: space-between; flex-wrap: wrap; gap: var(--sp-1); font-size: .8rem; font-family: var(--mono); letter-spacing: .04em; }

/* ---- Motion --------------------------------------------------------------- */
.reveal { opacity: 0; transform: translateY(22px); transition: opacity .7s ease, transform .7s cubic-bezier(.2,.7,.2,1); }
.reveal.in { opacity: 1; transform: none; }
.reveal[data-d="1"] { transition-delay: .08s; }
.reveal[data-d="2"] { transition-delay: .16s; }
.reveal[data-d="3"] { transition-delay: .24s; }

:where(a, button, summary):focus-visible { outline: 2px solid var(--gold); outline-offset: 3px; border-radius: 4px; }

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { opacity: 1; transform: none; transition: none; }
  .card:hover { transform: none; }
  * { animation: none !important; }
}
