/* SKADI · Deep Ice Neutrino Observatory
   Palette: glacial near-black, Cherenkov blue, photomultiplier amber. OKLCH only. */

:root {
  color-scheme: dark;

  --bg: oklch(0.09 0.011 235);
  --surface: oklch(0.13 0.014 235);
  --line: oklch(0.26 0.02 235);
  --ink: oklch(0.96 0.008 230);
  --body: oklch(0.88 0.012 232);
  --muted: oklch(0.72 0.02 232);
  --cherenkov: oklch(0.75 0.13 230);
  --cherenkov-dim: oklch(0.45 0.08 232);
  --amber: oklch(0.78 0.13 75);

  --font-sans: "Archivo", system-ui, sans-serif;
  --font-mono: "Fragment Mono", ui-monospace, monospace;

  --z-canvas: 0;
  --z-content: 1;
  --z-chrome: 10;
  --z-skip: 100;
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--body);
  font-family: var(--font-sans);
  font-size: 1.0625rem;
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

::selection {
  background: var(--amber);
  color: oklch(0.15 0.02 75);
}

:focus-visible {
  outline: 2px solid var(--amber);
  outline-offset: 3px;
  border-radius: 2px;
}

/* skip-link target: focus lands programmatically, never show a ring on the section */
section:focus { outline: none; }

/* ---------- fixed scene ---------- */

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: var(--z-canvas);
}

main {
  position: relative;
  z-index: var(--z-content);
}

/* ---------- chrome ---------- */

.skip-link {
  position: fixed;
  z-index: var(--z-skip);
  top: 0.75rem;
  left: 0.75rem;
  padding: 0.5rem 0.9rem;
  background: var(--surface);
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 0.8rem;
  text-decoration: none;
  border: 1px solid var(--line);
  transform: translateY(-300%);
}
.skip-link:focus-visible { transform: none; }

.site-head {
  position: fixed;
  z-index: var(--z-chrome);
  inset: 0 0 auto 0;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 1.1rem clamp(1.25rem, 4vw, 2.5rem);
  background: linear-gradient(to bottom, oklch(0.07 0.011 235 / 0.85), oklch(0.07 0.011 235 / 0));
  pointer-events: none;
}
.site-head a { pointer-events: auto; }

.site-head__mark {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  letter-spacing: 0.22em;
  color: var(--ink);
  text-decoration: none;
}

.site-head__nav {
  display: flex;
  gap: 1.75rem;
}
.site-head__nav a {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--muted);
  text-decoration: none;
  transition: color 160ms ease-out;
  padding: 0.75rem 0.25rem;
  margin: -0.75rem -0.25rem;
}
.site-head__nav a:hover { color: var(--ink); }

/* ---------- depth gauge ---------- */

.depth-gauge {
  position: fixed;
  z-index: var(--z-chrome);
  right: clamp(1rem, 2.5vw, 2rem);
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.depth-gauge__rail {
  position: relative;
  width: 9px;
  height: 44vh;
  background:
    repeating-linear-gradient(to bottom,
      var(--line) 0, var(--line) 1px,
      transparent 1px, transparent calc(44vh / 10));
  border-right: 1px solid var(--line);
}

.depth-gauge__marker {
  position: absolute;
  right: -1px;
  top: 0;
  width: 14px;
  height: 2px;
  background: var(--amber);
  box-shadow: 0 0 8px oklch(0.78 0.13 75 / 0.7);
}

.depth-gauge__readout {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}

/* ---------- hero ---------- */

.hero {
  position: relative;
  min-height: 100svh;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: clamp(1.5rem, 5vw, 4rem);
  padding-bottom: 18svh;
}

.hero__title {
  margin: 0;
  font-size: clamp(3.25rem, 10vw, 6rem);
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: 0.05em;
  line-height: 0.95;
  color: var(--ink);
  text-shadow: 0 2px 40px oklch(0.05 0.01 235 / 0.9);
}

.hero__sub {
  margin: 0.9rem 0 0;
  font-size: clamp(1.1rem, 2.2vw, 1.4rem);
  font-weight: 500;
  font-stretch: 110%;
  color: var(--ink);
}

.hero__meta {
  margin: 0.75rem 0 0;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--amber);
}
.hero__meta span { white-space: nowrap; }

.hero__lead {
  margin: 1.5rem 0 0;
  max-width: 42ch;
  font-size: 1.125rem;
  color: var(--body);
  text-shadow: 0 1px 18px oklch(0.05 0.01 235 / 0.8);
}

.hero__cue {
  position: absolute;
  left: 50%;
  bottom: 2.25rem;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--muted);
  text-decoration: none;
  animation: cue-float 2.6s ease-in-out infinite;
  transition: color 160ms ease-out;
}
.hero__cue:hover { color: var(--ink); }
.hero__cue svg { width: 18px; height: 18px; }

@keyframes cue-float {
  0%, 100% { transform: translateX(-50%) translateY(0); }
  50% { transform: translateX(-50%) translateY(7px); }
}

/* ---------- sections ---------- */

.section {
  display: grid;
  align-items: center;
  min-height: 115vh;
  padding: clamp(4rem, 14vh, 10rem) clamp(1.5rem, 7vw, 8rem);
}

.section__inner {
  max-width: 36rem;
  padding: clamp(1rem, 3vw, 2.5rem);
  background: radial-gradient(130% 130% at 50% 50%,
    oklch(0.08 0.012 235 / 0.65) 0%,
    oklch(0.08 0.012 235 / 0) 74%);
}

.section--right { justify-items: end; }

.section--wide .section__inner--wide { max-width: 62rem; justify-self: center; }

.section h2 {
  margin: 0.6rem 0 1.25rem;
  font-size: clamp(2.1rem, 4.5vw, 3.4rem);
  font-weight: 750;
  font-stretch: 115%;
  line-height: 1.05;
  letter-spacing: -0.015em;
  color: var(--ink);
  text-wrap: balance;
}

.section p {
  margin: 0 0 1.1rem;
  max-width: 62ch;
  text-wrap: pretty;
}
.section p:last-child { margin-bottom: 0; }

.depth-mark {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--amber);
  font-variant-numeric: tabular-nums;
}

/* ---------- spec sheet ---------- */

.spec {
  margin: 2.25rem 0 0;
  max-width: 26rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
}

.spec__row {
  display: flex;
  justify-content: space-between;
  gap: 2rem;
  padding: 0.55rem 0;
  border-top: 1px solid var(--line);
}
.spec__row:last-child { border-bottom: 1px solid var(--line); }

.spec dt { color: var(--muted); }
.spec dd { margin: 0; color: var(--ink); font-variant-numeric: tabular-nums; }

/* ---------- events ---------- */

.section__copy { max-width: 58ch; }

.event-panel {
  display: grid;
  grid-template-columns: minmax(280px, 460px) minmax(260px, 1fr);
  gap: clamp(1.5rem, 4vw, 3rem);
  align-items: start;
  margin-top: 2.5rem;
}

.event-display {
  margin: 0;
}

#eventCanvas {
  display: block;
  width: 100%;
  height: auto;
  background: radial-gradient(100% 100% at 50% 42%,
    oklch(0.12 0.018 235) 0%, oklch(0.075 0.012 235) 100%);
  border: 1px solid var(--line);
}

.event-display__caption {
  margin-top: 0.7rem;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  color: var(--muted);
}

.event-log {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-variant-numeric: tabular-nums;
}

.event-log__caption {
  text-align: left;
  padding-bottom: 0.6rem;
  color: var(--ink);
  font-size: 0.8rem;
}

.event-log th {
  text-align: left;
  font-weight: 400;
  color: var(--muted);
  padding: 0.45rem 0.75rem 0.45rem 0;
  border-bottom: 1px solid var(--line);
}

.event-log td {
  padding: 0.5rem 0.75rem 0.5rem 0;
  border-bottom: 1px solid oklch(0.2 0.016 235);
  color: var(--body);
}

.event-log tr.is-new td { color: var(--amber); }

.btn {
  margin-top: 1.5rem;
  padding: 0.7rem 1.3rem;
  font-family: var(--font-mono);
  font-size: 0.8rem;
  color: var(--ink);
  background: transparent;
  border: 1px solid var(--line);
  cursor: pointer;
  transition: border-color 160ms ease-out, background 160ms ease-out;
}
.btn:hover {
  border-color: var(--cherenkov);
  background: oklch(0.75 0.13 230 / 0.08);
}
.btn:active {
  border-color: var(--cherenkov);
  background: oklch(0.75 0.13 230 / 0.16);
}

/* ---------- bedrock / footer ---------- */

.section--bedrock {
  min-height: 130vh;
  align-content: end;
  padding-bottom: 4rem;
}

.site-foot {
  margin-top: clamp(4rem, 12vh, 8rem);
  padding-top: 1.5rem;
  border-top: 1px solid var(--line);
}

.site-foot__line {
  margin: 0.35rem 0;
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--body);
}

.site-foot__line--muted { color: var(--muted); }

/* ---------- reveal (default state is fully visible; the class only plays an entrance) ---------- */

@keyframes reveal-rise {
  from { opacity: 0; transform: translateY(26px); }
  to { opacity: 1; transform: none; }
}

.reveal--in {
  animation: reveal-rise 800ms cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---------- responsive ---------- */

@media (max-width: 860px) {
  .event-panel { grid-template-columns: 1fr; }
}

@media (max-width: 720px) {
  .depth-gauge { display: none; }
  .site-head__nav { display: none; }
  .section { min-height: 100vh; }
  .section--right { justify-items: start; }
}

/* ---------- reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .hero__cue { animation: none; }
  .reveal--in { animation: none; }
  * { transition-duration: 1ms !important; }
}
