/* Research (Night River): the page layer of research.html only. Shared look comes from tokens.css and site.css.
   The page is the owl's sight: one fixed scene behind everything, six notes that hold while the eye arrives,
   a scale along the bottom from "shipping today" to "years away". Colours come from the tokens. */

/* TEMPORARY type tokens. The site's new pair arrives as main/assets/css/type.css (--font-display, --font-text,
   --font-mono and a scale). Until it is wired in, these are the dark site's current faces. Delete this block then. */
.research-r2 {
}

.research-r2 {
  /* the page's own sizes: rem first, a small share of the width, a rem limit, so text follows browser zoom */
  --r-title: clamp(2.9rem, 1.4rem + 5.2vw, 7.75rem);
  --r-h2: clamp(1.45rem, 0.8rem + 1.45vw, 2.6rem);
  --r-h3: clamp(1.9rem, 1rem + 2.35vw, 4.3rem);
  --r-claim: clamp(1.0625rem, 0.75rem + 0.48vw, 1.4rem);
  --r-q: clamp(1.25rem, 0.6rem + 1.05vw, 2rem);
  --r-small: var(--text-sm);
  --r-tiny: var(--text-xs);
  --head-h: clamp(3.5rem, 9svh, 5.25rem);
  --rail-h: clamp(5rem, 11.5svh, 6.6rem);
  --col-text: min(31vw, 46rem);
  --col-meta: min(15.5vw, 22rem);
  /* the page's own colours, mixed from the tokens */
  --r-hair: color-mix(in srgb, var(--color-moon) 20%, transparent);
  --r-hair-strong: color-mix(in srgb, var(--color-moon) 46%, transparent);
  --r-veil: color-mix(in srgb, var(--color-bg) 86%, transparent);
  --r-veil-soft: color-mix(in srgb, var(--color-bg) 58%, transparent);
  --r-rail: color-mix(in srgb, var(--color-bg-deep) 90%, transparent);
  --st: var(--color-mneme);
}
.research-r2 main { position: relative; z-index: 1; font-family: var(--font-text); }
.research-r2 .eyebrow { font-family: var(--font-text); display: flex; align-items: center; gap: var(--space-3); }
.research-r2 .eyebrow::before { content: ""; width: 2.25rem; height: 1px; background: var(--color-river-mint); }
.research-r2 code { font-family: var(--font-mono); }
.num { font-variant-numeric: tabular-nums lining-nums; }

/* ---------- the stage: one fixed scene behind the whole page ---------- */
.stage { position: fixed; inset: 0; z-index: 0; background: var(--color-bg-deep); }
.stage.is-swapping canvas { opacity: 0; transition-duration: 220ms; }
/* the eye: a thin ring that trails the pointer (fine pointers, live scene only) */
.sight { position: fixed; left: 0; top: 0; z-index: 2; width: 8.5rem; height: 8.5rem; margin: -4.25rem 0 0 -4.25rem; border-radius: 50%; border: 1px solid var(--r-hair-strong); pointer-events: none; opacity: 0; transition: opacity var(--duration-slow) var(--ease-premium); will-change: transform; }
.sight::before, .sight::after { content: ""; position: absolute; background: var(--r-hair-strong); }
.sight::before { left: 50%; top: -0.5rem; width: 1px; height: 1rem; box-shadow: 0 8.5rem 0 var(--r-hair-strong); }
.sight::after { top: 50%; left: -0.5rem; height: 1px; width: 1rem; box-shadow: 8.5rem 0 0 var(--r-hair-strong); }
.sight.is-on { opacity: 0.85; }
.stage-pause { position: fixed; right: var(--gutter); top: calc(var(--header-h) + var(--space-3)); z-index: 8; display: inline-flex; align-items: center; gap: var(--space-2); min-height: 2.75rem; padding: 0 var(--space-4); border-radius: var(--radius-pill); background: var(--color-scrim-strong); border: 1px solid var(--color-glass-line); font-family: var(--font-text); font-size: var(--r-tiny); font-weight: 700; letter-spacing: 0.06em; color: var(--color-ink); opacity: 0; transition: opacity var(--duration-normal) var(--ease-premium), border-color var(--duration-fast) var(--ease-premium), transform var(--duration-fast) var(--ease-premium); }
.stage-pause.is-on { opacity: 1; }
.stage-pause:hover { border-color: var(--color-moon); }
.stage-pause:active { transform: scale(0.97); }
.stage-pause svg { width: 0.9rem; height: 0.9rem; }
.research-r2 .scene-say { max-width: min(44rem, calc(100% - 2 * var(--space-4))); font-family: var(--font-text); }
.research-r2 .scene-say--page { bottom: calc(var(--rail-h) + var(--space-4)); z-index: 30; }

/* ---------- first screen ---------- */
.hero { position: relative; min-height: calc(100svh - var(--head-h) - var(--rail-h)); padding: calc(var(--header-h) + 3svh) var(--gutter) 2svh; display: grid; align-content: center; }
.hero::before { content: ""; position: absolute; inset: 0 auto calc(-1 * (var(--head-h) + var(--rail-h))) 0; width: 62vw; z-index: -1; pointer-events: none; background: linear-gradient(90deg, var(--r-veil) 0%, var(--r-veil-soft) 46%, transparent 100%); }
.hero__text { display: grid; gap: clamp(1rem, 2.6svh, 2rem); max-width: min(46vw, 62rem); }
.hero h1 { font-size: var(--r-title); line-height: 0.96; letter-spacing: -0.018em; max-width: 11ch; }
.hero h1[data-len="mid"] { font-size: calc(var(--r-title) * 0.74); max-width: 14ch; }
.hero h1[data-len="long"] { font-size: calc(var(--r-title) * 0.56); max-width: 17ch; }
.hero h1 em, .hero h1 .is-em { font-style: italic; color: var(--color-river-blue); }
.hero .lede { font-size: var(--r-claim); max-width: 36em; color: var(--color-ink-muted); }
.hero .actions { display: flex; flex-wrap: wrap; gap: var(--space-3); }
/* the headline arrives word by word (script splits it; without script it is plain text) */
.hero h1 .w { display: inline-block; overflow: hidden; padding: 0.1em 0.06em 0.14em 0; margin: -0.1em -0.06em -0.14em 0; vertical-align: top; }
.hero h1 .w > span { display: inline-block; }
.js .hero h1 .w > span { transform: translateY(112%); }
.js .is-arrived h1 .w > span { transform: none; transition: transform var(--duration-page) var(--ease-premium) calc(var(--w, 0) * 110ms); }
.sight-hint { display: inline-flex; align-items: center; gap: var(--space-3); margin-top: clamp(0.25rem, 1.4svh, 1rem); font-size: var(--r-small); color: var(--color-ink-dim); }
.sight-hint__eye { flex: none; width: 1.4rem; height: 1.4rem; border-radius: 50%; border: 1px solid var(--r-hair-strong); box-shadow: inset 0 0 0 0.32rem var(--color-bg), inset 0 0 0 0.7rem var(--color-moon); animation: eye-breathe 4.8s ease-in-out infinite alternate; }
@keyframes eye-breathe { from { opacity: 0.55; transform: scale(0.92); } to { opacity: 1; transform: scale(1.06); } }
html[data-scene="poster"] .sight-hint, html[data-scene="none"] .sight-hint { display: none; }

/* ---------- the six areas: a head, a scale that stays, six notes ---------- */
.areas { position: relative; }
.areas__head { height: var(--head-h); padding-inline: var(--gutter); display: flex; align-items: center; gap: var(--space-5); }
.areas__head h2 { font-size: var(--r-h2); line-height: 1; }
/* the scale: from "shipping today" to "years away". It holds at the foot of the screen through all six notes. */
.range { position: sticky; top: calc(100svh - var(--rail-h)); z-index: 6; height: var(--rail-h); padding: 0 var(--gutter); display: grid; align-content: center; background: linear-gradient(180deg, transparent 0%, var(--r-rail) 34%); }
.range__ends { position: absolute; left: var(--gutter); right: var(--gutter); top: 0.15rem; display: flex; justify-content: space-between; font-size: var(--r-tiny); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-ink-dim); }
.range__ends span { padding: 0.15rem 0.5rem; margin-inline: -0.5rem; border-radius: var(--radius-sm); background: var(--r-veil); }   /* the river can run bright under "Years away" */
.range__list { position: relative; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); border-top: 1px solid var(--r-hair); margin-top: 1.5rem; }
.range__list a { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: var(--space-3); row-gap: 0.1rem; align-items: baseline; min-height: 2.9rem; padding: 0.6rem var(--space-4) 0.35rem 0; color: var(--color-ink-muted); transition: color var(--duration-fast) var(--ease-premium); }
.range__list a::before { content: ""; position: absolute; left: 0; top: -1px; width: 1px; height: 0.6rem; background: var(--r-hair-strong); transform-origin: 50% 0; transition: transform var(--duration-normal) var(--ease-premium), background-color var(--duration-fast) var(--ease-premium); }
.range__list a::after { content: ""; position: absolute; left: 0; right: var(--space-4); top: -1px; height: 1px; background: var(--color-ink); transform: scaleX(0); transform-origin: 0 50%; transition: transform var(--duration-slow) var(--ease-premium); }
.range__no { grid-row: 1 / span 2; font-family: var(--font-display); font-style: italic; font-size: var(--text-lg); color: var(--color-ink-dim); font-variant-numeric: lining-nums; transition: color var(--duration-fast) var(--ease-premium); }
.range__title { font-size: var(--r-small); font-weight: 700; letter-spacing: 0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.range__st { grid-column: 2; }
.range__list a:hover, .range__list a.is-here { color: var(--color-ink); }
.range__list a:hover::before, .range__list a.is-here::before { transform: scaleY(1.8); background: var(--color-ink); }
.range__list a:hover::after { transform: scaleX(1); }
.range__list a.is-here .range__no { color: var(--color-marigold); }
.range__list a:active { color: var(--color-moon); }
.range__list a:focus-visible { outline-offset: -2px; }
.range__mark { position: absolute; left: var(--gutter); top: calc(1.5rem + (var(--rail-h) - 1.5rem - 2.9rem - 0.95rem) / 2 + 0.2rem); width: 0.6rem; height: 0.6rem; margin: -0.3rem 0 0 -0.3rem; border-radius: 50%; background: var(--color-marigold); box-shadow: 0 0 0 0.3rem color-mix(in srgb, var(--color-marigold) 22%, transparent); opacity: 0; transition: opacity var(--duration-slow) var(--ease-premium); will-change: transform; pointer-events: none; }
.range.is-live .range__mark { opacity: 1; }
.range { transition: opacity var(--duration-slow) var(--ease-premium); }
.range.is-past { opacity: 0; pointer-events: none; }
.range.is-past:focus-within { opacity: 1; pointer-events: auto; }

/* status: a word and a colour, never the colour alone */
.st { display: inline-flex; align-items: center; gap: 0.45em; font-size: var(--r-tiny); font-weight: 700; letter-spacing: 0.1em; text-transform: uppercase; color: var(--st); white-space: nowrap; }
.st::before { content: ""; width: 0.5em; height: 0.5em; border-radius: 50%; background: var(--st); flex: none; }
.st--ship { --st: var(--color-success); }
.st--proto { --st: var(--color-marigold); }
.st--research { --st: var(--color-mneme); }
.st--research::before { background: none; box-shadow: inset 0 0 0 1.5px var(--st); }

/* ---------- a note: it holds while the eye travels to what was found ---------- */
.note { position: relative; min-height: 172svh; scroll-margin-top: 0; }
.note__frame { position: sticky; top: 0; height: 100svh; padding: calc(var(--header-h) + 2svh) var(--gutter) calc(var(--rail-h) + 2svh); display: grid; grid-template-columns: var(--col-text) minmax(0, 1fr) var(--col-meta); align-items: center; }
.note__frame::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 52vw; z-index: -1; pointer-events: none; background: linear-gradient(90deg, var(--r-veil) 0%, var(--r-veil-soft) 52%, transparent 100%); }
.note__frame::after { content: ""; position: absolute; inset: 0 0 0 auto; width: 26vw; z-index: -1; pointer-events: none; background: linear-gradient(270deg, var(--r-veil) 0%, var(--r-veil) 52%, transparent 100%); }   /* the margin column keeps its own dark ground: a structure can run bright behind it */
.note__text { grid-column: 1; display: grid; gap: clamp(0.9rem, 2.4svh, 1.6rem); }
.note__no { display: flex; align-items: baseline; gap: var(--space-3); font-family: var(--font-display); font-style: italic; color: var(--color-marigold); font-size: var(--r-h2); line-height: 1; font-variant-numeric: lining-nums; }
.note__of { font-family: var(--font-text); font-style: normal; font-size: var(--r-tiny); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-ink-dim); }
.note h3 { font-size: var(--r-h3); line-height: 1.02; letter-spacing: -0.014em; }
.note__claim { font-size: var(--r-claim); line-height: 1.58; color: var(--color-ink); max-width: 34em; }
.note__claim .ext { color: var(--pi); text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.2em; transition: color var(--duration-fast) var(--ease-premium); }
.note__claim .ext:hover { color: var(--color-ink); }
.note__claim .ext svg { display: inline-block; width: 0.62em; height: 0.62em; margin-left: 0.25em; }
.note__meta { grid-column: 3; display: grid; gap: clamp(1rem, 2.6svh, 1.75rem); align-content: center; }
.meta { display: grid; gap: var(--space-2); padding-top: var(--space-3); border-top: 1px solid var(--r-hair); }
.meta dt { font-size: var(--r-tiny); font-weight: 700; letter-spacing: 0.14em; text-transform: uppercase; color: var(--color-ink-muted); }
.meta dd { display: grid; gap: var(--space-2); justify-items: start; font-size: var(--r-small); color: var(--color-ink-muted); }
/* the three stages a note can be at, the one it is at filled in */
.ladder { display: inline-grid; grid-template-columns: repeat(3, 1.6rem); gap: 0.3rem; }
.ladder i { height: 0.3rem; border-radius: 2px; background: var(--r-hair); }
.ladder[data-step="1"] i:nth-child(-n+1), .ladder[data-step="2"] i:nth-child(-n+2), .ladder[data-step="3"] i:nth-child(-n+3) { background: var(--color-ink-muted); }
.keys { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; }
.keys li { display: inline-flex; align-items: center; min-height: 1.75rem; padding: 0 0.7rem; border-radius: var(--radius-sm); border: 1px solid var(--r-hair); background: var(--r-veil-soft); font-size: var(--r-tiny); color: var(--color-ink); white-space: nowrap; }
.keys code { font-size: 1em; }
.goal { display: inline-grid; grid-template-columns: repeat(10, 0.8rem); gap: 0.28rem; }
.goal i { width: 0.8rem; height: 0.8rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--color-marigold); }
.goal__say { line-height: 1.45; }
.goal__say .num { font-family: var(--font-mono); color: var(--color-ink); }
/* words of the note, pinned to the thing they name (the script moves them; they repeat the text, so they are hidden from readers) */
.pin { position: fixed; left: 0; top: 0; z-index: 3; pointer-events: none; opacity: 0; transition: opacity 500ms var(--ease-premium); will-change: transform; font-style: normal; }
.pin.is-on { opacity: 1; }
.pin::before { content: ""; position: absolute; left: -0.25rem; top: -0.25rem; width: 0.5rem; height: 0.5rem; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--color-marigold); }
.pin i { position: absolute; left: 0.2rem; top: 0; width: 2.9rem; height: 1px; background: var(--r-hair-strong); transform-origin: 0 50%; transform: rotate(-34deg); }
.pin b { position: absolute; left: 2.75rem; bottom: 0.95rem; padding: 0.2rem 0.65rem; border-radius: var(--radius-sm); background: var(--color-scrim-strong); border: 1px solid var(--r-hair); font-family: var(--font-text); font-size: var(--r-tiny); font-weight: 700; letter-spacing: 0.08em; color: var(--color-ink); white-space: nowrap; }
.pin--left i { left: auto; right: 0.2rem; transform-origin: 100% 50%; transform: rotate(34deg); }
.pin--left b { left: auto; right: 2.75rem; }
.pin--low i { transform: rotate(34deg); }
.pin--low.pin--left i { transform: rotate(-34deg); }
.pin--low b { bottom: auto; top: 0.95rem; }

/* ---------- the open questions ---------- */
.ask { position: relative; min-height: 165svh; }
.ask__frame { position: sticky; top: 0; min-height: 100svh; padding: calc(var(--header-h) + 4.5rem) var(--gutter) 5svh; display: grid; grid-template-columns: minmax(0, 23vw) minmax(0, 1fr); column-gap: 19vw; align-items: center; }
.ask__frame::before { content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none; background: linear-gradient(90deg, var(--r-veil) 0%, var(--r-veil-soft) 24%, transparent 34%, transparent 46%, var(--r-veil-soft) 56%, var(--r-veil) 100%); }
.ask__head { display: grid; gap: clamp(1rem, 2.6svh, 1.75rem); justify-items: start; }
.ask h2 { font-size: var(--r-h3); line-height: 1.02; letter-spacing: -0.014em; max-width: 12ch; }
.ask__invite { font-size: var(--r-claim); color: var(--color-ink-muted); max-width: 22em; }
.ask__list { counter-reset: q; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: clamp(2rem, 3vw, 5rem); }
.ask__list li { counter-increment: q; position: relative; display: grid; grid-template-columns: 2.4em minmax(0, 1fr); align-items: baseline; padding: clamp(0.9rem, 2.6svh, 1.9rem) 0; border-top: 1px solid var(--r-hair); font-family: var(--font-display); font-size: var(--r-q); line-height: 1.16; color: var(--color-ink); transition: border-color var(--duration-normal) var(--ease-premium); }
.ask__list li::before { content: counter(q, decimal-leading-zero); font-style: italic; font-size: 0.72em; color: var(--color-marigold); font-variant-numeric: lining-nums; transition: transform var(--duration-normal) var(--ease-premium); transform-origin: 0 80%; }
.ask__list li::after { content: ""; position: absolute; left: 0; top: -1px; width: 100%; height: 1px; background: var(--color-marigold); transform: scaleX(0); transform-origin: 0 50%; transition: transform 600ms var(--ease-premium); }
.ask__list li:hover::after { transform: scaleX(1); }
.ask__list li:hover::before { transform: scale(1.18); }
.ask__list span { text-wrap: pretty; }

/* ---------- layouts by screen shape ---------- */
/* not ultrawide: the margin column moves under the text */
@media (max-aspect-ratio: 2/1), (max-width: 1500px) {
  .research-r2 { --col-text: min(38vw, 44rem); }
  .note__frame { grid-template-columns: var(--col-text) minmax(0, 1fr); align-content: center; row-gap: clamp(1rem, 3svh, 2rem); }
  .note__frame::after { display: none; }
  .note__meta { grid-column: 1; grid-auto-flow: column; grid-auto-columns: minmax(0, max-content); justify-content: start; column-gap: var(--space-6); align-items: start; }
  .ask__frame { grid-template-columns: minmax(0, 26vw) minmax(0, 1fr); column-gap: 14vw; }
  .ask__frame::before { background: linear-gradient(90deg, var(--r-veil) 0%, var(--r-veil-soft) 24%, transparent 31%, transparent 39%, var(--r-veil-soft) 46%, var(--r-veil) 100%); }
  .ask__list { grid-template-columns: minmax(0, 1fr); }
  .ask__list li { padding-block: clamp(0.7rem, 1.9svh, 1.4rem); }
}
/* narrow or upright: the scene on top, the words under it, nothing held */
@media (max-width: 62rem), (max-aspect-ratio: 1/1) {
  .research-r2 { --col-text: 100%; --rail-h: 0rem; --head-h: auto; }
  .hero { min-height: 100svh; align-content: end; padding-bottom: 5svh; }
  .hero::before { inset: auto 0 0 0; width: auto; height: 78%; background: linear-gradient(0deg, var(--r-veil) 0%, var(--r-veil) 46%, transparent 100%); }
  .hero__text { max-width: none; }
  .hero h1 { max-width: none; }
  .areas__head { padding-block: var(--space-7) var(--space-4); flex-direction: column; align-items: flex-start; gap: var(--space-3); background: var(--r-veil); }
  .range { position: static; height: auto; padding-block: 0 var(--space-9); background: linear-gradient(180deg, var(--r-veil) 0%, var(--r-veil) calc(100% - 5rem), transparent 100%); }
  .range__ends { position: static; margin-bottom: var(--space-2); }
  .range__list { grid-template-columns: minmax(0, 1fr); margin-top: 0; border-top: 0; }
  .range__list a { min-height: 3.5rem; padding: 0.6rem 0; border-top: 1px solid var(--r-hair); grid-template-columns: 2.4rem minmax(0, 1fr); align-items: baseline; }
  .range__title { white-space: normal; font-size: var(--text-base); }
  .range__list a::before, .range__list a::after, .range__mark { display: none; }
  .note { min-height: 0; }
  .note__frame { position: relative; height: auto; min-height: 100svh; padding: 54svh var(--gutter) var(--space-8); grid-template-columns: minmax(0, 1fr); align-content: start; }
  .note__frame::before { inset: 38svh 0 0 0; width: auto; background: linear-gradient(180deg, transparent 0%, var(--r-veil) 22svh, var(--r-veil) calc(100% - 4rem), transparent 100%); }
  .note__meta { grid-auto-flow: row; }
  .pin { display: none; }
  .ask { min-height: 0; }
  .ask__frame { position: relative; grid-template-columns: minmax(0, 1fr); row-gap: var(--space-7); padding-top: 46svh; align-content: start; }
  .ask__frame::before { background: linear-gradient(180deg, transparent 0%, var(--r-veil) 34svh, var(--r-veil) 100%); }
  .ask h2 { max-width: none; }
  .stage-pause span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .stage-pause { padding: 0; width: 2.75rem; justify-content: center; right: var(--space-3); }
  .research-r2 .scene-say--page { bottom: auto; }
}
/* a short wide screen keeps the held notes but tightens them */
@media (min-width: 62.01rem) and (max-height: 46rem) {
  .note__claim { line-height: 1.5; }
  .meta { padding-top: var(--space-2); }
}

/* ---------- reduced motion: one still per section, fades stay ---------- */
@media (prefers-reduced-motion: reduce) {
  .js .hero h1 .w > span { transform: none; transition: none; }
  .sight-hint__eye { animation: none; }
  .note { min-height: 100svh; }
  .ask { min-height: 100svh; }
  .range__list a::before, .range__list a::after, .ask__list li::after, .ask__list li::before { transition: none; }
}
@media (forced-colors: active) {
  .keys li, .pin b, .stage-pause { border: 1px solid ButtonText; }
  .ladder i, .goal i { forced-color-adjust: none; }
}
