:root {
  --paper: #f5f1e8;
  --paper-deep: #ebe3d4;
  --page: #fffdf7;
  --page-edge: #f7f1e4;
  --ink: #2b2b2b;
  --ink-soft: #6f675d;
  --accent: #5f6b4a;
  --accent-strong: #465138;
  --line: rgba(96, 81, 63, 0.18);
  --line-soft: rgba(96, 81, 63, 0.1);
  --shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  --content: 800px;
  --reading-width: 680px;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  background:
    radial-gradient(circle at top left, rgba(170, 147, 117, 0.16), transparent 28%),
    radial-gradient(circle at bottom right, rgba(141, 155, 115, 0.12), transparent 28%),
    repeating-linear-gradient(
      0deg,
      rgba(255, 255, 255, 0.04),
      rgba(255, 255, 255, 0.04) 2px,
      rgba(0, 0, 0, 0.012) 2px,
      rgba(0, 0, 0, 0.012) 3px
    ),
    linear-gradient(180deg, #f7f3eb 0%, var(--paper) 100%);
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1.65;
}

a {
  color: var(--accent-strong);
  text-decoration-thickness: 0.08em;
  text-underline-offset: 0.16em;
}

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

img {
  max-width: 100%;
  display: block;
}

.skip-link {
  position: absolute;
  left: -9999px;
}

.skip-link:focus {
  left: 16px;
  top: 16px;
  z-index: 100;
  background: var(--page);
  padding: 10px 14px;
  border-radius: 4px;
  box-shadow: var(--shadow);
}

.site-header {
  position: sticky;
  top: 0;
  z-index: 20;
  backdrop-filter: blur(6px);
  background: rgba(245, 241, 232, 0.88);
  border-bottom: 1px solid var(--line-soft);
}

.header-inner {
  width: min(calc(100% - 24px), 980px);
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 12px 0;
}

.brand {
  color: var(--ink);
  text-decoration: none;
  min-width: 0;
}

.brand-lockup {
  display: grid;
  gap: 4px;
  align-items: start;
}

.brand-logo {
  width: min(320px, 100%);
  height: auto;
  display: block;
}

.brand-kicker {
  display: block;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.site-nav ul,
.breadcrumbs ol,
.footer-links,
.footer-categories,
.book-link-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.site-nav ul {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}

.site-nav a {
  display: inline-flex;
  align-items: center;
  padding: 6px 0;
  color: var(--ink);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  font-size: 0.95rem;
  letter-spacing: 0.03em;
}

.site-nav a:hover,
.site-nav a[aria-current="page"] {
  border-color: var(--accent-strong);
}

.book-container {
  width: min(calc(100% - 24px), var(--content));
  margin: 0 auto;
  padding: 26px 0 44px;
}

.page {
  max-width: 100%;
  margin: 0 auto;
  background: linear-gradient(180deg, var(--page) 0%, var(--page-edge) 100%);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--shadow);
  padding: 40px 30px;
  position: relative;
  overflow: hidden;
}

.page::before {
  content: "";
  position: absolute;
  inset: 14px;
  border: 1px solid rgba(96, 81, 63, 0.08);
  pointer-events: none;
}

.page-inner {
  max-width: var(--reading-width);
  margin: 0 auto;
  position: relative;
  z-index: 1;
}

h1,
h2,
h3,
.footer-title,
.book-link-title {
  font-family: Georgia, "Times New Roman", serif;
  letter-spacing: 0.01em;
}

h1 {
  margin: 0;
  font-size: clamp(2rem, 4.4vw, 3.4rem);
  line-height: 1.18;
}

h2 {
  margin: 30px 0 14px;
  font-size: clamp(1.45rem, 3vw, 2rem);
}

h3 {
  margin: 0 0 10px;
  font-size: 1.2rem;
}

p,
li,
th,
td,
figcaption {
  font-size: 18px;
  line-height: 1.7;
  color: var(--ink);
}

p {
  margin: 0 0 16px;
}

.lede,
.chapter-intro,
.footer-note,
.book-link-note,
.breadcrumbs,
.page-meta,
.page-number,
.cover-note,
.quick-facts th {
  color: var(--ink-soft);
}

.page-cover {
  min-height: calc(100vh - 150px);
  display: flex;
  align-items: center;
}

.cover-frame {
  max-width: 640px;
  margin: 0 auto;
  padding: 38px 24px 28px;
  text-align: center;
  border: 1px solid var(--line);
  background:
    radial-gradient(circle at top, rgba(255, 255, 255, 0.7), transparent 42%),
    linear-gradient(180deg, rgba(248, 243, 233, 0.92) 0%, rgba(255, 253, 247, 0.98) 100%);
}

.cover-ornament {
  width: 82px;
  height: 1px;
  margin: 0 auto 20px;
  background: var(--line);
  position: relative;
}

.cover-ornament::before,
.cover-ornament::after {
  content: "";
  position: absolute;
  top: -4px;
  width: 9px;
  height: 9px;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: var(--page);
}

.cover-ornament::before {
  left: -2px;
}

.cover-ornament::after {
  right: -2px;
}

.cover-kicker,
.chapter-tag,
.nav-label,
.footer-title {
  margin: 0 0 10px;
  font-size: 0.78rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cover-subtitle {
  font-size: 1.15rem;
  margin: 14px auto 16px;
  max-width: 30ch;
}

.cover-logo {
  width: min(100%, 520px);
  height: auto;
  margin: 0 auto 10px;
  display: block;
}

.cover-logo-note {
  margin: 0 auto 10px;
  font-size: 0.72rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--ink-soft);
}

.cover-note {
  max-width: 34ch;
  margin: 0 auto 14px;
}

.cover-note + .cover-note {
  margin-top: -2px;
}

.cover-actions,
.book-nav,
.footer-links,
.footer-categories {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
}

.cover-actions {
  justify-content: center;
  margin-bottom: 26px;
}

.button,
.ghost-button,
.book-nav a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  padding: 11px 18px;
  border: 1px solid var(--line);
  text-decoration: none;
  border-radius: 2px;
  transition: background-color 140ms ease, border-color 140ms ease, color 140ms ease;
}

.button {
  background: #6c7355;
  border-color: #6c7355;
  color: #fffdf7;
}

.button:hover {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: #fffdf7;
}

.ghost-button,
.book-nav a {
  background: rgba(255, 253, 247, 0.82);
  color: var(--accent-strong);
}

.ghost-button:hover,
.book-nav a:hover {
  background: rgba(108, 115, 85, 0.08);
}

.cover-illustration,
.figure-block {
  margin: 0 auto;
  max-width: 520px;
  padding: 16px;
  border: 1px solid var(--line);
  background: rgba(255, 253, 247, 0.85);
}

.cover-illustration img,
.figure-block img {
  width: 100%;
  height: auto;
  display: block;
}

.cover-illustration figcaption,
.figure-block figcaption {
  margin-top: 12px;
  font-size: 14px;
  text-align: center;
  color: var(--ink-soft);
}

.breadcrumbs {
  font-size: 14px;
  margin-bottom: 18px;
}

.breadcrumbs ol {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.breadcrumbs li::after {
  content: "/";
  margin-left: 8px;
  color: rgba(111, 103, 93, 0.7);
}

.breadcrumbs li:last-child::after {
  display: none;
}

.page-meta {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
  font-size: 14px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.page-divider {
  height: 1px;
  margin: 30px 0;
  background: var(--line);
  position: relative;
}

.page-divider::after {
  content: "§";
  position: absolute;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
  padding: 0 12px;
  background: var(--page);
  color: rgba(111, 103, 93, 0.72);
  font-size: 13px;
}

.chapter-block + .chapter-block,
.page-section + .page-section,
.section-block + .section-block {
  margin-top: 34px;
}

.chapter-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 12px;
}

.chapter-title {
  margin: 0;
}

.chapter-page {
  font-size: 14px;
  color: var(--ink-soft);
}

.book-link-list {
  display: grid;
  gap: 10px;
  margin-top: 18px;
}

.book-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: inherit;
  text-decoration: none;
}

.book-link-text {
  display: inline-flex;
  flex-direction: column;
  min-width: 0;
}

.book-link-title {
  font-size: 18px;
}

.book-link-note {
  font-size: 13px;
  line-height: 1.5;
}

.book-link-dots {
  flex: 1;
  min-width: 24px;
  height: 1px;
  margin-top: 3px;
  border-bottom: 1px dotted rgba(111, 103, 93, 0.72);
}

.book-link-page {
  min-width: 2ch;
  text-align: right;
  font-size: 15px;
  color: var(--ink-soft);
}

.contents-summary {
  margin-bottom: 10px;
}

.quick-facts {
  margin-top: 32px;
  padding: 20px;
  border: 1px solid var(--line);
  background: linear-gradient(180deg, rgba(255, 253, 247, 0.96) 0%, rgba(247, 241, 228, 0.86) 100%);
}

.quick-facts h2 {
  margin-top: 0;
}

.quick-facts table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed;
}

.quick-facts th,
.quick-facts td {
  padding: 12px 0;
  border-bottom: 1px solid var(--line-soft);
  text-align: left;
  vertical-align: top;
}

.quick-facts th {
  width: 38%;
  padding-right: 18px;
  font-weight: 400;
}

.facts-list {
  margin: 16px 0 0;
  padding-left: 22px;
  columns: 2 18rem;
  column-gap: 34px;
}

.facts-list li {
  break-inside: avoid;
  margin-bottom: 12px;
}

.section-title {
  margin-bottom: 12px;
}

.section-note {
  font-size: 15px;
  color: var(--ink-soft);
  margin-top: -4px;
}

.related-title {
  margin-top: 34px;
}

.book-nav {
  margin-top: 34px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.book-nav a {
  display: grid;
  gap: 4px;
  width: 100%;
  text-align: left;
  justify-items: start;
  align-content: start;
  align-items: start;
  min-height: auto;
}

.book-nav .nav-label {
  display: block;
  margin: 0;
  line-height: 1.2;
}

.book-nav a strong {
  display: block;
  font-size: 1rem;
  line-height: 1.25;
  color: var(--ink);
}

.book-nav a span:last-child {
  display: block;
  color: var(--ink-soft);
  font-size: 0.94rem;
  line-height: 1.25;
}

.site-footer {
  padding: 0 0 38px;
}

.footer-panel {
  width: min(calc(100% - 24px), var(--content));
  margin: 0 auto;
  padding: 18px 0 0;
  display: grid;
  gap: 12px;
}

.footer-title {
  margin: 0;
}

.footer-links,
.footer-categories {
  gap: 10px 16px;
  font-size: 0.96rem;
}

.footer-categories {
  justify-content: flex-start;
}

.footer-panel p {
  margin: 0;
}

.page-number {
  margin-top: 42px;
  text-align: center;
  font-size: 15px;
}

.not-found .cover-frame {
  max-width: 560px;
}

@media (max-width: 720px) {
  .header-inner {
    flex-direction: column;
    align-items: flex-start;
  }

  .book-container,
  .footer-panel {
    width: min(calc(100% - 16px), var(--content));
  }

  .page {
    padding: 28px 20px 24px;
  }

  .page::before {
    inset: 10px;
  }

  .page-cover {
    min-height: auto;
  }

  p,
  li,
  th,
  td,
  figcaption,
  .book-link-title {
    font-size: 16px;
  }

  .cover-frame {
    padding: 28px 16px 22px;
  }

  .brand-logo {
    width: min(250px, 100%);
  }

  .cover-logo {
    width: min(100%, 360px);
  }

  .page-meta,
  .chapter-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .quick-facts,
  .cover-illustration,
  .figure-block {
    padding: 14px;
  }

  .quick-facts table,
  .quick-facts tbody,
  .quick-facts tr,
  .quick-facts th,
  .quick-facts td {
    display: block;
    width: 100%;
  }

  .quick-facts tr {
    padding: 10px 0;
    border-bottom: 1px solid var(--line-soft);
  }

  .quick-facts th,
  .quick-facts td {
    border-bottom: 0;
    padding: 0;
  }

  .quick-facts th {
    margin-bottom: 6px;
  }

  .facts-list {
    columns: 1;
  }

  .book-nav {
    grid-template-columns: 1fr;
  }

  .book-link {
    gap: 10px;
  }
}
