:root {
  --paper: #f7f5f0;
  --ink: #272622;
  --muted: #77736b;
  --line: #d8d3ca;
  --accent: #a34b35;
  --cover-light: #f2f3f1;
  --cover-mid: #eaebe8;
  --cover-dark: #dfe1dd;
  --serif: "Fraunces", Georgia, serif;
  --sans: "DM Sans", system-ui, sans-serif;
}

* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; overflow: hidden; }
body { margin: 0; background: var(--paper); color: var(--ink); font: 15px/1.6 var(--sans); }
.site-shell { position: fixed; inset: 0; overflow: hidden; background: var(--paper); }
.site-peel-layer { position: fixed; z-index: 40; inset: 0; visibility: hidden; pointer-events: none; }
.site-peel-layer.is-active { visibility: visible; }
#site-peel-canvas { width: 100%; height: 100%; display: block; }

.cover-gate {
  position: fixed; z-index: 50; inset: 0; perspective: 1800px;
  transform-origin: left center; background: #e8e9e6; cursor: w-resize;
  touch-action: none; box-shadow: 0 16px 38px rgba(35,29,23,.10);
  transition: transform 1.25s cubic-bezier(.22,.78,.18,1);
}
.cover-gate.webgl-active { transform: none !important; transition: none !important; background: transparent; box-shadow: none; }
#cover-peel-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; }
.cover-gate.webgl-active #cover-peel-canvas { z-index: 1; }
.cover-gate.webgl-active .cover-gate-page { visibility: hidden; }
.cover-gate.webgl-active::after { display: none; }
.cover-gate-page {
  width: 100%; height: 100%; padding: 11vh 11vw 8vh 16vw;
  display: flex; flex-direction: column; justify-content: space-between;
  background:
    radial-gradient(circle at 24% 12%, rgba(255,255,255,.78), transparent 34%),
    linear-gradient(135deg, var(--cover-light) 0%, var(--cover-mid) 48%, var(--cover-dark) 100%);
  color: var(--ink);
  box-shadow: inset -24px 0 42px rgba(39,38,34,.055);
}
.cover-gate-page h2 { margin: 0; font: 600 clamp(62px,10vw,150px)/.86 var(--serif); letter-spacing: -.07em; }
.cover-gate-page h2 em { color: var(--accent); font-weight: 500; }
.cover-gate-footer { display: flex; justify-content: space-between; color: #74736e; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.cover-turn-label { color: var(--ink); }
.cover-turn-label b { display: inline-block; margin-left: 10px; color: var(--accent); font-size: 18px; font-weight: 400; transition: transform .3s ease; }
.cover-gate:hover .cover-turn-label b { transform: translateX(8px); }
.book-open .cover-gate:not(.webgl-active) { transform: perspective(1800px) rotateY(128deg) !important; }

.site-header { position: fixed; z-index: 20; top: 0; right: 0; left: 0; height: 78px; display: flex; justify-content: space-between; align-items: center; padding: 0 5vw; border-bottom: 1px solid var(--line); background: rgba(247,245,240,.92); backdrop-filter: blur(12px); font-size: 12px; letter-spacing: .08em; text-transform: uppercase; }
.wordmark { color: var(--ink); text-decoration: none; font-weight: 600; }
.wordmark span { color: var(--muted); font-weight: 400; }
.site-header nav { display: flex; gap: 28px; align-items: center; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover { color: var(--ink); }
.nav-cta { border-bottom: 1px solid var(--ink); padding-bottom: 3px; color: var(--ink) !important; }

.book-pages { position: fixed; inset: 78px 0 0; overflow: hidden; perspective: 2400px; background: var(--paper); }
.book-page { position: absolute; z-index: 0; inset: 0; overflow: hidden; opacity: 0; visibility: hidden; pointer-events: none; transform: translateX(2%); background: var(--paper); }
.book-page.is-active { z-index: 2; opacity: 1; visibility: visible; pointer-events: auto; transform: none; }
.book-page.is-under { z-index: 1; opacity: 1; visibility: visible; transform: none; }
.site-shell.is-peeling .book-page.is-active { opacity: 0; visibility: hidden; pointer-events: none; }
.site-shell.is-peeling .book-page.is-under { z-index: 2; pointer-events: auto; }
.book-page.turn-forward { z-index: 4; visibility: visible; animation: page-turn-forward .78s cubic-bezier(.65,.05,.22,1) both; transform-origin: left center; }
.book-page.turn-backward { z-index: 4; visibility: visible; animation: page-turn-backward .72s cubic-bezier(.65,.05,.22,1) both; transform-origin: left center; }
.book-page.turn-forward::after, .book-page.turn-backward::after { content: ""; position: absolute; z-index: 12; top: 0; bottom: 0; width: 112px; pointer-events: none; background: linear-gradient(90deg, rgba(247,245,240,0), #faf8f3 38%, #e4dfd5 70%, rgba(39,38,34,.08) 100%); box-shadow: 18px 0 24px rgba(39,38,34,.10); }
.book-page.turn-forward::after { animation: page-edge-forward .78s cubic-bezier(.65,.05,.22,1) both; }
.book-page.turn-backward::after { animation: page-edge-backward .72s cubic-bezier(.65,.05,.22,1) both; }

@keyframes page-turn-forward {
  0% { clip-path: inset(0); transform: perspective(2400px) rotateY(0); filter: drop-shadow(0 0 0 rgba(39,38,34,0)); }
  52% { filter: drop-shadow(18px 0 20px rgba(39,38,34,.14)); }
  100% { clip-path: inset(0 100% 0 0); transform: perspective(2400px) rotateY(-14deg); filter: drop-shadow(28px 0 24px rgba(39,38,34,.05)); }
}
@keyframes page-turn-backward {
  0% { clip-path: inset(0 0 0 100%); transform: perspective(2400px) rotateY(-14deg); filter: drop-shadow(28px 0 24px rgba(39,38,34,.05)); }
  52% { filter: drop-shadow(18px 0 20px rgba(39,38,34,.14)); }
  100% { clip-path: inset(0); transform: perspective(2400px) rotateY(0); filter: drop-shadow(0 0 0 rgba(39,38,34,0)); }
}
@keyframes page-edge-forward {
  from { left: calc(100% - 56px); opacity: 0; }
  10%, 86% { opacity: 1; }
  to { left: -112px; opacity: 0; }
}
@keyframes page-edge-backward {
  from { left: -112px; opacity: 0; }
  14%, 90% { opacity: 1; }
  to { left: calc(100% - 56px); opacity: 0; }
}

.hero { display: grid; grid-template-columns: minmax(0,1fr) 120px; align-items: center; padding: clamp(38px,6vh,78px) 13vw clamp(38px,7vh,88px) 12vw; }
.hero-copy { max-width: 820px; }
.eyebrow { margin: 0 0 24px; color: var(--accent); font-size: 11px; font-weight: 600; letter-spacing: .14em; text-transform: uppercase; }
.hero h1 { margin: 0; font: 600 clamp(52px,8.2vw,132px)/.89 var(--serif); letter-spacing: -.07em; }
.hero h1 em { color: var(--accent); font-weight: 500; }
.lede { max-width: 430px; margin: clamp(24px,4vh,42px) 0 28px; color: #5e5a54; font-size: 18px; line-height: 1.45; }
.hero-actions { display: flex; align-items: center; gap: 24px; }
.button { display: inline-block; padding: 14px 20px; text-decoration: none; font-size: 12px; font-weight: 600; letter-spacing: .05em; }
.button-dark { background: var(--ink); color: var(--paper); }
.button-dark:hover { background: var(--accent); }
.text-link { color: var(--ink); font-size: 12px; text-decoration: none; border-bottom: 1px solid var(--ink); }
.microcopy { margin-top: 24px; color: var(--muted); font-size: 11px; }
.hero-mark { align-self: stretch; display: flex; flex-direction: column; justify-content: space-between; align-items: center; padding: 20px 0; color: var(--muted); font-size: 11px; letter-spacing: .16em; }
.hairline { height: 100%; width: 1px; margin: 24px 0; background: var(--line); }

.excerpt-page { display: grid; grid-template-columns: 70px minmax(280px,1.25fr) minmax(220px,.75fr); gap: 5vw; align-items: center; padding: 7vh 9vw; background: #ece9e2; }
.excerpt-page::before { content: ""; position: absolute; inset: 6vh 7vw; border-top: 1px solid rgba(39,38,34,.22); border-bottom: 1px solid rgba(39,38,34,.22); pointer-events: none; }
.folio-number { align-self: start; padding-top: 42px; color: var(--accent); font: 500 12px/1 var(--sans); letter-spacing: .14em; }
.excerpt-page h2 { max-width: 700px; margin: 0; font: 500 clamp(46px,6.4vw,88px)/.94 var(--serif); letter-spacing: -.058em; }
.excerpt-page > p { max-width: 360px; color: #5e5a54; font-size: 18px; }

.reader { display: grid; grid-template-columns: 1fr 1fr; gap: 12vw; align-items: center; padding: 8vh 13vw; background: #f2efe9; }
.reader h2 { max-width: 500px; }
.reader h2, .buy-section h2 { margin: 0; font: 500 clamp(38px,5.2vw,72px)/.98 var(--serif); letter-spacing: -.052em; }
.body-copy { max-width: 470px; }
.body-copy p { margin: 0 0 24px; color: #5e5a54; font-size: 18px; }
.body-copy strong { color: var(--ink); font-weight: 600; }
.buy-section { display: grid; place-content: center; padding: 8vh 6vw; text-align: center; background: #ece9e2; }
.buy-section h2 { margin-bottom: 40px; }


@media (max-width: 760px) {
  .cover-gate-page { padding: 9vh 8vw 7vh 12vw; }
  .site-header { height: 64px; padding: 0 6vw; }
  .site-header nav a:not(.nav-cta) { display: none; }
  .book-pages { inset: 64px 0 0; }
  .hero { grid-template-columns: 1fr; padding: 6vh 8vw; }
  .hero h1 { font-size: clamp(45px,14vw,72px); }
  .hero-mark { display: none; }
  .hero-actions { align-items: flex-start; flex-direction: column; gap: 18px; }
  .lede { font-size: 16px; }
  .excerpt-page { grid-template-columns: 36px 1fr; gap: 5vw; padding: 5vh 7vw; }
  .excerpt-page::before { inset: 3vh 5vw; }
  .folio-number { padding-top: 8px; }
  .excerpt-page > div, .excerpt-page > p { grid-column: 2; }
  .excerpt-page h2 { font-size: clamp(38px,11vw,58px); }
  .excerpt-page > p { font-size: 16px; }
  .reader { grid-template-columns: 1fr; gap: 24px; padding: 6vh 8vw; }
  .reader h2, .buy-section h2 { font-size: clamp(36px,10vw,54px); }
  .body-copy { padding-top: 0; }
  .body-copy p { font-size: 15px; line-height: 1.48; }
  .buy-section { padding: 5vh 8vw; }
}

@media (prefers-reduced-motion: reduce) {
  .book-page.turn-forward, .book-page.turn-backward { animation-duration: 1ms; }
}
