:root {
  --green: #2f4f4f;
  --green-dark: #233c3c;
  --paper: #faf8f2;
  --ink: #2d2922;
  --muted: #756c5e;
  --faint: #b6aa92;
  --brass: #9b7a35;
  --line: rgba(95, 78, 43, .28);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top, rgba(255,255,255,.12), transparent 34%),
    linear-gradient(135deg, #263f3f, #385f5f 55%, #243b3b);
}

.book-page {
  width: min(920px, calc(100% - 40px));
  margin: 34px auto;
  padding: 42px 54px 38px;
  background:
    linear-gradient(90deg, rgba(0,0,0,.045), transparent 7%, transparent 93%, rgba(0,0,0,.06)),
    repeating-linear-gradient(0deg, rgba(255,255,255,.045), rgba(255,255,255,.045) 1px, transparent 1px, transparent 5px),
    var(--paper);
  border: 1px solid rgba(117, 95, 53, .38);
  box-shadow: 0 18px 46px rgba(0,0,0,.22);
  position: relative;
}

.book-page:before,
.book-page:after {
  content: "";
  position: absolute;
  top: 18px;
  bottom: 18px;
  width: 1px;
  background: rgba(117, 95, 53, .18);
}

.book-page:before { left: 24px; }
.book-page:after { right: 24px; }

.library-mark {
  text-align: center;
  color: var(--brass);
  font-family: Arial, sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: .18em;
  text-transform: uppercase;
  margin-bottom: 12px;
}

h1 {
  margin: 0;
  text-align: center;
  color: var(--green-dark);
  font-size: clamp(30px, 4vw, 44px);
  font-weight: normal;
  letter-spacing: -.02em;
  line-height: 1.08;
}

.subtitle {
  max-width: 690px;
  margin: 13px auto 24px;
  text-align: center;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.5;
}

.rule {
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--line), transparent);
  margin: 20px 0 24px;
}

.contents-title {
  margin: 0 0 12px;
  color: var(--green-dark);
  font-size: 18px;
  font-variant: small-caps;
  letter-spacing: .08em;
  font-weight: normal;
  text-align: center;
}

.index-list {
  list-style: none;
  margin: 0;
  padding: 0;
  counter-reset: guide;
}

.index-item {
  counter-increment: guide;
  border-bottom: 1px dotted rgba(95, 78, 43, .36);
}

.index-item a {
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) auto;
  gap: 14px;
  align-items: baseline;
  padding: 14px 0 12px;
  color: inherit;
  text-decoration: none;
}

.index-item a:hover .chapter-title,
.index-item a:focus .chapter-title {
  color: var(--brass);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.chapter-no {
  color: var(--brass);
  font-size: 15px;
  font-variant-numeric: tabular-nums;
}

.chapter-no:before { content: counter(guide, decimal-leading-zero); }

.chapter-title {
  display: block;
  color: var(--green-dark);
  font-size: 20px;
  line-height: 1.18;
  transition: color .15s ease;
}

.chapter-note {
  display: block;
  margin-top: 4px;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.42;
}

.page-ref {
  color: var(--faint);
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

.chapter-body {
  max-width: 720px;
  margin: 0 auto;
  font-size: 17px;
  line-height: 1.66;
}

.chapter-body .lead {
  font-size: 19px;
  line-height: 1.62;
  color: #463f35;
}

.chapter-body .lead:first-letter {
  float: left;
  font-size: 54px;
  line-height: .92;
  padding: 6px 8px 0 0;
  color: var(--green-dark);
}

.chapter-body h2 {
  margin: 28px 0 8px;
  color: var(--green-dark);
  font-size: 23px;
  font-weight: normal;
  border-bottom: 1px solid rgba(95, 78, 43, .2);
  padding-bottom: 5px;
}

.chapter-body p { margin: 0 0 14px; }

/* Guide images */

/* Guide images */

.guide-image {
    margin: 30px auto;
    max-width: 100%;
    text-align: center;
}

.guide-image img {
    display: block;
    width: 100%;
    max-width: 720px;
    height: auto;
    margin: 0 auto;
    border-radius: 12px;
    border: 1px solid rgba(47,79,79,0.25);
    box-shadow: 0 4px 14px rgba(0,0,0,0.14);
}

.guide-image figcaption {
    max-width: 100%;
    margin-top: 10px;
    font-size: 0.95rem;
    font-style: italic;
    color: #666;
}

.diagram {
  margin: 20px 0;
  padding: 16px;
  border: 1px solid rgba(95, 78, 43, .25);
  background: rgba(255,250,240,.42);
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  font-family: Arial, sans-serif;
  font-size: 13px;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--green-dark);
}

.diagram span:not(:last-child):after {
  content: " →";
  color: var(--brass);
  margin-left: 10px;
}

.process-diagram-image {
  margin: 22px 0 26px;
  padding: 10px;
  border: 1px solid rgba(95, 78, 43, .25);
  background: rgba(255,250,240,.5);
  text-align: center;
}

.process-diagram-image img {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(95, 78, 43, .22);
}

.letter-grid {
  margin: 18px 0;
  padding: 16px;
  overflow-x: auto;
  border: 1px solid rgba(95, 78, 43, .25);
  background: rgba(255,250,240,.5);
  color: var(--green-dark);
  font-size: 14px;
  line-height: 1.7;
}

.glossary {
  display: grid;
  grid-template-columns: 170px 1fr;
  gap: 0 18px;
}

.glossary dt {
  color: var(--green-dark);
  font-weight: bold;
  border-top: 1px dotted rgba(95, 78, 43, .28);
  padding: 10px 0;
}

.glossary dd {
  margin: 0;
  color: #4b443a;
  border-top: 1px dotted rgba(95, 78, 43, .28);
  padding: 10px 0;
}

.back-link {
  display: inline-block;
  margin-bottom: 18px;
  color: var(--brass);
  font-family: Arial, sans-serif;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  text-decoration: none;
}

.back-link:hover { text-decoration: underline; }

.small-note {
  margin: 25px auto 0;
  max-width: 710px;
  padding-top: 16px;
  border-top: 1px solid rgba(95, 78, 43, .18);
  color: var(--muted);
  font-size: 14px;
  line-height: 1.5;
  text-align: center;
}

.small-note strong { color: var(--green-dark); font-weight: normal; }

footer {
  margin-top: 22px;
  text-align: center;
  color: var(--faint);
  font-size: 12px;
  font-family: Arial, sans-serif;
  letter-spacing: .06em;
  text-transform: uppercase;
}

@media (max-width: 700px) {
  .book-page {
    width: min(100% - 22px, 920px);
    padding: 30px 28px;
  }

  .book-page:before,
  .book-page:after { display: none; }

  .index-item a { grid-template-columns: 36px minmax(0, 1fr); }
  .page-ref { display: none; }
  .chapter-title { font-size: 18px; }
  .chapter-body { font-size: 16px; }
  .glossary { grid-template-columns: 1fr; }
  .glossary dd { border-top: none; padding-top: 0; }
}
