/* OpusDesk Games — arcade cabinet.
 *
 * The site is a dark room holding a shelf of lit screens: the brand's own ink
 * token becomes the cabinet, and its near-white token becomes both the light in
 * the text and the colour of every playfield. Two hexes are derived from the ink
 * (--up, --line); everything else is one of the nine brand tokens or that token
 * at reduced alpha, so the palette is still the brand's.
 */

:root {
  /* brand tokens */
  --canvas: #fcfbff;
  --surface: #ffffff;
  --ink: #18151f;
  --muted: #6f6878;
  --border: #eae5f0;
  --primary: #6c4dff;
  --coral: #ff7a73;
  --mint: #5ed6b3;
  --lilac: #d9d0ff;

  /* cabinet: derived from --ink, not new colours */
  --cabinet: #18151f;
  --up: #221b33;
  --line: #33294d;

  --text: #fcfbff;
  --dim: rgba(217, 208, 255, .68);
  --screen: #fcfbff;
  --bezel: #2a2240;
  --glow: 0 0 0 1px rgba(108, 77, 255, .30), 0 16px 44px rgba(108, 77, 255, .17);

  --radius: 20px;
  --container: 73rem;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body {
  margin: 0;
  min-width: 20rem;
  background: var(--cabinet);
  color: var(--text);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont,
    "Segoe UI", "PingFang TC", "Microsoft JhengHei", sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
button, select { font: inherit; }
button, a, select { -webkit-tap-highlight-color: transparent; }
h1 { margin: 0 0 .5rem; font-size: clamp(1.7rem, 3vw, 2.4rem); line-height: 1.14; letter-spacing: -.03em; }
.container { width: min(calc(100% - 2.5rem), var(--container)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; z-index: 30; top: -4rem; left: 1rem; padding: .65rem .9rem; border-radius: .5rem; background: var(--primary); color: #fff; text-decoration: none; }
.skip-link:focus { top: 1rem; }
[hidden] { display: none !important; }

:where(a, button, select, [tabindex]):focus-visible {
  outline: 3px solid var(--mint);
  outline-offset: 3px;
  border-radius: 6px;
}

/* ── header ─────────────────────────────────────────────────────── */
.site-header {
  position: sticky; z-index: 10; top: 0;
  border-bottom: 1px solid var(--line);
  background: rgba(24, 21, 31, .88);
  backdrop-filter: blur(14px);
}
.header-inner { display: flex; align-items: center; justify-content: space-between; min-height: 4.4rem; gap: 1.2rem; flex-wrap: wrap; }
.brand { display: inline-flex; gap: .6rem; align-items: center; text-decoration: none; font-weight: 760; letter-spacing: -.035em; white-space: nowrap; }
.brand img { display: block; }
.brand em { font-style: normal; color: var(--lilac); }
.primary-nav { display: flex; gap: .6rem; align-items: center; font-size: .9rem; font-weight: 650; flex-wrap: wrap; }
.unit-nav-link {
  display: inline-flex; align-items: center; gap: .45rem; min-height: 2.35rem;
  padding: .3rem .8rem; border: 1px solid var(--line); border-radius: 999px;
  color: var(--text); text-decoration: none;
  transition: border-color .18s ease, color .18s ease;
}
.unit-nav-link:hover { border-color: var(--primary); color: var(--lilac); }
.unit-nav-dot { width: .5rem; height: .5rem; border-radius: 50%; background: var(--mint); box-shadow: 0 0 10px var(--mint); }
.language-picker select {
  appearance: none; border: 1px solid var(--line); border-radius: 999px;
  padding: .4rem 1.7rem .4rem .8rem; color: var(--text); background: var(--up)
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='m4 6 4 4 4-4' fill='none' stroke='%23d9d0ff' stroke-linecap='round' stroke-linejoin='round' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right .55rem center / .85rem;
  cursor: pointer;
}

/* ── shelf ──────────────────────────────────────────────────────── */
.view { padding: clamp(2.2rem, 5vw, 3.6rem) 0 4rem; }

.featured {
  display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  gap: clamp(1.2rem, 3vw, 2.6rem); align-items: center;
  padding: clamp(1rem, 2.4vw, 1.6rem);
  border: 1px solid var(--line); border-radius: var(--radius); background: var(--up);
}
.featured-screen {
  border-radius: 12px; border: 3px solid var(--bezel); background: var(--screen);
  box-shadow: var(--glow); aspect-ratio: 4 / 3; display: grid; place-items: center; padding: 1rem;
}
.featured-screen svg { width: 100%; height: 100%; display: block; }
.featured-copy { display: grid; gap: .7rem; justify-items: start; }
.featured-note { margin: 0; color: var(--dim); font-size: .82rem; }
.featured h2 { margin: 0; font-size: clamp(1.5rem, 2.6vw, 2.1rem); letter-spacing: -.025em; }
.featured-hint { margin: 0; color: var(--dim); }

.button {
  display: inline-flex; align-items: center; gap: .5rem; min-height: 2.7rem;
  padding: .5rem 1.3rem; border: 0; border-radius: 999px;
  background: var(--primary); color: #fff; font-weight: 700; text-decoration: none; cursor: pointer;
  transition: box-shadow .18s ease, transform .18s ease;
}
.button:hover { box-shadow: 0 12px 28px rgba(108, 77, 255, .34); transform: translateY(-1px); }
.button.is-quiet { background: transparent; border: 1px solid var(--line); color: var(--text); font-weight: 650; }
.button.is-quiet:hover { border-color: var(--primary); box-shadow: none; transform: none; }

.filters { display: flex; flex-wrap: wrap; gap: .5rem; margin: clamp(1.8rem, 4vw, 2.6rem) 0 1.3rem; }
.chip {
  border: 1px solid var(--line); border-radius: 999px; background: transparent;
  color: var(--dim); padding: .42rem 1rem; font-weight: 650; font-size: .9rem; cursor: pointer;
  transition: border-color .16s ease, color .16s ease, background .16s ease;
}
.chip:hover { border-color: var(--primary); color: var(--text); }
.chip[aria-pressed="true"] { background: var(--primary); border-color: var(--primary); color: #fff; }

.monitors { display: grid; grid-template-columns: repeat(auto-fill, minmax(14rem, 1fr)); gap: clamp(1rem, 2vw, 1.5rem); margin: 0; padding: 0; list-style: none; }
.monitor { display: grid; gap: .65rem; text-decoration: none; }
.monitor-screen {
  position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; padding: .9rem;
  border: 3px solid var(--bezel); border-radius: 14px; background: var(--screen);
  transition: border-color .18s ease, box-shadow .18s ease;
}
.monitor-screen svg { width: 100%; height: 100%; display: block; }
.monitor:hover .monitor-screen, .monitor:focus-visible .monitor-screen { border-color: var(--primary); box-shadow: var(--glow); }
.monitor-play {
  position: absolute; right: .55rem; bottom: .55rem;
  display: inline-flex; align-items: center; gap: .35rem;
  padding: .28rem .6rem; border-radius: 999px; background: var(--ink); color: var(--screen);
  font-size: .76rem; font-weight: 700; opacity: 0; transition: opacity .16s ease;
}
.monitor:hover .monitor-play, .monitor:focus-visible .monitor-play { opacity: 1; }
.monitor-body { display: grid; gap: .1rem; }
.monitor-title { font-size: 1.05rem; font-weight: 720; letter-spacing: -.015em; }
.monitor-hint { color: var(--dim); font-size: .84rem; }
.monitor.is-dead .monitor-screen { border-style: dashed; }
.monitor.is-dead .monitor-play { display: none; }

/* ── play view ──────────────────────────────────────────────────── */
.play-head { display: flex; align-items: baseline; gap: 1rem; flex-wrap: wrap; margin-bottom: 1.4rem; }
.play-back { color: var(--dim); font-size: .9rem; font-weight: 650; text-decoration: none; }
.play-back:hover { color: var(--lilac); }
.play-head h1 { margin: 0; }

.play-layout { display: grid; grid-template-columns: minmax(0, 1fr) minmax(15rem, 19rem); gap: clamp(1.4rem, 3vw, 2.6rem); align-items: start; }
.stage { padding: clamp(.9rem, 2vw, 1.4rem); border: 1px solid var(--line); border-radius: var(--radius); background: var(--up); }
.readout { display: flex; gap: 1.8rem; padding: 0 .2rem .9rem; }
.readout-item { display: grid; gap: .05rem; }
.readout-label { color: var(--dim); font-size: .7rem; font-weight: 650; }
.readout-value { font-size: 1.35rem; font-weight: 760; font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.stage-host { display: grid; place-items: center; }
.stage-host canvas {
  display: block; width: auto; height: auto; max-width: 100%;
  border: 3px solid var(--bezel); border-radius: 12px; background: var(--screen);
  box-shadow: var(--glow); touch-action: none; image-rendering: pixelated;
}
.stage-status { min-height: 1.5rem; margin: .8rem 0 0; color: var(--dim); font-size: .9rem; text-align: center; }

.side { display: grid; gap: 1.1rem; }
.controls { display: flex; flex-wrap: wrap; gap: .5rem; }
.key-map { display: grid; grid-template-columns: auto 1fr; gap: .5rem 1rem; margin: 0; font-size: .88rem; }
.key-map dt { color: var(--dim); }
.key-map dd { margin: 0; }
kbd {
  display: inline-block; min-width: 1.55rem; padding: .08rem .36rem;
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: .35rem;
  background: var(--cabinet); font-family: inherit; font-size: .8rem; text-align: center;
}

/* ── footer ─────────────────────────────────────────────────────── */
.site-footer { border-top: 1px solid var(--line); }
.footer-inner { display: flex; justify-content: space-between; gap: 1rem; padding: 1.7rem 0; flex-wrap: wrap; font-size: .88rem; }

/* Fullscreen: the cabinet frame gets out of the way and the screen scales up by
   whole factors, so it stays sharp instead of blurring. */
.stage:fullscreen {
  display: grid; align-content: center; justify-items: center;
  border: 0; border-radius: 0; background: var(--cabinet); padding: 2.5vmin; overflow: auto;
}
.stage:fullscreen .readout { width: 100%; justify-content: center; }
.stage:fullscreen .stage-host { width: 100%; }
.stage:fullscreen .stage-status { width: 100%; }

@media (max-width: 62rem) {
  .featured { grid-template-columns: minmax(0, 1fr); }
  .play-layout { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 34rem) {
  .header-inner { min-height: 0; padding: .8rem 0; }
  .primary-nav { width: 100%; }
  .readout { gap: 1.2rem; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
  .button:hover { transform: none; }
}
