:root {
  --forest: #174f35;
  --forest-dark: #0c3022;
  --gold: #d7b64a;
  --paper: #f8f5ec;
  --ink: #17221c;
  --muted: #66736b;
  --line: rgba(23, 79, 53, 0.2);
  --shadow: 0 18px 55px rgba(11, 35, 25, 0.18);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background: #e8ece7;
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.skip-link {
  position: fixed;
  z-index: 100;
  top: 0.75rem;
  left: 0.75rem;
  transform: translateY(-200%);
  padding: 0.75rem 1rem;
  border-radius: 0.4rem;
  background: white;
  color: var(--forest-dark);
}
.skip-link:focus { transform: translateY(0); }

#moncenisio-book { min-height: 100vh; }
.book-hero {
  display: grid;
  grid-template-columns: minmax(260px, 480px) minmax(280px, 570px);
  align-items: center;
  justify-content: center;
  gap: clamp(2rem, 6vw, 6rem);
  min-height: 90vh;
  padding: clamp(2rem, 7vw, 7rem);
  overflow: hidden;
  background:
    radial-gradient(circle at 74% 18%, rgba(215, 182, 74, 0.2), transparent 24rem),
    linear-gradient(135deg, var(--forest-dark), var(--forest));
  color: white;
}
.front-cover {
  display: block;
  width: 100%;
  height: auto;
  border: 1px solid rgba(255,255,255,0.22);
  box-shadow: 0 26px 80px rgba(0,0,0,0.4);
}
.hero-copy { max-width: 34rem; }
.eyebrow {
  margin: 0 0 1rem;
  color: var(--gold);
  font-size: 0.85rem;
  font-weight: 800;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}
.hero-copy h1 {
  margin: 0;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(3rem, 7vw, 6.5rem);
  font-weight: 500;
  line-height: 0.94;
}
.hero-copy > p:not(.eyebrow) {
  margin: 1.5rem 0 2rem;
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.1rem, 2vw, 1.5rem);
  line-height: 1.55;
}
.start-reading {
  display: inline-flex;
  padding: 0.85rem 1.25rem;
  border: 1px solid var(--gold);
  border-radius: 999px;
  background: var(--gold);
  color: var(--forest-dark);
  font-weight: 800;
  text-decoration: none;
}
.start-reading:hover, .start-reading:focus-visible { background: white; }

.reader-toolbar {
  position: sticky;
  z-index: 20;
  top: 0;
  display: grid;
  grid-template-columns: minmax(12rem, 1fr) auto minmax(15rem, 1fr);
  align-items: end;
  gap: 1rem;
  padding: 0.75rem clamp(1rem, 4vw, 3rem) 1rem;
  border-bottom: 1px solid var(--line);
  background: rgba(248, 245, 236, 0.96);
  box-shadow: 0 8px 28px rgba(11, 35, 25, 0.1);
  backdrop-filter: blur(12px);
}
.reader-toolbar label, .chapter-picker span {
  display: block;
  margin-bottom: 0.25rem;
  color: var(--forest-dark);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.reader-toolbar select, .reader-toolbar input {
  width: 100%;
  min-height: 2.55rem;
  border: 1px solid var(--line);
  border-radius: 0.45rem;
  background: white;
  color: var(--ink);
  font: inherit;
}
.reader-toolbar select { padding: 0 2.2rem 0 0.7rem; }
.reader-toolbar input { padding: 0 0.7rem; }
.page-controls { display: flex; align-items: center; gap: 0.6rem; padding-bottom: 0.05rem; }
.page-controls button, .book-search button {
  min-height: 2.55rem;
  border: 0;
  border-radius: 0.45rem;
  background: var(--forest);
  color: white;
  cursor: pointer;
  font: inherit;
  font-weight: 800;
}
.page-controls button { width: 2.55rem; font-size: 1.1rem; }
.page-controls button:hover, .page-controls button:focus-visible, .book-search button:hover, .book-search button:focus-visible { background: var(--forest-dark); }
#page-status { min-width: 7.5rem; color: var(--forest-dark); font-size: 0.85rem; font-weight: 750; text-align: center; }
.book-search { display: grid; grid-template-columns: 1fr auto; gap: 0 0.4rem; }
.book-search label { grid-column: 1 / -1; }
.book-search button { padding: 0 0.9rem; }
#search-status { grid-column: 1 / -1; min-height: 0; margin-top: 0.2rem; color: var(--muted); font-size: 0.75rem; }
.reading-progress { position: absolute; right: 0; bottom: 0; left: 0; height: 3px; background: rgba(23,79,53,0.1); }
.reading-progress span { display: block; width: 0; height: 100%; background: var(--gold); transition: width 180ms ease; }

.book-pages { width: min(100%, 1100px); margin: 0 auto; padding: clamp(2rem, 6vw, 5rem) clamp(1rem, 5vw, 3rem); }
.book-page { scroll-margin-top: 8rem; margin: 0 0 clamp(4rem, 9vw, 8rem); }
.chapter-title {
  max-width: 800px;
  margin: 0 auto 1.25rem;
  color: var(--forest);
  font-family: Georgia, "Times New Roman", serif;
  font-size: clamp(1.7rem, 4vw, 3rem);
  font-weight: 500;
  text-align: center;
}
.book-page figure { width: min(100%, 820px); margin: 0 auto; }
.page-zoom { display: block; background: white; box-shadow: var(--shadow); }
.page-zoom img { display: block; width: 100%; height: auto; }
.book-page figcaption { padding: 0.75rem 0; color: var(--muted); font-size: 0.78rem; text-align: center; }
.book-page.search-match .page-zoom { outline: 5px solid var(--gold); outline-offset: 6px; }
.book-footer { padding: 3rem 1rem 5rem; background: var(--forest-dark); color: white; text-align: center; }
.book-footer a { color: var(--gold); }

@media (max-width: 850px) {
  .book-hero { grid-template-columns: 1fr; min-height: auto; }
  .front-cover { width: min(100%, 440px); margin: 0 auto; }
  .hero-copy { text-align: center; }
  .reader-toolbar { grid-template-columns: 1fr auto; align-items: end; }
  .book-search { grid-column: 1 / -1; }
}

@media (max-width: 560px) {
  .book-hero { padding: 1.25rem 1rem 3rem; }
  .hero-copy h1 { font-size: 3rem; }
  .reader-toolbar { position: relative; grid-template-columns: 1fr; }
  .page-controls { justify-content: center; }
  .book-page { scroll-margin-top: 1rem; }
  .book-pages { padding-right: 0.6rem; padding-left: 0.6rem; }
}

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

@media print {
  .book-hero, .reader-toolbar, .book-footer { display: none !important; }
  body { background: white; }
  .book-pages { width: 100%; padding: 0; }
  .book-page { break-after: page; margin: 0; }
  .page-zoom { box-shadow: none; }
  .book-page figcaption, .chapter-title { display: none; }
}
