:root {
  --ink: #071a3a;
  --ink-deep: #040d1f;
  --phosphor: #7fd4ff;
  --phosphor-soft: rgb(127 212 255 / 0.5);
  --phosphor-faint: rgb(127 212 255 / 0.2);
  --signal: #ffb547;
  --text: #d4f1ff;
  --muted: #6f9ccf;
  --gutter: clamp(10px, 1.6vw, 18px);
  --zone: 14px;
  --glow: 0 0 6px rgb(127 212 255 / 0.55), 0 0 18px rgb(127 212 255 / 0.18);
  --glow-signal: 0 0 6px rgb(255 181 71 / 0.6), 0 0 18px rgb(255 181 71 / 0.2);
  --mono: "B612 Mono", ui-monospace, "SF Mono", Menlo, monospace;
  --sans: "B612", "Helvetica Neue", Arial, sans-serif;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: radial-gradient(circle at 50% 45%, #0d2652, var(--ink-deep) 75%) fixed var(--ink);
  color: var(--text);
}

body {
  margin: 0;
  min-height: 100vh;
  font: 13px/1.5 var(--mono);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* ---- Without WebGL: a plain, centred title block and link list ---- */

main {
  min-height: 100vh;
  display: grid;
  place-content: center;
  gap: 40px;
  padding: 48px 24px;
}

#scene,
#overlay,
.sheet,
.cue,
.scroll-space,
.crt {
  display: none;
}

.title-block {
  min-width: 232px;
  border: 1px solid var(--phosphor-soft);
  background: rgb(4 13 31 / 0.6);
  text-shadow: var(--glow);
}

.title-block h1 {
  margin: 0;
  padding: 11px 14px 1px;
  font: 700 15px/1.3 var(--sans);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--phosphor);
}

.role {
  margin: 0;
  padding: 0 14px 11px;
  color: var(--muted);
  font-size: 12px;
}

.readout {
  display: none;
  grid-template-columns: max-content 1fr;
  margin: 0;
  font-size: 10.5px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.readout div {
  display: contents;
}

.readout dt,
.readout dd {
  margin: 0;
  padding: 5px 14px;
  border-top: 1px solid var(--phosphor-faint);
}

.readout dt {
  color: var(--muted);
  border-right: 1px solid var(--phosphor-faint);
}

.readout dd {
  font-variant-numeric: tabular-nums;
}

#links ul {
  display: grid;
  gap: 18px;
  margin: 0;
  padding: 0;
  list-style: none;
}

#links a {
  display: grid;
  gap: 1px;
  color: inherit;
  text-decoration: none;
  outline: none;
}

#links .name {
  font: 700 17px/1.2 var(--sans);
  letter-spacing: 0.04em;
  color: var(--phosphor);
  text-shadow: var(--glow);
  transition: color 0.15s, text-shadow 0.15s;
}

#links .host {
  font-size: 11px;
  letter-spacing: 0.08em;
  color: var(--muted);
}

#links a:hover .name,
#links a.is-hot .name {
  color: var(--signal);
  text-shadow: var(--glow-signal);
}

#links a:focus-visible {
  outline: 1px solid var(--signal);
  outline-offset: 6px;
}

/* ---- With WebGL: the drawing sheet ---- */

.is-3d main {
  display: block;
  min-height: 0;
  padding: 0;
}

.is-3d #scene {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
}

.is-3d #overlay {
  display: block;
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  pointer-events: none;
}

#overlay .axis {
  fill: none;
  stroke: var(--phosphor);
  stroke-width: 1;
  stroke-dasharray: 22 5 4 5;
}

#overlay .leader {
  fill: none;
  stroke: var(--phosphor);
  stroke-width: 1;
  filter: drop-shadow(0 0 3px rgb(127 212 255 / 0.7));
}

#overlay .leader-dot {
  fill: var(--phosphor);
}

#overlay .is-hot {
  stroke: var(--signal);
  filter: drop-shadow(0 0 3px rgb(255 181 71 / 0.8));
}

#overlay .leader-dot.is-hot {
  fill: var(--signal);
}

.is-3d .sheet {
  display: block;
  position: fixed;
  inset: var(--gutter);
  border: 1px solid var(--phosphor-faint);
  pointer-events: none;
}

.zones {
  position: absolute;
  display: flex;
  font-size: 9px;
  letter-spacing: 0.1em;
  color: var(--muted);
  opacity: 0.8;
}

.zones span {
  flex: 1;
  display: grid;
  place-items: center;
}

.zones-x {
  inset: 0 var(--zone) auto;
  height: var(--zone);
  border-bottom: 1px solid var(--phosphor-faint);
}

.zones-x span + span {
  border-left: 1px solid var(--phosphor-faint);
}

.zones-bottom {
  inset: auto var(--zone) 0;
  border-bottom: 0;
  border-top: 1px solid var(--phosphor-faint);
}

.zones-y {
  inset: var(--zone) auto var(--zone) 0;
  width: var(--zone);
  flex-direction: column;
  border-right: 1px solid var(--phosphor-faint);
}

.zones-y span + span {
  border-top: 1px solid var(--phosphor-faint);
}

.zones-right {
  inset: var(--zone) 0 var(--zone) auto;
  border-right: 0;
  border-left: 1px solid var(--phosphor-faint);
}

.is-3d .title-block {
  position: fixed;
  right: calc(var(--gutter) + var(--zone) + 12px);
  bottom: calc(var(--gutter) + var(--zone) + 12px);
  z-index: 2;
}

.is-3d .readout {
  display: grid;
}

.is-3d #links {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
}

.is-3d #links a {
  position: fixed;
  top: 0;
  left: 0;
  padding: 4px 8px 5px;
  background: rgb(4 13 31 / 0.62);
  opacity: 0;
  pointer-events: none;
  will-change: transform, opacity;
}

.is-3d #links a.is-left {
  text-align: right;
}

.is-3d #links a.is-live {
  pointer-events: auto;
}

.is-3d .cue {
  display: flex;
  position: fixed;
  left: 50%;
  bottom: calc(var(--gutter) + var(--zone) + 14px);
  z-index: 2;
  flex-direction: column-reverse;
  align-items: center;
  gap: 10px;
  margin: 0;
  transform: translateX(-50%);
  font-size: 10.5px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  color: var(--muted);
  text-shadow: 0 0 3px var(--ink-deep), 0 0 10px var(--ink-deep), var(--glow);
  pointer-events: none;
}

.is-3d .cue::before {
  content: "";
  width: 1px;
  height: 30px;
  background: linear-gradient(to bottom, transparent, var(--phosphor) 45%, var(--phosphor) 55%, transparent) 0 0 / 1px 50% no-repeat;
  animation: cue-down 2.2s cubic-bezier(0.6, 0, 0.4, 1) infinite;
}

.is-3d .cue.is-up {
  flex-direction: column;
}

.is-3d .cue.is-up::before {
  animation-name: cue-up;
}

@keyframes cue-down {
  from { background-position: 0 -100%; }
  to { background-position: 0 200%; }
}

@keyframes cue-up {
  from { background-position: 0 200%; }
  to { background-position: 0 -100%; }
}

.is-3d .scroll-space {
  display: block;
  height: 260vh;
}

/* Scanlines and tube vignette sit over everything, labels included. */
.is-3d .crt {
  display: block;
  position: fixed;
  inset: 0;
  z-index: 10;
  pointer-events: none;
  background:
    radial-gradient(ellipse at center, transparent 55%, rgb(2 7 18 / 0.6) 100%),
    repeating-linear-gradient(to bottom, rgb(2 9 24 / 0.22) 0 1px, transparent 1px 3px);
}

/* Interface fades up once the hologram has materialised. */
.is-3d .sheet,
.is-3d .title-block,
.is-3d .cue {
  opacity: 0;
  transition: opacity 0.9s ease 1.3s;
}

.is-ready .sheet,
.is-ready .title-block,
.is-ready .cue {
  opacity: 1;
}

@media (max-width: 640px), (max-aspect-ratio: 9/10) {
  .zones-y {
    display: none;
  }

  .zones-x {
    inset-inline: 0;
  }

  .is-3d .title-block {
    top: calc(var(--gutter) + var(--zone) + 10px);
    left: calc(var(--gutter) + 10px);
    right: auto;
    bottom: auto;
    min-width: 0;
  }

  .title-block h1 {
    font-size: 13px;
    padding: 9px 12px 0;
  }

  .role {
    padding: 0 12px 9px;
  }

  .readout dt,
  .readout dd {
    padding: 4px 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .is-3d .cue::before {
    animation: none;
    background-position: 0 50%;
  }

  .is-3d .sheet,
  .is-3d .title-block,
  .is-3d .cue {
    transition: none;
  }
}
