/* =============================================================================
   About · the story (#story-intro … #story-outro), 2 Nov 2026.

   Paced on savor.it/process: one centred column, one idea per screen, a thin
   thread drawn down each chapter, labelled diagram moments and an arch step
   card closing each chapter, full-bleed moving grounds that hold still while
   the words scroll over them.

   Motion is scroll-scrubbed, not timed: js/about-story.js writes --p (0 → 1)
   on every [data-st] element from where it sits in the viewport, and the
   rules below read it. All of them sit under html.st-on, which the script
   only sets when motion is allowed, so without JS or with reduced motion the
   section is simply its finished state.

   This section is centred on purpose, to follow the reference. It is the one
   place on the site that breaks the held-left rule.
   ============================================================================= */

.st { position: relative; overflow: clip; text-align: center; padding-inline: var(--page-margin); }
.st > :not(.st-bg) { position: relative; z-index: 1; }
.st-col { max-width: 760px; margin: 0 auto; width: 100%; }
.st-col--wide { max-width: 1000px; }
.st-screen { min-height: 80vh; display: grid; place-items: center; padding-block: 12vh; }
.st-screen--short { min-height: 60vh; padding-block: 6vh; }

/* Type */
.st-lede { margin: 0 auto; max-width: 24ch; font: var(--weight-medium, 500) clamp(26px, 3.2vw, 42px)/1.2 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.st-lede + .st-lede { margin-top: .9em; }
.st-lede--accent { color: var(--ebr-purple); }
.st-body { margin: 24px auto 0; max-width: 34em; font-size: var(--type-copy, 17px); line-height: 1.6; color: var(--text-copy, #4A4A4A); text-wrap: pretty; }
.e-ground-ink .st-body, .e-ground-brand .st-body { color: var(--text-on-dark-muted); }
.st-cap { display: block; font: var(--type-label); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-muted); }
.e-ground-ink .st-cap, .e-ground-brand .st-cap { color: var(--text-on-dark-muted); }
.st-screen .st-col > .st-cap { margin-bottom: 30px; }

/* Full-bleed moving ground, pinned while the chapter scrolls over it */
.st-bg { position: sticky; top: 0; height: 100vh; height: 100lvh; margin-bottom: -100vh; margin-bottom: -100lvh; margin-inline: calc(var(--page-margin) * -1); z-index: 0; pointer-events: none; }
.st-bg__v { width: 100%; height: 100%; object-fit: cover; display: block; }
.st-bg::after { content: ""; position: absolute; inset: 0; background: linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,.18)); }


/* Intro */
.st-intro { padding-block: 14vh 22vh; }

/* Chapter title screen */
.st-head { min-height: 100vh; min-height: 100svh; display: grid; place-content: center; padding-block: 16vh 6vh; }
.st-num { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 16px; }
.st-num b { font: 500 clamp(64px, 9vw, 124px)/1 var(--font-display); letter-spacing: -.04em; }
.st-num .st-cap:first-child { text-align: right; }
.st-num .st-cap:last-child { text-align: left; }
.st-title { margin: 20px 0 0; font: 600 clamp(60px, 11vw, 176px)/.92 var(--font-display); letter-spacing: -.05em; text-wrap: balance; }

/* Thread */
.st-thread { width: 1px; height: 30vh; margin: 0 auto; background: currentColor; opacity: .55; transform-origin: top; }

/* Diagram: labels either side of a dotted spine */
.st-dia { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; display: grid; gap: 14px; font-size: 16px; }
.st-dia li { position: relative; width: 50%; }
.st-dia li::after { content: ""; position: absolute; top: .55em; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.st-dia__l { text-align: right; padding-right: 22px; }
.st-dia__l::after { right: -4px; }
.st-dia__r { margin-left: 50%; text-align: left; padding-left: 22px; }
.st-dia__r::after { left: -3px; }
.st-dia--hot { color: var(--ebr-yellow); }

/* Arch step card */
.st-arch { position: relative; width: min(760px, 100%); margin: 0 auto; aspect-ratio: 1000 / 720; }
.st-arch__ring { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.st-arch__ring path { fill: none; stroke: currentColor; stroke-width: 1.2; vector-effect: non-scaling-stroke; opacity: .6; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.st-arch__in { position: absolute; inset: 14% 16% auto; display: grid; justify-items: center; gap: 12px; }
.st-step { font: 600 11px/1 var(--font-mono); padding: 5px 9px; border: 1px solid currentColor; border-radius: 99px; }
.st-arch h3 { margin: 6px 0 0; font: var(--weight-medium, 500) clamp(22px, 2.6vw, 34px)/1.2 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.st-arch p { margin: 0; font-size: 16px; line-height: 1.55; max-width: 36em; color: var(--text-copy, #4A4A4A); }
.e-ground-ink .st-arch p, .e-ground-brand .st-arch p { color: var(--text-on-dark-muted); }

/* Word arc */
.st-arc { position: relative; height: 380px; width: 100%; max-width: 900px; margin: 0 auto; }
.st-arc__path { position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; }
.st-arc__path path { fill: none; stroke: currentColor; stroke-width: 1; vector-effect: non-scaling-stroke; opacity: .7; stroke-dasharray: 1 1; }
.st-arc span { position: absolute; left: var(--x); top: var(--y); transform: translate(-50%, -50%) rotate(var(--r, 0deg)); font: var(--weight-medium, 500) clamp(15px, 1.4vw, 19px)/1 var(--font-display); white-space: nowrap; }
.st-arc--hot { color: var(--ebr-yellow); }

/* Milestones (placeholders until Adrian writes them) */
.st-miles { list-style: none; margin: 0 auto; padding: 0; max-width: 560px; }
.st-miles li { display: grid; grid-template-columns: 1fr 1px 1fr; column-gap: 22px; }
.st-miles li::before { content: ""; grid-column: 2; grid-row: 1; background: currentColor; opacity: .5; }
.st-miles__yr { grid-column: 1; grid-row: 1; text-align: right; padding-block: 20px; font: 600 clamp(28px, 3.4vw, 40px)/1 var(--font-display); letter-spacing: -.03em; }
.st-miles__tx { grid-column: 3; grid-row: 1; text-align: left; padding-block: 20px; font-size: 15px; line-height: 1.45; color: var(--text-on-dark-muted); }
.st-miles__tx b { display: block; font-weight: 600; color: var(--text-on-dark); }
.st-miles li[data-todo] .st-miles__yr { opacity: .55; }

/* Today */
.st-figs { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 24px; }
.st-figs b { display: block; font: 600 clamp(48px, 6vw, 88px)/1 var(--font-display); letter-spacing: -.05em; font-variant-numeric: tabular-nums; }
.st-figs span { display: block; margin-top: 12px; font: var(--type-label); letter-spacing: var(--tracking-label); text-transform: uppercase; color: var(--text-muted); }
.st-svc { list-style: none; padding: 0; margin: 36px auto 0; display: flex; flex-wrap: wrap; justify-content: center; gap: 10px 12px; max-width: 760px; }
.st-svc a { display: inline-block; padding: 10px 16px; border-radius: 99px; background: var(--paper); color: var(--ink-900); font-size: 15px; text-decoration: none; transition: background .2s, color .2s; }
.st-svc a:hover { background: var(--ink-900); color: var(--white); }
.st-svc .is-new a { background: var(--ebr-purple); color: var(--white); }
.st-svc a:focus-visible { outline: 2px solid var(--ebr-purple); outline-offset: 3px; }

/* Close: photo collage around the founder's line */
.st-close { padding-block: 12vh var(--section-y); }
.st-close__h { margin-bottom: 48px; }
.st-collage { position: relative; height: 680px; max-width: 1240px; margin: 0 auto; }
.st-ph { position: absolute; left: var(--x); top: var(--y); width: var(--w); height: var(--h); display: grid; place-items: center; padding: 12px; border-radius: 4px; background: #E4E2DC; font: 600 10px/1.4 var(--font-mono); letter-spacing: .1em; text-transform: uppercase; color: var(--text-muted); }
.st-quote { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(560px, 90%); margin: 0; }
.st-quote blockquote { margin: 0; font: var(--weight-medium, 500) clamp(24px, 2.8vw, 34px)/1.25 var(--font-display); letter-spacing: -.02em; text-wrap: balance; }
.st-quote .st-cap { margin-top: 18px; }

/* ---------- Phones ---------- */
@media (max-width: 1100px) {
  .st-collage { height: auto; display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
  .st-ph { position: static; width: auto; height: auto; aspect-ratio: 4 / 3; }
  .st-quote { position: static; transform: none; width: 100%; grid-column: 1 / -1; order: -1; margin-bottom: 40px; }
}
@media (max-width: 700px) {
  .st-figs { grid-template-columns: repeat(2, minmax(0, 1fr)); row-gap: 36px; }
  .st-arc { height: auto; display: grid; gap: 14px; justify-items: center; }
  .st-arc span { position: static; transform: none; }
  .st-arc__path { display: none; }
  .st-arch { aspect-ratio: auto; padding: 56px 0 0; }
  .st-arch__in { position: static; padding-inline: 6%; }
  .st-dia { font-size: 15px; }
}

/* ---------- Scroll-scrubbed motion (only with html.st-on) ---------- */
.st-on [data-st] { --p: 0; }
.st-on .st-rv { opacity: calc(.06 + .94 * var(--p)); transform: translateY(calc((1 - var(--p)) * 36px)); }
.st-on .st-thread { transform: scaleY(var(--p)); }
.st-on .st-head .st-title { opacity: var(--p); letter-spacing: calc(-.05em + (1 - var(--p)) * .08em); }
.st-on .st-head .st-num b { opacity: var(--p); transform: translateY(calc((1 - var(--p)) * 24px)); }
.st-on .st-head .st-num .st-cap:first-child { opacity: var(--p); transform: translateX(calc((1 - var(--p)) * -24px)); }
.st-on .st-head .st-num .st-cap:last-child { opacity: var(--p); transform: translateX(calc((1 - var(--p)) * 24px)); }
.st-on .st-dia li,
.st-on .st-miles li,
.st-on .st-figs > div,
.st-on .st-svc li { opacity: clamp(0, calc(var(--p) * 6 - var(--i)), 1); transform: translateY(calc((1 - clamp(0, calc(var(--p) * 6 - var(--i)), 1)) * 18px)); }
.st-on .st-arc span { opacity: clamp(0, calc(var(--p) * 6 - var(--i) - .6), 1); }
.st-on .st-arc__path path,
.st-on .st-arch__ring path { stroke-dashoffset: calc(1 - var(--p)); }
.st-on .st-ph { transform: translateY(calc((1 - var(--p)) * (60px + var(--i) * 18px))); opacity: calc(.2 + .8 * var(--p)); }

/* Headings take the ground's text colour (the global h2/h3 colour is ink). */
.st-title, .st-arch h3, .st-quote blockquote, .st-num b, .st-lede { color: inherit; }
.st-lede--accent { color: var(--ebr-purple); }
.st-on .st-svc li { opacity: clamp(0, calc(var(--p) * 10 - var(--i)), 1); transform: translateY(calc((1 - clamp(0, calc(var(--p) * 10 - var(--i)), 1)) * 18px)); }
@media (max-width: 700px) { .st-ph:nth-child(n+5) { display: none; } }

/* =============================================================================
   Flow pass (2 Nov 2026): lines that flow and glow, after savor.it/process.
   --st-line is the line colour per ground: yellow on ink and purple, purple
   on white. --st-pulse is the bright run that travels along a drawn line.
   ============================================================================= */
.st { --st-line: var(--ebr-yellow); --st-pulse: #fff; }
.st.e-ground-white, .st-chapter--light { --st-line: var(--ebr-purple); --st-pulse: var(--ebr-yellow); }

/* The chapter line (built by js/about-story.js on wide screens) */
.st > .st-flow { position: absolute; left: 0; top: 0; z-index: 1; overflow: visible; pointer-events: none; color: var(--st-line); }
.st-flow path { fill: none; stroke-linecap: round; stroke-linejoin: round; }
.st-flow__line { stroke: var(--st-line); stroke-width: 1.6; }
.st-flow__glow { stroke: var(--st-line); stroke-width: 7; opacity: .16; }
.st-flow__trail { stroke: var(--st-line); stroke-width: 4; opacity: .45; }
.st-flow__pulse { stroke: var(--st-pulse); stroke-width: 2.4; }
.st-flow__head { fill: var(--st-pulse); stroke: var(--st-line); stroke-width: 2; }
.st-flow__halo, .st-flow__head { transition: opacity .25s; }
html.st-flow-on .st-thread { visibility: hidden; }

/* Phone threads: same colour, drawn from the top with a glowing tip */
.st-thread { position: relative; width: 1.5px; background: var(--st-line); opacity: 1; box-shadow: 0 0 10px var(--st-line); }
.st-on .st-thread { transform: none; clip-path: inset(0 -14px calc((1 - var(--p)) * 100%) -14px); }
.st-on .st-thread::after { content: ""; position: absolute; left: 50%; top: calc(var(--p) * 100%); width: 8px; height: 8px; margin: -4px 0 0 -4px; border-radius: 50%; background: var(--st-pulse); box-shadow: 0 0 0 2px var(--st-line), 0 0 14px 3px var(--st-line); opacity: clamp(0, calc((1 - var(--p)) * 40), 1); }

/* Arch: brighter ring with a soft glow under it */
.st-arch__ring path { stroke: var(--st-line); stroke-width: 1.6; opacity: 1; stroke-linecap: round; }
.st-arch__ring .st-glow { stroke-width: 7; opacity: .16; }

/* Word arc: dashes keep marching once the scroll has drawn the path */
.st-arc__path .st-arc__dash { stroke: var(--st-line); stroke-width: 2; opacity: 1; stroke-dasharray: 7 8; animation: st-march 1.1s linear infinite; }
.st-arc__path .st-glow { fill: none; stroke: var(--st-line); stroke-width: 7; opacity: .14; vector-effect: non-scaling-stroke; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.st-arc__path .st-arc__reveal { opacity: 1; fill: none; stroke: #fff; stroke-width: 40; stroke-dasharray: 1 1; stroke-dashoffset: 0; }
.st-on .st-arc__path .st-arc__reveal, .st-on .st-arc__path .st-glow { stroke-dashoffset: calc(1 - var(--p)); }
@keyframes st-march { to { stroke-dashoffset: -15; } }

/* Diagram: dots scatter in from the sides and gather on a glowing spine */
.st-dia { position: relative; }
.st-dia::before { content: ""; position: absolute; left: 50%; top: 0; bottom: 0; width: 1.5px; margin-left: -.75px; background: var(--st-line); box-shadow: 0 0 10px var(--st-line); transform-origin: top; }
.st-dia li::after { background: var(--st-line); box-shadow: 0 0 0 3px color-mix(in srgb, var(--st-line) 25%, transparent), 0 0 12px var(--st-line); }
.st-dia__l::after { right: -3.5px; }
.st-dia__r::after { left: -3.5px; }
.st-on .st-dia::before { transform: scaleY(clamp(0, calc((var(--p) - .55) * 2.4), 1)); }
.st-on .st-dia li { --q: clamp(0, calc(var(--p) * 1.5 - var(--i) * .1), 1); opacity: clamp(0, calc(var(--q) * 2.5), 1); transform: translate(calc((1 - var(--q)) * var(--dx, 0px)), calc((1 - var(--q)) * var(--dy, 0px))); }

/* Milestones: the centre rule takes the line colour and glows */
.st-miles li::before { background: var(--st-line); opacity: 1; box-shadow: 0 0 10px var(--st-line); }

@media (max-width: 700px) {
  .st-on .st-dia li { transform: translate(calc((1 - var(--q)) * var(--dx, 0px) * .3), calc((1 - var(--q)) * var(--dy, 0px) * .5)); }
}
@media (prefers-reduced-motion: reduce) {
  .st-arc__path .st-arc__dash { animation: none; }
}

/* =============================================================================
   Section transitions (3 Nov 2026), after savor.it/process.
   Each chapter rises out of a paper runway (.st-lead): its ground comes up
   as a narrow dome that widens and goes flat, then the corners lead so the
   paper left over is an ellipse hanging from the top, shrinking away. js/about-story.js writes the shape as a clip-path on the pinned
   ground (.st-bg); the section itself is paper underneath, so whatever the
   shape cuts away shows the band above. The ground colour moves onto .st-bg.
   ============================================================================= */
.st.st-chapter { background: var(--paper); }
.st-chapter > .st-bg { background: var(--ink-900); will-change: clip-path; }
.st-chapter.e-ground-brand > .st-bg { background: var(--ebr-purple); }
.st-chapter > .st-bg::after { background: linear-gradient(rgba(0,0,0,.18), rgba(0,0,0,0) 30%, rgba(0,0,0,0) 70%, rgba(0,0,0,.18)); }

/* Chapter III is dark now, so its figures and labels take the on-dark colours */
.e-ground-ink .st-figs span { color: var(--text-on-dark-muted); }
.e-ground-ink .st-figs b { color: var(--text-on-dark); }

/* Outro on paper */
.st-outro { padding-top: 14vh; }

/* Pinned diagram (3 Nov): the screen holds while the dots fly in, line up on
   the spine, then merge into the last one, the way the reference's elements
   merge into "Organic Molecules". Progress comes from the pin, not the list. */
.st-screen.st-pin { display: block; min-height: 0; height: 260vh; height: 260svh; padding-block: 0; }
.st-pin > .st-col { position: sticky; top: 0; height: 100vh; height: 100svh; display: flex; flex-direction: column; justify-content: center; }
.st-on .st-dia li { --q: clamp(0, calc(var(--p) * 3.2 - var(--i) * .16), 1); --m: clamp(0, calc((var(--p) - .58) * 4.5), 1);
  opacity: calc(clamp(0, calc(var(--q) * 2.5), 1) * (1 - var(--m)));
  transform: translate(calc((1 - var(--q)) * var(--dx, 0px)), calc((1 - var(--q)) * var(--dy, 0px) + var(--m) * var(--my, 0px))); }
.st-on .st-dia li.st-dia--hot { opacity: clamp(0, calc(var(--q) * 2.5), 1); transform: translate(calc((1 - var(--q)) * var(--dx, 0px)), calc((1 - var(--q)) * var(--dy, 0px))); }
.st-on .st-dia::before { transform: none; clip-path: inset(calc(clamp(0, calc((var(--p) - .58) * 4.5), 1) * 100%) -12px calc((1 - clamp(0, calc((var(--p) - .3) * 5), 1)) * 100%) -12px); }
@media (max-width: 700px) {
  .st-on .st-dia li { transform: translate(calc((1 - var(--q)) * var(--dx, 0px) * .3), calc((1 - var(--q)) * var(--dy, 0px) * .5 + var(--m) * var(--my, 0px))); }
  .st-on .st-dia li.st-dia--hot { transform: translate(calc((1 - var(--q)) * var(--dx, 0px) * .3), calc((1 - var(--q)) * var(--dy, 0px) * .5)); }
}
.st-pin .st-dia { width: 100%; }

/* ---- Transition pass 2 (3 Nov): runway, pinned titles, QA fixes ---- */
.st-lead { height: 100vh; height: 100lvh; }
.st-head { display: block; place-content: normal; min-height: 0; height: 170vh; height: 170svh; padding: 0; }
.st-head__in { position: sticky; top: 0; height: 100vh; height: 100svh; display: grid; place-content: center; }
.st-on .st-head .st-title { transform: translateY(calc((1 - var(--p)) * 40px)); }
/* merge: labels fade faster than their dots */
.st-dia li:not(.st-dia--hot) { color: rgb(255 255 255 / calc(1 - var(--m, 0) * 2.4)); }
@media (max-width: 700px) {
  .st-on .st-dia li { opacity: calc(clamp(0, calc(var(--q) * 1.6), 1) * (1 - var(--m))); transform: translate(calc((1 - var(--q)) * var(--dx, 0px) * .12), calc((1 - var(--q)) * var(--dy, 0px) * .5 + var(--m) * var(--my, 0px))); }
  .st-on .st-dia li.st-dia--hot { opacity: clamp(0, calc(var(--q) * 1.6), 1); transform: translate(calc((1 - var(--q)) * var(--dx, 0px) * .12), calc((1 - var(--q)) * var(--dy, 0px) * .5)); }
}
@media (prefers-reduced-motion: reduce) {
  .st-lead { height: 0; }
  .st-head { height: auto; }
  .st-head__in { position: static; min-height: 100vh; }
  .st-screen.st-pin { height: auto; min-height: 100vh; }
  .st-pin > .st-col { position: static; height: auto; min-height: 100vh; }
}

/* Origin photo (#origin) hidden on phones (3 Nov 2026, Adrian). Same 700px
   breakpoint the homepage uses to drop its Proof band on phones. */
@media (max-width: 700px) {
  #origin { display: none; }
}

/* About hero tiles carrying project snapshots (11 Nov 2026). The tile keeps
   its size, position, radius and parallax; the image just fills it. */
.e-abt__tile--photo { padding: 0; }
.e-abt__tile--photo img {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
