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

:root {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --muted: #888;
  --accent: #5c7a5c;
  --border: #e0e0da;
  --max-width: 800px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #181816;
    --text: #e4e4e0;
    --muted: #777;
    --accent: #7aa07a;
    --border: #2e2e2a;
  }
}

[data-theme="dark"] {
  --bg: #181816;
  --text: #e4e4e0;
  --muted: #777;
  --accent: #7aa07a;
  --border: #2e2e2a;
}

[data-theme="light"] {
  --bg: #fafaf8;
  --text: #1a1a1a;
  --muted: #888;
  --accent: #5c7a5c;
  --border: #e0e0da;
}

/* ── Theme toggle button ── */
#theme-toggle {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: none;
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 1.1rem;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s, border-color 0.2s;
}

#theme-toggle:hover {
  color: var(--accent);
  border-color: var(--accent);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: "Georgia", serif;
  font-size: clamp(17px, 2.5vw, 29px);
  line-height: 1.7;
  padding: clamp(24px, 5vw, 60px) clamp(16px, 4vw, 24px);
  border-top: 3px solid var(--accent);
}

main {
  max-width: var(--max-width);
  width: 100%;
  margin: 0 auto;
}

/* ── Header ── */
header {
  margin-bottom: 32px;
  padding-bottom: 24px;
}

header h1 {
  font-size: 1.7rem;
  font-weight: normal;
  letter-spacing: 0.02em;
}

header h1 a {
  color: var(--text);
  text-decoration: none;
}

header h1 a:hover {
  color: var(--accent);
}

header p {
  font-size: 1rem;
  color: var(--muted);
  margin-top: 4px;
  margin-left: 20px;
}

/* ── Page intro ── */
.page-intro {
  margin-top: -24px;
  margin-bottom: 48px;
  color: var(--muted);
  font-size: 1rem;
}

/* ── tally ── */
.tally {
  margin-top: -24px;
  margin-bottom: 30px;
  font-size: 1rem;
}

/* ── Menu ── */
.menu {
  list-style: none;
  text-align: center;
}

.menu li {
  display: flex;
  justify-content: center;
  align-items: baseline;
  gap: 16px;
  padding: 20px 0;
  border-bottom: 1px solid var(--border);
}

.menu li:first-child {
  border-top: 1px solid var(--border);
}

.menu a {
  color: var(--text);
  text-decoration: none;
  font-size: 1.1rem;
}

.menu a:hover {
  color: var(--accent);
}

.menu time {
  color: var(--muted);
  font-size: 0.85rem;
  white-space: nowrap;
  font-family: "Courier New", monospace;
}

/* ── Book list ── */
.book-list {
  list-style: none;
  counter-reset: book-counter;
}

.book-list li {
  counter-increment: book-counter;
  display: flex;
  align-items: baseline;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  font-size: 0.95rem;
}

.book-list li:first-child {
  border-top: 1px solid var(--border);
}

.book-list li::before {
  content: counter(book-counter);
  color: var(--accent);
  font-size: 0.75rem;
  font-family: "Courier New", monospace;
  min-width: 2.5em;
  text-align: right;
  flex-shrink: 0;
}

/* ── Post page ── */
article {
  margin-top: 0;
}

article header {
  border-bottom: none;
  margin-bottom: 40px;
  padding-bottom: 0;
}

article header h1 {
  font-size: 1.6rem;
  font-weight: normal;
  line-height: 1.3;
  margin-bottom: 8px;
}

article header time {
  color: var(--muted);
  font-size: 0.85rem;
  font-family: "Courier New", monospace;
}

.post-body {
  font-size: 1.05rem;
  line-height: 2.1;
}

.post-body p {
  margin-bottom: 1.4em;
}

.post-body h2 {
  font-size: 1.1 rem;
  font-weight: normal;
  margin: 2em 0 0.6em;
  color: var(--accent);
}

.post-body blockquote {
  border-left: 2px solid var(--accent);
  padding-left: 16px;
  color: var(--muted);
  margin: 1.4em 0;
}

/* ── Footer / back link ── */
.back {
  display: inline-block;
  margin-top: 48px;
  font-size: 0.85rem;
  color: var(--muted);
  text-decoration: none;
  font-family: "Courier New", monospace;
}

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