:root {
  --abyss: #061826;
  --night: #031016;
  --kelp: #0B3A3F;
  --cyan: #7DF9E8;
  --violet: #B7A6FF;
  --glass: #BFEAD9;
  --leather: #2B211C;
  --gold: #D8B46A;
}

* {
  box-sizing: border-box;
}

html {
  min-height: 100%;
  background: var(--night);
}

body {
  margin: 0;
  min-height: 100%;
  color: rgba(191, 234, 217, 0.88);
  font-family: "IBM Plex Sans", sans-serif;
  background: var(--night);
  overflow-x: hidden;
}

.deep-field {
  position: fixed;
  inset: 0;
  z-index: -5;
  overflow: hidden;
  background: linear-gradient(180deg, #061826 0%, #0B3A3F 55%, #031016 100%);
}

.water-gradient {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(circle at 45% 8%, rgba(125, 249, 232, 0.17), transparent 18%),
    radial-gradient(circle at 78% 44%, rgba(183, 166, 255, 0.07), transparent 27%),
    radial-gradient(circle at 12% 70%, rgba(216, 180, 106, 0.045), transparent 24%);
  filter: blur(8px);
  transform: translate3d(0, var(--water-y, 0px), 0);
  animation: breathe 11s ease-in-out infinite;
}

.caustic {
  position: absolute;
  inset: -18%;
  opacity: 0.16;
  mix-blend-mode: screen;
  background-image:
    repeating-linear-gradient(112deg, transparent 0 48px, rgba(125, 249, 232, 0.22) 50px, transparent 54px),
    repeating-linear-gradient(64deg, transparent 0 76px, rgba(191, 234, 217, 0.12) 80px, transparent 84px);
  filter: blur(1px);
  transform: translate3d(var(--caustic-x, 0px), var(--caustic-y, 0px), 0) rotate(-4deg);
  animation: causticDrift 24s linear infinite;
}

.caustic-two {
  opacity: 0.09;
  transform: translate3d(0, 0, 0) rotate(11deg) scale(1.15);
  animation-duration: 37s;
}

.bathymetry {
  position: absolute;
  width: 620px;
  height: 620px;
  border-radius: 50%;
  opacity: 0.17;
  filter: blur(0.2px);
  background:
    repeating-radial-gradient(ellipse at center, transparent 0 24px, rgba(191, 234, 217, 0.18) 25px 26px, transparent 27px 48px);
  mask-image: radial-gradient(circle, black, transparent 70%);
}

.bathymetry-a {
  left: -160px;
  top: 36vh;
  transform: translateY(calc(var(--scroll-depth, 0) * -46px));
}

.bathymetry-b {
  right: -210px;
  top: 112vh;
  transform: translateY(calc(var(--scroll-depth, 0) * -92px)) rotate(32deg);
}

.plankton {
  position: absolute;
  inset: 0;
  background-image:
    radial-gradient(circle, rgba(191, 234, 217, 0.55) 0 1px, transparent 1.6px),
    radial-gradient(circle, rgba(125, 249, 232, 0.33) 0 1px, transparent 1.5px);
  background-size: 92px 118px, 157px 131px;
  background-position: var(--plankton-x, 0px) var(--plankton-y, 0px), calc(var(--plankton-x, 0px) * -1) calc(var(--plankton-y, 0px) * 0.5);
  opacity: 0.22;
}

.narrative-console {
  position: relative;
}

.scene {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 7vh clamp(22px, 5vw, 84px);
  position: relative;
}

.console-shell {
  width: min(1180px, 100%);
  min-height: 76vh;
  display: grid;
  gap: clamp(14px, 1.7vw, 24px);
  position: relative;
}

.boot-shell {
  grid-template-columns: 0.72fr 1.42fr 0.72fr;
  grid-template-rows: 1fr auto;
  align-items: stretch;
}

.panes-shell {
  grid-template-columns: 0.9fr 1.45fr 0.65fr;
  align-items: center;
}

.archive-shell {
  grid-template-columns: 1.3fr 0.7fr;
  grid-template-rows: 1fr auto;
  align-items: end;
}

.glass-panel,
.leather-panel {
  position: relative;
  border: 1px solid rgba(125, 249, 232, 0.28);
  border-radius: 28px;
  overflow: hidden;
  box-shadow: inset 0 0 0 1px rgba(183, 166, 255, 0.06), 0 28px 90px rgba(0, 0, 0, 0.35);
  transform: translate3d(0, var(--panel-y, 20px), 0);
  opacity: 0.58;
  transition: opacity 1200ms cubic-bezier(.2,.8,.2,1), transform 1200ms cubic-bezier(.2,.8,.2,1), filter 1200ms ease;
}

.glass-panel {
  background:
    linear-gradient(135deg, rgba(191, 234, 217, 0.105), rgba(6, 24, 38, 0.28) 45%, rgba(11, 58, 63, 0.18)),
    rgba(3, 16, 22, 0.38);
  backdrop-filter: blur(19px) saturate(122%);
}

.leather-panel {
  background:
    radial-gradient(circle at 20% 18%, rgba(216, 180, 106, 0.13), transparent 22%),
    radial-gradient(circle at 80% 78%, rgba(125, 249, 232, 0.055), transparent 26%),
    repeating-linear-gradient(33deg, rgba(255, 255, 255, 0.018) 0 1px, transparent 1px 4px),
    repeating-linear-gradient(112deg, rgba(0, 0, 0, 0.15) 0 1px, transparent 1px 5px),
    #2B211C;
  border-color: rgba(216, 180, 106, 0.28);
  box-shadow: inset 0 0 34px rgba(0, 0, 0, 0.42), inset 0 0 0 1px rgba(216, 180, 106, 0.08), 0 34px 90px rgba(0, 0, 0, 0.42);
}

.scene.active-focus .glass-panel,
.scene.active-focus .leather-panel {
  opacity: 1;
  transform: translate3d(0, var(--panel-y, 0px), 0);
  filter: brightness(1.05);
}

.glass-panel::before,
.leather-panel::before {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  border-radius: inherit;
  padding: 1px;
  background: linear-gradient(125deg, rgba(125, 249, 232, 0.9), rgba(183, 166, 255, 0.38) 28%, transparent 48%, rgba(216, 180, 106, 0.32) 78%, rgba(125, 249, 232, 0.68));
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
  opacity: var(--edge-glow, 0.45);
}

.hero-pane {
  padding: clamp(36px, 6vw, 80px);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.side-ledger,
.note-ledger,
.low-ledger {
  padding: 24px;
  align-self: center;
}

.ledger-left {
  min-height: 390px;
}

.ledger-right {
  min-height: 460px;
}

.current-strip {
  grid-column: 1 / -1;
  min-height: 82px;
  border-radius: 22px;
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  align-items: center;
  gap: 1px;
  padding: 0 24px;
  font-family: "IBM Plex Mono", monospace;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(191, 234, 217, 0.66);
}

h1,
h2 {
  margin: 0;
  font-family: "Bebas Neue", sans-serif;
  font-weight: 400;
  color: rgba(191, 234, 217, 0.96);
  line-height: 0.9;
  text-wrap: balance;
}

h1 {
  font-size: clamp(96px, 18vw, 245px);
  letter-spacing: 0.16em;
  text-shadow: 0 0 38px rgba(125, 249, 232, 0.18);
}

h2 {
  font-size: clamp(58px, 8vw, 118px);
  letter-spacing: 0.035em;
}

p {
  font-size: clamp(15px, 1.45vw, 19px);
  line-height: 1.75;
  color: rgba(191, 234, 217, 0.78);
}

.kicker,
.panel-label,
.coordinate,
.mono-note,
code,
li {
  font-family: "IBM Plex Mono", monospace;
}

.kicker,
.panel-label,
.coordinate {
  display: block;
  font-size: 11px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--cyan);
}

.coordinate {
  color: rgba(183, 166, 255, 0.7);
  margin: 10px 0 28px;
}

.hero-statement {
  max-width: 690px;
  font-size: clamp(19px, 2.2vw, 30px);
}

.latin-fragment {
  font-family: "Cormorant Garamond", serif;
  font-style: italic;
  font-size: clamp(24px, 3.1vw, 42px);
  color: rgba(216, 180, 106, 0.86);
}

.tide-gauge {
  height: 156px;
  display: flex;
  align-items: end;
  gap: 11px;
  margin: 30px 0;
}

.tide-gauge span {
  width: 12px;
  border-radius: 10px 10px 2px 2px;
  background: linear-gradient(180deg, #7DF9E8, rgba(183, 166, 255, 0.32));
  opacity: 0.62;
  height: calc(28px + var(--i, 1) * 18px);
  animation: gauge 5.5s ease-in-out infinite;
}

.tide-gauge span:nth-child(1) { --i: 2; animation-delay: -1s; }
.tide-gauge span:nth-child(2) { --i: 5; animation-delay: -2s; }
.tide-gauge span:nth-child(3) { --i: 3; animation-delay: -3s; }
.tide-gauge span:nth-child(4) { --i: 6; animation-delay: -1.8s; }
.tide-gauge span:nth-child(5) { --i: 4; animation-delay: -4s; }

.circular-viewport {
  width: 170px;
  aspect-ratio: 1;
  border-radius: 50%;
  margin: 38px auto;
  border: 1px solid rgba(125, 249, 232, 0.35);
  background: radial-gradient(circle, rgba(125,249,232,0.1), rgba(3,16,22,0.78) 62%);
  position: relative;
  overflow: hidden;
}

.leaf-section,
.leaf-section::before,
.leaf-section::after {
  position: absolute;
  display: block;
  background: rgba(125, 249, 232, 0.72);
  box-shadow: 0 0 16px rgba(125, 249, 232, 0.42);
}

.leaf-section {
  width: 1px;
  height: 150px;
  left: 50%;
  top: 10px;
  transform: rotate(22deg);
}

.leaf-section::before,
.leaf-section::after {
  content: "";
  width: 76px;
  height: 1px;
  transform-origin: left center;
}

.leaf-section::before { top: 42px; transform: rotate(-34deg); }
.leaf-section::after { top: 84px; transform: rotate(38deg); }

.archive-card,
.wide-pane,
.archive-vault {
  padding: clamp(30px, 4vw, 62px);
}

.archive-card {
  min-height: 560px;
}

.wide-pane {
  min-height: 650px;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.note-ledger {
  min-height: 420px;
}

.embossed-mark {
  margin-top: 52px;
  color: rgba(216, 180, 106, 0.74);
  font-family: "IBM Plex Mono", monospace;
  letter-spacing: 0.18em;
  font-size: 12px;
  text-shadow: 0 1px 0 rgba(0,0,0,0.8);
}

.diagram-row {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  margin-top: 40px;
}

.ampoule,
.compass-sprout,
.bookmark-gauge {
  width: 150px;
  height: 150px;
  border: 1px solid rgba(125, 249, 232, 0.27);
  border-radius: 32px;
  background: rgba(3, 16, 22, 0.36);
  position: relative;
  overflow: hidden;
}

.ampoule span {
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%) rotate(-8deg);
  width: 112px;
  padding: 14px 10px;
  border-radius: 40px;
  border: 1px solid rgba(191, 234, 217, 0.44);
  color: rgba(191, 234, 217, 0.82);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  text-align: center;
}

.compass-sprout::before {
  content: "";
  position: absolute;
  inset: 28px;
  border: 1px solid rgba(183, 166, 255, 0.34);
  border-radius: 50%;
}

.compass-sprout i {
  position: absolute;
  left: 72px;
  top: 31px;
  width: 2px;
  height: 78px;
  background: var(--gold);
  transform: rotate(8deg);
}

.compass-sprout i::after {
  content: "";
  position: absolute;
  top: -12px;
  left: -8px;
  width: 18px;
  height: 24px;
  border-radius: 100% 0 100% 0;
  background: rgba(191, 234, 217, 0.76);
}

.bookmark-gauge b {
  position: absolute;
  inset: 24px 50px 24px 50px;
  border: 1px solid rgba(216, 180, 106, 0.6);
  border-bottom: 24px solid transparent;
  clip-path: polygon(0 0, 100% 0, 100% 100%, 50% 82%, 0 100%);
}

.ripple-dot {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--cyan);
  margin: 80px auto 0;
  box-shadow: 0 0 0 0 rgba(125, 249, 232, 0.5);
  animation: ripple 3.8s ease-out infinite;
}

.archive-vault {
  min-height: 590px;
}

code {
  display: inline-block;
  margin-top: 28px;
  padding: 18px 20px;
  border-radius: 16px;
  color: rgba(125, 249, 232, 0.9);
  background: rgba(3, 16, 22, 0.46);
  border: 1px solid rgba(125, 249, 232, 0.18);
}

.low-ledger ul {
  padding-left: 18px;
  line-height: 2.1;
  color: rgba(191, 234, 217, 0.76);
}

.final-caption {
  grid-column: 1 / -1;
  text-align: center;
  padding: 28px;
}

.depth-meter {
  position: fixed;
  right: 22px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 5;
  height: 58vh;
  display: grid;
  grid-template-rows: auto 1fr auto;
  justify-items: center;
  gap: 14px;
  color: rgba(191, 234, 217, 0.68);
  font-family: "IBM Plex Mono", monospace;
  font-size: 10px;
  letter-spacing: 0.14em;
}

.depth-label {
  writing-mode: vertical-rl;
}

.depth-track {
  width: 2px;
  height: 100%;
  border-radius: 4px;
  background: rgba(191, 234, 217, 0.15);
  overflow: hidden;
}

.depth-fill {
  display: block;
  width: 100%;
  height: calc(var(--scroll-depth, 0) * 100%);
  background: linear-gradient(180deg, #7DF9E8, #B7A6FF, #D8B46A);
  box-shadow: 0 0 20px rgba(125, 249, 232, 0.6);
}

.living-margin {
  position: fixed;
  top: 0;
  width: min(18vw, 220px);
  height: 100vh;
  z-index: 3;
  pointer-events: none;
  opacity: 0.54;
  filter: drop-shadow(0 0 14px rgba(125, 249, 232, 0.18));
}

.margin-left { left: 0; }
.margin-right { right: 0; }

.leaf-path {
  fill: none;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: calc(1200 - (var(--scroll-depth, 0) * 1200));
  transition: stroke-dashoffset 500ms ease-out;
}

.leaf-path.primary { stroke: rgba(125, 249, 232, 0.76); stroke-width: 1.6; }
.leaf-path.secondary { stroke: rgba(191, 234, 217, 0.55); stroke-width: 1.1; }
.leaf-path.tertiary { stroke: rgba(216, 180, 106, 0.42); stroke-width: 0.9; }

@keyframes breathe {
  0%, 100% { opacity: 0.84; transform: scale(1) translateY(var(--water-y, 0px)); }
  50% { opacity: 1; transform: scale(1.035) translateY(calc(var(--water-y, 0px) - 12px)); }
}

@keyframes causticDrift {
  from { background-position: 0 0, 0 0; }
  to { background-position: 220px 120px, -180px 210px; }
}

@keyframes gauge {
  0%, 100% { transform: scaleY(0.78); opacity: 0.42; }
  50% { transform: scaleY(1.08); opacity: 0.86; }
}

@keyframes ripple {
  0% { box-shadow: 0 0 0 0 rgba(125, 249, 232, 0.48); }
  100% { box-shadow: 0 0 0 84px rgba(125, 249, 232, 0); }
}

@media (max-width: 920px) {
  .boot-shell,
  .panes-shell,
  .archive-shell {
    grid-template-columns: 1fr;
  }
  .current-strip {
    grid-template-columns: 1fr 1fr;
  }
  .living-margin {
    opacity: 0.27;
  }
  .depth-meter {
    right: 9px;
  }
}

@media (max-width: 620px) {
  .scene {
    padding: 6vh 18px 6vh 14px;
  }
  .current-strip {
    grid-template-columns: 1fr;
    padding: 20px;
  }
  h1 {
    letter-spacing: 0.09em;
  }
  .depth-meter {
    display: none;
  }
}
