/* Two set pieces: the Game of Life before the work, and a dark band that turns the page to the person. */
.interlude { position:relative; overflow:clip; }

/* The hinge: a streamed sentence on an inverted band (ink ground, page-colour type). */
.interlude-cut { background:var(--ink); color:var(--bg); padding-block:clamp(4.5rem,10vw,8.5rem); }
.cut-text { max-width:18ch; margin:0; font:400 clamp(2.6rem,6.4vw,6.6rem)/1.02 var(--serif); letter-spacing:-.035em; min-height:4.1em; }
.cut-caret { display:inline-block; width:.07em; height:.82em; margin-left:.04em; vertical-align:-.08em; background:currentColor; }
.interlude-cut.is-streaming .cut-caret { animation:cut-blink .9s steps(1) infinite; }
@media (prefers-reduced-motion:reduce) { .cut-caret { display:none; } } /* nothing streams, so a still caret reads as a typo */
@keyframes cut-blink { 50% { opacity:0; } }
.cut-after { margin:1.4rem 0 0; max-width:40ch; text-wrap:pretty; font-size:clamp(1.05rem,1.6vw,1.4rem); opacity:.78; }
.cut-after strong { font-weight:500; opacity:1; }
.interlude-cut.is-waiting .cut-after { opacity:0; }
.interlude-cut .cut-after { transition:opacity .3s ease-out; }

/* Conway's Game of Life on a 50×25 dot grid; scroll picks the generation. The section is tall; the stage is pinned. */
.interlude-life { height:220vh; background:var(--bg); border-top:1px solid var(--line); }
.life-pin { position:sticky; top:0; min-height:100vh; display:grid; align-items:center; padding-block:4rem; }
.life-inner { display:grid; grid-template-columns:minmax(0,1fr) minmax(0,1.25fr); gap:clamp(2rem,5vw,5rem); align-items:center; }
.life-count { grid-row:span 2; margin:0; font:400 clamp(5rem,15vw,15rem)/.82 var(--serif); letter-spacing:-.06em; font-variant-numeric:tabular-nums; }
.life-count small { display:block; margin-top:1.2rem; font:400 1rem var(--sans); letter-spacing:0; color:var(--dim); }
.life-grid { display:grid; grid-template-columns:repeat(50,1fr); gap:2px; }
.life-grid i { aspect-ratio:1; border-radius:50%; background:var(--ink); opacity:.08; transition:opacity .12s ease-out; }
.life-grid i.is-on { opacity:1; }
.life-copy { margin:0; max-width:46ch; color:var(--dim); }
@media (max-width:760px) {
  .interlude-life { height:190vh; }
  .life-inner { grid-template-columns:minmax(0,1fr); gap:1.5rem; }
  .life-count { grid-row:auto; font-size:clamp(6rem,30vw,9rem); }
  .life-grid { gap:1px; }
}
@media (prefers-reduced-motion:reduce) {
  .interlude-life { height:auto; }
  .life-pin { position:static; min-height:0; }
  .life-grid i { transition:none; }
}

.interlude-hinge .cut-text { max-width:22ch; min-height:3.1em; font-size:clamp(2.1rem,4.4vw,4.4rem); }

/* Two acts. Act I (the work) sits on the page ground; Act II (the person) on one continuous second tone. */
/* The homepage Tools band sits on the ground; /skills/ keeps its own glow. Same specificity, later file: no !important needed. */
#skills { background:var(--bg); }
.act-two { background:var(--bg-alt); border-bottom:0; }
#keyboard.act-two { border-top:1px solid var(--line); }

/* Chapter numerals: the sections really are a sequence. */
.chapter-no { display:flex; align-items:baseline; gap:.7rem; margin-bottom:1rem; padding-top:.7rem; border-top:1px solid var(--ink); max-width:14rem; font:400 .875rem var(--sans); color:var(--dim); }
.chapter-no b { font:400 1.6rem/1 var(--serif); letter-spacing:.04em; color:var(--ink); }

/* Header nav shows where you are. */
.mast nav a[aria-current] { color:var(--ink); text-decoration:underline; text-decoration-thickness:1px; text-underline-offset:.45em; }

/* A quiet numeral rail in the left gutter, only where there is a gutter. */
.chapter-rail { position:fixed; left:clamp(12px,2vw,32px); top:50%; transform:translateY(-50%); z-index:20; display:none; flex-direction:column; gap:.2rem; opacity:0; transition:opacity .2s ease-out; }
.chapter-rail.is-visible { opacity:1; }
.chapter-rail a { display:flex; align-items:center; gap:.6rem; min-height:32px; color:var(--dim); text-decoration:none; font:400 .875rem var(--serif); letter-spacing:.06em; }
.chapter-rail a span { font:400 .75rem var(--sans); letter-spacing:0; opacity:0; transform:translateX(-4px); transition:opacity .15s ease-out, transform .15s ease-out; }
.chapter-rail a[aria-current] { color:var(--ink); }
.chapter-rail a[aria-current] span,.chapter-rail a:hover span,.chapter-rail a:focus-visible span { opacity:1; transform:none; }
.chapter-rail a[aria-current] b::after { content:''; display:inline-block; width:14px; height:1px; margin-left:.5rem; vertical-align:middle; background:currentColor; }
.chapter-rail b { font-weight:400; }
@media (min-width:1500px) { .chapter-rail { display:flex; } }
@media (prefers-reduced-motion:reduce) { .chapter-rail,.chapter-rail a span { transition:none; } }

/* Hero thesis: the one sentence a visitor needs first. */
.cover-thesis { max-width:26ch; margin:0 0 .9rem; text-wrap:balance; font:400 clamp(1.5rem,2.6vw,2.25rem)/1.15 var(--serif); letter-spacing:-.015em; color:var(--ink); }
@media screen and (prefers-reduced-motion:no-preference) {
  .cover-thesis > span { animation:thesis-token 1ms step-end var(--reveal-at) backwards; } /* not `both`: Chrome's step-end can end on the from frame and leave late tokens invisible */
  @keyframes thesis-token { from { opacity:0; } to { opacity:1; } }
}
.medal-column { align-self:start; padding-top:2.4rem; }
.medal-column .specimen-open { border-top:0; padding-top:0; }
.chapter-next { display:none; }
@media (max-width:920px) {
  .chapter-next { position:fixed; left:50%; bottom:max(14px, env(safe-area-inset-bottom)); z-index:20; display:inline-flex; align-items:center; gap:.45rem; min-height:44px; padding:0 1rem; transform:translate(-50%, 8px); opacity:0; pointer-events:none; background:color-mix(in srgb, var(--bg) 88%, transparent); backdrop-filter:blur(10px); border:1px solid var(--line); border-radius:999px; color:var(--ink); text-decoration:none; font:400 .8125rem var(--sans); white-space:nowrap; transition:opacity .2s ease-out, transform .2s ease-out; }
  .chapter-next.is-visible { opacity:1; transform:translate(-50%, 0); pointer-events:auto; }
  .chapter-next.is-visible.is-tucked:not(:focus-visible),
  .is-scrolling-down .chapter-next.is-visible:not(:focus-visible) { opacity:0; transform:translate(-50%, 8px); pointer-events:none; }
  .chapter-next span { color:var(--dim); }
  .chapter-next b { font:400 1rem/1 var(--serif); letter-spacing:.04em; }
  .chapter-next i { font-style:normal; color:var(--orange); }
}
@media (prefers-reduced-motion:reduce) { .chapter-next { transition:none; } }

/* Forced colors strip backgrounds, which would erase the life cells and map dots. */
@media (forced-colors:active) { .life-grid i,.map-dot::before { forced-color-adjust:none; background:CanvasText; } }
