/* Loose Bolt: one stylesheet for the home page, every arcade play page and the
   credits page. Generated pages come from tools/arcade.py; this file is hand
   written.

   The look: painted machine-shop steel (deep indigo) behind the games, and the
   site's one loud thing is safety yellow, used for the header bar, the selected
   category and the buttons. Game thumbnails carry the colour everywhere else.
   A tile tips a couple of degrees when you point at it: a bolt coming loose. */

@font-face {
  font-family: "Rubik";
  src: url("fonts/rubik-latin-wght.woff2") format("woff2");
  font-weight: 300 900;
  font-display: swap;
}

:root {
  --steel: #262e63;   /* page */
  --panel: #323b7d;   /* chips, empty thumbnails */
  --deep:  #1d2450;   /* footer, frame surround */
  --line:  #4a559e;
  --bolt:  #ffc914;   /* safety yellow */
  --ink:   #1c1f3a;   /* text on yellow: 13.1:1 */
  --chalk: #f3f5ff;   /* text on steel: 12.4:1 */
  --muted: #bcc3ec;   /* secondary text on steel: 7.6:1 */
  color-scheme: dark;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  background: var(--steel);
  color: var(--chalk);
  font: 400 16px/1.5 "Rubik", system-ui, -apple-system, "Segoe UI", sans-serif;
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
main { flex: 1; }
a { color: inherit; }
img { display: block; max-width: 100%; }
button { font: inherit; cursor: pointer; }
:focus-visible { outline: 3px solid var(--bolt); outline-offset: 2px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.wrap { width: 100%; max-width: 1280px; margin: 0 auto; padding: 0 16px; }
@media (min-width: 700px) { .wrap { padding: 0 28px; } }

/* --- header ------------------------------------------------------------ */
.top { background: var(--bolt); color: var(--ink); }
.top-in {
  max-width: 1280px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 12px 24px; flex-wrap: wrap;
}
@media (min-width: 700px) { .top-in { padding: 12px 28px; } }
.logo {
  display: inline-flex; align-items: center; gap: 9px; text-decoration: none;
  font-weight: 800; font-size: 25px; letter-spacing: -0.03em; line-height: 1;
}
.logo .mark { width: 34px; height: 34px; flex: none; }
.logo .mark path { fill: currentColor; }
.logo.small { font-size: 19px; }
.logo.small .mark { width: 26px; height: 26px; }
.search { flex: 1 1 220px; max-width: 440px; margin-left: auto; }
.search input {
  width: 100%; font: 500 16px "Rubik", system-ui, sans-serif; color: var(--ink);
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%231c1f3a' stroke-width='2.6' stroke-linecap='round'%3E%3Ccircle cx='10.5' cy='10.5' r='6.5'/%3E%3Cpath d='m15.5 15.5 5 5'/%3E%3C/svg%3E") no-repeat 14px 50% / 18px;
  border: 2px solid var(--ink); border-radius: 999px; padding: 9px 16px 9px 42px;
}
.search input::placeholder { color: #5b5f7c; }
.search input:focus-visible { outline: 3px solid var(--ink); outline-offset: 1px; }
@media (max-width: 520px) { .search { flex-basis: 100%; max-width: none; } }

/* --- shelves ----------------------------------------------------------- */
.shelf-h {
  font-size: clamp(22px, 3vw, 28px); font-weight: 800; letter-spacing: -0.02em;
  line-height: 1.1; margin: 30px 0 14px;
}
.count { color: var(--muted); font-weight: 500; font-size: .62em; margin-left: 6px; vertical-align: 2px; }

.tile { display: flex; flex-direction: column; text-decoration: none; color: var(--chalk); min-width: 0; }
.tile[hidden] { display: none; }
.pic {
  position: relative; display: block; aspect-ratio: 16 / 9; overflow: hidden;
  border-radius: 12px; background: var(--panel);
  transition: transform .16s cubic-bezier(.3, .7, .4, 1.4);
}
.pic img { width: 100%; height: 100%; object-fit: cover; }
.tile:hover .pic, .tile:focus-visible .pic { transform: rotate(-2deg) translateY(-3px); }
.tile:focus-visible { outline: none; }
.tile:focus-visible .pic { outline: 3px solid var(--bolt); outline-offset: 3px; }
@media (prefers-reduced-motion: reduce) {
  .pic { transition: none; }
  .tile:hover .pic, .tile:focus-visible .pic { transform: none; }
}
.name { font-weight: 600; font-size: 15.5px; margin-top: 8px; line-height: 1.25; }
.line { color: var(--muted); font-size: 14px; margin-top: 3px; }
.ours {
  position: absolute; left: 8px; top: 8px;
  background: var(--bolt); color: var(--ink);
  font-weight: 700; font-size: 12px; line-height: 1; padding: 5px 8px; border-radius: 6px;
}

.grid {
  display: grid; gap: 22px 16px;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
}
@media (min-width: 700px) { .grid { grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 26px 20px; } }

/* Our own five: the first one big, the other four around it. */
.featured { display: grid; gap: 22px 16px; grid-template-columns: repeat(2, 1fr); }
.featured .big { grid-column: 1 / -1; }
@media (min-width: 900px) {
  .featured { grid-template-columns: repeat(4, 1fr); gap: 26px 20px; }
  .featured .big { grid-column: span 2; grid-row: span 2; }
}
.featured .ours { display: none; }
.featured .big .name { font-size: clamp(20px, 2.4vw, 26px); font-weight: 700; margin-top: 10px; }
.featured .big .line { font-size: 16px; }
.featured .big .pic { border-radius: 16px; }

.all { margin-top: 18px; }
.all-head { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; margin-bottom: 18px; }
.all-head .shelf-h { margin-bottom: 0; }
.chips {
  display: flex; gap: 8px; margin-top: 30px; overflow-x: auto; scrollbar-width: none;
  -webkit-overflow-scrolling: touch; max-width: 100%; padding: 3px;
}
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; border: 0; border-radius: 999px; padding: 8px 15px;
  background: var(--panel); color: var(--chalk); font-weight: 600; font-size: 15px;
}
.chip:hover { background: var(--line); }
.chip[aria-pressed="true"] { background: var(--bolt); color: var(--ink); }
@media (max-width: 699px) { .chips { margin: 4px -16px 0; padding: 3px 16px; max-width: none; width: calc(100% + 32px); } }

.none { color: var(--muted); margin: 8px 0 20px; }
.none button { background: none; border: 0; color: var(--chalk); text-decoration: underline; padding: 0; }

/* --- a game's page ----------------------------------------------------- */
.stage {
  margin-top: 16px; background: #000; border-radius: 14px; overflow: hidden;
  height: clamp(420px, calc(100dvh - 160px), 860px);
}
@media (max-width: 699px) {
  .stage { margin: 0 -16px; border-radius: 0; height: calc(100dvh - 120px); min-height: 380px; }
}
.stage:fullscreen { border-radius: 0; height: 100%; }
.stage:-webkit-full-screen { border-radius: 0; height: 100%; }
/* White, not black: A Dark Room leaves its body transparent and sets black
   text, assuming a white page behind it. On a black frame it was invisible. */
#game { display: block; width: 100%; height: 100%; border: 0; background: #fff; }

.info { max-width: 820px; margin-top: 18px; }
.title-row { display: flex; align-items: center; gap: 12px 20px; flex-wrap: wrap; }
.title-row h1 { font-size: clamp(26px, 4vw, 36px); font-weight: 800; letter-spacing: -0.025em; line-height: 1.1; }
.btn {
  border: 0; border-radius: 10px; padding: 10px 18px;
  background: var(--bolt); color: var(--ink); font-weight: 700; font-size: 15.5px;
}
.btn:hover { background: #ffd84f; }
.btn[hidden] { display: none; }
.maker { color: var(--muted); margin-top: 8px; font-size: 15px; }
.maker a, .about a, .lede a, .credit a { color: var(--chalk); text-underline-offset: 2px; }
.facts { display: grid; gap: 10px 28px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); margin-top: 16px; }
.facts dt { color: var(--muted); font-size: 14px; font-weight: 500; }
.facts dd { font-size: 16px; overflow-wrap: anywhere; }
.about { margin-top: 16px; max-width: 68ch; line-height: 1.6; }
.about strong { font-weight: 600; }

/* --- credits ----------------------------------------------------------- */
.narrow { max-width: 860px; }
.credits h1 { font-size: clamp(28px, 4vw, 38px); font-weight: 800; letter-spacing: -0.025em; margin-top: 30px; }
.lede { color: var(--muted); max-width: 68ch; margin-top: 12px; line-height: 1.6; }
.credit { border-top: 1px solid var(--line); margin-top: 30px; padding-top: 22px; scroll-margin-top: 16px; }
.credit h2 { font-size: 23px; font-weight: 700; }
.credit h2 a { text-decoration: none; }
.credit h2 a:hover { text-decoration: underline; }
.credit h3 { font-size: 15px; font-weight: 600; color: var(--muted); margin-top: 16px; }
.credit ul { margin: 6px 0 0 20px; font-size: 15px; line-height: 1.55; }
.credit li + li { margin-top: 4px; }

.moved { margin: 40px 0; font-size: 18px; }

/* --- footer ------------------------------------------------------------ */
.foot { background: var(--deep); color: var(--muted); margin-top: 56px; }
.foot-in {
  max-width: 1280px; margin: 0 auto; padding: 26px 16px 34px;
  display: flex; flex-wrap: wrap; align-items: center; gap: 12px 28px; font-size: 15px;
}
@media (min-width: 700px) { .foot-in { padding: 28px 28px 36px; } }
.foot .logo { color: var(--chalk); }
.foot nav { display: flex; flex-wrap: wrap; gap: 8px 22px; margin-left: auto; }
.foot nav a { color: var(--chalk); text-underline-offset: 2px; }
