/* ====================================================================
   lowest.dev — observation deck stylesheet
   Single-frame, scrollless, full-viewport HUD over animated abyss.
   ==================================================================== */

:root {
  /* Abyss strata */
  --abyss-0: #05060F;
  --abyss-1: #0B0E22;
  --abyss-2: #141A3C;

  /* Mist + chrome */
  --mist: #E8ECFF;
  --chrome-line: rgba(232, 236, 255, 0.22);
  --chrome-line-strong: rgba(232, 236, 255, 0.45);

  /* Dopamine neon palette (5 hues) */
  --neon-cyan:    #5BF4FF;
  --neon-magenta: #FF4DD2;
  --neon-lime:    #C6FF4E;
  --neon-violet:  #8A5BFF;
  --neon-coral:   #FF7A59;

  /* Translucent gel fills */
  --gel-cyan:    rgba(91, 244, 255, 0.18);
  --gel-magenta: rgba(255, 77, 210, 0.16);
  --gel-violet:  rgba(138, 91, 255, 0.18);
  --gel-lime:    rgba(198, 255, 78, 0.14);
  --gel-coral:   rgba(255, 122, 89, 0.16);

  /* Live dominant aurora hues — script.js updates these */
  --hue-a: var(--neon-cyan);
  --hue-b: var(--neon-magenta);
  --hue-recessive: var(--neon-violet);

  /* Reticle hue tracks dominant aurora */
  --reticle-hue: var(--neon-cyan);

  /* Layout */
  --frame-pad: clamp(0.85rem, 1.6vw, 1.5rem);
  --tick-font-size: 10px;
  --hud-font-size: 11px;
  --hud-letter-spacing: 0.18em;

  /* Wordmark scale — clamp 12rem -> 28rem */
  --word-size: clamp(7rem, 28vw, 28rem);
}

/* ----- reset / base ----- */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

html,
body {
  width: 100svw;
  height: 100svh;
  overflow: hidden;
  background: var(--abyss-0);
  color: var(--mist);
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  font-weight: 350;
  line-height: 1.6;
  cursor: none;
  -webkit-font-smoothing: antialiased;
  text-rendering: geometricPrecision;
  letter-spacing: 0.005em;
}

a {
  color: inherit;
  text-decoration: none;
  cursor: none;
}

ul {
  list-style: none;
}

/* ----- main probe container ----- */
.probe {
  position: fixed;
  inset: 0;
  width: 100svw;
  height: 100svh;
  overflow: hidden;
  isolation: isolate;
  background: radial-gradient(
      ellipse 120% 80% at 50% 110%,
      rgba(20, 26, 60, 0.55) 0%,
      rgba(11, 14, 34, 0.0) 55%
    ),
    radial-gradient(
      ellipse 100% 70% at 50% -10%,
      rgba(91, 244, 255, 0.05) 0%,
      rgba(5, 6, 15, 0.0) 60%
    ),
    linear-gradient(180deg, #0B0E22 0%, #07091B 40%, #05060F 100%);
}

/* Five planes stack on top of each other */
.plane {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.plane--abyss   { z-index: 0; }
.plane--aurora  { z-index: 1; }
.plane--blobs   { z-index: 2; }
.plane--chrome  { z-index: 3; pointer-events: none; }
.plane--word    { z-index: 4; pointer-events: none; }

/* Camera transform applied during stratum descent — JS sets these */
.plane--aurora,
.plane--blobs {
  transform-origin: 50% 60%;
  transition: transform 2.6s cubic-bezier(0.22, 0.61, 0.36, 1),
              filter 2.6s cubic-bezier(0.22, 0.61, 0.36, 1),
              opacity 2.6s cubic-bezier(0.22, 0.61, 0.36, 1);
  will-change: transform, filter, opacity;
}

.probe[data-descending="1"] .plane--aurora,
.probe[data-descending="1"] .plane--blobs {
  transform: scale(1.32);
  filter: blur(12px) saturate(1.25);
  opacity: 0.35;
}

/* ====================================================================
   Plane 0 — Abyss field
   ==================================================================== */

.abyss-noise {
  position: absolute;
  inset: -10%;
  background-image:
    radial-gradient(1px 1px at 20% 30%, rgba(232, 236, 255, 0.06) 50%, transparent 51%),
    radial-gradient(1px 1px at 70% 80%, rgba(232, 236, 255, 0.05) 50%, transparent 51%),
    radial-gradient(1px 1px at 40% 60%, rgba(232, 236, 255, 0.04) 50%, transparent 51%),
    radial-gradient(1px 1px at 85% 25%, rgba(232, 236, 255, 0.05) 50%, transparent 51%),
    radial-gradient(1px 1px at 12% 78%, rgba(232, 236, 255, 0.05) 50%, transparent 51%),
    radial-gradient(1.5px 1.5px at 55% 45%, rgba(232, 236, 255, 0.04) 50%, transparent 51%),
    radial-gradient(1px 1px at 32% 12%, rgba(232, 236, 255, 0.04) 50%, transparent 51%),
    radial-gradient(1px 1px at 78% 68%, rgba(232, 236, 255, 0.06) 50%, transparent 51%);
  background-size: 240px 240px, 320px 320px, 180px 180px, 280px 280px, 200px 200px, 360px 360px, 220px 220px, 300px 300px;
  background-position: 0 0, 50px 80px, 120px 30px, 200px 160px, 60px 200px, 180px 100px, 90px 140px, 30px 220px;
  opacity: 0.55;
  animation: abyssDrift 80s linear infinite;
  mix-blend-mode: screen;
}

@keyframes abyssDrift {
  0%   { transform: translate3d(0, 0, 0); }
  100% { transform: translate3d(-120px, -60px, 0); }
}

.abyss-haze {
  position: absolute;
  inset: 0;
  background: radial-gradient(
      ellipse 65% 45% at 50% 70%,
      rgba(91, 244, 255, 0.07) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 55% 35% at 30% 45%,
      rgba(138, 91, 255, 0.06) 0%,
      transparent 70%
    ),
    radial-gradient(
      ellipse 50% 30% at 75% 30%,
      rgba(255, 77, 210, 0.05) 0%,
      transparent 70%
    );
  animation: hazeBreathe 22s ease-in-out infinite alternate;
  mix-blend-mode: screen;
}

@keyframes hazeBreathe {
  0%   { opacity: 0.7; transform: translateY(0); }
  100% { opacity: 1.0; transform: translateY(-12px); }
}

/* ====================================================================
   Plane 1 — Aurora ribbons
   ==================================================================== */

.aurora-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  mix-blend-mode: screen;
  opacity: 0.92;
}

/* Hue-rotate cycle on the entire group — 80s slow drift */
#aurora-group {
  animation: auroraHueDrift 80s linear infinite;
  transform-origin: 50% 50%;
}

@keyframes auroraHueDrift {
  0%   { filter: url(#aurora-blur) hue-rotate(0deg); }
  100% { filter: url(#aurora-blur) hue-rotate(360deg); }
}

.aurora-ribbon {
  mix-blend-mode: screen;
}

.aurora-filament {
  fill: none;
  stroke-width: 1;
  opacity: 0;
  mix-blend-mode: screen;
}

/* ====================================================================
   Plane 2 — Organic blobs
   ==================================================================== */

.blob-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  pointer-events: auto;
  mix-blend-mode: screen;
}

.blob {
  pointer-events: auto;
  cursor: none;
}

.blob-stroke {
  fill: none;
  stroke-width: 0.7;
  pointer-events: none;
}

.blob-datum {
  font-family: 'JetBrains Mono', monospace;
  font-size: 9px;
  letter-spacing: 0.18em;
  fill: var(--mist);
  font-feature-settings: "tnum", "zero";
  pointer-events: none;
  text-transform: uppercase;
}

.blob-datum--hot {
  fill: var(--neon-lime);
}

.blob-narratives {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.blob-narrative {
  position: absolute;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 250;
  font-size: clamp(11px, 0.95vw, 15px);
  line-height: 1.55;
  color: var(--mist);
  letter-spacing: 0.005em;
  max-width: 18ch;
  opacity: 0;
  transform: translateY(4px);
  transition: opacity 600ms ease, transform 600ms ease;
  text-shadow: 0 0 18px rgba(91, 244, 255, 0.35);
  font-variation-settings: "wght" 250, "opsz" 14, "SOFT" 50;
  pointer-events: none;
}

.blob-narrative.is-visible {
  opacity: 0.92;
  transform: translateY(0);
}

/* ====================================================================
   Plane 3 — HUD chrome
   ==================================================================== */

.plane--chrome {
  font-family: 'JetBrains Mono', monospace;
  font-size: var(--hud-font-size);
  letter-spacing: var(--hud-letter-spacing);
  text-transform: uppercase;
  color: var(--mist);
  font-feature-settings: "tnum", "zero";
}

/* --- Corner brackets (4 small L-shapes) --- */
.bracket {
  position: absolute;
  width: 28px;
  height: 28px;
  border-color: var(--chrome-line-strong);
  border-style: solid;
  border-width: 0;
}

.bracket--tl { top: var(--frame-pad); left: var(--frame-pad); border-top-width: 1px; border-left-width: 1px; }
.bracket--tr { top: var(--frame-pad); right: var(--frame-pad); border-top-width: 1px; border-right-width: 1px; }
.bracket--bl { bottom: var(--frame-pad); left: var(--frame-pad); border-bottom-width: 1px; border-left-width: 1px; }
.bracket--br { bottom: var(--frame-pad); right: var(--frame-pad); border-bottom-width: 1px; border-right-width: 1px; }

/* --- Edge tick rulers --- */
.tick-rail {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: clamp(20px, 4.2vh, 46px);
  font-size: var(--tick-font-size);
  letter-spacing: 0.18em;
}

.tick-rail--left {
  left: var(--frame-pad);
  align-items: flex-start;
}

.tick-rail--right {
  right: var(--frame-pad);
  align-items: flex-end;
}

.tick-rail li {
  display: flex;
  align-items: center;
  gap: 8px;
  color: rgba(232, 236, 255, 0.5);
}

.tick-rail--right li {
  flex-direction: row-reverse;
}

.tick-mark {
  display: inline-block;
  width: 14px;
  height: 1px;
  background: var(--chrome-line);
}

.tick-mark--strong {
  width: 22px;
  background: var(--neon-cyan);
  box-shadow: 0 0 8px rgba(91, 244, 255, 0.6);
}

.tick-label {
  font-family: 'JetBrains Mono', monospace;
  opacity: 0.7;
}

/* --- HUD text blocks --- */
.hud {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 0.6em;
  white-space: nowrap;
  color: var(--mist);
  opacity: 0.78;
}

.hud-label {
  color: rgba(232, 236, 255, 0.55);
  font-weight: 500;
}

.hud-value {
  color: var(--mist);
  font-feature-settings: "tnum", "zero";
}

.hud-unit {
  color: rgba(232, 236, 255, 0.4);
  font-weight: 300;
}

.hud-ornament {
  color: var(--neon-cyan);
  opacity: 0.7;
  letter-spacing: 0;
}

.hud--top {
  top: calc(var(--frame-pad) + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10.5px;
}

.hud--depth {
  top: calc(var(--frame-pad) + 38px);
  left: calc(var(--frame-pad) + 42px);
  font-size: 10.5px;
}

.hud--freq {
  top: calc(var(--frame-pad) + 38px);
  right: calc(var(--frame-pad) + 42px);
  font-size: 10.5px;
}

.hud--coord {
  bottom: calc(var(--frame-pad) + 38px);
  left: calc(var(--frame-pad) + 42px);
  font-size: 10.5px;
}

.hud--time {
  bottom: calc(var(--frame-pad) + 38px);
  right: calc(var(--frame-pad) + 42px);
  font-size: 10.5px;
}

.hud--bottom {
  bottom: calc(var(--frame-pad) + 6px);
  left: 50%;
  transform: translateX(-50%);
  font-size: 10px;
  letter-spacing: 0.22em;
  color: rgba(232, 236, 255, 0.6);
}

#tagline {
  display: inline-block;
  padding: 2px 12px;
  border-left: 1px solid var(--chrome-line);
  border-right: 1px solid var(--chrome-line);
}

/* --- Affordances ("ENTER STRATUM" / "ASCEND") --- */
.affordance {
  position: absolute;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Fraunces', serif;
  font-style: italic;
  font-weight: 200;
  font-size: clamp(0.78rem, 0.95vw, 0.95rem);
  letter-spacing: 0.05em;
  text-transform: lowercase;
  color: rgba(232, 236, 255, 0.78);
  pointer-events: auto;
  cursor: none;
  font-variation-settings: "wght" 250, "opsz" 14, "SOFT" 60;
  transition: color 0.6s ease, font-variation-settings 0.6s ease;
}

.affordance em {
  position: relative;
  display: inline-block;
  padding-bottom: 2px;
}

.affordance em::after {
  content: "";
  position: absolute;
  left: 0;
  bottom: 0;
  width: 0;
  height: 1px;
  background: currentColor;
  transition: width 0.7s cubic-bezier(0.22, 0.61, 0.36, 1);
}

.affordance:hover {
  color: var(--neon-cyan);
  font-variation-settings: "wght" 320, "opsz" 14, "SOFT" 100;
}

.affordance:hover em::after {
  width: 100%;
}

.affordance--enter {
  bottom: calc(var(--frame-pad) - 4px);
  left: calc(var(--frame-pad) + 8px);
}

.affordance--ascend {
  top: calc(var(--frame-pad) - 4px);
  right: calc(var(--frame-pad) + 8px);
}

/* --- Cursor reticle --- */
.reticle {
  position: fixed;
  top: 0;
  left: 0;
  width: 14px;
  height: 14px;
  pointer-events: none;
  z-index: 9999;
  transform: translate3d(-50%, -50%, 0);
  mix-blend-mode: screen;
  will-change: transform, width, height;
}

.reticle-ring {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 1px solid var(--reticle-hue);
  opacity: 0.85;
  transition: border-color 0.4s ease, box-shadow 0.4s ease;
}

.reticle-dot {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 2px;
  height: 2px;
  background: var(--reticle-hue);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  box-shadow: 0 0 8px var(--reticle-hue);
  transition: background 0.4s ease, box-shadow 0.4s ease;
}

.reticle.is-haloed {
  width: 42px;
  height: 42px;
}

.reticle.is-haloed .reticle-ring {
  box-shadow: 0 0 22px var(--reticle-hue);
  opacity: 0.6;
}

/* ====================================================================
   Plane 4 — Living wordmark
   ==================================================================== */

.plane--word {
  display: flex;
  align-items: center;
  justify-content: center;
}

.wordmark {
  font-family: 'Fraunces', 'Times New Roman', serif;
  font-weight: 400;
  font-size: var(--word-size);
  line-height: 0.78;
  text-transform: lowercase;
  color: var(--mist);
  letter-spacing: -0.04em;
  display: inline-flex;
  user-select: none;
  white-space: nowrap;
  text-shadow:
    0 0 60px rgba(91, 244, 255, 0.15),
    0 0 120px rgba(138, 91, 255, 0.10);
  mix-blend-mode: screen;
  font-variation-settings: "wght" 400, "opsz" 144, "SOFT" 50;
}

.glyph {
  display: inline-block;
  font-variation-settings: "wght" 400, "opsz" 144, "SOFT" 50;
  will-change: font-variation-settings;
  transform-origin: 50% 60%;
}

/* The dot of the lowercase 'i' is replaced by a small live blob.
   Our wordmark "lowest" doesn't contain an i — but should the
   composition ever change, the rule is here. The 'o' instead gets
   a subtle highlight pulse to act as the "live element". */
.glyph[data-i="1"] {
  color: var(--mist);
  text-shadow:
    0 0 50px rgba(91, 244, 255, 0.45),
    0 0 100px rgba(91, 244, 255, 0.18);
}

/* Ascend descend stratum colour-shift */
.probe[data-stratum="0"] { /* default */ }
.probe[data-stratum="1"] .wordmark { letter-spacing: -0.038em; }
.probe[data-stratum="2"] .wordmark { letter-spacing: -0.036em; }

/* ====================================================================
   Responsive — tighten chrome inward, shrink blob field, never wrap.
   ==================================================================== */

@media (max-width: 900px) {
  :root {
    --frame-pad: clamp(0.6rem, 2.4vw, 1.2rem);
    --word-size: clamp(5rem, 30vw, 14rem);
    --tick-font-size: 9px;
    --hud-font-size: 10px;
  }

  .tick-rail {
    gap: clamp(14px, 3.4vh, 28px);
  }

  .hud--depth { left: calc(var(--frame-pad) + 30px); top: calc(var(--frame-pad) + 30px); }
  .hud--freq  { right: calc(var(--frame-pad) + 30px); top: calc(var(--frame-pad) + 30px); }
  .hud--coord { left: calc(var(--frame-pad) + 30px); bottom: calc(var(--frame-pad) + 30px); }
  .hud--time  { right: calc(var(--frame-pad) + 30px); bottom: calc(var(--frame-pad) + 30px); }

  .blob-narrative { font-size: 11px; max-width: 14ch; }
}

@media (max-width: 600px) {
  :root {
    --word-size: clamp(4.5rem, 32vw, 9rem);
  }

  .tick-rail--left,
  .tick-rail--right {
    gap: 14px;
  }

  .tick-rail li {
    font-size: 8.5px;
  }

  .hud--top,
  .hud--bottom {
    font-size: 9px;
    letter-spacing: 0.16em;
  }

  .hud--top .hud-text { display: inline; }
}

@media (min-width: 1600px) {
  :root {
    --word-size: clamp(14rem, 22vw, 28rem);
    --frame-pad: clamp(1.4rem, 1.5vw, 2rem);
  }
}

/* Print / fallback — never used in viewport but defined. */
@media print {
  .reticle, .plane--aurora, .plane--blobs { display: none; }
}
