/* Block 5 · Implantat (V8-BLOCKS §5; L3; R5). Night stretch: the ground is transparent, the fixed night layer shows
   through (ctx.night in 05-implantat.js); text is authored light. Cols 1–4: the H2's three lines are the legend, a 2 px
   lime rule marks the part being placed. Cols 5–12 bleed to the viewport's right edge: the stage (3D host + posters),
   clipped to itself.
   Live (html.js, motion, ≥ 810): a run of 200 svh; the stage pins for one screen and the text column rides 1 : 1 beside
   it (R1 no-stop); the night flips with block 5's heading and stage in view (LOCKED V13).
   Static (no JS, reduced motion): no run; the band carries its own night; the stage is a 90 svh frame beside the text.
   P: text first, then a sticky 4:5 poster frame stepping p 0 → .5 → 1 with the scroll. */
.im { color: var(--on-band); background: var(--band); padding-block: 0; }   /* without the motion layer the band carries its own night */
html.motion .im { background: transparent; }                               /* with it, the fixed night layer shows through (R5) */
html.motion.rm .im { background: var(--band); }                           /* reduced motion: night at once */
/* text column and stage share one grid cell (≥ 810): the text flows with the page beside the stage */
.im-run { display: grid; }
.im-flow, .im-pin { grid-area: 1 / 1; min-width: 0; }
.im-flow { position: relative; z-index: 2; pointer-events: none; padding-block: var(--sec-pad-dark); }
.im-text { grid-column: 1 / 5; min-width: 0; position: relative; pointer-events: auto; }
.im-grid { position: relative; align-items: start; padding-block: var(--sec-pad-dark); }
.im-h { position: relative; font-size: var(--fs-h2); line-height: var(--lh-h2); letter-spacing: var(--ls-h2); font-weight: var(--fw-display); color: var(--on-band); }
.im-part { display: block; white-space: nowrap; }
/* the legend lights the part being placed (David 2026-11-10): the resting parts dim to ink 60 % (3.14, AA large), the
   active part is full ink; JS sets .is-legend only where the scroll drives it, so no JS / reduced motion keep all ink */
html.motion:not(.rm) .im-h.is-legend .im-part { color: var(--on-band-dim); transition: color .35s var(--ease-ui); }
html.motion:not(.rm) .im-h.is-legend .im-part.is-on { color: var(--on-band); }
.im-rule {                                     /* makro's active-item rule, lime on night (a 2 px mark, not text) */
  position: absolute; left: -20px; top: .12em; width: 2px; height: .96em; border-radius: 1px; background: var(--on-band);   /* lime on the logo blue is 1.49: the mark is ink */
}
.im-p { margin-top: 32px; max-width: 24em; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--on-band-2); }
.im-link {
  display: inline-flex; align-items: center; gap: 8px; min-height: 44px; margin-top: 16px;
  font-size: var(--fs-body); color: var(--on-band); text-decoration: underline; text-decoration-color: var(--on-band-line);
}
.im-link svg { width: 20px; height: 20px; flex: none; }
.im-link:hover { text-decoration-color: var(--on-band); }
.im-link:focus-visible { outline-color: var(--ink); }

.im-stage {
  grid-column: 5 / 13; position: relative; height: 90svh; min-height: 520px; overflow: clip;
  margin-right: calc(-1 * max(var(--side), (100vw - var(--container)) / 2));
}
/* the studio light (David 2026-11-10: "add some background, so plain"): a soft pool of lighter blue behind the object,
   as a lit backdrop wall in a product shot; JS raises it with the assembly (--im-lit 0 → 1), static it is full */
.im-stage::before {
  content: ""; position: absolute; inset: var(--im-top, 0px) 0 0; pointer-events: none;   /* fades to 0 at its own edges: never cut by the stage's clip */
  background: radial-gradient(closest-side, var(--band-light) 0%, var(--band-light) 18%, var(--band-light-0) 100%);
  opacity: calc(.45 + .55 * var(--im-lit, 1)); transform: scale(calc(.86 + .14 * var(--im-lit, 1)));
}
.im-stage { --im-top: 0px; }
.im-host { position: absolute; left: 50%; top: calc(50% + var(--im-top) / 2); height: min(92%, calc(100% - var(--im-top) - 32px)); max-width: 100%; transform: translate(-50%, -50%); }   /* the 4:5 frames, never stretched to the stage */

/* live (≥ 810): the stage pins for one screen; the text column rides 1 : 1 beside it (starting at 70 svh, so the legend
   and paragraph are on screen through most of the pin), R1 no-stop rule */
@media (min-width: 810px) {
  html.js:not(.rm) .im-run { height: 200svh; }   /* pinned for one screen (round 1: no time stopped) */
  html.js:not(.rm) .im-pin { position: sticky; top: 0; align-self: start; height: 100svh; overflow: clip; }
  html.js:not(.rm) .im-grid { height: 100svh; padding-block: 0; }
  html.js:not(.rm) .im-flow { padding-block: 70svh 0; }
  /* the text holds beside the pinned stage for the whole assembly (David 2026-11-10: "this text flies by, it should
     stop or stay on the screen during the animation"; overrules R1's 1 : 1 ride here): it rises from 70 svh to its
     hold line, stays while the parts seat, and leaves with the run's end, together with the stage */
  html.js:not(.rm) .im-flow > .wrap { height: 100%; }
  html.js:not(.rm) .im-text {
    --im-hold: max(calc(var(--nav-bottom) + 32px), calc(50svh - 190px));
    position: sticky; top: var(--im-hold); align-self: start;
    height: calc(100svh - var(--im-hold));   /* the held box reaches the window's foot, so it leaves exactly with the stage */
  }
  html.js:not(.rm) .im-stage { height: 100svh; min-height: 0; --im-top: var(--nav-bottom); }   /* the pinned stage starts at the window's top: frames and light sit below the header */
  html.js:not(.rm) .im-rule { will-change: transform; }
}

@media (max-width: 1199.98px) {
  .im-text { grid-column: 1 / 6; }
  .im-stage { grid-column: 6 / 13; }
}
@media (max-width: 809.98px) {
  .im-run { display: block; }
  .im-flow { padding-block: var(--sec-pad) 0; }
  .im-grid { padding-block: 0; }
  .im-text, .im-stage { grid-column: 1 / -1; }
  .im-rule { left: -12px; }
  .im-stage { margin: 36px 0 0; height: auto; min-height: 0; aspect-ratio: 4 / 5; border-radius: var(--r-md); }
  .im-host { inset: 0; height: 100%; transform: none; left: 0; top: 0; }   /* the stage is the frames' own 4:5 */
  html.js:not(.rm) .im-pin { height: 100svh; margin-bottom: var(--sec-pad); }   /* the frame pins < one screen */
  html.js:not(.rm) .im-grid { height: 100%; }
  html.js:not(.rm) .im-stage {
    position: sticky; top: calc(var(--nav-bottom) + 16px); height: auto; aspect-ratio: 4 / 5;
    max-height: calc(100svh - var(--nav-bottom) - var(--bar-h) - 32px);
  }
}
