/* ==========================================================
   ECHOA — black & white
   1. base
   2. video background
   3. progress bar
   4. landing (index.html)
   5. site header (subpages)
   6. page intro
   7. chapters & quotes
   8. chapter side navigation
   9. books grid
   10. reader overlay
   11. footer
   12. scrollbar & mobile
   ========================================================== */

@import url('https://fonts.googleapis.com/css2?family=Cormorant+Garamond:ital,wght@0,300;0,400;0,600;1,400&family=Cinzel:wght@400;500;600&family=Inter:wght@200;300;400&display=swap');

/* ---------- 1. base ---------- */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: #000;
  color: #fff;
  overflow-x: hidden;
}

/* landing page: no scrolling at all */
body.landing {
  height: 100vh;
  overflow: hidden;
}

a {
  color: inherit;
  text-decoration: none;
}

/* ---------- 2. video background ---------- */

.bg-video {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  object-fit: cover;
  filter: grayscale(100%) contrast(1.1) brightness(0.55);
  z-index: -2;
}

.bg-overlay {
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse at center, transparent 30%, rgba(0, 0, 0, 0.75) 100%),
    linear-gradient(to bottom, rgba(0, 0, 0, 0.35), rgba(0, 0, 0, 0.55));
  z-index: -1;
}

/* ---------- 3. progress bar ---------- */

/* full width, scaled on the compositor — no layout/paint on scroll */
.progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: #fff;
  z-index: 100;
  transform: scaleX(0);
  transform-origin: 0 50%;
  will-change: transform;
}

/* ---------- 4. landing ---------- */

.landing-nav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.6rem;
  padding: 2.2rem 1rem;
  z-index: 50;
  animation: fadeIn 2.5s 1.8s both;
}

.landing-nav a {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.45em;
  margin-left: 0.45em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
  padding: 0.4rem 0.2rem;
  position: relative;
  transition: color 0.4s ease;
}

/* underline: letter-spacing leaves a trailing gap on the RIGHT,
   so the line spans from the left edge to just before that gap */
.landing-nav a::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0.45em;
  bottom: 0;
  height: 1px;
  background: rgba(255, 255, 255, 0.7);
  transform: scaleX(0);
  transform-origin: center;
  transition: transform 0.4s ease;
}

.landing-nav a:hover {
  color: #fff;
}

.landing-nav a:hover::after {
  transform: scaleX(1);
}

.nav-sep {
  font-size: 0.55rem;
  color: rgba(255, 255, 255, 0.3);
}

/* hero */

.hero {
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: relative;
  text-align: center;
}

.hero-corners {
  position: absolute;
  inset: 2.5rem;
  pointer-events: none;
  animation: fadeIn 3s 1.6s both;
}

.corner {
  position: absolute;
  width: 42px;
  height: 42px;
  border: 1px solid rgba(255, 255, 255, 0.28);
}

.corner.tl { top: 0;    left: 0;   border-right: none;  border-bottom: none; }
.corner.tr { top: 0;    right: 0;  border-left: none;   border-bottom: none; }
.corner.bl { bottom: 0; left: 0;   border-right: none;  border-top: none; }
.corner.br { bottom: 0; right: 0;  border-left: none;   border-top: none; }

.hero-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(3.2rem, 12vw, 9.5rem);
  font-weight: 500;
  letter-spacing: 0.28em;
  margin-left: 0.28em;
  color: #fff;
  text-shadow: 0 0 60px rgba(255, 255, 255, 0.3);
  display: flex;
  justify-content: center;
}

.hero-title span {
  display: inline-block;
  animation: letterIn 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-title span:nth-child(1) { animation-delay: 0.35s; }
.hero-title span:nth-child(2) { animation-delay: 0.5s; }
.hero-title span:nth-child(3) { animation-delay: 0.65s; }
.hero-title span:nth-child(4) { animation-delay: 0.8s; }
.hero-title span:nth-child(5) { animation-delay: 0.95s; }

@keyframes letterIn {
  from {
    opacity: 0;
    transform: translateY(70px) rotate(3deg);
  }
  to {
    opacity: 1;
    transform: translateY(0) rotate(0);
  }
}

.hero-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin: 2.5rem auto 2rem;
  animation: fadeIn 2.5s 1.4s both;
}

.div-line {
  width: clamp(60px, 12vw, 140px);
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5), transparent);
}

.div-mark {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.55);
  animation: pulse 4s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(1); }
  50%      { opacity: 1;   transform: scale(1.25); }
}

.hero-sub {
  font-size: clamp(0.7rem, 1.4vw, 1rem);
  font-weight: 200;
  letter-spacing: 0.6em;
  margin-left: 0.6em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
  animation: heroIn 2.2s 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.hero-tag {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.25rem);
  font-weight: 400;
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.38);
  margin-top: 1.6rem;
  animation: heroIn 2.2s 1.5s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes heroIn {
  from {
    opacity: 0;
    transform: translateY(40px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

/* ---------- 5. site header (subpages) ---------- */

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  padding: 1.1rem 2.5rem;
  z-index: 90;
  background: linear-gradient(to bottom, rgba(0, 0, 0, 0.8), transparent);
}

.header-brand {
  font-family: 'Cinzel', serif;
  font-size: 0.95rem;
  font-weight: 500;
  letter-spacing: 0.5em;
  color: rgba(255, 255, 255, 0.85);
  justify-self: start;
  transition: color 0.4s ease;
}

.header-brand:hover {
  color: #fff;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 1.6rem;
  justify-self: center;
}

/* same size as the landing page navigation */
.header-nav a {
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  font-weight: 500;
  letter-spacing: 0.45em;
  margin-left: 0.45em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.3rem 0.1rem;
  position: relative;
  transition: color 0.4s ease;
}

.header-nav a:hover {
  color: rgba(255, 255, 255, 0.9);
}

.header-nav a.active {
  color: #fff;
}

.header-nav a.active::after {
  content: '';
  position: absolute;
  left: 0;
  right: 0.45em;
  bottom: -2px;
  height: 1px;
  background: rgba(255, 255, 255, 0.6);
}

.header-chapter {
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  justify-self: end;
}

/* ---------- 6. page intro ---------- */

.page-intro {
  min-height: 55vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 9rem 2rem 3rem;
}

.page-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.4rem, 7vw, 5rem);
  font-weight: 500;
  letter-spacing: 0.35em;
  margin-left: 0.35em;
  color: #fff;
  text-shadow: 0 0 50px rgba(255, 255, 255, 0.25);
  animation: heroIn 1.6s cubic-bezier(0.22, 1, 0.36, 1) both;
}

.page-intro .hero-divider {
  margin: 1.8rem auto 1.4rem;
  animation-delay: 0.5s;
}

.page-sub {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
  animation: heroIn 1.8s 0.4s cubic-bezier(0.22, 1, 0.36, 1) both;
}

/* ---------- 6b. chapter menu ---------- */

.chapter-menu {
  max-width: 760px;
  margin: 0 auto;
  padding: 1rem 2rem 12rem;
  display: flex;
  flex-direction: column;
}

.menu-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 2rem;
  padding: 2.2rem 1.5rem;
  border-top: 1px solid rgba(255, 255, 255, 0.12);
  cursor: pointer;
  position: relative;
  opacity: 0;
  transform: translateY(40px);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    background 0.4s ease;
}

.menu-row:last-child {
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.menu-row.visible {
  opacity: 1;
  transform: translateY(0);
}

.menu-row:hover {
  background: rgba(255, 255, 255, 0.04);
}

.menu-numeral {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.22);
  min-width: 2.2em;
  text-align: center;
  transition: color 0.4s ease;
}

.menu-row:hover .menu-numeral {
  color: rgba(255, 255, 255, 0.7);
}

.menu-text {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  text-align: left;
}

.menu-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.1rem, 2.6vw, 1.55rem);
  font-weight: 500;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.88);
  transition: color 0.4s ease;
}

.menu-row:hover .menu-title {
  color: #fff;
}

.menu-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.85rem, 1.6vw, 1.05rem);
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.38);
}

.menu-count {
  font-size: 0.62rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
  white-space: nowrap;
}

.menu-arrow {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.3rem;
  color: rgba(255, 255, 255, 0.25);
  transform: translateX(-8px);
  opacity: 0;
  transition: transform 0.4s ease, opacity 0.4s ease, color 0.4s ease;
}

.menu-row:hover .menu-arrow {
  transform: translateX(0);
  opacity: 1;
  color: rgba(255, 255, 255, 0.8);
}

/* ---------- 6c. chapter footer navigation ---------- */

.chapter-footer-nav {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 2rem 6rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2.5rem;
}

.fnav-back {
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.4em;
  margin-left: 0.4em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  padding: 0.9rem 2rem;
  border: 1px solid rgba(255, 255, 255, 0.2);
  transition: color 0.4s ease, border-color 0.4s ease, background 0.4s ease;
}

.fnav-back:hover {
  color: #fff;
  border-color: rgba(255, 255, 255, 0.6);
  background: rgba(255, 255, 255, 0.05);
}

.fnav-links {
  display: flex;
  align-items: center;
  gap: 3rem;
  flex-wrap: wrap;
  justify-content: center;
}

.fnav-link {
  font-family: 'Cinzel', serif;
  font-size: 0.78rem;
  font-weight: 500;
  letter-spacing: 0.25em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
  transition: color 0.4s ease;
}

.fnav-link:hover {
  color: #fff;
}

/* ---------- 7. chapters & quotes ---------- */

.quotes {
  max-width: 820px;
  margin: 0 auto;
  padding: 2rem 2rem 8rem;
  display: flex;
  flex-direction: column;
  gap: 30vh;
}

.chapter-header {
  padding: 22vh 0 4vh;
}

.chapter-numeral {
  display: block;
  font-family: 'Cinzel', serif;
  font-size: clamp(3rem, 7vw, 5rem);
  font-weight: 400;
  color: rgba(255, 255, 255, 0.14);
  line-height: 1;
  margin-bottom: 0.6rem;
}

.chapter-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.8rem, 4.5vw, 3rem);
  font-weight: 500;
  letter-spacing: 0.45em;
  margin-left: 0.45em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.9);
}

.chapter-divider {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.2rem;
  margin: 1.8rem auto 1.4rem;
}

.chapter-subtitle {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: clamp(0.95rem, 1.8vw, 1.2rem);
  letter-spacing: 0.12em;
  color: rgba(255, 255, 255, 0.4);
}

/* quote blocks — GPU-friendly reveal: opacity + transform only */

.quote {
  opacity: 0;
  transform: translateY(50px);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
  text-align: center;
  /* offscreen quotes are skipped by layout & paint entirely */
  content-visibility: auto;
  contain-intrinsic-size: auto 340px;
}

.quote.visible {
  opacity: 1;
  transform: translateY(0);
}

.quote-mark {
  display: block;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.3);
  margin-bottom: 2.2rem;
}

.quote-text {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(1.5rem, 3.2vw, 2.4rem);
  font-weight: 400;
  font-style: italic;
  line-height: 1.5;
  color: rgba(255, 255, 255, 0.92);
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.8);
}

.quote-text::before { content: '\201C'; opacity: 0.4; }
.quote-text::after  { content: '\201D'; opacity: 0.4; }

.quote-author {
  display: block;
  margin-top: 2.2rem;
  font-size: 0.75rem;
  font-weight: 300;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.5);
}

.quote-author::before {
  content: '';
  display: block;
  width: 40px;
  height: 1px;
  background: rgba(255, 255, 255, 0.3);
  margin: 0 auto 1.4rem;
}

/* ---------- 8. chapter side navigation ---------- */

.chapter-nav {
  position: fixed;
  right: 2rem;
  top: 50%;
  transform: translateY(-50%);
  display: flex;
  flex-direction: column;
  gap: 1.4rem;
  z-index: 90;
}

.chapter-nav[hidden] {
  display: none;
}

.chapter-nav-item {
  background: none;
  border: none;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 0.85rem;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.3);
  padding: 0.2rem 0.4rem;
  transition: color 0.4s ease, transform 0.4s ease;
}

.chapter-nav-item:hover {
  color: rgba(255, 255, 255, 0.8);
}

.chapter-nav-item.active {
  color: #fff;
  transform: scale(1.35);
  text-shadow: 0 0 12px rgba(255, 255, 255, 0.5);
}

/* ---------- 9. books grid ---------- */

.books-grid {
  max-width: 1100px;
  margin: 0 auto;
  padding: 2rem 2rem 10rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
  gap: 3.5rem 2.5rem;
}

.book-card {
  cursor: pointer;
  text-align: center;
  opacity: 0;
  transform: translateY(50px);
  transition:
    opacity 0.9s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.9s cubic-bezier(0.22, 1, 0.36, 1);
}

.book-card.visible {
  opacity: 1;
  transform: translateY(0);
}

.book-card {
  content-visibility: auto;
  contain-intrinsic-size: auto 420px;
}

.book-cover {
  position: relative;
  aspect-ratio: 2 / 3;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.15);
  background: linear-gradient(160deg, #111 0%, #1c1c1c 50%, #0a0a0a 100%);
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.6);
  transition: transform 0.45s ease, border-color 0.45s ease, box-shadow 0.45s ease;
}

/* calm, single-element hover: gentle lift-free scale + soft glow */
.book-card:hover .book-cover {
  transform: scale(1.03);
  border-color: rgba(255, 255, 255, 0.55);
  box-shadow:
    0 18px 44px rgba(0, 0, 0, 0.8),
    0 0 28px rgba(255, 255, 255, 0.07);
}

.book-cover img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  filter: grayscale(100%) contrast(1.05);
}

.book-card:hover .book-title {
  color: #fff;
}

/* fallback cover shown when no image is available */
.cover-fallback {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  gap: 1rem;
}

/* thin inner frame — classic book cover look */
.cover-fallback::before {
  content: '';
  position: absolute;
  inset: 10px;
  border: 1px solid rgba(255, 255, 255, 0.18);
  pointer-events: none;
}

.book-cover.no-image .cover-fallback { display: flex; }
.book-cover.no-image img { display: none; }

.cover-fallback .fb-title {
  font-family: 'Cinzel', serif;
  font-size: 1.05rem;
  font-weight: 500;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.8);
  line-height: 1.6;
}

.cover-fallback .fb-mark {
  font-size: 0.7rem;
  color: rgba(255, 255, 255, 0.3);
}

.book-title {
  font-family: 'Cormorant Garamond', serif;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: rgba(255, 255, 255, 0.82);
  margin-top: 1.4rem;
  transition: color 0.4s ease;
}

.book-author {
  font-size: 0.68rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.45);
  margin-top: 0.5rem;
}

.book-year {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.3);
  margin-top: 0.35rem;
}

/* ---------- 10. reader overlay ---------- */

.reader {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
}

.reader[hidden] {
  display: none;
}

/* solid dark backdrop — no backdrop-filter (expensive) */
.reader-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.93);
}

/* the panel is an invisible container — the paper page is the visual */
.reader-panel {
  position: relative;
  width: min(720px, 94vw);
  height: min(84vh, 880px);
  animation: readerIn 0.45s cubic-bezier(0.22, 1, 0.36, 1) both;
}

@keyframes readerIn {
  from { opacity: 0; transform: translateY(30px); }
  to   { opacity: 1; transform: translateY(0); }
}

.reader-close {
  position: absolute;
  top: -0.6rem;
  right: 0;
  transform: translateY(-100%);
  z-index: 2;
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.65);
  width: 40px;
  height: 40px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.reader-close:hover {
  color: #fff;
  border-color: #fff;
}

/* --- book layout: a light paper page on the dark stage --- */

.book-panel {
  display: flex;
  flex-direction: column;
}

.book-page-area {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  gap: clamp(0.5rem, 2vw, 1.2rem);
}

.book-page-frame {
  flex: 1;
  min-width: 0;
  height: 100%;
  display: flex;
  position: relative;
  perspective: 1600px;
}

/* the paper — dark edition; pages never scroll, only turn */
.book-page {
  flex: 1;
  overflow: hidden;
  background: linear-gradient(105deg, #181818 0%, #101010 60%, #0a0a0a 100%);
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 3px;
  box-shadow:
    inset 14px 0 22px -16px rgba(0, 0, 0, 0.9),
    inset -1px 0 0 rgba(255, 255, 255, 0.04);
  padding: clamp(2rem, 5vw, 3.4rem) clamp(1.6rem, 6vw, 4rem);
  display: flex;
  flex-direction: column;
  color: #e8e8e8;
}

/* --- real page turn: a leaf folding over the spine --- */

.flip-leaf {
  position: absolute;
  inset: 0;
  z-index: 2;
  transform-origin: left center;
  backface-visibility: hidden;
  will-change: transform;
  pointer-events: none;
}

/* curl shading on the leaf while it turns */
.flip-leaf::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(to right, rgba(0, 0, 0, 0.05) 0%, transparent 30%, rgba(0, 0, 0, 0.55) 100%);
}

.flip-leaf.flip-fwd {
  animation: leafFwd 0.55s cubic-bezier(0.45, 0.05, 0.55, 0.95) both;
}
.flip-leaf.flip-fwd::after {
  animation: shadeIn 0.55s cubic-bezier(0.45, 0.05, 0.55, 0.95) both;
}

.flip-leaf.flip-back {
  animation: leafBack 0.55s cubic-bezier(0.45, 0.05, 0.55, 0.95) both;
}
.flip-leaf.flip-back::after {
  animation: shadeOut 0.55s cubic-bezier(0.45, 0.05, 0.55, 0.95) both;
}

@keyframes leafFwd {
  from { transform: rotateY(0deg); }
  to   { transform: rotateY(-104deg); }
}

@keyframes leafBack {
  from { transform: rotateY(-104deg); }
  to   { transform: rotateY(0deg); }
}

@keyframes shadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

@keyframes shadeOut {
  from { opacity: 1; }
  to   { opacity: 0; }
}

/* the page underneath gets a soft moving shadow near the spine */
.book-page-frame:has(.flip-fwd) .book-page:not(.flip-leaf) {
  animation: underShadow 0.55s ease-out both;
}

@keyframes underShadow {
  from { filter: brightness(0.72); }
  to   { filter: brightness(1); }
}


/* title page */

.title-page {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  gap: 1.1rem;
}

.tp-mark {
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.35);
}

.tp-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(1.4rem, 3.6vw, 2.3rem);
  font-weight: 500;
  letter-spacing: 0.14em;
  color: #fff;
  line-height: 1.4;
}

.tp-divider {
  width: 90px;
  height: 1px;
  background: linear-gradient(to right, transparent, rgba(255, 255, 255, 0.5), transparent);
}

.tp-author {
  font-size: 0.7rem;
  font-weight: 300;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.55);
}

.tp-year {
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.95rem;
  color: rgba(255, 255, 255, 0.38);
}

.tp-hint {
  margin-top: 2rem;
  font-size: 0.62rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.3);
}

/* content pages */

.page-body {
  flex: 1;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-body p {
  font-family: 'Cormorant Garamond', serif;
  font-size: clamp(0.95rem, 1.8vw, 1.18rem);
  font-weight: 400;
  line-height: 1.75;
  color: rgba(255, 255, 255, 0.88);
  white-space: pre-line;
}

.page-footer {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 0.58rem;
  letter-spacing: 0.35em;
  text-transform: uppercase;
  text-align: center;
  color: rgba(255, 255, 255, 0.3);
}

/* arrows + pagination */

.page-arrow {
  background: none;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 50%;
  color: rgba(255, 255, 255, 0.6);
  width: 48px;
  height: 48px;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.3s ease, border-color 0.3s ease;
}

.page-arrow:hover:not(:disabled) {
  color: #fff;
  border-color: #fff;
}

.page-arrow:disabled {
  opacity: 0.15;
  cursor: default;
}

.book-pagination {
  text-align: center;
  padding-top: 1.2rem;
  font-family: 'Cormorant Garamond', serif;
  font-style: italic;
  font-size: 0.9rem;
  letter-spacing: 0.25em;
  color: rgba(255, 255, 255, 0.45);
}

.fb-author {
  font-size: 0.58rem;
  font-weight: 300;
  letter-spacing: 0.3em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.4);
}

/* ---------- 11. footer ---------- */

.footer {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4rem 2rem;
}

.footer-title {
  font-family: 'Cinzel', serif;
  font-size: clamp(2.2rem, 7vw, 5rem);
  font-weight: 500;
  letter-spacing: 0.35em;
  margin-left: 0.35em;
  color: rgba(255, 255, 255, 0.85);
}

.footer-sub {
  margin-top: 1.5rem;
  font-size: 0.7rem;
  font-weight: 200;
  letter-spacing: 0.4em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.35);
}

/* ---------- 12. scrollbar & mobile ---------- */

::-webkit-scrollbar { width: 6px; }
::-webkit-scrollbar-track { background: #000; }
::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.25); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.45); }

@media (max-width: 600px) {
  .quotes { padding: 1.5rem 1.5rem 6rem; gap: 26vh; }
  .chapter-nav { right: 0.8rem; gap: 1rem; }

  .menu-row {
    grid-template-columns: auto 1fr;
    gap: 1.2rem;
    padding: 1.8rem 0.8rem;
  }
  .menu-count, .menu-arrow { display: none; }

  .site-header {
    grid-template-columns: 1fr;
    justify-items: center;
    gap: 0.6rem;
    padding: 1rem 1.2rem;
  }
  .header-brand { justify-self: center; }
  .header-chapter { display: none; }

  .books-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2.5rem 1.5rem;
  }

  .page-arrow { width: 34px; height: 34px; font-size: 1.1rem; }
}

/* short windows: shrink book text so pages always fit without scrolling */
@media (max-height: 760px) {
  .book-page { padding: 1.4rem clamp(1.2rem, 5vw, 3rem); }
  .page-body p { font-size: 0.92rem; line-height: 1.55; }
  .page-footer { margin-top: 1rem; padding-top: 0.6rem; }
}
