:root {
  --bg: #faf9f6;
  --fg: #1a1a1a;
  --muted: #6b6b6b;
  --accent-color: #a3402e;
  --success-color: #2f7d46;
  --border: #ddd8cf;
  --card-bg: #ffffff;
}

:root[data-theme="dark"] {
  --bg: #1a1a1a;
  --fg: #f2f0ea;
  --muted: #a8a8a8;
  --accent-color: #e0866b;
  --success-color: #5fbf82;
  --border: #3a3a3a;
  --card-bg: #232323;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #1a1a1a;
    --fg: #f2f0ea;
    --muted: #a8a8a8;
    --accent-color: #e0866b;
    --success-color: #5fbf82;
    --border: #3a3a3a;
    --card-bg: #232323;
  }
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--fg);
  font-family: Georgia, "Iowan Old Style", serif;
  display: flex;
  flex-direction: column;
  align-items: center;
  transition: background 0.2s ease, color 0.2s ease;
}

/* Site-wide nav bar (see nav.js) — shared across every page rather than
   duplicated per-stylesheet, since it renders identically everywhere.
   Two rows: title+toggle on top, then a sub-nav row of page links below —
   giving the links their own full-width row instead of squeezing them in
   next to the title, where three labels plus the toggle had no room and
   started wrapping awkwardly. */
header {
  width: 100%;
  max-width: 640px;
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  padding: 1.5rem 1rem 0.75rem;
}

.site-nav-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.site-title {
  font-size: 1.3rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--fg);
  text-decoration: none;
  white-space: nowrap;
}

.site-nav-links {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  flex-wrap: wrap;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border);
}

.nav-link {
  font-family: system-ui, sans-serif;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
}

.nav-link:hover {
  color: var(--accent-color);
}

.nav-link.active {
  color: var(--fg);
  font-weight: 700;
}

/* Three labels plus wrapping ragged onto a half-empty second line reads as
   broken layout — a clean vertical stack reads as intentional instead. */
@media (max-width: 640px) {
  .site-nav-links {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.6rem;
  }
}

#theme-toggle {
  background: none;
  border: 1px solid var(--border);
  border-radius: 999px;
  width: 2.2rem;
  height: 2.2rem;
  font-size: 1rem;
  cursor: pointer;
  color: var(--fg);
  flex-shrink: 0;
}
