:root {
  /* The intro's orange plate (R 207, G 114, B 3) and its black ink. */
  --plate: #cf7203;
  --plate-hot: #ec8a10;
  --ink: #0c0b0a;
  --paper: #e9e3da;
  --body: #cfc7bb;
  --soft: #bdb6ab;
  --muted: #8f877c;
  --line: #221f1c;
  --line-strong: #2a2622;
  --ember: #ff9a7a; /* CS2's REPORT A BUG icon tint */

  --font: "Saira", "Bahnschrift", "Segoe UI", sans-serif;
  --mono: "JetBrains Mono", ui-monospace, "Cascadia Mono", monospace;
  --wrap: min(1152px, 100% - 48px);

  /* Logo video box: 1880x640, the settled logo fills its middle 68% x 38%. */
  --logo-w: min(1150px, 128vw);
}

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

html {
  background: var(--ink);
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  color: var(--paper);
  font: 400 1.0625rem/1.6 var(--font);
  background: var(--ink);
  -webkit-font-smoothing: antialiased;
  overflow-x: clip;
}

/* Film grain over everything. It sits on top, so it never becomes the logo's backdrop. */
body::after {
  content: "";
  position: fixed;
  inset: -50%;
  z-index: 10;
  pointer-events: none;
  opacity: 0.08;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='220' height='220'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)'/%3E%3C/svg%3E");
}

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

.nowrap { white-space: nowrap; }

a { color: inherit; text-underline-offset: 3px; }
:focus-visible { outline: 3px solid var(--plate-hot); outline-offset: 4px; }
.plate :focus-visible { outline-color: var(--ink); }

/* ---- Two layouts, one document -----------------------------------------------------------------
   First visit (the default):  hero (full screen) → lead → beta → download → footer
   Returning (data-visit):     hero → lead → download → beta → footer
   Only `order` and styling change; the markup is shared. */

.page { display: flex; flex-direction: column; min-height: 100vh; }

.hero { order: 1; }
.lead { order: 2; }
.beta { order: 3; }
.get  { order: 4; }
.foot { order: 5; }

[data-visit="returning"] .get  { order: 3; }
[data-visit="returning"] .beta { order: 4; }

.plate { background: var(--plate); color: var(--ink); }

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

/* No transform, opacity, filter, isolation or z-index on any ancestor of the video: each would make
   an isolated group, and the multiply blend would then key against transparent instead of this
   plate, leaving a white box. */
.hero {
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 100vh;
  min-height: 100svh;
}

[data-visit="returning"] .hero { min-height: 0; }

/* Socials on the left, the badge in the middle; the empty third column keeps it centred. */
.hero__bar {
  width: var(--wrap);
  margin: 0 auto;
  padding-top: 24px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 12px;
  font: 700 0.8125rem/1.4 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.badge {
  justify-self: center;
  padding: 5px 14px 4px;
  background: var(--ink);
  color: var(--plate);
}
.badge::before { content: "● "; }

.logo {
  /* The transparent logo box overlaps the header; only the social links take input. */
  pointer-events: none;
  position: relative;
  width: var(--logo-w);
  aspect-ratio: 1880 / 640;
  margin: auto 0 auto calc(50% - var(--logo-w) / 2);
  font-size: inherit;
}

[data-visit="returning"] .logo {
  margin-top: calc(var(--logo-w) * -0.03);
  margin-bottom: calc(var(--logo-w) * -0.075);
}

.logo__video,
.logo__still {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  pointer-events: none;
}

.logo__video {
  mix-blend-mode: multiply;
  /* The crop cuts through the opening's giant letters; feather the frame edges. */
  -webkit-mask-image:
    linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent),
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(to bottom, transparent, #000 16%, #000 84%, transparent),
    linear-gradient(to right, transparent, #000 7%, #000 93%, transparent);
  mask-composite: intersect;
}

.logo__still[hidden], .logo__video[hidden] { display: none; }

/* Returning visitors skip the intro: the held frame is there from the first paint. */
[data-visit="returning"] .logo__video { display: none; }
[data-visit="returning"] .logo__still { display: block; }

/* The intro's glitch streaks, frozen. */
.speed {
  position: absolute;
  display: flex;
  flex-direction: column;
  transform: skewX(-24deg);
  pointer-events: none;
}
.speed i { display: block; width: var(--w); height: 10px; background: var(--ink); }
.speed--right { right: -40px; top: 120px; align-items: flex-end; gap: 14px; }
.speed--left { left: -30px; bottom: 140px; gap: 12px; }
.speed--left i { height: 8px; }
[data-visit="returning"] .speed--left { display: none; }

.hero__foot {
  position: absolute;
  left: 24px;
  right: 24px;
  bottom: 24px;
  display: flex;
  justify-content: space-between;
  font: 700 0.6875rem/1 var(--mono);
  letter-spacing: 0.14em;
  opacity: 0.75;
  pointer-events: none;
}

.cue {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 10px;
  width: max-content;
  margin: 0 auto;
  padding: 8px 14px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  font: 700 0.75rem/1 var(--mono);
  letter-spacing: 0.2em;
  text-transform: uppercase;
  text-decoration: none;
  animation: cue-in 600ms ease 2.6s both;
}
.cue svg { width: 20px; height: 20px; animation: bob 1.6s ease-in-out 3.2s infinite; }

[data-visit="returning"] .hero__foot,
[data-visit="returning"] .cue { display: none; }

@keyframes cue-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes bob { 50% { transform: translateY(5px); } }

/* ---- What it is ---------------------------------------------------------------------------------- */

.lead p {
  width: var(--wrap);
  margin: 0 auto;
  padding-top: clamp(80px, 12vh, 128px);
  color: var(--paper);
  font-size: clamp(1.625rem, 1.1rem + 2vw, 2.5rem);
  font-weight: 500;
  line-height: 1.25;
  text-wrap: balance;
}

[data-visit="returning"] .lead { background: var(--plate); }
[data-visit="returning"] .lead p {
  max-width: 620px;
  padding-top: 0;
  color: var(--ink);
  font-size: clamp(1.125rem, 1rem + 0.5vw, 1.375rem);
  text-align: center;
}

/* ---- Download ------------------------------------------------------------------------------------ */

.get {
  padding: clamp(80px, 12vh, 128px) 24px;
  text-align: center;
}

[data-visit="returning"] .get { padding: 40px 24px clamp(72px, 10vh, 112px); }

/* Returning visits stack three orange sections. Their edges land on fractional pixels, and the
   black page shows through the shared edge as a hairline; overlapping by a pixel closes it. */
[data-visit="returning"] .lead,
[data-visit="returning"] .get { margin-top: -1px; }

.get__kicker {
  margin: 0 0 28px;
  font: 700 0.8125rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}
[data-visit="returning"] .get__kicker { display: none; }

/* The download slab: black ink on the plate, slanted like the wordmark. */
.dl {
  --skew: -14deg;
  display: inline-block;
  transform: skewX(var(--skew));
  background: var(--ink);
  color: var(--plate);
  text-decoration: none;
  cursor: pointer;
  box-shadow: 10px 10px 0 rgba(12, 11, 10, 0.25);
  transition: transform 140ms ease, box-shadow 140ms ease, color 140ms ease;
}

.dl__face {
  display: inline-flex;
  align-items: center;
  gap: 16px;
  padding: 22px 46px 20px 40px;
  transform: skewX(calc(var(--skew) * -1));
  font-size: clamp(1.375rem, 1rem + 1.2vw, 1.875rem);
  font-style: italic;
  font-weight: 800;
  font-stretch: 125%;
  letter-spacing: 0.03em;
  line-height: 1;
  text-transform: uppercase;
}

.dl__icon { width: 28px; height: 28px; flex: none; }

.dl:hover {
  color: var(--plate-hot);
  transform: skewX(var(--skew)) translate(-3px, -3px);
  box-shadow: 14px 14px 0 rgba(12, 11, 10, 0.3);
}
.dl:active { transform: skewX(var(--skew)) translate(2px, 2px); box-shadow: 6px 6px 0 rgba(12, 11, 10, 0.3); }

.dl[aria-disabled="true"],
.dl[aria-disabled="true"]:hover {
  background: transparent;
  color: var(--ink);
  box-shadow: inset 0 0 0 3px var(--ink);
  transform: skewX(var(--skew));
  cursor: default;
}

.get__meta {
  margin: 22px 0 0;
  font: 700 0.75rem/1.6 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  opacity: 0.85;
}

/* ---- Beta call ----------------------------------------------------------------------------------- */

.beta {
  width: var(--wrap);
  margin: 0 auto;
  padding: clamp(64px, 9vh, 96px) 0 clamp(96px, 14vh, 140px);
}
[data-visit="returning"] .beta { padding-top: clamp(96px, 14vh, 128px); }

.kicker {
  margin: 0 0 18px;
  color: var(--plate-hot);
  font: 700 0.8125rem/1 var(--mono);
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

/* "I need beta testers." types itself out (main.js). The letters hold their space from the start, so
   nothing moves while they appear; the caret rides on the last one. */
.tw-word { white-space: nowrap; }
.tw-ch { visibility: hidden; }
.tw-ch.is-on { visibility: visible; }
.tw-ch.is-caret { position: relative; }
.tw-ch.is-caret::after {
  content: "";
  visibility: visible;
  position: absolute;
  top: 50%;
  left: 100%;
  width: 0.09em;
  height: 0.72em;
  margin-left: 0.08em;
  background: currentColor;
  transform: translateY(-50%) skewX(-14deg);
}
.tw-ch.is-start::after { left: 0; margin-left: -0.04em; animation: blink 0.5s steps(1, end) infinite; }
.is-typed .tw-ch.is-caret::after { animation: blink 1.06s steps(1, end) infinite; }

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

.beta__title {
  margin: 0;
  color: var(--plate-hot);
  font-size: clamp(3rem, 1.6rem + 6vw, 7rem);
  font-style: italic;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.92;
  letter-spacing: -0.01em;
  text-transform: uppercase;
}

.beta__lede {
  max-width: 640px;
  margin: 28px 0 0;
  color: var(--body);
  font-size: 1.1875rem;
  line-height: 1.6;
}

.cards {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin: 72px 0 0;
  padding: 0;
  list-style: none;
}

.card {
  flex: 1 1 300px;
  padding: 28px 28px 32px;
  border: 2px solid var(--line-strong);
}

.card__num {
  display: block;
  color: transparent;
  -webkit-text-stroke: 2px var(--plate-hot);
  font-size: 5.25rem;
  font-style: italic;
  font-weight: 800;
  font-stretch: 125%;
  line-height: 0.9;
}

.card__title {
  margin: 22px 0 12px;
  color: #ffffff;
  font-size: 1.625rem;
  font-style: italic;
  font-weight: 800;
  font-stretch: 112%;
  line-height: 1.05;
  text-transform: uppercase;
}

.card p { margin: 0; color: var(--soft); font-size: 1rem; line-height: 1.6; }
.card b { color: var(--paper); font-weight: 700; }
.card .card__fine { margin-top: 12px; color: var(--muted); font-size: 0.875rem; line-height: 1.5; }

.card--hot { background: var(--plate); border-color: var(--plate); color: var(--ink); }
.card--hot .card__num { -webkit-text-stroke-color: var(--ink); }
.card--hot .card__title,
.card--hot p,
.card--hot b { color: var(--ink); }
.card--hot p { font-weight: 500; }

/* A replica of the in-game button. Clicking it files another (pretend) bug: main.js pops a
   "Bug #N reported" out of it. */
.bug { position: relative; display: inline-block; }

.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 1px 12px 0 9px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  background: #000;
  color: #f2eee8;
  font-family: inherit;
  font-size: 0.8125rem;
  font-weight: 700;
  line-height: 1.5;
  letter-spacing: 0.06em;
  white-space: nowrap;
  vertical-align: 1px;
  cursor: pointer;
  transition: border-color 140ms ease, transform 100ms ease;
}
.pill:hover { border-color: var(--ember); }
.pill:active { transform: scale(0.96); }
.pill svg { width: 13px; height: 13px; color: var(--ember); }

.bug-pop {
  position: absolute;
  left: 50%;
  bottom: 100%;
  white-space: nowrap;
  color: var(--plate-hot);
  font: 700 0.8125rem/1 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 2px 0 var(--ink);
  pointer-events: none;
  animation: bug-pop 1s cubic-bezier(0.2, 0.7, 0.2, 1) forwards;
}

@keyframes bug-pop {
  0% { opacity: 0; transform: translate(calc(-50% + var(--x, 0px)), 8px) scale(0.85); }
  15% { opacity: 1; transform: translate(calc(-50% + var(--x, 0px)), -4px) scale(1.05); }
  25% { transform: translate(calc(-50% + var(--x, 0px)), -8px) scale(1); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x, 0px)), -52px) scale(1); }
}

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

.foot {
  width: var(--wrap);
  margin: 0 auto;
  padding: 28px 0 40px;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 24px 32px;
  color: var(--muted);
  font-size: 0.8125rem;
}
[data-visit="returning"] .foot { border-top: 1px solid var(--line); }
.foot p { margin: 0; }
.foot a { color: var(--paper); }

.foot__social {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 20px;
}

.foot__by {
  color: var(--paper);
  font: 700 0.8125rem/1 var(--mono);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.socials {
  display: flex;
  gap: 8px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.socials a {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid;
  transition: color 140ms ease, background-color 140ms ease, border-color 140ms ease;
}
.socials svg { width: 20px; height: 20px; fill: currentColor; }

/* On the plate: black ink that flips to orange-on-black under the pointer. */
.hero .socials a { color: var(--ink); border-color: rgba(12, 11, 10, 0.3); }
.hero .socials a:hover { color: var(--plate); background: var(--ink); border-color: var(--ink); }

/* On black: paper that turns orange. */
.foot .socials a { color: var(--paper); border-color: var(--line-strong); }
.foot .socials a:hover { color: var(--plate-hot); border-color: var(--plate-hot); }

.sprite { position: absolute; width: 0; height: 0; overflow: hidden; }

.foot__legal { display: grid; gap: 4px; }

/* ---- Small screens ------------------------------------------------------------------------------- */

@media (max-width: 760px) {
  .speed { display: none; }
}

@media (max-width: 640px) {
  .hero__foot { display: none; } /* it would sit on the scroll cue */
  .hero__bar { grid-template-columns: 1fr; justify-items: center; }
  .hero__bar .badge { grid-row: 1; }
}

@media (max-width: 480px) {
  .dl__face { padding: 18px 30px 16px 26px; gap: 12px; }
  .dl__icon { width: 22px; height: 22px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .cue, .cue svg,
  .tw-ch.is-caret::after { animation: none; }
  .dl, .pill, .socials a { transition: none; }
  .bug-pop { animation-name: bug-fade; }
}

@keyframes bug-fade {
  0%, 60% { opacity: 1; transform: translate(calc(-50% + var(--x, 0px)), -8px); }
  100% { opacity: 0; transform: translate(calc(-50% + var(--x, 0px)), -8px); }
}
