﻿/* Copied from _explorations/story-A/dist. Edited for the site: the two @font-face rules are removed (the site serves both fonts from /assets/fonts). Site overrides live in /assets/css/page-home.css. */
/* Combination scroll story. Everything is scoped to .story. Re-theme with the custom properties below,
   on :root or on the story element; the defaults use :where() so any site rule wins. */

:where(:root) {
  --story-paper: #f2f1ed;   /* background of the light beats: the desk and the page */
  --story-sheet: #ffffff;   /* drawing sheet */
  --story-ink: #0b0b0c;     /* text and lines on light */
  --story-dark: #09090a;    /* background of the dark beats: inside the machine, the studio */
  --story-bench: #e6e5e1;   /* background of the last beat */
  --story-line: #ecece9;    /* lines on dark */
  --story-accent: #ff5a1f;  /* the one highlighter colour */
  --story-muted: #5d5d5a;   /* caption sentence on light */
  --story-muted-dark: #a6a6a2; /* caption sentence on dark */
  --story-on-dark: #f4f4f1; /* text on dark */
  --story-len: 11;          /* length of the story in screen heights */
  --story-font-sans: Manrope, system-ui, -apple-system, 'Segoe UI', sans-serif;
  --story-font-mono: 'JetBrains Mono', ui-monospace, Consolas, monospace;
  --story-gutter: clamp(20px, 5vw, 72px);
}

.story { position: relative; display: block; background: var(--story-paper); color: var(--story-ink); font-family: var(--story-font-sans); }
.story:empty { min-height: 100vh; } /* holds the place until the script has built the story */
.story *, .story *::before, .story *::after { box-sizing: border-box; }
.story :focus-visible { outline: 2px solid var(--story-accent); outline-offset: 3px; }
.story__heading { position: absolute; width: 1px; height: 1px; margin: 0; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.story__end { display: block; height: 0; outline: 0; }
.story__skip { position: absolute; z-index: 6; top: 20px; right: var(--story-gutter); font: 500 12px/1 var(--story-font-mono); letter-spacing: .08em; text-transform: uppercase; color: inherit; text-underline-offset: 4px; padding: 12px 0; }

/* ---------- static: a calm vertical sequence (reduced motion, no WebGL, before the script runs) ---------- */
.story__beats { list-style: none; margin: 0 auto; padding: 56px var(--story-gutter); max-width: 1100px; }
.story__beat { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: clamp(20px, 5vw, 72px); align-items: center; padding: 40px 0; border-top: 1px solid rgba(0, 0, 0, .12); }
.story__beat:first-child { border-top: 0; }
.story__still, .story__sketch { display: block; width: 100%; height: auto; border-radius: 3px; background: #d9d8d4; }
.story__sketch { background: none; }
.story__num { font: 500 12px/1.2 var(--story-font-mono); letter-spacing: .09em; text-transform: uppercase; margin: 0 0 18px; display: flex; align-items: center; gap: 10px; }
.story__num::before { content: ''; width: 18px; height: 2px; background: var(--story-accent); flex: none; }
.story__title { font: 600 clamp(28px, 3.5vw, 54px)/1.04 var(--story-font-sans); letter-spacing: -.028em; margin: 0 0 18px; text-wrap: balance; }
.story__text { margin: 0; font-size: 17px; line-height: 1.55; color: var(--story-muted); max-width: 34ch; }
.story .sk { fill: none; stroke: #161617; stroke-width: 1.25; stroke-linecap: round; stroke-linejoin: round; }
.story .sk--faint { stroke-width: .8; opacity: .55; }
.story .sk--hl { stroke: var(--story-accent); stroke-width: 9; stroke-linecap: butt; opacity: .5; mix-blend-mode: multiply; }
.story--static .story__skip { position: static; display: inline-block; margin: 24px var(--story-gutter) 0; }
@media (max-width: 760px) { .story__beat { grid-template-columns: 1fr; gap: 20px; } .story__text { font-size: 15px; } }

/* ---------- live: one pinned stage driven by scroll ---------- */
.story--live { height: calc(var(--story-len) * 100vh); }
.story--live .story__end { position: absolute; left: 0; bottom: 0; } /* the skip link lands just past the story */
.story--live .story__stage { position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--story-paper); transition: background-color .35s linear, color .35s linear; }
.story--live .story__stage[data-theme='dark'] { background: var(--story-dark); color: var(--story-on-dark); --story-muted: var(--story-muted-dark); }
.story--live .story__stage[data-theme='bench'] { background: var(--story-bench); }
.story--live .story__visual { position: absolute; inset: 0; }
.story__canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; opacity: 0; transition: opacity .45s linear; }
.story__canvas.is-ready { opacity: 1; }
.story--live .story__beats { position: static; margin: 0; padding: 0; max-width: none; }
.story--live .story__beat { display: block; padding: 0; border: 0; }
.story--live .story__still { display: none; }
.story--live .story__sketch { position: absolute; z-index: 1; left: 0; top: 0; width: 320px; height: 300px; max-width: none; transform-origin: 0 0; border-radius: 0; pointer-events: none;
  /* until the script places it: roughly centred in the free area */
  transform: translate(63.5vw, 50vh) scale(2.4) translate(-150px, -150px); }
.story--live .story__caption { position: absolute; z-index: 3; left: var(--story-gutter); top: 50%; width: min(30vw, 400px); transform: translateY(-46%); opacity: 0; transition: opacity .3s linear, transform .5s cubic-bezier(.2, .7, .2, 1); pointer-events: none; }
.story--live .story__beat.is-on .story__caption { opacity: 1; transform: translateY(-50%); pointer-events: auto; }
.story--live .story__title, .story--live .story__text, .story--live .story__num { transition: color .35s linear; }
.story__rail { position: absolute; z-index: 3; left: var(--story-gutter); bottom: 30px; display: flex; align-items: center; gap: 12px; font: 500 11px/1 var(--story-font-mono); letter-spacing: .08em; opacity: .9; }
.story__rail span { display: flex; align-items: flex-end; gap: 9px; height: 14px; }
.story__rail i { width: 1px; height: 7px; background: currentColor; opacity: .4; transition: height .25s, opacity .25s, background-color .25s; }
.story__rail i.is-on { height: 14px; opacity: 1; background: var(--story-accent); width: 2px; }
.story__rail em { font-style: normal; opacity: .5; }
.story__code { position: absolute; z-index: 2; right: 4vw; top: 50%; transform: translateY(-50%); width: 272px; min-height: 15em; margin: 0; font: 500 11.5px/1.75 var(--story-font-mono); color: #d9d9d5; white-space: pre; opacity: 0; pointer-events: none; }
.story__code u { display: inline-block; width: .6em; height: 1.1em; margin-left: 1px; vertical-align: -.18em; background: var(--story-accent); text-decoration: none; }
.story__ver { position: absolute; z-index: 2; right: 6vw; top: 14%; display: grid; grid-template-columns: repeat(4, 14px); gap: 6px; align-items: end; color: var(--story-on-dark); opacity: 0; pointer-events: none; }
.story__ver b { grid-column: 1 / -1; font: 500 64px/1 var(--story-font-mono); letter-spacing: -.04em; }
.story__ver span { grid-column: 1 / -1; font: 500 11px/1 var(--story-font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--story-muted-dark); margin: 4px 0 8px; }
.story__ver i { height: 3px; background: #4a4a4c; }
.story__ver i.is-on { background: var(--story-accent); }
.story__strand { position: absolute; z-index: 2; left: 0; top: 0; margin: -22px 0 0 10px; font: 500 11px/1 var(--story-font-mono); letter-spacing: .09em; text-transform: uppercase; color: var(--story-on-dark); white-space: nowrap; opacity: 0; pointer-events: none; padding-left: 22px; }
.story__strand::before { content: ''; position: absolute; left: 0; top: 50%; width: 16px; height: 1px; background: var(--story-accent); }

/* phones and tall windows: the object in the upper part, the caption under it */
@media (max-width: 819px), (max-aspect-ratio: 9/10) {
  .story--live .story__sketch { transform: translate(49vw, 33vh) scale(1.15) translate(-150px, -150px); }
  .story--live .story__caption { left: 20px; right: 20px; width: auto; top: auto; bottom: 62px; transform: translateY(8px); }
  .story--live .story__beat.is-on .story__caption { transform: none; }
  .story--live .story__title { font-size: clamp(26px, 7.4vw, 34px); margin-bottom: 12px; }
  .story--live .story__num { margin-bottom: 12px; }
  .story--live .story__text { font-size: 15px; line-height: 1.5; max-width: 40ch; }
  .story__rail { left: 20px; bottom: 22px; }
  .story__code { right: 12px; top: 8%; transform: none; width: 176px; font-size: 9px; line-height: 1.7; }
  .story__ver { right: 20px; top: 16px; grid-template-columns: repeat(4, 10px); gap: 4px; }
  .story__ver b { font-size: 36px; }
  .story__skip { right: 20px; top: 12px; }
}
@media (prefers-reduced-motion: reduce) { .story *, .story { transition: none !important; animation: none !important; } }
