/* Block 2 · Hero „Eingesetzt" (V8-BLOCKS §2). Recipe R3 on the V5 expansion. Mist ground.
   Live (html.js, not reduced motion): the copy scrolls normally; the stage is sticky for the run; js/blocks/02-hero.js
   clips the photo from the frame rect to full bleed and lands the cards. Static (no JS, reduced motion, failsafe):
   the copy, then the full photo with both cards landed on it: the end state, nothing pinned. */
.hero { position: relative; background: var(--mist); --hero-run: 1.2; }
.hero-h1 {
  font-size: min(48px, calc((100vw - 2 * var(--side)) / var(--h1-em-p)));
  line-height: var(--lh-h1); letter-spacing: var(--ls-h1); font-weight: var(--fw-display);
}
.hero-lede { margin-top: 24px; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--ink-75); max-width: 34em; }
.hero-ctas { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 24px; margin-top: 32px; }
.hero-copy { padding-top: calc(var(--nav-bottom) + 24px); padding-bottom: 32px; }
.hero-row { margin-top: 24px; }
.hero-text { grid-column: 1 / -1; min-width: 0; }
.hero-slot, .hero-pslot, .hero-rim, .hero-run, .hero-addr { display: none; }

/* ---- static: the end state ---- */
.hero-stage { position: relative; height: 100svh; overflow: hidden; }
.hero-frame, .hero-photo { position: absolute; inset: 0; overflow: hidden; }
.hero-img { width: 100%; height: 100%; object-fit: cover; object-position: 50% 30%; max-width: none; }
.hero-cards { position: absolute; z-index: 2; left: var(--side); bottom: 40px; display: flex; align-items: flex-end; gap: 16px; }
.hero-card { position: relative; flex: none; min-width: 0; }
.hero-card .card { min-width: 280px; }
.hero-veil { position: absolute; inset: 0; border-radius: var(--r-sm); background: var(--veil); opacity: 0; pointer-events: none; }

@media (min-width: 810px) {
  /* the H1 runs across the viewport minus 2 × 40 (V8-BLOCKS §2 line fit: 72 px at 1440, ≈ 97 px at 1920, max 120) */
  .hero-h1 {
    font-size: min(120px, calc((100vw - 2 * var(--side)) / var(--h1-em))); white-space: nowrap;
    width: calc(100vw - 2 * var(--side)); margin-left: calc(50% - 50vw + var(--side));
  }
  .hero-text { grid-column: 1 / 7; }
}
@media (max-width: 809.98px) {
  /* phones (phone round 2026-10-23): the photo leads. Reading order H1 → photo → lede → buttons → address; the copy's
     wrappers step aside (display: contents) so the stage can sit between the H1 and the lede */
  .hero { display: flex; flex-direction: column; }
  .hero-copy, .hero-row, .hero-text { display: contents; }
  .hero-h1 { order: 1; padding: calc(var(--nav-bottom) + 24px) var(--side) 0; }
  .hero-stage { order: 2; margin-top: 24px; }
  .hero-lede { order: 3; padding-inline: var(--side); }
  .hero-ctas { order: 4; padding-inline: var(--side); }
  .hero-addr { order: 5; display: grid; gap: 2px; margin-top: 24px; padding-inline: var(--side); font-size: var(--fs-ui); line-height: var(--lh-ui); }
  .hero-addr li + li { color: var(--ink-75); }
  .hero-run { order: 6; }
  .hero > :last-child { margin-bottom: 0; }
  .hero::after { content: ""; order: 7; height: 32px; }
  .hero-stage { height: auto; aspect-ratio: 4 / 5; overflow: visible; }
  .hero-frame, .hero-photo { position: relative; height: 100%; }
  .hero-cards { position: relative; left: auto; bottom: auto; flex-direction: column; align-items: stretch; gap: 8px; margin: -96px 16px 0; }
  .hero-card .card { min-width: 0; }
}

/* ---- live: pinned stage, frame → full bleed, cards land ---- */
html.js:not(.rm) .hero-run { display: block; height: calc(var(--hero-run) * 100svh); }
html.js:not(.rm) .hero-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; z-index: 2; pointer-events: none; aspect-ratio: auto; }
html.js:not(.rm) .hero-frame { position: absolute; inset: 0; height: auto; overflow: visible; }
html.js:not(.rm) .hero-photo { position: absolute; inset: 0; height: auto; clip-path: inset(50% 50% 50% 50%); will-change: clip-path; }
html.js:not(.rm) .hero-img { position: absolute; left: 0; top: 0; width: var(--img-w, 100%); height: auto; object-fit: fill; transform-origin: 0 0; will-change: transform; }
html.js:not(.rm) .hero-rim { display: block; position: absolute; border-radius: var(--r-lg); box-shadow: var(--rim-glass); pointer-events: none; }
html.js:not(.rm) .hero-cards { pointer-events: auto; }
html.js:not(.rm) .hero-card { will-change: transform; transform-origin: 50% 50%; }
html.js:not(.rm) .hero-veil { opacity: 1; }

@media (min-width: 810px) {
  /* the copy lies over the top of the section and scrolls away; the stage (transparent) pins above it */
  html.js:not(.rm) .hero-copy { position: absolute; z-index: 1; top: 0; left: 0; right: 0; height: 100svh; display: flex; flex-direction: column; padding-bottom: 24px; }
  /* the row shares the H1's measure (viewport minus 2 × 40) so lede, frame and H1 hang on one left edge */
  html.js:not(.rm) .hero-row { flex: 1 1 auto; min-height: 0; width: calc(100vw - 2 * var(--side)); margin-left: calc(50% - 50vw + var(--side)); }
  html.js:not(.rm) .hero-text { grid-column: 1 / 6; }
  /* the frame reaches the fold (cols 6–12 of that measure) */
  html.js:not(.rm) .hero-slot { display: block; grid-column: 6 / 13; height: 100%; min-height: 280px; }
}
@media (max-width: 809.98px) {
  /* phones: nothing pinned. The stage (one screen tall, sized once: lvh, else the measured px) scrolls in normal flow
     under the H1 while js/blocks/02-hero.js opens the frame from its rectangle to full bleed */
  html.js:not(.rm) .hero-run { display: none; }
  html.js:not(.rm) .hero-stage { position: relative; height: var(--vh0, 100vh); height: max(var(--vh0, 100vh), 100lvh); }
  html.js:not(.rm) .hero-lede { margin-top: 24px; }
  html.js:not(.rm) .hero-ctas { margin-top: 24px; }
  /* the card row: compact, at the photo's foot, its foot 16 px above the bar on the first measured screen; sized here,
     the cards' insides untouched */
  html.js:not(.rm) .hero-cards {
    position: absolute; left: 12px; right: 12px; margin: 0; flex-direction: row; align-items: stretch; gap: 8px;
    bottom: calc(100% - var(--vh0, 100%) + var(--bar-h) + 12px);
  }
  html.js:not(.rm) .hero-card { flex: 1 1 0; display: flex; }
  html.js:not(.rm) .hero-card[data-pose="hours"] { flex-grow: 1.3; }
  html.js:not(.rm) .hero-card .card { flex: 1; padding: 12px 14px; }
  html.js:not(.rm) .hero-card .card-status { font-size: 15px; line-height: 1.35; }
  html.js:not(.rm) .hero-card .card-toggle { min-height: 40px; margin: 4px 0 -8px; }
  html.js:not(.rm) .hero-card .card-figure { font-size: 28px; }
  html.js:not(.rm) .hero-card .card-count { margin-top: 2px; font-size: var(--fs-ui); line-height: 1.35; }
  html.js:not(.rm) .hero-card .card-source { margin-top: 4px; font-size: 12px; line-height: 1.35; }   /* small print: the date of the figure */
  html.js:not(.rm) .hero-veil { display: none; }
  /* they arrive once the photo has opened and settled (.is-cards, set by the JS): one fade up 10 px, together */
  html.js:not(.rm) .hero-cards { transform: translate3d(0, 10px, 0); transition: opacity .2s var(--ease-ui), transform .2s var(--ease-ui); }
  html.motion:not(.rm).is-loaded .hero.is-ready:not(.is-cards) .hero-cards { opacity: 0; pointer-events: none; }
  html.js:not(.rm) .hero.is-cards .hero-cards { transform: none; transition: opacity .5s var(--ease-ui), transform .5s var(--ease-ui); }
}

/* load ladder (donor): photo and rim fade in .4 s after the H1 starts, over 1.6 s; the cards with them */
html.motion:not(.rm) .hero-frame, html.motion:not(.rm) .hero-cards { opacity: 0; }
html.motion:not(.rm).is-loaded .hero.is-ready .hero-frame { opacity: 1; transition: opacity 1.6s var(--ease-ui) .4s; }
html.motion:not(.rm).is-loaded .hero.is-ready .hero-cards { opacity: 1; transition: opacity 1s var(--ease-ui) .6s; }

/* the riding line (David, round 1: "Let a text line ride"): HOME:address on a small paper plate. Live it moves 1 : 1
   with the scroll across the whole run (js/blocks/02-hero.js), so the pinned stretch never reads as held.
   Static (no JS, reduced motion): it sits on the photo's lower right (D) or under the cards (P). */
.hero-ride {
  position: absolute; z-index: 3; right: max(var(--side), calc((100vw - var(--container)) / 2)); bottom: 40px;
  display: grid; gap: 2px; padding: 10px 16px; border-radius: var(--r-sm); background: var(--paper); color: var(--ink);
  font-size: var(--fs-ui); line-height: var(--lh-ui); text-align: right; max-width: calc(100vw - 2 * var(--side));
}
.hero-ride li + li { color: var(--ink-75); }
@media (max-width: 809.98px) {
  /* phones (overrule of V17, V8-PHONE-ROUND): the line stands still in the copy (.hero-addr, its visible copy); this
     one stays in the document for screen readers only */
  .hero-ride { position: absolute; left: 0; top: 0; width: 1px; height: 1px; margin: 0; padding: 0; background: none; }
  .hero-ride li { width: 1px; white-space: nowrap; clip-path: inset(50%); }   /* each line clips itself: no box cuts text */
}
@media (min-width: 810px) { html.js:not(.rm) .hero-ride { will-change: transform; } }
html.motion:not(.rm) .hero-ride { opacity: 0; }
html.motion:not(.rm).is-loaded .hero.is-ready .hero-ride { opacity: 1; transition: opacity 1s var(--ease-ui) .8s; }
