/* Chapter dives (chapters/dive.js): a scroll-scrubbed crafted sequence over the living stage. DESKTOP ONLY. */
.dive-stage{display:none}
@media (min-width:701px){
  .dive-on .dive-section{height:calc(var(--chapter-viewport-height,100svh)*var(--dive-h,3.2))!important;min-height:0!important}
  /* Motion round 3: the compact layout (html.living-layout) holds the dive's scroll from the first paint, before dive.js
     knows the tier (the document grew by half a screen when dive-on landed); every chapter's data-height is 1. A tier C
     still (dive-still) gives it back. */
  .living-layout:not(.dive-on):not(.dive-still) .dive-section{height:calc(var(--chapter-viewport-height,100svh)*var(--dive-h,1))!important;min-height:0!important}
  .dive-stage{display:block;position:fixed;inset:0;z-index:0;pointer-events:none;opacity:0;overflow:hidden;background:#061d16}
  .dive-stage canvas{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block}
  .dive-stage:after{content:"";position:absolute;inset:0;background:linear-gradient(0deg,#071c16cc,transparent 34%);pointer-events:none}
  .dive-active .living-stage .engineering{visibility:hidden!important}
  .dive-active .dive-section .detail{visibility:hidden}
  .dive-labels{position:absolute;inset:0;width:100%;height:100%;z-index:1;overflow:hidden;filter:drop-shadow(0 1px 3px #071c16)}
  .dive-labels path{fill:none;stroke:#dec38c;stroke-width:2;vector-effect:non-scaling-stroke;stroke-dasharray:1;stroke-dashoffset:1;transition:stroke-dashoffset 1.1s ease}
  .dive-labels circle{fill:#dec38c;opacity:0;transition:opacity var(--m-fade) var(--m-dissolve) var(--m-ease-out)}
  .dive-labels text{fill:#f2dfb9;font:500 19px Manrope,'Manrope fallback',sans-serif;letter-spacing:1px;opacity:0;transition:opacity var(--m-label-in) var(--m-dissolve) var(--m-ease-out);paint-order:stroke;stroke:#102922;stroke-width:5px;stroke-linejoin:round}
  .dive-post{position:absolute;inset:0;width:100%;height:100%;object-fit:cover;display:block;opacity:0}
  .dive-labels g.on path{stroke-dashoffset:0}
  .dive-labels g.on circle,.dive-labels g.on text{opacity:1}
}
@media (prefers-reduced-motion:reduce){.dive-labels path,.dive-labels circle,.dive-labels text{transition:none!important}}
@media (min-width:701px){.dive-on #fermentacja .detail.cutaway,.dive-still #fermentacja .detail.cutaway{display:none}.dive-labels text{font-size:22px}}

@media(min-width:701px){
 .dive-stage{background:#0c1f1a}
 .dive-stage:after{background:var(--chapter-scrim)}
 .dive-labels{filter:none}
 .dive-labels path{stroke:#ffffff8c;stroke-width:1}
 .dive-labels text{fill:#f4f6f4;stroke:none}
 .dive-labels circle:not(.callout-ring){fill:#e3b363}
 .dive-labels .callout-pill{opacity:0;transition:opacity var(--m-label-in) var(--m-dissolve) var(--m-ease-out)}
 .dive-labels .callout-ring{fill:rgba(8,22,17,.55)}
 .dive-labels g.on .callout-pill{opacity:1}
}
@media(prefers-reduced-motion:reduce){.dive-labels .callout-pill{transition:none}}
/* round 3: the living stage draws a depth plate at 1.025 (main.js framing); the sequence and its labels match it, so the
   plate hands over to frame 0 without a size jump */
@media(min-width:701px){.dive-on .dive-stage canvas,.dive-on .dive-stage .dive-labels,.dive-on .dive-stage .dive-post{transform:scale(1.025);transform-origin:50% 50%}}
/* Short beats need immediate labels, including reverse scrolling. */
@media(min-width:701px){
 .dive-labels path{transition:stroke-dashoffset var(--m-feedback) var(--m-ease-out)}
 .dive-labels circle,.dive-labels text,.dive-labels .callout-pill{transition:opacity var(--m-feedback) var(--m-ease-out)}
}

@media(min-width:701px){
 .dive-labels path{stroke-width:1.5px}
 .dive-labels text{fill:#F4F7F5;font-weight:500}
 .dive-labels circle:not(.callout-ring){fill:#fff}
}
/* Motion round 1: dive.js draws each callout on its own rAF (--draw 0..1, eased with the site curve): the leader draws
   first, then the dot, text and glass fade in. No CSS transition clock to lag behind or catch up with the frame. */
@media(min-width:701px){
 :is(.dive-on,.dive-still) .dive-labels g path{stroke-dashoffset:calc(1 - min(1, var(--draw,0) * 1.6));transition:none}
 :is(.dive-on,.dive-still) .dive-labels g :is(circle,text,.callout-pill){opacity:clamp(0, (var(--draw,0) - .35) * 1.55, 1);transition:none}
}
/* X2: callouts draw object first. The anchor dot lands on the object, the leader draws out from it to the pill, then the
   pill and text fade in; leaving runs the same curve backwards (pill, then leader back into the dot, then the dot). */
@media(min-width:701px){
 :is(.dive-on,.dive-still) .dive-labels g :is(circle:not(.callout-ring),.callout-ring){opacity:clamp(0, var(--draw,0) * 5, 1)}
 :is(.dive-on,.dive-still) .dive-labels g path{stroke-dashoffset:calc(1 - clamp(0, (var(--draw,0) - .1) * 1.7, 1))}
 :is(.dive-on,.dive-still) .dive-labels g :is(text,.callout-pill){opacity:clamp(0, (var(--draw,0) - .55) * 2.25, 1)}
}
/* X2: the inspection gesture. The open picture takes the hand (grab, grabbing while dragged); the copy keeps its text cursor
   and links their pointer. Keyboard focus on the section draws one cream hairline inset on the picture, nothing more. */
@media(min-width:701px){
 .dive-grab body{cursor:grab}
 .dive-grab .scene-copy{cursor:auto}
 .dive-dragging body,.dive-dragging body *{cursor:grabbing!important;user-select:none!important;-webkit-user-select:none!important}
 .dive-on .dive-section:focus{outline:none}
 .dive-stage:before{content:"";position:absolute;inset:14px;z-index:2;border:1px solid rgba(244,236,214,.42);border-radius:2px;opacity:0;transition:opacity var(--m-feedback) var(--m-ease-out);pointer-events:none}
 .dive-stage.is-focused:before{opacity:1}
}
@media(prefers-reduced-motion:reduce){.dive-stage:before{transition:none}}

/* PACE18: a quiet grip at the stage edge, highlighted by hover or keyboard focus. */
.dive-handle{display:none}
@media(min-width:701px){
 .dive-grab .dive-handle{display:grid;place-items:center;position:absolute;right:calc(var(--gutter) + 62px);bottom:88px;width:56px;height:44px;z-index:3;border:1px solid #dec38c60;border-radius:24px;background:rgba(13,17,16,.72);color:var(--paper);opacity:.65;pointer-events:none}
 .dive-handle svg{width:40px;height:24px;stroke:currentColor;stroke-width:1.5;stroke-linecap:round;stroke-linejoin:round}
 .dive-grab body:hover .dive-handle,.dive-stage.is-focused .dive-handle{opacity:1}
 .dive-dragging .dive-handle{color:var(--gold)}
}

/* PACE19: read the displayed frame, not scroll time. Keep the property on the small
   badge so frame changes do not invalidate every callout. The attribute mapping
   works without typed attr() support or a new motion-JS hook. */
@media(min-width:801px){
 .dive-grab .dive-handle{
  --dive-frame:0;--dive-start:0;--dive-end:63;
  --dive-progress:clamp(0,calc((var(--dive-frame) - var(--dive-start)) / (var(--dive-end) - var(--dive-start))),1);
  width:92px;height:44px;padding:9px 14px;gap:6px;border-color:rgba(244,246,244,.14);
  background:rgba(12,35,30,.88);backdrop-filter:blur(12px);-webkit-backdrop-filter:blur(12px);opacity:1;
 }
 .dive-handle svg{display:none}
 .dive-handle::before{content:"Przekrój";font-size:10px;line-height:1;color:var(--paper)}
 .dive-handle::after{content:"";width:64px;height:1.5px;background:linear-gradient(var(--gold),var(--gold)) left / calc(var(--dive-progress) * 100%) 100% no-repeat,rgba(255,255,255,.24)}
 .dive-stage[data-frame-start="18"] ~ main .dive-handle{--dive-start:18}
 .dive-stage[data-frame-end="42"] ~ main .dive-handle{--dive-end:42}
 .dive-stage[data-frame="0"] ~ main .dive-handle{--dive-frame:0}
 .dive-stage[data-frame="1"] ~ main .dive-handle{--dive-frame:1}
 .dive-stage[data-frame="2"] ~ main .dive-handle{--dive-frame:2}
 .dive-stage[data-frame="3"] ~ main .dive-handle{--dive-frame:3}
 .dive-stage[data-frame="4"] ~ main .dive-handle{--dive-frame:4}
 .dive-stage[data-frame="5"] ~ main .dive-handle{--dive-frame:5}
 .dive-stage[data-frame="6"] ~ main .dive-handle{--dive-frame:6}
 .dive-stage[data-frame="7"] ~ main .dive-handle{--dive-frame:7}
 .dive-stage[data-frame="8"] ~ main .dive-handle{--dive-frame:8}
 .dive-stage[data-frame="9"] ~ main .dive-handle{--dive-frame:9}
 .dive-stage[data-frame="10"] ~ main .dive-handle{--dive-frame:10}
 .dive-stage[data-frame="11"] ~ main .dive-handle{--dive-frame:11}
 .dive-stage[data-frame="12"] ~ main .dive-handle{--dive-frame:12}
 .dive-stage[data-frame="13"] ~ main .dive-handle{--dive-frame:13}
 .dive-stage[data-frame="14"] ~ main .dive-handle{--dive-frame:14}
 .dive-stage[data-frame="15"] ~ main .dive-handle{--dive-frame:15}
 .dive-stage[data-frame="16"] ~ main .dive-handle{--dive-frame:16}
 .dive-stage[data-frame="17"] ~ main .dive-handle{--dive-frame:17}
 .dive-stage[data-frame="18"] ~ main .dive-handle{--dive-frame:18}
 .dive-stage[data-frame="19"] ~ main .dive-handle{--dive-frame:19}
 .dive-stage[data-frame="20"] ~ main .dive-handle{--dive-frame:20}
 .dive-stage[data-frame="21"] ~ main .dive-handle{--dive-frame:21}
 .dive-stage[data-frame="22"] ~ main .dive-handle{--dive-frame:22}
 .dive-stage[data-frame="23"] ~ main .dive-handle{--dive-frame:23}
 .dive-stage[data-frame="24"] ~ main .dive-handle{--dive-frame:24}
 .dive-stage[data-frame="25"] ~ main .dive-handle{--dive-frame:25}
 .dive-stage[data-frame="26"] ~ main .dive-handle{--dive-frame:26}
 .dive-stage[data-frame="27"] ~ main .dive-handle{--dive-frame:27}
 .dive-stage[data-frame="28"] ~ main .dive-handle{--dive-frame:28}
 .dive-stage[data-frame="29"] ~ main .dive-handle{--dive-frame:29}
 .dive-stage[data-frame="30"] ~ main .dive-handle{--dive-frame:30}
 .dive-stage[data-frame="31"] ~ main .dive-handle{--dive-frame:31}
 .dive-stage[data-frame="32"] ~ main .dive-handle{--dive-frame:32}
 .dive-stage[data-frame="33"] ~ main .dive-handle{--dive-frame:33}
 .dive-stage[data-frame="34"] ~ main .dive-handle{--dive-frame:34}
 .dive-stage[data-frame="35"] ~ main .dive-handle{--dive-frame:35}
 .dive-stage[data-frame="36"] ~ main .dive-handle{--dive-frame:36}
 .dive-stage[data-frame="37"] ~ main .dive-handle{--dive-frame:37}
 .dive-stage[data-frame="38"] ~ main .dive-handle{--dive-frame:38}
 .dive-stage[data-frame="39"] ~ main .dive-handle{--dive-frame:39}
 .dive-stage[data-frame="40"] ~ main .dive-handle{--dive-frame:40}
 .dive-stage[data-frame="41"] ~ main .dive-handle{--dive-frame:41}
 .dive-stage[data-frame="42"] ~ main .dive-handle{--dive-frame:42}
 .dive-stage[data-frame="43"] ~ main .dive-handle{--dive-frame:43}
 .dive-stage[data-frame="44"] ~ main .dive-handle{--dive-frame:44}
 .dive-stage[data-frame="45"] ~ main .dive-handle{--dive-frame:45}
 .dive-stage[data-frame="46"] ~ main .dive-handle{--dive-frame:46}
 .dive-stage[data-frame="47"] ~ main .dive-handle{--dive-frame:47}
 .dive-stage[data-frame="48"] ~ main .dive-handle{--dive-frame:48}
 .dive-stage[data-frame="49"] ~ main .dive-handle{--dive-frame:49}
 .dive-stage[data-frame="50"] ~ main .dive-handle{--dive-frame:50}
 .dive-stage[data-frame="51"] ~ main .dive-handle{--dive-frame:51}
 .dive-stage[data-frame="52"] ~ main .dive-handle{--dive-frame:52}
 .dive-stage[data-frame="53"] ~ main .dive-handle{--dive-frame:53}
 .dive-stage[data-frame="54"] ~ main .dive-handle{--dive-frame:54}
 .dive-stage[data-frame="55"] ~ main .dive-handle{--dive-frame:55}
 .dive-stage[data-frame="56"] ~ main .dive-handle{--dive-frame:56}
 .dive-stage[data-frame="57"] ~ main .dive-handle{--dive-frame:57}
 .dive-stage[data-frame="58"] ~ main .dive-handle{--dive-frame:58}
 .dive-stage[data-frame="59"] ~ main .dive-handle{--dive-frame:59}
 .dive-stage[data-frame="60"] ~ main .dive-handle{--dive-frame:60}
 .dive-stage[data-frame="61"] ~ main .dive-handle{--dive-frame:61}
 .dive-stage[data-frame="62"] ~ main .dive-handle{--dive-frame:62}
 .dive-stage[data-frame="63"] ~ main .dive-handle{--dive-frame:63}
}

/* PACE20: the badge lives in the chapter eyebrow, so wrapping titles and viewport
   changes cannot detach it from the reading axis. Only its stage supplies progress. */
@media(min-width:801px){
 .dive-section .eyebrow{display:flex;align-items:center;gap:20px;min-height:32px}
 .dive-grab .dive-section .dive-handle{position:static;display:inline-grid;flex:none;width:92px;height:32px;padding:5px 14px;gap:4px;text-transform:none;letter-spacing:normal;text-shadow:none}
 .dive-stage.is-focused ~ main .dive-handle{outline:1px solid var(--gold);outline-offset:3px}
 .dive-labels text{translate:0 .9642857em}
 .dive-labels .callout-pill{translate:0 calc(13.5 * var(--callout-unit,1px))}
}
