/* Block 9 · Angst (V8-BLOCKS §9). Full-bleed photo spread: foto-14 in crop box C (source x .25–1.0, y 0–.633, 16:9;
   reasons and measurements in _tools/blocks/09_angst.py). C covers the section, anchored right and top; the text
   sits in C's coordinates on the white door (x .63 of C; paragraphs to .90). Nothing moves or scales but the rise.
   Stacked (phones, windows narrower than 5:4, or too short for the text above his shoulder): the photo on its own
   (P 4:5 at x .40–.93; T/D the C crop), then the text on paper. Both crops are cut files (V8-IMAGE-REVIEW §5B 5–6):
   the image only covers its box, never zoomed.
   Motion (M1, js/blocks/09-angst.js = the Anfahrt spread): with JS and motion the frame opens like a sheet (margins
   --wx / --wy → 0, clip-path none once open) and the photo drifts by --ag-drift; without them nothing below applies. */
.ag { --ag-ar: 1.7773; position: relative; background: var(--paper); scroll-margin-top: 0; }
.ag-c { position: relative; }
.ag-pic { position: relative; display: block; aspect-ratio: 4 / 5; overflow: hidden; }
.ag-img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: 50% 0; }   /* P: angst-foto-14-p (x .40–.93, 4:5); T/D: angst-foto-14-d (= C) */
.ag-text { width: 100%; max-width: calc(var(--container) + 2 * var(--side)); margin-inline: auto; padding: var(--gap-stack) var(--side) var(--sec-pad); }
.ag-p { margin-top: 16px; max-width: 34em; }
.ag-h + .ag-p { margin-top: 20px; }
.ag-act { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; margin-top: 24px; }
/* stacked: the picture is the frame (straight edges); the photo, taller than it by --ag-drift, drifts inside it */
.ag-pic.is-live { clip-path: inset(var(--wy, 0) var(--wx, 0) 0 var(--wx, 0)); }
.ag-pic.is-live.is-open { clip-path: none; }
.ag-pic.is-live .ag-img { top: calc(var(--ag-drift, 0px) / -2); height: calc(100% + var(--ag-drift, 0px)); will-change: transform; }

/* T/D stacked: the C crop at 16:9 */
@media (min-width: 810px) {
  .ag-pic { aspect-ratio: var(--ag-ar); }
  .ag-text { padding-top: 60px; }
  .ag-text > * { max-width: 640px; }
}

/* the spread: C covers the 100 svh section; the text on the door */
@media (min-width: 810px) and (min-aspect-ratio: 5/4) and ((min-width: 1316px) or (min-height: 740px)) {
  .ag { --cw: max(100cqw, calc(100cqh * var(--ag-ar))); height: 100svh; container-type: size; overflow: clip; background: var(--mist); }
  .ag-c { position: absolute; top: 0; right: 0; width: var(--cw); aspect-ratio: var(--ag-ar); }
  .ag-pic { position: absolute; inset: 0; aspect-ratio: auto; overflow: visible; }
  .ag-text {
    position: absolute; left: 63%; top: max(13%, calc(var(--nav-bottom) + 24px)); width: min(35%, 540px); max-width: none;
    margin: 0; padding: 0;
  }
  .ag-text > * { max-width: none; }
  .ag-p { max-width: min(100%, calc(var(--cw) * .27)); }
  /* the spread: the section is the frame; C is --ag-drift taller (it still covers the section at both ends of the
     drift) and drifts with the text on it, so the text never leaves the door; the text keeps its nav clearance */
  .ag.is-live { --cw: max(100cqw, calc((100cqh + var(--ag-drift, 0px)) * var(--ag-ar))); clip-path: inset(var(--wy, 0) var(--wx, 0) 0 var(--wx, 0)); }
  .ag.is-live.is-open { clip-path: none; }
  .ag.is-live .ag-c { top: calc(var(--ag-drift, 0px) / -2); will-change: transform; }
  .ag.is-live .ag-text { top: max(13%, calc(var(--nav-bottom) + 24px + var(--ag-drift, 0px) / 2)); }
}
