/* Zweitlicht – «Die Geschichte». Builds on css/site.css: tokens, type, buttons, header, footer, door, story pieces
   (.site-progress, .site-dots, .site-cue, .site-claim, .site-chip, .site-lit). Here only layout, scenes and the canvas.
   Default = a calm stacked page; html.film = the scroll-driven film. */
html{background:var(--zl-night)}
html.film{scroll-behavior:auto}
body{background:var(--zl-night)}
.nb{white-space:nowrap}
.scene[id]{scroll-margin-top:0}

/* ---------- canvas ---------- */
#stage{display:none}
.film #stage{display:block;position:fixed;inset:0;width:100%;height:100%;z-index:0;pointer-events:none}
main{position:relative;z-index:1}

/* ---------- film scenes: DEFAULT (no JS / reduced motion) = stacked page ---------- */
.scene{padding:96px var(--zl-gutter) 84px;border-top:1px solid var(--zl-line)}
.scene:first-of-type{padding-top:calc(var(--zl-header) + 56px);border-top:0}
.scene.night{background:var(--zl-night)}
.scene .pin{max-width:1100px;margin:0 auto;display:flex;flex-direction:column;gap:28px}
.scene .still{width:min(320px,80%);height:auto;margin:0 0 8px;color:var(--zl-clear)}
.scene .still path{vector-effect:non-scaling-stroke}
.scene .still .tagfill{fill:var(--zl-night)} /* the tag hides the bottle line behind it (tools/d-lamp-still.mjs) */
.scene.ignite .still .tagfill{fill:var(--zl-green)}
.scene.ignite{background:var(--zl-green)}
.hero-copy h1{max-width:16ch}
.chip{align-self:flex-start}
html:not(.film) .cue{display:none} /* «Scrollen» only makes sense where scrolling plays the film */
.big-line{font-weight:600;font-family:var(--zl-f-head);line-height:1.06;letter-spacing:var(--zl-track-head);text-wrap:balance}
.giant{letter-spacing:-.04em}
.facts{display:flex;flex-direction:column;gap:30px}
.fact-num{font:800 var(--zl-fs-display)/.9 var(--zl-f-head);letter-spacing:-.045em;color:var(--zl-fg)}
.fact-line{font-size:var(--zl-fs-lead);line-height:1.45;max-width:30ch;margin-top:14px;color:var(--zl-fg-2);padding-top:14px;border-top:1px solid var(--zl-amber)}
.fact:nth-child(2) .fact-num{color:var(--zl-amber)}
.source{font:400 var(--zl-fs-tag)/1.4 var(--zl-f-mono);letter-spacing:.12em;text-transform:uppercase;color:var(--zl-fg-3)}
.werk-head h2{max-width:13ch}
.steps{list-style:none;margin:36px 0 0;padding:0;display:flex;flex-direction:column;gap:22px}
.step-head{display:flex;align-items:baseline;gap:18px;position:relative}
.num{font:500 15px/1 var(--zl-f-mono);letter-spacing:.06em;color:var(--zl-amber);min-width:30px}
.num::before{content:"0"}
.step-text{font-size:var(--zl-fs-body);line-height:1.55;color:var(--zl-fg-2);max-width:40ch;margin:10px 0 0 48px}
.step-bar{display:none}
.hero-film{margin-top:22px}
/* wide screens without the film: two columns like funke.html's fallback – copy left on the site column, the drawing right and large */
@media (min-width:761px){
  html:not(.film) .scene .pin{max-width:var(--zl-max);display:grid;grid-template-columns:minmax(0,5fr) minmax(0,6fr);column-gap:56px;row-gap:28px;align-items:center;align-content:center}
  html:not(.film) .scene .pin > *{grid-column:1}
  html:not(.film) .scene .pin > .chip{justify-self:start;width:max-content}
  html:not(.film) .scene .pin > .still{grid-column:2;grid-row:1 / span 6;width:100%;max-width:600px;margin:0;justify-self:center}
}

/* ---------- film scenes: html.film ---------- */
/* pins are one *small* viewport tall (iOS: toolbar shown), so copy anchored to the bottom is never covered */
.film .scene{--vh:100vh}
@supports (height:100svh){.film .scene{--vh:100svh}}
.film .scene{height:calc(var(--len) * var(--vh));padding:0;background:transparent;border:0}
.film .scene + .scene{margin-top:calc(-1 * var(--vh))}
.film .scene .pin{position:sticky;top:0;height:var(--vh);max-width:none;margin:0;display:block;overflow:hidden;pointer-events:none;
  --col:max(var(--zl-gutter),calc((100% - var(--zl-max)) / 2)); /* the site's content column (same left edge as .site-wrap) */
  --safe-b:env(safe-area-inset-bottom,0px)}
.film .scene .still{display:none}
.film .t{position:absolute;opacity:0;visibility:hidden;will-change:opacity,transform}
.film .t a,.film .t button{pointer-events:auto}
.film .t [data-t]{will-change:opacity,transform}

/* scene 1 */
/* the first screen is composed like the other pages: copy left on the site column, the protagonist (with its chip) to the right */
.film .hero-copy{left:var(--col);right:auto;width:min(600px,44vw);top:var(--zl-header);bottom:0;text-align:left;display:flex;flex-direction:column;justify-content:center}
.film .hero-copy br.lg{display:none}
.film .hero-copy .site-tag{margin-bottom:min(18px,2vh)}
.film .hero-in{animation:gs-in 1.3s .25s var(--zl-ease) both}
.film.instant .hero-in{animation:none}
@keyframes gs-in{from{opacity:0;transform:translateY(20px)}to{opacity:1;transform:none}}
.film .hero-copy h1{max-width:none}
.film .chip{left:var(--chip-x,72%);top:var(--chip-y,30%)}
.film .big-line{left:6vw;right:6vw;top:calc(var(--zl-header) + 3vh);text-align:center}
/* scene 2 */
.film .facts{left:var(--col);top:0;bottom:0;width:min(560px,40vw);justify-content:center;gap:min(42px,4.5vh);padding-top:var(--zl-header)}
.film .source{margin-top:calc(min(42px,4.5vh) * -.5)}
/* scene 3 */
.film .giant{left:4vw;right:4vw;top:calc(var(--zl-header) + 4vh);text-align:center}
/* scene 4 */
.film .werk-copy{left:var(--col);top:0;bottom:0;width:min(540px,42vw);display:flex;flex-direction:column;justify-content:center;padding-top:var(--zl-header)}
.film .steps{display:grid;grid-template-columns:1fr;gap:0;margin-top:min(44px,5vh)}
.film .step{display:contents}
.film .step-head{grid-column:1;padding:14px 0;border-top:1px solid var(--zl-line);opacity:0;visibility:hidden;will-change:opacity,transform}
.film .step[data-step="0"] .step-head{grid-row:1}
.film .step[data-step="1"] .step-head{grid-row:2}
.film .step[data-step="2"] .step-head{grid-row:3;border-bottom:1px solid var(--zl-line)}
.film .step-head h3{color:var(--zl-fg);transition:color var(--zl-t)}
.film .step-head .num{color:var(--zl-fg-3);transition:color var(--zl-t)}
.film .step-head.on h3,.film .step-head.on .num{color:var(--zl-amber)}
.film .step-bar{display:block;position:absolute;left:0;right:0;bottom:-1px;height:1px;background:var(--zl-amber);transform-origin:0 50%;transform:scaleX(0)}
/* every step text shares one slot; film.js lifts the active one right under its title */
.film .step-text{grid-column:1;grid-row:4;margin:16px 0 0;opacity:0;visibility:hidden;max-width:42ch;will-change:opacity,transform}
/* scene 5 */
.film .claim{width:min(620px,40vw)} /* position + size: .film .site-claim in site.css */

/* ---------- lit ending: the film ---------- */
/* plain Flaschengrün: exactly the colour the ignition ends on, so the pinned scene leaves without a seam */
.filmsec{background:var(--zl-green);padding:calc(var(--zl-header) + clamp(24px,4vh,48px)) 0 clamp(48px,7vh,80px)}
/* its top padding already clears the header: a jump to #film lands the section at the very top (cancels html's scroll-padding) */
.filmsec{scroll-margin-top:calc(-1 * var(--zl-header))}
.film-head{display:flex;flex-direction:column;align-items:flex-start;margin-bottom:clamp(20px,3vh,32px)}
.film-meta{margin-top:12px;font-size:var(--zl-fs-lead);color:var(--zl-fg-2)}
/* the frame always fits the screen after the jump: at most ~66 % of the viewport height */
.film-frame{position:relative;aspect-ratio:16/9;width:100%;max-width:calc(max(200px,min(66vh,100vh - 300px)) * 16 / 9);border-radius:var(--zl-r-lg);overflow:hidden;background:var(--zl-night);box-shadow:var(--zl-shadow),inset 0 0 0 1px var(--zl-line)}
@supports (height:100svh){.film-frame{max-width:calc(max(200px,min(66svh,100svh - 300px)) * 16 / 9)}}
.film-frame video{width:100%;height:100%;object-fit:cover;background:var(--zl-night)}
.film-poster{all:unset;position:absolute;inset:0;cursor:pointer;display:block}
.film-poster img{width:100%;height:100%;object-fit:cover;transition:transform 1.2s var(--zl-ease),filter .6s}
.film-poster:hover img{transform:scale(1.02);filter:brightness(1.08)}
/* the play button sits on the dark wall left of the lamp (film/poster.jpg, made from assets-src/funke-quer-an.webp) */
.film-poster .play{--d:clamp(56px,9vw,112px);position:absolute;left:24%;top:38%;width:var(--d);height:var(--d);margin:calc(var(--d) / -2) 0 0 calc(var(--d) / -2);
  border-radius:50%;background:var(--zl-amber);color:var(--zl-nachtglas);display:grid;place-items:center;box-shadow:var(--zl-glow-amber);transition:transform var(--zl-t-slow) var(--zl-ease)}
.film-poster:hover .play{transform:scale(1.06)}
.film-poster .play svg{width:34%;margin-left:8%}
.film-poster:focus-visible{outline:2px solid var(--zl-accent);outline-offset:-6px;border-radius:var(--zl-r-lg)}
.filmsec + .site-next{background:var(--zl-green);padding-top:0}
.film [data-glide]{will-change:transform,opacity}
.film .site-dots{transition:opacity var(--zl-t),visibility var(--zl-t)}

/* ---------- phone ---------- */
@media (max-width:760px), (max-aspect-ratio:4/5){
  .film .hero-copy{left:var(--zl-gutter);right:var(--zl-gutter);width:auto;bottom:auto;top:calc(var(--zl-header) + 4vh);display:block}
  .film main .site-tag{margin-bottom:12px}
  .film .big-line{left:var(--zl-gutter);right:var(--zl-gutter);top:calc(var(--zl-header) + 2.5vh)}
  .film .facts{left:var(--zl-gutter);right:var(--zl-gutter);width:auto;bottom:auto;top:calc(var(--zl-header) + 2.5vh);padding-top:0;gap:min(22px,2.6vh)}
  .film .source{margin-top:-6px}
  .film .fact-num{font-size:min(15vw,7.4vh)}
  .film .fact-line{font-size:16px;margin-top:8px;padding-top:8px}
  .film .giant{top:calc(var(--zl-header) + 4vh)}
  .film .werk-copy{left:var(--zl-gutter);right:var(--zl-gutter);width:auto;bottom:auto;top:calc(41vh + 26px);padding-top:0;display:block}
  .film .werk-head .site-tag{margin-bottom:8px}
  .film .steps{margin-top:min(18px,2vh)}
  .film .step-head{padding:min(10px,1.2vh) 0}
  .film .step-text{font-size:15px;line-height:1.5;margin-top:min(12px,1.4vh)}
  .film .claim{width:auto}
  .film-frame,.film-poster:focus-visible{border-radius:var(--zl-r-md)}
}

/* ---------- short screens (phone landscape): copy in the left column, the film art on the right ---------- */
@media (max-height:500px) and (min-aspect-ratio:4/5) and (min-width:761px){
  .film .hero-copy{left:var(--col);right:auto;width:46vw;top:var(--zl-header);bottom:0;text-align:left;display:flex;flex-direction:column;justify-content:center}
  .film .hero-copy h1{font-size:min(var(--zl-fs-h1),10vh)}
  .film .hero-copy .site-tag{margin-bottom:8px}
  .film .hero-film{margin-top:6px}
  .film .cue{display:none}
  .film .big-line{left:var(--col);right:auto;width:46vw;text-align:left;top:calc(var(--zl-header) + 4vh);font-size:min(var(--zl-fs-h1),10vh)}
  .film .facts{width:46vw;gap:10px;padding-top:var(--zl-header)}
  .film .fact-num{font-size:min(var(--zl-fs-display),13vh)}
  .film .fact-line{font-size:15px;margin-top:4px;padding-top:6px;max-width:34ch}
  .film .source{margin-top:-2px}
  .film .giant{left:var(--col);right:auto;width:46vw;text-align:left;top:0;bottom:0;padding-top:var(--zl-header);display:flex;align-items:center;font-size:min(var(--zl-fs-display),17vh)}
  .film .werk-copy{width:50vw;padding-top:var(--zl-header)}
  .film .werk-head .site-tag{margin-bottom:4px}
  .film .werk-head h2{font-size:min(var(--zl-fs-h2),8.2vh);max-width:none}
  .film .steps{margin-top:8px}
  .film .step-head{padding:5px 0}
  .film .step h3{font-size:min(var(--zl-fs-h3),5.4vh)}
  .film .step-text{font-size:15px;line-height:1.42;margin-top:6px}
  .film .claim{width:46vw}
  .filmsec{padding-top:calc(var(--zl-header) + 12px)}
  .filmsec .site-wrap{display:grid;grid-template-columns:minmax(0,.7fr) minmax(0,1.3fr);gap:28px;align-items:end}
  .film-head{margin-bottom:0}
  .film-frame{max-width:none;width:min(100%,calc((100vh - var(--zl-header) - 32px) * 16 / 9))}
}
