:root {
  --bg-primary: #081222;
  --bg-secondary: #0d1b2e;
  --bg-tertiary: #132a42;
  --text-primary: #c8dce8;
  --text-secondary: #8fa8bc;
  --text-tertiary: #5a7a8f;
  --accent-primary: #2a7ab5;
  --accent-glow: #1e5f8a;
  --border-rule: #1a3a5c;
  --signal: #4dc9f6;
  --bottom: #040a14;
  --mid-teal: #7aafc8;
  --grid-gap: clamp(12px, 2vw, 32px);
  --page-pad: clamp(18px, 4vw, 72px);
}

* { box-sizing: border-box; }

html { scroll-behavior: auto; }

body {
  margin: 0;
  background: var(--bg-primary);
  color: var(--text-secondary);
  font-family: "Inter", sans-serif;
  font-size: clamp(0.95rem, 1.1vw, 1.1rem);
  line-height: 1.72;
  letter-spacing: 0.005em;
  min-height: 100vh;
  overflow-x: hidden;
}

body::after {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 72% 24%, rgba(42, 122, 181, 0.10), transparent 28%), linear-gradient(180deg, rgba(8, 18, 34, 0) 0%, rgba(4, 10, 20, 0.42) 100%);
  z-index: -1;
}

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

.depth-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -2;
  opacity: 0;
  background-image: linear-gradient(rgba(26, 58, 92, 0.15) 1px, transparent 1px), linear-gradient(90deg, rgba(26, 58, 92, 0.15) 1px, transparent 1px);
  background-size: 120px 80px;
  animation: gridFade 800ms ease forwards;
}

.sonar-header {
  position: sticky;
  top: 0;
  z-index: 20;
  height: 8vh;
  min-height: 58px;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: clamp(16px, 2vw, 32px);
  padding: 0 var(--page-pad);
  background: rgba(8, 18, 34, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid rgba(26, 58, 92, 0.55);
  opacity: 0;
  animation: headerFade 400ms ease 160ms forwards;
}

.logotype {
  font-family: "Darker Grotesque", sans-serif;
  font-weight: 800;
  font-size: 18px;
  color: var(--text-primary);
  letter-spacing: 0.01em;
}

.header-rule, .footer-rule {
  height: 1px;
  background: var(--border-rule);
  transform: scaleX(0);
  transform-origin: left;
  animation: ruleDraw 1.2s ease 380ms forwards;
}

.nav-cluster {
  display: flex;
  gap: clamp(12px, 2vw, 28px);
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(0.7rem, 0.85vw, 0.85rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

.nav-cluster a { transition: color 220ms ease, text-shadow 220ms ease; }
.nav-cluster a:hover { color: var(--accent-primary); text-shadow: 0 0 18px rgba(30, 95, 138, 0.45); }

.descent-page { min-height: 200vh; }

.primary-sweep, .secondary-sweep, .vertical-descent {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: var(--grid-gap);
  padding-left: var(--page-pad);
  padding-right: var(--page-pad);
  position: relative;
}

.primary-sweep {
  min-height: 37vh;
  padding-top: clamp(30px, 5vh, 72px);
  align-items: start;
}

.primary-copy { grid-column: 1 / span 8; max-width: 920px; }

.section-label {
  margin: 0 0 18px;
  font-family: "Space Grotesk", sans-serif;
  font-weight: 500;
  font-size: clamp(0.7rem, 0.85vw, 0.85rem);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-tertiary);
}

h1, h2 {
  margin: 0;
  font-family: "Darker Grotesque", sans-serif;
  font-weight: 900;
  letter-spacing: -0.025em;
  line-height: 1.08;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.6rem, 5vw, 4.8rem); }
h2 { font-size: clamp(1.6rem, 3vw, 2.8rem); color: var(--mid-teal); margin-bottom: 18px; }

.matrix-field {
  grid-column: 9 / span 4;
  min-height: 220px;
  position: relative;
  display: flex;
  justify-content: center;
  align-items: center;
  border-left: 1px solid rgba(26, 58, 92, 0.55);
}

.node-matrix {
  position: relative;
  z-index: 2;
  display: grid;
  grid-template-columns: repeat(6, 12px);
  gap: 2px;
  padding: 32px;
  background: rgba(13, 27, 46, 0.42);
  box-shadow: inset 0 0 0 1px rgba(26, 58, 92, 0.35), 0 0 44px rgba(42, 122, 181, 0.08);
}

.node-matrix span {
  width: 12px;
  height: 12px;
  border-radius: 1px;
  background: var(--accent-primary);
  opacity: 0;
  transform: translateY(4px);
  animation: nodeAssemble 500ms ease forwards, nodePulse 4s ease-in-out infinite;
}

.node-matrix span:nth-child(6n+1), .node-matrix span:nth-child(6n+3) { opacity: 0.20; }
.node-matrix span:nth-child(6n+2), .node-matrix span:nth-child(6n+5) { opacity: 0.42; }
.node-matrix span:nth-child(6n+4), .node-matrix span:nth-child(6n+6) { opacity: 0.68; }
.node-matrix span:nth-child(n+1):nth-child(-n+6) { animation-delay: 900ms, 1700ms; }
.node-matrix span:nth-child(n+7):nth-child(-n+12) { animation-delay: 1050ms, 2100ms; }
.node-matrix span:nth-child(n+13):nth-child(-n+18) { animation-delay: 1200ms, 2500ms; }
.node-matrix span:nth-child(n+19):nth-child(-n+24) { animation-delay: 1350ms, 2900ms; }
.node-matrix span:nth-child(n+25):nth-child(-n+30) { animation-delay: 1500ms, 3300ms; }
.node-matrix span:nth-child(n+31):nth-child(-n+36) { animation-delay: 1650ms, 3700ms; }
.node-matrix span:nth-child(5n) { animation-duration: 500ms, 4.4s; }
.node-matrix span:nth-child(11n) { animation-duration: 500ms, 3.6s; }

.pressure-rings { position: absolute; inset: 50% auto auto 50%; transform: translate(-50%, -50%); pointer-events: none; }
.pressure-rings span { position: absolute; inset: 50% auto auto 50%; border: 1px solid var(--border-rule); border-radius: 50%; transform: translate(-50%, -50%); }
.rings-large span:nth-child(1) { width: 160px; height: 160px; opacity: 0.12; }
.rings-large span:nth-child(2) { width: 230px; height: 230px; opacity: 0.08; }
.rings-large span:nth-child(3) { width: 310px; height: 310px; opacity: 0.04; }
.rings-small span:nth-child(1) { width: 24px; height: 24px; opacity: 0.12; }
.rings-small span:nth-child(2) { width: 36px; height: 36px; opacity: 0.08; }
.rings-small span:nth-child(3) { width: 48px; height: 48px; opacity: 0.04; }

.secondary-sweep { min-height: 30vh; align-items: start; padding-top: 4vh; }
.secondary-copy { grid-column: 1 / span 6; max-width: 680px; }
.secondary-copy p, .descent-block p { margin: 0; color: rgba(143, 168, 188, 0.88); }
.ocean-void { grid-column: 7 / span 6; min-height: 28vh; position: relative; }
.sounding-line { position: absolute; left: 38%; top: -9vh; height: 34vh; border-left: 1px solid rgba(26, 58, 92, 0.7); }

.vertical-descent { min-height: 125vh; padding-top: 3vh; padding-bottom: 16vh; }
.descent-void { position: absolute; top: 0; right: var(--page-pad); bottom: 0; width: calc((100% - (2 * var(--page-pad))) * 0.33); border-left: 1px solid rgba(26, 58, 92, 0.35); background-image: linear-gradient(rgba(26, 58, 92, 0.10) 1px, transparent 1px), linear-gradient(90deg, rgba(26, 58, 92, 0.10) 1px, transparent 1px); background-size: 80px 80px; }
.descent-block { grid-column: 1 / span 7; position: relative; padding: 26px 0 34px; min-height: 28vh; }
.descent-block + .connector { margin-top: -2vh; }
.connector { grid-column: 8 / span 1; height: 15vh; border-left: 1px solid rgba(26, 58, 92, 0.74); justify-self: center; }
.label-wrap { position: relative; display: inline-block; }
.label-wrap .pressure-rings { left: -26px; top: 9px; }

.reveal-block { opacity: 0; transform: scale(0.97); transition: opacity 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94), transform 500ms cubic-bezier(0.25, 0.46, 0.45, 0.94); transform-origin: left center; }
.primary-copy.reveal-block { transform: translateY(20px) scale(0.97); transition: opacity 600ms ease-out, transform 600ms ease-out; }
.reveal-block.in-view { opacity: 1; transform: scale(1); }
.primary-copy.reveal-block.in-view { transform: translateY(0) scale(1); }

.sonar-sweep { position: absolute; left: var(--page-pad); right: var(--page-pad); bottom: 0; height: 1px; overflow: hidden; opacity: 0; }
.sonar-sweep::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, var(--signal), transparent); transform: translateX(-105%); }
.section-watch.sweep-active > .sonar-sweep, .descent-block.sweep-active .sonar-sweep { opacity: 1; }
.section-watch.sweep-active > .sonar-sweep::after, .descent-block.sweep-active .sonar-sweep::after { animation: sonarMove 2.5s ease forwards; }

.seafloor-footer { min-height: 20vh; position: relative; display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 24px; padding: 34px var(--page-pad); background: linear-gradient(180deg, var(--bg-primary), var(--bottom)); color: rgba(90, 122, 143, 0.6); font-family: "Space Grotesk", sans-serif; font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; }
.footer-rule { animation-delay: 0ms; }
.footer-content { display: flex; gap: clamp(18px, 3vw, 44px); align-items: center; flex-wrap: wrap; opacity: 0; transition: opacity 700ms ease; }
.seafloor-footer.in-view .footer-content { opacity: 1; }
.footer-content p { margin: 0; }
.footer-content a:hover { color: var(--accent-primary); }
.final-node { width: 12px; height: 12px; border-radius: 1px; background: var(--signal); opacity: 0.26; box-shadow: 0 0 0 rgba(77, 201, 246, 0); }
.seafloor-footer.in-view .final-node { animation: finalPing 1.2s ease 300ms 1 forwards; }

@keyframes gridFade { to { opacity: 1; } }
@keyframes headerFade { to { opacity: 1; } }
@keyframes ruleDraw { to { transform: scaleX(1); } }
@keyframes nodeAssemble { to { opacity: var(--node-opacity, 0.55); transform: translateY(0); } }
@keyframes nodePulse { 0%, 82%, 100% { filter: brightness(1); } 8%, 14% { opacity: 1; filter: brightness(1.7); } }
@keyframes sonarMove { to { transform: translateX(105%); } }
@keyframes finalPing { 0% { opacity: 0.26; box-shadow: 0 0 0 rgba(77, 201, 246, 0); } 45% { opacity: 1; box-shadow: 0 0 26px rgba(77, 201, 246, 0.72); } 100% { opacity: 0.42; box-shadow: 0 0 0 rgba(77, 201, 246, 0); } }

@media (max-width: 780px) {
  .sonar-header { grid-template-columns: auto 1fr; }
  .header-rule { display: none; }
  .nav-cluster { gap: 10px; font-size: 0.62rem; }
  .primary-sweep, .secondary-sweep, .vertical-descent { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .primary-copy, .secondary-copy, .descent-block { grid-column: 1 / -1; }
  .matrix-field { grid-column: 1 / -1; min-height: 190px; justify-content: flex-start; border-left: 0; }
  .ocean-void, .descent-void, .connector { display: none; }
  .seafloor-footer { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .depth-grid, .sonar-header, .reveal-block, .footer-content { opacity: 1 !important; transform: none !important; }
  .header-rule, .footer-rule { transform: scaleX(1) !important; }
  .node-matrix span { opacity: 0.55 !important; transform: none !important; }
}
