/* ABISSO — discesa negli oceani */

@font-face {
  font-family: 'Cormorant';
  src: url('../vendor/fonts/cormorant-garamond-v21-latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Cormorant';
  src: url('../vendor/fonts/cormorant-garamond-v21-latin-italic.woff2') format('woff2');
  font-weight: 400; font-style: italic; font-display: swap;
}
@font-face {
  font-family: 'Cormorant';
  src: url('../vendor/fonts/cormorant-garamond-v21-latin-600.woff2') format('woff2');
  font-weight: 600; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Grotesk';
  src: url('../vendor/fonts/space-grotesk-v22-latin-regular.woff2') format('woff2');
  font-weight: 400; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Grotesk';
  src: url('../vendor/fonts/space-grotesk-v22-latin-500.woff2') format('woff2');
  font-weight: 500; font-style: normal; font-display: swap;
}
@font-face {
  font-family: 'Grotesk';
  src: url('../vendor/fonts/space-grotesk-v22-latin-700.woff2') format('woff2');
  font-weight: 700; font-style: normal; font-display: swap;
}

:root {
  --teal: #8FE3D9;
  --pearl: #EAF6F4;
  --hud: #7FD6CE;
  --hud-dim: rgba(143, 227, 217, 0.45);
  --ink: #04070d;
  --glow: rgba(120, 220, 235, 0.55);
}

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

html { scroll-behavior: auto; }

body {
  background: #04070d;
  color: var(--pearl);
  font-family: 'Grotesk', system-ui, sans-serif;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  cursor: default;
}

/* ---- Shader canvas (fixed background) ---- */
#gl {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  z-index: 0;
  display: block;
}

/* ---- Creature layer (fixed, above shader, below text) ---- */
#creatures {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}
.creature {
  position: absolute;
  will-change: transform, opacity;
  opacity: 0;
  transition: opacity 0.6s ease;
  pointer-events: auto;
}
.creature img {
  display: block;
  width: 100%;
  height: auto;
  filter: drop-shadow(0 0 22px var(--glow));
}
.creature .clabel {
  position: absolute;
  left: 50%;
  bottom: -14px;
  transform: translate(-50%, 8px);
  min-width: 210px;
  max-width: 280px;
  padding: 10px 14px;
  background: rgba(4, 12, 18, 0.72);
  border: 1px solid var(--hud-dim);
  border-radius: 4px;
  backdrop-filter: blur(6px);
  opacity: 0;
  transition: opacity 0.35s ease, transform 0.35s ease;
  pointer-events: none;
}
.creature:hover .clabel { opacity: 1; transform: translate(-50%, 0); }
.creature .clabel .sci {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-size: 1.15rem;
  color: var(--teal);
  line-height: 1.1;
}
.creature .clabel .com {
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--hud);
  margin: 3px 0 6px;
}
.creature .clabel .cur {
  font-size: 0.78rem;
  color: rgba(234, 246, 244, 0.82);
  line-height: 1.45;
}

/* Titanic silhouette special */
#titanic-wrap {
  position: absolute;
  opacity: 0;
  transition: opacity 1.2s ease;
  pointer-events: none;
}
#titanic-wrap svg { display: block; width: 100%; height: auto; }

/* ---- Scroll content ---- */
#scroll { position: relative; z-index: 3; }
.panel {
  height: 100vh;
  display: flex;
  align-items: center;
  padding: 0 8vw;
  pointer-events: none;
}
.panel.right { justify-content: flex-end; text-align: right; }
.panel.left { justify-content: flex-start; text-align: left; }
.panel.center { justify-content: center; text-align: center; }

.block {
  max-width: 480px;
  opacity: 0;
  transform: translateY(38px);
  transition: opacity 1s ease, transform 1s cubic-bezier(0.22, 1, 0.36, 1);
}
.block.in { opacity: 1; transform: translateY(0); }

.zone {
  font-family: 'Grotesk', sans-serif;
  font-weight: 500;
  font-size: 0.72rem;
  letter-spacing: 0.42em;
  text-transform: uppercase;
  color: var(--hud);
  margin-bottom: 1.1rem;
  opacity: 0.85;
}
.depth-big {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: clamp(3.4rem, 9vw, 7.5rem);
  line-height: 0.92;
  letter-spacing: -0.02em;
  color: var(--pearl);
  text-shadow: 0 0 40px rgba(120, 210, 230, 0.28);
}
.depth-big .u { font-size: 0.32em; color: var(--hud); letter-spacing: 0; margin-left: 0.15em; font-family: 'Grotesk', sans-serif; font-weight: 400; }
.ptitle {
  font-family: 'Cormorant', serif;
  font-style: italic;
  font-weight: 400;
  font-size: clamp(1.5rem, 3vw, 2.3rem);
  color: var(--teal);
  margin: 0.8rem 0 1rem;
  line-height: 1.15;
}
.ptext {
  font-size: 0.98rem;
  line-height: 1.7;
  color: rgba(234, 246, 244, 0.9);
  font-weight: 400;
}
.right .block { margin-left: auto; }

/* Intro hero */
#hero .block { max-width: 620px; }
#hero .kicker {
  font-size: 0.7rem; letter-spacing: 0.5em; text-transform: uppercase;
  color: var(--hud); margin-bottom: 1.4rem;
}
#hero h1 {
  font-family: 'Cormorant', serif;
  font-weight: 600;
  font-size: clamp(4rem, 16vw, 12rem);
  line-height: 0.85;
  letter-spacing: 0.02em;
  color: var(--pearl);
  text-shadow: 0 0 60px rgba(143, 227, 217, 0.4);
}
#hero .sub {
  font-size: 1.05rem; line-height: 1.6; margin-top: 1.6rem;
  color: rgba(234, 246, 244, 0.86); max-width: 440px;
}
.scroll-cue {
  margin-top: 2.6rem; font-size: 0.72rem; letter-spacing: 0.3em;
  text-transform: uppercase; color: var(--hud);
  display: flex; align-items: center; gap: 0.8rem;
}
.scroll-cue .arrow {
  display: inline-block; width: 1px; height: 34px;
  background: linear-gradient(var(--hud), transparent);
  animation: cue 2.4s ease-in-out infinite;
}
@keyframes cue { 0%,100% { transform: scaleY(0.4); opacity: .4; } 50% { transform: scaleY(1); opacity: 1; } }

/* Final panel */
#final .block { max-width: 620px; }
#final .coords {
  font-family: 'Grotesk', monospace;
  font-size: 0.9rem; letter-spacing: 0.16em;
  color: var(--hud); margin: 1.4rem 0;
}
#final .dedica {
  font-family: 'Cormorant', serif; font-style: italic;
  font-size: 1.3rem; color: var(--teal); line-height: 1.5; margin-top: 1.2rem;
}

/* ---- HUD ---- */
#hud {
  position: fixed;
  inset: 0;
  z-index: 5;
  pointer-events: none;
  font-family: 'Grotesk', monospace;
  color: var(--hud);
}
/* legibility halo on bright surface water — driven by --hud-halo from JS (0 in the deep) */
#hud, #column, #footer { text-shadow: 0 1px 6px rgba(235,255,252, var(--hud-halo, 0)); }
.hud-corner {
  position: absolute;
  font-size: 0.72rem;
  letter-spacing: 0.1em;
}
.hud-tl { top: 26px; left: 30px; }
.hud-tr { top: 26px; right: 30px; text-align: right; }
.hud-bl { bottom: 26px; left: 30px; }
.hud-label { font-size: 0.58rem; letter-spacing: 0.24em; text-transform: uppercase; color: var(--hud-dim); display: block; margin-bottom: 3px; }
.hud-val { font-size: 1.05rem; font-weight: 500; color: var(--hud); font-variant-numeric: tabular-nums; }
.hud-val .un { font-size: 0.62rem; color: var(--hud-dim); margin-left: 3px; }

/* frame ticks */
.hud-frame { position: absolute; border-color: var(--hud-dim); border-style: solid; width: 22px; height: 22px; }
.f-tl { top: 18px; left: 18px; border-width: 1px 0 0 1px; }
.f-tr { top: 18px; right: 18px; border-width: 1px 1px 0 0; }
.f-bl { bottom: 18px; left: 18px; border-width: 0 0 1px 1px; }
.f-br { bottom: 18px; right: 18px; border-width: 0 1px 1px 0; }

/* Depthometer center-top big readout */
#depthometer {
  position: absolute;
  top: 22px; left: 50%; transform: translateX(-50%);
  text-align: center;
}
#depthometer .dm-num {
  font-family: 'Grotesk', monospace;
  font-size: 1.5rem; font-weight: 700;
  color: var(--hud-strong, var(--pearl)); letter-spacing: 0.04em;
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 18px rgba(120,210,230,.35), 0 1px 10px rgba(235,255,252, var(--hud-halo, 0));
}
#depthometer .dm-num .un { font-size: 0.7rem; color: var(--hud); font-weight: 400; margin-left: 4px; }
#depthometer .dm-zone { font-size: 0.56rem; letter-spacing: 0.34em; text-transform: uppercase; color: var(--hud); margin-top: 4px; }

/* ---- Water column progress (right) ---- */
#column {
  position: fixed;
  right: 16px; top: 12vh; bottom: 12vh;
  width: 4px; z-index: 5;
  background: rgba(120, 210, 230, 0.12);
  border-radius: 4px;
  pointer-events: none;
}
#column .fill {
  position: absolute; left: 0; right: 0; top: 0;
  background: linear-gradient(var(--teal), #1a6f8c 40%, #06232f 80%, #020407);
  border-radius: 4px; height: 0%;
}
#column .knob {
  position: absolute; left: 50%; transform: translate(-50%, -50%);
  width: 9px; height: 9px; border-radius: 50%;
  background: var(--teal); box-shadow: 0 0 10px 2px var(--glow);
}
#column .tick {
  position: absolute; left: -20px; width: 14px; height: 1px;
  background: var(--hud-dim);
}
#column .tick span {
  position: absolute; right: 18px; top: -6px; white-space: nowrap;
  font-family: 'Grotesk', monospace; font-size: 0.5rem;
  letter-spacing: 0.1em; color: var(--hud-dim);
}

/* ---- Footer / gallery link ---- */
#footer {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  z-index: 6; display: flex; gap: 14px; align-items: center;
  font-size: 0.62rem; letter-spacing: 0.16em; color: var(--hud-dim);
  pointer-events: none;
}
#footer a { color: var(--hud); text-decoration: none; pointer-events: auto; }
#footer a:hover { color: var(--teal); }
#footer a:focus-visible { outline: 1px solid var(--teal); outline-offset: 3px; }
#footer .sig { font-family: 'Cormorant', serif; font-style: italic; }

/* Vignette overlay for text legibility depth */
#dark-overlay {
  position: fixed; inset: 0; z-index: 1; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 40%, rgba(2,4,8,0.55) 100%);
  opacity: 0;
}

@media (max-width: 720px) {
  .hud-tl, .hud-tr, .hud-bl { font-size: 0.62rem; }
  #depthometer .dm-num { font-size: 1.15rem; }
  .block { max-width: 84vw; }
  #column { right: 8px; }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-cue .arrow { animation: none; }
  .block { transition: opacity 0.5s ease; transform: none; }
  .block:not(.in) { transform: none; }
}
