/* ============================================================
   Deep Dive — Studio · production stylesheet
   Sections: reset, base, canvas, loading, top-bar, ruler,
   diver + bubbles, discoveries (project cards), footer/final,
   responsive, reduced-motion, accessibility, no-canvas fallback.
   ============================================================ */

/* ── Reset & base ── */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { background: #050a1a; }

html, body {
  width: 100%;
  min-height: 100vh;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  color: #fff;
  overflow-x: hidden;
  background: #050a1a;
}

a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: none; cursor: pointer; }
ul { list-style: none; }
img { max-width: 100%; display: block; }

/* Cursor stays native everywhere by default; only the eligible desktop
   diver state hides it, and only while not navigating by keyboard. */
body.diver-active { cursor: none; }
body.diver-active a,
body.diver-active button { cursor: none; }

/* Visible focus ring, restored whenever keyboard navigation is in use
   (and always available to assistive tech regardless of mouse state). */
a:focus-visible,
button:focus-visible {
  outline: 2px solid rgba(150, 220, 255, 0.9);
  outline-offset: 3px;
  border-radius: 4px;
}
body.kbd-nav a:focus,
body.kbd-nav button:focus {
  outline: 2px solid rgba(150, 220, 255, 0.9);
  outline-offset: 3px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: fixed;
  top: -60px; left: 12px;
  z-index: 999;
  background: #0a1a2e;
  color: #fff;
  padding: 10px 16px;
  border-radius: 8px;
  transition: top 0.2s ease;
}
.skip-link:focus { top: 12px; }

/* ── Canvas layer ── */
#ocean-canvas {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}
body.no-canvas #ocean-canvas { display: none; }
body.no-canvas {
  background: linear-gradient(180deg, #0e3a52 0%, #061726 45%, #020a12 100%);
}

/* Scroll spacer creates the 0–8,200 m scrollable range that drives depth. */
#scroll-spacer {
  height: 820vh;
  width: 1px;
  opacity: 0;
  pointer-events: none;
  position: relative;
  z-index: -1;
}

/* ── UI overlay shell ── */
#ui-overlay {
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
}
#ui-overlay > * { pointer-events: auto; }

/* ── Top bar ── */
#top-bar {
  position: absolute;
  top: 28px; left: 0; width: 100%;
  padding: 0 40px;
  display: flex;
  justify-content: flex-end;
  align-items: center;
  font-weight: 500;
  font-size: 14px;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.75);
  pointer-events: none;
}
.depth-display {
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  padding: 6px 16px;
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.07);
}
.depth-display .zone-tag {
  font-weight: 300;
  opacity: 0.55;
  font-size: 12px;
  margin-left: 8px;
  letter-spacing: 0.05em;
}

/* ── Hero / surface identity ── */
#hero {
  position: absolute;
  left: 6%;
  top: 46%;
  max-width: 480px;
  transform: translateY(-50%);
  transition: opacity 0.4s ease;
  pointer-events: none;
}
#hero h1 {
  font-size: clamp(26px, 3.4vw, 40px);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}
#hero p {
  font-size: 16px;
  font-weight: 300;
  color: rgba(255, 255, 255, 0.6);
  line-height: 1.5;
}

/* ── Scroll hint ── */
#scroll-hint {
  position: absolute;
  bottom: 46px; left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
  background: rgba(0, 0, 0, 0.16);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 10px 24px;
  border-radius: 60px;
  border: 1px solid rgba(255, 255, 255, 0.05);
  animation: pulse-hint 3s ease-in-out infinite;
  transition: opacity 0.8s ease, transform 0.8s ease;
}
#scroll-hint.hidden { opacity: 0; transform: translateX(-50%) translateY(10px); pointer-events: none; }
@keyframes pulse-hint {
  0%, 100% { opacity: 0.4; transform: translateX(-50%) scale(1); }
  50% { opacity: 0.75; transform: translateX(-50%) scale(1.02); }
}

/* ── Center zone label ── */
#zone-label {
  position: absolute;
  bottom: 110px; left: 50%;
  transform: translateX(-50%);
  font-size: 13px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.16);
  background: rgba(0, 0, 0, 0.08);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  padding: 8px 24px;
  border-radius: 40px;
  border: 1px solid rgba(255, 255, 255, 0.03);
  transition: opacity 1s ease, transform 1s ease;
}
#zone-label.hidden { opacity: 0; transform: translateX(-50%) translateY(10px); }

/* ── Depth ruler (right) ── */
#depth-ruler {
  position: absolute;
  right: 30px; top: 50%;
  transform: translateY(-50%);
  height: 62vh;
  min-height: 320px;
  max-height: 680px;
  width: 120px;
  display: flex;
  align-items: center;
  justify-content: flex-end;
}
#depth-zone-bands {
  position: absolute;
  left: -1px;
  width: 4px;
  height: 100%;
  border-radius: 4px;
  overflow: hidden;
}
.ruler-zone-band { position: absolute; left: 0; width: 100%; }

#depth-track {
  position: relative;
  width: 2px;
  height: 100%;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
  flex-shrink: 0;
  margin-right: 14px;
}
#depth-fill {
  position: absolute;
  bottom: 0; left: 50%;
  transform: translateX(-50%);
  width: 2px;
  background: rgba(200, 235, 255, 0.5);
  border-radius: 4px;
}
#depth-markers { position: absolute; inset: 0; }
.ruler-marker {
  position: absolute;
  right: 12px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  gap: 7px;
  white-space: nowrap;
}
.ruler-label {
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.3);
  transition: color 0.4s ease;
}
.ruler-marker.active .ruler-label { color: rgba(210, 235, 255, 0.9); font-weight: 500; }
.ruler-dot {
  width: 4px; height: 4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  transition: background 0.4s ease, transform 0.4s ease;
  display: inline-block;
}
.ruler-marker.active .ruler-dot { background: #fff; transform: scale(1.6); }

#current-depth-marker {
  position: absolute;
  right: -6px;
  width: 22px; height: 22px;
  transform: translateY(-50%);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  border: 1.5px solid rgba(200, 235, 255, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  transition: border-color 0.4s ease, background 0.4s ease;
}
#current-depth-marker .inner {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #fff;
}
#current-depth-marker.active { border-color: #fff; box-shadow: 0 0 12px rgba(180, 225, 255, 0.5); }
#current-depth-readout {
  position: absolute;
  right: 32px;
  top: 50%;
  transform: translateY(-50%);
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #051018;
  background: rgba(210, 235, 255, 0.92);
  padding: 3px 8px;
  border-radius: 3px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.3s ease;
}
#current-depth-marker.active #current-depth-readout { opacity: 1; }

/* ── Diver — a persistent scene subject, visible at every depth and on
   every device; only the follow-behavior (mouse vs. idle path) differs. ── */
#diver-cursor {
  position: fixed;
  top: 0; left: 0;
  pointer-events: none;
  /* Below #discoveries (8) and #ui-overlay (10): if the diver (cursor
     mode) or its light ever crosses a card or UI chrome, readability of
     that content always wins — the diver dims behind the card's glass
     rather than washing out or obscuring the text on top of it. */
  z-index: 6;
  width: 212px; height: 112px;
  opacity: 0;
  display: block;
  will-change: transform;
  transition: opacity 0.6s ease;
}
#diver-cursor.visible { opacity: 1; }
#diver-cursor svg {
  width: 100%; height: 100%;
  filter: drop-shadow(0 6px 22px rgba(0,0,0,0.5)) drop-shadow(0 0 6px rgba(140,210,255,0.18));
}
/* Close-in housing glow only — the actual beam that reaches into the
   scene and reveals nearby fish/terrain is drawn on the canvas itself
   (see drawDiverBeam in main.js), since a DOM layer can only sit on top
   of things, never brighten what's already beneath it. */
.diver-light {
  position: absolute;
  top: 50%; left: 88%;
  width: 90px; height: 56px;
  transform: translateY(-50%);
  background: radial-gradient(ellipse at 0% 50%, rgba(200,235,255,0.5) 0%, rgba(160,220,255,0.16) 40%, rgba(150,215,255,0) 75%);
  filter: blur(2px);
  opacity: 0;
  pointer-events: none;
}
.diver-bubbles-host {
  position: absolute;
  top: 8%; left: 82%;
  width: 55px; height: 66px;
  overflow: visible;
}
@media (hover: none), (pointer: coarse) {
  #diver-cursor { width: 118px; height: 62px; }
}
@media (hover: none), (pointer: coarse), (max-width: 480px) {
  #diver-cursor { width: 96px; height: 50px; }
}
.diver-bubble {
  position: absolute;
  bottom: 0;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 30%, rgba(255,255,255,0.22), rgba(255,255,255,0.02));
  border: 0.5px solid rgba(255,255,255,0.05);
  animation: bubble-rise linear forwards;
}
@keyframes bubble-rise {
  0% { transform: translateY(0) translateX(0) scale(1); opacity: 0.6; }
  100% { transform: translateY(-90px) translateX(14px) scale(0.5); opacity: 0; }
}

/* ── Discoveries (project cards) ── */
#discoveries { position: fixed; inset: 0; z-index: 8; pointer-events: none; }

.project-card {
  position: absolute;
  top: 50%; left: 50%;
  width: 90%; max-width: 460px;
  padding: 28px 30px 30px;
  border-radius: 4px;
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, -50%) translateY(16px) scale(0.94);
  transition: opacity 0.15s linear;
  will-change: transform, opacity, left, top;
  background: rgba(5, 12, 22, 0.5);
  backdrop-filter: blur(11px);
  -webkit-backdrop-filter: blur(11px);
  border: 1px solid rgba(160, 215, 255, 0.14);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}
.project-card.visible { pointer-events: auto; }

/* corner-bracket HUD accents, instrument-panel feel over generic glass */
.project-card::before,
.project-card::after {
  content: '';
  position: absolute;
  width: 14px; height: 14px;
  border: 1px solid rgba(160, 215, 255, 0.4);
  pointer-events: none;
}
.project-card::before { top: -1px; left: -1px; border-right: none; border-bottom: none; }
.project-card::after { bottom: -1px; right: -1px; border-left: none; border-top: none; }

.project-glyph {
  position: absolute;
  top: 26px; right: 26px;
  width: 22px; height: 22px;
  color: rgba(160, 215, 255, 0.4);
  fill: currentColor;
}
.project-card .depth-badge {
  position: absolute;
  top: -11px; left: 22px;
  font-family: ui-monospace, 'SF Mono', 'JetBrains Mono', Menlo, Consolas, monospace;
  font-size: 11px;
  letter-spacing: 0.03em;
  color: rgba(180, 225, 255, 0.85);
  background: #050e18;
  padding: 3px 10px;
  border-radius: 3px;
  border: 1px solid rgba(160, 215, 255, 0.3);
}
.project-card .tag {
  display: block;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.32);
  margin: 14px 0 12px;
}
.project-card h2 {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin-bottom: 8px;
}
.project-card .sub {
  font-size: 15px;
  color: rgba(255, 255, 255, 0.45);
  margin-bottom: 14px;
}
.project-card .description {
  font-size: 15px;
  font-weight: 300;
  line-height: 1.6;
  color: rgba(255, 255, 255, 0.55);
  max-width: 440px;
}
.project-tech {
  display: flex; flex-wrap: wrap; gap: 8px;
  margin-top: 16px;
}
.project-tech li {
  font-size: 11px;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.45);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 20px;
  padding: 4px 12px;
}
.project-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin-top: 20px;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #051018;
  background: rgba(210, 235, 255, 0.92);
  padding: 9px 18px;
  border-radius: 30px;
  transition: background 0.25s ease, transform 0.2s ease;
}
.project-link:hover { background: #fff; transform: translateY(-1px); }

/* Final discovery variant */
.project-card--final { text-align: center; }
.project-card--final h2 { font-size: 34px; }
.final-actions { margin-top: 22px; }
.social-links { display: flex; justify-content: center; gap: 14px; margin-bottom: 18px; }
.social-link {
  font-size: 13px;
  color: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 30px;
  padding: 8px 18px;
  transition: color 0.25s ease, border-color 0.25s ease, background 0.25s ease;
}
.social-link:hover { color: #fff; border-color: rgba(150, 220, 255, 0.5); background: rgba(150, 220, 255, 0.06); }
.return-surface {
  font-size: 13px;
  letter-spacing: 0.03em;
  color: rgba(255, 255, 255, 0.55);
  padding: 6px 4px;
  border-bottom: 1px solid transparent;
  transition: color 0.25s ease, border-color 0.25s ease;
}
.return-surface:hover { color: #fff; border-color: rgba(255, 255, 255, 0.3); }

/* ── noscript fallback ── */
noscript .noscript-panel {
  position: relative;
  z-index: 20;
  display: block;
  max-width: 640px;
  margin: 10vh auto;
  padding: 32px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
}
noscript .noscript-panel h1 { font-size: 24px; margin-bottom: 10px; }
noscript .noscript-panel ul { margin-top: 16px; display: grid; gap: 10px; }
noscript .noscript-panel a { text-decoration: underline; }

/* ── Responsive ── */
@media (max-width: 900px) {
  #hero { left: 24px; max-width: 78%; }
}

@media (max-width: 768px) {
  #top-bar { padding: 0 20px; top: 18px; }
  .depth-display { font-size: 13px; padding: 5px 12px; }
  .depth-display .zone-tag { display: none; }

  #depth-ruler { right: 10px; height: 48vh; min-height: 220px; width: 70px; }
  .ruler-label { font-size: 8px; }
  #current-depth-marker { width: 20px; height: 20px; }

  .project-card { padding: 26px 22px 30px; max-width: 94%; border-radius: 18px; }
  .project-card h2 { font-size: 21px; }
  .project-card .sub, .project-card .description { font-size: 13.5px; }
  .project-glyph { top: 22px; right: 22px; width: 20px; height: 20px; }

  #scroll-hint { font-size: 11px; padding: 8px 18px; bottom: 26px; }
  #zone-label { font-size: 11px; padding: 6px 16px; bottom: 78px; }
}

@media (max-width: 480px) {
  #hero h1 { font-size: 22px; }
  #hero p { font-size: 13px; }
  .project-card h2 { font-size: 19px; }
  #depth-ruler { width: 56px; }
  .ruler-label { font-size: 7px; }
}

/* ── Reduced motion ── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  #scroll-hint { animation: none; }
  .diver-bubble { display: none; }
}

/* ── Loading ── */
#loading {
  position: fixed; inset: 0;
  z-index: 999;
  background: #050a1a;
  display: flex; align-items: center; justify-content: center;
  color: rgba(255, 255, 255, 0.3);
  font-size: 13px;
  letter-spacing: 0.14em;
  transition: opacity 1s ease;
}
#loading.fade { opacity: 0; pointer-events: none; }
