/* =========================================================================
   Belvani · sitio para negocios
   Layout idea: one sticky "stage" carries a single Wallet card from the hero
   through the four steps (scroll-driven, CSS only), then the page settles
   into calm editorial sections on cream.
   ========================================================================= */

/* ---------- 1. Tokens: neutrals (light is the base) ---------- */
:root {
  --bg: #F1EADF;
  --surface: #F8F4EC;
  --sunken: #E8DFD0;
  --raised: #FBF8F2;
  --sand: #E6DCCB;
  --border: #D8CDBB;
  --border-strong: #BFB29E;
  --text-1: #26201A;
  --text-2: #5A5046;
  --text-3: #6C6054;
  --scrim: rgba(38, 32, 26, .45);
  --shadow: 0 1px 2px rgba(38, 32, 26, .06), 0 8px 24px -8px rgba(38, 32, 26, .14);
  --success: #36704A;
  --danger: #B3382C;

  /* Immersive band (why section): espresso in light, a lifted ink in dark */
  --immersive: #26201A;
  --on-imm-1: #F1EADF;
  --on-imm-2: #C4B9A9;
  --on-imm-link: #D9C9AE;

  /* Fonts */
  --f-display: "Fraunces", "Iowan Old Style", Georgia, serif;
  --f-body: "DM Sans", "Segoe UI", system-ui, sans-serif;
  --f-logo: "Cormorant Garamond", "Cormorant", Garamond, serif;

  /* Shape, space, motion */
  --radius-s: 10px;
  --radius-m: 14px;
  --radius-l: 20px;
  --head-h: 64px;
  --gutter: clamp(20px, 5vw, 56px);
  --ease: cubic-bezier(.2, .7, .2, 1);
  --dur: 160ms;

  color-scheme: light dark;
}

/* ---------- 2. Accent families (data-accent on <html>) ---------- */
:root,
:root[data-accent="petrolio"] {
  --a-l: #1F5A6B; --a-hover-l: #1B4D5C; --a-press-l: #17434F; --a-soft-l: #E9EEF0; --a-softb-l: #C7D6DA;
  --a-d: #398FA8; --a-hover-d: #4A9DB5; --a-press-d: #2E7A91; --a-soft-d: #1C282B; --a-softb-d: #2B4047;
  --rw-l: #C4553C; --rw-d: #E07A5F; /* Corallo */
}
:root[data-accent="bordeaux"] {
  --a-l: #6D1A2C; --a-hover-l: #5E1626; --a-press-l: #511321; --a-soft-l: #F0E8EA; --a-softb-l: #DAC6CA;
  --a-d: #D3667E; --a-hover-d: #DE7A90; --a-press-d: #BF566D; --a-soft-d: #382123; --a-softb-d: #4E2D31;
  --rw-l: #B8862B; --rw-d: #D9A441; /* Ocra */
}
:root[data-accent="prugna"] {
  --a-l: #5E2A55; --a-hover-l: #512449; --a-press-l: #461F3F; --a-soft-l: #EFEAEE; --a-softb-l: #D7CAD4;
  --a-d: #BA71AD; --a-hover-d: #C685BB; --a-press-d: #A65E99; --a-soft-d: #34232B; --a-softb-d: #4A3240;
  --rw-l: #B5686F; --rw-d: #D08A90; /* Rosa antico */
}

/* Light mapping (default) */
:root {
  --accent: var(--a-l);
  --accent-hover: var(--a-hover-l);
  --accent-press: var(--a-press-l);
  --accent-soft: var(--a-soft-l);
  --accent-soft-border: var(--a-softb-l);
  --accent-text: var(--a-l);
  --on-accent: #FFFFFF;
  --reward: var(--rw-l);
}

/* ---------- 3. Dark theme: system preference, then explicit override ---------- */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #16120F; --surface: #201A15; --sunken: #1B1612; --raised: #2A231C; --sand: #1F1914;
    --border: #3B3228; --border-strong: #51463A;
    --text-1: #F1EADF; --text-2: #C4B9A9; --text-3: #968A7A;
    --scrim: rgba(22, 18, 15, .6);
    --shadow: 0 8px 24px -8px rgba(0, 0, 0, .5);
    --success: #6FB587; --danger: #E8776B;
    --immersive: #2A231C;
    --accent: var(--a-d); --accent-hover: var(--a-hover-d); --accent-press: var(--a-press-d);
    --accent-soft: var(--a-soft-d); --accent-soft-border: var(--a-softb-d);
    --accent-text: var(--a-d); --on-accent: #16120F; --reward: var(--rw-d);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #16120F; --surface: #201A15; --sunken: #1B1612; --raised: #2A231C; --sand: #1F1914;
  --border: #3B3228; --border-strong: #51463A;
  --text-1: #F1EADF; --text-2: #C4B9A9; --text-3: #968A7A;
  --scrim: rgba(22, 18, 15, .6);
  --shadow: 0 8px 24px -8px rgba(0, 0, 0, .5);
  --success: #6FB587; --danger: #E8776B;
  --immersive: #2A231C;
  --accent: var(--a-d); --accent-hover: var(--a-hover-d); --accent-press: var(--a-press-d);
  --accent-soft: var(--a-soft-d); --accent-soft-border: var(--a-softb-d);
  --accent-text: var(--a-d); --on-accent: #16120F; --reward: var(--rw-d);
  color-scheme: dark;
}
:root[data-theme="light"] { color-scheme: light; }

/* ---------- 4. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html {
  accent-color: var(--accent);
  scroll-padding-top: calc(var(--head-h) + 12px);
  -webkit-text-size-adjust: 100%;
}
@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text-1);
  font: 400 1rem/1.55 var(--f-body);
  font-optical-sizing: auto;
  -webkit-font-smoothing: antialiased;
}
h1, h2, h3, h4 {
  font-family: var(--f-display);
  font-weight: 500;
  line-height: 1.15;
  letter-spacing: -.012em;
  margin: 0;
  text-wrap: balance;
}
p { margin: 0; text-wrap: pretty; }
a { color: var(--accent-text); text-underline-offset: .18em; text-decoration-thickness: 1px; }
a:hover { text-decoration-thickness: 2px; }
img, svg { display: block; max-width: 100%; }
ul, ol { margin: 0; padding: 0; list-style: none; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft-border); color: var(--text-1); }

.sprite { position: absolute; }
.visually-hidden:where(:not(:focus-within, :active)) {
  position: absolute !important; clip-path: inset(50%) !important; overflow: hidden !important;
  width: 1px !important; height: 1px !important; margin: -1px !important;
  padding: 0 !important; border: 0 !important; white-space: nowrap !important;
}
.skip {
  position: fixed; left: 12px; top: -60px; z-index: 50;
  background: var(--text-1); color: var(--bg); padding: 10px 14px; border-radius: var(--radius-s);
}
.skip:focus { top: 12px; }

.wrap { width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto; }
.lede { font-size: 1.125rem; color: var(--text-2); max-width: 36ch; }
.fine { font-size: .875rem; color: var(--text-3); }

.ico {
  width: 24px; height: 24px; flex: none;
  fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round;
}

/* ---------- 5. Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 48px; padding: 0 22px;
  border-radius: 999px; border: 1px solid transparent;
  font: 500 1rem/1 var(--f-body); text-decoration: none; cursor: pointer;
  transition: background-color var(--dur) ease-out, border-color var(--dur) ease-out, color var(--dur) ease-out;
}
.btn-primary { background: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); text-decoration: none; }
.btn-primary:active { background: var(--accent-press); }
.btn-quiet { color: var(--text-1); border-color: var(--border-strong); background: transparent; }
.btn-quiet:hover { border-color: var(--text-1); text-decoration: none; }
.btn-small { min-height: 40px; padding: 0 16px; font-size: .9375rem; }
.btn-block { width: 100%; }

/* ---------- 6. Header + animated wordmark ---------- */
.site-head {
  position: fixed; inset: 0 0 auto; z-index: 20; height: var(--head-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-inline: max(var(--gutter), (100% - 1180px) / 2);
  background: color-mix(in srgb, var(--bg) 94%, transparent);
  border-bottom: 1px solid transparent;
}
@supports (animation-timeline: scroll()) and (animation-range: 0% 100%) {
  .site-head { animation: head-line linear both; animation-timeline: scroll(root); animation-range: 0 120px; }
  @keyframes head-line { to { border-bottom-color: var(--border); } }
}
.wordmark {
  position: relative; display: inline-block; color: var(--text-1); text-decoration: none;
  padding: 4px 2px 8px;
}
.wordmark-ink {
  display: block;
  font: italic 600 1.875rem/1 var(--f-logo);
  letter-spacing: .005em;
}
.wordmark-swash {
  position: absolute; left: 6%; right: 2%; bottom: 0; width: 92%; height: 10px; overflow: visible;
  fill: none; stroke: var(--text-1); stroke-width: 1.3; stroke-linecap: round;
}
@media (prefers-reduced-motion: no-preference) {
  .wordmark-ink {
    -webkit-mask-image: linear-gradient(100deg, #000 42%, transparent 58%);
    mask-image: linear-gradient(100deg, #000 42%, transparent 58%);
    -webkit-mask-size: 280% 100%; mask-size: 280% 100%;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    animation: write 1.5s .15s var(--ease) both;
  }
  .wordmark-swash path {
    stroke-dasharray: 120; stroke-dashoffset: 120;
    animation: swash .7s 1.25s ease-out forwards;
  }
}
@keyframes write {
  from { -webkit-mask-position: 100% 0; mask-position: 100% 0; }
  to   { -webkit-mask-position: 0% 0;   mask-position: 0% 0; }
}
@keyframes swash { to { stroke-dashoffset: 0; } }

.site-nav { display: none; gap: 28px; }
.site-nav a { color: var(--text-2); text-decoration: none; font-size: .9375rem; }
.site-nav a:hover { color: var(--text-1); }
@media (min-width: 960px) { .site-nav { display: flex; } }


/* ---------- 7. Story: hero + sticky stage (static layout first) ---------- */
main, .site-foot { position: relative; z-index: 1; }
.story { position: relative; }

.hero { position: relative; z-index: 2; }
.hero-copy {
  position: relative;
  width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto;
  padding-top: calc(var(--head-h) + clamp(28px, 7svh, 72px));
  padding-bottom: 48px;
  display: grid; gap: 22px; justify-items: start;
}
.hero-title {
  font-weight: 500;
  font-size: clamp(3.5rem, 7.4vw, 6.75rem);
  line-height: .98;
  letter-spacing: -.028em;
  font-variation-settings: "opsz" 144;
}
.hero-title span { display: inline-block; }
.hero-title .ht-a { display: block; }
.hero-loop { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.hero-loop path { fill: none; stroke: var(--accent); stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.hero-loop circle { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .hero-loop path { stroke-dasharray: 1 2; stroke-dashoffset: 1; animation: loop-draw 2.6s .7s cubic-bezier(.45, .05, .25, 1) forwards; }
  .hero-loop circle { opacity: 0; transform-box: fill-box; transform-origin: center; animation: dot-in .35s 3.2s ease-out forwards; /* loop 2.6 s after .7 s; was 1.8 s */ }
}
@keyframes loop-draw { to { stroke-dashoffset: 0; } }
@keyframes dot-in { from { opacity: 0; scale: 0; } to { opacity: 1; scale: 1; } }
.hero-lede { font-size: 1.125rem; color: var(--text-2); max-width: 36ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; }
.hero-foot { font-size: .9375rem; color: var(--text-3); max-width: 40ch; }

.stage { position: relative; }
.stage-grid {
  width: min(1180px, 100% - 2 * var(--gutter)); margin-inline: auto;
  display: grid; gap: 40px; padding-block: 24px 72px;
}
.progress { display: none; }
.caption-list { display: grid; gap: 28px; }
.caption { display: grid; gap: 8px; max-width: 42ch; }
.caption h3 { font-size: clamp(1.625rem, 3vw, 2.25rem); }
.caption p { color: var(--text-2); font-size: 1.0625rem; }
.caption .caption-step { font-size: .875rem; color: var(--accent-text); font-weight: 500; }
.caption .caption-note { font-size: .875rem; color: var(--text-3); }

.scene { display: grid; place-items: center; }
.scene-3d { position: relative; display: grid; place-items: center; }
.saved-pill, .note, .m-sign-top, .m-sign-bottom { display: none; }

/* The morphing object: one shell, one pass, one QR that travels */
.morph {
  --card-w: min(80vw, 320px);
  position: relative; width: var(--card-w);
  container-type: inline-size;
}
.m-shell {
  position: absolute; inset: 0;
  background: #F1EADF; border: 1px solid #D8CDBB; border-radius: 4.6cqw;
  box-shadow: var(--shadow);
}
.m-pass { position: relative; }
.morph .pass { background: none; border-color: transparent; box-shadow: none; }
.m-sign-top, .m-sign-bottom {
  position: absolute; inset-inline: 8%; margin: 0; text-align: center; color: #26201A;
  font-family: var(--f-display); font-weight: 500;
}
.m-sign-top { top: 12%; justify-content: center; align-items: center; gap: 2cqw; font-size: 6.4cqw; }
.m-sign-top svg { width: 6.6cqw; height: auto; aspect-ratio: 1; fill: var(--a-l); }
.m-sign-bottom { bottom: 15%; font-size: 5.2cqw; line-height: 1.25; }
.m-sign-bottom span { display: block; margin-top: 1.6cqw; font: 400 3.6cqw/1.3 var(--f-body); color: #6C6054; }

/* ---------- 8. Wallet passes (Apple style + Google style) ---------- */
.pass-wrap { container-type: inline-size; width: var(--card-w, min(80vw, 320px)); }
.pass, .gpass {
  --c-bg: #F1EADF; --c-fg: #26201A; --c-label: #6C6054; --c-strip: #E8DFD0;
  --c-stamp: var(--a-l); --c-off: rgba(38, 32, 26, .2); --c-reward: #C4553C; --c-line: #D8CDBB;
}
:is(.pass, .gpass)[data-brand="nogal"] {
  --c-bg: #1D3A2E; --c-fg: #F1EADF; --c-label: #B5C4B1; --c-strip: #163027;
  --c-stamp: #D9B979; --c-off: rgba(241, 234, 223, .2); --c-reward: #E9CF94; --c-line: #2A4A3C;
}
:is(.pass, .gpass)[data-brand="hoja"] {
  --c-bg: #141714; --c-fg: #EEF1EA; --c-label: #9AA596; --c-strip: #1D221C;
  --c-stamp: #8DC07A; --c-off: rgba(238, 241, 234, .18); --c-reward: #E0A84A; --c-line: #262B25;
}
.pass {
  background: var(--c-bg); color: var(--c-fg);
  border-radius: 4.6cqw; border: 1px solid var(--c-line); box-shadow: var(--shadow);
  padding: 5cqw 5.5cqw 4.5cqw;
  display: grid; gap: 4cqw; font-family: var(--f-body); overflow: hidden;
}
.pass-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 3cqw; }
.pass-logo { white-space: nowrap; display: flex; align-items: center; gap: 2cqw; font: 500 5.6cqw/1.1 var(--f-display); letter-spacing: -.01em; }
.pass-logo svg { width: 6.4cqw; height: auto; aspect-ratio: 1; fill: var(--c-stamp); }
.pass-count { text-align: right; display: grid; justify-items: end; }
.pass-label { font-size: 2.5cqw; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--c-label); }
.pass-value { font-size: 4.6cqw; font-weight: 500; line-height: 1.2; }
.pass-count .pass-value { font-size: 6cqw; font-variant-numeric: tabular-nums; }
.pass-strip {
  margin-inline: -5.5cqw; padding: 4.4cqw 7cqw; background: var(--c-strip);
  display: grid; gap: 3cqw 4cqw;
}
.stamp { position: relative; aspect-ratio: 1; display: grid; min-width: 0; }
.stamp > * { grid-area: 1 / 1; min-width: 0; }
.stamp svg { width: 54%; height: auto; aspect-ratio: 1; overflow: visible; }
.stamp .off { border-radius: 50%; border: .45cqw dashed var(--c-off); display: grid; place-items: center; }
.stamp .off svg { fill: var(--c-off); }
.stamp .on, .stamp .pre { border-radius: 50%; background: var(--c-stamp); display: grid; place-items: center; opacity: 0; }
.stamp .on { scale: .4; transition: opacity 180ms ease-out, scale 380ms cubic-bezier(.3, 1.4, .5, 1); }
.stamp .on svg, .stamp .pre svg { fill: var(--c-bg); }
.stamp.is-on .on { opacity: 1; scale: 1; }
@media (prefers-reduced-motion: reduce) { .stamp .on { transition: opacity 180ms ease-out; } }
.stamp.reward .off { border-style: solid; border-color: transparent; }
.stamp.reward .off svg { width: 70%; }
.stamp.reward .on { background: transparent; }
.stamp.reward .on svg { width: 72%; fill: var(--c-reward); }
.pass-fields { display: grid; grid-template-columns: 1fr auto; gap: 3.2cqw 4cqw; }
.pass-fields > div { display: grid; gap: .6cqw; min-width: 0; }
.pass-fields > div:nth-child(even) { text-align: right; justify-items: end; }
.swap { display: grid; }
.swap > * { grid-area: 1 / 1; }
.pass-fields .swap > span { display: grid; gap: .6cqw; justify-items: end; }
.pass-qr { justify-self: center; display: grid; justify-items: center; gap: 1.6cqw; margin-top: 2cqw; transform-origin: 50% 40%; }
.qr-tile { background: #FFFFFF; border-radius: 3cqw; padding: 2.6cqw; width: 33cqw; }
.qr-tile svg { width: 100%; height: auto; }
.pass-credit { font: italic 600 3.4cqw/1 var(--f-logo); color: var(--c-label); letter-spacing: .01em; }

/* Google Wallet look (approximation): circular logo, program title, fields, full-width image, barcode */
.gpass {
  background: var(--c-bg); color: var(--c-fg); border-radius: 6cqw; box-shadow: var(--shadow);
  border: 1px solid var(--c-line);
  display: grid; gap: 4.4cqw; padding-top: 5.5cqw; overflow: hidden; font-family: var(--f-body);
}
.g-head { display: flex; align-items: center; gap: 3cqw; padding-inline: 6cqw; }
.g-logo { width: 10cqw; aspect-ratio: 1; border-radius: 50%; background: var(--c-strip); display: grid; place-items: center; flex: none; }
.g-logo svg { width: 58%; height: auto; aspect-ratio: 1; fill: var(--c-stamp); }
.g-issuer { font-size: 4.2cqw; font-weight: 500; }
.g-title { padding-inline: 6cqw; font: 500 7.2cqw/1.15 var(--f-body); letter-spacing: -.01em; }
.g-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 3.6cqw 4cqw; padding-inline: 6cqw; }
.g-fields > div { display: grid; gap: .8cqw; min-width: 0; }
.g-label { font-size: 3.2cqw; color: var(--c-label); }
.g-value { font-size: 4.6cqw; font-weight: 500; font-variant-numeric: tabular-nums; }
.g-hero { background: var(--c-strip); padding: 5cqw 8cqw; display: grid; gap: 3cqw 4cqw; }
.g-qr { justify-self: center; padding-bottom: 6cqw; }
.g-qr .qr-tile { width: 40cqw; border-radius: 4cqw; }

/* ---------- 9. Scroll-driven story (only with .sda) ----------
   Timeline map, in % of the story's contain range (keep in sync with main.js P()):
   design units 0-16 hero · 17-37 step 1 (sign) · 38-56 step 2 · 57-77 step 3 (stamps) · 78-100 step 4 (notices).
   Steps 1 and 4 get 1.5x scroll, so every design % p is written here as P(p) = units(p) / 121 * 100,
   units: p<=17 -> p; <=37 -> 17+(p-17)*1.5; <=78 -> 47+(p-37); else 88+(p-78)*1.5.
   Result: 0-14.05 hero · 14.05-38.84 step 1 · 39.67-54.55 step 2 · 55.37-71.9 step 3 · 72.73-100 step 4 */
.sda .story { height: 753.4svh; /* 640svh before steps 1 and 4 got 1.5x scroll */ view-timeline: --story block; }
.sda .hero { height: 100svh; }
.sda .stage { position: sticky; top: 0; height: 100svh; margin-top: -100svh; z-index: 1; overflow: clip; }
.sda .stage-grid { height: 100%; padding: calc(var(--head-h) + 14px) 0 0; gap: 0; grid-template-rows: auto 1fr; }
.sda .captions { position: relative; height: 30svh; min-height: 210px; display: grid; grid-template-rows: auto 1fr; gap: 18px; }

.sda .progress {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; max-width: 220px;
  opacity: 0; animation: fade-in auto linear both; animation-timeline: --story; animation-range: contain 10.74% contain 14.05%;
}
.sda .progress span { height: 3px; border-radius: 3px; background: var(--border); overflow: hidden; }
.sda .progress i {
  display: block; height: 100%; background: var(--accent); transform-origin: left; transform: scaleX(0);
  animation: bar auto linear both; animation-timeline: --story;
}
.sda .progress span:nth-child(1) i { animation-range: contain 14.05% contain 38.84%; }
.sda .progress span:nth-child(2) i { animation-range: contain 39.67% contain 54.55%; }
.sda .progress span:nth-child(3) i { animation-range: contain 55.37% contain 71.9%; }
.sda .progress span:nth-child(4) i { animation-range: contain 72.73% contain 90.08%; }
@keyframes bar { to { transform: scaleX(1); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Captions take turns: one leaves upward under a clip edge, then the next rises in. Never both. */
.sda .caption-list { position: relative; overflow: clip; }
.sda .caption-step { position: absolute; clip-path: inset(50%); width: 1px; height: 1px; overflow: hidden; }
.sda .caption {
  position: absolute; inset: 0 auto auto 0; opacity: 0;
  animation: cap auto linear none; animation-timeline: --story;
}
.sda .caption[data-step="1"] { animation-range: contain 14.05% contain 38.84%; }
.sda .caption[data-step="2"] { animation-range: contain 39.67% contain 54.55%; }
.sda .caption[data-step="3"] { animation-range: contain 55.37% contain 71.9%; }
.sda .caption[data-step="4"] { animation-name: cap-last; animation-fill-mode: forwards; animation-range: contain 72.73% contain 90.08%; }
@keyframes cap { 0% { opacity: 0; translate: 0 48px; } 16%, 84% { opacity: 1; translate: 0 0; } 100% { opacity: 0; translate: 0 -48px; } }
@keyframes cap-last { 0% { opacity: 0; translate: 0 48px; } 28%, 100% { opacity: 1; translate: 0 0; } }

.sda .scene { position: relative; place-items: center; padding-bottom: 5svh; }
.sda .morph {
  --card-w: min(80vw, 316px, calc((100svh - var(--head-h) - 30svh - 70px) / 1.38));
  --hy: 31svh; --hrx: 58deg; --hry: 0deg; --hrz: -5deg; --ch4-y: 5svh;
  z-index: 1;
  animation: morph-pose auto linear both; animation-timeline: --story; animation-range: contain 0% contain 100%;
  will-change: transform;
}
@keyframes morph-pose {
  0% { transform: perspective(1400px) translate3d(0, var(--hy), 0) rotateX(var(--hrx)) rotateY(var(--hry)) rotateZ(var(--hrz)) scale(1); }
  13.22%, 72.73% { transform: perspective(1400px) translate3d(0, 0, 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); }
  76.45% { transform: perspective(1400px) translate3d(0, var(--ch4-y), 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1.035); }
  81.4%, 100% { transform: perspective(1400px) translate3d(0, var(--ch4-y), 0) rotateX(0deg) rotateY(0deg) rotateZ(0deg) scale(1); }
}
.sda .m-shell { animation: shell auto linear both; animation-timeline: --story; animation-range: contain 0% contain 100%; }
@keyframes shell {
  0%, 15.91% { inset: 0; border-radius: 4.6cqw; background-color: #F1EADF; }
  26.45%, 39.26% { inset: 6% 4% 10% 4%; border-radius: 9cqw; background-color: #FBF8F2; }
  45.87%, 100% { inset: 0; border-radius: 4.6cqw; background-color: #F1EADF; }
}
.sda .morph :is(.pass-head, .pass-strip, .pass-fields, .pass-credit) {
  animation: content-swap auto linear both; animation-timeline: --story; animation-range: contain 0% contain 100%;
}
@keyframes content-swap {
  0%, 15.29% { opacity: 1; translate: 0 0; scale: 1; }
  20.87%, 44.63% { opacity: 0; translate: 0 -10px; scale: .97; }
  48.35%, 100% { opacity: 1; translate: 0 0; scale: 1; }
}
.sda .morph .pass-qr { animation: qr-travel auto linear both; animation-timeline: --story; animation-range: contain 0% contain 100%; }
@keyframes qr-travel {
  0%, 16.53% { translate: 0 0; scale: 1; }
  27.69%, 39.26% { translate: 0 var(--qr-shift, -120px); scale: 1.5; }
  46.28%, 100% { translate: 0 0; scale: 1; }
}
.sda .m-sign-top, .sda .m-sign-bottom {
  display: block; opacity: 0;
  animation: sign-copy auto linear both; animation-timeline: --story; animation-range: contain 0% contain 100%;
}
.sda .m-sign-top { display: flex; }
@keyframes sign-copy {
  0%, 23.97% { opacity: 0; translate: 0 10px; }
  29.55%, 36.98% { opacity: 1; translate: 0 0; }
  39.67%, 100% { opacity: 0; translate: 0 -10px; }
}
.sda .saved-pill {
  display: flex; align-items: center; gap: 8px; align-self: end; justify-self: center; grid-area: 1 / 1;
  margin: 0 0 calc(-1 * 52px); padding: 8px 14px 8px 10px; border-radius: 999px; z-index: 2;
  background: var(--text-1); color: var(--bg); font-size: .875rem; font-weight: 500;
  opacity: 0; animation: pill auto linear both; animation-timeline: --story; animation-range: contain 0% contain 100%;
}
.saved-pill .ico { width: 18px; height: 18px; color: var(--bg); }
@keyframes pill {
  0%, 47.93% { opacity: 0; translate: 0 12px; }
  50%, 53.31% { opacity: 1; translate: 0 0; }
  54.96%, 100% { opacity: 0; translate: 0 -6px; }
}
.sda .morph, .sda .note, .sda .saved-pill { grid-area: 1 / 1; }
.sda .note {
  display: grid; grid-template-columns: 36px 1fr auto; gap: 10px; align-items: start;
  align-self: start; width: min(86vw, 340px); z-index: 3;
  padding: 11px 12px; border-radius: 18px;
  background: #FBF8F2; color: #26201A; border: 1px solid #E4DACB;
  box-shadow: 0 10px 30px -10px rgba(38, 32, 26, .35);
  font-size: .8125rem; line-height: 1.35; opacity: 0;
  animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both;
  animation-timeline: --story; animation-range: contain 0% contain 100%;
}
.sda .note-1 { margin-top: -3svh; animation-name: note-1; }
.sda .note-2 { margin-top: -3svh; animation-name: note-2; }
@keyframes note-1 {
  0%, 75.21% { opacity: 0; translate: 0 -24px; }
  79.55%, 85.12% { opacity: 1; translate: 0 0; }
  89.46%, 100% { opacity: 1; translate: 0 76px; scale: .97; }
}
@keyframes note-2 {
  0%, 85.12% { opacity: 0; translate: 0 -24px; }
  89.46%, 100% { opacity: 1; translate: 0 0; }
}
.note-icon { width: 36px; height: 36px; border-radius: 9px; background: #F1EADF; border: 1px solid #D8CDBB; display: grid; place-items: center; }
.note-icon svg { width: 20px; height: auto; aspect-ratio: 1; fill: var(--a-l); }
.note-body { display: grid; gap: 1px; }
.note-body b { font-weight: 700; }
.note-time { color: #6C6054; font-size: .75rem; }

/* JS-built swaps inside the story card (see main.js) */
.sda .story-card .tl, .sda #story-card .tl { opacity: 0; animation-name: seg-on; animation-duration: auto; animation-timing-function: linear; animation-timeline: --story; }
@keyframes seg-on { from { opacity: 1; } to { opacity: 1; } }
.sda #story-card .stamp .on { transition: none; animation-name: stamp-in; animation-duration: auto; animation-timing-function: var(--ease); animation-fill-mode: forwards; animation-timeline: --story; }
.sda #story-card .stamp .pre { animation-name: pre-out; animation-duration: auto; animation-timing-function: linear; animation-fill-mode: both; animation-timeline: --story; animation-range: contain 32.64% contain 33.14%; }
@keyframes stamp-in { from { opacity: 0; scale: 1.7; } 60% { opacity: 1; } to { opacity: 1; scale: 1; } }
@keyframes pre-out { from { opacity: 1; } to { opacity: 0; } }

@media (min-width: 900px) {
  .stage-grid { grid-template-columns: minmax(320px, 440px) 1fr; align-items: center; }
  .sda .stage-grid { grid-template-rows: 1fr; padding-top: var(--head-h); }
  .sda .captions { height: 46svh; align-content: center; }
  .sda .caption-list { height: 34svh; }
  .sda .scene { height: 100%; padding: 0; }
  .sda .morph {
    --card-w: min(350px, calc((100svh - var(--head-h) - 110px) / 1.38));
    --hy: 2svh; --hrx: 14deg; --hry: -28deg; --hrz: 5deg; --ch4-y: 4svh;
  }
  .sda .note { margin-top: 0; }
  .hero-copy { padding-top: calc(var(--head-h) + 16px); padding-bottom: 32px; min-height: 100svh; align-content: center; }
  .hero-title { font-size: clamp(3.5rem, min(7.4vw, 12.5svh), 6.75rem); }
  .hero-copy > * { max-width: 560px; }
  .hero-title, .hero-loop { max-width: none; }
}

/* Short laptop screens (720-820px tall): tighter hero so nothing crowds the header */
@media (min-width: 900px) and (max-height: 820px) {
  .hero-copy { gap: 18px; }
  .hero-title { font-size: clamp(3.25rem, min(7vw, 11.5svh), 6rem); }
  .hero-lede { font-size: 1.0625rem; }
}

/* ---------- 10. Why ---------- */
.why { position: relative; padding-block: 96px; }
.why h2 { font-size: clamp(2.25rem, 5vw, 4rem); max-width: 14ch; }
.why .wrap { display: grid; gap: 40px; }
.cups { margin: 0; display: grid; gap: 20px; max-width: 760px; }
.cups-row { display: grid; grid-template-columns: repeat(10, 1fr); gap: clamp(6px, 1.6vw, 18px); }
.cup {
  aspect-ratio: 1; background: var(--text-1);
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8h13v5.2A6.2 6.2 0 0 1 10.8 19h-.6A6.2 6.2 0 0 1 4 13.2V8Zm13 1.5h1.3a2.7 2.7 0 0 1 0 5.4H16.6' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M8 3.5c-.8 1 .8 1.6 0 2.8M11.5 3.5c-.8 1 .8 1.6 0 2.8' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M4 8h13v5.2A6.2 6.2 0 0 1 10.8 19h-.6A6.2 6.2 0 0 1 4 13.2V8Zm13 1.5h1.3a2.7 2.7 0 0 1 0 5.4H16.6' fill='none' stroke='%23000' stroke-width='1.6' stroke-linejoin='round'/%3E%3Cpath d='M8 3.5c-.8 1 .8 1.6 0 2.8M11.5 3.5c-.8 1 .8 1.6 0 2.8' fill='none' stroke='%23000' stroke-width='1.4' stroke-linecap='round'/%3E%3C/svg%3E") center / contain no-repeat;
}
.cup.gone { opacity: .2; }
.cups figcaption { font: 400 clamp(1.25rem, 2.4vw, 1.75rem)/1.35 var(--f-display); max-width: 32ch; }
.cups sup, .why-text sup { font: 500 .7em/0 var(--f-body); margin-left: 2px; }
.why-text { display: grid; gap: 16px; max-width: 56ch; color: var(--text-2); font-size: 1.0625rem; }
.sources { display: grid; gap: 6px; font-size: .8125rem; color: var(--text-2); list-style: decimal; padding-left: 1.2em; max-width: 70ch; }
/* Cups scene (html.sda only): the figure stays pinned inside a taller track; first all ten cups
   light up one by one, then the six "lost" ones float away. Static layout keeps 4 full + 6 faded. */
.sda .cups-track { height: 210svh; view-timeline: --cups block; }
.sda .cups-track > .cups { position: sticky; top: calc(var(--head-h) + 16svh); }
.sda .cup { animation: cup-on auto linear both; animation-timeline: --cups; }
.sda .cup.gone {
  animation: cup-on auto linear both, cup-off auto linear forwards;
  animation-timeline: --cups, --cups;
}
.sda .cup:nth-child(1)  { animation-range: contain 2% contain 7%; }
.sda .cup:nth-child(2)  { animation-range: contain 6% contain 11%; }
.sda .cup:nth-child(3)  { animation-range: contain 10% contain 15%; }
.sda .cup:nth-child(4)  { animation-range: contain 14% contain 19%; }
.sda .cup:nth-child(5)  { animation-range: contain 18% contain 23%, contain 52% contain 64%; }
.sda .cup:nth-child(6)  { animation-range: contain 22% contain 27%, contain 56% contain 68%; }
.sda .cup:nth-child(7)  { animation-range: contain 26% contain 31%, contain 60% contain 72%; }
.sda .cup:nth-child(8)  { animation-range: contain 30% contain 35%, contain 64% contain 76%; }
.sda .cup:nth-child(9)  { animation-range: contain 34% contain 39%, contain 68% contain 80%; }
.sda .cup:nth-child(10) { animation-range: contain 38% contain 43%, contain 72% contain 84%; }
@keyframes cup-on { from { opacity: .14; scale: .82; } 70% { opacity: 1; scale: 1.12; } to { opacity: 1; scale: 1; } }
@keyframes cup-off { from { opacity: 1; translate: 0 0; } to { opacity: .2; translate: 0 -26px; } }
/* ---------- 11. Club ---------- */
.club { padding-block: 112px 96px; }
.club-grid { display: grid; gap: 48px; }
.club-intro { display: grid; gap: 18px; align-content: start; }
.club-intro h2 { font-size: clamp(2.5rem, 5.4vw, 4.25rem); }
.club-lists { display: grid; gap: 22px; }
.group-title { font: 500 .9375rem/1.3 var(--f-body); color: var(--text-3); letter-spacing: 0; }
.features { display: grid; margin-bottom: 26px; }
.features li {
  display: grid; grid-template-columns: 28px 1fr; gap: 16px;
  padding-block: 20px; border-top: 1px solid var(--border);
}
.features li:last-child { border-bottom: 1px solid var(--border); }
.features .ico { color: var(--accent); margin-top: 2px; }
.features h4 { font-size: 1.3125rem; margin-bottom: 6px; }
.features p { color: var(--text-2); max-width: 52ch; }
.tiers { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.tiers span { padding: 5px 12px; border-radius: 999px; font-size: .875rem; font-weight: 500; }
.tiers span:nth-child(1) { background: var(--accent-soft); color: var(--text-1); border: 1px solid var(--accent-soft-border); }
.tiers span:nth-child(2) { background: var(--accent-soft); color: var(--text-1); border: 1px solid var(--accent); }
.tiers span:nth-child(3) { background: var(--accent); color: var(--on-accent); border: 1px solid var(--accent); }
@media (min-width: 900px) {
  .club-grid { grid-template-columns: 5fr 7fr; gap: 72px; }
  .club-intro { position: sticky; top: calc(var(--head-h) + 40px); }
}


/* ---------- 12. Examples ---------- */
.examples { padding-block: 96px; }
.ex-grid { display: grid; gap: 40px; align-items: center; }
.ex-copy { display: grid; gap: 20px; align-content: start; }
.ex-copy h2 { font-size: clamp(2.25rem, 4.6vw, 3.5rem); }
.ex-controls { display: grid; gap: 20px; max-width: 420px; }
.ex-controls fieldset { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.ex-controls legend, .range-field label { font-weight: 500; font-size: .9375rem; padding: 0; margin-bottom: 10px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); background: var(--sunken); border-radius: 999px; padding: 4px; gap: 4px; }
.seg-2 { grid-template-columns: repeat(2, 1fr); }
.seg input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.seg label {
  display: grid; place-items: center; min-height: 44px; border-radius: 999px; cursor: pointer;
  font-weight: 500; color: var(--text-2);
  transition: background-color var(--dur) ease-out, color var(--dur) ease-out;
}
.seg input:checked + label { background: var(--surface); color: var(--text-1); box-shadow: var(--shadow); }
.seg input:focus-visible + label { outline: 2px solid var(--accent); outline-offset: 2px; }
.range-field { display: grid; }
.range-field input { width: 100%; min-height: 44px; }
.range-field output { font-variant-numeric: tabular-nums; color: var(--accent-text); }
.ex-stage {
  display: grid; place-items: center; padding: clamp(28px, 6vw, 64px) 16px; min-height: 560px;
  background: var(--sunken); border-radius: var(--radius-l); perspective: 1200px;
}
.sda .ex-stage { background: var(--bg); }
.ex-card { --card-w: min(76vw, 330px); transition: transform 300ms var(--ease); view-transition-name: ex-card; }
::view-transition-group(ex-card) { animation-duration: 420ms; animation-timing-function: cubic-bezier(.2, .7, .2, 1); }
@media (prefers-reduced-motion: reduce) {
  ::view-transition-group(*), ::view-transition-old(*), ::view-transition-new(*) { animation: none !important; }
}
@media (min-width: 900px) { .ex-grid { grid-template-columns: 5fr 6fr; gap: 72px; } }

/* ---------- 13. Setup steps ---------- */
.setup { padding-block: 96px; }
.setup-grid { display: grid; gap: 40px; }
.setup h2 { font-size: clamp(2.25rem, 4.6vw, 3.5rem); margin-bottom: 18px; max-width: 16ch; }
.steps { position: relative; display: grid; gap: 34px; counter-reset: step; padding-left: 56px; }
.steps::before {
  content: ""; position: absolute; left: 17px; top: 18px; bottom: 18px; width: 2px;
  background: var(--accent); border-radius: 2px;
}
.has-thread .steps::before { display: none; } /* the page thread draws this line instead */
.steps li { position: relative; counter-increment: step; display: grid; gap: 6px; }
.steps li::before {
  content: counter(step); position: absolute; left: -56px; top: -2px;
  width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center;
  background: var(--bg); color: var(--accent-text); border: 2px solid var(--accent);
  font: 500 1rem/1 var(--f-display);
}
.steps h3 { font-size: 1.375rem; }
.steps p { color: var(--text-2); max-width: 46ch; }
@media (min-width: 900px) { .setup-grid { grid-template-columns: 5fr 7fr; gap: 72px; } }
/* ---------- 14. Pilot / promises ---------- */
.pilot { padding-block: 96px; }
.pilot-head { display: grid; gap: 20px; justify-items: start; margin-bottom: 48px; }
.pilot h2 { font-size: clamp(2.25rem, 4.6vw, 3.5rem); max-width: 18ch; }
.pilot .lede { max-width: 52ch; }
.pilot-steps { display: grid; gap: 10px; counter-reset: ps; max-width: 52ch; }
.pilot-steps li { counter-increment: ps; display: grid; grid-template-columns: 30px 1fr; gap: 12px; align-items: start; color: var(--text-2); }
.pilot-steps li > span { padding-top: 3px; }
.pilot-steps li::before {
  content: counter(ps); display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--accent); color: var(--on-accent); font: 500 .9375rem/1 var(--f-display);
}
.pilot-steps b { color: var(--text-1); font-weight: 500; }
.promises { display: grid; gap: 0 48px; }
.promises li { display: grid; gap: 8px; padding-block: 22px; border-top: 1px solid var(--border); }
.promises h3 { font-size: 1.3125rem; }
.promises p { color: var(--text-2); max-width: 48ch; }
@media (min-width: 760px) { .promises { grid-template-columns: 1fr 1fr; } }

/* ---------- 15. FAQ ---------- */
.faq { padding-block: 96px; }
.faq-grid { display: grid; gap: 32px; }
.faq h2 { font-size: clamp(2.25rem, 4.6vw, 3.5rem); }
.faq-list { border-top: 1px solid var(--border); }
.faq details { border-bottom: 1px solid var(--border); }
.faq summary {
  list-style: none; cursor: pointer; display: flex; justify-content: space-between; gap: 18px; align-items: center;
  padding-block: 20px; font: 500 1.1875rem/1.35 var(--f-display);
}
.faq summary::-webkit-details-marker { display: none; }
.faq summary::after {
  content: ""; flex: none; width: 14px; height: 14px;
  background:
    linear-gradient(var(--text-1) 0 0) center / 14px 1.5px no-repeat,
    linear-gradient(var(--text-1) 0 0) center / 1.5px 14px no-repeat;
  transition: rotate var(--dur) ease-out;
}
.faq details[open] summary::after { rotate: 45deg; }
@media (prefers-reduced-motion: reduce) { .faq summary::after { transition: none; } }
.faq details p { padding-bottom: 22px; color: var(--text-2); max-width: 62ch; }
@media (min-width: 900px) { .faq-grid { grid-template-columns: 5fr 7fr; gap: 72px; } }

/* ---------- 16. Contact ---------- */
.contact { padding-block: 96px 120px; }
.contact-grid { display: grid; gap: 40px; align-items: start; }
.contact-copy { display: grid; gap: 20px; }
.contact h2 { font-size: clamp(2.5rem, 5.4vw, 4.25rem); }
.channels { display: grid; gap: 10px; max-width: 420px; }
.channel {
  display: flex; align-items: center; gap: 14px; padding: 14px 16px; min-height: 64px;
  border: 1px solid var(--border); border-radius: var(--radius-m); color: var(--text-1); text-decoration: none;
  transition: border-color var(--dur) ease-out;
}
.channel:hover { border-color: var(--accent); }
.channel .ico { color: var(--accent); }
.channel > span { display: grid; }
.channel span span { color: var(--text-2); font-size: .9375rem; }

.contact-form {
  display: grid; gap: 18px; padding: clamp(20px, 4vw, 32px);
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l);
}
.contact-form h3 { font-size: 1.5rem; }
.field { display: grid; gap: 6px; border: 0; padding: 0; margin: 0; min-width: 0; }
.field label, .field legend { font-weight: 500; font-size: .9375rem; padding: 0; }
.field legend { margin-bottom: 8px; }
.opt { color: var(--text-3); font-weight: 400; }
.hint { font-size: .8125rem; color: var(--text-3); }
.field input, .field textarea {
  font: inherit; font-size: max(1rem, 1em); color: var(--text-1);
  min-height: 48px; padding: 12px 14px;
  background: var(--bg); border: 1px solid var(--border-strong); border-radius: var(--radius-s);
}
.field textarea { resize: vertical; min-height: 96px; }
.field input:focus-visible, .field textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.err { display: none; align-items: center; gap: 6px; font-size: .875rem; color: var(--danger); }
.err .ico { width: 18px; height: 18px; }
.field input:user-invalid { border-color: var(--danger); }
.field input:user-invalid + .err,
.tried .field input:invalid + .err,
.field input.is-bad + .err { display: flex; }
.tried .field input:invalid, .field input.is-bad { border-color: var(--danger); }
.choices { display: grid; gap: 4px; }
.choices span { display: flex; align-items: center; gap: 10px; min-height: 40px; }
.choices input { width: 20px; height: 20px; margin: 0; flex: none; }
.sent { display: grid; gap: 14px; padding: 16px; border-radius: var(--radius-m); background: var(--accent-soft); border: 1px solid var(--accent-soft-border); }
.sent[hidden] { display: none; }
.sent-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (min-width: 900px) { .contact-grid { grid-template-columns: 5fr 6fr; gap: 72px; } }

/* ---------- 17. Footer ---------- */
.site-foot { padding-block: 56px 72px; border-top: 1px solid var(--border); }
.foot-grid { display: grid; gap: 28px; }
.foot-mark { font: italic 600 2rem/1 var(--f-logo); }
.foot-tag { font: italic 400 1rem/1.4 var(--f-display); color: var(--text-3); margin-top: 6px; }
.foot-text { display: grid; gap: 6px; color: var(--text-2); font-size: .9375rem; }
.foot-nav { display: flex; flex-wrap: wrap; gap: 20px; font-size: .9375rem; }
@media (min-width: 900px) { .foot-grid { grid-template-columns: 1fr 2fr auto; align-items: start; } }

/* ---------- 18. Dev switcher (#dev) ---------- */
.dev {
  position: fixed; right: 12px; bottom: 12px; z-index: 40;
  display: grid; gap: 6px; padding: 12px; width: 236px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-m);
  box-shadow: var(--shadow); font-size: .8125rem;
}
.dev[hidden] { display: none; }
.dev p { color: var(--text-3); }
.dev-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; }
.dev button {
  font: inherit; min-height: 36px; border-radius: 8px; cursor: pointer;
  background: var(--bg); color: var(--text-1); border: 1px solid var(--border);
}
.dev button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); border-color: var(--accent); }

/* ---------- 19. Color scenes ----------
   Sections keep transparent backgrounds; fixed full-screen layers fade in while
   their section is on screen, so the page changes color without a hard edge. */
.scene-ink {
  --bg: #201A15; --surface: #2B241E; --sunken: #2B241E;
  --text-1: #F1EADF; --text-2: #C4B9A9; --text-3: #A3978A;
  --border: rgba(241, 234, 223, .16); --border-strong: rgba(241, 234, 223, .42); /* .42: field edges reach 3:1 */
  --accent: var(--a-d); --accent-hover: var(--a-hover-d); --accent-press: var(--a-press-d);
  /* Links on ink use the warm link tone (9.4:1+); the dark accent was 4.1-4.5:1, below AA for body text. */
  --accent-text: var(--on-imm-link); --accent-soft: var(--a-soft-d); --accent-soft-border: var(--a-softb-d);
  --on-accent: #16120F; --danger: #E8776B;
  color: var(--text-1);
  accent-color: var(--accent); /* radios/checkbox: re-resolve to the dark accent (was the inherited light one, under 3:1) */
  background: var(--immersive);
}
.scene-layer { display: none; }

.sda { timeline-scope: --sc-why, --sc-ex, --sc-pilot, --sc-contact; }
.sda .why { view-timeline: --sc-why block; background: transparent; padding-block: 34svh 44svh; }
.sda .examples { view-timeline: --sc-ex block; padding-block: 22svh; }
.sda .pilot { view-timeline: --sc-pilot block; padding-block: 22svh; }
.sda .contact { view-timeline: --sc-contact block; background: transparent; padding-top: 30svh; }
.sda .site-foot { background: transparent; }
.sda .scene-layer {
  display: block; position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: 0;
  animation: sc-in auto linear both, sc-out auto linear forwards;
  animation-range: entry 0% entry 40%, exit 8% exit 46%;
}
.sda .l-why { background: var(--immersive); animation-timeline: --sc-why, --sc-why; }
.sda .l-ex { background: var(--sand); animation-timeline: --sc-ex, --sc-ex; animation-range: entry 0% entry 55%, exit 20% exit 60%; }
.sda .l-pilot { background: var(--accent-soft); animation-timeline: --sc-pilot, --sc-pilot; animation-range: entry 0% entry 55%, exit 20% exit 60%; }
.sda .l-contact { background: var(--immersive); animation: sc-in auto linear both; animation-timeline: --sc-contact; animation-range: entry 35% entry 80%; }
@keyframes sc-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes sc-out { from { opacity: 1; } to { opacity: 0; } }

/* Text follows the background (light mode only; in dark mode the text is light on both sides).
   While a dark layer fades in or out, the sections on screen switch their color tokens between the
   cream-page set and the ink set at 57 % layer opacity, the point where dark and light text read
   equally well (~3.6:1 for body text). Unregistered custom properties animate discretely, so the
   switch is a clean flip, driven by the same scroll timeline and range as the layer it follows
   (l-why: entry 0-40 % in, exit 8-46 % out; l-contact: entry 35-80 % in). Layer opacity is linear,
   so the flip sits at 57 % of a fade-in range and at 43 % of a fade-out range. */
/* These sections inherit text color from <body>; re-declare it so it follows their own (flipping) tokens.
   Same value as the inherited one at rest, so nothing changes outside the flip. */
.sda :is(.stage, .club, .faq) { color: var(--text-1); }
@keyframes ink-in {
  0%, 57% {
    --text-1: #26201A; --text-2: #5A5046; --text-3: #6C6054; --danger: #B3382C;
    --bg: #F1EADF; --surface: #F8F4EC; --sunken: #E8DFD0; --border: #D8CDBB; --border-strong: #BFB29E;
    --accent: var(--a-l); --accent-hover: var(--a-hover-l); --accent-press: var(--a-press-l); --accent-text: var(--a-l);
    --accent-soft: var(--a-soft-l); --accent-soft-border: var(--a-softb-l); --on-accent: #FFFFFF;
  }
  57.01%, 100% {
    --text-1: #F1EADF; --text-2: #C4B9A9; --text-3: #A3978A; --danger: #E8776B;
    --bg: #201A15; --surface: #2B241E; --sunken: #2B241E;
    --border: rgba(241, 234, 223, .16); --border-strong: rgba(241, 234, 223, .42);
    --accent: var(--a-d); --accent-hover: var(--a-hover-d); --accent-press: var(--a-press-d); --accent-text: var(--on-imm-link);
    --accent-soft: var(--a-soft-d); --accent-soft-border: var(--a-softb-d); --on-accent: #16120F;
  }
}
@keyframes ink-out {
  0%, 43% {
    --text-1: #F1EADF; --text-2: #C4B9A9; --text-3: #A3978A; --danger: #E8776B;
    --bg: #201A15; --surface: #2B241E; --sunken: #2B241E;
    --border: rgba(241, 234, 223, .16); --border-strong: rgba(241, 234, 223, .42);
    --accent: var(--a-d); --accent-hover: var(--a-hover-d); --accent-press: var(--a-press-d); --accent-text: var(--on-imm-link);
    --accent-soft: var(--a-soft-d); --accent-soft-border: var(--a-softb-d); --on-accent: #16120F;
  }
  43.01%, 100% {
    --text-1: #26201A; --text-2: #5A5046; --text-3: #6C6054; --danger: #B3382C;
    --bg: #F1EADF; --surface: #F8F4EC; --sunken: #E8DFD0; --border: #D8CDBB; --border-strong: #BFB29E;
    --accent: var(--a-l); --accent-hover: var(--a-hover-l); --accent-press: var(--a-press-l); --accent-text: var(--a-l);
    --accent-soft: var(--a-soft-l); --accent-soft-border: var(--a-softb-l); --on-accent: #FFFFFF;
  }
}
@media (prefers-color-scheme: light) {
  :root.sda:not([data-theme="dark"]) .stage {
    animation-name: ink-in; animation-fill-mode: forwards; animation-duration: auto; animation-timing-function: linear;
    animation-timeline: --sc-why; animation-range: entry 0% entry 40%;
  }
  :root.sda:not([data-theme="dark"]) .faq {
    animation-name: ink-in; animation-fill-mode: forwards; animation-duration: auto; animation-timing-function: linear;
    animation-timeline: --sc-contact; animation-range: entry 35% entry 80%;
  }
  :root.sda:not([data-theme="dark"]) .why {
    animation-name: ink-in, ink-out; animation-fill-mode: backwards, forwards; animation-duration: auto; animation-timing-function: linear;
    animation-timeline: --sc-why, --sc-why; animation-range: entry 0% entry 40%, exit 8% exit 46%;
  }
  :root.sda:not([data-theme="dark"]) .club {
    animation-name: ink-out; animation-fill-mode: backwards; animation-duration: auto; animation-timing-function: linear;
    animation-timeline: --sc-why; animation-range: exit 8% exit 46%;
  }
  :root.sda:not([data-theme="dark"]) .contact {
    animation-name: ink-in; animation-fill-mode: backwards; animation-duration: auto; animation-timing-function: linear;
    animation-timeline: --sc-contact; animation-range: entry 35% entry 80%;
  }
}
:root.sda[data-theme="light"] .stage {
  animation-name: ink-in; animation-fill-mode: forwards; animation-duration: auto; animation-timing-function: linear;
  animation-timeline: --sc-why; animation-range: entry 0% entry 40%;
}
:root.sda[data-theme="light"] .faq {
  animation-name: ink-in; animation-fill-mode: forwards; animation-duration: auto; animation-timing-function: linear;
  animation-timeline: --sc-contact; animation-range: entry 35% entry 80%;
}
:root.sda[data-theme="light"] .why {
  animation-name: ink-in, ink-out; animation-fill-mode: backwards, forwards; animation-duration: auto; animation-timing-function: linear;
  animation-timeline: --sc-why, --sc-why; animation-range: entry 0% entry 40%, exit 8% exit 46%;
}
:root.sda[data-theme="light"] .club {
  animation-name: ink-out; animation-fill-mode: backwards; animation-duration: auto; animation-timing-function: linear;
  animation-timeline: --sc-why; animation-range: exit 8% exit 46%;
}
:root.sda[data-theme="light"] .contact {
  animation-name: ink-in; animation-fill-mode: backwards; animation-duration: auto; animation-timing-function: linear;
  animation-timeline: --sc-contact; animation-range: entry 35% entry 80%;
}

/* ---------- 20. The thread ---------- */
.thread { position: absolute; left: 0; top: 0; width: 100%; height: 0; overflow: visible; pointer-events: none; z-index: 0; }
.thread path { fill: none; stroke: var(--accent); stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.thread path.on-ink { stroke: #D9C9AE; }
.thread-head {
  position: absolute; left: 0; top: 0; width: 12px; height: 12px; margin: -6px 0 0 -6px; z-index: 0;
  border-radius: 50%; background: var(--accent); pointer-events: none; opacity: 0;
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--accent) 20%, transparent);
  transition: opacity 300ms ease-out, background-color 300ms ease-out;
  will-change: transform;
}
.thread-head.is-on { opacity: 1; }
.thread-head.on-ink { background: #D9C9AE; box-shadow: 0 0 0 5px rgba(217, 201, 174, .22); }

/* ---------- 21. Reveals: headings rise out of a clip line, blocks settle in ---------- */
.sda .rv-h { animation: rv-clip auto linear both; animation-timeline: view(); animation-range: entry 10% entry 85%; }
.sda .rv { animation: rv-up auto linear both; animation-timeline: view(); animation-range: entry 0% entry 70%; }
@keyframes rv-clip {
  from { clip-path: inset(0 0 100% 0); translate: 0 .45em; }
  to   { clip-path: inset(-10% -10% -20% -10%); translate: 0 0; }
}
@keyframes rv-up { from { opacity: 0; translate: 0 36px; } to { opacity: 1; translate: 0 0; } }

/* ---------- 23. Consent + short privacy notice (contact form) ---------- */
.consent { display: flex; align-items: flex-start; gap: 10px; min-height: 44px; font-size: .9375rem; color: var(--text-2); cursor: pointer; }
.consent input { width: 20px; height: 20px; margin: 2px 0 0; flex: none; accent-color: var(--accent); cursor: pointer; }
.notice-short { font-size: .8125rem; line-height: 1.5; color: var(--text-3); }
/* Placeholder text that must be filled in before launch: deliberately visible. */
.fill { background: var(--accent-soft); outline: 1px dashed var(--accent-soft-border); border-radius: 3px; padding: 0 3px; }

/* ---------- 24. Legal pages (aviso-de-privacidad.html) ---------- */
.legal { padding-block: calc(var(--head-h) + clamp(32px, 6vw, 72px)) 96px; }
.legal-wrap { display: grid; gap: 40px; max-width: 72ch; }
.legal-head { display: grid; gap: 16px; }
.legal h1 { font-size: clamp(2.5rem, 5.4vw, 4rem); }
.legal h2 { font-size: clamp(1.5rem, 2.6vw, 1.875rem); margin-bottom: 14px; }
.legal h3 { font: 500 1.0625rem/1.35 var(--f-body); margin: 20px 0 8px; }
.legal section > p + p, .legal section > p + ul, .legal section > ul + p, .legal section > ol + p { margin-top: 12px; }
.legal section p, .legal section li { color: var(--text-2); }
.legal section b { color: var(--text-1); font-weight: 500; }
.legal section ul, .legal section ol { display: grid; gap: 6px; padding-left: 1.3em; }
.legal section ul { list-style: disc; }
.legal section ol { list-style: decimal; }
.legal section ol.alpha { list-style: lower-alpha; }
.legal-summary { padding: clamp(20px, 4vw, 28px); background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-l); }
.legal-summary h2 { font-size: 1.375rem; }
.legal-toc ol { display: grid; gap: 6px; list-style: decimal; padding-left: 1.3em; }
.legal-toc a { text-decoration-color: var(--border-strong); }

/* ---------- 22. Forced colors (Windows high contrast): keep state visible ----------
   Only applies in forced-colors mode; no effect on the normal design. */
@media (forced-colors: active) {
  .seg input:checked + label { outline: 2px solid Highlight; outline-offset: -2px; }
  .faq summary::after { background: none; border: 1px solid CanvasText; border-radius: 50%; width: 10px; height: 10px; }
  .faq details[open] summary::after { background: CanvasText; }
  .stamp.is-on .on { border: 2px solid CanvasText; }
  .dev button[aria-pressed="true"] { outline: 2px solid Highlight; }
}
