:root {
  --ink: #171711;
  --paper: #f3eee2;
  --paper-deep: #e8dfce;
  --gold: #d8a543;
  --muted: rgb(23 23 17 / 58%);
  --reader-size: 20px;
  color-scheme: light;
  font-family: Arial, Helvetica, sans-serif;
  font-synthesis: none;
  text-rendering: optimizeLegibility;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
}

a {
  color: inherit;
}

button,
summary {
  font: inherit;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 10px;
  left: 10px;
  padding: 10px 14px;
  color: var(--paper);
  background: var(--ink);
  transform: translateY(-160%);
}

.skip-link:focus {
  transform: translateY(0);
}

.reading-progress {
  position: fixed;
  z-index: 90;
  top: 0;
  right: 0;
  left: 0;
  height: 3px;
  background: rgb(216 165 67 / 16%);
}

.reading-progress span {
  display: block;
  width: 0;
  height: 100%;
  background: var(--gold);
}

.reader-nav {
  position: absolute;
  z-index: 10;
  top: 0;
  right: 0;
  left: 0;
  display: grid;
  min-height: 84px;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 0 5vw;
  color: var(--paper);
  border-bottom: 1px solid rgb(243 238 226 / 15%);
}

.reader-wordmark {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  justify-self: start;
  font-family: Georgia, serif;
  font-size: 19px;
  text-decoration: none;
}

.sun-mark {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 1px solid var(--gold);
  border-radius: 50%;
  box-shadow: inset 0 -7px 0 var(--gold);
}

.reader-nav nav {
  display: flex;
  gap: 7px;
}

.reader-nav nav a {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border: 1px solid rgb(243 238 226 / 18%);
  border-radius: 50%;
  color: rgb(243 238 226 / 63%);
  font-family: Georgia, serif;
  text-decoration: none;
}

.reader-nav nav a:hover,
.reader-nav nav a[aria-current="page"] {
  color: var(--ink);
  border-color: var(--gold);
  background: var(--gold);
}

.home-link {
  justify-self: end;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-decoration: none;
  text-transform: uppercase;
}

.part-hero {
  position: relative;
  overflow: hidden;
  min-height: 660px;
  padding: 170px 8vw 100px;
  color: var(--paper);
  background:
    radial-gradient(circle at 72% 50%, rgb(216 165 67 / 21%), transparent 30%),
    linear-gradient(135deg, #11110d, #222017 68%, #12120e);
}

.part-aura {
  position: absolute;
  top: 50%;
  right: 7vw;
  width: min(40vw, 480px);
  aspect-ratio: 1;
  border: 1px solid rgb(216 165 67 / 28%);
  border-radius: 50%;
  box-shadow:
    0 0 0 48px rgb(216 165 67 / 4%),
    0 0 0 110px rgb(216 165 67 / 2%);
  transform: translateY(-50%);
}

.part-kicker,
.part-subtitle {
  position: relative;
  margin: 0;
  color: var(--gold);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.part-hero h1 {
  position: relative;
  max-width: 850px;
  margin: 30px 0 14px;
  font-family: Georgia, serif;
  font-size: clamp(70px, 10vw, 150px);
  font-weight: 400;
  letter-spacing: -0.065em;
  line-height: 0.84;
}

.part-subtitle {
  margin-top: 28px;
  color: rgb(243 238 226 / 52%);
}

.part-intro {
  position: relative;
  max-width: 590px;
  margin: 42px 0 0;
  color: rgb(243 238 226 / 70%);
  font-family: Georgia, serif;
  font-size: 20px;
  line-height: 1.65;
}

.part-meta {
  position: relative;
  display: flex;
  flex-wrap: wrap;
  gap: 11px 25px;
  margin-top: 36px;
  color: rgb(243 238 226 / 47%);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.part-meta span + span::before {
  margin-right: 25px;
  color: var(--gold);
  content: "✦";
}

.begin-part {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 24px;
  margin-top: 48px;
  padding: 15px 0;
  border-bottom: 1px solid var(--gold);
  color: var(--paper);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.15em;
  text-decoration: none;
  text-transform: uppercase;
}

.reader-shell {
  display: grid;
  max-width: 1420px;
  grid-template-columns: 310px minmax(0, 760px);
  justify-content: center;
  gap: clamp(50px, 8vw, 130px);
  margin: 0 auto;
  padding: 100px 5vw 150px;
}

.contents {
  min-width: 0;
}

.contents details {
  position: sticky;
  top: 32px;
}

.contents summary {
  display: flex;
  justify-content: space-between;
  padding: 0 0 18px;
  border-bottom: 1px solid rgb(23 23 17 / 22%);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.18em;
  list-style: none;
  cursor: pointer;
  text-transform: uppercase;
}

.contents summary::-webkit-details-marker {
  display: none;
}

.contents summary span {
  color: var(--muted);
}

.contents ol {
  max-height: calc(100vh - 110px);
  overflow: auto;
  margin: 0;
  padding: 14px 7px 30px 0;
  list-style: none;
  scrollbar-width: thin;
}

.contents li + li {
  border-top: 1px solid rgb(23 23 17 / 9%);
}

.contents a {
  display: grid;
  grid-template-columns: 30px 1fr;
  gap: 8px;
  padding: 12px 8px;
  color: rgb(23 23 17 / 57%);
  font-family: Georgia, serif;
  font-size: 13px;
  line-height: 1.3;
  text-decoration: none;
  transition: color 0.2s ease, background 0.2s ease;
}

.contents a span {
  color: rgb(23 23 17 / 32%);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  letter-spacing: 0.08em;
}

.contents a:hover,
.contents a.current {
  color: var(--ink);
  background: rgb(216 165 67 / 14%);
}

.reading-tools {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-bottom: 75px;
  padding-bottom: 18px;
  border-bottom: 1px solid rgb(23 23 17 / 16%);
}

.reading-tools span {
  margin-right: auto;
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.reading-tools button {
  width: 38px;
  height: 34px;
  border: 1px solid rgb(23 23 17 / 20%);
  color: var(--ink);
  background: transparent;
  cursor: pointer;
}

.reading-tools button:hover {
  border-color: var(--gold);
  background: rgb(216 165 67 / 12%);
}

.book-chapter {
  margin-bottom: 120px;
  scroll-margin-top: 35px;
}

.chapter-heading {
  position: relative;
  margin-bottom: 45px;
  padding-bottom: 30px;
  border-bottom: 1px solid rgb(23 23 17 / 18%);
}

.chapter-heading p {
  margin: 0 0 18px;
  color: var(--gold);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.chapter-heading h2 {
  max-width: 690px;
  margin: 0;
  font-family: Georgia, serif;
  font-size: clamp(38px, 5vw, 62px);
  font-weight: 400;
  letter-spacing: -0.045em;
  line-height: 1.02;
}

.chapter-heading > a {
  position: absolute;
  right: 0;
  bottom: 34px;
  color: rgb(23 23 17 / 25%);
  text-decoration: none;
}

.chapter-heading > a:hover {
  color: var(--gold);
}

.chapter-text {
  font-family: Georgia, "Times New Roman", serif;
  font-size: var(--reader-size);
  line-height: 1.82;
}

.chapter-text p {
  margin: 0 0 1.25em;
}

.chapter-text > p:first-child::first-letter {
  float: left;
  margin: 0.08em 0.12em 0 0;
  color: var(--gold);
  font-size: 3.8em;
  line-height: 0.73;
}

.chapter-text .ph3,
.chapter-text h3 {
  margin: 2.8em 0 1.2em;
  font-family: Georgia, serif;
  font-size: 1.35em;
  font-weight: 400;
  text-align: center;
}

.chapter-text .poem {
  margin: 2.4em 0;
  padding-left: 2em;
  border-left: 2px solid var(--gold);
  font-style: italic;
}

.chapter-text .pre {
  margin: 2.4em 0;
  padding-left: 2em;
  border-left: 2px solid var(--gold);
  font-style: italic;
  line-height: 1.65;
  white-space: pre-line;
}

.chapter-text blockquote {
  margin: 2.5em 0;
  padding: 0 0 0 1.5em;
  border-left: 2px solid var(--gold);
}

.part-pagination {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  margin-top: 30px;
  border-top: 1px solid rgb(23 23 17 / 20%);
  border-bottom: 1px solid rgb(23 23 17 / 20%);
}

.part-pagination a {
  padding: 30px 20px 30px 0;
  font-family: Georgia, serif;
  font-size: 23px;
  text-decoration: none;
}

.part-pagination a + a {
  padding-right: 0;
  padding-left: 20px;
  border-left: 1px solid rgb(23 23 17 / 20%);
  text-align: right;
}

.part-pagination span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-family: Arial, Helvetica, sans-serif;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: 0.17em;
  text-transform: uppercase;
}

.reader-footer {
  display: flex;
  min-height: 180px;
  align-items: center;
  gap: 25px;
  padding: 45px 5vw;
  color: rgb(243 238 226 / 55%);
  background: var(--ink);
  font-size: 11px;
}

.reader-footer p {
  margin: 0;
}

.reader-footer a {
  color: var(--gold);
}

.reader-footer > a:last-child {
  margin-left: auto;
  text-decoration: none;
}

@media (max-width: 900px) {
  .reader-shell {
    grid-template-columns: 1fr;
    gap: 55px;
    padding: 70px 7vw 110px;
  }

  .contents details {
    position: static;
  }

  .contents ol {
    max-height: 420px;
  }
}

@media (max-width: 620px) {
  .reader-nav {
    min-height: 72px;
    grid-template-columns: auto 1fr auto;
    padding: 0 20px;
  }

  .reader-wordmark > span:last-child {
    display: none;
  }

  .reader-nav nav {
    display: flex;
    justify-self: center;
  }

  .reader-nav nav a {
    width: 30px;
    height: 30px;
  }

  .part-hero {
    min-height: 650px;
    padding: 145px 24px 80px;
  }

  .part-hero h1 {
    font-size: clamp(64px, 22vw, 100px);
  }

  .part-aura {
    right: -35%;
    width: 88vw;
  }

  .part-meta {
    display: grid;
  }

  .part-meta span + span::before {
    margin-right: 10px;
  }

  .reader-shell {
    padding-right: 24px;
    padding-left: 24px;
  }

  .reading-tools {
    margin-bottom: 58px;
  }

  .book-chapter {
    margin-bottom: 90px;
  }

  .chapter-heading > a {
    display: none;
  }

  .part-pagination a {
    font-size: 18px;
  }

  .reader-footer {
    align-items: flex-start;
    flex-direction: column;
    padding: 55px 24px;
    line-height: 1.6;
  }

  .reader-footer > a:last-child {
    margin: 20px 0 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
}
