.reader-page {
  --reader-gold: #dfbb7a;
  --reader-ink: #30241e;
  --reader-cream: #f4e7cf;
  --reader-rule: #aa865158;
  --reader-serif: "Noto Serif KR", "KoPub Batang", "나눔명조", Batang, "AppleMyungjo", Georgia, serif;
  width: min(100% - 3rem, 75rem);
  margin-inline: auto;
  padding-block: clamp(1.5rem, 4vw, 3.5rem) clamp(3rem, 6vw, 6rem);
  color: var(--reader-cream);
}

.reader-cover {
  display: grid;
  grid-template-columns: minmax(17rem, .85fr) minmax(0, 1.3fr);
  grid-template-areas: "copy art";
  align-items: stretch;
  border: 1px solid var(--reader-rule);
  margin-bottom: clamp(2rem, 5vw, 4rem);
  overflow: hidden;
  background: linear-gradient(143deg, #223044, #121925 58%, #101621);
}

.reader-cover-image {
  grid-area: art;
  position: relative;
  min-width: 0;
  min-height: 20rem;
  margin: 0;
  border-inline-start: 1px solid var(--reader-rule);
}

.reader-cover-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center 44%;
  display: block;
}

.reader-cover-copy {
  grid-area: copy;
  display: flex;
  min-width: 0;
  flex-direction: column;
  justify-content: center;
  padding: clamp(1.8rem, 4.4vw, 4.75rem);
}

.reader-kicker {
  margin: 0 0 .9rem;
  color: var(--reader-gold);
  font-size: .94rem;
  font-weight: 700;
  letter-spacing: .17em;
}

.reader-cover h1 {
  margin: 0;
  color: var(--reader-cream);
  font: 700 clamp(2.3rem, 4.4vw, 4.25rem) / 1.18 var(--reader-serif);
  letter-spacing: -.06em;
  word-break: keep-all;
}

.reader-actions {
  display: flex;
  flex-wrap: wrap;
  gap: .55rem;
  margin-top: clamp(1.35rem, 3vw, 2.5rem);
}

.reader-actions a,
.reader-end a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 2.8rem;
  padding-inline: 1rem;
  border: 1px solid var(--reader-rule);
  color: var(--reader-cream);
  font-size: .935rem;
  font-weight: 700;
  text-decoration: none;
  transition: background-color .16s ease, border-color .16s ease;
}

.reader-actions .reader-start {
  border-color: #efd49d;
  background: #e2c18b;
  color: #1c1b1a;
}

.reader-actions .reader-start:hover {
  background: #f4dcae;
}

.reader-actions .reader-outline:hover,
.reader-end a:hover {
  border-color: var(--reader-gold);
  background: #e2c18b14;
}

.reader-layout {
  display: grid;
  grid-template-columns: minmax(11rem, 15.25rem) minmax(0, 1fr);
  align-items: start;
  gap: clamp(1.25rem, 3vw, 3rem);
}

.reader-rail {
  position: sticky;
  top: calc(var(--site-header-height, 4.75rem) + 1rem);
}

.reader-contents {
  --toc-surface: #17212e;
  border: 1px solid var(--reader-rule);
  padding: 1rem 1rem .9rem;
  background: var(--toc-surface);
  scroll-margin-top: max(6rem, var(--site-header-height, 0rem));
}

.reader-contents:target {
  border-color: var(--reader-gold);
}

.reader-contents h2 {
  margin: .25rem 0 .65rem;
  padding: 0 .4rem .6rem;
  border-bottom: 1px solid var(--reader-rule);
  color: var(--reader-gold);
  font-size: 1.04rem;
  letter-spacing: .075em;
}

.reader-contents ol {
  display: grid;
  gap: .2rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

.reader-contents a {
  display: flex;
  align-items: center;
  min-height: 2.7rem;
  padding: .38rem .55rem;
  border-inline-start: 2px solid transparent;
  color: #d8cbb6;
  font-size: .925rem;
  line-height: 1.45;
  text-decoration: none;
  transition: border-color .15s ease, background-color .15s ease;
  word-break: keep-all;
}

.reader-contents a:hover {
  background-color: #e6c88b17;
}

.reader-contents a[aria-current="location"] {
  border-inline-start-color: var(--reader-gold);
  background: #e6c88b22;
  color: #f8e8c7;
}

.reader-progress {
  margin-top: .8rem;
  padding: .8rem .55rem .1rem;
  border-top: 1px solid var(--reader-rule);
  color: #ddd2c0;
}

.reader-progress label {
  display: flex;
  justify-content: space-between;
  gap: .6rem;
  font-size: .83rem;
}

.reader-progress output {
  color: var(--reader-gold);
  font-variant-numeric: tabular-nums;
}

.reader-progress progress {
  display: block;
  width: 100%;
  height: .3rem;
  margin: .45rem 0 0;
  overflow: hidden;
  accent-color: var(--reader-gold);
}

.reader-book {
  display: grid;
  gap: clamp(1rem, 3vw, 1.9rem);
  min-width: 0;
}

.reader-chapter {
  --reader-vellum: url("media/prologue/parchment.webp");
  min-width: 0;
  margin: 0;
  padding: .3rem clamp(.65rem, 1.25vw, 1.2rem) .6rem;
  border-style: solid;
  border-color: transparent;
  border-width: clamp(1.3rem, 3.7vw, 3.6rem) clamp(1rem, 3.9vw, 3.8rem);
  border-image: var(--reader-vellum) 18% 13% 18% 13% fill stretch round;
  background: #eacda0;
  background-clip: padding-box;
  color: var(--reader-ink);
  font-family: var(--reader-serif);
  scroll-margin-top: max(6.25rem, var(--site-header-height, 0rem));
}

.reader-chapter-heading {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  column-gap: .8rem;
  margin: 0 0 clamp(1.15rem, 3vw, 1.85rem);
  padding: .72rem 0 .68rem;
  border-top: 3px double #795636a8;
  border-bottom: 1px solid #7956367a;
}

.reader-chapter-heading h2 {
  margin: 0;
  color: #36261e;
  font: 700 clamp(1.32rem, 2.9vw, 2rem) / 1.43 var(--reader-serif);
  letter-spacing: -.045em;
  word-break: keep-all;
}

.reader-chapter-index {
  display: inline-flex;
  align-items: center;
  min-height: 2.75rem;
  padding-inline: .35rem;
  color: #56391f;
  font-size: .875rem;
  font-weight: 700;
  text-underline-offset: .22em;
  white-space: nowrap;
}

.reader-chapter p {
  margin: 0 0 1.6rem;
  color: var(--reader-ink);
  font-size: clamp(1.025rem, 1.65vw, 1.175rem);
  font-weight: 500;
  line-height: 1.95;
  word-break: keep-all;
  overflow-wrap: anywhere;
}

.reader-chapter p:last-child {
  margin-bottom: 0;
}

.reader-illustration {
  margin: 0 0 1.2rem;
  border: 1px solid #735136c9;
  background: #302621;
  box-shadow: 0 .45rem 1rem #38231328;
}

.reader-illustration img {
  display: block;
  width: 100%;
  height: auto;
}

.reader-end {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: .6rem;
  margin-top: clamp(1rem, 3vw, 2rem);
}

.reader-page a:focus-visible,
.reader-contents:focus-visible,
.reader-chapter:focus-visible {
  outline: 2px solid var(--reader-gold);
  outline-offset: 3px;
}

.reader-chapter a:focus-visible {
  outline-color: #65421d;
}

@media (max-width: 52rem) {
  .reader-layout {
    grid-template-columns: minmax(0, 1fr);
  }

  .reader-rail {
    position: static;
  }

  .reader-contents ol {
    grid-template-columns: repeat(2, minmax(0, 1fr));
    column-gap: .7rem;
  }

  .reader-chapter {
    padding-inline: clamp(.45rem, 1.7vw, 1rem);
  }
}

@media (max-width: 42rem) {
  .reader-page {
    width: calc(100% - 1.5rem);
  }

  .reader-cover {
    grid-template-columns: minmax(0, 1fr);
    grid-template-areas: "art" "copy";
    margin-bottom: 1.35rem;
  }

  .reader-cover-image {
    min-height: 0;
    aspect-ratio: 16 / 10;
    border-inline-start: 0;
    border-bottom: 1px solid var(--reader-rule);
  }

  .reader-cover-copy {
    padding: 1.35rem clamp(1rem, 5vw, 2rem) 1.55rem;
  }

  .reader-contents {
    padding: .85rem .7rem;
  }

  .reader-chapter {
    border-width: 1.35rem .7rem;
  }

  .reader-end {
    justify-content: flex-start;
  }
}

@media (max-width: 23rem) {
  .reader-contents ol {
    grid-template-columns: minmax(0, 1fr);
  }

  .reader-chapter p {
    word-break: normal;
  }
}

@media (prefers-reduced-motion: reduce) {
  .reader-page a {
    transition: none;
  }
}

@media print {
  .reader-page {
    width: 100%;
  }

  .reader-cover {
    color: #171717;
    background: white;
  }

  .reader-cover h1,
  .reader-kicker {
    color: #171717;
  }

  .reader-layout {
    display: block;
  }

  .reader-rail,
  .reader-end,
  .reader-actions,
  .reader-chapter-index {
    display: none;
  }

  .reader-chapter {
    border: 0;
    background: white;
  }

  .reader-illustration {
    break-inside: avoid;
  }
}
