/* =========================================================
   Tokens (from WEB_DESIGN.md)
   ========================================================= */
:root {
  --bg: #050505;
  --surface: #0f0f0f;
  --text: #f5f5f5;
  --text-muted: #a3a3a3;
  --text-dim: #8a8a8a;
  --text-body: #c9c9c9;
  --border: #262626;
  --border-strong: #3a3a3a;
  --accent: #f2b705;
  --accent-hover: #ffc824;
  --on-accent: #0a0a0a;
  --ok: #3fb950;
  --r-sm: 4px;
  --r-md: 6px;
  --font: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --font-display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;

  --bar-h: 64px;
  --maxw: 1160px;
  --ease-out: cubic-bezier(.16, 1, .3, 1);

  /* Shape of the game picture box. 1 = square, 16 / 9 = Roblox thumbnail. */
  --shot-ratio: 1;

  color-scheme: dark;
}

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

html { scroll-behavior: smooth; scroll-padding-top: var(--bar-h); }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 400 15px/1.55 var(--font);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

/* War-map grid that fades out towards the edges */
body::before {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    linear-gradient(to right, rgb(255 255 255 / 0.085) 1px, transparent 1px) center / 224px 224px,
    linear-gradient(to bottom, rgb(255 255 255 / 0.085) 1px, transparent 1px) center / 224px 224px,
    linear-gradient(to right, rgb(255 255 255 / 0.04) 1px, transparent 1px) center / 56px 56px,
    linear-gradient(to bottom, rgb(255 255 255 / 0.04) 1px, transparent 1px) center / 56px 56px;
  -webkit-mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
          mask-image: radial-gradient(ellipse 70% 60% at 50% 45%, #000 20%, transparent 75%);
}

h1, h2, p { margin: 0; }

a {
  color: var(--text);
  text-decoration-color: var(--border-strong);
  text-underline-offset: 3px;
  transition: text-decoration-color 150ms ease-out, color 150ms ease-out;
}
a:hover { text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

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

.skip {
  position: fixed; left: 16px; top: -48px; z-index: 100;
  padding: 8px 12px; background: var(--accent); color: var(--on-accent);
  border-radius: var(--r-sm); font-weight: 600; text-decoration: none;
}
.skip:focus { top: 12px; }

.eyebrow {
  display: flex; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim);
}
.eyebrow::before { content: ""; width: 18px; height: 1px; background: var(--border-strong); }

.lead { color: var(--text-muted); font-size: 17px; line-height: 1.6; text-wrap: pretty; }

[data-icon] { display: inline-flex; }
[data-icon] svg { width: 16px; height: 16px; flex: none; }

/* =========================================================
   Buttons
   ========================================================= */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 40px; padding: 9px 16px; border-radius: var(--r-sm);
  font: 600 13.5px/1 var(--font); white-space: nowrap; text-decoration: none;
  border: 1px solid var(--border-strong); color: var(--text); background: transparent;
  cursor: pointer;
  transition: background-color 150ms ease-out, border-color 150ms ease-out, color 150ms ease-out;
}
.btn:hover { border-color: var(--text-muted); }
.btn svg { width: 16px; height: 16px; flex: none; }
.btn-sm { min-height: 34px; padding: 7px 12px; font-size: 13px; color: var(--text-muted); background: rgb(15 15 15 / 0.6); border-color: var(--border); }
.btn-sm:hover { color: var(--text); border-color: var(--border-strong); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-primary svg { transition: transform 200ms var(--ease-out); }
.btn-primary:hover svg { transform: translateY(2px); }

/* =========================================================
   Top bar
   ========================================================= */
.topbar {
  position: fixed; inset: 0 0 auto 0; z-index: 50;
  height: var(--bar-h);
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding-inline: max(16px, calc((100% - var(--maxw)) / 2));
  border-bottom: 1px solid transparent;
  transition: background-color 250ms ease-out, border-color 250ms ease-out;
  animation: drop 700ms var(--ease-out) both;
}
.topbar.is-scrolled {
  background: rgb(5 5 5 / 0.82);
  border-bottom-color: var(--border);
  -webkit-backdrop-filter: blur(12px);
          backdrop-filter: blur(12px);
}

.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; min-width: 0; }
.brand .mark {
  display: grid; place-items: center; flex: none;
  width: 30px; height: 30px; border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  font: 700 14px/1 var(--font-display); color: var(--accent); background: var(--surface);
}
.brand .mark.has-avatar { width: 34px; height: 34px; padding: 0; overflow: hidden; }
.brand .mark.has-avatar img { display: block; width: 100%; height: 100%; object-fit: cover; }
.brand b { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.brand-role {
  font-size: 11px; font-weight: 600; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-dim); padding-left: 10px; border-left: 1px solid var(--border);
  white-space: nowrap;
}

.social { display: flex; gap: 6px; }

/* =========================================================
   Hero / intro
   ========================================================= */
.hero {
  position: relative;
  min-height: 100vh; min-height: 100svh;
  display: grid; align-items: center;
  padding: calc(var(--bar-h) + 48px) 16px 120px;
}
.hero-inner {
  width: min(100%, var(--maxw)); margin: 0 auto;
  display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(0, 1fr); gap: 72px; align-items: center;
  opacity: calc(1 - var(--h, 0) * 1.4);
  transform: translate3d(0, calc(var(--h, 0) * 90px), 0) scale(calc(1 - var(--h, 0) * 0.04));
  will-change: transform, opacity;
}

.hero h1 {
  margin: 18px 0 20px;
  font: 700 clamp(38px, 5.6vw, 66px)/1.03 var(--font-display);
  letter-spacing: -0.035em;
  text-wrap: balance;
}
.hero .lead { max-width: 56ch; }
.hero-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 32px; }

/* Card with corner brackets */
.card {
  position: relative; padding: 28px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.03), 0 2px 4px rgb(0 0 0 / 0.4), 0 24px 64px rgb(0 0 0 / 0.55);
}
.card::before,
.shot::before {
  --b: rgb(255 255 255 / 0.32);
  content: ""; position: absolute; inset: -8px; pointer-events: none;
  background:
    linear-gradient(var(--b), var(--b)) left top / 14px 1px,
    linear-gradient(var(--b), var(--b)) left top / 1px 14px,
    linear-gradient(var(--b), var(--b)) right top / 14px 1px,
    linear-gradient(var(--b), var(--b)) right top / 1px 14px,
    linear-gradient(var(--b), var(--b)) left bottom / 14px 1px,
    linear-gradient(var(--b), var(--b)) left bottom / 1px 14px,
    linear-gradient(var(--b), var(--b)) right bottom / 14px 1px,
    linear-gradient(var(--b), var(--b)) right bottom / 1px 14px;
  background-repeat: no-repeat;
}

.card-head { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.card-head b { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.card-head span {
  margin-left: auto; font-size: 11px; font-weight: 600; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--text-dim);
}

.facts {
  list-style: none; margin: 0; padding: 0;
  border: 1px solid var(--border); border-radius: var(--r-md); background: var(--bg);
}
.facts li { display: grid; grid-template-columns: 112px 1fr; gap: 12px; align-items: baseline; padding: 14px 16px; }
.facts li + li { border-top: 1px solid var(--border); }
.facts span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-dim);
}
.facts b { font-size: 14.5px; font-weight: 500; font-variant-numeric: tabular-nums; }
.facts b.has-dot { display: inline-flex; align-items: center; gap: 8px; }
.facts b.has-dot .dot { background: var(--ok); box-shadow: 0 0 0 3px rgb(63 185 80 / 0.18); }

/* Scroll cue */
.scroll-cue {
  position: absolute; left: 50%; bottom: 28px; translate: -50% 0;
  display: flex; flex-direction: column; align-items: center; gap: 10px;
  font-size: 11px; font-weight: 600; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-dim); text-decoration: none;
  opacity: calc(1 - var(--h, 0) * 4);
  animation: fade 1s 900ms ease-out both;
}
.scroll-cue i {
  position: relative; width: 1px; height: 44px; overflow: hidden; background: var(--border);
}
.scroll-cue i::after {
  content: ""; position: absolute; left: 0; top: 0; width: 1px; height: 16px;
  background: var(--accent);
  animation: cue 1.8s cubic-bezier(.65, 0, .35, 1) infinite;
}
.scroll-cue:hover { color: var(--text); }

/* Load-in */
.reveal { animation: rise 900ms var(--ease-out) both; animation-delay: calc(120ms + var(--i, 0) * 90ms); }

@keyframes rise { from { opacity: 0; transform: translateY(22px); filter: blur(6px); } to { opacity: 1; transform: none; filter: none; } }
@keyframes drop { from { opacity: 0; transform: translateY(-100%); } to { opacity: 1; transform: none; } }
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes cue { 0% { transform: translateY(-16px); } 100% { transform: translateY(44px); } }

/* =========================================================
   Games carousel
   ========================================================= */
.work {
  --p: 0; /* scroll progress, set by main.js */
  /* How much extra scrolling the carousel stays locked on screen for */
  --pin-length: 110svh;
  position: relative;
  height: calc(100svh + var(--pin-length));
  padding: 0 16px;
  overflow-x: clip;
}

/* Locked on screen while you scroll through .work */
.work-pin {
  position: sticky; top: var(--bar-h);
  height: calc(100svh - var(--bar-h));
  display: flex; flex-direction: column;
  padding: 16px 0 20px;
}

/* Gently snap the carousel into place when you stop scrolling near it (main.js adds .snap) */
html.snap { scroll-snap-type: y proximity; }
.hero, .work { scroll-snap-align: start; }
.contact { scroll-snap-align: end; }

.work-head {
  width: min(100%, var(--maxw)); margin: 0 auto;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  opacity: var(--p);
  transform: translateY(calc((1 - var(--p)) * 24px));
}
.counter {
  display: flex; align-items: baseline; gap: 6px;
  font-size: 13px; color: var(--text-dim); font-variant-numeric: tabular-nums;
}
.counter b { display: inline-block; font: 700 22px/1 var(--font-display); color: var(--text); letter-spacing: -0.02em; }

.stage {
  position: relative; isolation: isolate;
  width: min(100%, 1280px); margin: 0 auto;
  flex: 1; min-height: 0;
  display: grid;
  grid-template-columns: 56px minmax(0, 1fr) 56px;
  grid-template-areas:
    "prev slides next"
    ".    rail   .   ";
  grid-template-rows: minmax(0, 1fr) auto;
  align-items: center; column-gap: 24px; row-gap: 16px;
  padding: 8px 0 0;
  touch-action: pan-y;
}

/* Tapering black shadow behind the game */
.shadow {
  position: absolute; inset: -12% -18%; z-index: -2; pointer-events: none;
  background: radial-gradient(ellipse 50% 50% at 50% 48%,
    rgb(0 0 0 / 0.97) 0%,
    rgb(0 0 0 / 0.9) 32%,
    rgb(0 0 0 / 0.55) 58%,
    rgb(0 0 0 / 0.18) 78%,
    transparent 100%);
  opacity: var(--p);
  transform: scale(calc(0.55 + var(--p) * 0.45));
  will-change: transform, opacity;
}

/* Faint colour wash from the current game's picture (only when it has one) */
.ambient {
  position: absolute; inset: 6% 18%; z-index: -1; pointer-events: none;
  -webkit-mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 10%, transparent 70%);
          mask-image: radial-gradient(ellipse 50% 50% at 50% 50%, #000 10%, transparent 70%);
  opacity: var(--p);
}
.ambient-layer {
  position: absolute; inset: 0;
  background: center / cover no-repeat;
  filter: blur(70px) saturate(1.2);
  opacity: 0; transition: opacity 900ms ease-out;
}
.ambient-layer.is-on { opacity: 0.2; }

/* Arrows */
.nav {
  z-index: 3;
  display: grid; place-items: center;
  width: 56px; height: 56px; padding: 0;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: rgb(15 15 15 / 0.7); color: var(--text-muted);
  cursor: pointer;
  opacity: var(--p);
  transition: border-color 150ms ease-out, color 150ms ease-out, background-color 150ms ease-out;
}
.nav.prev { grid-area: prev; transform: translateX(calc((1 - var(--p)) * -48px)); }
.nav.next { grid-area: next; transform: translateX(calc((1 - var(--p)) * 48px)); }
.nav svg { width: 26px; height: 26px; transition: transform 200ms var(--ease-out); }
.nav:hover { color: var(--text); border-color: var(--border-strong); background: var(--surface); }
.nav.prev:hover svg { transform: translateX(-3px); }
.nav.next:hover svg { transform: translateX(3px); }
.nav:active svg { transform: scale(0.9); }

/* Slides: all stacked in one cell, so the stage never jumps in height */
.slides {
  grid-area: slides;
  display: grid; justify-items: center; align-self: center;
  opacity: clamp(0, calc(var(--p) * 1.5 - 0.3), 1);
  transform: translate3d(0, calc((1 - var(--p)) * 90px), 0) scale(calc(0.9 + var(--p) * 0.1));
  will-change: transform, opacity;
}
.slide {
  grid-area: 1 / 1;
  align-self: start;
  width: min(100%, 680px);
  display: flex; flex-direction: column; align-items: center; text-align: center;
  visibility: hidden;
}
.slide.is-active, .slide.is-leaving { visibility: visible; }
.slide.is-entering { z-index: 2; }

.slide-title {
  font: 700 clamp(28px, 3.4vw, 40px)/1.08 var(--font-display);
  letter-spacing: -0.03em; text-wrap: balance;
}
.slide-meta {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 4px 10px;
  margin: 10px 0 22px;
  font-size: 13px; color: var(--text-dim);
}
.slide-meta > * + * { padding-left: 10px; border-left: 1px solid var(--border-strong); }
.slide-meta .role { color: var(--text-muted); font-weight: 600; }
.slide-meta .period { font-variant-numeric: tabular-nums; }
.status { display: inline-flex; align-items: center; gap: 6px; }
.dot { width: 6px; height: 6px; border-radius: 50%; background: var(--border-strong); flex: none; }
.status.is-live { color: var(--text-muted); }
.status.is-live .dot { background: var(--ok); }

/* Game picture */
/* --shot-h is set by main.js so the title, picture, text and tags all fit on one screen */
.shot {
  position: relative;
  width: min(100%, calc(var(--shot-h, 400px) * var(--shot-ratio)), calc(400px * var(--shot-ratio)));
  aspect-ratio: var(--shot-ratio);
  margin-bottom: 24px;
}
.shot::before {
  inset: calc(-10px - (1 - var(--p)) * 40px);
  opacity: var(--p);
}
.shot-frame {
  position: absolute; inset: 0; overflow: hidden;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  clip-path: inset(calc((1 - var(--p)) * 50%) round var(--r-sm));
  box-shadow: 0 30px 80px rgb(0 0 0 / 0.6);
}
.shot-media { position: absolute; inset: 0; background: var(--surface); }
.shot-media > * { position: absolute; inset: 0; width: 100%; height: 100%; }
.shot-media img { display: block; object-fit: cover; }

/* Placeholder until an image is added */
.ph {
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
  background:
    linear-gradient(to right, rgb(255 255 255 / 0.045) 1px, transparent 1px) center / 28px 28px,
    linear-gradient(to bottom, rgb(255 255 255 / 0.045) 1px, transparent 1px) center / 28px 28px,
    var(--surface);
}
.ph b {
  font: 700 clamp(56px, 9svh, 88px)/1 var(--font-display); letter-spacing: -0.05em;
  color: var(--border-strong);
}
.ph span {
  font-size: 11px; font-weight: 600; letter-spacing: 0.14em; text-transform: uppercase; color: var(--text-dim);
}

.slide-desc {
  max-width: 64ch;
  color: var(--text-body); font-size: 15px; line-height: 1.7; text-wrap: pretty;
}

.slide-foot {
  display: flex; flex-wrap: wrap; justify-content: center; align-items: center; gap: 8px 14px;
  margin-top: 20px;
}
.slide-foot:empty { display: none; }
.exp {
  display: inline-flex; align-items: center; gap: 7px;
  font-size: 13px; font-weight: 600; color: var(--text-muted); text-decoration: none;
}
.exp svg { width: 14px; height: 14px; flex: none; }
.exp .ext { width: 12px; height: 12px; opacity: 0.7; }
a.exp:hover { color: var(--text); }
a.exp:hover .ext { color: var(--accent); opacity: 1; }
.tags { display: flex; flex-wrap: wrap; justify-content: center; gap: 6px; list-style: none; margin: 0; padding: 0; }
.tag {
  padding: 4px 8px; border: 1px solid var(--border); border-radius: var(--r-sm);
  font-size: 12px; color: var(--text-dim); background: rgb(15 15 15 / 0.6);
}

/* Rail of game markers */
.rail {
  grid-area: rail;
  display: flex; justify-content: center; gap: 4px;
  opacity: var(--p);
}
.rail-btn {
  display: flex; flex-direction: column; align-items: flex-start; gap: 7px;
  padding: 8px 4px; border: 0; background: none; cursor: pointer;
  font: 600 11px/1 var(--font); color: var(--text-dim); font-variant-numeric: tabular-nums;
  transition: color 150ms ease-out;
}
.rail-btn i {
  display: block; width: 28px; height: 2px; background: var(--border-strong);
  transition: width 400ms var(--ease-out), background-color 250ms ease-out;
}
.rail-btn:hover { color: var(--text); }
.rail-btn:hover i { background: var(--text-dim); }
.rail-btn[aria-current="true"] { color: var(--text); }
.rail-btn[aria-current="true"] i { width: 52px; background: var(--accent); }

.work.is-single .nav, .work.is-single .rail, .work.is-single .counter { display: none; }

/* =========================================================
   Contact / footer
   ========================================================= */
.contact { padding: 72px 16px 24px; border-top: 1px solid var(--border); background: rgb(5 5 5 / 0.7); }
.contact-inner { width: min(100%, var(--maxw)); margin: 0 auto; }
.contact h2 {
  margin: 16px 0 12px;
  font: 700 clamp(26px, 3.4vw, 38px)/1.1 var(--font-display); letter-spacing: -0.03em; text-wrap: balance;
}
.contact .lead { max-width: 52ch; font-size: 16px; }
.contact-links { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 28px; }
.legal {
  width: min(100%, var(--maxw)); margin: 64px auto 0; padding-top: 20px;
  display: flex; justify-content: space-between; gap: 16px;
  border-top: 1px solid var(--border);
  font-size: 13px; color: var(--text-dim);
}
.legal a { color: var(--text-dim); }
.legal a:hover { color: var(--text); }

.reveal-on-scroll { opacity: 0; transform: translateY(24px); transition: opacity 800ms ease-out, transform 800ms var(--ease-out); }
.reveal-on-scroll.in-view { opacity: 1; transform: none; }

/* =========================================================
   Responsive
   ========================================================= */
@media (max-width: 960px) {
  .hero-inner { grid-template-columns: 1fr; gap: 48px; }
  .glance { width: min(100%, 480px); }
}

/* Phones and short windows: the carousel won't fit on one screen, so don't lock it.
   main.js also adds .no-pin when the content measures too tall to fit. */
.work.no-pin { height: auto; padding: 8px 16px 72px; }
.work.no-pin .work-pin { position: static; height: auto; padding: 0; }
.work.no-pin .stage { flex: none; padding-top: 28px; row-gap: 24px; }

@media (max-width: 720px), (max-height: 640px) {
  .work { height: auto; padding: 8px 16px 72px; }
  .work-pin { position: static; height: auto; padding: 0; }
  .stage { flex: none; padding-top: 28px; row-gap: 24px; }
}

@media (max-width: 720px) {
  .stage {
    grid-template-columns: 48px minmax(0, 1fr) 48px;
    grid-template-areas:
      "slides slides slides"
      "prev   rail   next";
    column-gap: 8px;
    min-height: 0;
    padding-top: 28px;
  }
  .nav { width: 48px; height: 48px; }
  .nav.next { justify-self: end; }
  .rail { gap: 0; }
  .rail-btn { padding-inline: 3px; }
  .rail-btn i { width: 16px; }
  .rail-btn[aria-current="true"] i { width: 30px; }
  .shadow { inset: -6% -40%; }
  .slide-desc { font-size: 14.5px; }
}

@media (max-width: 640px) {
  .brand-role { display: none; }
  .social .lbl { display: none; }
  .social .btn-sm { width: 36px; height: 36px; padding: 0; }
  .hero { padding-top: calc(var(--bar-h) + 32px); }
  .hero .lead { font-size: 16px; }
  .facts li { grid-template-columns: 96px 1fr; padding: 12px 14px; }
  .card { padding: 22px; }
}

@media (max-width: 400px) {
  .hero-actions .btn { width: 100%; }
  .legal { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; animation-iteration-count: 1 !important; }
  .scroll-cue i::after { display: none; }
  .reveal-on-scroll { opacity: 1; transform: none; transition: none; }
}
