.reader-page {
  min-height: 100vh;
  background: #e9e7e0;
}

.reader-header {
  position: relative;
}

.reader-nav {
  gap: 27px;
}

.reader-layout {
  min-height: calc(100vh - 78px);
  display: grid;
  grid-template-columns: 255px minmax(0, 1fr);
}

.reader-sidebar {
  min-height: calc(100vh - 78px);
  padding: 31px 25px 22px;
  display: flex;
  flex-direction: column;
  background: #f7f5ef;
  border-right: 1px solid #dcd9d0;
}

.reader-back {
  color: #647184;
  font-size: 10px;
}

.reader-back span {
  padding-right: 7px;
  color: #c97e4a;
}

.reader-side-label {
  margin: 55px 0 11px;
  color: #89909a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .14em;
}

.book-switcher {
  border-top: 1px solid #deddd6;
}

.book-switcher a {
  min-height: 52px;
  padding: 0 8px;
  display: flex;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #deddd6;
  color: #536176;
  font-size: 11px;
  transition: color .2s ease, background .2s ease;
}

.book-switcher a:hover,
.book-switcher a.is-active {
  background: #eeece5;
  color: #17283e;
}

.book-switch-number {
  color: #c97e4a;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .08em;
}

.reader-sidebar-note {
  margin-top: 29px;
  padding: 14px 12px;
  display: flex;
  align-items: flex-start;
  gap: 9px;
  background: #eeece5;
}

.reader-sidebar-note .tiny-diamond {
  margin: 5px 0 0;
  flex: 0 0 auto;
}

.reader-sidebar-note p {
  margin: 0;
  color: #697486;
  font-size: 9px;
  line-height: 1.75;
}

.reader-sidebar-home {
  margin-top: auto;
  padding-top: 17px;
  display: flex;
  justify-content: space-between;
  border-top: 1px solid #deddd6;
  color: #647184;
  font-size: 9px;
}

.reader-sidebar-home span {
  color: #c97e4a;
}

.reader-main {
  width: min(100%, 1120px);
  margin: 0 auto;
  padding: 38px clamp(25px, 5vw, 72px) 25px;
}

.reader-titlebar {
  display: flex;
  justify-content: space-between;
  gap: 20px;
}

.reader-kicker {
  margin: 0;
  color: #b76e41;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .16em;
}

.reader-kicker span,
.reader-subtitle span {
  padding: 0 4px;
  color: #c97e4a;
}

.reader-titlebar h1 {
  margin: 7px 0 0;
  color: #17283e;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 36px);
  font-weight: 500;
  letter-spacing: -.03em;
  line-height: 1.25;
}

.reader-subtitle {
  margin: 7px 0 0;
  color: #788292;
  font-size: 9px;
}

.reader-title-mark {
  padding-top: 10px;
  color: rgba(201, 126, 74, .6);
  font-family: var(--serif);
  font-size: 35px;
  font-style: italic;
}

.book-stage {
  position: relative;
  min-height: 410px;
  margin-top: 20px;
  display: grid;
  grid-template-columns: 46px minmax(0, 1fr) 46px;
  align-items: center;
  gap: 12px;
}

.book-page {
  position: relative;
  isolation: isolate;
  width: min(100%, 675px);
  max-height: min(64vh, 735px);
  margin: 0 auto;
  padding: 17px 18px 0;
  display: flex;
  flex-direction: column;
  background: #f8f6f0;
  box-shadow: 0 9px 24px rgba(32, 35, 38, .16), 0 1px 2px rgba(32, 35, 38, .15);
}

.book-page::before {
  position: absolute;
  z-index: -1;
  top: 8px;
  right: 3px;
  bottom: 1px;
  left: 3px;
  content: "";
  background: #dedbd2;
  box-shadow: 0 8px 18px rgba(32, 35, 38, .08);
  transform: rotate(.5deg);
}

.book-page-image-link {
  min-height: 240px;
  height: min(57vh, 650px);
  display: grid;
  place-items: center;
  overflow: auto;
  background: #fff;
}

.book-page-image {
  width: auto;
  max-width: 100%;
  height: auto;
  max-height: 100%;
  display: block;
  object-fit: contain;
}

.book-page-image-link[hidden],
.book-text-page[hidden] {
  display: none;
}

.book-text-page {
  min-height: 240px;
  height: min(57vh, 650px);
  overflow: auto;
  background:
    linear-gradient(90deg, rgba(174, 154, 118, .07), transparent 13%, transparent 87%, rgba(174, 154, 118, .07)),
    #fffdf7;
  color: #282821;
}

.book-cover-page {
  padding: clamp(24px, 6vw, 70px) clamp(20px, 7vw, 80px);
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.text-page-eyebrow {
  margin: 0;
  color: #a56d43;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: .17em;
  text-transform: uppercase;
}

.book-text-page h2 {
  max-width: 500px;
  margin: 17px 0 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3.8vw, 39px);
  font-weight: 500;
  line-height: 1.3;
}

.text-page-subheading {
  margin: 20px 0 0;
  color: #6f6b60;
  font-family: var(--serif);
  font-size: 16px;
}

.text-page-details {
  max-width: 340px;
  margin: 15px 0 0;
  color: #777267;
  font-size: 10px;
  line-height: 1.9;
}

.text-page-year {
  margin-top: 20px;
  color: #a56d43;
  font-family: var(--serif);
  font-size: 18px;
}

.book-contents-page {
  padding: 27px clamp(19px, 4vw, 45px);
}

.book-unavailable-page {
  padding: clamp(24px, 6vw, 70px);
  display: flex;
  align-items: center;
  flex-direction: column;
  justify-content: center;
  text-align: center;
}

.book-unavailable-page .text-page-details {
  max-width: 360px;
}

.book-text-page .contents-list {
  max-width: 540px;
  margin: 18px auto 0;
  padding: 0;
  list-style: none;
  counter-reset: chapter;
}

.contents-list li {
  min-height: 35px;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 32px;
  align-items: center;
  gap: 12px;
  border-bottom: 1px solid #e8e3d8;
}

.contents-list button {
  padding: 6px 0;
  border: 0;
  background: none;
  color: #34372f;
  text-align: left;
  font-family: var(--serif);
  font-size: 11px;
  cursor: pointer;
}

.contents-list button:hover {
  color: #a56d43;
}

.contents-list span {
  color: #a56d43;
  text-align: right;
  font-family: var(--sans);
  font-size: 9px;
}

.book-page-caption {
  min-height: 40px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 15px;
  color: #727a84;
  font-size: 9px;
}

.page-folio {
  color: #ad6d43;
  font-family: var(--serif);
  font-size: 12px;
  font-style: italic;
}

.page-turn {
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border: 1px solid #d6d3cb;
  border-radius: 50%;
  background: rgba(247, 245, 239, .7);
  color: #17283e;
  font-size: 16px;
  cursor: pointer;
  transition: background .2s ease, border-color .2s ease, opacity .2s ease;
}

.page-turn:hover:not(:disabled) {
  border-color: #c97e4a;
  background: #f7f5ef;
}

.page-turn:disabled {
  opacity: .35;
  cursor: not-allowed;
}

.reader-progress-meta {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  color: #727a84;
  font-size: 9px;
}

.reader-progress-meta a {
  color: #ad6d43;
}

.reader-controls {
  display: grid;
  grid-template-columns: 100px minmax(0, 1fr) 100px;
  align-items: center;
  gap: 20px;
  max-width: 790px;
  margin: 20px auto 0;
}

.reader-control-button {
  padding: 8px 0;
  border: 0;
  background: transparent;
  color: #35445a;
  font-family: var(--sans);
  font-size: 10px;
  cursor: pointer;
}

.reader-control-button:disabled {
  color: #a4a8ae;
  cursor: not-allowed;
}

.reader-control-button span {
  padding: 0 5px;
}

.reader-control-next {
  text-align: right;
}

.reader-progress input {
  width: 100%;
  height: 3px;
  margin: 0 0 9px;
  display: block;
  appearance: none;
  background: #d3d0c8;
  cursor: pointer;
}

.reader-progress input::-webkit-slider-thumb {
  width: 12px;
  height: 12px;
  appearance: none;
  border: 2px solid #f7f5ef;
  border-radius: 50%;
  background: #c97e4a;
  box-shadow: 0 0 0 1px #c97e4a;
}

.reader-progress input::-moz-range-thumb {
  width: 9px;
  height: 9px;
  border: 2px solid #f7f5ef;
  border-radius: 50%;
  background: #c97e4a;
  box-shadow: 0 0 0 1px #c97e4a;
}

.reader-key-hint {
  margin: 16px 0 0;
  color: #ad6d43;
  text-align: center;
  font-size: 8px;
  font-weight: 700;
  letter-spacing: .1em;
}

.reader-key-hint span {
  margin-left: 6px;
  color: #858b95;
  font-weight: 400;
  letter-spacing: 0;
}

.reader-error {
  max-width: 670px;
  margin: 12px auto;
  color: #9f382f;
  font-size: 12px;
  text-align: center;
}

@media (max-width: 800px) {
  .reader-layout {
    grid-template-columns: 190px minmax(0, 1fr);
  }

  .reader-sidebar {
    padding-right: 16px;
    padding-left: 16px;
  }

  .reader-main {
    padding-right: 20px;
    padding-left: 20px;
  }

  .reader-title-mark {
    display: none;
  }

  .book-stage {
    grid-template-columns: 34px minmax(0, 1fr) 34px;
    gap: 6px;
  }

  .page-turn {
    width: 32px;
    height: 32px;
  }

  .reader-controls {
    grid-template-columns: 75px minmax(0, 1fr) 75px;
    gap: 8px;
  }
}

@media (max-width: 600px) {
  .reader-layout {
    min-height: calc(100vh - 70px);
    grid-template-columns: 1fr;
  }

  .reader-sidebar {
    min-height: 0;
    padding: 13px 20px 10px;
    border-right: 0;
    border-bottom: 1px solid #dcd9d0;
  }

  .reader-back,
  .reader-side-label,
  .reader-sidebar-note,
  .reader-sidebar-home {
    display: none;
  }

  .book-switcher {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    border-top: 0;
  }

  .book-switcher a,
  .book-switcher a:not(:first-child) {
    min-height: 37px;
    padding: 0 5px;
    justify-content: center;
    gap: 6px;
    border: 1px solid #deddd6;
    font-size: 9px;
  }

  .reader-main {
    width: 100%;
    padding: 24px 12px 25px;
  }

  .reader-titlebar {
    padding: 0 9px;
  }

  .reader-titlebar h1 {
    font-size: 25px;
  }

  .reader-subtitle {
    font-size: 8px;
  }

  .book-stage {
    min-height: 350px;
    margin-top: 17px;
    grid-template-columns: 28px minmax(0, 1fr) 28px;
    gap: 4px;
  }

  .book-page {
    max-height: 59vh;
    padding: 10px 10px 0;
  }

  .book-page-image-link {
    min-height: 230px;
    height: 52vh;
  }

  .book-page-caption {
    min-height: 34px;
    font-size: 8px;
  }

  .page-turn {
    width: 27px;
    height: 27px;
    font-size: 13px;
  }

  .reader-controls {
    grid-template-columns: 32px minmax(0, 1fr) 32px;
    gap: 6px;
    margin-top: 16px;
  }

  .reader-control-button {
    font-size: 14px;
  }

  .reader-control-button span {
    display: none;
  }

  .reader-progress-meta {
    font-size: 8px;
  }

  .reader-progress-meta a {
    font-size: 8px;
  }

  .reader-key-hint {
    margin-top: 12px;
  }
}
