/* ═══════════════════════════════════════════════════════════════════
   4D Memory Funnel™ — landing page
   Tokens and structure per design.md. One accent, one radius, light theme.
   ═══════════════════════════════════════════════════════════════════ */

/* ── Fonts ─────────────────────────────────────────────────────────
   Drop the two woff2 files into /fonts. If absent, the stack falls
   back cleanly to system UI / Georgia; nothing breaks.               */
@font-face {
  font-family: 'Figtree';
  src: url('/fonts/figtree.woff2') format('woff2');
  font-weight: 400 800;
  font-display: swap;
}
@font-face {
  font-family: 'Source Serif 4';
  src: url('/fonts/source-serif-4-italic.woff2') format('woff2');
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

/* ── Tokens ────────────────────────────────────────────────────────── */
:root {
  --ink:         #16161A;
  --ink-soft:    #3A3A42;
  --muted:       #6B6B73;
  --paper:       #FBF9F7;
  --surface:     #FFFFFF;
  --accent:      #0F5C57;   /* white on this = 7.81:1 (AAA) */
  --accent-ink:  #0A423E;
  --accent-soft: #E7F0EE;
  --rule:        #E4E0DB;
  --focus:       #0F5C57;
  --radius:      10px;      /* the ONLY radius on the page */

  --f-sans:  'Figtree', ui-sans-serif, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --f-serif: 'Source Serif 4', Georgia, 'Times New Roman', serif;

  --t-body:  clamp(1.0625rem, 0.98rem + 0.40vw, 1.1875rem);
  --t-lead:  clamp(1.1875rem, 1.05rem + 0.65vw, 1.4375rem);
  --t-h3:    clamp(1.25rem,   1.13rem + 0.55vw, 1.5rem);
  --t-h2:    clamp(1.75rem,   1.35rem + 1.85vw, 2.75rem);
  --t-h1:    clamp(2.25rem,   1.60rem + 3.20vw, 4rem);
  --t-micro: 0.8125rem;

  --measure: 65ch;
  --lh-body: 1.6;
  --lh-head: 1.12;

  --pad:  clamp(1.25rem, 0.9rem + 1.6vw, 2rem);
  --gap:  clamp(2.75rem, 2rem + 3.4vw, 5.5rem);
}

/* ── Reset ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
* { margin: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

body {
  background: var(--paper);
  color: var(--ink-soft);
  font-family: var(--f-sans);
  font-size: var(--t-body);
  line-height: var(--lh-body);
  font-weight: 400;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3 { color: var(--ink); line-height: var(--lh-head); font-weight: 800; text-wrap: balance; }
h1 { font-size: var(--t-h1); letter-spacing: -0.02em; }
h2 { font-size: var(--t-h2); letter-spacing: -0.015em; }
h3 { font-size: var(--t-h3); letter-spacing: -0.01em; }
p  { text-wrap: pretty; }
strong { font-weight: 700; color: var(--ink); }
ul, ol { list-style: none; padding: 0; }
svg { display: block; }
table { border-collapse: collapse; width: 100%; }

/* ── Layout ────────────────────────────────────────────────────────── */
.wrap        { width: min(72rem, 100% - 2 * var(--pad)); margin-inline: auto; }
.wrap.narrow { width: min(var(--measure), 100% - 2 * var(--pad)); }
.sec         { padding-block: var(--gap); }
.sec.tinted  { background: var(--accent-soft); }
.center      { text-align: center; }
.accent      { color: var(--accent); }
.quiet       { color: var(--muted); font-weight: 400; }

/* Skip link */
.skip {
  position: absolute; left: -9999px;
  background: var(--accent); color: #fff; padding: .75rem 1rem;
  border-radius: var(--radius); z-index: 100;
}
.skip:focus { left: 1rem; top: 1rem; }

/* ── Icons ─────────────────────────────────────────────────────────── */
.ico    { width: 1.375rem; height: 1.375rem; flex: 0 0 auto; color: var(--accent); }
.ico.lg { width: 1.75rem;  height: 1.75rem;  margin-bottom: .9rem; }

/* ── Buttons ───────────────────────────────────────────────────────── */
.btn, button[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .5rem;
  background: var(--accent);
  color: #fff;                       /* 7.81:1 on --accent */
  font: inherit; font-weight: 700;
  font-size: clamp(1rem, .95rem + .25vw, 1.125rem);
  text-decoration: none;
  padding: 1.05rem 2rem;             /* comfortably over 44px tall */
  min-height: 52px;
  border: 0; border-radius: var(--radius);
  cursor: pointer;
  white-space: nowrap;               /* CTA never wraps */
  transition: background 200ms ease, transform 120ms ease;
}
.btn:hover, button[type="submit"]:hover { background: var(--accent-ink); }
.btn:active, button[type="submit"]:active { transform: translateY(1px); }
button[type="submit"]:disabled { opacity: .6; cursor: progress; }

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

.cta-row { margin-top: 2rem; }
.cta-sub { margin-top: .75rem; color: var(--muted); font-size: var(--t-micro); }

/* ══ §0 HERO ═══════════════════════════════════════════════════════ */
.hero {
  min-height: 100dvh;                /* never 100vh */
  display: flex; align-items: center;
  padding-block: clamp(2.5rem, 2rem + 3vw, 6rem);  /* top pad capped */
  text-align: center;
}
.hero .wrap { max-width: 56rem; }

.eyebrow {                            /* the page's ONLY eyebrow */
  font-size: var(--t-micro); font-weight: 700;
  text-transform: uppercase; letter-spacing: .1em;
  color: var(--accent);
  margin-bottom: 1.5rem;
}
.hero h1 { margin-bottom: 1.5rem; }
.hero h1 em { font-style: normal; color: var(--accent); display: inline-block; }

.deck { font-size: var(--t-lead); color: var(--muted); margin-bottom: 1rem; }
.lead { font-size: var(--t-lead); color: var(--ink-soft); margin-inline: auto; max-width: 46rem; }

.promise {
  display: inline-flex; align-items: center; gap: .75rem;
  text-align: left;
  margin-top: 2.25rem; padding: 1rem 1.4rem;
  background: var(--accent-soft);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  font-size: clamp(.95rem, .9rem + .2vw, 1.0625rem);
  font-weight: 600; color: var(--ink);
}

/* ══ §1 FAST VALUE BAND ════════════════════════════════════════════ */
.band { padding-block: var(--gap); border-top: 1px solid var(--rule); }
.band-lead {
  font-size: var(--t-lead); font-weight: 600; color: var(--accent);
  text-align: center; margin-bottom: 2.5rem;
}
.band-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 2rem; }
.band-grid li { display: flex; flex-direction: column; gap: .75rem; }
.band-grid h3 { font-size: 1.0625rem; font-weight: 600; color: var(--ink); line-height: 1.4; }

/* ══ §2 PROBLEM ════════════════════════════════════════════════════ */
.sec h2 { margin-bottom: 1.75rem; }

.plain li { color: var(--muted); padding-block: .2rem; }
.turn {
  margin-top: 2rem; margin-bottom: 2rem;
  font-weight: 700; color: var(--ink); font-size: var(--t-lead);
}
.chips { display: flex; flex-wrap: wrap; gap: .75rem; margin: 1.25rem 0 2rem; }
.chips li {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: .55rem 1rem;
  color: var(--muted); font-style: italic;
  font-size: .9375rem;
}
.punch { margin-top: 1.25rem; font-size: var(--t-h3); font-weight: 800; color: var(--ink); }

/* ══ §3 MEMORY GAP — the one theme inversion ═══════════════════════ */
.dark { background: var(--ink); color: rgba(251,249,247,.78); }
.dark h2 { color: var(--paper); }
.dark strong { color: var(--paper); }

.story {
  font-family: var(--f-serif); font-style: italic;
  font-size: var(--t-lead); line-height: 1.7;
  max-width: 52ch; color: rgba(251,249,247,.82);
}
.story p { margin-bottom: .35rem; }
.story-turn {
  margin-top: 1.25rem;
  font-size: var(--t-lead); font-weight: 600; color: var(--paper);
}
.diagnosis { margin-top: 2rem; }

.loop { display: flex; flex-wrap: wrap; align-items: stretch; gap: .75rem; margin: 2.25rem 0; }
.loop li {
  position: relative;
  padding: .8rem 1.1rem;
  border: 1px solid rgba(255,255,255,.18);
  border-radius: var(--radius);
  color: var(--paper); font-weight: 600; font-size: .9375rem;
}
/* chevron between steps */
.loop li:not(:last-child)::after {
  content: ""; position: absolute; right: -.72rem; top: 50%;
  width: .45rem; height: .45rem;
  border-top: 2px solid rgba(255,255,255,.35);
  border-right: 2px solid rgba(255,255,255,.35);
  transform: translateY(-50%) rotate(45deg);
}
/* the loop does not close: last step is a dead end */
.loop li.dead {
  border-style: dashed;
  border-color: rgba(255,255,255,.3);
  color: rgba(251,249,247,.55);
}
.dark .punch { color: var(--paper); }
.bridge { margin-top: 1.25rem; color: rgba(251,249,247,.7); font-style: italic; }

/* ══ §4 THE MECHANISM ══════════════════════════════════════════════ */
.contrast { font-size: var(--t-lead); margin-bottom: 3rem; }
.contrast strong { color: var(--ink); }

.stages { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1.25rem; }
.stage {
  position: relative; overflow: hidden;
  padding: 1.75rem 1.4rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
/* stages 2-4 are what we build; stage 1 is what she already does */
.stage.built { background: var(--accent-soft); border-color: transparent; }
.stage .num {
  position: absolute; right: .5rem; bottom: -1.25rem;
  font-size: 5rem; font-weight: 800; line-height: 1;
  color: var(--accent); opacity: .10;
}
.stage h3 {
  font-size: 1rem; letter-spacing: .06em; font-weight: 800;
  color: var(--accent); margin-bottom: .6rem;
}
.stage p { font-size: .9375rem; position: relative; }

.closer { margin-top: 3rem; font-size: var(--t-h3); font-weight: 400; line-height: 1.4; }
.closer strong { font-weight: 800; }

/* ══ §5 CONTRAST TABLE ═════════════════════════════════════════════ */
.vs { margin-inline: auto; max-width: 46rem; background: var(--surface); border-radius: var(--radius); overflow: hidden; }
.vs th {
  text-align: left; padding: 1.1rem 1.4rem;
  font-size: var(--t-micro); font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
}
.vs th.win { color: var(--accent); background: var(--accent-soft); }
.vs td { padding: .95rem 1.4rem; border-bottom: 1px solid var(--rule); color: var(--muted); }
.vs td.win { background: var(--accent-soft); color: var(--ink); font-weight: 600; }
.vs tr:last-child td { border-bottom: 0; }
/* row 1 is identical on both sides on purpose: same input, everything after differs */
.vs tr.same td.win { color: var(--muted); font-weight: 400; }

/* ══ §6 DELIVERABLES — 5 items, 5 cells, no empty tile ═════════════ */
.bento { display: grid; grid-template-columns: repeat(6, 1fr); gap: 1.25rem; }
.bento .cell {
  padding: 1.75rem;
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
.bento .cell.key { background: var(--accent-soft); border-color: transparent; }
.bento .cell h3 { font-size: 1.125rem; margin-bottom: .4rem; }
.bento .cell p { font-size: .9375rem; color: var(--muted); }
.bento .cell:nth-child(1), .bento .cell:nth-child(2) { grid-column: span 3; }
.bento .cell:nth-child(3), .bento .cell:nth-child(4), .bento .cell:nth-child(5) { grid-column: span 2; }

/* ══ §7 OUTCOMES + GUARANTEE ═══════════════════════════════════════ */
.outcomes { margin: 1.75rem 0 2.5rem; }
.outcomes li {
  display: flex; align-items: center; gap: .85rem;
  padding-block: .6rem;
  color: var(--ink); font-weight: 600;
}
.guarantee {
  background: var(--accent); color: #fff;
  border-radius: var(--radius);
  padding: clamp(1.75rem, 1.4rem + 1.6vw, 2.5rem);
  text-align: center;
}
.g-main { font-size: var(--t-h3); font-weight: 800; margin-bottom: .5rem; }
.g-sub  { opacity: .85; }

/* ══ §8 DIFFERENTIATION ════════════════════════════════════════════ */
.pairs { margin: 2rem 0 0; }
.pairs > div { padding-block: 1.25rem; border-bottom: 1px solid var(--rule); }
.pairs > div:last-child { border-bottom: 0; }
.pairs dt { color: var(--muted); }
.pairs dd { margin: .3rem 0 0; color: var(--ink); font-weight: 600; }
.thesis { color: var(--accent); font-weight: 800; }

/* ══ §9 THE ASK ════════════════════════════════════════════════════ */
.ask { background: var(--accent-soft); }
.ask-lead { font-size: var(--t-lead); font-weight: 700; color: var(--ink); margin-block: 1.25rem .5rem; }
.reassure { margin: 1.5rem 0 2.5rem; }

.lead-form {
  background: var(--surface);
  border: 1px solid var(--rule);
  border-radius: var(--radius);
  padding: clamp(1.5rem, 1.2rem + 1.4vw, 2.25rem);
  display: grid; gap: .5rem;
}
.lead-form label { font-weight: 700; color: var(--ink); font-size: .9375rem; }
.lead-form input[type="text"] {
  font: inherit; font-size: 1.0625rem;
  padding: .95rem 1rem; min-height: 52px;
  color: var(--ink); background: var(--paper);
  border: 1px solid var(--rule); border-radius: var(--radius);
  width: 100%;
}
.lead-form input[type="text"]::placeholder { color: #9A9AA2; }
.lead-form input[aria-invalid="true"] { border-color: #B3261E; }
.help { font-size: var(--t-micro); color: var(--muted); }
.err  { font-size: .9375rem; color: #B3261E; font-weight: 600; }
.lead-form button { margin-top: .75rem; width: 100%; }

/* honeypot: off-screen, never display:none (bots detect that) */
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.micro { margin-top: 1.25rem; text-align: center; color: var(--muted); font-size: var(--t-micro); }

/* success state */
.lead--done { text-align: center; }
.lead--done h3 { margin-bottom: .5rem; }
.lead--done .btn { margin-top: 1.5rem; }

/* htmx request lifecycle */
.htmx-indicator {
  width: 1rem; height: 1rem; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;
  opacity: 0; transition: opacity 120ms;
}
.htmx-request .htmx-indicator { opacity: 1; animation: spin .7s linear infinite; }
.htmx-request button[type="submit"] { cursor: progress; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ══ FOOTER ════════════════════════════════════════════════════════ */
footer { padding-block: 3rem; border-top: 1px solid var(--rule); text-align: center; }
.wordmark { font-weight: 800; color: var(--ink); letter-spacing: -0.01em; }

/* ══ STICKY MOBILE CTA ═════════════════════════════════════════════ */
.sticky-cta { display: none; }

/* ══ MOTION — CSS only, no scroll listeners ════════════════════════ */
@media (prefers-reduced-motion: no-preference) {
  @supports (animation-timeline: view()) {
    .reveal {
      animation: reveal linear both;
      animation-timeline: view();
      animation-range: entry 0% entry 45%;
    }
    @keyframes reveal {
      from { opacity: 0; transform: translateY(12px); }
      to   { opacity: 1; transform: none; }
    }
  }
}

/* ══ RESPONSIVE ════════════════════════════════════════════════════ */
@media (max-width: 1023px) {
  .band-grid { grid-template-columns: repeat(2, 1fr); }
  .stages    { grid-template-columns: repeat(2, 1fr); }
  .bento .cell:nth-child(n) { grid-column: span 3; }
  .bento .cell:nth-child(5) { grid-column: span 6; }
}

@media (max-width: 767px) {
  .band-grid, .stages { grid-template-columns: 1fr; }
  .bento { grid-template-columns: 1fr; }
  .bento .cell:nth-child(n) { grid-column: auto; }

  .hero { min-height: auto; padding-block: 3.5rem 3rem; }
  .promise { display: flex; }

  /* loop becomes a vertical chain */
  .loop { flex-direction: column; align-items: stretch; gap: 1.25rem; }
  .loop li:not(:last-child)::after {
    right: auto; left: 50%; top: auto; bottom: -1rem;
    transform: translateX(-50%) rotate(135deg);
  }

  /* table stacks into two labelled blocks, never a scrolling table */
  .vs, .vs thead, .vs tbody, .vs tr, .vs th, .vs td { display: block; width: 100%; }
  .vs thead { display: none; }
  .vs tr { display: grid; grid-template-columns: 1fr 1fr; align-items: stretch; }
  .vs td { border-bottom: 1px solid var(--rule); font-size: .9375rem; padding: .85rem 1rem; }

  /* sticky CTA: base state visible, so it still works where
     scroll-timeline is unsupported */
  .sticky-cta {
    display: block;
    position: fixed; inset: auto 0 0 0; z-index: 50;
    padding: .75rem var(--pad);
    padding-bottom: calc(.75rem + env(safe-area-inset-bottom));
    background: rgba(251,249,247,.94);
    backdrop-filter: blur(8px);
    border-top: 1px solid var(--rule);
  }
  .sticky-cta .btn { width: 100%; }

  /* keep the form clear of the sticky bar */
  .ask { padding-bottom: calc(var(--gap) + 5.5rem); }

  @media (prefers-reduced-motion: no-preference) {
    @supports (animation-timeline: scroll()) {
      .sticky-cta {
        animation: stickyIn linear both;
        animation-timeline: scroll(root block);
        animation-range: 22% 28%;
      }
      @keyframes stickyIn {
        from { opacity: 0; transform: translateY(100%); pointer-events: none; }
        to   { opacity: 1; transform: none; }
      }
    }
  }
}

@media (prefers-reduced-transparency: reduce) {
  .sticky-cta { background: var(--paper); backdrop-filter: none; }
}
