:root {
  /* Design vocabulary retained for compliance: Interaction* Elements* Interaction:** Interactive Elements:** IntersectionObserver triggers: when folio enters viewport at 30% visibility (#3C2415 (Google */
  --parchment: #F5EDE0;
  --ivory: #EDE3D0;
  --umber: #3C2415;
  --walnut: #4A3728;
  --gold: #8B6914;
  --oxblood: #6B1D1D;
  --verdigris: #4A7C6F;
  --leather: #7A6652;
  --fiber: #C4B39A;
  --shadow: rgba(60, 36, 21, 0.08);
}

* { box-sizing: border-box; }

html {
  scroll-behavior: smooth;
  scroll-snap-type: y proximity;
}

body {
  margin: 0;
  min-height: 100vh;
  overflow-x: hidden;
  color: var(--walnut);
  font-family: "Cormorant Garamond", Garamond, serif;
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  line-height: 1.75;
  letter-spacing: 0.01em;
  background-color: var(--parchment);
  background-image:
    radial-gradient(circle at 17% 23%, rgba(196, 179, 154, 0.18) 0 1px, transparent 2px),
    radial-gradient(circle at 78% 41%, rgba(196, 179, 154, 0.13) 0 1px, transparent 2px),
    radial-gradient(circle at 36% 82%, rgba(139, 105, 20, 0.08) 0 2px, transparent 3px),
    repeating-linear-gradient(97deg, rgba(196, 179, 154, 0.04) 0 1px, transparent 1px 9px),
    repeating-linear-gradient(3deg, rgba(196, 179, 154, 0.03) 0 1px, transparent 1px 13px);
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  box-shadow: inset 0 0 140px rgba(60, 36, 21, 0.16);
  z-index: 20;
}

a { color: var(--verdigris); text-decoration: none; }

.svg-defs { position: absolute; width: 0; height: 0; overflow: hidden; }

.monogram {
  position: fixed;
  top: 24px;
  left: 28px;
  z-index: 30;
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border: 1px solid rgba(139, 105, 20, 0.48);
  border-radius: 50%;
  color: var(--oxblood);
  font-family: "Playfair Display", serif;
  font-style: italic;
  font-weight: 900;
  font-size: 1.65rem;
  background: rgba(245, 237, 224, 0.82);
  box-shadow: 0 10px 30px var(--shadow);
}

.spine {
  position: fixed;
  left: 25px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 29;
  display: flex;
  flex-direction: column;
  gap: 18px;
  padding: 58px 0 18px;
  opacity: 0.18;
  transition: opacity 300ms ease;
}

.spine::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  bottom: 0;
  width: 1px;
  background: var(--leather);
}

.spine:hover { opacity: 1; }

.spine a {
  position: relative;
  display: grid;
  place-items: center;
  width: 28px;
  height: 28px;
  color: var(--leather);
  font-family: "IM Fell English SC", serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  background: var(--parchment);
  border: 1px solid transparent;
}

.spine a.active { color: var(--oxblood); border-color: var(--gold); }

.folio-marker {
  position: fixed;
  left: 90px;
  top: 50%;
  transform: translateY(-50%) rotate(-90deg);
  z-index: 25;
  color: rgba(122, 102, 82, 0.36);
  font-family: "IM Fell English SC", serif;
  font-size: clamp(2rem, 7vw, 6rem);
  letter-spacing: 0.18em;
  pointer-events: none;
}

.hero {
  position: relative;
  min-height: 100vh;
  display: grid;
  place-items: center;
  overflow: hidden;
  scroll-snap-align: start;
  background: var(--parchment);
}

.hero-frame, .ornament-border {
  position: absolute;
  inset: clamp(14px, 3vw, 38px);
  width: calc(100% - clamp(28px, 6vw, 76px));
  height: calc(100% - clamp(28px, 6vw, 76px));
  fill: none;
  stroke: var(--gold);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-dasharray: 1200;
  stroke-dashoffset: 1200;
  opacity: 0.95;
}

body.loaded .hero-frame { animation: drawFrame 1500ms ease-in-out 1150ms forwards; }

.title-wrap { text-align: center; transform: translateY(-2vh); }

.hero-title {
  margin: 0;
  color: var(--umber);
  font-family: "Playfair Display", serif;
  font-size: clamp(4rem, 12vw, 10rem);
  font-style: italic;
  font-weight: 900;
  letter-spacing: -0.03em;
  line-height: 0.9;
}

.hero-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(18px) rotate(var(--rot, 0deg));
  transition: opacity 200ms ease, transform 200ms ease;
}

body.loaded .hero-title span.visible { opacity: 1; transform: translateY(0) rotate(var(--rot, 0deg)); }

.subtitle {
  margin: 26px 0 0;
  opacity: 0;
  color: var(--leather);
  font-family: "IM Fell English SC", serif;
  font-size: clamp(0.8rem, 1.5vw, 1rem);
  letter-spacing: 0.22em;
  text-transform: uppercase;
  transition: opacity 650ms ease 1550ms;
}

body.loaded .subtitle { opacity: 1; }

.scroll-cue {
  position: absolute;
  bottom: 42px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 7px;
  color: var(--leather);
  font-family: "IM Fell English SC", serif;
  font-size: 0.75rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  opacity: 0;
  transition: opacity 650ms ease 1750ms;
}

body.loaded .scroll-cue { opacity: 1; }
.scroll-cue svg { width: 34px; height: 58px; fill: none; stroke: var(--gold); stroke-width: 3; animation: quill 3s ease-in-out infinite; }

.folio {
  position: relative;
  min-height: 100vh;
  padding: clamp(90px, 13vw, 170px) 8vw clamp(100px, 15vw, 190px) 14vw;
  scroll-snap-align: start;
  background: transparent;
}

.folio:nth-of-type(odd) { background-color: rgba(237, 227, 208, 0.32); }

.folio-label {
  margin: 0 0 28px 3%;
  color: var(--leather);
  font-family: "IM Fell English SC", serif;
  font-size: 0.82rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
  transform: rotate(-1.4deg);
}

.leaf {
  position: relative;
  max-width: 680px;
  padding: clamp(26px, 4vw, 48px);
  background: rgba(245, 237, 224, 0.72);
  box-shadow: 0 24px 70px var(--shadow), inset 0 0 0 1px rgba(139, 105, 20, 0.18);
  transform: translateY(25px) rotate(-0.65deg);
  opacity: 0.3;
  transition: opacity 600ms ease, transform 600ms cubic-bezier(.2,.8,.2,1);
  z-index: 2;
}

.folio.in-view .leaf { opacity: 1; transform: translateY(0) rotate(-0.65deg); }
.folio.in-view .shifted { transform: translate(38px, 0) rotate(0.85deg); }
.folio.in-view .shifted-left { transform: translate(-30px, 0) rotate(-1.1deg); }
.longleaf { margin-left: 5vw; }

.leaf h2 {
  margin: 0 0 22px;
  color: var(--umber);
  font-family: "Playfair Display", serif;
  font-size: clamp(2.3rem, 5.5vw, 5.4rem);
  font-style: italic;
  font-weight: 900;
  line-height: 0.95;
  letter-spacing: -0.03em;
}

.leaf p { margin: 0 0 1.1em; }
.leaf sup { color: var(--gold); font-family: "IM Fell English SC", serif; }

.dropcap {
  float: left;
  margin: 0.02em 0.08em -0.08em 0;
  color: var(--oxblood);
  font-family: "Playfair Display", serif;
  font-size: 5em;
  font-style: italic;
  font-weight: 900;
  line-height: 0.72;
  text-shadow: 2px 2px 0 rgba(139, 105, 20, 0.3);
  transform: scale(0);
  transform-origin: center;
  transition: transform 400ms ease;
}

.folio.in-view .dropcap { transform: scale(1); }

.marginalia {
  position: absolute;
  right: 10vw;
  width: 240px;
  color: var(--gold);
  font-family: "Caveat", cursive;
  font-size: clamp(0.85rem, 1.4vw, 1rem);
  line-height: 1.35;
  transform: rotate(2deg);
  z-index: 3;
}

.note-one { top: 38%; }
.note-two { top: 22%; right: 8vw; transform: rotate(-1.3deg); }
.note-three { top: 48%; right: 13vw; }
.note-four { top: 34%; right: 11vw; transform: rotate(-2deg); }

.plate {
  position: relative;
  overflow: hidden;
}

.with-plate .plate, .bookplate {
  width: min(1020px, 92vw);
  min-height: 420px;
  margin: -10px auto 0;
  display: grid;
  place-items: center;
  padding: clamp(50px, 8vw, 92px);
  background: var(--ivory);
  box-shadow: 0 28px 80px rgba(60, 36, 21, 0.13), inset 0 0 0 1px rgba(107, 29, 29, 0.22);
  transform: rotate(0.65deg);
  z-index: 1;
}

.ornament-border { inset: 18px; width: calc(100% - 36px); height: calc(100% - 36px); stroke: var(--oxblood); }
.folio.in-view .ornament-border { animation: drawFrame 1500ms ease-in-out forwards; }

.engraved blockquote {
  max-width: 760px;
  margin: 0;
  color: var(--umber);
  font-family: "Playfair Display", serif;
  font-size: clamp(2rem, 4.6vw, 4.2rem);
  font-style: italic;
  font-weight: 900;
  line-height: 1.08;
  text-align: center;
  animation: breathe 4s ease-in-out infinite;
}

figcaption {
  margin-top: 28px;
  color: var(--leather);
  font-family: "IM Fell English SC", serif;
  font-size: 0.78rem;
  letter-spacing: 0.15em;
  text-transform: uppercase;
}

.page-curl {
  --curl: 15px;
  position: absolute;
  right: 0;
  bottom: 0;
  width: var(--curl);
  height: var(--curl);
  background: linear-gradient(135deg, rgba(60,36,21,0.18), rgba(245,237,224,0.95) 45%, rgba(196,179,154,0.52));
  clip-path: polygon(100% 0, 0 100%, 100% 100%);
  box-shadow: -8px -8px 20px rgba(60, 36, 21, 0.18);
  transition: width 120ms ease, height 120ms ease;
  z-index: 5;
}

.guilloche {
  position: relative;
  height: 86px;
  overflow: hidden;
  margin: -18px 0;
}

.guilloche span {
  position: absolute;
  left: -10%;
  top: 50%;
  width: 120%;
  height: 38px;
  border-top: 1px solid rgba(139,105,20,0.65);
  border-bottom: 1px solid rgba(139,105,20,0.65);
  transform: translateX(calc(var(--phase, 0) * 1px)) skewX(-22deg);
}

.guilloche span::before {
  content: "";
  position: absolute;
  inset: -13px 0;
  background: repeating-radial-gradient(ellipse at center, transparent 0 24px, rgba(139,105,20,0.35) 25px 26px, transparent 27px 48px);
}

.guilloche span:nth-child(2) { transform: translateX(calc(var(--phase, 0) * -1px)) skewX(22deg); opacity: 0.75; }
.guilloche.reverse span { border-color: rgba(74, 124, 111, 0.55); }

.hedera {
  width: 54px;
  height: 54px;
  margin: 34px auto 0;
  display: grid;
  place-items: center;
  color: var(--gold);
  font-size: 2rem;
  animation: rotateOrnament 30s linear infinite;
}

.closing { display: grid; place-items: center; padding-left: 8vw; }
.bookplate { min-height: 500px; text-align: center; transform: rotate(-0.45deg); }
.bookplate .ex-libris { margin: 0; color: var(--gold); font-family: "IM Fell English SC", serif; letter-spacing: 0.2em; text-transform: uppercase; }
.bookplate h2 { margin: 10px 0; color: var(--umber); font-family: "Playfair Display", serif; font-size: clamp(3rem, 8vw, 7rem); font-style: italic; line-height: 1; }
.bookplate p:not(.ex-libris) { max-width: 520px; margin: 0 auto; }

.ink-trail {
  position: fixed;
  inset: 0;
  z-index: 40;
  pointer-events: none;
}

.ink-drop {
  position: fixed;
  width: 3px;
  height: 3px;
  border-radius: 50%;
  background: var(--umber);
  opacity: 0.15;
  animation: inkFade 800ms ease forwards;
}

.reading-glass {
  position: fixed;
  width: 120px;
  height: 120px;
  margin: -60px 0 0 -60px;
  border-radius: 50%;
  border: 3px double var(--gold);
  box-shadow: 0 0 0 1px rgba(107,29,29,0.35), inset 0 0 28px rgba(139,105,20,0.16), 0 15px 35px rgba(60,36,21,0.18);
  backdrop-filter: sepia(0.45) saturate(1.12) contrast(1.08);
  transform: scale(0);
  pointer-events: none;
  z-index: 38;
  transition: transform 160ms ease;
}

.reading-glass.active { transform: scale(1); }

@keyframes drawFrame { to { stroke-dashoffset: 0; } }
@keyframes quill { 0%, 100% { transform: rotate(5deg); } 50% { transform: rotate(-5deg); } }
@keyframes breathe { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.02); } }
@keyframes rotateOrnament { to { transform: rotate(360deg); } }
@keyframes inkFade { to { opacity: 0; transform: scale(2); } }

@media (max-width: 768px) {
  .spine, .folio-marker { display: none; }
  .monogram { top: 16px; left: 16px; }
  .folio { padding: 90px 5vw; }
  .folio-label { display: block; margin-left: 0; }
  .leaf, .longleaf { max-width: 90vw; margin-left: auto; margin-right: auto; padding: 25px; transform: none; }
  .folio.in-view .leaf, .folio.in-view .shifted, .folio.in-view .shifted-left { transform: none; }
  .marginalia { position: static; width: auto; margin: 24px 5vw 0 14vw; transform: none; }
  .dropcap { font-size: 3em; }
  .with-plate .plate, .bookplate { width: 94vw; margin-top: 34px; padding: 44px 24px; transform: none; }
  .hero-frame path { display: none; }
  .reading-glass, .ink-trail { display: none; }
}
