/* ---------- shared base ---------- */

:root {
  --bg: #fff;
  --ink: #000;
  --muted: #6e6e6e;
  --line: #e2e2e2;
  --soft: #efefef;
  --surface: #fff;
  --accent: var(--ink);
  --gap: 16px;
  --radius: 0px;
  --btn-radius: 0px;
  --pad: clamp(16px, 4vw, 56px);
  --max: 1600px;
  --font: system-ui, sans-serif;
  --display: var(--font);
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { display: block; max-width: 100%; }
a { color: inherit; }
h1, h2, p { margin: 0; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
main:focus { outline: none; }

.skip { position: absolute; left: 12px; top: -60px; padding: 8px 12px; background: var(--ink); color: var(--bg); z-index: 10; }
.skip:focus { top: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

.top, main, .foot { width: 100%; max-width: var(--max); margin-inline: auto; padding-inline: var(--pad); }

.top {
  display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap;
  gap: 12px 32px; padding-block: 28px 40px;
}
.mark { text-decoration: none; font-family: var(--display); }
.top nav { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 28px; }
.top nav a { text-decoration: none; color: var(--muted); }
.top nav a:hover { color: var(--ink); }
.top nav a[aria-current] { color: var(--ink); text-decoration: underline; text-decoration-color: var(--accent); text-underline-offset: 7px; text-decoration-thickness: 1px; }

main { padding-bottom: 96px; }

.foot {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 24px;
  padding-block: 32px 40px; color: var(--muted); font-size: 0.875rem;
}
.foot-links { display: flex; gap: 20px; }
.foot a { text-decoration: none; }
.foot a:hover { color: var(--ink); }

/* page headings */
.page-head { margin-bottom: 36px; max-width: 60ch; }
.page-head h1 { font-family: var(--display); font-weight: 500; font-size: clamp(2rem, 4vw, 3rem); line-height: 1.05; }
.lede { color: var(--muted); margin-top: 10px; }
.back { display: inline-block; margin-bottom: 20px; color: var(--muted); text-decoration: none; font-size: 0.9rem; }
.back::before { content: "‹"; margin-right: 6px; }
.back:hover { color: var(--ink); }
.game-meta { display: flex; flex-wrap: wrap; column-gap: 14px; color: var(--muted); }
.game-head .game-meta { margin-top: 12px; }
.game-head .lede { font-size: 0.9rem; }

.empty { padding: 72px 0; color: var(--muted); }
.empty a { display: inline-block; margin-top: 8px; color: var(--ink); }

/* games list (default: rows) */
.games { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 440px), 1fr)); gap: 20px 40px; }
.game { display: flex; align-items: center; gap: 18px; text-decoration: none; }
.game-cover { display: block; flex: none; width: 132px; aspect-ratio: 3 / 2; overflow: hidden; background: var(--c, var(--soft)); border-radius: var(--radius); }
.game-cover img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s ease; }
.game-cover img.is-loaded { opacity: 1; }
.game-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.game-title { font-family: var(--display); font-size: 1.1rem; line-height: 1.25; }
.game .game-meta { font-size: 0.875rem; }
.game:hover .game-title { text-decoration: underline; text-underline-offset: 4px; text-decoration-thickness: 1px; }

/* recent games on the home page */
.recent { margin-top: clamp(64px, 9vw, 128px); }
.recent-first { margin-top: 0; }
.recent-head { display: flex; justify-content: space-between; align-items: baseline; gap: 16px; margin-bottom: 20px; }
.recent-head h2 { font-family: var(--display); font-weight: 500; font-size: 1.5rem; }
.recent-head a { color: var(--muted); font-size: 0.9rem; }
.recent-head a:hover { color: var(--ink); }

/* photo grids */
.grid-masonry { display: flex; align-items: flex-start; gap: var(--gap); }
.col { flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; gap: var(--gap); }
.grid-rows { display: flex; flex-direction: column; gap: var(--gap); }
.row { display: flex; gap: var(--gap); }
.row > .tile, .row > .fill { flex: var(--ar) 1 0%; min-width: 0; }
.tile {
  position: relative; display: block; overflow: hidden; aspect-ratio: var(--ar);
  background: var(--c, var(--soft)); border-radius: var(--radius);
}
.tile img { width: 100%; height: 100%; object-fit: cover; opacity: 0; transition: opacity 0.6s ease; }
.tile img.is-loaded { opacity: 1; }
.cap { display: none; }

/* viewer */
.lb {
  width: 100vw; height: 100dvh; max-width: none; max-height: none; margin: 0; padding: 0; border: 0;
  background: var(--lb-bg, var(--bg)); color: var(--ink); font-family: var(--font);
}
.lb[open] { display: grid; grid-template-rows: auto minmax(0, 1fr); }
.lb::backdrop { background: var(--lb-bg, var(--bg)); }
.lb-bar { display: flex; align-items: center; gap: 20px; padding: 14px var(--pad); }
.lb-where { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-count { color: var(--muted); font-variant-numeric: tabular-nums; font-size: 0.9rem; }
.lb-actions { display: flex; gap: 8px; }
.lb-btn {
  font: inherit; font-size: 0.9rem; line-height: 1; padding: 10px 16px; color: inherit; background: none;
  border: 1px solid var(--line); border-radius: var(--btn-radius); cursor: pointer; text-decoration: none;
}
.lb-download { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.lb-stage { position: relative; display: flex; align-items: center; justify-content: center; min-height: 0; padding: 0 80px 28px; }
.lb-stage img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.lb-nav {
  position: absolute; top: 50%; translate: 0 -50%; width: 52px; height: 52px; display: grid; place-items: center;
  background: none; border: 0; color: inherit; cursor: pointer; border-radius: var(--btn-radius);
}
.lb-nav svg { width: 26px; height: 26px; fill: none; stroke: currentColor; stroke-width: 1.5; }
.lb-nav:disabled { opacity: 0.2; cursor: default; }
.lb-prev { left: 12px; }
.lb-next { right: 12px; }

@media (max-width: 640px) {
  .top { padding-block: 20px 28px; }
  .game-cover { width: 104px; }
  .lb-bar { flex-wrap: wrap; gap: 8px 16px; padding: 12px 16px; }
  .lb-where { flex-basis: 100%; order: -1; }
  .lb-actions { margin-left: auto; }
  .lb-stage { padding: 0 0 72px; }
  .lb-nav { top: auto; bottom: 10px; translate: none; }
  .lb-prev { left: 16px; }
  .lb-next { right: 16px; }
}

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

/* ---------- 1. Overview — quiet white, condensed wordmark, even grid ---------- */

[data-t="overview"] {
  --font: "Archivo", system-ui, sans-serif;
  --muted: #737373;
  --gap: clamp(10px, 1.6vw, 22px);
  --max: 1440px;
}
[data-t="overview"] .mark { font-size: 1.45rem; font-weight: 500; font-stretch: 78%; text-transform: uppercase; letter-spacing: 0.01em; }
[data-t="overview"] .top nav { font-size: 0.85rem; }
[data-t="overview"] .page-head h1 { font-stretch: 78%; font-weight: 500; font-size: clamp(2.2rem, 5vw, 3.6rem); }

/* ---------- 2. Studio — dense tight grid, pill nav, one black button ---------- */

[data-t="studio"] {
  --font: "Hanken Grotesk", system-ui, sans-serif;
  --muted: #6b6b6b;
  --line: #e4e4e2;
  --soft: #ececea;
  --gap: 6px;
  --pad: clamp(10px, 1.6vw, 20px);
  --btn-radius: 6px;
  --max: 1800px;
}
[data-t="studio"] body { font-size: 15px; }
[data-t="studio"] .top { align-items: center; padding-block: 14px; }
[data-t="studio"] .mark { font-weight: 600; font-size: 1rem; letter-spacing: -0.01em; }
[data-t="studio"] .top nav { gap: 8px; }
[data-t="studio"] .pills { display: flex; padding: 3px; background: #f1f1ef; border-radius: 8px; font-size: 0.8rem; }
[data-t="studio"] .pills a { padding: 6px 12px; border-radius: 6px; }
[data-t="studio"] .pills a[aria-current] { background: #fff; text-decoration: none; box-shadow: 0 0 0 1px #e4e4e2; }
[data-t="studio"] .top nav .cta { padding: 9px 14px; font-size: 0.8rem; font-weight: 500; color: #fff; background: #000; border-radius: 6px; }
[data-t="studio"] .page-head { margin: 28px 0 28px; }
[data-t="studio"] .page-head h1 { font-weight: 600; letter-spacing: -0.03em; }
[data-t="studio"] .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 220px), 1fr)); gap: 28px 6px; }
[data-t="studio"] .game { flex-direction: column; align-items: stretch; gap: 10px; }
[data-t="studio"] .game-cover { width: auto; aspect-ratio: 4 / 5; }
[data-t="studio"] .game-title { font-size: 0.95rem; font-weight: 500; }
[data-t="studio"] .game .game-meta { font-size: 0.8rem; }
[data-t="studio"] .foot { font-size: 0.8rem; }
@media (max-width: 640px) {
  [data-t="studio"] .pills a:not([aria-current]):not(:first-child) { display: none; }
}

/* ---------- 3. Volume — name left, menu right, even three-across grids, titles under boxes ---------- */

[data-t="volume"] {
  --font: "Figtree", system-ui, sans-serif;
  --display: var(--font);
  --muted: #6c6c6c;
  --soft: #ececec;
  --gap: clamp(12px, 2vw, 26px);
  --pad: clamp(18px, 4.4vw, 64px);
  --max: 1360px;
}
[data-t="volume"] .top { align-items: center; padding-block: clamp(24px, 4vw, 44px) clamp(36px, 6vw, 80px); }
[data-t="volume"] .mark { font-size: clamp(1.35rem, 2.2vw, 1.65rem); font-weight: 500; letter-spacing: -0.015em; }
[data-t="volume"] .top nav { gap: 6px 26px; font-size: 0.88rem; }
[data-t="volume"] .top nav a[aria-current] { text-decoration-thickness: 1.5px; }
[data-t="volume"] .top nav .icon { display: grid; place-items: center; width: 28px; height: 28px; margin-left: 4px; color: var(--ink); }
[data-t="volume"] .top nav .icon svg { width: 17px; height: 17px; }

[data-t="volume"] .page-head { margin-bottom: clamp(28px, 4vw, 48px); }
[data-t="volume"] .page-head h1 { font-weight: 500; letter-spacing: -0.025em; font-size: clamp(1.8rem, 3.6vw, 2.6rem); }
[data-t="volume"] .game-head .lede { margin-top: 6px; }

/* one square box per game, its name centered underneath */
[data-t="volume"] .games { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: clamp(28px, 4vw, 52px) var(--gap); }
[data-t="volume"] .game { display: flex; flex-direction: column; align-items: stretch; gap: 14px; text-align: center; }
[data-t="volume"] .game-cover { width: 100%; aspect-ratio: 1; position: relative; }
[data-t="volume"] .game-cover img { transition: transform 0.7s cubic-bezier(0.2, 0.7, 0.2, 1), opacity 0.6s ease; }
[data-t="volume"] .game:hover .game-cover img, [data-t="volume"] .game:focus-visible .game-cover img { transform: scale(1.035); }
[data-t="volume"] .game-cover::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent);
  transform: scaleX(0); transform-origin: left; transition: transform 0.4s ease;
}
[data-t="volume"] .game:hover .game-cover::after, [data-t="volume"] .game:focus-visible .game-cover::after { transform: scaleX(1); }
[data-t="volume"] .game-text { align-items: center; gap: 3px; }
[data-t="volume"] .game-title { font-size: clamp(1.05rem, 1.4vw, 1.2rem); font-weight: 500; letter-spacing: -0.01em; }
[data-t="volume"] .game .game-meta { justify-content: center; font-size: 0.82rem; }
[data-t="volume"] .game:hover .game-title { text-decoration: none; }

[data-t="volume"] .recent-head { margin-bottom: 24px; }
[data-t="volume"] .recent-head h2 { font-weight: 500; letter-spacing: -0.02em; font-size: clamp(1.4rem, 2.4vw, 1.75rem); }
[data-t="volume"] .recent-head a { font-size: 0.88rem; text-decoration-color: var(--accent); text-underline-offset: 5px; }

@media (max-width: 900px) {
  [data-t="volume"] .games { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  [data-t="volume"] .games { grid-template-columns: 1fr; }
  [data-t="volume"] .top nav { gap: 6px 18px; }
}

/* ---------- 4. Headline — big title on a sheet, rounded justified rows ---------- */

[data-t="headline"] {
  --font: "Bricolage Grotesque", system-ui, sans-serif;
  --muted: #6a6a6a;
  --soft: #eeeeec;
  --gap: 8px;
  --radius: 14px;
  --btn-radius: 99px;
  --max: 1480px;
  --lb-bg: #fff;
}
[data-t="headline"] body { background: #e8e8e6; padding: clamp(0px, 1.4vw, 18px); }
[data-t="headline"] .top, [data-t="headline"] main, [data-t="headline"] .foot { background: #fff; }
[data-t="headline"] .top { border-radius: 22px 22px 0 0; padding-block: 24px 24px; }
[data-t="headline"] .foot { border-radius: 0 0 22px 22px; }
[data-t="headline"] main { padding-bottom: 72px; }
[data-t="headline"] .mark { font-weight: 500; letter-spacing: -0.02em; }
[data-t="headline"] .top nav a[aria-current] { text-decoration: none; }
[data-t="headline"] .pill { display: inline-block; padding: 6px 14px; font-size: 0.8rem; background: #f0f0ee; border-radius: 99px; }
[data-t="headline"] .intro {
  display: grid; grid-template-columns: 1fr minmax(0, 30ch); align-items: end; gap: 20px 48px;
  padding: clamp(28px, 6vw, 72px) 0 clamp(28px, 4vw, 52px);
}
[data-t="headline"] .intro .pill { grid-column: 1 / -1; justify-self: start; }
[data-t="headline"] .intro h1, [data-t="headline"] .page-head h1 {
  font-size: clamp(3rem, 10vw, 8rem); font-weight: 500; letter-spacing: -0.05em; line-height: 0.92;
}
[data-t="headline"] .intro .lede { text-align: right; margin: 0 0 0.6em; color: var(--ink); }
[data-t="headline"] .page-head { max-width: none; padding-top: clamp(20px, 4vw, 48px); }
[data-t="headline"] .page-head .pill { margin-bottom: 18px; }
[data-t="headline"] .game-head h1 { font-size: clamp(2.4rem, 6vw, 5rem); }
[data-t="headline"] .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); gap: 32px 8px; }
[data-t="headline"] .game { flex-direction: column; align-items: stretch; gap: 12px; }
[data-t="headline"] .game-cover { width: auto; aspect-ratio: 4 / 3; }
[data-t="headline"] .game-title { font-size: 1.3rem; font-weight: 500; letter-spacing: -0.02em; }
[data-t="headline"] .game-text { padding-inline: 4px; }
@media (max-width: 700px) {
  [data-t="headline"] .intro { grid-template-columns: 1fr; }
  [data-t="headline"] .intro .lede { text-align: left; }
  [data-t="headline"] .top { border-radius: 0; }
  [data-t="headline"] .foot { border-radius: 0; }
}

/* ---------- 5. Night Game — dark, hero photo, titled cards ---------- */

[data-t="nightgame"] {
  --bg: #1d2025;
  --ink: #f2f2ef;
  --muted: #a2a8b0;
  --line: #3a3f47;
  --soft: #2a2e35;
  --font: "Barlow", system-ui, sans-serif;
  --display: "Barlow Condensed", "Barlow", sans-serif;
  --gap: 12px;
  --radius: 10px;
  --btn-radius: 99px;
  --lb-bg: #15171b;
  --max: 1520px;
}
[data-t="nightgame"] .mark { font-size: 1.35rem; font-weight: 600; letter-spacing: 0.01em; }
[data-t="nightgame"] .top { padding-block: 22px 26px; }
[data-t="nightgame"] .hero { position: relative; border-radius: 16px; overflow: hidden; margin-bottom: 56px; background: var(--soft); }
[data-t="nightgame"] .hero img { width: 100%; height: clamp(340px, 66vh, 700px); object-fit: cover; }
[data-t="nightgame"] .hero::after { content: ""; position: absolute; inset: 40% 0 0; background: linear-gradient(transparent, rgb(0 0 0 / 0.72)); }
[data-t="nightgame"] .hero-text { position: absolute; left: 0; right: 0; bottom: 0; z-index: 1; padding: clamp(20px, 4vw, 48px); color: #fff; }
[data-t="nightgame"] .hero h1 { font-family: var(--display); font-weight: 600; font-size: clamp(2.6rem, 7vw, 5.6rem); line-height: 0.95; }
[data-t="nightgame"] .hero p { margin-top: 10px; max-width: 46ch; color: rgb(255 255 255 / 0.85); }
[data-t="nightgame"] .button { display: inline-block; margin-top: 22px; padding: 12px 22px; background: #fff; color: #000; text-decoration: none; font-weight: 500; border-radius: 99px; }
[data-t="nightgame"] .section-title, [data-t="nightgame"] .page-head h1 { font-family: var(--display); font-weight: 600; }
[data-t="nightgame"] .section-title { font-size: 1.6rem; margin-bottom: 18px; }
[data-t="nightgame"] .page-head h1 { font-size: clamp(2.6rem, 6vw, 4.2rem); }
[data-t="nightgame"] .grid-rows .cap {
  display: block; position: absolute; left: 0; right: 0; bottom: 0; padding: 36px 14px 12px;
  font-family: var(--display); font-weight: 500; font-size: 1.05rem; color: #fff;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.6));
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
[data-t="nightgame"] .game-head ~ .grid .cap { display: none; }
[data-t="nightgame"] .games { grid-template-columns: repeat(auto-fill, minmax(min(100%, 300px), 1fr)); gap: 12px; }
[data-t="nightgame"] .game { position: relative; display: block; border-radius: var(--radius); overflow: hidden; }
[data-t="nightgame"] .game-cover { width: 100%; aspect-ratio: 4 / 3; }
[data-t="nightgame"] .game-text {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 48px 16px 14px; color: #fff;
  background: linear-gradient(transparent, rgb(0 0 0 / 0.75));
}
[data-t="nightgame"] .game-title { font-family: var(--display); font-size: 1.55rem; font-weight: 600; }
[data-t="nightgame"] .game .game-meta { color: rgb(255 255 255 / 0.78); }
[data-t="nightgame"] .lb-download { background: #fff; color: #000; border-color: #fff; }
