:root {
  color-scheme: dark;
  --ink: #26221a;
  --paper: #eadbb8;
  --paper-edge: #b49c75;
  --leather: #4b3225;
  --gold: #dfc58f;
  --parchment-text: #f5e9d1;
  --serif: "Palatino Linotype", "Book Antiqua", Palatino, Georgia, serif;
  --sans: system-ui, sans-serif;
}

*, *::before, *::after { box-sizing: border-box; }
body {
  min-height: 100vh;
  min-height: 100svh;
  margin: 0;
  color: var(--parchment-text);
  font: 1rem var(--serif);
  background:
    radial-gradient(ellipse at 51% 39%, #4d4534, transparent 69%),
    repeating-linear-gradient(103deg, #d5b47a07 0 1px, #0000 1px 4px),
    #211e17;
}
h1, p { margin: 0; }
button { cursor: pointer; font: inherit; }
button:focus-visible { outline: 2px solid #f5d58e; outline-offset: 4px; }

.reader { width: min(calc(100% - 2.5rem), 1200px); margin: auto; padding: clamp(1.15rem, 4vh, 2.8rem) 0 1.3rem; }
.book-header {
  width: min(100%, 970px);
  margin: 0 auto clamp(1rem, 2.8vh, 2rem);
  padding: 0 .1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
h1 { font-size: clamp(1.3rem, 3.2vw, 2.4rem); line-height: 1.05; letter-spacing: -.04em; font-weight: 400; }
.text-button {
  min-height: 2.55rem;
  padding: .36rem .9rem;
  border: 1px solid #9b8160;
  border-radius: 3px;
  color: #f4e6cb;
  background: #2e281d;
  white-space: nowrap;
}
.text-button:hover, .round-button:hover:not(:disabled) { background: #574733; }

.book-stage {
  width: min(100%, 1040px, calc((100svh - 153px) * 1.69));
  min-width: min(100%, 560px);
  position: relative;
  margin-inline: auto;
  isolation: isolate;
}
.book-stage::before {
  content: "";
  position: absolute;
  z-index: -1;
  inset: -6px -10px -10px;
  border-radius: 6px 7px 8px 7px;
  border: 1px solid #805e42;
  background:
    linear-gradient(90deg, #39271dc2, transparent 47%, #302316 50%, transparent 52%, #39271dc2),
    repeating-linear-gradient(127deg, #ffe0a719 0 1px, #281b0b21 1px 3px),
    var(--leather);
  box-shadow: 0 18px 60px #120f0ce8, inset 0 0 0 3px #301f16;
  pointer-events: none;
}
.book-stage::after {
  content: "";
  position: absolute;
  z-index: -1;
  inset: 1px -3px -6px;
  border-radius: 4px;
  background:
    linear-gradient(90deg, #4d342317, #26180d75 49.5%, #93663a65 50.5%, #4d342317),
    repeating-linear-gradient(#c7af82 0 1px, #a08662 1px 2px, #d7c29b 2px 3px);
  box-shadow: 0 2px 4px #130b06a1;
  pointer-events: none;
}
.book-stage.is-cover::before, .book-stage.is-cover::after { display: none; }

#book { width: 100%; touch-action: pan-y; }
.leaf {
  color: var(--ink);
  overflow: hidden;
  background: var(--paper);
  background-image:
    radial-gradient(ellipse at 18% 11%, #fff8e17f, transparent 65%),
    radial-gradient(ellipse at 84% 100%, #a5754526, transparent 70%),
    repeating-linear-gradient(53deg, #6e502508 0 1px, #fff7df12 1px 3px);
}
.page-content {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  box-shadow: inset 0 0 24px #926b3f38;
}
.leaf.--left .page-content { box-shadow: inset -19px 0 25px -22px #3b2617ec, inset 0 0 24px #926b3f38; }
.leaf.--right .page-content { box-shadow: inset 18px 0 25px -23px #3b2617e8, inset 0 0 24px #926b3f38; }
.leaf .plate {
  display: block;
  width: 92%;
  height: 94%;
  object-fit: contain;
  mix-blend-mode: multiply;
  filter: grayscale(1) contrast(1.05) brightness(1.1);
  mask-image: radial-gradient(ellipse 69% 72% at center, #000 66%, #000d 77%, transparent 100%);
  user-select: none;
  pointer-events: none;
}
.leaf .plate[src$="/strick.webp"] { filter: saturate(.63) contrast(1.06) brightness(1.1); }
.folio {
  position: absolute;
  bottom: clamp(.5rem, 1.35vw, .95rem);
  color: #644e35;
  font-size: .8rem;
  font-style: italic;
}
.leaf.--left .folio { left: 1.1rem; }
.leaf.--right .folio { right: 1.1rem; }

.cover {
  border: 1px solid #9c7554;
  border-radius: 4px;
  color: var(--gold);
  background:
    radial-gradient(ellipse at 42% 29%, #8b60406e, transparent 70%),
    repeating-linear-gradient(125deg, #fee6a91c 0 1px, #1d110e44 1px 3px),
    #4c2f22;
  box-shadow: inset 0 0 0 4px #40261c, inset 0 0 29px #190c07ad;
}
.cover .page-content { inset: 6%; place-content: center; text-align: center; border: 1px solid #c5a67391; box-shadow: inset 0 0 0 4px #63412c, inset 0 0 0 5px #b8945b62; }
.cover .cover-name { font-size: clamp(1.95rem, 5vw, 3.8rem); line-height: .99; letter-spacing: -.065em; text-shadow: 0 2px #1d100bc4; }
.cover .cover-origin { font: .61rem var(--sans); text-transform: uppercase; letter-spacing: .17em; margin-top: .95rem; }

.book-controls {
  margin-top: clamp(1.3rem, 3.6vh, 2.4rem);
  display: flex;
  justify-content: center;
  align-items: center;
  gap: .85rem;
}
.round-button {
  display: grid;
  place-items: center;
  width: 2.7rem;
  height: 2.7rem;
  padding: 0;
  font: 1.23rem var(--sans);
  color: var(--gold);
  border: 1px solid #9b8160;
  border-radius: 50%;
  background: #2d271d;
}
.round-button:disabled { opacity: .34; cursor: default; }
.page-position {
  min-width: 12ch;
  text-align: center;
  font: .83rem var(--sans);
  font-variant-numeric: tabular-nums;
  color: var(--gold);
}
@media (max-width: 680px) {
  .reader { width: calc(100% - 1.75rem); padding-top: 1rem; }
  .book-header { width: min(100%, 445px); }
  .book-stage { width: min(100%, 440px, calc((100svh - 142px) * .845)); min-width: min(100%, 260px); }
  .book-stage::before { inset: -4px -5px -7px; }
  .book-stage::after { inset: 1px -2px -4px; }
}
