:root {
  --bg: #000;
  --ink: #f4f4f2;
  --dim: rgba(244, 244, 242, 0.66);
  --line: rgba(244, 244, 242, 0.2);
  --blue: #3d7bff;
  --paper: #1ec86e;
  --trash: #ff2d6e;
  --unsure: #ffffff;
  --verdict: var(--unsure);
  --mono: "SF Mono", ui-monospace, "JetBrains Mono", Menlo, Consolas, monospace;
  --grot: "Helvetica Neue", Helvetica, Arial, sans-serif;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { font: 11px/1.45 var(--mono); letter-spacing: 0.02em; -webkit-font-smoothing: antialiased; }
a { color: inherit; }
button { font: inherit; color: inherit; }
:focus-visible { outline: 1px solid var(--ink); outline-offset: 3px; }

.canvas {
  position: relative; min-height: 100vh; overflow: hidden;
  display: grid; place-items: center;
  background-image: radial-gradient(rgba(244, 244, 242, 0.1) 1px, transparent 1px);
  background-size: 22px 22px;
}
.head { position: absolute; z-index: 4; left: 16px; top: 12px; max-width: 316px; padding: 8px; background: #000; }
.head h1 { margin: 0; font: 500 13px/1.3 var(--mono); letter-spacing: 0.04em; }
.head h1 span { color: var(--dim); }
.head p { margin: 4px 0 0; color: var(--dim); }
.pick { position: absolute; z-index: 4; right: 24px; top: 20px; display: flex; }
.pick button { background: #000; border: 1px solid var(--line); padding: 7px 12px; cursor: pointer; color: var(--dim); }
.pick button + button { border-left: 0; }
.pick button:hover { color: var(--ink); }
.pick button[aria-pressed="true"] { background: var(--ink); color: #000; border-color: var(--ink); }
.credits { position: absolute; z-index: 4; left: 24px; right: 24px; bottom: 16px; display: flex; gap: 28px; color: var(--dim); }
.credits a:last-child { margin-left: auto; }
.credits > * { padding: 2px 6px; background: rgba(0, 0, 0, 0.86); }

/* the stage is the Blender render. The film sits in the geode's opening, behind the picture. */
.stage {
  position: relative; container-type: size;
  width: min(100vw, 160vh); aspect-ratio: 16 / 10;
  font-size: clamp(9px, 0.8cqw, 12.5px);
}
.geode { position: absolute; inset: 0; z-index: 2; width: 100%; height: 100%; pointer-events: none; user-select: none; }
/* the film is cut to the centre line of the chrome ring, which geode.py writes out */
.hole { position: absolute; inset: 0; background: #000; clip-path: polygon(83.28% 50.00%, 82.70% 45.71%, 82.15% 42.93%, 81.70% 40.54%, 81.35% 38.34%, 81.09% 36.24%, 80.82% 34.20%, 80.46% 32.25%, 79.91% 30.45%, 79.10% 28.85%, 78.00% 27.50%, 76.67% 26.41%, 75.17% 25.54%, 73.61% 24.81%, 72.11% 24.10%, 70.72% 23.27%, 69.48% 22.22%, 68.35% 20.90%, 67.24% 19.33%, 66.03% 17.58%, 64.61% 15.79%, 62.86% 14.14%, 60.72% 12.77%, 58.10% 11.81%, 54.90% 11.32%, 50.00% 11.28%, 45.14% 11.63%, 42.00% 12.27%, 39.38% 13.10%, 37.10% 14.03%, 35.06% 15.01%, 33.21% 16.03%, 31.52% 17.12%, 30.01% 18.29%, 28.67% 19.59%, 27.52% 21.00%, 26.52% 22.49%, 25.64% 24.02%, 24.79% 25.50%, 23.87% 26.88%, 22.80% 28.14%, 21.53% 29.30%, 20.05% 30.42%, 18.42% 31.60%, 16.76% 32.96%, 15.22% 34.60%, 13.95% 36.59%, 13.09% 38.98%, 12.70% 41.80%, 12.78% 45.12%, 13.25% 50.00%, 14.00% 54.72%, 14.87% 57.73%, 15.72% 60.23%, 16.46% 62.48%, 17.05% 64.59%, 17.52% 66.65%, 17.94% 68.68%, 18.43% 70.64%, 19.07% 72.49%, 19.94% 74.15%, 21.08% 75.59%, 22.45% 76.78%, 24.01% 77.72%, 25.69% 78.48%, 27.43% 79.12%, 29.19% 79.68%, 30.95% 80.21%, 32.74% 80.72%, 34.59% 81.16%, 36.55% 81.49%, 38.65% 81.65%, 40.90% 81.61%, 43.34% 81.40%, 46.07% 81.07%, 50.00% 80.73%, 53.86% 80.49%, 56.47% 80.48%, 58.86% 80.76%, 61.25% 81.35%, 63.74% 82.18%, 66.37% 83.11%, 69.09% 83.98%, 71.82% 84.60%, 74.41% 84.81%, 76.76% 84.52%, 78.75% 83.68%, 80.33% 82.36%, 81.52% 80.63%, 82.36% 78.63%, 82.94% 76.47%, 83.37% 74.26%, 83.71% 72.04%, 84.02% 69.82%, 84.30% 67.58%, 84.51% 65.28%, 84.60% 62.87%, 84.52% 60.30%, 84.26% 57.53%, 83.83% 54.44%); }
.hole video { position: absolute; left: 20.3%; top: 23.3%; width: 59.4%; height: 53.4%; object-fit: contain; }
/* about: the film steps back and the words take the opening */
.hole video { transition: opacity 0.4s; }
.stage.is-about .hole video { opacity: 0.14; }
.stage.is-about .transport { visibility: hidden; }
.about { display: none; position: absolute; z-index: 1; left: 20.3%; top: 23.3%; width: 59.4%; height: 53.4%; padding: 4.4cqw 5cqw 0 13cqw; }
.stage.is-about .about { display: block; }
.about svg { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; }
.about line { stroke: rgba(244, 244, 242, 0.45); stroke-width: 1; }
.about rect { fill: none; stroke: var(--ink); stroke-width: 1; }
.about p { position: relative; margin: 0 0 0.9em; max-width: 36cqw; font-size: max(11px, 0.88cqw); line-height: 1.5; color: var(--ink); }
.about p.lead { font: 300 2cqw/1.08 var(--grot); letter-spacing: -0.02em; margin-bottom: 0.55em; }
.about p.now::after { content: ""; display: inline-block; width: 0.5em; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--ink); }
.wires { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; z-index: 3; }
.wires.back { z-index: 1; opacity: 0.6; }
.wires path { fill: none; stroke: rgba(244, 244, 242, 0.75); stroke-width: 1.2; }
.wires path.hot { stroke: var(--verdict); stroke-width: 1.6; }
.wires circle { fill: #111; stroke: var(--ink); stroke-width: 1.2; }

/* nodes, shaped like the ones in Blender's shader editor */
.node {
  position: absolute; z-index: 3; width: 15.5cqw; min-width: 150px;
  background: rgba(30, 30, 32, 0.9); border: 1px solid rgba(0, 0, 0, 0.9);
  box-shadow: 0 0 0 1px rgba(244, 244, 242, 0.14); border-radius: 5px; touch-action: none;
  --s: 1; scale: var(--s);
}
/* three depths: far nodes sit behind the chrome, near ones float over it */
.node.back { z-index: 1; --s: 0.8; filter: brightness(0.82); }
.node.front { z-index: 5; --s: 1.14; box-shadow: 0 0 0 1px rgba(244, 244, 242, 0.3), 0 20px 50px rgba(0, 0, 0, 0.65); }
.node.drag { box-shadow: 0 0 0 1px var(--ink); }
.bar {
  display: flex; align-items: center; gap: 8px; padding: 0.45em 0.8em;
  background: rgba(244, 244, 242, 0.13); border-radius: 4px 4px 0 0; cursor: grab; user-select: none;
}
.bar b { font-weight: 500; }
.bar em { margin-left: auto; font-style: normal; color: var(--dim); }
.node dl { margin: 0; padding: 0.35em 0; }
.node dl div { display: flex; justify-content: space-between; gap: 10px; padding: 0.2em 0.8em; }
.node dt { color: var(--dim); }
.node dd { margin: 0; text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

.n-source { left: 0.5%; top: 16%; }
.n-sam { left: 27%; top: 2.5%; }
.n-words { left: 55%; top: 4.5%; width: 19cqw; }
.n-rules { right: 5%; top: 25%; }
.n-hands { left: 0.5%; top: 51%; }

.thumb { aspect-ratio: 16 / 9; background: #000; overflow: hidden; }
.thumb video, .thumb img { display: block; width: 100%; height: 100%; object-fit: cover; }
.cap { margin: 0; padding: 0.7em 0.8em; height: 8.6em; overflow: hidden; color: var(--dim); border-bottom: 1px solid rgba(244, 244, 242, 0.12); }
.cap::after { content: ""; display: inline-block; width: 0.5em; height: 1em; margin-left: 2px; vertical-align: -2px; background: var(--ink); }

/* the rules node carries the last verdict as light */
.n-rules { background: linear-gradient(165deg, color-mix(in srgb, var(--verdict) 34%, rgb(30, 30, 32)), rgba(30, 30, 32, 0.92) 60%); }
.last { margin: 0; padding: 0.7em 0.8em; font-weight: 500; letter-spacing: 0.05em; min-height: 3.6em; border-bottom: 1px solid rgba(244, 244, 242, 0.12); }
.tally { list-style: none; margin: 0; padding: 0.45em 0 0; }
.tally li { display: flex; align-items: center; gap: 8px; padding: 0.2em 0.8em; }
.tally li i { width: 0.7em; height: 0.7em; background: var(--c); }
.tally li span { margin-left: auto; font-variant-numeric: tabular-nums; }

.transport {
  position: absolute; z-index: 4; left: 32%; width: 36%; top: 80.5%;
  display: flex; align-items: center; gap: 10px; padding: 0.3em 0.8em;
  background: rgba(0, 0, 0, 0.78); border: 1px solid var(--line); border-radius: 5px;
}
.transport button { background: none; border: 0; padding: 4px 6px; cursor: pointer; font-size: 10px; min-width: 28px; min-height: 24px; }
.transport span { color: var(--dim); font-variant-numeric: tabular-nums; white-space: nowrap; }
.transport input { flex: 1; min-width: 0; appearance: none; -webkit-appearance: none; height: 16px; background: none; cursor: pointer; }
.transport input::-webkit-slider-runnable-track { height: 1px; background: rgba(244, 244, 242, 0.5); }
.transport input::-webkit-slider-thumb { -webkit-appearance: none; width: 7px; height: 13px; margin-top: -6px; background: var(--ink); }
.transport input::-moz-range-track { height: 1px; background: rgba(244, 244, 242, 0.5); }
.transport input::-moz-range-thumb { width: 7px; height: 13px; border: 0; border-radius: 0; background: var(--ink); }

/* the one big thing */
.number { position: absolute; z-index: 5; right: 2%; bottom: 6.5%; text-align: right; }
.number strong { display: block; font: 300 13.5cqw/0.82 var(--grot); letter-spacing: -0.04em; font-variant-numeric: tabular-nums; text-shadow: 0 0 40px #000, 0 0 12px #000; }
.number span { display: inline-block; margin-top: 0.9em; padding: 2px 6px; background: rgba(0, 0, 0, 0.86); color: var(--ink); text-transform: uppercase; letter-spacing: 0.1em; text-shadow: 0 0 8px #000; }

@media (max-width: 860px) {
  .canvas { display: block; overflow: visible; overflow-x: clip; min-height: 0; padding: 56px 0 24px; }
  .head { left: 16px; right: 16px; top: 16px; max-width: none; }
  .head p { display: none; }
  .pick { position: relative; right: auto; top: auto; margin: 0 16px 6px; }
  /* the geode runs off both sides, so the film fills the phone's width */
  .stage { width: 100%; container-type: normal; aspect-ratio: auto; font-size: 11px; display: flex; flex-direction: column; }
  .stage::before { content: ""; display: block; aspect-ratio: 16 / 15; order: 0; }
  .geode { left: -25%; top: 0; width: 150%; height: auto; }
  .hole { inset: auto; left: -25%; top: 0; width: 150%; aspect-ratio: 16 / 10; }
  .wires.back, .stage.is-about .wires { display: none; }
  .about { position: static; order: 1; width: auto; height: auto; padding: 4px 16px 8px 30px; }
  .about svg { display: none; }
  .about p { max-width: none; font-size: 12px; }
  .about p.lead { font-size: 26px; }
  .stage.is-about .transport, .stage.is-about .number, .stage.is-about .node { display: none; }
  .node, .transport, .number { position: static; width: auto; margin: 10px 16px 0; scale: none; translate: none; filter: none; }
  /* nodes stay nodes: narrow, stepped left and right, wired in a chain */
  .node { margin-top: 26px; }
  .n-rules { width: 66%; align-self: flex-start; }
  .n-words { width: 70%; align-self: flex-end; }
  .n-sam { width: 62%; align-self: flex-start; }
  .n-hands { width: 56%; align-self: flex-end; }
  .n-source { width: 58%; align-self: flex-start; }
  .transport { order: 1; margin-top: -4px; }
  .number { order: 2; text-align: left; margin-top: 18px; }
  .n-rules { order: 3; } .n-words { order: 4; } .n-sam { order: 5; } .n-hands { order: 6; } .n-source { order: 7; }
  .number strong { font-size: 34vw; }
  .cap { height: auto; min-height: 5em; }
  .bar { cursor: default; }
  .credits { position: static; flex-wrap: wrap; gap: 6px 20px; margin: 22px 16px 0; }
}
