/* Burgi: gallery-style games site.
   References: A24 (frames on white, large medium-weight grotesk titles set on
   the image, one small outlined button), Neon (tag above the title, captioned
   rows), Annapurna (art first, little text).

   Type: one family and three sizes (--fs-s, --fs-m, --fs-l), nothing else.
   Text is black on white or white on images, never grey or coloured, never
   upper case. The images carry the colour. */

@font-face {
  font-family: "Host Grotesk";
  src: url("/assets/fonts/host-grotesk-latin-wght-normal.woff2") format("woff2");
  font-weight: 300 800;
  font-style: normal;
  font-display: swap;
}

:root {
  color-scheme: light;
  --bg: #ffffff;
  --ink: #000000;
  --line: #e4e4e4;
  --ok: #1e8a3c;
  --warn: #c27c0e;
  --bad: #d4321c;
  --sans: "Host Grotesk", "Helvetica Neue", Helvetica, Arial, sans-serif;
  /* the only three font sizes */
  --fs-s: 15px;
  --fs-m: clamp(26px, 2.8vw, 44px);
  --fs-l: clamp(48px, 6.6vw, 120px);
  --pad: clamp(16px, 2vw, 28px);
  --gap: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  /* behind white text on art: dark where the text sits, clear above it */
  --scrim: linear-gradient(to top, rgb(0 0 0 / 0.8), rgb(0 0 0 / 0.55) 30%, rgb(0 0 0 / 0.2) 52%, rgb(0 0 0 / 0) 70%);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 var(--fs-s)/1.45 var(--sans);
  letter-spacing: -0.005em;
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
img { display: block; max-width: 100%; height: auto; }
p { margin: 0 0 0.8em; }
h1, h2, h3, h4 { margin: 0; font-size: var(--fs-s); font-weight: 500; }
a { color: inherit; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
:focus-visible { outline: 2px solid currentColor; outline-offset: 3px; }
table { border-collapse: collapse; }
time { white-space: nowrap; }
.sub { font-weight: 400; }
.skip { position: absolute; left: -999px; top: 8px; background: var(--ink); color: #fff; padding: 6px 12px; z-index: 20; }
.skip:focus { left: 8px; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.arrow { width: 14px; height: 10px; flex: none; transition: translate 0.3s var(--ease); }
a:hover > .arrow { translate: 3px 0; }

/* Large type: frame titles, section and page titles, the footer name. */
.frame-title, .section-head h2, .page-title, .footer-name {
  font-size: var(--fs-l);
  font-weight: 500;
  letter-spacing: -0.05em;
  line-height: 0.8;
}
/* Medium type: statements and the wordmark. */
.statement, .wordmark {
  font-size: var(--fs-m);
  font-weight: 500;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

/* ---------- top bar ---------- */

/* A solid black bar above the art, so the wordmark and menu always read. */
.topbar {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 16px;
  padding: 14px var(--pad);
  background: var(--ink);
  color: #fff;
}
.topbar a { text-decoration: none; }
.topbar a:hover { text-decoration: underline; }
.topnav { display: flex; gap: 22px; }
.wordmark { font-weight: 600; letter-spacing: -0.05em; line-height: 1; }
.topbar .wordmark:hover { text-decoration: none; }
.topstatus { justify-self: end; display: inline-flex; align-items: center; }
[data-live="summary"]::before {
  content: ""; display: inline-block; flex: none; width: 7px; height: 7px; border-radius: 50%; margin-right: 8px;
  background: #9a9a9a;
}
[data-live][data-state="up"]::before { background: #3fc463; }
[data-live][data-state="slow"]::before { background: #f0a92e; }
[data-live][data-state="down"]::before { background: #f04a32; }

/* ---------- frames: art with the title on it ---------- */

/* Home: the games as a grid of frames, two across. */
.reel { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--gap); }
.reel > .frame:last-child:nth-child(odd) { grid-column: 1 / -1; aspect-ratio: 3 / 1; }

.frame {
  position: relative;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: #111;
  color: #fff;
  isolation: isolate;
  container-type: size;
}
.frame-art { position: absolute; inset: 0; z-index: -2; }
.frame-art picture { display: contents; }
.frame-art img {
  width: 100%; height: 100%; object-fit: cover;
  transition: scale 1.4s var(--ease);
}
.frame:hover .frame-art img { scale: 1.03; }
/* The one gradient: a dark scrim so white text reads on any art. */
.frame::after {
  content: ""; position: absolute; inset: 0; z-index: -1; pointer-events: none;
  background: var(--scrim);
}
.frame-foot {
  position: absolute; left: 0; right: 0; bottom: 0;
  padding: 0 var(--pad) var(--pad);
}
.frame-tag { display: flex; flex-wrap: wrap; gap: 0 1.4em; margin: 0 0 12px; }
.frame-title { margin: 0 0 18px -0.04em; }
.frame-title a { text-decoration: none; }
.frame-title a::after { content: ""; position: absolute; inset: 0; z-index: 1; } /* whole frame is the link */
.frame-meta { position: relative; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 24px; }
.frame-tagline { font-weight: 500; margin: 0; }
.frame-meta .btn-line { margin-left: auto; }
.status { display: inline-flex; align-items: center; gap: 8px; margin: 0; }
.dot { flex: none; width: 7px; height: 7px; border-radius: 50%; background: #9a9a9a; }
[data-state="up"] .dot { background: #3fc463; }
[data-state="slow"] .dot { background: #f0a92e; }
[data-state="down"] .dot { background: #f04a32; }

/* Buttons: outlined on art, solid on white. */
.btn-line, .btn {
  display: inline-flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  line-height: 1;
  text-decoration: none; border-radius: 2px;
  transition: background-color 0.2s, color 0.2s;
}
.btn-line { border: 1px solid currentColor; color: #fff; }
.btn-line:hover { background: #fff; color: #000; }
.btn { background: var(--ink); color: #fff; border: 1px solid var(--ink); }
.btn:hover { background: #fff; color: var(--ink); }

/* ---------- sections ---------- */

.section { padding: clamp(64px, 9vw, 140px) var(--pad) 0; }
.section-tight { padding-top: 32px; }
.section-head {
  display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 32px; flex-wrap: wrap;
  border-top: 1px solid var(--ink); padding-top: 14px; margin-bottom: 28px;
}
.section-head h2 { line-height: 0.85; }
.section-head p { max-width: 36ch; margin: 0; }

/* Gallery wall: rows of two (2:1 or 1:2) and rows of three. The aspect
   ratios make both items in a row the same height (a 1fr item next to a 2fr
   16:9 item is 8:9). */
.wall { display: grid; gap: 30px; }
.row { display: grid; gap: 10px; align-items: start; }
.r-21 { grid-template-columns: 2fr 1fr; }
.r-12 { grid-template-columns: 1fr 2fr; }
.r-111 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.r-solo { grid-template-columns: 2fr 1fr; }
.row figure { margin: 0; min-width: 0; }
.shot { display: block; aspect-ratio: 16 / 9; overflow: hidden; background: #111; cursor: zoom-in; }
.r-21 > :last-child .shot, .r-12 > :first-child .shot { aspect-ratio: 8 / 9; }
.shot img { width: 100%; height: 100%; object-fit: cover; transition: scale 0.9s var(--ease); }
.shot:hover img { scale: 1.04; }
.row figcaption { margin-top: 8px; line-height: 1.35; max-width: 60ch; }
.row figcaption b { font-weight: 500; }

/* Live data */
.live { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 40px 28px; }
.live-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; margin-bottom: 8px; }
.live-head :is(h2, h3) { font-weight: 600; }
.live-head p { margin: 0; }
.live-head a { text-decoration: none; }
.live-head a:hover { text-decoration: underline; }
.board, .deaths { list-style: none; margin: 0; padding: 0; }
.board li { display: grid; grid-template-columns: 22px minmax(0, 1fr) auto; gap: 8px; padding: 9px 0; border-top: 1px solid var(--line); }
.deaths li { display: grid; gap: 2px; padding: 9px 0; border-top: 1px solid var(--line); line-height: 1.3; }
.who { min-width: 0; overflow-wrap: anywhere; font-weight: 500; }
.rank, .val, .nums dd { font-variant-numeric: tabular-nums; }
.val { white-space: nowrap; }
.nums { margin: 0; }
.nums div { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.nums dd { margin: 0; }
.empty { padding-top: 9px; border-top: 1px solid var(--line); }
.live-sub { font-weight: 600; margin: 18px 0 2px; }
.live-foot { margin: 8px 0 0; }

/* Server table */
.servers { width: 100%; font-variant-numeric: tabular-nums; }
.servers thead th { font-weight: 500; text-align: left; padding: 0 16px 10px 0; }
.servers td, .servers tbody th { padding: 14px 16px 14px 0; border-top: 1px solid var(--line); text-align: left; vertical-align: baseline; }
.servers tbody th { font-weight: 500; }
.servers tbody th a { text-decoration: none; }
.servers tbody th a:hover { text-decoration: underline; }
.servers tbody th .sub { display: block; }
.servers .n { text-align: right; padding-right: 0; }
.ticks { display: inline-flex; gap: 2px; vertical-align: middle; }
.ticks i { width: 3px; height: 14px; border-radius: 1px; background: var(--line); }
.ticks .t2 { background: var(--ok); }
.ticks .t1 { background: var(--warn); }
.ticks .t0 { background: var(--bad); }
.table-note { margin-top: 14px; }

/* About */
.about { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 3fr); gap: 24px 40px; }
.about-label { border-top: 1px solid var(--ink); padding-top: 14px; }
.about-body { border-top: 1px solid var(--ink); padding-top: 10px; }
.about-more { columns: 2 280px; column-gap: 40px; margin-top: 36px; }
.about-more p { break-inside: avoid; }

/* Footer */
.footer {
  display: grid; grid-template-columns: 2fr 1fr 1fr; gap: 28px 40px;
  margin-top: clamp(80px, 10vw, 160px); padding: 18px var(--pad) 28px;
  border-top: 1px solid var(--ink);
}
.footer-name { margin: 0; line-height: 0.85; }
.footer-links { list-style: none; margin: 0; padding: 0; }
.footer-links li { margin: 0 0 4px; }
.footer-links a { text-decoration: none; }
.footer-links a:hover { text-decoration: underline; }
.footer-fine { grid-column: 1 / -1; margin: 24px 0 0; }

/* ---------- game page ---------- */

.frame.hero { aspect-ratio: auto; height: clamp(440px, 46vw, 82svh); }
.frame.hero .frame-art img { animation: settle 2.4s var(--ease) both; }
@keyframes settle { from { scale: 1.06; } }
.frame-next { aspect-ratio: auto; height: clamp(300px, 30vw, 480px); }
.intro {
  display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px clamp(28px, 5vw, 88px);
  padding: clamp(48px, 7vw, 104px) var(--pad) 0;
}
.intro-body { max-width: 60ch; }
.intro-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 20px; margin-top: 22px; }
.details { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 40px 28px; }
.details > div { border-top: 1px solid var(--ink); padding-top: 14px; }
.small-head { font-weight: 600; margin-bottom: 10px; }
.features { list-style: none; padding: 0; margin: 0; }
.features li { padding: 9px 0; border-top: 1px solid var(--line); }
.facts { margin: 0; }
.facts div { display: grid; grid-template-columns: 90px minmax(0, 1fr); gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.facts dt { font-weight: 500; }
.facts dd { margin: 0; }
.details .live-block { margin-top: 0; }
.hosting { margin-top: 18px; }
.next { margin-top: clamp(80px, 10vw, 160px); }
.page-game .footer { margin-top: 48px; }

/* ---------- servers page, 404 ---------- */

.page-head { padding-top: clamp(40px, 6vw, 80px); }
.page-title { margin: 0 0 32px -0.04em; }
.page-head .statement { display: flex; align-items: center; }
.page-head .statement::before { width: 0.32em; height: 0.32em; margin-right: 0.3em; }
.page-note { max-width: 60ch; margin-top: 18px; }

/* ---------- lightbox ---------- */

.lightbox { border: 0; padding: 0; background: transparent; width: 100vw; height: 100vh; max-width: 100vw; max-height: 100vh; color: #fff; touch-action: pan-y pinch-zoom; }
html:has(.lightbox[open]) { overflow: hidden; } /* the page stays put behind the viewer */
.lightbox::backdrop { background: rgb(0 0 0 / 0.95); }
.lightbox[open] { animation: fade 0.25s ease-out; }
.lightbox[open]::backdrop { animation: fade 0.25s ease-out; }
.lightbox figure { margin: 0; height: 100%; display: grid; grid-template-rows: 1fr auto; place-items: center; padding: 56px 16px 20px; }
.lightbox img { max-width: 100%; max-height: calc(100vh - 130px); object-fit: contain; }
.lightbox[open] img { animation: lift 0.35s var(--ease); }
.lightbox figcaption { padding-top: 12px; text-align: center; }
.lb-btn { position: fixed; z-index: 2; background: none; border: 0; color: #fff; font: 400 var(--fs-m)/1 var(--sans); padding: 10px 16px; cursor: pointer; }
.lb-close { top: 4px; right: 6px; }
.lb-prev { left: 4px; top: 50%; translate: 0 -50%; }
.lb-next { right: 4px; top: 50%; translate: 0 -50%; }
@keyframes fade { from { opacity: 0; } }
@keyframes lift { from { opacity: 0; scale: 0.98; } }

/* ---------- reveal on scroll (site.js adds .rise below the fold) ---------- */

.row figure, .reel > .frame, .section-head, .live-block, .details > div, .about-body, .intro {
  transition: opacity 0.9s var(--ease), translate 0.9s var(--ease);
}
.row figure:nth-child(2) { transition-delay: 0.08s; }
.row figure:nth-child(3) { transition-delay: 0.16s; }
.reel > .frame:nth-child(even) { transition-delay: 0.08s; }
.rise { opacity: 0; translate: 0 28px; }

/* ---------- smaller screens ---------- */

@media (max-width: 1000px) {
  .live { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .details { grid-template-columns: 1fr 1fr; }
  .details > div:nth-child(3) { grid-column: 1 / -1; }
  .intro { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .topbar { grid-template-columns: auto 1fr auto; }
  .wordmark { order: -1; }
  .topnav { justify-content: center; gap: 16px; }
  .topnav a:nth-child(n + 3) { display: none; }
  .topstatus { font-size: 0; } /* keep only the dot */
  .topstatus::before { margin-right: 0; width: 9px; height: 9px; }
  .reel { grid-template-columns: 1fr; }
  .reel > .frame, .reel > .frame:last-child:nth-child(odd) { aspect-ratio: 4 / 5; }
  .frame.hero { height: 78svh; }
  .frame-meta .btn-line { margin-left: 0; }
  .wall { gap: 26px; }
  .row, .r-21, .r-12, .r-111, .r-solo { grid-template-columns: 1fr; gap: 22px; }
  .row .shot, .r-21 > :last-child .shot, .r-12 > :first-child .shot { aspect-ratio: 16 / 9; }
  .about { grid-template-columns: 1fr; }
  .about-label { border-top: 0; padding-top: 0; }
  .footer { grid-template-columns: 1fr 1fr; }
  .footer-name { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .live, .details { grid-template-columns: 1fr; }
  /* Server table as stacked records. */
  .servers thead { display: none; }
  .servers, .servers tbody, .servers tr, .servers td, .servers tbody th { display: block; width: 100%; }
  .servers tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .servers td, .servers tbody th { border: 0; padding: 3px 0; }
  .servers td { display: flex; justify-content: space-between; gap: 12px; text-align: right; }
  .servers td::before { content: attr(data-label); text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
  .rise { opacity: 1; translate: none; }
}
