/* tools/web/site.css — the landing page and the player pages (tools/web.ts). */

:root {
  color-scheme: dark;
  --bg: #0d0f14;
  --panel: #151922;
  --line: #262c38;
  --text: #dfe4ec;
  --muted: #8d97a8;
  --accent: #f4c35a;
  --accent-ink: #1b1505;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
}

a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: 2px; }
a:hover { color: #ffd98a; }

h1, h2 { line-height: 1.2; }

kbd {
  display: inline-block;
  min-width: 1.9em;
  padding: 2px 6px;
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  background: #1c212b;
  color: var(--text);
  font: 12px/1.4 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  text-align: center;
  white-space: nowrap;
}

/* Pixel art: nearest-neighbour scaling for the previews and the game. */
.shot img,
.stage canvas {
  image-rendering: crisp-edges;
  image-rendering: pixelated;
}

table.controls { border-collapse: collapse; }
table.controls th {
  padding: 3px 14px 3px 0;
  font-weight: normal;
  text-align: left;
  vertical-align: top;
  white-space: nowrap;
}
table.controls td { padding: 4px 0; color: var(--muted); }
.pointer-key { font-size: 13px; color: var(--text); }

.site-footer {
  max-width: 1040px;
  margin: 32px auto 0;
  padding: 16px 16px 32px;
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 13px;
}

/* ---- landing ------------------------------------------------------------ */

.landing .site-header,
.landing .games {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 16px;
}

.landing .site-header { padding-top: 40px; padding-bottom: 12px; }
.landing h1 { margin: 0 0 8px; font-size: 28px; letter-spacing: 0.01em; }
.landing .intro { max-width: 640px; margin: 0; color: var(--muted); }
.landing .links { margin: 8px 0 0; }
.landing .elsewhere { color: var(--muted); font-size: 13px; margin-left: 6px; }


.game-card {
  display: grid;
  grid-template-columns: 480px 1fr;
  gap: 24px;
  align-items: start;
  padding: 24px 0;
  border-top: 1px solid var(--line);
}
.game-card:first-child { margin-top: 16px; }

.shot { text-decoration: none; }

.shot img {
  display: block;
  width: 480px;
  height: auto;
  background: #000;
  border-radius: 3px;
  box-shadow: 0 0 0 1px var(--line);
}

/* A game without a preview image yet. */
.no-preview {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 480px;
  max-width: 100%;
  aspect-ratio: 480 / 272;
  padding: 16px;
  border-radius: 3px;
  background: repeating-linear-gradient(45deg, #11141b 0 8px, #151922 8px 16px);
  box-shadow: 0 0 0 1px var(--line);
  color: var(--muted);
  font-size: 18px;
  text-align: center;
}

.card-body h2 { margin: 0 0 6px; font-size: 20px; }
.card-body h2 a { color: var(--text); text-decoration: none; }
.card-body h2 a:hover { color: var(--accent); }
.card-body .description { margin: 0 0 12px; }
.card-body table.controls { font-size: 13px; }

.play {
  display: inline-block;
  margin-top: 4px;
  padding: 7px 14px;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
  text-decoration: none;
}
.play:hover { background: #ffd98a; color: var(--accent-ink); }

@media (max-width: 860px) {
  .game-card { grid-template-columns: 1fr; gap: 14px; }
  .shot img { width: 100%; max-width: 480px; }
}
/* Below 1x a nearest-neighbour preview drops whole rows; smooth it instead. */
@media (max-width: 511px) {
  .shot img { image-rendering: auto; }
}

/* ---- player ------------------------------------------------------------- */

.bar {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 4px 18px;
  padding: 12px 16px;
}
.bar h1 { margin: 0; font-size: 18px; }
.back { font-size: 14px; }

.screen-area {
  display: flex;
  justify-content: center;
  padding: 0 16px;
}

/* tools/web/player.js sets the exact size: a whole number of device pixels
   per game pixel. Until then, 2x. */
.stage {
  position: relative;
  width: 960px;
  max-width: 100%;
  background: #000;
  outline: none;
  box-shadow: 0 0 0 1px var(--line);
}
.stage[data-focused="true"] { box-shadow: 0 0 0 1px var(--accent); }

.stage canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  user-select: none;
  -webkit-user-select: none;
}

.overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 16px;
  background: rgba(8, 9, 12, 0.78);
  text-align: center;
}
.overlay[hidden] { display: none; }
.overlay p { margin: 0; max-width: 36em; }
.stage[data-state="error"] .overlay p { color: #ffb4a8; }
.overlay button {
  padding: 6px 14px;
  border: 0;
  border-radius: 4px;
  background: var(--accent);
  color: var(--accent-ink);
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.focus-hint {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);
  margin: 0;
  padding: 5px 12px;
  border: 1px solid var(--accent);
  border-radius: 999px;
  background: rgba(13, 15, 20, 0.88);
  font-size: 13px;
  white-space: nowrap;
  pointer-events: none;
}
.focus-hint[hidden] { display: none; }

.caption {
  margin: 10px auto 0;
  padding: 0 16px;
  max-width: 720px;
  color: var(--muted);
  font-size: 13px;
  text-align: center;
}

.info {
  max-width: 720px;
  margin: 20px auto 0;
  padding: 0 16px;
}
.info .description { margin: 0 0 16px; }
.info h2 { margin: 0 0 8px; font-size: 16px; }

.noscript { text-align: center; color: #ffb4a8; }

/* On-screen buttons, only where there is no hovering mouse. */
.pad {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  max-width: 520px;
  margin: 14px auto 0;
  padding: 0 16px;
  user-select: none;
  -webkit-user-select: none;
  -webkit-touch-callout: none;
}
@media (hover: hover) and (pointer: fine) {
  .pad { display: none; }
}
@media (hover: none) and (pointer: coarse) {
  .caption { display: none; }
}
.pad button {
  min-width: 48px;
  height: 48px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--panel);
  color: var(--text);
  font: 600 16px/1 system-ui, sans-serif;
  touch-action: none;
}
.pad button.held { background: var(--accent); color: var(--accent-ink); }
.dpad {
  display: grid;
  grid-template-columns: repeat(3, 48px);
  grid-template-rows: repeat(3, 48px);
  gap: 4px;
}
.dpad .up { grid-area: 1 / 2; }
.dpad .left { grid-area: 2 / 1; }
.dpad .right { grid-area: 2 / 3; }
.dpad .down { grid-area: 3 / 2; }
.pad .actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
  max-width: 220px;
}
.pad .actions button { border-radius: 24px; padding: 0 12px; }
.pad .pad-select, .pad .pad-start { font-size: 12px; height: 36px; }
