/* The question, into 04 · Subjects. "Every discovery begins with a" over one large hollow "?": Satoshi Black's own glyph,
   outlined in the same light as the brand's accent words (.hero-title-accent in home.css). The section holds still
   while it is scrolled through, and gate.js moves the viewpoint into the "?" and through its dot. The subjects section
   (atlas.css) waits further back the whole time, as it is, seen only through the dot, and comes forward until it is
   the scene. --gate-run is how far that takes; --gate-line is the outline's width, in ems of the glyph. */

.gate {
  --gate-run: 150vh;
  --gate-line: 0.013;
  position: relative;
  margin-top: max(0px, calc(var(--space-section) - 16svh));
}

/* Without the script nothing is pinned: the question, then the subjects below it. (With Reduce Motion the stage is
   still held, but nothing travels: the question gives way to the subjects in place.) */
.gate-stage { position: relative; }
.gate-plane {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  gap: clamp(64 * var(--z), 12svh, 150 * var(--z));
  min-height: 100svh; padding: 0 var(--gutter);
  text-align: center;
  transform-origin: 0 0;
}
.gate-title { font-size: clamp(34 * var(--z), 4.1vw, 76 * var(--z)); font-weight: 500; line-height: 1.05; letter-spacing: -0.04em; }
/* The space the "?" stands in: a little under half the window, so the line above it holds its own. The outline is
   drawn over the whole stage (below), so it can grow past this box. */
.gate-mark-box { position: relative; height: min(46svh, 100vw); aspect-ratio: 515 / 767; flex: none; }

.gate-glow, .gate-line { position: absolute; left: 0; top: 0; width: 100%; height: 100%; overflow: visible; pointer-events: none; }
.gate.is-live :is(.gate-glow, .gate-line) { height: 100svh; }
/* A fine line in the accent words' light: bands of Soft Gold and Periwinkle that meet through warm white, drifting
   slowly along it (gate.js), its glow close round it and a faint Periwinkle bloom further out. The glow sits under the
   hollow, so it shows only outside and the black inside stays black. gate.js sets --line, the outline's width, as the
   viewpoint nears. */
.gate-glow path, .gate-line path { fill: none; stroke: url(#gate-light); stroke-linejoin: round; }
.gate-glow { filter: blur(calc(var(--line, 7px) * 0.9)) drop-shadow(0 0 calc(var(--line, 7px) * 3) rgba(124, 135, 221, 0.4)); opacity: 0.9; }

.gate-window { position: relative; background: var(--bg); }
.gate-depth { display: grid; align-content: center; transform-origin: 50% 50%; }
/* The space above the subjects is the stage's here, not the section's own. */
.gate-depth > .atlas { padding-top: 0; }
.gate-fog { position: absolute; inset: 0; background: var(--bg); opacity: 0; pointer-events: none; }

/* ---------- Live: one stage held in the window while the section scrolls past ---------- */

.gate.is-live { height: calc(100svh + var(--gate-run)); }
.gate.is-live .gate-stage { position: sticky; top: 0; height: 100svh; overflow: hidden; overflow: clip; }
.gate.is-live :is(.gate-plane, .gate-window) { position: absolute; inset: 0; }
.gate.is-live .gate-plane { z-index: 1; }
.gate.is-live .gate-glow { z-index: 2; }
.gate.is-live .gate-window { z-index: 3; }
.gate.is-live .gate-line { z-index: 4; }
.gate.is-live .gate-depth { position: absolute; inset: 0; }
.gate.is-live.is-moving .gate-depth { will-change: transform; }
/* Until the viewpoint is through, the subjects can't be taken hold of. */
.gate.is-live:not(.is-open) .gate-window { pointer-events: none; }
.gate.is-open :is(.gate-glow, .gate-line) { visibility: hidden; }

@media (max-width: 719px) {
  .gate { --gate-run: 130vh; margin-top: max(0px, calc(var(--space-section) * 0.75 - 16svh)); }
  .gate-mark-box { height: min(42svh, 96vw); }
}
