/* Style: kitbash pack "Phosphor Dither Diorama". One ink on near-black paper, every grey is a 4x4 dither. */

/* One face for every word: Departure Mono, a pixel font, so the letters are built like the dots. Sizes are
   multiples of half its 11 px grid, which keeps the pixels square on sharp screens. */
@font-face {
  font-family: "Departure Mono";
  font-style: normal;
 
  font-display: swap;
  src: url("fonts/departure-mono.woff2") format("woff2");
}

:root {
  --paper: #0c0c0e; /* page background, the unlit pixel of every dither */
  --ink: #c8ffe8; /* text and the lit pixel of every dither; the Ink control repaints it */
  --ink-soft: color-mix(in srgb, var(--ink) 66%, var(--paper)); /* captions and hints */
  --ink-faint: color-mix(in srgb, var(--ink) 24%, var(--paper)); /* hairline rules, slider tracks */
  --chip: var(--paper); /* box behind words that sit over lit cells */
  --font: "Departure Mono", ui-monospace, Menlo, monospace;
  --text-s: 11px;
  --text-m: 16.5px;
  --text-l: 22px;
  --text-xxl: clamp(33px, 4.4vw, 55px);
  --edge: clamp(16px, 4vw, 56px);
  --gap: clamp(16px, 2.4vw, 32px);
  --space-xs: 4px;
  --space-s: 8px;
  --space-m: 16px;
  --space-l: 24px;
  --line: 1px;
  --tap: 44px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --quick: 160ms;
  --blink: 1060ms;
  --pulse: 2400ms;
}

*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 400 var(--text-m)/1.4 var(--font); font-synthesis: none; -webkit-font-smoothing: antialiased; }
h1, button, input, label { font: inherit; }
canvas { display: block; }
a { color: inherit; }
::selection { background: var(--ink); color: var(--paper); }
[hidden] { display: none !important; }

.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* Top bar */
.topbar__bar { display: flex; align-items: center; justify-content: space-between; gap: var(--gap); padding: var(--space-s) var(--edge) 0; }
.topbar__brand { display: inline-flex; align-items: center; gap: var(--space-s); min-height: var(--tap); text-decoration: none; }
.topbar__mark { width: 21px; height: 21px; background: radial-gradient(circle, var(--ink) 0 40%, transparent 44%) 0 0 / 7px 7px; }
.topbar__wordmark { font-size: var(--text-l); }
.topbar__tagline { margin: 0; color: var(--ink-soft); font-size: var(--text-s); }
.topbar__fade { width: 100%; height: 36px; image-rendering: pixelated; }

/* Booth: the picture in a halo of light, with its controls beside it */
.booth { position: relative; overflow: hidden; padding: var(--space-m) var(--edge) var(--space-l); }
.booth__inner {
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(300px, 0.85fr);
  grid-template-areas: "stage intro" "stage panel";
  grid-template-rows: auto 1fr;
  gap: var(--space-m) var(--gap);
  max-width: 1180px;
  margin: 0 auto;
  align-items: start;
}
.booth__intro { grid-area: intro; }
.booth__intro, .booth__status, .booth__actions, .panel { position: relative; z-index: 1; } /* words and buttons sit over the halo */
.booth__stage { grid-area: stage; display: grid; gap: var(--space-s); }
.panel { grid-area: panel; }

.booth__title { display: inline; margin: 0; padding: 0 var(--space-s); background: var(--chip); font-size: var(--text-xxl); line-height: 1.15; box-decoration-break: clone; -webkit-box-decoration-break: clone; }
.booth__lede { max-width: 32em; margin: var(--space-m) 0 0; padding: var(--space-xs) var(--space-s); background: var(--chip); color: var(--ink-soft); }

.booth__frame { position: relative; border: var(--line) solid var(--ink); background: var(--paper); }
.booth__halo { position: absolute; inset: -4%; width: 108%; height: 108%; image-rendering: pixelated; pointer-events: none; }
.booth__picture { position: relative; width: 100%; height: auto; aspect-ratio: 1; image-rendering: pixelated; touch-action: none; cursor: grab; }
.booth__picture:active { cursor: grabbing; }
.booth__hint { position: absolute; left: var(--space-s); top: var(--space-s); padding: var(--space-xs) var(--space-s); background: var(--chip); font-size: var(--text-s); pointer-events: none; }
.booth__status { min-height: 1.4em; margin: 0; padding: 0 var(--space-s); background: var(--chip); color: var(--ink-soft); justify-self: start; }
.booth__prompt { color: var(--ink); animation: pulse var(--pulse) ease-in-out infinite; }
.booth__cursor { display: inline-block; width: 0.5em; height: 1em; margin-left: 3px; vertical-align: -0.15em; background: var(--ink); animation: blink var(--blink) steps(1) infinite; }
.booth__actions { display: flex; flex-wrap: wrap; gap: var(--space-s); }
.booth__video { position: fixed; left: 0; top: 0; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* Buttons: hover is an inversion */
.button {
  display: inline-flex; align-items: center; justify-content: center;
  min-height: var(--tap); padding: 0 var(--space-m);
  border: var(--line) solid var(--ink); border-radius: 0;
  background: var(--paper); color: var(--ink);
  font-size: var(--text-m); text-decoration: none; cursor: pointer;
  transition: background-color var(--quick) var(--ease), color var(--quick) var(--ease);
}
.button--solid { background: var(--ink); color: var(--paper); }
.button:hover, .button:focus-visible, .button:focus-within { background: var(--ink); color: var(--paper); outline: none; }
.button--solid:hover, .button--solid:focus-visible { background: var(--paper); color: var(--ink); }
.button:focus-visible, .button:focus-within { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.button:disabled { opacity: 0.4; pointer-events: none; }

/* Panel */
.panel { display: grid; gap: var(--space-m); padding: var(--space-m); border: var(--line) solid var(--ink); background: var(--chip); }
.panel__sources { display: flex; flex-wrap: wrap; gap: var(--space-s); }
.panel__cycles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-s); }
.cycle {
  display: flex; flex-direction: column; align-items: flex-start; justify-content: center; gap: 2px;
  min-height: 55px; padding: var(--space-xs) var(--space-s); text-align: left;
  border: var(--line) solid var(--ink-faint); border-radius: 0;
  background: var(--paper); color: var(--ink); cursor: pointer;
  transition: background-color var(--quick) var(--ease), color var(--quick) var(--ease), border-color var(--quick) var(--ease);
}
.cycle__name { color: var(--ink-soft); font-size: var(--text-s); transition: color var(--quick) var(--ease); }
.cycle:hover, .cycle:focus-visible { border-color: var(--ink); background: var(--ink); color: var(--paper); outline: none; }
.cycle:hover .cycle__name, .cycle:focus-visible .cycle__name { color: var(--paper); }
.cycle:focus-visible { box-shadow: 0 0 0 2px var(--paper), 0 0 0 3px var(--ink); }
.cycle:active { transform: translateY(1px); }
.cycle--random { align-items: center; border-color: var(--ink); }

.panel__sliders { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--space-xs) var(--space-m); }
.slider { display: grid; gap: 0; }
.slider__name { color: var(--ink-soft); font-size: var(--text-s); }
.slider input { appearance: none; -webkit-appearance: none; width: 100%; height: var(--tap); margin: 0; background: transparent; cursor: pointer; }
.slider input::-webkit-slider-runnable-track { height: var(--line); background: var(--ink-faint); }
.slider input::-moz-range-track { height: var(--line); background: var(--ink-faint); }
.slider input::-webkit-slider-thumb { -webkit-appearance: none; width: 14px; height: 24px; margin-top: -12px; border: 0; border-radius: 0; background: var(--ink); }
.slider input::-moz-range-thumb { width: 14px; height: 24px; border: 0; border-radius: 0; background: var(--ink); }
.slider input:focus-visible { outline: var(--line) solid var(--ink); outline-offset: -6px; }

/* Footer */
.footer { display: flex; flex-wrap: wrap; justify-content: space-between; gap: var(--space-xs) var(--gap); padding: var(--space-m) var(--edge) var(--space-l); border-top: var(--line) solid var(--ink-faint); color: var(--ink-soft); font-size: var(--text-s); }
.footer p { margin: 0; }
.footer a { display: inline-block; padding: 15px 4px; margin: -15px -4px; }

@keyframes blink { 50% { opacity: 0; } }
@keyframes pulse { 50% { opacity: 0.35; } }

@media (max-width: 860px) {
  .booth__inner { grid-template-columns: minmax(0, 1fr); grid-template-areas: "intro" "stage" "panel"; }
  .booth__stage { max-width: 560px; width: 100%; margin: 0 auto; }
  .topbar__tagline { display: none; }
}

@media (max-width: 420px) {
  .button { padding: 0 12px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}
