/* Tokens, column, fixed stages, water, rays, gauge, type, buttons */
:root {
  --shallow: #8FE3F0; --lagoon: #2BA8D8; --abyss: #0B2A5B; --trench: #050B24;
  --petal: #FFF8EC; --sun: #FFC94A; --jelly: #FF9FD2;
  --d: 0; --wt: #BFF0FF; --wb: #46BDE3; --wl: 0px;
  --col: min(100vw, 440px);
}
* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { background: var(--trench); }
body {
  font-family: "Quicksand", system-ui, sans-serif; color: var(--petal);
  overflow-x: hidden; -webkit-tap-highlight-color: transparent;
}

/* fixed layers, aligned to the phone-width column */
.stage {
  position: fixed; top: 0; bottom: 0; left: 50%; width: var(--col);
  transform: translateX(-50%); pointer-events: none; overflow: hidden;
}
.stage.back { z-index: 0; }
.stage.front { z-index: 2; }
.water { position: absolute; inset: 0; background: linear-gradient(to bottom, var(--wt), var(--wb)); }

/* light rays: gradients only (no blur filter), masked below the waterline */
.rays {
  position: absolute; left: -25%; right: -25%; top: var(--wl); height: 90%;
  opacity: calc(.95 - var(--d) * 2.6); mix-blend-mode: screen;
  -webkit-mask: linear-gradient(transparent, #000 8%); mask: linear-gradient(transparent, #000 8%);
}
.rays i {
  position: absolute; top: 0; width: var(--w); height: 112%;
  background: linear-gradient(90deg, transparent, rgba(255,248,215,.55) 30%, rgba(255,248,215,.55) 70%, transparent),
              linear-gradient(to bottom, rgba(255,255,255,1), rgba(255,255,255,0) 85%);
  background-blend-mode: multiply;
  -webkit-mask: linear-gradient(to bottom, #000, transparent 85%); mask: linear-gradient(to bottom, #000, transparent 85%);
  opacity: .55; transform-origin: 50% 0; transform: rotate(var(--r));
}

#motes {
  position: absolute; inset: 0; width: 100%; height: 100%;
  -webkit-mask: linear-gradient(transparent var(--wl), #000 calc(var(--wl) + 24px));
  mask: linear-gradient(transparent var(--wl), #000 calc(var(--wl) + 24px));
}
#companions { position: absolute; inset: 0; }

/* depth gauge */
.gauge {
  position: absolute; left: 16px; top: 16vh; bottom: 16vh; width: 2px; border-radius: 2px;
  background: linear-gradient(rgba(255,255,255,.6), rgba(255,255,255,.14));
}
.mark {
  position: absolute; left: 50%; top: 0; width: 10px; height: 10px; margin: -5px 0 0 -5px;
  border-radius: 50%; background: #fff; box-shadow: 0 0 10px rgba(190,240,255,.95);
}
.num {
  position: absolute; left: 14px; top: 50%; transform: translateY(-50%);
  font: 600 .8rem/1 "Quicksand", sans-serif; font-variant-numeric: tabular-nums; white-space: nowrap;
  color: rgba(255,255,255,.92); text-shadow: 0 1px 6px rgba(0,25,60,.75);
}
.gauge.arrived .mark { background: var(--sun); box-shadow: 0 0 16px var(--sun); }
.gauge.arrived .num { color: var(--sun); }

/* scrolling column */
.ocean { position: relative; z-index: 1; width: var(--col); margin: 0 auto; overflow: hidden; }
section { position: relative; }
.surface { height: 100vh; }
.shallow { height: 125vh; }
.mid { height: 125vh; }
.deep { height: 115vh; }
.dark { height: 110vh; }
.finale { height: 100vh; height: 100svh; }

/* opening screen: no scrolling until the first tap */
html.locked, body.locked { overflow: hidden; height: 100%; overscroll-behavior: none; }
body.locked { touch-action: none; }
.surface { cursor: pointer; }

/* the two lines */
.line {
  font-family: "Fraunces", Georgia, serif; font-style: italic; font-weight: 380;
  font-variation-settings: "SOFT" 100, "opsz" 96; letter-spacing: -.01em; line-height: 1.08; text-align: center;
}

/* buttons */
.pill {
  pointer-events: auto; cursor: pointer; font: 600 .95rem "Quicksand", sans-serif; color: #fff;
  background: rgba(255,255,255,.16); border: 1.5px solid rgba(255,255,255,.75); border-radius: 999px;
  padding: .7rem 1.6rem; text-shadow: 0 1px 6px rgba(0,40,80,.45);
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.pill:focus-visible, .icon-btn:focus-visible { outline: 2px solid var(--sun); outline-offset: 3px; }
.icon-btn {
  position: fixed; z-index: 4; top: max(12px, env(safe-area-inset-top)); right: calc(50% - var(--col) / 2 + 12px);
  width: 40px; height: 40px; border-radius: 50%; border: 1px solid rgba(255,255,255,.4);
  background: rgba(5,11,36,.35); color: #fff; display: grid; place-items: center; cursor: pointer;
  -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px);
}
.icon-btn[hidden] { display: none; }
/* ↺ dive again: the screen brightens like surfacing, the page jumps back to the top behind it, then it clears (fade time = VEIL_FADE_MS in main.js) */
.veil {
  position: fixed; inset: 0; z-index: 6; pointer-events: none; opacity: 0; transition: opacity .7s ease;
  background: radial-gradient(120% 80% at 50% 0%, #FFF4D6 0%, #BFF0FF 55%, #7FD3EE 100%);
}
.veil.on { opacity: 1; pointer-events: auto; }
.icon-btn svg { width: 20px; height: 20px; }
.icon-btn .ico-on { display: none; }
.icon-btn[aria-pressed="true"] .ico-on { display: block; }
.icon-btn[aria-pressed="true"] .ico-off { display: none; }

/* debug-only switches for the perf probe (?perf&off=...) */
.off-rays .rays, .off-motes #motes, .off-all .stage.front, .off-all .ocean > section > * { display: none !important; }
.off-ripple .title { filter: none !important; }
.off-idle *, .off-idle *::before { animation: none !important; }
.off-shadow * { filter: none !important; }
.off-scenes .ocean > section:not(#surface) > * { display: none !important; }
.off-tent .tent { animation: none !important; }
.off-sardine .sardine { animation: none !important; }
.off-jelly .jelly, .off-jelly .j-bell, .off-jelly .j-tent { animation: none !important; }
.off-fish .fish { animation: none !important; }
.off-surf .waves, .off-surf .glints i, .off-surf .bubbles i, .off-surf .float-daisy .daisy { animation: none !important; }
.off-tuck .tuck .daisy { animation: none !important; filter: none !important; }
.off-manta .mrow, .off-manta .flap { animation: none !important; }
.off-cruise .cruise > *, .off-cruise .bob-slow, .off-cruise .bob { animation: none !important; }
.off-anem .anemone > * { animation: none !important; }
.debug-static *, .debug-static *::before { transition: none !important; }
.debug-og .gauge, .debug-og .cta { display: none !important; }
