.footer-links { display: flex; flex-wrap: wrap; gap: .5rem 1.15rem; margin-inline: auto 0; font-size: .9rem; }
.footer-links a { text-decoration-color: #a68365; text-underline-offset: .24em; }
.footer-links a:hover { color: #fff1dc; }

.reading-layout {
  --reading-border: #ddcebb;
  --reading-accent: #8b4331;
  display: grid;
  grid-template-columns: minmax(10rem, 13rem) minmax(0, 1fr);
  gap: clamp(2rem, 5vw, 5.6rem);
  align-items: start;
  max-width: 72rem;
  padding-block: clamp(2.4rem, 5vw, 5rem) clamp(3.25rem, 6.5vw, 6rem);
}
.reading-directory {
  position: sticky;
  top: 6rem;
  scroll-margin-top: 6rem;
  padding: 1rem;
  border: 1px solid #e3d3bf;
  border-radius: .65rem;
  background: linear-gradient(160deg, #f8efe2, #fffdf8 63%);
  box-shadow: 0 .3rem 1rem #462c1610;
}
.reading-directory h2 {
  padding: .05rem .45rem .65rem;
  margin-bottom: .45rem;
  border-bottom: 1px solid #e8d9c6;
  color: #654124;
  font-size: 1.15rem;
  letter-spacing: 0;
}
.reading-directory ul { display: grid; gap: .18rem; padding: 0; margin: 0; list-style: none; }
.reading-directory a {
  display: block;
  padding: .52rem .55rem;
  border-inline-start: 2px solid transparent;
  border-radius: .24rem;
  color: #4b3a2f;
  font-size: .9375rem;
  line-height: 1.45;
  text-decoration: none;
  overflow-wrap: anywhere;
}
.reading-directory a:is(:hover, :focus-visible, [aria-current]) {
  border-inline-start-color: #a37248;
  background: #f3e5d4;
  color: #673923;
}
.reading-directory a[aria-current] { font-weight: 650; }
.chapter-trail { margin-bottom: .7rem; color: #f2d3a8; font-size: .9375rem; text-underline-offset: .22em; }
.chapter-banner-inner { max-width: 72rem; padding-block: clamp(2.45rem, 4.75vw, 4.25rem); }
.chapter-banner:not(.chapter-banner-landscape) .chapter-cover img { max-height: 16rem; }
.chapter-banner-landscape .chapter-banner-inner { min-height: clamp(17rem, 27vw, 23rem); }
.chapter-banner-brand .chapter-banner-inner { min-height: clamp(20rem, 31vw, 31rem); }
.chapter-banner-brand .chapter-cover { inset-inline-start: 27%; }
.chapter-banner-brand .chapter-cover img { object-position: 52% 22%; }
.chapter-banner-brand::after { background: linear-gradient(90deg, #241611 18%, #251711ed 30%, #2114108f 48%, #24130f1a 76%); }
.chapter-banner h1 { font-size: clamp(2.1rem, 4.4vw, 4rem); }
.reading-content { min-width: 0; }
.reading-topic + .reading-topic {
  margin-top: clamp(2.65rem, 5.4vw, 4.9rem);
  padding-top: clamp(2rem, 4vw, 3.1rem);
  border-top: 1px solid var(--reading-border);
}
.reading-topic > h2, .topic-page section.chapter-section > h2 {
  font-size: clamp(1.7rem, 3vw, 2.75rem);
}
.reading-topic > h2 { margin-bottom: 1.25rem; }
.reading-topic .chapter-section + .chapter-section {
  padding-top: 0;
  border: 0;
  margin-top: 1.6rem;
}
.reading-topic .chapter-section h3 { font-size: clamp(1.2rem, 2vw, 1.6rem); }
.reading-topic-photo { margin-block: 0 1.25rem; }
.reading-topic-photo img { max-height: min(18rem, 68vw); }
.reading-content .chapter-list {
  grid-template-columns: minmax(0, 1fr);
  gap: 0;
  border-top: 1px solid var(--reading-border);
  max-width: 45rem;
}
.reading-content .chapter-list li {
  padding: .8rem 0;
  border: 0;
  border-bottom: 1px solid var(--reading-border);
  background: transparent;
}
.reading-content .chapter-list li::marker { color: var(--reading-accent); font-weight: 600; }
.reading-content .chapter-list p { margin-top: .25rem; }
.chapter-related { display: inline-block; margin-top: 1rem; scroll-margin-top: 6rem; color: #7d3025; text-underline-offset: .22em; }

.reading-topic:target > h2 { color: #7d3025; }

.chapter-profile {
  display: grid;
  grid-template-columns: minmax(0, 1fr) clamp(8rem, 24%, 13rem);
  gap: clamp(1.15rem, 3vw, 2.5rem);
  align-items: center;
  margin-top: 1rem;
  padding: clamp(1rem, 2.8vw, 2rem);
  border: 1px solid #e2d2be;
  border-radius: .65rem;
  background: #fcf7ef;
}
.chapter-profile-copy p { color: var(--muted); line-height: 1.8; }
.chapter-credentials { margin: .8rem 0 0; padding-inline-start: 1.3rem; color: #514136; }
.chapter-credentials li + li { margin-top: .4rem; }
.chapter-credentials li::marker { color: #926238; }
.chapter-portrait { max-width: 13rem; justify-self: center; }
.chapter-portrait img { width: 100%; border-radius: 50%; }

.reading-content :is(#han-di-moutai, #xu-family) {
  margin-top: clamp(2rem, 4vw, 3.25rem);
  padding-top: clamp(1.5rem, 3vw, 2.25rem);
  border-top: 1px solid var(--reading-border);
}
#xu-family .chapter-sequence { list-style: none; }
#xu-family .chapter-sequence li { display: grid; grid-template-columns: 5rem minmax(0, 1fr); gap: .65rem; }
#xu-family .chapter-sequence strong { color: #82512b; font-variant-numeric: tabular-nums; }
#xu-family .chapter-sequence p { margin: 0; }
#xu-family > .chapter-figure img { width: 100%; border-radius: .38rem; }

@media (min-width: 1100px) {
  #xu-family { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); align-items: start; column-gap: clamp(1.25rem, 3vw, 2.5rem); }
  #xu-family > :is(h2, h3) { grid-column: 1 / -1; }
  #xu-family > .chapter-figure { margin-top: 1.25rem; }
}

.chapter-metrics {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  justify-items: center;
  gap: clamp(.45rem, 2.2vw, 1.5rem);
  max-width: 43rem;
  margin-top: 1.65rem;
}
.chapter-metrics > div {
  display: grid;
  place-content: center;
  gap: .35rem;
  width: min(100%, 11rem);
  aspect-ratio: 1;
  padding: .72rem;
  border: 1px solid #a77551;
  border-radius: 50%;
  background: radial-gradient(circle at 30% 10%, #95613e, #70402b 84%);
  box-shadow: inset 0 0 0 .3rem #f1cc9324, 0 .4rem 1rem #4d2b1714;
  color: #fff3df;
  text-align: center;
}
.chapter-metrics dt { font-size: clamp(.83rem, 1.12vw, 1rem); line-height: 1.4; }
.chapter-metrics dd { color: #fff0c7; font-size: clamp(1rem, 1.9vw, 1.65rem); font-variant-numeric: tabular-nums; font-weight: 650; line-height: 1.2; }
@media (max-width: 520px) {
  .chapter-metrics > div { aspect-ratio: auto; min-height: 5.15rem; border-radius: .6rem; padding: .5rem .25rem; }
}

.chapter-photo-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin-top: 1.35rem; }
.chapter-photo-pair .chapter-figure { max-width: none; margin: 0; }
.chapter-photo-pair img { width: 100%; aspect-ratio: 1.4; object-fit: cover; border-radius: .35rem; }

@media (max-width: 850px) {
  .reading-layout { grid-template-columns: minmax(0, 1fr); gap: 1.55rem; }
  .reading-directory { position: static; }
  .reading-directory ul { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr)); gap: .25rem 1rem; }
}
@media (max-width: 680px) {
  .chapter-banner-brand .chapter-banner-inner { min-height: 21rem; align-items: end; }
  .chapter-banner-brand .chapter-cover { inset-inline-start: 0; }
  .chapter-banner-brand .chapter-cover img { object-position: 60% 45%; }
  .chapter-banner-brand::after { background: linear-gradient(0deg, #21130ff7 4%, #21130fd4 33%, #21130f24 78%); }
}

@media (max-width: 580px) {
  .chapter-profile { grid-template-columns: minmax(0, 1fr); }
  .chapter-portrait { grid-row: 1; width: min(100%, 10rem); }
  .chapter-credentials { line-height: 1.65; }
  .footer-links { margin-inline: 0; }
}
