@font-face {
  font-family: "DM Mono";
  src: url("fonts/dm-mono-latin-400-normal.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0000-00FF, U+2000-206F, U+20AC, U+2122, U+2190-2193, U+2212;
}

@font-face {
  font-family: "DM Mono";
  src: url("fonts/dm-mono-latin-ext-400-normal.woff2") format("woff2");
  font-display: swap;
  unicode-range: U+0100-02BA, U+1E00-1EFF, U+2C60-2C7F, U+A720-A7FF;
}

:root {
  --bg: #0f0c09;
  --ink: #f3e9d8;
  --muted: #a39684;
  --faint: #8c8071;
  --amber: #f29a3e;
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);

  /* Written by fizz.js so the DOM lines up with the dot grid. */
  --cell: 6px;
  --horizon: 72svh;
  --glass-x: 50vw;
  --glass-y: 20svh;
  --glass-w: 280px;
  --glass-h: 500px;
  --caption-x: 50vw;
  --caption-y: 80svh;
  --caption-w: 336px;

  color-scheme: dark;
  -webkit-tap-highlight-color: transparent;
}

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

html { background: var(--bg); }

body {
  min-height: 100svh;
  color: var(--muted);
  background: var(--bg);
  font: 400 14px/1.6 "DM Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  -webkit-font-smoothing: antialiased;
  overscroll-behavior: none;
}

#scene {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
}

.intro {
  position: absolute;
  left: clamp(24px, 8vw, 128px);
  bottom: calc(100svh - var(--horizon) + var(--cell) * 3);
  width: min(38ch, calc(100vw - 48px));
}

.intro h1 {
  color: var(--ink);
  font: inherit;
}

.intro .role { margin-bottom: 1.6em; }

.intro p { text-wrap: pretty; }

.links {
  display: flex;
  gap: 2ch;
  margin-top: 1.6em;
  padding: 0;
  list-style: none;
}

a {
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: var(--faint);
  text-underline-offset: 3px;
  transition: text-decoration-color 160ms ease;
}

@media (hover: hover) and (pointer: fine) {
  a:hover { text-decoration-color: var(--amber); }
}

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

#glass {
  position: fixed;
  left: var(--glass-x);
  top: var(--glass-y);
  width: var(--glass-w);
  height: var(--glass-h);
  border: 0;
  background: none;
  cursor: pointer;
  touch-action: pan-y;
  user-select: none;
}

.caption {
  position: fixed;
  left: var(--caption-x);
  top: var(--caption-y);
  width: var(--caption-w);
  font-size: 11px;
  line-height: 1.7;
  color: var(--faint);
}

.caption-row {
  display: flex;
  justify-content: space-between;
  gap: 2ch;
}

.label {
  color: var(--amber);
  letter-spacing: 0.08em;
}

.formula { color: var(--muted); margin-top: 0.5em; white-space: nowrap; }

.formula sub {
  font-size: 0.75em;
  line-height: 0;
}

.telemetry { font-variant-numeric: tabular-nums; }

/* Entrance: rare, once per visit. Short stagger, nothing blocks interaction. */
.intro > *,
.caption {
  animation: rise 600ms var(--ease-out) both;
}

.intro > :nth-child(2) { animation-delay: 50ms; }
.intro > :nth-child(3) { animation-delay: 100ms; }
.intro > :nth-child(4) { animation-delay: 150ms; }
.caption { animation-delay: 500ms; }

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(8px);
    filter: blur(2px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .intro > *,
  .caption { animation: fade 200ms ease both; }

  @keyframes fade {
    from { opacity: 0; }
  }
}

/* Without WebGL2 there is no scene to caption. The text stands alone. */
.no-scene #scene,
.no-scene #glass,
.no-scene .caption { display: none; }

.no-scene .intro {
  top: 20svh;
  bottom: auto;
}

.no-scene .needs-scene { display: none; }

@media (max-width: 699px), (max-aspect-ratio: 1/1) {
  .intro {
    left: 24px;
    top: calc(env(safe-area-inset-top) + 24px);
    bottom: auto;
    font-size: 13px;
  }

  .intro .role { margin-bottom: 1em; }
  .links { margin-top: 1em; }
}

/* Landscape phones: the words go first, the glass keeps what room is left. */
@media (max-height: 520px) {
  .intro {
    top: calc(env(safe-area-inset-top) + 16px);
    bottom: auto;
    font-size: 13px;
  }

  .intro .role { margin-bottom: 0.8em; }
  .links { margin-top: 0.8em; }
  .formula { display: none; }
}
