/* Smile4U · „Näher" stage (review build, docs/HOME-NEXT.md phase B). Blocks 04 + 05 as one pinned macro take.
   Tokens, type and the frame player are v8's; this file is layout on them.
   Three states:
     static   no JS or reduced motion: the end frame as a picture, then every step and the legend in reading order
     stage    html.motion:not(.rm): the picture is pinned full bleed, one beat of copy at a time holds beside it
     phone    ≤ 809: the 9:16 take, the copy above the object */

/* ---------- static ---------- */
.nx { position: relative; background: var(--band); color: var(--on-band); }
.nx-pic { margin: 0; aspect-ratio: 16 / 9; width: 100%; }
.nx-pic img { object-fit: cover; }
.nx-shade, .nx-prog, .nx-load { display: none; }
.nx-copy { padding: 64px var(--side) 96px; max-width: 760px; }
.nx-steps { list-style: none; margin: 0; padding: 0; }
.nx-beat + .nx-beat, .nx-steps, .nx-legend { margin-top: 64px; }

.nx-h { font-size: clamp(56px, 9.4vw, 188px); line-height: .96; letter-spacing: -0.055em; font-weight: var(--fw-display); }
.nx-stmt { margin-top: 32px; max-width: 21em; font-size: var(--fs-statement); line-height: var(--lh-statement); letter-spacing: var(--ls-statement); font-weight: var(--fw-statement); }
.nx-num { display: block; font-size: clamp(64px, 7.6vw, 148px); line-height: .9; letter-spacing: -0.05em; font-weight: var(--fw-display); }
.nx-t { margin-top: 20px; font-size: var(--fs-h2); line-height: 1.12; letter-spacing: var(--ls-h2); font-weight: var(--fw-display); }
.nx-t a { color: inherit; text-decoration: none; }
.nx-t a::after { content: "→"; display: inline-block; margin-left: .28em; font-size: .5em; vertical-align: .32em; }
.nx-t a:hover, .nx-more:hover { text-decoration: underline; text-underline-offset: .18em; text-decoration-thickness: 1px; }
.nx-line { margin-top: 16px; max-width: 19em; font-size: clamp(20px, 1.55vw, 28px); line-height: 1.32; letter-spacing: var(--ls-statement); color: var(--on-band-2); }
.nx-extra { margin-top: 8px; font-size: var(--fs-ui); line-height: var(--lh-ui); color: var(--on-band-2); }
.nx-mw { margin-top: 32px; max-width: 420px; display: flex; align-items: baseline; gap: 12px; }
.nx-q, .nx-l { font-size: var(--fs-ui); line-height: var(--lh-ui); color: var(--on-band-2); }
.nx-q { white-space: nowrap; }
.nx-l { min-width: 0; }
.nx-v { font-size: clamp(32px, 2.9vw, 48px); line-height: 1; letter-spacing: var(--ls-figure); font-weight: var(--fw-display); white-space: nowrap; }
.nx-r { flex: 1 1 32px; border-bottom: 1px solid var(--on-band-line); }
.nx-inset { margin: 28px 0 0; width: min(100%, 296px); height: min(21vh, 208px); border-radius: var(--r-md); overflow: hidden; }
.nx-inset picture, .nx-inset img { display: block; width: 100%; height: 100%; object-fit: cover; }
.nx-lh { font-size: clamp(44px, 5.2vw, 100px); line-height: 1.04; letter-spacing: -0.05em; font-weight: var(--fw-display); }
.nx-part { display: block; white-space: nowrap; }
.nx-p { margin-top: 32px; max-width: 24em; font-size: var(--fs-body); line-height: var(--lh-body); color: var(--on-band-2); }
.nx-more { display: inline-block; margin-top: 20px; font-size: var(--fs-body); color: inherit; text-decoration: none; }

/* ---------- stage ---------- */
html.motion:not(.rm) .nx { background: var(--paper); }            /* the ground the picture opens on (block 03 ends on paper) */
html.motion:not(.rm) .nx-run { height: 570vh; }                    /* nine states over 4.45 screens + .25 rest + the screen itself (naeher.js ZONES) */
html.motion:not(.rm) .nx-pin {
  position: sticky; top: 0; height: 100vh; height: 100svh; overflow: hidden; background: var(--band);
  /* purpose: Fahrt in — a framed picture on the page opens to the full screen as it arrives (naeher.js sets the insets) */
  clip-path: inset(var(--nx-iy, 0px) var(--nx-ix, 0px) round var(--nx-r, 0px));
}
html.motion:not(.rm) .nx-pic {
  position: absolute; right: 0; top: 50%; width: max(100vw, calc(100vh * 16 / 9)); height: auto; aspect-ratio: 16 / 9;
  transform: translateY(-50%);                                      /* cover, cropped on the left only: the object sits right of centre */
}
html.motion:not(.rm) .nx-pic .fr-canvas { cursor: default; }
/* purpose: Breath — at rest the picture pushes in a little and back, so the pinned screen is never frozen. Transform
   only, runs while the stage is on screen (naeher.js .is-seen), off under reduced motion with the rest of the stage. */
html.motion:not(.rm) .nx-pin.is-seen .nx-pic { transform-origin: 68% 58%; animation: nx-breath 7s ease-in-out infinite alternate; }
@keyframes nx-breath { to { scale: 1.014; } }
/* purpose: loading is shown as it is — a hairline at the stage's top edge fills with the decoded frames, then leaves */
html.motion:not(.rm) .nx-load { display: block; position: absolute; inset: 0 0 auto 0; height: 2px; background: var(--on-band-line); opacity: 0; transition: opacity .4s var(--ease-ui); z-index: 2; }
html.motion:not(.rm) .nx-pin.is-loading .nx-load { opacity: 1; }
html.motion:not(.rm) .nx-load i { display: block; height: 100%; background: var(--ink); transform-origin: 0 50%; transform: scaleX(0); transition: transform .2s linear; }
html.motion:not(.rm) .nx-shade {
  display: block; position: absolute; inset: auto 0 0 0; height: 34%; pointer-events: none;
  background: linear-gradient(rgba(73, 169, 218, 0), var(--band)); opacity: var(--nx-out, 0);   /* purpose: the picture's foot meets the next block's ground without an edge */
}
html.motion:not(.rm) .nx-copy {
  position: absolute; left: max(var(--side), 6vw); top: 0; bottom: 0; width: min(36vw, 580px); max-width: none; padding: 0;
}
html.motion:not(.rm) .nx-steps, html.motion:not(.rm) .nx-legend, html.motion:not(.rm) .nx-beat + .nx-beat { margin-top: 0; }
html.motion:not(.rm) .nx-beat {
  position: absolute; left: 0; top: 52%; width: 100%;
  opacity: 0; visibility: hidden; transform: translate3d(0, calc(-50% + 28px), 0);
  /* purpose: Zeile — one beat of copy holds while its part of the take plays, then gives way upward */
  transition: opacity .16s var(--ease-ui), transform .4s var(--ease-scroll), visibility 0s .16s;   /* leaves fast: two beats are never read on top of each other */
}
html.motion:not(.rm) .nx-beat.is-past { transform: translate3d(0, calc(-50% - 28px), 0); }
html.motion:not(.rm) .nx-beat.is-on {
  opacity: 1; visibility: visible; transform: translate3d(0, -50%, 0);
  transition: opacity .34s var(--ease-ui) .2s, transform .5s var(--ease-scroll) .2s, visibility 0s;
}
html.motion:not(.rm) .nx-intro { width: min(62vw, 1180px); }
html.motion:not(.rm) .nx-part { color: var(--on-band-dim); transition: color .35s var(--ease-ui); }   /* purpose: the heading is the legend of the part being placed */
html.motion:not(.rm) .nx-part.is-on { color: var(--on-band); }
html.motion:not(.rm) .nx-prog {
  display: block; position: absolute; left: calc(max(var(--side), 6vw) - 28px); top: 52%; width: 2px; height: 168px;
  margin-top: -84px; background: var(--on-band-line);
}
html.motion:not(.rm) .nx-prog i { display: block; width: 100%; height: 100%; background: var(--ink); transform-origin: 50% 0; transform: scaleY(var(--nx-p, 0)); }

/* ---------- phone ---------- */
@media (max-width: 809px), (max-aspect-ratio: 1/1) {   /* a tablet held upright has the phone's proportions: it gets the upright take too */
  .nx-copy { padding: 40px var(--side) 64px; }
  /* David's iPhone, 2026-11-17: the copy ran over the teeth. In Safari the window is about 660 px tall, not 844, and
     the object starts near its middle: every beat of copy has to end in the upper 45 %. Numeral and title share a
     row, the statement is body-sized. */
  .nx-h { font-size: clamp(38px, 11.4vw, 50px); }
  .nx-stmt { margin-top: 12px; max-width: none; font-size: 17px; line-height: 1.38; letter-spacing: 0; font-weight: 400; color: var(--on-band-2); }
  .nx-step { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 12px; align-items: baseline; }
  .nx-step > :not(.nx-num):not(.nx-t) { grid-column: 1 / -1; }
  .nx-num { font-size: 26px; line-height: 1.12; letter-spacing: var(--ls-h2); color: var(--on-band-dim); }
  .nx-t { margin-top: 0; font-size: 26px; }
  .nx-line { margin-top: 8px; max-width: none; font-size: 17px; }
  .nx-extra { margin-top: 4px; }
  .nx-mw { margin-top: 12px; }
  .nx-v { font-size: 28px; }
  .nx-lh { font-size: clamp(28px, 8.4vw, 36px); }
  .nx-p { margin-top: 10px; max-width: none; font-size: 15px; line-height: 1.42; }
  .nx-more { margin-top: 10px; }
  html.motion:not(.rm) .nx-pic {
    right: auto; left: 50%; top: auto; bottom: 0; width: max(100vw, calc(100svh * 9 / 16)); aspect-ratio: 9 / 16;
    transform: translateX(-50%);                                    /* cover, cropped at the top only: the object sits low */
  }
  html.motion:not(.rm) .nx-pin.is-seen .nx-pic { transform-origin: 50% 72%; }
  /* the take's upper third is the studio's cove, darker than the band (ink on it measured under 4.5 : 1): the copy
     stands on the band token itself, and the picture comes out of it below */
  html.motion:not(.rm) .nx-pin::after {
    content: ""; position: absolute; inset: 0 0 auto 0; height: 60%; pointer-events: none;
    background: linear-gradient(var(--band) 0, var(--band) 74%, rgba(73, 169, 218, 0));      /* band to 44 %, clear by 60 % */
  }
  html.motion:not(.rm) .nx-copy { left: var(--side); right: var(--side); width: auto; z-index: 1; }
  html.motion:not(.rm) .nx-prog { z-index: 1; }
  html.motion:not(.rm) .nx-shade { z-index: 1; }
  .nx-mw { gap: 8px; }
  html.motion:not(.rm) .nx-beat { top: calc(var(--nav-h, 68px) + 40px); transform: translate3d(0, 20px, 0); }
  html.motion:not(.rm) .nx-beat.is-past { transform: translate3d(0, -20px, 0); }
  html.motion:not(.rm) .nx-beat.is-on { transform: none; }
  html.motion:not(.rm) .nx-intro { width: 100%; }
  html.motion:not(.rm) .nx-inset { display: none; }                 /* the picture owns the phone screen */
  html.motion:not(.rm) .nx-prog { left: var(--side); right: var(--side); top: calc(var(--nav-h, 68px) + 24px); width: auto; height: 2px; margin: 0; }
  html.motion:not(.rm) .nx-prog i { transform-origin: 0 50%; transform: scaleX(var(--nx-p, 0)); }
}

/* the smallest phones in Safari (about 620 px of window): the legend ends above the object too */
@media (max-width: 809px) and (max-height: 640px) {
  .nx-lh { font-size: 26px; }
  .nx-p { font-size: 14px; }
}

/* ---------- the ruler (round 3): where the visitor is in the nine states, and a way straight to any of them ----------
   One device: a scale of ticks and one mark. It replaces the progress hairline. Static state: not shown. */
.nx-rule { display: none; }
html.motion:not(.rm) .nx-prog { display: none; }
html.motion:not(.rm) .nx-rule {
  display: block; position: absolute; left: calc(max(var(--side), 6vw) - 44px); top: 52%; width: 28px; margin-top: -117px; z-index: 2;
  /* the scale's fine graduation between the nine ticks */
  background: repeating-linear-gradient(to bottom, var(--on-band-line) 0 1px, transparent 1px 8.667px) 0 12px / 6px calc(100% - 25px) no-repeat;
}
html.motion:not(.rm) .nx-tick {
  display: block; position: relative; width: 28px; height: 26px; padding: 0; border: 0; background: none; cursor: pointer; color: var(--on-band-dim);
}
html.motion:not(.rm) .nx-tick::before { content: ""; position: absolute; left: 0; top: 12px; width: 12px; height: 1px; background: currentColor; transition: width .3s var(--ease-ui); }
html.motion:not(.rm) .nx-tick:hover::before, html.motion:not(.rm) .nx-tick:focus-visible::before { width: 20px; }
html.motion:not(.rm) .nx-tick.is-on, html.motion:not(.rm) .nx-tick.is-done { color: var(--ink); }
html.motion:not(.rm) .nx-tick:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
html.motion:not(.rm) .nx-mark {
  position: absolute; left: 0; top: 11px; width: 24px; height: 3px; background: var(--ink); pointer-events: none;
  transition: transform .5s var(--ease-scroll);        /* purpose: the mark travels to the state the scroll has chosen */
}
@media (max-width: 809px), (max-aspect-ratio: 1/1) {
  html.motion:not(.rm) .nx-rule {
    left: var(--side); right: var(--side); top: calc(var(--nav-h, 68px) + 12px); width: auto; margin: 0; display: flex;
    background: repeating-linear-gradient(to right, var(--on-band-line) 0 1px, transparent 1px 11.11%) 0 0 / 100% 5px no-repeat;
  }
  html.motion:not(.rm) .nx-tick { flex: 1 1 0; width: auto; height: 28px; }
  html.motion:not(.rm) .nx-tick::before { left: 0; top: 0; width: 1px; height: 11px; transition: height .3s var(--ease-ui); }
  html.motion:not(.rm) .nx-tick:hover::before, html.motion:not(.rm) .nx-tick:focus-visible::before { width: 1px; height: 16px; }
  html.motion:not(.rm) .nx-mark { left: 0; top: 0; width: 3px; height: 20px; }
}

/* the clips lie over the canvas at its exact size; the one that plays or rests is shown, the other waits unseen (naeher.js) */
.nx-clip { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: cover; opacity: 0; pointer-events: none; }
.nx-clip.is-on { opacity: 1; }

/* ---------- windows taller than the take (16:9) but wider than tall: a 16:10 laptop in full screen, a tablet lying down ----------
   Found 2026-11-17: the picture covers the window by its height there and was hung from the right edge, so everything
   in it moved left, under the copy (the gates had only measured 16:9 windows). It now hangs from the centre, and the
   copy's lines end where the object begins: the clear width is measured from the take itself (the object never
   comes left of 33.5 % of the frame while a step's copy stands, 44 % under the opening statement). */
@media (min-width: 810px) and (min-aspect-ratio: 1001/1000) and (max-aspect-ratio: 16/9) {
  html.motion:not(.rm) .nx-pic { right: auto; left: 50%; transform: translate(-50%, -50%); }
  html.motion:not(.rm) .nx-copy {
    --nx-clear: max(240px, calc(50vw - 0.165 * 177.78vh - max(var(--side), 6vw) - 12px));
    --nx-clear0: max(300px, calc(50vw - 0.06 * 177.78vh - max(var(--side), 6vw) - 12px));
  }
  html.motion:not(.rm) .nx-line { max-width: min(19em, var(--nx-clear)); }
  html.motion:not(.rm) .nx-p { max-width: min(24em, var(--nx-clear)); }
  html.motion:not(.rm) .nx-mw { max-width: min(420px, var(--nx-clear)); }
  html.motion:not(.rm) .nx-t { max-width: var(--nx-clear); }
  html.motion:not(.rm) .nx-stmt { max-width: min(21em, var(--nx-clear0)); }
  html.motion:not(.rm) .nx-h { font-size: clamp(56px, min(9.4vw, 13.6vh), 188px); }
}

/* the same windows, narrow copy: a measure row may break onto two lines instead of pushing its parts into each other */
@media (min-width: 810px) and (min-aspect-ratio: 1001/1000) and (max-aspect-ratio: 16/9) {
  html.motion:not(.rm) .nx-mw { flex-wrap: wrap; row-gap: 2px; }
  html.motion:not(.rm) .nx-r { flex-basis: 16px; }
}
