/* about-chapters.css — #192 S17 About chapters, the homepage's «About Extrême» right under the category banners (spec
   docs/superpowers/specs/2026-11-06-about-timeline-design.md, S17; the approved spikes …-spike.html §1 and …-spike-mobile.html M2 «Deck»).
   From 1024 px: three columns — photos | the middle that sticks under the header | photos; below 1024 (phones and tablets, plan «Global
   Constraints»): no columns, the Deck — a stack of cards over the chapters. Markup — sections/about-chapters.liquid; about-chapters.js marks the
   section data-ready and drives data-state, --d (counter), --f (laps), --py (parallax); pin-top.js keeps --ext-chapters-top = the header's foot.
   Without the script the chapters stand as a list and the photos as a grid. Lime only for the laps and the button; the counter in sand. */

/* #192 sand (#E6E1D4 — the Sand scheme's ground) for the counter and the past laps; the spike's motion curve (Concept split-words / the stopwatch) */
.ext-chapters { --ext-ch-sand: 230 225 212; --ext-ch-ease: cubic-bezier(.7, 0, .15, 1); overflow: clip; }

/* #192 the middle's parts — the same with the script or without */
/* #192 the heading: Archivo 800, one word in outline (Concept's highlighted-text, #146); a soft shadow so it reads over the photos under it */
.ext-chapters__head { margin: 0; font-family: var(--font-heading-family); font-weight: 800; font-size: clamp(42px, 4.3vw, 76px); line-height: 1; letter-spacing: -.025em; text-wrap: balance; text-shadow: 0 4px 32px rgb(9 9 11 / .55); }
/* #192 the chapter's text: 17 px, 72 %, at most 440 wide */
.ext-chapters__text { max-width: 440px; margin: 0 auto; font-size: 17px; line-height: 1.5; color: rgb(var(--color-foreground) / .72); text-shadow: 0 2px 16px rgb(9 9 11 / .8); }
/* #192 the photos: radius 16, the ink shadow (0 24 48 −16, 70 %); a photo block without an image is the empty figure on this dark placeholder ground
   (.is-empty — Shopify's placeholder_svg_tag there), never a broken image */
.ext-chapters__photo { margin: 0; aspect-ratio: var(--ar, 4 / 5); border-radius: 16px; overflow: hidden; background: rgb(var(--color-placeholder)); box-shadow: 0 24px 48px -16px rgb(9 9 11 / .7), 0 0 0 1px rgb(var(--color-foreground) / .06); }
.ext-chapters__photo img, .ext-chapters__card img { display: block; width: 100%; height: 100%; object-fit: cover; }

/* #192 without the script (and until it starts): the chapters as a list — each heading over its text, the button last — and the photos as a grid
   under them; no counter, no laps, no Deck */
.ext-chapters:not([data-ready]) { display: grid; gap: 3rem 1rem; padding: 4rem 24px; }
@media screen and (min-width: 768px) { .ext-chapters:not([data-ready]) { grid-template-columns: 1fr 1fr; } }
.ext-chapters:not([data-ready]) .ext-chapters__pin { grid-column: 1 / -1; order: -1; position: relative; z-index: 1; display: flex; flex-direction: column; align-items: center; gap: 1rem; text-align: center; }
.ext-chapters:not([data-ready]) :is(.ext-chapters__heads, .ext-chapters__texts) { display: contents; }
.ext-chapters:not([data-ready]) :is(.ext-chapters__counter, .ext-chapters__laps, .ext-chapters__deck) { display: none; }
.ext-chapters:not([data-ready]) .ext-chapters__head:nth-child(1) { order: 1; }
.ext-chapters:not([data-ready]) .ext-chapters__text:nth-child(1) { order: 2; }
.ext-chapters:not([data-ready]) .ext-chapters__head:nth-child(2) { order: 3; }
.ext-chapters:not([data-ready]) .ext-chapters__text:nth-child(2) { order: 4; }
.ext-chapters:not([data-ready]) .ext-chapters__head:nth-child(3) { order: 5; }
.ext-chapters:not([data-ready]) .ext-chapters__text:nth-child(3) { order: 6; }
.ext-chapters:not([data-ready]) .ext-chapters__head:nth-child(4) { order: 7; }
.ext-chapters:not([data-ready]) .ext-chapters__text:nth-child(4) { order: 8; }
.ext-chapters:not([data-ready]) .ext-chapters__head:nth-child(5) { order: 9; }
.ext-chapters:not([data-ready]) .ext-chapters__text:nth-child(5) { order: 10; }
.ext-chapters:not([data-ready]) .ext-chapters__button { order: 11; margin-top: 1rem; }
.ext-chapters:not([data-ready]) .ext-chapters__col { position: relative; z-index: 1; display: grid; grid-template-columns: 1fr 1fr; align-items: start; gap: 1rem; }

/* #192 the pinned frame: the section is at least N chapters of scroll (--ext-ch-step, «Scroll per chapter») plus the frame — a min-height: when the
   photo columns run longer (a short «Scroll per chapter», few chapters, tall photos) the section grows to hold them, so the last photo is never cut at
   the next section (overflow: clip), and the script counts the chapters over the real length; the frame sticks flush under the header
   (--ext-chapters-top — the header's foot when shown, fixed while Concept slides it away on phones: the script then lifts the middle and the Deck by
   a transform) and fills the screen below it. Content-box: the section's paddings come on top */
.ext-chapters[data-ready] {
  --ext-ch-frame: calc(100svh - var(--ext-chapters-top, 0px));
  box-sizing: content-box; min-height: calc(var(--ext-ch-n, 3) * var(--ext-ch-step, 60vh) + var(--ext-ch-frame));
  display: grid; grid-template-columns: 100%;
}
/* #192 (Artem 2026-11-07) the next section rises over the frame's empty foot (--ext-ch-tail, about-chapters.js): from the section's lowest content
   to it — the Padding bottom plus its padding top, as between any two sections. In that strip the middle and the columns let the clicks through */
.ext-chapters[data-ready] { margin-bottom: calc(var(--ext-ch-tail, 0px) * -1); }
.ext-chapters[data-ready] :is(.ext-chapters__pin, .ext-chapters__col) { pointer-events: none; }
.ext-chapters[data-ready] .ext-chapters__pin > * { pointer-events: auto; }
.ext-chapters[data-ready] .ext-chapters__pin { position: sticky; top: var(--ext-chapters-top, 0px); z-index: 3; height: var(--ext-ch-frame); align-self: start; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; }
/* #192 the counter «01 / 03»: Archivo 900 in sand, 40–58 px; each digit a strip of 0–9 behind a 1em window, rolled to --d like a stopwatch's
   (1.05 s); the digit that stays the same does not move. «/ 03» 14 px, 60 % */
.ext-chapters[data-ready] .ext-chapters__counter { display: flex; align-items: flex-start; justify-content: center; margin: 18px 0 10px; color: rgb(var(--ext-ch-sand)); }
.ext-chapters .ext-odo { display: block; height: 1em; overflow: hidden; font-family: var(--font-heading-family); font-weight: 900; font-size: clamp(40px, 3.3vw, 58px); line-height: 1; letter-spacing: -.04em; }
.ext-chapters .ext-odo__strip { display: block; transform: translateY(calc(var(--d, 0) * -1em)); transition: transform 1.05s var(--ext-ch-ease); }
.ext-chapters .ext-odo__strip b { display: block; height: 1em; font-weight: inherit; }
.ext-chapters__total { margin: .35em 0 0 .3em; font-size: 14px; font-weight: 700; line-height: 1; color: rgb(var(--color-foreground) / .6); }
/* #192 the laps: a 2 px segment per chapter under the counter, 150 wide in all, 5 apart — the current one fills with lime as its chapter scrolls,
   the past ones stay full in sand 55 %, the next ones are the foreground at 16 % */
.ext-chapters__laps { display: flex; gap: 5px; width: 150px; margin: 0 auto 30px; }
.ext-chapters__laps > span { position: relative; flex: 1; height: 2px; border-radius: 2px; overflow: hidden; background: rgb(var(--color-foreground) / .16); }
.ext-chapters__laps > span::after { content: ""; position: absolute; inset: 0; background: rgb(var(--color-highlight)); transform: scaleX(var(--f, 0)); transform-origin: var(--transform-origin-start, left); }
.ext-chapters__laps > span[data-state="past"]::after { background: rgb(var(--ext-ch-sand) / .55); }
/* #192 «Chapter counter» off: no counter, no laps (the markup stays — ruling R2) */
.ext-chapters[data-counter="false"] :is(.ext-chapters__counter, .ext-chapters__laps) { display: none; }
/* #192 the chapters' headings in one grid cell, aligned to the foot (a short one does not float off its text); the texts in another under them */
.ext-chapters[data-ready] :is(.ext-chapters__heads, .ext-chapters__texts) { display: grid; width: 100%; }
.ext-chapters[data-ready] :is(.ext-chapters__heads, .ext-chapters__texts) > * { grid-area: 1 / 1; }
.ext-chapters[data-ready] .ext-chapters__head { align-self: end; }
.ext-chapters[data-ready] .ext-chapters__texts { margin-top: 22px; }
.ext-chapters[data-ready] .ext-chapters__text { align-self: start; }
.ext-chapters[data-ready] .ext-chapters__button { margin-top: 34px; }
/* #192 the words of a heading (Concept split-words / fade-up): each rises from under its own line, 55 ms after the one before, 160 ms in; the old
   heading's words leave upward. The line is cut by clip-path (top and foot only — the outline's stroke and the last letter keep their sides) */
.ext-chapters[data-ready] .ext-word { display: inline-block; vertical-align: top; padding-bottom: .08em; margin-bottom: -.08em; clip-path: inset(0 -.2em); }
.ext-chapters[data-ready] .ext-word > span { display: inline-block; transition: transform .75s var(--ext-ch-ease); }
.ext-chapters[data-ready] .ext-chapters__head[data-state="next"] .ext-word > span { transform: translateY(108%); }
.ext-chapters[data-ready] .ext-chapters__head[data-state="past"] .ext-word > span { transform: translateY(-108%); transition-duration: .5s; }
.ext-chapters[data-ready] .ext-chapters__head[data-state="on"] .ext-word > span { transition-delay: calc(var(--k, 0) * 55ms + 160ms); }
/* #192 the text comes in after its heading (.4 s) and leaves with it */
.ext-chapters[data-ready] .ext-chapters__text { transition: opacity .5s, transform .6s var(--ext-ch-ease); }
.ext-chapters[data-ready] .ext-chapters__text[data-state="next"] { opacity: 0; transform: translateY(14px); }
.ext-chapters[data-ready] .ext-chapters__text[data-state="past"] { opacity: 0; transform: translateY(-14px); }
.ext-chapters[data-ready] .ext-chapters__text[data-state="on"] { transition-delay: .4s; }
/* #192 the first state after a load is set at once (data-instant for two frames): a reload in the middle shows its chapter, it does not roll there */
.ext-chapters[data-instant] *, .ext-chapters[data-instant] *::after { transition: none !important; }

/* #192 from 1024 px: photos | the middle (≈ 1.15 fr, at least 480) | photos; the columns start level, 16vh down; the photos hug the middle and slide
   under it (--dx % toward it), each tilted (--rot) and drifting (--py, parallax), under the middle's words */
@media screen and (min-width: 1024px) {
  .ext-chapters[data-ready] { grid-template-columns: 1fr minmax(480px, 1.15fr) 1fr; column-gap: 24px; padding-inline: 24px; }
  .ext-chapters[data-ready] .ext-chapters__col { position: relative; z-index: 1; display: flex; flex-direction: column; align-items: flex-end; padding-top: 16vh; }
  .ext-chapters[data-ready] .ext-chapters__col[data-side="right"] { align-items: flex-start; --ext-ch-dir: -1; }
  /* #192 the photo: --h high at its ratio (narrower columns shrink it to their width, the ratio kept), --gap below the one above */
  .ext-chapters[data-ready] .ext-chapters__photo { flex: none; width: min(100%, calc(var(--h, 46vh) * var(--ar, 4 / 5))); margin-top: var(--gap, 0px); transform: translate3d(calc(var(--dx, 0%) * var(--ext-ch-dir, 1)), var(--py, 0px), 0) rotate(var(--rot, 0deg)); will-change: transform; }
  .ext-chapters__deck { display: none; }
}
/* #192 low screens from 1024 (a laptop ~800 px high and below): the heading drops to its floor. #224 (2026-11-09): nothing is
   hidden by the screen's height — the chapter's text went at 680 before; the middle holds it down to a 540 px window */
@media screen and (min-width: 1024px) and (max-height: 760px) { .ext-chapters__head { font-size: 42px; } }

/* #192 below 1024 — the Deck (Artem's pick M2): no columns; the middle sticks under the header and ends above the mobile dock; on top of it a stack
   of 4:5 cards 56 % of the screen wide, then the eyebrow, counter 36, laps 120, heading 28–34, text 14. The card gives way on a short screen (a real
   phone's 100svh with the browser's bars ≈ 660 on a 390 × 844 iPhone): the ~350 px under it plus the header and the dock always fit — at 390 × 844
   without bars it stays the spike's 56 %; on tablets it stops at a third of the screen's height */
@media screen and (max-width: 1023px) {
  .ext-chapters[data-ready] { --ext-ch-frame: calc(100svh - var(--ext-chapters-top, 0px) - var(--mobile-dock-height, 0px)); --ext-ch-under: 350px; --ext-ch-card: max(120px, min(56vw, 34svh, calc((100svh - var(--ext-chapters-top, 80px) - var(--mobile-dock-height, 0px) - var(--ext-ch-under)) * .8))); }
  .ext-chapters[data-ready] .ext-chapters__col { display: none; }
  .ext-chapters[data-ready] .ext-chapters__pin { grid-area: 1 / 1; z-index: 2; justify-content: flex-start; padding: calc(var(--ext-ch-card) * 1.25 + 58px) 24px 0; }
  .ext-chapters[data-ready] .ext-chapters__counter { margin: 8px 0 6px; }
  .ext-chapters .ext-odo { font-size: 36px; }
  .ext-chapters__total { font-size: 12px; margin-top: .3em; }
  .ext-chapters__laps { gap: 4px; width: 120px; margin-bottom: 14px; }
  .ext-chapters__head { font-size: clamp(28px, 8vw, 34px); line-height: 1.02; text-shadow: 0 3px 24px rgb(9 9 11 / .75); }
  .ext-chapters__text { max-width: 300px; font-size: 14px; line-height: 1.45; color: rgb(var(--color-foreground) / .78); text-shadow: 0 2px 14px rgb(9 9 11 / .9); }
  .ext-chapters[data-ready] .ext-chapters__texts { margin-top: 14px; }
  .ext-chapters[data-ready] .ext-chapters__button { margin-top: 16px; }
  /* #192 the Deck: a layer as tall as the middle, stuck with it, under its words; the cards 22 px from its top, centred */
  .ext-chapters[data-ready] .ext-chapters__deck { grid-area: 1 / 1; position: sticky; top: var(--ext-chapters-top, 0px); z-index: 1; height: var(--ext-ch-frame); align-self: start; pointer-events: none; }
  .ext-chapters__card { position: absolute; top: 22px; left: 50%; width: var(--ext-ch-card); margin: 0 0 0 calc(var(--ext-ch-card) / -2); aspect-ratio: 4 / 5; border-radius: 14px; overflow: hidden; background: rgb(var(--color-placeholder)); box-shadow: 0 18px 36px -12px rgb(9 9 11 / .8), 0 0 0 1px rgb(var(--color-foreground) / .06); transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)); }
  /* #192 a card darkens with an ink veil (opacity only): the two under the stack to 40 %, the chapters already passed to 55 % */
  .ext-chapters__card::after { content: ""; position: absolute; inset: 0; background: rgb(9 9 11); opacity: var(--dim, 0); transition: opacity .5s; }
  .ext-chapters__card--base[data-side="left"] { --r: -7deg; --x: -6%; --y: 2%; --dim: .6; }
  .ext-chapters__card--base[data-side="right"] { --r: 6deg; --x: 7%; --y: -1%; --dim: .6; }
  /* #192 each chapter's card lands at its own small tilt (−2.5° / +3° / −1.5° in the spike; two more for a fourth and a fifth chapter) */
  .ext-chapters__card[data-index="0"] { --r: -2.5deg; }
  .ext-chapters__card[data-index="1"] { --r: 3deg; }
  .ext-chapters__card[data-index="2"] { --r: -1.5deg; }
  .ext-chapters__card[data-index="3"] { --r: 2deg; }
  .ext-chapters__card[data-index="4"] { --r: -3deg; }
  /* #192 a chapter's card waits below, turned 10° more and clear; it slides up onto the stack when its chapter comes, back down when the page
     scrolls back; the ones passed stay under it, darker. These are the poses only: the slide between them is the script's (element.animate,
     about-chapters.js «slide») — on Safari for iOS 27.0.1 a CSS transition on the card never ran (2026-11-09) */
  .ext-chapters[data-ready] .ext-chapters__card[data-state="next"] { transform: translateY(135%) rotate(calc(var(--r, 0deg) + 10deg)); opacity: 0; }
  .ext-chapters[data-ready] .ext-chapters__card[data-state="past"] { --dim: .45; }
  /* #192 a chapter without a photo anywhere (no image, no n-th photo block): an empty dark card, never a broken image */
  .ext-chapters__card.is-empty { background: rgb(var(--color-foreground) / .06); }
}
/* #224 a phone in landscape (below 1024, ≤ 520 px high — a 280 px frame cannot hold the card over the words): the Deck on the left half, the words
   on the right half, both centred in the frame; the card at most 36 % of the width */
@media screen and (max-width: 1023px) and (orientation: landscape) and (max-height: 520px) {
  .ext-chapters[data-ready] { --ext-ch-card: max(96px, min(36vw, calc((var(--ext-ch-frame) - 48px) * .8))); }
  .ext-chapters[data-ready] .ext-chapters__pin { justify-content: center; padding: 0 24px 0 50%; }
  .ext-chapters__card { top: calc((var(--ext-ch-frame) - var(--ext-ch-card) * 1.25) / 2); left: 26%; }
  .ext-chapters__head { font-size: 26px; }
  .ext-chapters__text { max-width: 340px; }
  .ext-chapters[data-ready] .ext-chapters__texts { margin-top: 10px; }
  .ext-chapters[data-ready] .ext-chapters__button { margin-top: 12px; }
}
/* #224 the smallest landscape (an iPhone SE, ≈ 667 × 320 with the bars): the words a step smaller so the middle fits its 240 px frame */
@media screen and (max-width: 1023px) and (orientation: landscape) and (max-height: 340px) {
  .ext-chapters .ext-odo { font-size: 30px; }
  .ext-chapters[data-ready] .ext-chapters__counter { margin: 4px 0; }
  .ext-chapters__laps { margin-bottom: 10px; }
  .ext-chapters__head { font-size: 22px; }
  .ext-chapters__text { font-size: 13px; line-height: 1.4; }
  .ext-chapters[data-ready] .ext-chapters__texts { margin-top: 8px; }
  .ext-chapters[data-ready] .ext-chapters__button { margin-top: 10px; }
}
/* #224 a very short phone screen (an iPhone SE with the browser's bars, ≈ 375 × 548): the text stays, the card gives way (the formula above, down
   to 120 px wide); before, the chapter's text went at 620 */

/* #192 reduced motion: no parallax (the script sets no --py), no rolling digits, no rising words or sliding cards — the chapters change at once */
@media (prefers-reduced-motion: reduce) {
  .ext-chapters[data-ready] :is(.ext-odo__strip, .ext-word > span, .ext-chapters__text), .ext-chapters[data-ready] .ext-chapters__card::after { transition: none; }
  .ext-chapters[data-ready] .ext-chapters__head:not([data-state="on"]) { visibility: hidden; }
  .ext-chapters[data-ready] .ext-chapters__head[data-state] .ext-word > span, .ext-chapters[data-ready] .ext-chapters__text[data-state] { transform: none; }
  .ext-chapters[data-ready] .ext-chapters__card[data-state="next"] { transform: translate(var(--x, 0), var(--y, 0)) rotate(var(--r, 0deg)); }
}
