/* ==========================================================================
   Newbit Games — static site styles
   No build step, no external requests.
   ========================================================================== */

/* Space Grotesk (variable, wght 300–700), SIL OFL — latin + latin-ext */
@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-ext-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}

@font-face {
  font-family: "Space Grotesk";
  src: url("../fonts/space-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 700;
  font-style: normal;
  font-display: swap;
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

@font-face {
  font-family: "Geist Mono";
  src: url("../fonts/GeistMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  /* the site is already dark: browsers must not apply forced / auto dark mode */
  color-scheme: dark;
  --bg: #000;
  --bg-elev: #0a0a0a;
  --bg-elev-2: #111;
  --text: #ededed;
  --text-muted: #a1a1a1;
  --text-faint: #6b6b6b;
  --border: rgba(255, 255, 255, 0.1);
  --border-strong: rgba(255, 255, 255, 0.15);
  --accent: #67DFEA;
  --accent-glow: rgba(103, 223, 234, 0.45);

  --font-sans: "Space Grotesk", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  --page-pad: clamp(20px, 4vw, 96px);
  --page-pad-l: max(var(--page-pad), env(safe-area-inset-left, 0px));
  --page-pad-r: max(var(--page-pad), env(safe-area-inset-right, 0px));
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --header-h: 64px;
  --radius: 12px;
  --radius-lg: 16px;
}

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

html {
  -webkit-tap-highlight-color: transparent;
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-padding-top: calc(var(--header-h) + 16px);
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 16px;
  line-height: 1.6;
  letter-spacing: -0.01em;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  overflow-x: hidden;
}

img, svg { display: block; max-width: 100%; }
a { color: inherit; text-decoration: none; }
ul { margin: 0; padding: 0; list-style: none; }
h1, h2, h3, p { margin: 0; }

::selection { background: color-mix(in srgb, var(--accent) 30%, transparent); color: #fff; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 6px;
}

[tabindex="-1"]:focus { outline: none; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  left: 16px;
  top: -100px;
  z-index: 100;
  padding: 8px 14px;
  background: var(--text);
  color: #000;
  border-radius: 999px;
  font-weight: 500;
}
.skip-link:focus { top: 12px; }

.mono-label,
.eyebrow,
.fact-index {
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

/* ---------- Buttons ---------- */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 48px;
  padding: 0 24px;
  border-radius: 999px;
  font-size: 16px;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1;
  white-space: nowrap;
  border: 1px solid transparent;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn-sm { height: 36px; padding: 0 16px; font-size: 14px; }

.btn-primary { background: var(--text); color: #0a0a0a; }
.btn-primary:hover { background: #cfcfcf; }

.btn-secondary {
  background: var(--bg-elev);
  color: var(--text);
  border-color: var(--border-strong);
}
.btn-secondary:hover { background: #1a1a1a; border-color: rgba(255, 255, 255, 0.25); }

.btn:focus-visible { outline-offset: 3px; border-radius: 999px; }

/* ---------- Header ---------- */

.site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  height: calc(var(--header-h) + var(--safe-top));
  padding-top: var(--safe-top);
  border-bottom: 1px solid transparent;
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.site-header.is-scrolled {
  background: rgba(0, 0, 0, 0.7);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: saturate(180%) blur(12px);
  backdrop-filter: saturate(180%) blur(12px);
}

.header-inner {
  height: 100%;
  padding: 0 var(--page-pad-r) 0 var(--page-pad-l);
  display: flex;
  align-items: center;
  gap: 32px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 500;
  letter-spacing: -0.02em;
  font-size: 16px;
}

/* Logo: thin outline, stroke width is set per placement (non-scaling stroke). */
.logo-mark { overflow: visible; flex: none; }
.brand-mark { width: 24px; height: 24px; color: var(--text); stroke-width: 1.5px; }
.site-header .brand-name,
.mobile-menu .brand-name { color: var(--accent); }
.site-footer .brand { color: var(--text-muted); }
.site-footer .brand-mark { width: 20px; height: 20px; color: var(--text-muted); stroke-width: 1.25px; }

.site-nav ul { display: flex; gap: 4px; }
.site-nav a {
  display: block;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 14px;
  color: var(--text-muted);
  transition: color 0.15s ease, background-color 0.15s ease;
}
.site-nav a:hover,
.site-nav a:focus-visible { color: var(--accent); background: rgba(255, 255, 255, 0.06); }

.header-actions { margin-left: auto; display: flex; gap: 8px; }

/* ---------- Mobile menu (shown below 768px) ---------- */

.menu-toggle,
.mobile-menu { display: none; }
html.menu-open,
html.menu-open body { overflow: hidden; }

/* ---------- Frame: section lines like a blueprint ---------- */

.frame { position: relative; }
.frame + .frame { border-top: 1px solid var(--border); }

/* ---------- Hero ---------- */

.hero {
  /* full first screen: viewport minus the sticky header (vh fallback, then svh) */
  min-height: calc(100vh - var(--header-h) - var(--safe-top));
  min-height: calc(100svh - var(--header-h) - var(--safe-top));
  padding: clamp(56px, 10vw, 128px) var(--page-pad-r) clamp(56px, 10vw, 128px) var(--page-pad-l);
  display: flex;
  flex-direction: column;
  justify-content: center;
  overflow: hidden;
}

.hero-grid {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr minmax(200px, 360px) 1fr;
  align-items: center;
  gap: clamp(24px, 4vw, 56px);
}

.hero-title {
  font-size: clamp(56px, 9vw, 112px);
  line-height: 0.95;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.hero-figure {
  position: relative;
  aspect-ratio: 1;
  display: grid;
  place-items: center;
}

/* Hero mark: stacked SVG layers (glow, orbits, mark), all with the same viewBox.
   Only opacity is animated, blur filters are rasterised once. */
.hero-mark {
  position: relative;
  width: 72%;
  aspect-ratio: 1;
  color: var(--text);
}
.hero-layer {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
}
/* explicit paint order (never changed by the mobile rules, they only hide layers):
   glow (1) < orbit back halves (2) < black mark (3) < orbit front halves (4) */
.hero-mark { isolation: isolate; }
.glow-group { z-index: 1; pointer-events: none; }
.glow-group .hero-layer { pointer-events: none; }
.orbits-back { z-index: 2; }
.layer-mark {
  z-index: 3;
  opacity: 1;
  /* its own GPU layer, so the compositor always draws it above the animated glow layers */
  will-change: transform;
}
.orbits-front { z-index: 4; }
.layer-swarm { z-index: 4; pointer-events: none; } /* chaos swarm (comets.js): after .orbits-front in the DOM, always over the mark */
/* full-quality blur by default; the lite copies are shown on phones / touch devices */
.glow-lite { display: none; }
.layer-mark { stroke-width: 1.5px; }
.dot-halo, .dot-core, .dot-trail { stroke: none; }
.dot-trail { fill: var(--accent); }
/* comet collision flash (elements are pooled and animated from main.js: transform + opacity only) */
.flash-core,
.flash-spark { fill: #fff; stroke: none; }
.flash-halo { stroke: none; }
.flash-halo-rim { stop-color: var(--accent-glow); stop-opacity: 0.55; } /* ~0.25 accent near the halo edge */
.flash-ring { fill: none; stroke: #fff; stroke-width: 1px; vector-effect: non-scaling-stroke; }
.dot-flash { fill: #fff; stroke: none; } /* comet head turning white for a moment after a hit */
.dot-core { fill: var(--accent); }
.halo-stop-in  { stop-color: var(--accent-glow); stop-opacity: 1; }
.halo-stop-out { stop-color: var(--accent-glow); stop-opacity: 0; }

/* All glow layers: overall brightness is driven by the cursor (JS sets --glow-intensity, 0.8 by default). */
.glow-group {
  position: absolute;
  inset: 0;
  /* z-index / pointer-events: see the paint order block above */
  opacity: var(--glow-intensity, 0.8);
  will-change: opacity;
}

/* Static state (also used for prefers-reduced-motion): light from the top, no movement. */
.glow-wide-wrap {
  position: absolute;
  inset: 0;
  /* owned by JS: cursor "boost", --glow-scale is 1 … ~1.4 */
  transform: scale(var(--glow-scale, 1));
  will-change: transform;
}
/* owned by CSS: no JS writes on these layers, otherwise they would fight the keyframes */
.layer-wide { opacity: 0.22; will-change: opacity; }
.layer-glow { opacity: 0.25; will-change: opacity; }
.glow-top { opacity: 1; }

@media (prefers-reduced-motion: no-preference) {
  .layer-wide { animation: glow-breathe 8s ease-in-out infinite alternate; }
  .layer-glow { animation: glow-orbit 7s ease-in-out infinite; }
  /* 7s cycle, peak at 25% (1.75s). Quarter-cycle offsets (0, -1.75, -3.5, -5.25s) put the peaks at
     0s (top), 1.75s (right), 3.5s (bottom), 5.25s (left): the light walks clockwise. */
  .glow-top    { animation-delay: -1.75s; }
  .glow-right  { animation-delay: 0s; }
  .glow-bottom { animation-delay: -5.25s; }
  .glow-left   { animation-delay: -3.5s; }
  /* pause everything while the hero is off screen */
  .hero.is-offscreen .layer-wide,
  .hero.is-offscreen .layer-glow { animation-play-state: paused; }
}

@keyframes glow-breathe {
  from { opacity: 0.20; }
  to   { opacity: 0.26; }
}
@keyframes glow-orbit {
  /* a layer rests at 0.08 between peaks: the sum never goes dark, the bright edge stays easy to follow */
  0%   { opacity: 0.08; }
  25%  { opacity: 1; }
  50%  { opacity: 0.08; }
  100% { opacity: 0.08; }
}

.hero-facts {
  justify-self: end;
  display: grid;
  gap: 0;
  min-width: 220px;
  border-top: 1px solid var(--border);
}
.hero-facts li {
  display: flex;
  align-items: baseline;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 18px;
  letter-spacing: -0.01em;
}
.fact-index { color: var(--accent); }

/* Scroll hint at the bottom of the hero */
.scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 16px;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  color: var(--text-muted);
  opacity: 0.5;
  transition: opacity 0.3s ease;
  pointer-events: none;
}
.scroll-hint.is-hidden { opacity: 0; }
.scroll-hint-line { width: 1px; height: 22px; background: currentColor; }

/* Comet catching (comets.js / main.js): crosshair over a catchable comet, counter in the bottom-left corner */
.is-aiming,
.is-aiming * { cursor: crosshair !important; }
.catch-box {
  position: absolute;
  left: var(--page-pad-l);
  bottom: 36px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted); /* #a1a1a1 */
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.5s ease, visibility 0s linear 0.5s;
}
.catch-box.is-shown { opacity: 1; visibility: visible; transition: opacity 0.5s ease; }
.catch-num { color: var(--accent); transition: color 0.2s ease; }
.catch-num.is-hot { color: #fff; transition: none; }
.catch-note {
  position: absolute;
  left: 0;
  top: 100%;
  margin-top: 4px;
  white-space: nowrap;
  opacity: 0;
  transition: opacity 0.4s ease;
}
.catch-note.is-shown { opacity: 1; }
/* chaos mode label + countdown (main.js), bottom-right corner of the hero */
.chaos-box {
  position: absolute;
  right: var(--page-pad-r);
  bottom: 36px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--accent);
  text-align: right;
  pointer-events: none;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}
.chaos-box.is-shown { opacity: 1; visibility: visible; transition: opacity 0.4s ease; }
.chaos-num { display: inline-block; min-width: 2ch; text-align: right; }
.scroll-hint-arrow {
  width: 7px;
  height: 7px;
  margin-top: -5px;
  border-right: 1px solid currentColor;
  border-bottom: 1px solid currentColor;
  transform: rotate(45deg);
  animation: hint-bob 2.4s ease-in-out infinite;
}
@keyframes hint-bob {
  0%, 100% { translate: 0 0; }
  50%      { translate: 0 4px; }
}

/* ---------- Sections ---------- */

.section { padding: clamp(56px, 8vw, 104px) var(--page-pad-r) clamp(56px, 8vw, 104px) var(--page-pad-l); }

.section-head { margin-bottom: 40px; }
.eyebrow { margin-bottom: 12px; color: var(--accent); }
.section-title {
  font-size: clamp(32px, 5vw, 48px);
  line-height: 1.05;
  font-weight: 500;
  letter-spacing: -0.045em;
}

.split {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1.2fr);
  gap: clamp(24px, 5vw, 80px);
  align-items: start;
}
.split .section-head { margin-bottom: 0; }

.prose p {
  color: var(--text-muted);
  font-size: clamp(17px, 1.6vw, 20px);
  line-height: 1.6;
  max-width: 60ch;
}
.prose p + p { margin-top: 1em; }

/* Terminal lines (terminal.js; the static text is also the final / no-JS / reduced-motion state).
   :is() lifts the specificity above ".prose p" without !important. */
:is(.terminal, .prose .terminal) {
  position: relative;
  max-width: none;
  margin: 0 0 20px;
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.6;
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: var(--text-muted);
}
.prose .terminal + p { margin-top: 0; }
.terminal.terminal--games { margin-bottom: 16px; }
.terminal.terminal--contact { margin-bottom: 24px; }
.terminal.terminal--404 { display: inline-block; margin: 0 0 12px; text-align: left; }
.term-prompt,
.term-cursor { color: var(--accent); }
.term-anim { position: absolute; left: 0; top: 0; white-space: pre; pointer-events: none; }
/* while it plays, the real line keeps its place (and stays readable for screen readers) but is not painted */
html.js-term .terminal:not(.is-done) :is(.term-line, .term-line .term-prompt) { color: transparent; }

/* ---------- Games ---------- */

.game-card--featured {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-elev);
  overflow: hidden;
}

.game-cover {
  position: relative;
  min-height: 320px;
  display: grid;
  place-items: center;
  border-right: 1px solid var(--border);
  background:
    radial-gradient(ellipse at 50% 120%, rgba(255, 255, 255, 0.1), transparent 60%),
    linear-gradient(rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, rgba(255, 255, 255, 0.05) 1px, transparent 1px) 0 0 / 32px 32px,
    #050505;
}
.game-cover-label {
  font-family: var(--font-mono);
  font-size: clamp(48px, 8vw, 96px);
  letter-spacing: -0.03em;
  color: rgba(237, 237, 237, 0.9);
  text-shadow: 0 0 32px rgba(255, 255, 255, 0.25);
}

.game-body {
  padding: clamp(24px, 4vw, 40px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: flex-start;
  gap: 16px;
}

/* development progress (values: assets/js/progress.js) */
.dev-progress { width: 100%; max-width: 360px; }
.dev-progress-head {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 10px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.dp-acc { color: var(--accent); }
.dev-progress-track {
  height: 2px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
}
.dev-progress-fill {
  height: 100%;
  background: var(--accent);
  transform-origin: left center;
}
.dev-progress-fill.is-filling { transition: transform 1.2s cubic-bezier(0.22, 1, 0.36, 1); } /* ease-out */
.dev-dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 8px var(--accent-glow);
}
@media (prefers-reduced-motion: no-preference) {
  .dev-dot { animation: dot-pulse 2.4s ease-in-out infinite; }
}
@keyframes dot-pulse {
  0%, 100% { opacity: 1; }
  50%      { opacity: 0.35; }
}

.game-title {
  font-size: clamp(28px, 4vw, 40px);
  line-height: 1.1;
  font-weight: 500;
  letter-spacing: -0.045em;
}
.game-desc { color: var(--text-muted); font-size: 17px; max-width: 44ch; }
.game-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }

.games-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.game-slot {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: 160px;
  padding: 24px;
  border: 1px dashed var(--border-strong);
  border-radius: var(--radius);
}
.game-slot p { font-size: 18px; font-weight: 500; letter-spacing: -0.02em; color: var(--text-muted); }
.slot-note { margin-top: auto; font-size: 14px; color: var(--text-faint); }

/* ---------- Contact ---------- */

.contact-emails { display: grid; gap: 28px; }
.contact-row[hidden] { display: none; }
.contact-label {
  display: block;
  margin-bottom: 6px;
  font-family: var(--font-mono);
  font-size: 12px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.contact-email {
  display: inline-block;
  font-size: clamp(24px, 4vw, 40px);
  font-weight: 500;
  letter-spacing: -0.03em;
  border-bottom: 1px solid var(--border-strong);
  padding-bottom: 4px;
  transition: border-color 0.15s ease, color 0.15s ease;
  overflow-wrap: anywhere;
}
.contact-email:hover,
.contact-email:focus-visible { color: var(--accent); border-color: var(--accent); }

.social-list { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

/* ---------- Footer ---------- */

.site-footer {
  padding: 56px var(--page-pad-r) calc(32px + var(--safe-bottom)) var(--page-pad-l);
  border-top: 1px solid var(--border);
}
.footer-grid {
  display: grid;
  grid-template-columns: 2fr repeat(3, 1fr);
  gap: 32px;
}
.footer-note { margin-top: 12px; color: var(--text-muted); font-size: 14px; }
.footer-heading { font-size: 14px; font-weight: 500; margin-bottom: 14px; }
.footer-col li + li { margin-top: 10px; }
.footer-col a { font-size: 14px; color: var(--text-muted); transition: color 0.15s ease; }
.footer-col a:hover,
.footer-col a:focus-visible { color: var(--accent); }

.footer-bottom {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 12px;
  margin-top: 48px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-muted);
}

/* ---------- 404 page ---------- */

.not-found {
  min-height: calc(100vh - var(--header-h) - 89px);
  min-height: calc(100svh - var(--header-h) - 89px);
  padding: clamp(56px, 10vw, 128px) var(--page-pad-r) clamp(56px, 10vw, 128px) var(--page-pad-l);
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: center;
}
.not-found-title {
  font-size: clamp(96px, 18vw, 220px);
  line-height: 0.9;
  font-weight: 500;
  letter-spacing: -0.045em;
}
.not-found-text {
  margin: 20px 0 36px;
  color: var(--text-muted);
  font-size: clamp(18px, 2vw, 22px);
}
/* 404 mini-game (404.js): mark with comets on top, centred text below */
.nf-game {
  align-items: center;
  text-align: center;
  overflow: hidden; /* comets never cause horizontal scrolling */
}
.nf-figure {
  position: relative;
  width: clamp(140px, 18vw, 220px);
  aspect-ratio: 1;
  margin: 40px auto 72px; /* room for the orbits above / below the mark */
}
.nf-figure .hero-mark { width: 100%; }
.nf-game .not-found-title { font-size: clamp(64px, 9vw, 112px); }
.nf-game .not-found-text { margin: 16px 0 12px; }
.nf-counter {
  margin-bottom: 32px;
  font-family: var(--font-mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  color: var(--text-muted);
}
.nf-num { color: var(--accent); }
.nf-game .not-found-text:has(+ .nf-counter[hidden]) { margin-bottom: 36px; }
/* light glow variant everywhere (as on phones) and all three comets */
.nf-figure .glow-full,
.nf-figure .glow-right,
.nf-figure .glow-left { display: none; }
.nf-figure .glow-lite { display: inline; }
.nf-figure .orbit-3 { display: inline; }
.site-footer--compact { padding-top: 0; }
.site-footer--compact .footer-bottom { margin-top: 0; border-top: 0; }

/* ---------- Pixel cat (assets/js/cat.js) ---------- */
/* Lives on the divider lines; created by JS only. Sprite: 16 frames of 16×16, scaled ×3 (×2.5 on phones). */

.cat {
  --cat-s: 48px;
  position: absolute;
  left: 0;
  bottom: calc(100% + 1px); /* feet exactly on the top edge of the 1px border line */
  z-index: 2;
  width: var(--cat-s);
  height: var(--cat-s);
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: none;
  color: inherit;
  font: inherit;
  cursor: pointer;
  overflow: visible;
  will-change: transform;
  -webkit-tap-highlight-color: transparent;
}
.cat::before { content: ""; position: absolute; inset: -4px -2px 0; } /* tap area >= 44×44 on phones */
.cat:focus-visible { outline-offset: 2px; border-radius: 4px; }
.cat--flying { pointer-events: none; } /* mid-air between lines: may pass over text, never catches clicks */
.cat-body,
.cat-sprite { position: absolute; inset: 0; display: block; }
.cat-sprite {
  background: url("../img/cat-sprite.png") 0 0 / calc(var(--cat-s) * 16) var(--cat-s) no-repeat;
  image-rendering: pixelated;
}

.cat-fx { position: absolute; pointer-events: none; user-select: none; white-space: nowrap; }
.cat-z {
  bottom: calc(var(--cat-s) * 0.5);
  font: 11px/1 var(--font-mono);
  color: var(--text-muted);
  opacity: 0;
  animation: cat-z 2.4s linear forwards;
}
.cat-z--static { opacity: 1; animation: none; }
.cat-heart {
  bottom: calc(var(--cat-s) + 2px);
  width: calc(var(--cat-s) * 7 / 16);
  height: auto;
  margin-left: calc(var(--cat-s) * -7 / 32);
  image-rendering: pixelated;
  animation: cat-rise 0.8s ease-out forwards;
}
.cat-mrrp {
  bottom: calc(var(--cat-s) * 0.7);
  font: 12px/1 var(--font-mono);
  color: var(--accent);
  animation: cat-fade 0.8s ease-out forwards;
}
.cat-mrrp--r { left: calc(100% + 2px) !important; }
.cat-mrrp--l { left: auto !important; right: calc(100% + 2px); }
.cat-bang {
  bottom: calc(var(--cat-s) + 2px);
  margin-left: -0.3em;
  font: 700 12px/1 var(--font-mono);
  color: var(--text);
}

@keyframes cat-z {
  0% { opacity: 0; transform: translate(0, 0); }
  15% { opacity: 1; }
  100% { opacity: 0; transform: translate(8px, -28px); }
}
@keyframes cat-rise {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; }
  70% { opacity: 1; }
  100% { opacity: 0; transform: translateY(-20px); }
}
@keyframes cat-fade {
  0% { opacity: 0; transform: translateY(2px); }
  15% { opacity: 1; transform: none; }
  70% { opacity: 1; }
  100% { opacity: 0; }
}

@media (max-width: 767.98px) {
  .cat { --cat-s: 40px; }
}

/* ---------- Responsive ---------- */

@media (min-width: 1800px) {
  .hero-grid { grid-template-columns: 1fr minmax(240px, 440px) 1fr; }
}

@media (max-width: 960px) {
  .hero-grid {
    grid-template-columns: 1fr;
    gap: 40px;
  }
  .hero-figure { order: -1; width: 196px; justify-self: center; }
  .hero-facts { justify-self: stretch; }

  .game-card--featured { grid-template-columns: 1fr; }
  .game-cover { min-height: 220px; border-right: 0; border-bottom: 1px solid var(--border); }

  .split { grid-template-columns: 1fr; }
  .footer-grid { grid-template-columns: repeat(3, 1fr); }
  .footer-brand { grid-column: 1 / -1; }
}

@media (max-width: 720px) {
  .games-grid { grid-template-columns: 1fr; }
  .game-slot { min-height: 0; }
}

/* ---------- Phones (< 768px) ---------- */
@media (max-width: 767.98px) {
  :root { --header-h: 56px; }

  /* header: logo left, burger right; nav + Wishlist live in the menu */
  .header-inner { gap: 12px; }
  .site-nav,
  .header-actions { display: none; }
  .menu-toggle {
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 44px;
    height: 44px;
    margin: 0 -10px 0 auto;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--text);
    cursor: pointer;
  }
  .menu-toggle-line { display: block; width: 22px; height: 1.5px; background: currentColor; }

  .mobile-menu {
    position: fixed;
    inset: 0;
    z-index: 100;
    display: flex;
    flex-direction: column;
    padding: var(--safe-top) var(--page-pad-r) calc(24px + var(--safe-bottom)) var(--page-pad-l);
    background: #000;
    overflow-y: auto;
    overscroll-behavior: contain;
    opacity: 0;
    transition: opacity 0.2s ease;
  }
  .mobile-menu[hidden] { display: none; }
  .mobile-menu.is-open { opacity: 1; }
  .mobile-menu-bar {
    flex: none;
    height: var(--header-h);
    display: flex;
    align-items: center;
    justify-content: space-between;
  }
  .menu-close {
    position: relative;
    width: 44px;
    height: 44px;
    margin-right: -10px;
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: none;
    color: var(--text);
    cursor: pointer;
  }
  .menu-close span {
    position: absolute;
    left: 11px;
    top: 21px;
    width: 22px;
    height: 1.5px;
    background: currentColor;
    transform: rotate(45deg);
  }
  .menu-close span + span { transform: rotate(-45deg); }
  .mobile-menu-nav { margin-top: clamp(16px, 5vh, 48px); }
  .mobile-menu-nav li + li { border-top: 1px solid var(--border); }
  .mobile-menu-nav a {
    display: block;
    padding: 14px 0;
    font-size: clamp(36px, 11vw, 56px);
    line-height: 1.1;
    font-weight: 500;
    letter-spacing: -0.045em;
  }
  .mobile-menu-foot {
    margin-top: auto;
    padding-top: 32px;
    display: flex;
    flex-direction: column;
    gap: 16px;
  }
  .mobile-menu-foot .btn { width: 100%; height: 52px; }
  .mobile-menu-social { display: flex; flex-wrap: wrap; gap: 8px; }
  .mobile-menu-nav a,
  .mobile-menu-social a { transition: color 0.15s ease; }
  .mobile-menu-nav a:hover,
  .mobile-menu-nav a:focus-visible,
  .mobile-menu-social a:hover,
  .mobile-menu-social a:focus-visible { color: var(--accent); }
  .mobile-menu-social a {
    display: inline-flex;
    align-items: center;
    min-height: 44px;
    padding: 0 18px;
    border: 1px solid var(--border-strong);
    border-radius: 999px;
    color: var(--text-muted);
    font-size: 15px;
  }

  /* hero: mark ~60% of the width, bigger headline, everything centred */
  .hero-figure { width: 60vw; max-width: 340px; }
  .hero-mark { width: 100%; }
  .hero-title { font-size: clamp(48px, 17vw, 84px); }
  .hero-copy { text-align: center; }
  .hero-facts li { justify-content: center; }

  /* footer: one column */
  .footer-grid { grid-template-columns: 1fr; gap: 28px; }
}

/* ---------- Touch / small screens: tap targets >= 44px, secondary text >= 15px ---------- */
@media (pointer: coarse), (max-width: 767.98px) {
  .brand { min-height: 44px; }
  .btn-sm { height: 44px; font-size: 15px; }
  .site-nav a { padding: 13px 12px; font-size: 15px; }
  .footer-col li + li { margin-top: 0; }
  .footer-col a { display: inline-block; padding: 10px 0; font-size: 16px; }
  /* readable secondary text */
  .slot-note,
  .footer-note,
  .footer-bottom { font-size: 15px; }
  .footer-heading { font-size: 15px; margin-bottom: 4px; }
  .contact-email { padding-top: 8px; padding-bottom: 8px; }
  .skip-link { padding: 13px 16px; }
}

/* ---------- Phones in landscape: mark left, text right ---------- */
@media (orientation: landscape) and (max-height: 500px) and (max-width: 960px) {
  .hero { padding-top: 24px; padding-bottom: 40px; }
  .hero-grid {
    grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
    /* empty 1fr rows above / below: title + 01/02/03 sit as one block centred on the mark */
    grid-template-rows: 1fr auto auto 1fr;
    grid-template-areas: "fig ." "fig copy" "fig facts" "fig .";
    column-gap: 32px;
    row-gap: 0;
  }
  .hero-figure { grid-area: fig; order: 0; width: min(36vw, 62vh); }
  .hero-copy { grid-area: copy; }
  .hero-facts { grid-area: facts; margin-top: 20px; }
  .hero-title { font-size: clamp(40px, 12vh, 64px); }
  .hero-facts li { padding: 8px 0; font-size: 16px; justify-content: flex-start; }
  .scroll-hint { display: none; }
  /* landscape keeps the left-aligned layout */
  .hero-copy { text-align: left; }
}

/* ---------- Lighter hero effects on phones / touch devices ---------- */
/* fewer orbits: the largest one only on wide screens with a mouse */
@media (max-width: 899.98px), (hover: none) { .orbit-3 { display: none; } }

@media (hover: none), (max-width: 767.98px) {
  /* 2 shimmer layers (top + bottom) instead of 4, same cycle */
  .glow-right,
  .glow-left { display: none; }
  /* half the blur radius and smaller filter regions: swap to the lite copies (display only) */
  .glow-full { display: none; }
  .glow-lite { display: inline; }
}

/* ---------- Intro, scroll reveal, heading decode (assets/js/anim.js) ----------
   All start states require html.js-anim (set before first paint, never with reduced motion or without JS). */

/* scroll / staggered reveal */
html.js-anim :is(.section-head .eyebrow, .section-title, .game-card--featured, .game-slot, .prose p:not(.terminal),
  .contact-row, .social-list, .footer-brand, .footer-col, .footer-bottom, .hero-facts li) {
  transition: opacity 0.6s cubic-bezier(0.2, 0.7, 0.2, 1), transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
html.js-anim :is(.section-head .eyebrow, .section-title, .game-card--featured, .game-slot, .prose p:not(.terminal),
  .contact-row, .social-list, .footer-brand, .footer-col, .footer-bottom, .hero-facts li):not(.is-in) {
  opacity: 0;
  transform: translateY(14px);
}
html.js-anim .rv-instant { transition: none !important; }

/* logo intro (html.intro-pending is removed when the intro ends or is skipped) */
html.intro-pending .layer-mark polygon,
html.intro-pending .layer-mark rect { stroke-dasharray: 4000; stroke-dashoffset: 4000; } /* outline hidden until JS measures it */
html.intro-pending .glow-group { opacity: 0; transition: opacity 0.12s ease-out; }
html.intro-pending.intro-glow-peak .glow-group { opacity: 1; }                       /* "power on": a bit above normal */
html.intro-pending.intro-glow-on .glow-group { opacity: var(--glow-intensity, 0.8); transition: opacity 0.25s ease-in-out; }
html.intro-pending .layer-orbits { opacity: 0; transition: opacity 0.6s ease; }
html.intro-pending.intro-comets-on .layer-orbits { opacity: 1; }
html.intro-pending .hero-title { opacity: 0; }
html.intro-pending.intro-text-on .hero-title { opacity: 1; }
html.intro-pending .scroll-hint { opacity: 0; }

/* heading decode: the real text stays in place (transparent), an aria-hidden overlay shows the scramble */
.hero-title,
.section-title { position: relative; }
.is-decoding { color: transparent; }
.decode {
  position: absolute;
  inset: 0;
  pointer-events: none;
  color: var(--text);
}
.decode span {
  position: absolute;
  display: block;
  white-space: pre;
  /* left-aligned with the heading's own letter-spacing, so a locked letter sits exactly on the real one */
  text-align: left;
}

/* ---------- Logo glitch (header logo on hover / focus, hero mark on click; see main.js) ----------
   JS adds .is-glitching to .logo-glitch / .hero-mark for 380 ms. Only transform, opacity and clip-path animate,
   in jumps (steps), never smoothly. The ghosts are outline copies already in the DOM, hidden at rest.
   --u = viewBox units per screen px (set by JS), so the Г / І shifts are in screen pixels at any size. */
.logo-glitch { position: relative; display: inline-flex; flex: none; }
.gl-ghost {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  opacity: 0;
  pointer-events: none;
}
.logo-glitch .gl-ghost { stroke-width: 1.5px; }
.hero-mark .gl-ghost { z-index: 5; stroke-width: 1.5px; }
.gl-ghost-a { color: var(--accent); }
.gl-ghost-b { color: #fff; }
.hero-mark.is-glitchable { cursor: pointer; -webkit-tap-highlight-color: transparent; }

/* chaos swarm impact (comets.js): a light 200 ms jolt of Г / І. Two classes with identical keyframes take
   turns, so every impact restarts it without a reflow. Listed before .is-glitching, which wins if both run. */
@media (prefers-reduced-motion: no-preference) {
  .is-jolt-a .gl-g { animation: gl-jolt-g 200ms steps(1, end) both; }
  .is-jolt-a .gl-i { animation: gl-jolt-i 200ms steps(1, end) both; }
  .is-jolt-b .gl-g { animation: gl-jolt-g2 200ms steps(1, end) both; }
  .is-jolt-b .gl-i { animation: gl-jolt-i2 200ms steps(1, end) both; }
}
@keyframes gl-jolt-g {
  0%        { transform: translate(calc(-2px * var(--u, 1)), calc(1px * var(--u, 1))); }
  35%       { transform: translate(calc(-3px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  70%       { transform: translate(calc(-1px * var(--u, 1)), 0); }
  100%      { transform: translate(0, 0); }
}
@keyframes gl-jolt-i {
  0%        { transform: translate(calc(2px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  35%       { transform: translate(calc(3px * var(--u, 1)), calc(1px * var(--u, 1))); }
  70%       { transform: translate(calc(1px * var(--u, 1)), 0); }
  100%      { transform: translate(0, 0); }
}
@keyframes gl-jolt-g2 {
  0%        { transform: translate(calc(-2px * var(--u, 1)), calc(1px * var(--u, 1))); }
  35%       { transform: translate(calc(-3px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  70%       { transform: translate(calc(-1px * var(--u, 1)), 0); }
  100%      { transform: translate(0, 0); }
}
@keyframes gl-jolt-i2 {
  0%        { transform: translate(calc(2px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  35%       { transform: translate(calc(3px * var(--u, 1)), calc(1px * var(--u, 1))); }
  70%       { transform: translate(calc(1px * var(--u, 1)), 0); }
  100%      { transform: translate(0, 0); }
}

@media (prefers-reduced-motion: no-preference) {
  .is-glitching .gl-g,
  .is-glitching .gl-i,
  .is-glitching .gl-ghost { animation: 380ms steps(1, end) both; }
  .is-glitching .gl-g { animation-name: gl-g; }
  .is-glitching .gl-i { animation-name: gl-i; }
  .is-glitching .gl-ghost-a { animation-name: gl-ghost-a; }
  .is-glitching .gl-ghost-b { animation-name: gl-ghost-b; }
}

/* Г: 2–5 px to the left, І: 3–6 px to the right, with ±1–2 px vertical jitter; both back in place at 88% */
@keyframes gl-g {
  0%        { transform: translate(0, 0); }
  10%       { transform: translate(calc(-3px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  22%       { transform: translate(calc(-5px * var(--u, 1)), calc(1px * var(--u, 1))); }
  34%       { transform: translate(calc(-2px * var(--u, 1)), 0); }
  47%       { transform: translate(calc(-4px * var(--u, 1)), calc(2px * var(--u, 1))); }
  60%       { transform: translate(calc(-5px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  74%       { transform: translate(calc(-3px * var(--u, 1)), calc(1px * var(--u, 1))); }
  88%, 100% { transform: translate(0, 0); }
}
@keyframes gl-i {
  0%        { transform: translate(0, 0); }
  10%       { transform: translate(calc(4px * var(--u, 1)), calc(1px * var(--u, 1))); }
  22%       { transform: translate(calc(6px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  34%       { transform: translate(calc(3px * var(--u, 1)), calc(1px * var(--u, 1))); }
  47%       { transform: translate(calc(5px * var(--u, 1)), calc(-2px * var(--u, 1))); }
  60%       { transform: translate(calc(6px * var(--u, 1)), 0); }
  74%       { transform: translate(calc(3px * var(--u, 1)), calc(-1px * var(--u, 1))); }
  88%, 100% { transform: translate(0, 0); }
}
/* ghosts: visible only as a thin horizontal band that jumps to a new height every frame */
@keyframes gl-ghost-a {
  0%        { opacity: 0;    transform: translateX(0);    clip-path: inset(50% 0 50% 0); }
  10%       { opacity: 0.85; transform: translateX(-3px); clip-path: inset(14% 0 68% 0); }
  30%       { opacity: 0.7;  transform: translateX(-2px); clip-path: inset(58% 0 26% 0); }
  52%       { opacity: 0.85; transform: translateX(-3px); clip-path: inset(32% 0 54% 0); }
  70%       { opacity: 0.6;  transform: translateX(-2px); clip-path: inset(80% 0 6% 0); }
  86%, 100% { opacity: 0;    transform: translateX(0);    clip-path: inset(50% 0 50% 0); }
}
@keyframes gl-ghost-b {
  0%        { opacity: 0;    transform: translateX(0);   clip-path: inset(50% 0 50% 0); }
  16%       { opacity: 0.75; transform: translateX(3px); clip-path: inset(44% 0 40% 0); }
  38%       { opacity: 0.6;  transform: translateX(2px); clip-path: inset(4% 0 82% 0); }
  60%       { opacity: 0.8;  transform: translateX(3px); clip-path: inset(66% 0 18% 0); }
  78%       { opacity: 0.65; transform: translateX(2px); clip-path: inset(22% 0 64% 0); }
  88%, 100% { opacity: 0;    transform: translateX(0);   clip-path: inset(50% 0 50% 0); }
}

/* ---------- Motion ---------- */

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  html { scroll-behavior: auto; }
}
