/* First Look Chess: one stylesheet, no external fonts, light and dark. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --ink: #1d1f24;
  --muted: #5d6270;
  --rule: #e4e1da;
  --accent: #1f4e5f;        /* ink teal: links, buttons */
  --accent-ink: #ffffff;
  --accent-soft: #e6eef0;
  --serif: Charter, "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", Consolas, Menlo, monospace;
  --measure: 40rem;
  --wide: 64rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15171b;
    --surface: #1d2026;
    --ink: #e8e6e1;
    --muted: #a3a7b1;
    --rule: #2f333b;
    --accent: #8cc4d4;
    --accent-ink: #10181b;
    --accent-soft: #1f2d33;
  }
}

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

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 1.125rem;
  line-height: 1.6;
  -webkit-text-size-adjust: 100%;
}

a { color: var(--accent); text-underline-offset: 0.15em; }
a:hover { text-decoration-thickness: 2px; }

.wrap { max-width: var(--wide); margin: 0 auto; padding: 0 1rem; }

/* Header */
.site-header { border-bottom: 1px solid var(--rule); background: var(--surface); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline;
  justify-content: space-between; gap: 0.5rem 1.5rem; padding-top: 0.9rem; padding-bottom: 0.9rem;
}
.masthead {
  font-family: var(--serif); font-weight: 700; font-size: 1.35rem;
  letter-spacing: 0.01em; color: var(--ink); text-decoration: none;
}
nav { display: flex; flex-wrap: wrap; gap: 0.25rem 1.1rem; font-family: var(--sans); font-size: 0.95rem; }
nav a { color: var(--muted); text-decoration: none; padding: 0.15rem 0; }
nav a:hover { color: var(--ink); }
nav a[aria-current="page"] { color: var(--ink); border-bottom: 2px solid var(--accent); }

main { padding-top: 3rem; padding-bottom: 3.5rem; }

h1, h2, h3 { line-height: 1.2; font-weight: 700; }
h1 { font-size: clamp(1.9rem, 4vw, 2.6rem); margin: 0 0 0.75rem; }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.25rem; }

.lede { font-size: 1.2rem; color: var(--muted); max-width: var(--measure); }
.kicker { font-family: var(--sans); font-size: 0.85rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 0 0 0.5rem; }
.kicker a { color: inherit; }

/* Reading column */
.prose { max-width: var(--measure); }
.prose h2 { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); }
.prose h3 { margin-top: 1.75rem; margin-bottom: 0.35rem; }
.prose h3 + p { margin-top: 0; }
.prose img { max-width: 100%; height: auto; }

pre, code { font-family: var(--mono); font-size: 0.9em; }
pre {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 6px;
  padding: 1rem; overflow-x: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.5;
}

/* Buttons */
.button {
  display: inline-block; font-family: var(--sans); font-weight: 600; font-size: 1rem;
  background: var(--accent); color: var(--accent-ink); text-decoration: none;
  padding: 0.7rem 1.4rem; border-radius: 6px;
}
.button:hover { filter: brightness(1.1); }

/* Home */
.hero { max-width: var(--measure); padding-bottom: 1rem; }
.hero h1 { font-size: clamp(2.3rem, 6vw, 3.4rem); }
.tagline { font-size: 1.3rem; color: var(--muted); margin-top: 0; }
.actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.75rem 1.25rem; }
.actions .sample { font-family: var(--sans); font-size: 0.95rem; }
.cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(14rem, 1fr));
  gap: 1rem; margin-top: 2.5rem;
}
.card {
  background: var(--surface); border: 1px solid var(--rule); border-radius: 8px;
  padding: 1.25rem 1.25rem 0.5rem;
}
.card h2 { margin: 0 0 0.5rem; font-size: 1.2rem; }
.card h2 a { color: var(--ink); text-decoration: none; }
.card p { font-size: 1rem; margin: 0 0 0.75rem; }
.more { font-family: var(--sans); font-size: 0.95rem; font-weight: 600; text-decoration: none; }

/* Blog */
.posts { list-style: none; padding: 0; margin: 1.5rem 0 0; }
.posts li { padding: 1.25rem 0; border-top: 1px solid var(--rule); }
.posts time { font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.posts h2 { margin: 0.2rem 0 0.4rem; font-size: 1.3rem; }
.posts p { margin: 0; }
.draft {
  font-family: var(--sans); font-size: 0.7rem; font-weight: 600; text-transform: uppercase;
  background: var(--accent-soft); color: var(--accent); padding: 0.1rem 0.4rem; border-radius: 4px;
  vertical-align: middle;
}

/* Books */
.book-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(12rem, 1fr));
  gap: 2rem 1.5rem; margin-top: 2rem;
}
.book-tile h2 { font-size: 1.15rem; margin: 0.75rem 0 0.25rem; }
.book-tile h2 a { color: var(--ink); text-decoration: none; }
.book-tile p { font-size: 0.98rem; margin: 0.25rem 0; }
.subtitle { color: var(--muted); font-style: italic; }
.cover {
  display: block; width: 100%; max-width: 14rem; aspect-ratio: 2 / 3; object-fit: cover;
  border-radius: 3px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.2), 0 6px 18px rgb(0 0 0 / 0.12);
}
.cover-blank {
  display: flex; align-items: center; justify-content: center; text-align: center; padding: 1rem;
  background: var(--accent); color: var(--accent-ink); font-weight: 700; font-size: 1.1rem; line-height: 1.3;
}
.book-head { display: grid; grid-template-columns: minmax(8rem, 14rem) 1fr; gap: 2rem; align-items: start; margin-bottom: 2rem; }
.book-head h1 { margin-top: 0; }
.facts { display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem; font-family: var(--sans); font-size: 0.95rem; margin: 1rem 0 1.25rem; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; }
.soon { font-family: var(--sans); color: var(--muted); }

@media (max-width: 36rem) {
  .book-head { grid-template-columns: 1fr; }
  .book-head .cover { max-width: 11rem; }
}

/* Footer */
.site-footer { border-top: 1px solid var(--rule); font-family: var(--sans); font-size: 0.85rem; color: var(--muted); }
.site-footer .wrap { padding-top: 1.25rem; padding-bottom: 2rem; }
.site-footer p { max-width: var(--measure); margin: 0.5rem 0; }
.site-footer a { color: var(--muted); }
