/* Vivid — landing + policy.
 *
 * Every colour here is lifted from src/theme/tokens.ts. Nothing is invented: the site and the app
 * are the same product and must read as the same product. If a token changes there, change it here.
 *
 * The hero band is deliberately single-theme — always the dark, warm grade. It sits over a
 * photograph, and a photograph reads best against one consistent treatment; a light-mode variant
 * would mean either washing out the image or putting dark text on a bright sunny sky. Everything
 * below the hero follows the visitor's theme.
 */

:root {
  /* light — tokens.ts `light` */
  --ink: #ede0d1;
  --surface: #f8f1e7;
  --raised: #fffbf5;
  --line: #dcc7ae;
  --fg: #33241a;
  --mut: #6e5744;
  --dim: #8b7660;
  --sand: #845b33;
  --clay: #7a4b2f;
  --moss: #4e5530;
  --shadow: rgba(89, 62, 46, 0.13);
}

@media (prefers-color-scheme: dark) {
  :root {
    /* dark — tokens.ts `dark` */
    --ink: #16100d;
    --surface: #211811;
    --raised: #2c2019;
    --line: #3a2a20;
    --fg: #f2e6d8;
    --mut: #a6907a;
    --dim: #84705d;
    --sand: #bf9b7a;
    --clay: #c4714a;
    --moss: #9da65e;
    --shadow: rgba(0, 0, 0, 0.45);
  }
}

/* Typefaces, from tokens.ts `typography`.
 *
 *   ui:   { fontFamily: 'System' }   → SF Pro on Apple platforms
 *   mono: { fontFamily: 'Menlo', fontVariant: ['tabular-nums'] }
 *
 * Menlo leads the mono stack because that is what the token names. React Native needs a concrete
 * family, and Menlo is the monospace iOS actually ships; `ui-monospace` would resolve to SF Mono,
 * a different face. The rest of the stack is fallback for platforms without Menlo.
 *
 * Note the divergence: prototipo-dashboard.html declares --mono with SF Mono ahead of Menlo, so the
 * screenshots rendered from it are set in SF Mono. tokens.ts wins here, being the app's own token.
 */
:root {
  --ui: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  --mono: Menlo, ui-monospace, "SF Mono", SFMono-Regular, Consolas, monospace;
}

/* The hero grade. Fixed values, not tokens — see the note at the top. */
:root {
  --hero-ink: #16100d;
  --hero-fg: #f2e6d8;
  --hero-mut: #c3ad96;
  --hero-dim: #9a8570;
  --hero-line: rgba(242, 230, 216, 0.16);
  --hero-sand: #bf9b7a;
}

* { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { animation: none !important; transition: none !important; }
}

body {
  margin: 0;
  background: var(--ink);
  color: var(--fg);
  font: 16px/1.65 var(--ui);
}

img { max-width: 100%; display: block; }
a { color: var(--clay); }

/* The app's signature typographic device: a tiny uppercase mono label above the thing it names.
 * tokens.ts `typography.label` — 9px, 1.1 letter-spacing, uppercase. Scaled up for the web. */
.eyebrow {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.6rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--dim);
  margin: 0;
}

.shell { width: 100%; max-width: 68rem; margin: 0 auto; padding: 0 24px; }

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

.hero {
  position: relative;
  isolation: isolate;
  background: var(--hero-ink);
  color: var(--hero-fg);
  overflow: hidden;
  padding: 88px 0 0;
}

.hero__photo {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 62% 32%;
  z-index: -2;
}

/* Two scrims rather than one: a vertical grade that lands on solid --hero-ink at the bottom so the
 * section joins the next one with no seam, and a horizontal one so the headline always has a dark
 * field under it regardless of how the photo crops at that viewport width. */
.hero__scrim {
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(105deg, rgba(22, 16, 13, 0.82) 0%, rgba(22, 16, 13, 0.72) 36%, rgba(22, 16, 13, 0.18) 50%, rgba(22, 16, 13, 0.26) 70%),
    linear-gradient(to bottom, rgba(22, 16, 13, 0.32) 0%, rgba(22, 16, 13, 0.02) 26%, rgba(22, 16, 13, 0.35) 50%, rgba(22, 16, 13, 0.7) 88%, #16100d 100%);
}

.hero__bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding-bottom: 64px;
}

/* The wordmark IS the brand mark — the app ships no logo asset. Matches BrandSplash.tsx: caps,
 * weight 700, wide tracking (30px type on 7px letter-spacing = 0.23em), in the sand colour. */
.brand {
  font-family: var(--ui);
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: 0.23em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--sand);
  /* letter-spacing adds a trailing gap after the last letter; pull it back so the mark sits flush. */
  margin-right: -0.23em;
}

.hero__bar .eyebrow { color: var(--hero-dim); white-space: nowrap; }
.hero .brand { color: var(--hero-sand); }

.hero__grid {
  display: grid;
  grid-template-columns: minmax(0, 1.05fr) minmax(0, 0.95fr);
  align-items: end;
  gap: 48px;
}

/* Centred against the device column rather than bottom-aligned. Bottom-aligning left ~350px of
 * dead scrim above the headline on a desktop viewport, because the row is as tall as the phone. */
.hero__copy { align-self: center; padding: 40px 0 96px; max-width: 34rem; }
.hero__copy .eyebrow { color: var(--hero-sand); margin-bottom: 20px; }

/* tokens.ts `typography.hero` — 42 / 800 / -1.5 tracking. */
.hero h1 {
  font-size: clamp(2.4rem, 6vw, 4rem);
  line-height: 1.02;
  font-weight: 800;
  letter-spacing: -0.038em;
  margin: 0 0 24px;
  text-wrap: balance;
}

.hero p {
  font-size: 1.08rem;
  line-height: 1.6;
  color: var(--hero-mut);
  margin: 0 0 36px;
  max-width: 30rem;
}

.hero strong { color: var(--hero-fg); font-weight: 600; }

/* ------------------------------------------------------------ cta badge */

.cta { display: flex; flex-direction: column; align-items: flex-start; gap: 12px; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  padding: 12px 22px 12px 18px;
  border-radius: 14px;
  border: 1px solid var(--hero-line);
  text-decoration: none;
  line-height: 1.15;
}

.badge svg { width: 21px; height: 25px; flex: none; }

.badge__small {
  display: block;
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.6rem;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.badge__big { display: block; font-size: 1.06rem; font-weight: 600; letter-spacing: -0.02em; }

/* Live state — an anchor to the App Store. */
a.badge {
  background: var(--hero-fg);
  color: #16100d;
  border-color: transparent;
  transition: transform 0.16s ease, box-shadow 0.16s ease;
}
a.badge:hover, a.badge:focus-visible { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(0, 0, 0, 0.4); }
a.badge .badge__small { color: rgba(22, 16, 13, 0.62); }

/* Pre-launch state — not an anchor, because there is nowhere to go yet. */
span.badge { background: rgba(242, 230, 216, 0.07); color: var(--hero-fg); cursor: default; }
span.badge .badge__small { color: var(--hero-sand); }

.cta__note { font-size: 0.82rem; color: var(--hero-dim); margin: 0; }

/* ----------------------------------------------------------- the device */

/* The mockup arrives from Figma with its own bezel and frame, so this element contributes no
 * chrome of its own — it used to draw a CSS bezel, which would now sit as a second frame around
 * the first. It is purely a positioning box. */
.device {
  position: relative;
  width: 100%;
  max-width: 320px;
  margin: 0 auto -1px;
  justify-self: center;
  align-self: end;
}

.device img {
  width: 100%;
  /* Load-bearing. The <img> carries width/height attributes so the browser can reserve the right
   * box before the file loads; those attributes also apply as presentational hints, so without
   * height:auto the CSS width fights a fixed attribute height and the screenshot renders stretched.
   * It shipped that way once — 302x852 on a 415x900 image, squeezed 1.3x vertically. */
  height: auto;
  display: block;
  /* drop-shadow, not box-shadow: the mockup is a transparent PNG with rounded corners, and
   * box-shadow would trace its rectangular box — a hard-edged slab behind a rounded phone.
   * drop-shadow follows the alpha channel instead. */
  filter: drop-shadow(0 28px 60px rgba(0, 0, 0, 0.55));
}

/* ------------------------------------------------------- features block */

/* The features band is always light, in both themes — like the hero is always dark. Redefining the
 * tokens on this element rather than hardcoding colours means everything inside (cards, rules,
 * eyebrows) picks the light values up on its own. `color` has to be set explicitly too: body's
 * `color: var(--fg)` is computed at body, and children inherit that computed value rather than
 * re-resolving the variable here. Values are tokens.ts `light`. */
.features {
  --surface: #f8f1e7;
  --raised: #fffbf5;
  --line: #dcc7ae;
  --fg: #33241a;
  --mut: #6e5744;
  --dim: #8b7660;
  --sand: #845b33;
  --clay: #7a4b2f;
  --moss: #4e5530;

  background: var(--surface);
  color: var(--fg);
  border-top: 1px solid var(--line);
  padding: 88px 0 96px;
}

.features__head { max-width: 34rem; margin-bottom: 56px; }
.features__head h2 {
  font-size: clamp(1.6rem, 3.4vw, 2.15rem);
  line-height: 1.15;
  letter-spacing: -0.03em;
  font-weight: 700;
  margin: 14px 0 0;
  text-wrap: balance;
}

.cards { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }

.card {
  background: var(--raised);
  border: 1px solid var(--line);
  border-radius: 18px; /* tokens.ts radii.card */
  padding: 26px 24px 28px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* One rule per palette family — sand, moss, clay. The three features are different domains, not
 * steps in a sequence, so they get distinct colours rather than 01 / 02 / 03. */
.card::before { content: ""; display: block; width: 34px; height: 3px; border-radius: 2px; }
.card--import::before { background: var(--sand); }
.card--goals::before { background: var(--moss); }
.card--secure::before { background: var(--clay); }

.card h3 { font-size: 1.12rem; font-weight: 600; letter-spacing: -0.02em; margin: 0; text-wrap: balance; }
.card p { margin: 0; color: var(--mut); font-size: 0.94rem; line-height: 1.62; }
.card .eyebrow { margin-bottom: -4px; }
.card--import .eyebrow { color: var(--sand); }
.card--goals .eyebrow { color: var(--moss); }
.card--secure .eyebrow { color: var(--clay); }

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

.foot { background: var(--ink); border-top: 1px solid var(--line); padding: 44px 0 56px; }

.foot__row {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px 32px;
}

.foot nav { display: flex; flex-wrap: wrap; gap: 8px 26px; }
/* Scoped to nav and fine print on purpose. A bare `.foot a` also matches the brand lockup, which
 * is an <a>, and drew an underline rule across the logo. */
.foot nav a, .foot__fine a { color: var(--mut); text-decoration: none; border-bottom: 1px solid var(--line); padding-bottom: 2px; }
.foot nav a:hover, .foot nav a:focus-visible,
.foot__fine a:hover, .foot__fine a:focus-visible { color: var(--fg); border-color: currentColor; }
.foot .brand { color: var(--sand); text-decoration: none; }
.foot__fine { margin: 28px 0 0; font-size: 0.78rem; color: var(--dim); line-height: 1.7; }

/* ------------------------------------------------------------ policy page */

.doc { background: var(--ink); padding: 0 0 24px; }
.doc__bar { padding: 22px 0; border-bottom: 1px solid var(--line); }
.doc__bar .shell { display: flex; align-items: center; justify-content: space-between; gap: 16px; }
.doc__bar .brand { color: var(--sand); }

.back {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  text-decoration: none;
  color: var(--mut);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 8px 16px;
  white-space: nowrap;
}
.back:hover, .back:focus-visible { color: var(--fg); border-color: var(--sand); }

.doc main { max-width: 42rem; margin: 0 auto; padding: 0 24px 72px; }
.doc header { padding: 56px 0 32px; border-bottom: 1px solid var(--line); margin-bottom: 32px; }
/* Headings need their own line-height. Inheriting the body's 1.65 opens a gap wide enough to read
 * as two separate headings when a title wraps. */
.doc h1 { font-size: 1.75rem; line-height: 1.22; margin: 0 0 10px; letter-spacing: -0.025em; text-wrap: balance; }
.doc h2 {
  font-size: 1.15rem; line-height: 1.3; margin: 40px 0 12px; letter-spacing: -0.015em;
  padding-top: 24px; border-top: 1px solid var(--line);
}
.doc h2:first-of-type { border-top: none; padding-top: 0; }
.doc h3 { font-size: 0.95rem; line-height: 1.4; margin: 24px 0 8px; color: var(--mut); }
.doc p, .doc li { color: var(--mut); }
.doc strong { color: var(--fg); }
.doc .meta { font-size: 0.85rem; color: var(--dim); margin: 0; }
.doc .lede {
  background: var(--surface); border: 1px solid var(--line); border-left: 3px solid var(--clay);
  border-radius: 10px; padding: 16px 18px; margin: 0 0 8px;
}
.doc .lede p { margin: 0; color: var(--fg); }
.doc table { width: 100%; border-collapse: collapse; margin: 16px 0; font-size: 0.9rem; }
.doc th, .doc td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
.doc th { color: var(--fg); font-weight: 600; }
.doc td { color: var(--mut); }
.doc .wrap { overflow-x: auto; }
.doc .aside { font-size: 0.85rem; color: var(--dim); }
.doc code { background: var(--surface); padding: 2px 6px; border-radius: 5px; font-size: 0.9em; }
.doc footer { margin-top: 56px; padding-top: 24px; border-top: 1px solid var(--line); font-size: 0.85rem; color: var(--dim); }

/* --------------------------------------------------------------- focus */

:focus-visible { outline: 2px solid var(--sand); outline-offset: 3px; border-radius: 4px; }
.hero :focus-visible { outline-color: var(--hero-sand); }

/* -------------------------------------------------------------- narrow */

@media (max-width: 900px) {
  /* One column means the copy now spans the full frame, including the bright half of the photo the
   * horizontal gradient was there to leave alone. Replace it with a straight vertical grade: dark
   * behind the text, opening up around the device. */
  .hero__scrim {
    background: linear-gradient(
      to bottom,
      rgba(22, 16, 13, 0.88) 0%,
      rgba(22, 16, 13, 0.76) 30%,
      rgba(22, 16, 13, 0.46) 52%,
      rgba(22, 16, 13, 0.62) 84%,
      #16100d 100%
    );
  }

  .cards { grid-template-columns: 1fr; }
  .hero__grid { grid-template-columns: 1fr; gap: 8px; }
  .hero__copy { padding: 0 0 8px; max-width: none; }
  .hero__bar { padding-bottom: 44px; }
  .hero { padding-top: 44px; }
  .device { max-width: 268px; }
}

@media (max-width: 560px) {
  .shell { padding: 0 20px; }
  .features { padding: 64px 0 72px; }
  .features__head { margin-bottom: 36px; }
  .hero__bar .eyebrow { display: none; }
}
