/*
  Fortistic look: notebook paper, ink, a ballpoint-blue accent, and a highlighter
  for whatever just happened (the last chess move, the newest line on the scoresheet).
  Layout: one left-aligned column. On game pages the game comes first, then the text.
  System fonts only, so pages load with no extra downloads.
*/
:root {
  --paper: #f8f9fb;
  --ink: #1d2433;
  --muted: #5b6577;
  --line: #d9dee7;
  --tint: #eef1f6;
  --accent: #2346c4;
  --on-accent: #ffffff;
  --highlight: rgba(255, 213, 0, 0.5);
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Helvetica Neue", Arial, sans-serif;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #131823;
    --ink: #e7eaf0;
    --muted: #a0a9b9;
    --line: #2c3444;
    --tint: #1b2130;
    --accent: #93a8ff;
    --on-accent: #10152a;
    --highlight: rgba(255, 213, 0, 0.42);
    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --paper: #131823;
  --ink: #e7eaf0;
  --muted: #a0a9b9;
  --line: #2c3444;
  --tint: #1b2130;
  --accent: #93a8ff;
  --on-accent: #10152a;
  --highlight: rgba(255, 213, 0, 0.42);
  color-scheme: dark;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.6;
}

img {
  max-width: 100%;
  height: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

a:focus-visible,
button:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 2px;
}

h1,
h2,
h3 {
  line-height: 1.2;
  text-wrap: balance;
}

h1 {
  margin: 0 0 10px;
  font-size: 2rem;
  letter-spacing: -0.015em;
}

h2 {
  margin: 36px 0 10px;
  font-size: 1.375rem;
  letter-spacing: -0.01em;
}

h3 {
  margin: 26px 0 8px;
  font-size: 1.125rem;
}

p,
ul,
ol,
dl {
  margin: 0 0 14px;
}

.wrap {
  width: 100%;
  max-width: 1040px;
  margin: 0 auto;
  padding-right: 20px;
  padding-left: 20px;
}

.skip-link {
  position: absolute;
  top: 8px;
  left: -9999px;
  z-index: 100;
  padding: 8px 12px;
  border-radius: 8px;
  background: var(--ink);
  color: var(--paper);
}

.skip-link:focus {
  left: 12px;
}

/* Header and footer */
.site-header {
  border-bottom: 1px solid var(--line);
}

.site-header .wrap {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-height: 60px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  font-size: 1.125rem;
  font-weight: 800;
  letter-spacing: -0.01em;
  text-decoration: none;
}

.logo {
  flex: none;
  width: 26px;
  height: 26px;
}

.logo-bg {
  fill: var(--ink);
}

.logo-sq {
  fill: var(--paper);
}

.logo-hl {
  fill: #ffd500;
}

.site-nav {
  display: flex;
  gap: 20px;
}

.site-nav a {
  color: var(--ink);
  font-weight: 600;
  text-decoration: none;
}

.site-nav a:hover {
  text-decoration: underline;
}

main {
  padding-top: 28px;
  padding-bottom: 56px;
}

.site-footer {
  border-top: 1px solid var(--line);
  color: var(--muted);
  font-size: 0.875rem;
}

.site-footer .wrap {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 8px 20px;
  padding-top: 20px;
  padding-bottom: 28px;
}

.site-footer p {
  margin: 0;
}

.site-footer nav {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
}

.site-footer a {
  color: var(--muted);
}

/* Home page */
.intro {
  max-width: 40rem;
  margin-bottom: 36px;
}

.intro h1 {
  font-size: 2.75rem;
  line-height: 1.08;
  letter-spacing: -0.025em;
}

.intro p {
  margin: 0;
  color: var(--muted);
  font-size: 1.125rem;
}

.games h2,
.more-games h2 {
  margin-top: 0;
  font-size: 1.125rem;
}

.more-games {
  margin-top: 48px;
}

.game-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.game-card a {
  display: block;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--paper);
  color: var(--ink);
  text-decoration: none;
}

.game-card a:hover {
  border-color: var(--accent);
}

.game-card img {
  display: block;
  width: 100%;
  border-bottom: 1px solid var(--line);
}

.game-card-title {
  display: block;
  padding: 12px 14px 0;
  font-weight: 700;
}

.game-card-blurb {
  display: block;
  padding: 2px 14px 14px;
  color: var(--muted);
  font-size: 0.9375rem;
}

/* Game pages */
.crumbs {
  margin-bottom: 14px;
  color: var(--muted);
  font-size: 0.875rem;
}

.crumbs a {
  color: var(--muted);
}

.game-head {
  margin-bottom: 14px;
}

.game-head h1 {
  margin: 0;
}

.game-head p {
  margin: 2px 0 0;
  color: var(--muted);
}

/* Reading text */
.prose {
  max-width: 65ch;
}

.prose h2:first-child {
  margin-top: 0;
}

.prose ul {
  padding-left: 1.25em;
}

.prose li {
  margin-bottom: 6px;
}

.piece-moves {
  display: grid;
  grid-template-columns: max-content 1fr;
  gap: 6px 18px;
}

.piece-moves dt {
  font-weight: 700;
}

.piece-moves dd {
  margin: 0;
}

.meta {
  color: var(--muted);
  font-size: 0.9375rem;
}

.game-grid + .meta {
  margin-top: 16px;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 40px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--paper);
  color: var(--ink);
  font: inherit;
  font-size: 0.9375rem;
  font-weight: 600;
  cursor: pointer;
}

.btn:hover {
  background: var(--tint);
}

.btn-primary,
.btn-primary:hover {
  border-color: var(--accent);
  background: var(--accent);
  color: var(--on-accent);
}

.btn-primary:hover {
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: default;
}

.btn:disabled:hover {
  background: var(--paper);
}

@media (max-width: 520px) {
  .wrap {
    padding-right: 16px;
    padding-left: 16px;
  }

  main {
    padding-top: 20px;
  }

  h1 {
    font-size: 1.75rem;
  }

  .intro h1 {
    font-size: 2.125rem;
  }
}
