/* the department of nothing: simple and flat, with neon accents. tokens, fonts, shared chrome, dark/light */

/* all fonts are self-hosted (sil open font licence, see assets/fonts/) so no request leaves the site */
@font-face {
  font-family: "Chakra Petch";
  src: url("/assets/fonts/chakra-petch-latin-600.woff2") format("woff2");
  font-weight: 600;
  font-display: swap;
}

@font-face {
  font-family: "Chakra Petch";
  src: url("/assets/fonts/chakra-petch-latin-700.woff2") format("woff2");
  font-weight: 700;
  font-display: swap;
}

@font-face {
  font-family: "Saira";
  src: url("/assets/fonts/saira-latin-wght.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-400.woff2") format("woff2");
  font-weight: 400;
  font-display: swap;
}

@font-face {
  font-family: "IBM Plex Mono";
  src: url("/assets/fonts/ibm-plex-mono-latin-600.woff2") format("woff2");
  font-weight: 600 700;
  font-display: swap;
}

:root {
  color-scheme: dark;

  --bg: #0e0f15;
  --surface: #161822; /* boxes, cards, inputs */
  --raised: #1d2030;
  --text: #ecedf5;
  --muted: #9a9db3;
  --border: #2a2d3e;
  --rule: #222534;
  --accent: #a78bfa;
  --accent-strong: #8b5cf6;
  --link: #c4b5fd;
  --online: #4ade80;
  --gold: #fbbf24;
  --focus: #c4b5fd;
  --selection: rgb(167 139 250 / 0.18);
  --selection-text: var(--text);
  --glow: 1; /* neon glow strength, turned down in light mode */

  /* older names the machine stylesheets still use */
  --panel: var(--surface);
  --field: var(--surface);
  --glass: var(--surface);
  --glass-strong: var(--raised);
  --glass-border: var(--border);
  --accent-gradient: linear-gradient(135deg, #8b5cf6, #ec4899);
  --brand-line: var(--accent);
  --stamp: var(--gold);
  --radius: 10px;

  --display: "Chakra Petch", "Saira", system-ui, sans-serif;
  --font: "Saira", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, Consolas, monospace;
  --width: 880px;
}

@media (prefers-color-scheme: light) {
  :root {
    color-scheme: light;
    --bg: #fafafc;
    --surface: #ffffff;
    --raised: #f1f1f6;
    --text: #15161f;
    --muted: #5b5e73;
    --border: #dcdde6;
    --rule: #ebebf1;
    --accent: #7c3aed;
    --accent-strong: #6d28d9;
    --link: #6d28d9;
    --online: #15803d;
    --gold: #b45309;
    --focus: #7c3aed;
    --selection: rgb(124 58 237 / 0.1);
    --glow: 0.45;
  }
}

/* each machine's neon colour, used for its icon, tags and glow */
[data-mode="the-button"] { --tile: #f43f5e; }
[data-mode="do-not-press"] { --tile: #f59e0b; }
[data-mode="3am"] { --tile: #818cf8; }
[data-mode="tab-endurance"] { --tile: #22d3ee; }
[data-mode="hold"] { --tile: #3b82f6; }
[data-mode="waiting-room"] { --tile: #84cc16; }
[data-mode="progress-bar"] { --tile: #10b981; }
[data-mode="unsubscribe"] { --tile: #ec4899; }
[data-mode="coin-flip"] { --tile: #eab308; }
[data-mode="someone-else"] { --tile: #a1a1aa; }

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

body {
  margin: 0;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--text);
  font: 17px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--link); }

/* keeps the hidden attribute working even on elements styled with display */
[hidden] { display: none !important; }

/* readable by screen readers, invisible on screen */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

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

::selection {
  background: var(--accent);
  color: #ffffff;
}

/* kills animations for people who asked for less motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

.skip-link {
  position: absolute;
  left: 8px;
  top: -100px;
  z-index: 50;
  padding: 8px 14px;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #ffffff;
}

.skip-link:focus {
  top: 8px;
}

/* ---------- header and footer ---------- */

.site-header {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px max(16px, (100% - var(--width)) / 2);
  border-bottom: 1px solid var(--rule);
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  color: var(--text);
  font: 700 1.05rem/1.1 var(--display);
  letter-spacing: 0.06em;
  text-decoration: none;
  text-transform: uppercase;
}

/* the site icon: a neon browser window showing a 404 */
.logo-mark {
  flex: none;
  width: 28px;
  height: 28px;
}

.site-footer {
  padding: 24px 16px 20px;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.85rem;
  text-align: center;
}

.site-footer p {
  margin: 0;
}

/* the small maker's credit at the very bottom */
.built-by {
  margin-top: 10px !important;
  font-size: 0.75rem;
}

.built-by a {
  color: inherit;
}

.built-by a:hover {
  color: var(--link);
}

/* ---------- the page ---------- */

main {
  flex: 1;
  width: min(100% - 32px, var(--width));
  margin: 0 auto;
  padding: 20px 0 56px;
}

/* the "back to the machines" link on every machine page */
.back-link {
  color: var(--muted);
  font-size: 0.9rem;
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.mode-header {
  display: grid;
  justify-items: center;
  gap: 10px;
  padding: 16px 0 28px;
  text-align: center;
}

/* the machine's icon, glowing in its own colour */
.mode-icon-large {
  width: 44px;
  height: 44px;
  color: var(--tile);
  filter: drop-shadow(0 0 calc(10px * var(--glow)) var(--tile));
}

.tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px;
  margin: 0;
}

.tag {
  padding: 1px 10px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-size: 0.8rem;
}

.tag-mode {
  border-color: color-mix(in srgb, var(--tile) 55%, transparent);
  color: var(--tile);
  font: 600 0.8rem var(--display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* neon on white is hard to read, so the colour darkens a little in light mode */
@media (prefers-color-scheme: light) {
  .mode-icon-large,
  .tag-mode {
    color: color-mix(in srgb, var(--tile) 78%, #000);
  }
}

main h1 {
  margin: 0;
  font: 700 clamp(1.9rem, 5vw, 2.6rem)/1.1 var(--display);
  letter-spacing: 0.01em;
}

main .description {
  max-width: 44ch;
  margin: 0;
  color: var(--muted);
}

/* the plain box each machine sits in */
.play-area {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 8px;
  padding: 40px 24px;
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
  text-align: center;
}

/* status lines become a small notice once they have something to say */
.status {
  min-height: 1.5em;
  max-width: 44ch;
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 0.95rem;
}

.status:not(:empty) {
  padding: 8px 14px;
  border: 1px solid var(--border);
  border-left: 3px solid var(--accent);
  border-radius: 8px;
  background: var(--raised);
  color: var(--text);
  text-align: left;
}

/* fine print and house rules */
.rules {
  max-width: 50ch;
  margin: 28px 0 0;
  color: var(--muted);
  font-size: 0.9rem;
}

/* big tabular numbers: counters, clocks, timers, with a faint glow */
.counter {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
  text-shadow: 0 0 calc(18px * var(--glow)) color-mix(in srgb, var(--tile, var(--accent)) 50%, transparent);
}

/* ---------- shared controls ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 20px;
  border: none;
  border-radius: 8px;
  background: var(--accent-strong);
  color: #ffffff;
  font: 600 1rem/1.2 var(--font);
  cursor: pointer;
}

.button:hover {
  background: var(--accent);
}

.button:disabled {
  opacity: 0.55;
  cursor: progress;
}

.button-secondary {
  border: 1px solid var(--border);
  background: var(--raised);
  color: var(--text);
}

.button-secondary:hover {
  background: var(--raised);
  border-color: var(--accent);
}

/* the big glowing action button the pressing modes are built around.
   each machine sets --tone to its own colour */
.action-button {
  --size: min(56vw, 220px);
  --tone: var(--accent);
  position: relative;
  display: grid;
  place-content: center;
  width: var(--size);
  height: var(--size);
  border: 2px solid var(--tone);
  border-radius: 50%;
  background: radial-gradient(circle at 50% 40%, color-mix(in srgb, var(--tone) 22%, transparent), transparent 72%), var(--surface);
  box-shadow: 0 0 calc(36px * var(--glow)) color-mix(in srgb, var(--tone) 40%, transparent);
  color: var(--text);
  font: 700 1.2rem/1 var(--display);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  cursor: pointer;
  touch-action: manipulation; /* stops double-tap zoom when pressing fast */
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: transform 90ms ease-out, box-shadow 160ms ease-out;
}

.action-button:hover {
  box-shadow: 0 0 calc(52px * var(--glow)) color-mix(in srgb, var(--tone) 55%, transparent);
}

/* pressed: sinks in and flares up */
.action-button:active,
.action-button.is-pressed,
.action-button[aria-pressed="true"] {
  transform: scale(0.95);
  background: radial-gradient(circle at 50% 45%, color-mix(in srgb, var(--tone) 45%, transparent), transparent 78%), var(--surface);
  box-shadow: 0 0 calc(70px * var(--glow)) color-mix(in srgb, var(--tone) 70%, transparent);
}

.action-button:focus-visible {
  outline-offset: 10px;
}

/* a bordered box for lists and reports */
.box {
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--bg);
}

/* a little gold badge stuck on a result */
.stamp {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 2px 10px;
  border: 1px solid var(--gold);
  border-radius: 999px;
  color: var(--gold);
  font: 700 0.75rem/1.4 var(--display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.stamp::before {
  content: "★";
}
