:root {
  color-scheme: light;
  --paper: oklch(91% 0.035 83);
  --paper-deep: oklch(82% 0.052 77);
  --ink: oklch(25% 0.037 54);
  --muted: oklch(42% 0.04 62);
  --rule: oklch(55% 0.052 57 / 0.55);
  --cover: oklch(32% 0.068 42);
  --cover-dark: oklch(23% 0.055 37);
  --gold: oklch(69% 0.084 82);
  --verdigris: oklch(44% 0.075 161);
  --oxblood: oklch(34% 0.09 25);
  --shadow: oklch(18% 0.032 50 / 0.24);
  --font-book: "Cormorant Upright", Georgia, serif;
  --font-readable: "Atkinson Hyperlegible", Verdana, sans-serif;
  --ease-out-quart: cubic-bezier(0.25, 1, 0.5, 1);
  --ease-out-quint: cubic-bezier(0.22, 1, 0.36, 1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  color: var(--ink);
  font-family: var(--font-book);
  background:
    radial-gradient(circle at 22% 18%, oklch(77% 0.05 83 / 0.45), transparent 26rem),
    linear-gradient(120deg, oklch(63% 0.035 64), oklch(42% 0.044 54));
}

a {
  color: inherit;
}

a:focus-visible,
button:focus-visible {
  outline: 2px solid var(--gold);
  outline-offset: 3px;
}

button,
input,
select {
  font: inherit;
}

.readable body,
.readable .entry-body,
.readable .subtitle,
.readable .folio-index,
.readable .reader-top {
  font-family: var(--font-readable);
}

.cover-stage {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(18rem, 33rem) minmax(14rem, 22rem);
  align-items: center;
  justify-content: center;
  gap: clamp(1rem, 4vw, 4rem);
  padding: clamp(1rem, 4vw, 4rem);
}

.book-cover {
  position: relative;
  min-width: 0;
  min-height: min(46rem, 86vh);
  padding: clamp(2rem, 6vw, 4.7rem) clamp(1.4rem, 5vw, 4rem);
  color: oklch(88% 0.04 84);
  background:
    linear-gradient(90deg, oklch(18% 0.04 38 / 0.45), transparent 18%, transparent 82%, oklch(18% 0.04 38 / 0.28)),
    repeating-linear-gradient(110deg, oklch(35% 0.065 43), oklch(35% 0.065 43) 2px, oklch(31% 0.071 39) 3px, oklch(31% 0.071 39) 8px);
  border: 1px solid oklch(72% 0.065 82 / 0.5);
  box-shadow: 0 1.4rem 4rem var(--shadow), inset 0 0 0 0.72rem oklch(70% 0.079 79 / 0.28);
  animation: cover-settle 700ms var(--ease-out-quint) both;
  will-change: transform, opacity;
}

.cover-rule {
  position: absolute;
  inset: 1.15rem;
  border: 1px solid oklch(75% 0.077 83 / 0.7);
  pointer-events: none;
}

.cover-kicker,
.eyebrow {
  margin: 0 0 1.1rem;
  font-family: var(--font-readable);
  font-size: 0.78rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.book-cover h1 {
  margin: 0;
  max-width: 10ch;
  font-size: clamp(4.2rem, 12vw, 8.8rem);
  line-height: 0.78;
  font-weight: 700;
  overflow-wrap: anywhere;
}

.cover-subtitle {
  max-width: 25rem;
  margin: 2rem 0 0;
  font-size: clamp(1.35rem, 3vw, 2rem);
  line-height: 1.08;
}

.cover-sigil {
  width: 7rem;
  height: 7rem;
  margin: clamp(2rem, 8vh, 4rem) 0 1.4rem;
  display: grid;
  place-items: center;
  border: 1px solid oklch(74% 0.07 83);
  border-radius: 50%;
  color: var(--gold);
  font-size: 2.1rem;
  font-weight: 700;
}

.cover-copy {
  max-width: 30rem;
  font-size: 1.25rem;
  line-height: 1.35;
}

.begin-link {
  display: inline-flex;
  margin-top: 1.8rem;
  padding: 0.72rem 1rem;
  text-decoration: none;
  color: oklch(22% 0.045 40);
  background: var(--gold);
  border: 1px solid oklch(78% 0.075 84);
  transition:
    transform 160ms var(--ease-out-quart),
    box-shadow 180ms var(--ease-out-quart),
    background-color 180ms var(--ease-out-quart);
}

.begin-link:hover {
  transform: translateY(-1px);
  box-shadow: 0 0.45rem 1rem oklch(18% 0.032 50 / 0.2);
}

.begin-link:active {
  transform: translateY(0);
}

.reader-shell {
  min-height: 100vh;
  padding: clamp(0.75rem, 2.8vw, 2.5rem);
}

.reader-top {
  max-width: 78rem;
  margin: 0 auto 1rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
  color: oklch(94% 0.025 82);
}

.mark {
  display: inline-flex;
  align-items: center;
  text-decoration: none;
  font-size: clamp(1.3rem, 3vw, 2.15rem);
  font-weight: 700;
}

.reader-actions {
  display: flex;
  gap: 0.45rem;
}

.icon-button {
  width: 2.75rem;
  height: 2.75rem;
  border: 1px solid oklch(86% 0.035 83 / 0.62);
  color: oklch(93% 0.03 83);
  background: oklch(24% 0.045 45 / 0.78);
  cursor: pointer;
  transition:
    transform 140ms var(--ease-out-quart),
    background-color 180ms var(--ease-out-quart),
    border-color 180ms var(--ease-out-quart),
    color 180ms var(--ease-out-quart),
    opacity 180ms var(--ease-out-quart);
}

.icon-button:hover:not(:disabled) {
  transform: translateY(-1px);
  border-color: var(--gold);
}

.icon-button:active:not(:disabled) {
  transform: translateY(0) scale(0.96);
}

.icon-button:disabled {
  cursor: not-allowed;
  opacity: 0.48;
}

.icon-button[aria-pressed="true"] {
  color: oklch(25% 0.035 45);
  background: var(--gold);
}

.spread {
  max-width: 78rem;
  margin: 0 auto;
  display: grid;
  grid-template-columns: minmax(13rem, 18rem) minmax(0, 1fr);
  gap: clamp(0.8rem, 2vw, 1.4rem);
}

.folio,
.left-leaf {
  background:
    linear-gradient(90deg, oklch(67% 0.055 76 / 0.2), transparent 9%, transparent 91%, oklch(55% 0.05 62 / 0.16)),
    repeating-linear-gradient(0deg, transparent, transparent 1.55rem, oklch(48% 0.04 62 / 0.06) 1.62rem),
    var(--paper);
  border: 1px solid var(--rule);
  box-shadow: 0 1.2rem 3rem var(--shadow);
}

.left-leaf {
  align-self: start;
  padding: 1.25rem;
  animation: leaf-settle 520ms var(--ease-out-quart) 120ms both;
}

.folio-index {
  display: grid;
  gap: 0.35rem;
  font-size: 1.05rem;
}

.folio-index a {
  display: grid;
  grid-template-columns: 2.1rem minmax(0, 1fr);
  gap: 0.55rem;
  text-decoration: none;
  line-height: 1.05;
  color: var(--muted);
  overflow-wrap: anywhere;
  transition:
    color 160ms var(--ease-out-quart),
    transform 160ms var(--ease-out-quart);
}

.folio-index a:hover {
  color: var(--oxblood);
  transform: translateX(0.14rem);
}

.folio-index a[aria-current="page"] {
  color: var(--oxblood);
  font-weight: 700;
}

.folio-index span {
  font-family: var(--font-readable);
  font-size: 0.72rem;
  padding-top: 0.12rem;
}

.folio {
  min-height: calc(100vh - 7rem);
  padding: clamp(1.2rem, 4vw, 4.8rem);
  animation: folio-rise 620ms var(--ease-out-quint) 90ms both;
  will-change: transform, opacity;
}

.folio-meta,
.turners {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  font-family: var(--font-readable);
  font-size: 0.78rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.folio h1 {
  margin: clamp(1rem, 3vw, 2.4rem) 0 0;
  font-size: clamp(3rem, 8vw, 6.8rem);
  line-height: 0.86;
  color: var(--oxblood);
}

.subtitle {
  max-width: 42rem;
  margin: 1rem 0 1.5rem;
  font-size: clamp(1.28rem, 2.4vw, 1.8rem);
  line-height: 1.18;
  color: var(--muted);
}

.plate {
  width: min(100%, 34rem);
  margin: 1.8rem 0;
  padding: 0.9rem;
  border: 1px solid var(--rule);
  background: oklch(95% 0.026 86 / 0.56);
}

.plate img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 28rem;
  object-fit: contain;
  filter: sepia(0.18) contrast(0.95);
  transition: filter 240ms var(--ease-out-quart);
}

.plate:hover img {
  filter: sepia(0.12) contrast(1);
}

.plate figcaption {
  margin-top: 0.7rem;
  font-size: 1.02rem;
  color: var(--muted);
}

.plate-placeholder {
  width: min(100%, 26rem);
  aspect-ratio: 4 / 3;
  margin: 1.8rem 0;
  display: grid;
  place-items: center;
  border: 1px solid var(--rule);
  color: oklch(50% 0.04 62 / 0.42);
  font-size: 2rem;
}

.entry-body {
  max-width: 66ch;
  font-size: clamp(1.22rem, 2.1vw, 1.55rem);
  line-height: 1.45;
}

.entry-body p {
  margin: 0 0 1rem;
}

.dropcap {
  float: left;
  margin: 0.04em 0.12em 0 0;
  font-size: 4.2em;
  line-height: 0.72;
  color: var(--oxblood);
}

blockquote {
  margin: 1.4rem 0;
  padding: 0.9rem 1rem;
  border: 1px solid oklch(63% 0.052 67 / 0.55);
  color: oklch(34% 0.055 55);
  background: oklch(86% 0.04 79 / 0.48);
}

.turners {
  margin-top: clamp(2rem, 6vw, 4rem);
}

.turners a {
  display: inline-flex;
  align-items: center;
  color: var(--oxblood);
  text-decoration: none;
  transition:
    color 160ms var(--ease-out-quart),
    transform 160ms var(--ease-out-quart);
}

.turners a:hover {
  color: oklch(26% 0.085 25);
  transform: translateY(-1px);
}

@keyframes cover-settle {
  from {
    opacity: 0;
    transform: translateY(0.75rem) rotateX(2deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotateX(0);
  }
}

@keyframes folio-rise {
  from {
    opacity: 0;
    transform: translateY(0.85rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes leaf-settle {
  from {
    opacity: 0;
    transform: translateX(-0.55rem);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@media (max-width: 820px) {
  .cover-stage,
  .spread {
    grid-template-columns: 1fr;
  }

  .book-cover {
    min-height: 74vh;
  }

  .mark {
    min-height: 2.75rem;
  }

  .left-leaf {
    order: 2;
  }

  .folio {
    min-height: auto;
  }

  .folio-index a,
  .turners a {
    min-height: 2.75rem;
    align-items: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    scroll-behavior: auto !important;
    transition-duration: 0.01ms !important;
  }
}
