@import url('https://fonts.googleapis.com/css2?family=Newsreader:ital,opsz,wght@0,6..72,400;0,6..72,500;0,6..72,600;1,6..72,400;1,6..72,500&display=swap');

:root {
  --text: #2c2a26;
  --muted: #6e6b65;
  --faint: #a09d97;
  --rule: #d8d3cb;
  --bg: #f4f1ec;
  --toggle-bg: #d8d3cb;
  --toggle-dot: #2c2a26;
  --w: 600px;
}

[data-theme="dark"] {
  --text: #e8e4dc;
  --muted: #9a958d;
  --faint: #5c5850;
  --rule: #3a3632;
  --bg: #252220;
  --toggle-bg: #5c5850;
  --toggle-dot: #e8e4dc;
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { font-size: 18px; }

body {
  font-family: 'Newsreader', Georgia, serif;
  color: var(--text);
  background: var(--bg);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  transition: background 0.3s, color 0.3s;
}

.c {
  max-width: var(--w);
  margin: 0 auto;
  padding: 3.5rem 1.5rem 6rem;
}

a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--rule);
  text-underline-offset: 3px;
}
a:hover { text-decoration-color: var(--text); }

.title {
  font-size: 1.6rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  margin-bottom: 2rem;
}

.chapters { list-style: none; }
.chapters li {
  margin-bottom: 0.35rem;
  font-size: 1rem;
}

.back {
  display: inline-block;
  font-size: 0.95rem;
  color: var(--muted);
  text-decoration: none;
  margin-bottom: 2rem;
}
.back:hover { color: var(--text); }

.chapter h1 {
  font-size: 1.7rem;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 2rem;
}

.chapter-body {
  font-size: 1.05rem;
  line-height: 1.85;
}
.chapter-body p { margin-bottom: 1.3rem; }
.chapter-body blockquote {
  margin: 1.5rem 0;
  padding-left: 1.2rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}
.chapter-body h2 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-top: 2.5rem;
  margin-bottom: 0.8rem;
}

.chapter-nav {
  margin-top: 3rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
}
.chapter-nav a { color: var(--muted); text-decoration: none; }
.chapter-nav a:hover { color: var(--text); }

/* Toggle switch */
.toggle {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  width: 44px;
  height: 24px;
  background: var(--toggle-bg);
  border-radius: 12px;
  border: none;
  cursor: pointer;
  padding: 0;
  transition: background 0.3s;
}
.toggle::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  background: var(--toggle-dot);
  border-radius: 50%;
  transition: transform 0.3s;
}
[data-theme="dark"] .toggle::after {
  transform: translateX(20px);
}

footer {
  margin-top: 4rem;
  padding-top: 1.5rem;
  border-top: 1px solid var(--rule);
  font-size: 0.85rem;
  color: var(--faint);
}

@media (max-width: 480px) {
  html { font-size: 16px; }
  .c { padding: 2rem 1.25rem 4rem; }
  .toggle { top: 1rem; right: 1rem; }
}
