/* Self-hosted fonts (SIL OFL 1.1, see assets/fonts/OFL-*.txt), latin subset from @fontsource */
@font-face { font-family: "Inter"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/inter-latin-400.woff2") format("woff2"); }
@font-face { font-family: "Inter"; font-style: normal; font-weight: 600; font-display: swap; src: url("fonts/inter-latin-600.woff2") format("woff2"); }
@font-face { font-family: "Press Start 2P"; font-style: normal; font-weight: 400; font-display: swap; src: url("fonts/press-start-2p-latin-400.woff2") format("woff2"); }

/* Free Tools Association: dark, minimal, one retro accent (the six-color Apple stripe). */
:root {
  --bg: #0c0c0e;
  --surface: #151518;
  --surface-2: #1d1d21;
  --line: #2a2a30;
  --text: #e9e7e2;
  --muted: #9b9892;
  --accent: #fdb827;
  --stripe: linear-gradient(90deg, #61bb46 0 16.66%, #fdb827 0 33.33%, #f5821f 0 50%, #e03a3e 0 66.66%, #963d97 0 83.33%, #009ddc 0);
  --pixel: "Press Start 2P", ui-monospace, monospace;
  --sans: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  --max: 1160px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 16px/1.6 var(--sans);
  -webkit-font-smoothing: antialiased;
}
body::before { content: ""; display: block; height: 4px; background: var(--stripe); }
a { color: inherit; }
img { display: block; max-width: 100%; }
.pixelated { image-rendering: pixelated; }
.wrap { max-width: var(--max); margin: 0 auto; padding: 0 16px; }

/* ---- header / footer */
.site-header { border-bottom: 1px solid var(--line); }
.site-header .wrap { display: flex; align-items: center; gap: 24px; height: 64px; }
.brand { font: 13px/1 var(--pixel); letter-spacing: 1px; text-decoration: none; white-space: nowrap; }
.brand small { display: block; margin-top: 6px; font: 11px/1 var(--sans); letter-spacing: 0; color: var(--muted); }
.site-nav { margin-left: auto; display: flex; gap: 20px; }
.site-nav a { color: var(--muted); text-decoration: none; font-size: 15px; }
.site-nav a:hover, .site-nav a[aria-current="page"] { color: var(--text); }
.site-footer { margin-top: 96px; border-top: 1px solid var(--line); color: var(--muted); font-size: 13px; }
.site-footer .wrap { padding-top: 24px; padding-bottom: 40px; display: flex; flex-wrap: wrap; gap: 8px 24px; justify-content: space-between; }

/* ---- hero */
.hero { padding: 72px 0 40px; }
.hero h1 { margin: 0 0 20px; font: clamp(20px, 4vw, 34px)/1.35 var(--pixel); letter-spacing: 1px; }
.hero p { margin: 0; max-width: 640px; color: var(--muted); font-size: 18px; }

/* ---- filters */
.filters { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin: 8px 0 28px; }
.chip {
  font: 14px/1 var(--sans); color: var(--muted); background: transparent;
  border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px; cursor: pointer;
}
.chip:hover { color: var(--text); border-color: #444; }
.chip[aria-pressed="true"] { color: #000; background: var(--text); border-color: var(--text); }
.chip .n { opacity: .55; margin-left: 4px; }
.search {
  margin-left: auto; min-width: 0; width: 220px; font: 14px var(--sans); color: var(--text);
  background: var(--surface); border: 1px solid var(--line); border-radius: 999px; padding: 9px 14px;
}
.search:focus { outline: none; border-color: #555; }
.empty { color: var(--muted); padding: 40px 0; }

/* ---- gallery */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 28px 20px; }
.card { text-decoration: none; display: block; }
.card .shot {
  position: relative; aspect-ratio: 8 / 5; overflow: hidden; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--line);
}
.card .shot img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; transition: transform .35s ease; }
.card:hover .shot img { transform: scale(1.04); }
.card .play {
  position: absolute; right: 10px; bottom: 10px; width: 34px; height: 34px; border-radius: 50%;
  display: grid; place-items: center; background: rgba(0,0,0,.65); backdrop-filter: blur(4px);
  opacity: 0; transition: opacity .2s;
}
.card:hover .play, .card:focus-visible .play { opacity: 1; }
.card h3 { margin: 12px 0 2px; font-size: 16px; font-weight: 600; }
.meta { color: var(--muted); font-size: 13px; }
.meta span + span::before { content: "·"; margin: 0 6px; }
.year-head { grid-column: 1 / -1; margin: 20px 0 -8px; font: 12px/1 var(--pixel); color: var(--muted); }

/* ---- app page */
.crumbs { padding: 28px 0 0; font-size: 14px; color: var(--muted); }
.crumbs a { text-decoration: none; }
.crumbs a:hover { color: var(--text); }
.app-head { padding: 28px 0 32px; display: grid; gap: 40px; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); align-items: start; }
.app-head h1 { margin: 6px 0 10px; font: clamp(20px, 3.5vw, 28px)/1.35 var(--pixel); }
.tag { display: inline-block; font-size: 12px; text-transform: uppercase; letter-spacing: .08em; color: var(--accent); }
.hero-shot { aspect-ratio: 8 / 5; border-radius: var(--radius); overflow: hidden; background: var(--surface); border: 1px solid var(--line); }
.hero-shot img { width: 100%; height: 100%; object-fit: contain; image-rendering: pixelated; }
.actions { display: flex; flex-wrap: wrap; gap: 10px; margin: 24px 0 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px; text-decoration: none; cursor: pointer;
  font: 600 15px/1 var(--sans); padding: 13px 18px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--surface-2); color: var(--text);
}
.btn:hover { border-color: #555; }
.btn.primary { background: var(--text); color: #000; border-color: var(--text); }
.btn.primary:hover { background: #fff; }
.btn small { font-weight: 400; opacity: .65; }
.prose { max-width: 680px; font-size: 17px; }
.prose p { margin: 0 0 1em; }
.prose a { color: var(--accent); }
h2.section { margin: 56px 0 18px; font: 12px/1 var(--pixel); letter-spacing: 1px; color: var(--muted); text-transform: uppercase; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 12px; }
.shots button { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); cursor: zoom-in; aspect-ratio: 8 / 5; }
.shots img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.eggs { width: 100%; max-width: 680px; border-collapse: collapse; font-size: 15px; }
.eggs td { padding: 12px 0; border-top: 1px solid var(--line); vertical-align: top; }
.eggs td:first-child { width: 45%; padding-right: 16px; font-family: ui-monospace, monospace; font-size: 13px; color: var(--accent); }
.pager { display: flex; justify-content: space-between; gap: 16px; margin-top: 64px; padding-top: 24px; border-top: 1px solid var(--line); }
.pager a { text-decoration: none; color: var(--muted); font-size: 14px; }
.pager a:hover { color: var(--text); }
.pager b { display: block; color: var(--text); font-weight: 600; }

/* ---- lightbox */
dialog.lightbox { padding: 0; border: 0; background: transparent; max-width: 96vw; max-height: 92vh; }
dialog.lightbox::backdrop { background: rgba(0,0,0,.88); }
dialog.lightbox img { width: min(960px, 96vw); max-height: 92vh; object-fit: contain; image-rendering: pixelated; }
dialog.lightbox.photo img { image-rendering: auto; width: auto; max-width: 96vw; }

/* ---- player */
body.player { min-height: 100vh; display: flex; flex-direction: column; }
.player-bar { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line); font-size: 14px; }
.player-bar a { text-decoration: none; color: var(--muted); }
.player-bar a:hover { color: var(--text); }
.player-bar .title { font-weight: 600; }
.player-bar .sp { flex: 1; }
.player-bar button { font: 14px var(--sans); color: var(--text); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; padding: 7px 12px; cursor: pointer; }
.stage { flex: 1; position: relative; display: grid; place-items: center; padding: 16px; background: #000; }
.screen { --ar: 1.524; position: relative; width: min(100%, calc((100vh - 140px) * var(--ar))); aspect-ratio: 704 / 462; }
.screen canvas { width: 100%; height: 100%; display: block; outline: none; image-rendering: pixelated; }
.overlay {
  position: absolute; inset: 0; display: grid; place-items: center; text-align: center;
  background: rgba(0,0,0,.72) center / cover no-repeat; cursor: pointer; border: 0; color: var(--text); font: inherit;
}
.overlay .big { font: 14px/1.6 var(--pixel); display: flex; flex-direction: column; align-items: center; gap: 18px; }
.overlay .ring { width: 72px; height: 72px; border-radius: 50%; display: grid; place-items: center; background: var(--text); color: #000; }
.overlay.loading { cursor: progress; }
.status { padding: 10px 16px; font-size: 13px; color: var(--muted); border-top: 1px solid var(--line); min-height: 40px; }
.status.err { color: #ff8a80; }
kbd { font: 12px ui-monospace, monospace; padding: 1px 5px; border: 1px solid var(--line); border-radius: 4px; background: var(--surface); }

/* ---- about */
.about-section { margin-top: 64px; }
.about-section h2 { margin: 0 0 12px; font: 13px/1.5 var(--pixel); }
.about-section > p { max-width: 680px; color: var(--muted); }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 16px; margin-top: 20px; }
.photos.wide { grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.photos figure { margin: 0; }
.photos button { padding: 0; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; background: var(--surface); cursor: zoom-in; width: 100%; aspect-ratio: 4 / 3; }
.photos.docs button { aspect-ratio: 3 / 4; }
.photos img { width: 100%; height: 100%; object-fit: cover; }
.photos figcaption { margin-top: 8px; font-size: 13px; color: var(--muted); }
.labels { display: flex; flex-wrap: wrap; gap: 32px; margin-top: 24px; align-items: center; }
.labels figure { margin: 0; text-align: center; font-size: 13px; color: var(--muted); }
.in-memory { margin: 96px auto 0; padding-top: 48px; max-width: 560px; border-top: 1px solid var(--line); text-align: center; }
.in-memory p { margin: 0; color: var(--muted); }
.in-memory .names { margin-top: 14px; display: flex; flex-wrap: wrap; justify-content: center; gap: 12px 72px; font-size: 20px; font-weight: 600; color: var(--text); }
.in-memory small { display: block; margin-top: 2px; font-size: 14px; font-weight: 400; color: var(--muted); }
.labels img { margin: 0 auto 8px; image-rendering: pixelated; }

@media (max-width: 760px) {
  .app-head { grid-template-columns: 1fr; gap: 24px; }
  .app-head .hero-shot { order: -1; }
  .search { margin-left: 0; width: 100%; }
  .hero { padding: 48px 0 28px; }
  .grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 20px 12px; }
  .card .play { opacity: 1; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* ---- collections tabs */
.tabs { display: flex; gap: 28px; border-bottom: 1px solid var(--line); margin: 0 0 20px; overflow-x: auto; }
.tab {
  font: 600 15px/1 var(--sans); color: var(--muted); background: none; border: 0; cursor: pointer;
  padding: 14px 0; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap;
}
.tab:hover { color: var(--text); }
.tab[aria-pressed="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab .n { margin-left: 6px; font-weight: 400; opacity: .55; }

/* ---- placeholder when there is no screenshot */
.noshot {
  width: 100%; height: 100%; display: grid; place-items: center; padding: 16px; text-align: center;
  background: repeating-linear-gradient(0deg, #141417 0 2px, #18181c 2px 4px);
}
.noshot span { font: 11px/1.7 var(--pixel); color: var(--muted); }
.hero-shot .noshot span { font-size: 14px; }

/* ---- underground */
.ug { display: grid; gap: 32px; margin-top: 24px; }
.ug h3 { margin: 0 0 10px; font-size: 15px; font-weight: 600; }
.ug .row { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.ug button { padding: 0; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; background: #000; cursor: zoom-in; aspect-ratio: 35 / 24; }
.ug img { width: 100%; height: 100%; object-fit: cover; image-rendering: pixelated; }
.note { margin-top: 16px; font-size: 14px; color: var(--muted); }

/* js-dos wraps the canvas in its own container */
.screen .dosbox-container { width: 100%; height: 100%; }
.screen .dosbox-container canvas { width: 100% !important; height: 100% !important; image-rendering: pixelated; }
.prose code { font: 14px ui-monospace, monospace; color: var(--accent); }
