/* ---------- Reset & base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Fraunces", Georgia, "Times New Roman", serif;
  font-optical-sizing: auto;
  font-weight: 400;
  color: #1a1a1a;
  background: #faf8f3;
  line-height: 1.65;
  font-size: 19px;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

@media (max-width: 640px) {
  body { font-size: 17px; line-height: 1.6; }
}

a {
  color: #8a3324;
  text-decoration: none;
  border-bottom: 1px solid rgba(138, 51, 36, 0.25);
  transition: border-color 0.15s ease, color 0.15s ease;
}
a:hover { border-bottom-color: #8a3324; }

h1, h2, h3, h4 {
  font-family: "Fraunces", Georgia, serif;
  font-weight: 500;
  line-height: 1.2;
  letter-spacing: -0.01em;
  color: #111;
}

p { margin: 0 0 1.1em; }

hr {
  border: none;
  border-top: 1px solid #e5dfd1;
  margin: 3em auto;
  max-width: 120px;
}

blockquote {
  margin: 1.5em 0;
  padding: 0.2em 1.4em;
  border-left: 3px solid #8a3324;
  color: #3a3a3a;
  font-style: italic;
}

code {
  font-family: "SF Mono", Menlo, Consolas, monospace;
  background: #efeadb;
  padding: 0.1em 0.35em;
  border-radius: 3px;
  font-size: 0.88em;
}

strong { font-weight: 600; color: #111; }

/* ---------- Header ---------- */
.site-header {
  border-bottom: 1px solid #e8e2d3;
  background: #faf8f3;
  position: sticky;
  top: 0;
  z-index: 10;
  backdrop-filter: saturate(1.1) blur(6px);
  -webkit-backdrop-filter: saturate(1.1) blur(6px);
}
.site-header__inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0.5em 1.5em;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.site-header__brand {
  display: flex;
  align-items: center;
  gap: 0.45em;
  color: #111;
  font-family: "Fraunces", serif;
  font-weight: 500;
  font-size: 1em;
  border: none;
}
.site-header__mark {
  font-size: 1.15em;
  color: #8a3324;
}
.site-header__nav {
  display: flex;
  align-items: center;
  gap: 0.4em;
  font-family: "Inter", system-ui, sans-serif;
  font-size: 0.82em;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.lang-switch {
  color: #888;
  border: none;
  padding: 0.2em 0.4em;
}
.lang-switch.is-active { color: #111; font-weight: 600; }
.lang-sep { color: #ccc; }

/* ---------- Main ---------- */
.content {
  max-width: 680px;
  margin: 0 auto;
  padding: 3em 1.5em 4em;
}

/* ---------- Home / TOC ---------- */
.hero { margin-bottom: 4em; }
.hero__eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8a3324;
  margin: 0 0 0.8em;
}
.hero__title {
  font-size: clamp(2.6em, 6vw, 4em);
  margin: 0 0 0.4em;
  font-weight: 500;
  letter-spacing: -0.02em;
}
.hero__lede {
  font-size: 1.2em;
  color: #3a3a3a;
  margin: 0.8em 0 2em;
  max-width: 34em;
  line-height: 1.55;
}
.hero__cta {
  display: inline-block;
  font-family: "Inter", sans-serif;
  font-size: 0.95em;
  font-weight: 500;
  padding: 0.85em 1.6em;
  background: #111;
  color: #faf8f3;
  border: none;
  border-radius: 999px;
  letter-spacing: 0.02em;
}
.hero__cta:hover {
  background: #8a3324;
  border: none;
}

.toc__title {
  font-family: "Inter", sans-serif;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #888;
  font-weight: 500;
  margin: 0 0 1em;
  padding-bottom: 0.8em;
  border-bottom: 1px solid #e8e2d3;
}
.toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.toc__item {
  border-bottom: 1px solid #eee7d6;
}
.toc__item a {
  display: flex;
  align-items: baseline;
  gap: 1.2em;
  padding: 1em 0;
  color: #1a1a1a;
  border: none;
  transition: transform 0.15s ease, color 0.15s ease;
}
.toc__item a:hover {
  color: #8a3324;
  transform: translateX(4px);
}
.toc__number {
  font-family: "Inter", sans-serif;
  font-size: 0.8em;
  color: #b8ad93;
  font-variant-numeric: tabular-nums;
  min-width: 1.5em;
  font-weight: 500;
}
.toc__name {
  font-family: "Fraunces", serif;
  font-size: 1.15em;
  font-weight: 500;
}

/* ---------- Chapter ---------- */
.chapter__header {
  margin-bottom: 2.5em;
  padding-bottom: 1.5em;
  border-bottom: 1px solid #e8e2d3;
}
.chapter__eyebrow {
  font-family: "Inter", sans-serif;
  font-size: 0.78em;
  text-transform: uppercase;
  letter-spacing: 0.14em;
  color: #8a3324;
  margin: 0 0 0.8em;
  font-weight: 500;
}
.chapter__title {
  font-size: clamp(2em, 5vw, 3em);
  margin: 0;
  font-weight: 500;
  letter-spacing: -0.02em;
  line-height: 1.15;
}
.chapter__body h2 {
  font-size: 1.5em;
  margin: 2em 0 0.6em;
  font-weight: 600;
}
.chapter__body h3 {
  font-size: 1.2em;
  margin: 1.8em 0 0.5em;
  font-weight: 600;
}
.chapter__body ul, .chapter__body ol {
  padding-left: 1.3em;
}
.chapter__body li { margin-bottom: 0.4em; }

/* ---------- Chapter nav ---------- */
.chapter__nav {
  margin-top: 4em;
  padding-top: 2em;
  border-top: 1px solid #e8e2d3;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 1.5em;
  align-items: start;
  font-family: "Inter", sans-serif;
}
.chapter__nav a {
  display: block;
  border: none;
  color: #1a1a1a;
}
.chapter__nav a:hover .nav-title { color: #8a3324; }
.chapter__nav-prev { text-align: left; }
.chapter__nav-next { text-align: right; }
.chapter__nav-home {
  align-self: center;
  font-size: 0.82em;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: #888;
}
.chapter__nav-home a { color: #888; }
.chapter__nav-home a:hover { color: #8a3324; }
.nav-label {
  display: block;
  font-size: 0.75em;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: #b8ad93;
  margin-bottom: 0.25em;
}
.nav-title {
  display: block;
  font-family: "Fraunces", serif;
  font-size: 1em;
  font-weight: 500;
  line-height: 1.3;
  transition: color 0.15s ease;
}

@media (max-width: 640px) {
  .chapter__nav {
    grid-template-columns: 1fr;
    gap: 1.5em;
  }
  .chapter__nav-next,
  .chapter__nav-prev { text-align: left; }
  .chapter__nav-home { order: 3; text-align: center; }
}

/* ---------- Footer ---------- */
.site-footer {
  border-top: 1px solid #e8e2d3;
  background: #f4efe0;
  padding: 2.5em 1.5em;
  margin-top: 2em;
}
.site-footer__inner {
  max-width: 680px;
  margin: 0 auto;
  text-align: center;
  color: #888;
  font-family: "Inter", sans-serif;
  font-size: 0.85em;
}
.site-footer__tagline { margin: 0 0 0.4em; font-style: italic; color: #6a6a6a; }
.site-footer__meta { margin: 0; font-size: 0.9em; }
