/* ==================================================================
   Run for the Mind - home page (loads after styles.css)
   Five scenes on the DESIGN.md system: a campaign hero (film with the
   display headline burned in and one white pill), the route map on a
   soft-cloud stage, the distance cards, a black campaign tile for the
   manifesto, and the register tiles. Nothing here hides content: every
   scene reads fully without JavaScript. scenes.js adds html.scrolly
   (desktop) or html.scrolly-phone (phones) for the scroll choreography.
   ================================================================== */

/* ---------- Scenes ---------- */
.scene { position: relative; overflow-x: clip; }
.scene .stage { position: relative; }
.scene .heading { max-width: 60rem; }
.scene .heading .h2 { margin-bottom: 12px; }
.scene .heading .lede { margin-top: 0; }

/* ---------- Scene 1: campaign hero ---------- */
.scene-hero { background: var(--ink); }
.scene-hero .stage { min-height: calc(100svh - var(--header-h)); display: flex; flex-direction: column; justify-content: flex-end; padding: 96px 0 var(--section); }
.film { position: absolute; inset: 0; z-index: 0; overflow: hidden; background: var(--ink); }
.film-poster, .film-loop, .film-scrub, .film-canvas { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; object-position: center 55%; }
.film-loop, .film-scrub { opacity: 0; transition: opacity .8s ease; }
.film.has-loop .film-loop, .film.has-scrub .film-scrub { opacity: 1; }
.film.has-scrub .film-loop { opacity: 0; }
.film-canvas { display: block; opacity: 0; transition: opacity .6s ease; }
.film.has-frames .film-canvas { opacity: 1; }
.film-scrim { position: absolute; inset: 0; background: linear-gradient(180deg, rgb(17 17 17 / .12) 0%, rgb(17 17 17 / 0) 35%, rgb(17 17 17 / .6) 100%); }
.hero-copy { position: relative; z-index: 2; padding-inline: var(--gutter); max-width: 72rem; color: #fff; }
.hero-copy .eyebrow { color: #fff; animation: rise .7s ease both; }
.hero-title { font-size: clamp(3.5rem, 10vw, 8rem); line-height: .9; color: #fff; margin: 4px 0 16px; }
.hero-title .line { display: block; overflow: hidden; }
.hero-title .line > span { display: block; animation: rise .8s ease .08s both; }
.hero-title .line:nth-child(2) > span { animation-delay: .16s; }
.hero-lede { max-width: 44ch; color: #fff; animation: rise .8s ease .28s both; }
.hero-lede em { font-style: normal; font-weight: 500; }
.hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 24px; animation: rise .8s ease .38s both; }
@keyframes rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
.race-sheet { position: relative; z-index: 3; margin: 24px var(--gutter) 0; padding: 24px; max-width: 36rem; background: var(--canvas); color: var(--ink); }
.race-sheet .sheet-title { margin: 0 0 8px; font-size: 1.5rem; font-weight: 500; line-height: 1.2; color: var(--ink); }
.race-sheet .rows > li { padding: 12px 0; }
@media (min-width: 40rem) { .race-sheet .rows > li { grid-template-columns: 2rem minmax(5rem, 1fr) minmax(0, 1.6fr); } }
.race-sheet .countdown { margin-top: 24px; }
.race-sheet .sheet-cta { margin-top: 16px; }
.scroll-cue { position: absolute; right: var(--gutter); bottom: 24px; z-index: 3; display: none; color: #fff; mix-blend-mode: difference; }
@media (min-width: 64rem) {
  .scene-hero .stage { display: grid; grid-template-columns: minmax(0, 1.3fr) minmax(0, 36rem); align-items: end; gap: 48px; padding: 120px var(--gutter) var(--section); }
  .hero-copy { padding-inline: 0; }
  .race-sheet { margin: 0; }
}
/* Desktop choreography (scenes.js adds html.scrolly): a tall runway with a sticky stage;
   the film docks into a square panel on the left and the race sheet sits on the white canvas beside it */
.scrolly .scene-hero { min-height: 260svh; background: var(--canvas); }
.scrolly .scene-hero .stage { position: sticky; top: var(--header-h); height: calc(100dvh - var(--header-h)); min-height: 0; display: block; padding: 0; background: var(--canvas); }
.scrolly .hero-copy { position: absolute; left: var(--gutter); right: var(--gutter); bottom: var(--section); max-width: 66rem; }
.scrolly .race-sheet { position: absolute; right: var(--gutter); top: 50%; transform: translateY(-50%); width: min(38rem, 44vw); margin: 0; padding: 0; max-height: calc(100% - 48px); overflow: auto; }
.scrolly .scroll-cue { display: block; }
.scrolly .film { will-change: clip-path; }
/* Phone choreography (html.scrolly-phone): sticky stage, the sheet slides up over the film */
.scrolly-phone .scene-hero .stage { position: sticky; top: var(--header-h); height: calc(100dvh - var(--header-h)); min-height: 0; padding-top: 0; }
.scrolly-phone .scene-hero > .race-sheet { margin: -4svh 0 0; max-width: none; }

/* ---------- Scene 2: the route (the map sits on soft cloud, like a product photograph) ---------- */
.scene-route { background: var(--canvas); }
.scene-route .stage { padding-block: var(--section); }
.route-grid { display: grid; gap: 24px; }
.route-map { position: relative; margin: 0; padding: clamp(12px, 2vw, 24px); background: var(--soft-cloud); }
.route-map svg { width: 100%; height: auto; display: block; }
.route-map figcaption { margin: 12px 0 0; color: var(--mute); }
.map-base .grid { display: none; }
.map-base .tw { fill: var(--canvas); stroke: var(--hairline); stroke-width: 2; }
.map-base .road { fill: none; stroke: var(--ink); stroke-opacity: .55; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; }
.map-base .road-major { stroke: var(--hairline); stroke-opacity: 1; stroke-width: 10; stroke-dasharray: none; }
.map-base .rb { fill: var(--canvas); stroke: var(--ink); stroke-width: 2.5; }
.map-base .gate circle { fill: var(--ink); stroke: var(--canvas); stroke-width: 3; }
.course { fill: none; stroke: var(--ink); stroke-width: 7; stroke-linecap: round; stroke-linejoin: round; stroke-dasharray: 1; stroke-dashoffset: 0; opacity: 0; transition: opacity .4s ease; }
.course.is-active { opacity: 1; }
.course-shadow { fill: none; stroke: rgb(17 17 17 / .12); stroke-width: 18; stroke-linecap: round; stroke-linejoin: round; opacity: 0; }
.course-shadow.is-active { opacity: 1; }
.callout { transition: opacity .4s ease; }
.callout circle { fill: var(--canvas); stroke: var(--ink); stroke-width: 2.5; }
.callout line { stroke: var(--ink); stroke-width: 1.5; }
.callout text { font-family: var(--font-body); font-size: 24px; font-weight: 500; fill: var(--ink); }
.callout .num { fill: var(--mute); font-size: 20px; }
.runner rect { fill: var(--ink); }
.route-map.no-course .course, .route-map.no-course .course-shadow, .route-map.no-course .callout, .route-map.no-course .runner { display: none; }
.map-credit { display: block; margin-top: 4px; }
.map-credit a { color: var(--mute); }
/* Distance tabs and the category pills: filter chips (white with a hairline; black when selected) */
.route-tabs { display: flex; flex-wrap: wrap; gap: 8px; margin: 16px 0 8px; }
.route-tab, .vault-pill { display: inline-flex; align-items: baseline; gap: 8px; min-height: 40px; padding: 8px 16px; background: var(--canvas); border: 1px solid var(--hairline); border-radius: var(--radius-pill); color: var(--ink); font: inherit; font-size: 1rem; font-weight: 500; line-height: 1.5; cursor: pointer; }
.route-tab[aria-selected="true"], .vault-pill.is-active { background: var(--ink); border-color: var(--ink); color: var(--on-primary); }
.route-legend { margin: 16px 0 24px; }
@media (min-width: 64rem) {
  .route-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1.45fr); align-items: center; gap: 48px; }
  .scrolly .scene-route { min-height: 220svh; }
  .scrolly .scene-route .stage { position: sticky; top: 0; height: 100dvh; display: flex; align-items: center; padding-block: var(--header-h) 0; }
}

/* ---------- Scene 3: the distances (flat square cards, 8px gutters) ---------- */
.scene-distances { background: var(--canvas); }
.scene-distances .stage { padding-block: var(--section) 0; }
.distances-head { margin-bottom: 24px; }
.track { list-style: none; margin: 0; padding: 0 var(--gutter) var(--section); display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; scrollbar-width: none; -webkit-overflow-scrolling: touch; }
.track::-webkit-scrollbar { display: none; }
.track::after { content: ""; flex: 0 0 1px; }
.card-d { flex: 0 0 min(82vw, 24rem); scroll-snap-align: start; display: flex; flex-direction: column; gap: 12px; padding: 24px; background: var(--soft-cloud); }
.card-d .dist { margin: 0; font-family: var(--font-display); font-size: clamp(4.5rem, 8vw, 6rem); line-height: .9; color: var(--ink); }
.card-d .dist small { font-size: .5em; margin-left: .06em; color: var(--mute); }
.card-d .card-name { margin: 0; font-size: .875rem; color: var(--mute); }
.card-d .card-desc { margin: 0; color: var(--charcoal); font-size: .875rem; }
.card-d .btn-line, .card-d .btn-gold { margin-top: auto; align-self: flex-start; }
.card-d .btn-line { background: var(--canvas); }
.card-included { background: var(--canvas); box-shadow: inset 0 0 0 1px var(--hairline); }
.card-included .lozenges { color: var(--charcoal); }
.rows.compact > li { padding: 10px 0; grid-template-columns: 2rem minmax(5rem, 1fr) minmax(0, 1.4fr); }
@media (min-width: 64rem) {
  .card-d { flex-basis: 27rem; }
  .scrolly .scene-distances { min-height: 240svh; }
  .scrolly .scene-distances .stage { position: sticky; top: 0; height: 100dvh; display: flex; flex-direction: column; justify-content: center; padding: var(--header-h) 0 0; }
  .scrolly .track { overflow: visible; scroll-snap-type: none; will-change: transform; }
}

/* ---------- Scene 4: the manifesto (a black campaign tile; the film is the only depth) ---------- */
.scene-ethos { position: relative; background: var(--ink); color: #fff; padding-block: clamp(64px, 12vw, 160px); overflow: hidden; }
.ethos-back { position: absolute; inset: 0; z-index: 0; pointer-events: none; }
.ethos-film { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; filter: brightness(.4); transition: opacity 1s ease; }
.ethos-film.is-on { opacity: 1; }
.ethos-inner { position: relative; z-index: 1; max-width: calc(64rem + 2 * var(--gutter)); }
.scene-ethos .eyebrow { color: var(--stone-inverse); }
.manifesto { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); font-weight: 500; line-height: 1.25; color: #fff; text-wrap: pretty; }
.manifesto .w { display: inline-block; transition: color .3s ease; }
.manifesto.is-live .w { color: var(--stone-inverse); }
.manifesto.is-live .w.is-lit { color: #fff; }
.manifesto em { font-style: normal; }

/* ---------- Scene 5: register (8px grid of soft-cloud tiles; the entry tile is the one black block) ---------- */
.scene-vault { padding-block: var(--section); background: var(--canvas); }
.vault { display: grid; gap: 8px; grid-template-columns: repeat(2, minmax(0, 1fr)); margin-top: 24px; }
.vault > .tile-xl, .vault > .tile-wide { grid-column: 1 / -1; }
.tile-xl { padding: clamp(24px, 4vw, 48px); display: flex; flex-direction: column; justify-content: flex-end; gap: 16px; min-height: 22rem; background: var(--ink); color: #fff; }
.tile-xl .micro { color: var(--stone-inverse); }
.tile-xl .vault-copy { margin: 0; color: #fff; max-width: 50ch; }
.tile-xl .vault-alt { margin: 0; color: var(--stone-inverse); font-size: .875rem; }
.tile-xl a:not(.btn-gold) { color: #fff; }
.tile-xl .btn-gold { align-self: flex-start; background: var(--canvas); color: var(--ink); }
.tile-xl .btn-gold:hover { background: var(--soft-cloud); color: var(--ink); }
.tile-xl .places-left { background: var(--canvas); color: var(--ink); align-self: flex-start; }
.vault-pills { display: flex; flex-wrap: wrap; gap: 8px; }
.tile-xl .vault-pill { background: transparent; border-color: var(--ash); color: #fff; }
.tile-xl .vault-pill small { font-size: .875rem; font-weight: 400; color: var(--stone-inverse); }
.tile-xl .vault-pill.is-active { background: var(--canvas); border-color: var(--canvas); color: var(--ink); }
.tile-xl .vault-pill.is-active small { color: var(--mute); }
.tile .micro { margin: 0 0 8px; }
.tile .rows.compact { margin: 4px 0 8px; }
.tile .lozenges { color: var(--charcoal); }
.tile .link-arrow { margin-top: 8px; }
.tile .tile-links { display: flex; flex-wrap: wrap; gap: 0 24px; }
.tile-map { padding: 0; overflow: hidden; }
@media (max-width: 40rem) { .vault { grid-template-columns: 1fr; } }
@media (min-width: 64rem) {
  .vault { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .vault > .tile { grid-column: span 2; }
  .vault > .tile-xl { grid-column: span 4; grid-row: span 2; }
  .vault > .tile-wide { grid-column: 1 / -1; }
}

/* ---------- Motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-copy .eyebrow, .hero-title .line > span, .hero-lede, .hero-actions { animation: none; }
  .course, .callout, .manifesto .w, .film-loop, .film-scrub, .film-canvas, .ethos-film { transition: none; }
}
