/* The choice between Lite and Full 3D, and both loaders (html.js.gate-on, see journey-check.js).
   Layers while it shows: the dark sky (.gate-bg) under the page's journey canvas, which draws the two
   planets, under the words and buttons (.gate-ui). main gives up its stacking context so the canvas can
   sit between them; nothing changes once the gate is gone. */
.gate { display: none; }
.js.gate-on .gate { display: block; }
.js.gate-on main { z-index: auto; }
.js.gate-on .journey-stage { display: block; position: fixed; inset: 0; z-index: calc(var(--z-modal) + 1); height: 100dvh; margin: 0; background: none; pointer-events: none; }
.js.gate-on .journey-canvas { opacity: 1; transition: none; }
.js.gate-on body { overflow: hidden; }

.gate-bg {
  position: fixed; inset: 0; z-index: var(--z-modal);
  background:
    radial-gradient(1px 1px at 12% 18%, #fff, transparent), radial-gradient(1px 1px at 78% 12%, #fff, transparent),
    radial-gradient(1.5px 1.5px at 33% 72%, #fff, transparent), radial-gradient(1px 1px at 64% 38%, #fff, transparent),
    radial-gradient(1px 1px at 91% 81%, #fff, transparent), radial-gradient(1px 1px at 22% 88%, #fff, transparent),
    radial-gradient(1px 1px at 47% 9%, #fff, transparent), radial-gradient(1.5px 1.5px at 85% 52%, #fff, transparent),
    radial-gradient(1px 1px at 6% 47%, #fff, transparent), radial-gradient(1px 1px at 56% 93%, #fff, transparent),
    radial-gradient(70% 60% at 50% 115%, color-mix(in oklab, var(--glow-b) 45%, transparent), transparent),
    radial-gradient(50% 45% at 85% 0%, color-mix(in oklab, var(--glow-a) 25%, transparent), transparent),
    var(--color-paper);
  background-size: 420px 380px, 520px 460px, 610px 500px, 380px 420px, 470px 530px, 560px 410px, 640px 600px, 700px 520px, 450px 470px, 530px 560px, 100% 100%, 100% 100%, 100% 100%;
}
.gate-ui {
  position: fixed; inset: 0; z-index: calc(var(--z-modal) + 2);
  display: grid; grid-template-rows: auto auto auto 1fr auto; justify-items: center; align-items: start;
  padding: clamp(24px, 5vh, 56px) var(--space-lg) clamp(24px, 5vh, 48px); text-align: center; color: var(--color-ink);
  pointer-events: none;
}
.gate-ui > * { pointer-events: auto; }
.gate-brand { justify-self: start; display: inline-flex; align-items: center; gap: var(--space-xs); margin: 0; font: 600 var(--text-xl)/1 var(--font-display); letter-spacing: -0.02em; }
.gate-title { margin: clamp(16px, 6vh, 72px) 0 var(--space-xs); font: 600 clamp(1.75rem, 2.6vw + 0.5rem, 3rem)/1.08 var(--font-display); letter-spacing: -0.025em; }
.gate-note { margin: 0; color: var(--color-ink-2); font-size: var(--text-md); }

.gate-centre { align-self: center; display: grid; justify-items: center; }
.gate-picks { display: flex; align-items: center; justify-content: center; gap: clamp(48px, 12vw, 220px); }
.gate-pick {
  display: grid; justify-items: center; gap: 4px; padding: var(--space-sm); border: 0; border-radius: var(--radius-card);
  background: none; color: inherit; font: inherit; cursor: pointer;
  transition: opacity var(--dur-long) var(--ease-out);
}
.gate-pick:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 6px; }
.gate-slot { display: block; aspect-ratio: 1; } /* the 3D planet eases between sizes itself (gate.js) */
.gate-pick[data-pick="lite"] .gate-slot { width: clamp(110px, 11vw, 170px); }
.gate-pick[data-pick="full"] .gate-slot { width: clamp(170px, 17vw, 260px); }
.gate-label { margin-top: var(--space-sm); font: 600 var(--text-lg)/1.2 var(--font-display); }
.gate-sub { color: var(--color-ink-2); font-size: var(--text-sm); }

/* after a pick (or a remembered choice): only that planet, larger, with the readout under it */
.gate[data-picked] .gate-title, .gate[data-picked] .gate-note { opacity: 0; transition: opacity var(--dur-long) var(--ease-out); }
.gate[data-picked] .gate-pick:not(.is-picked) { opacity: 0; pointer-events: none; transition: opacity 250ms var(--ease-out); }
.gate.is-settled .gate-pick.is-gone { display: none; }
.gate[data-picked] .gate-pick.is-picked { cursor: default; }
.gate.is-settled .gate-pick.is-picked .gate-slot { width: clamp(220px, 24vw, 340px); }
.gate[data-picked] .gate-pick .gate-label, .gate[data-picked] .gate-pick .gate-sub { opacity: 0; transition: opacity 250ms var(--ease-out); }
.gate.is-settled .gate-pick .gate-label, .gate.is-settled .gate-pick .gate-sub { display: none; }

.gate-readout { display: grid; justify-items: center; gap: 2px; margin-top: var(--space-md); outline: none; font-variant-numeric: tabular-nums; }
.gate-readout[hidden] { display: none; }
.gate-pct { font: 600 var(--text-2xl)/1 var(--font-display); letter-spacing: -0.02em; }
.gate-msg { margin: var(--space-sm) 0 0; color: var(--color-ink-2); font-size: var(--text-sm); }

.gate-hold {
  justify-self: end; display: grid; place-items: center; width: 36px; height: 36px; border: 1px solid var(--glass-rim); border-radius: 50%;
  background: var(--glass-btn); color: var(--color-ink); cursor: pointer;
}
.gate-hold:hover { background: var(--glass-btn-hover); }
.gate-hold:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 3px; }
.gate-hold .i-play, .gate-hold[aria-pressed="true"] .i-pause { display: none; }
.gate-hold[aria-pressed="true"] .i-play { display: block; }

/* the hand-over: everything fades, then the gate is removed */
.gate.is-leaving .gate-bg, .gate.is-leaving .gate-ui { opacity: 0; transition: opacity 600ms var(--ease-out); }

@media (prefers-reduced-motion: reduce) {
  .gate-pick, .gate-slot, .gate[data-picked] .gate-title, .gate[data-picked] .gate-note, .gate.is-leaving .gate-bg, .gate.is-leaving .gate-ui { transition: none; }
}

/* The menu switch between Lite and Full 3D (both carry journey-on; phones and calm screens never see it) */
.mode-switch { display: none; }
.journey-on .mode-switch { display: inline-flex; gap: 2px; padding: 3px; border: 1px solid var(--glass-rim); border-radius: var(--radius-pill); background: var(--glass-btn); }
.mode-switch button { padding: 4px 10px; border: 0; border-radius: var(--radius-pill); background: none; color: var(--color-ink-2); font: 500 var(--text-xs)/1.2 var(--font-body); cursor: pointer; }
.mode-switch button:hover { color: var(--color-ink); }
.mode-switch button[aria-pressed="true"] { background: var(--color-ink); color: var(--color-paper); cursor: default; }
.mode-switch button:focus-visible { outline: 2px solid var(--color-ink); outline-offset: 2px; }
