:root {
  --verde-profundo: #122014;
  --verde-musgo: #26391e;
  --verde-selo: #4f6333;
  --dourado: #c7a15e;
  --dourado-claro: #e1c487;
  --pergaminho: #d8bd86;
  --marrom: #2a1710;
  --marrom-claro: #4a2a18;
  --sombra: rgba(0, 0, 0, .52);
  --page-ratio: 1086 / 1448;
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  margin: 0;
  color: #f5ead1;
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
  background:
    radial-gradient(circle at top left, rgba(122, 95, 45, .36), transparent 32rem),
    radial-gradient(circle at bottom right, rgba(38, 57, 30, .52), transparent 30rem),
    linear-gradient(135deg, #0b100c 0%, #182416 44%, #2a1710 100%);
  overflow-x: hidden;
}

body::before {
  content: "";
  position: fixed;
  inset: 0;
  pointer-events: none;
  opacity: .22;
  background-image:
    linear-gradient(rgba(255,255,255,.035) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255,255,255,.025) 1px, transparent 1px);
  background-size: 42px 42px;
  mask-image: radial-gradient(circle at center, black 0%, transparent 80%);
}

.ambient {
  position: fixed;
  border-radius: 999px;
  filter: blur(70px);
  opacity: .35;
  pointer-events: none;
}

.ambient-one {
  width: 19rem;
  height: 19rem;
  top: 5vh;
  left: -6rem;
  background: #c7a15e;
}

.ambient-two {
  width: 22rem;
  height: 22rem;
  right: -7rem;
  bottom: 8vh;
  background: #344a28;
}

.site-shell {
  width: min(1180px, calc(100% - 28px));
  margin: 0 auto;
  padding: 32px 0 46px;
  position: relative;
  z-index: 1;
}

.brand-header {
  text-align: center;
  margin: 0 auto 22px;
}

.seal-mini {
  display: block;
  width: 74px;
  height: 74px;
  margin: 0 auto 12px;
  object-fit: contain;
  filter: drop-shadow(0 10px 24px rgba(0,0,0,.34));
}

.eyebrow {
  margin: 0 0 6px;
  font-size: .86rem;
  letter-spacing: .24em;
  text-transform: uppercase;
  color: var(--dourado-claro);
}

h1 {
  margin: 0;
  font-family: "Cinzel", "Cormorant Garamond", serif;
  font-size: clamp(2rem, 6vw, 4.4rem);
  font-weight: 600;
  line-height: .95;
  letter-spacing: .04em;
  text-shadow: 0 10px 26px rgba(0,0,0,.28);
}

.subtitle {
  max-width: 760px;
  margin: 14px auto 0;
  color: rgba(245, 234, 209, .86);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.35rem, 2.7vw, 1.8rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.45;
  letter-spacing: .01em;
  text-wrap: balance;
}


.chapter-nav {
  width: min(840px, 100%);
  margin: 18px auto 4px;
  padding: 0 6px;
}

.chapter-nav-inner {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 12px;
  border-radius: 999px;
  border-top: 1px solid rgba(225, 196, 135, .16);
  border-bottom: 1px solid rgba(225, 196, 135, .12);
  background: rgba(8, 18, 10, .22);
  backdrop-filter: blur(4px);
}

.chapter-nav-inner::before,
.chapter-nav-inner::after {
  display: none;
}

.chapter-kicker {
  margin: 0;
  color: rgba(225, 196, 135, .58);
  font-family: "Cinzel", serif;
  font-size: .68rem;
  font-weight: 500;
  letter-spacing: .24em;
  text-align: center;
  text-transform: uppercase;
}

.chapter-nav-title,
.chapter-nav-subtitle {
  display: none;
}

.chapter-list {
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 6px 8px;
}

.chapter-item {
  position: relative;
  display: inline-flex;
  align-items: center;
  min-height: auto;
  padding: 0;
  border: 0;
  border-radius: 999px;
  background: transparent;
  box-shadow: none;
  transition: none;
}

.chapter-item::after {
  display: none;
}

.chapter-item:hover,
.chapter-item.active {
  transform: none;
  border-color: transparent;
  background: transparent;
}

.chapter-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: transparent;
  color: rgba(245, 234, 209, .70);
  font-family: "Cormorant Garamond", serif;
  font-size: clamp(.82rem, 1.9vw, .96rem);
  line-height: 1;
  letter-spacing: .02em;
  text-align: center;
  cursor: pointer;
  transition: color 160ms ease, background 160ms ease, border-color 160ms ease;
}

.chapter-button:hover,
.chapter-button.active {
  color: #f3dfad;
  border-color: rgba(225, 196, 135, .14);
  background: rgba(225, 196, 135, .07);
}

.chapter-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: auto;
  height: auto;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: rgba(225, 196, 135, .66);
  font-family: "Cinzel", serif;
  font-size: .66rem;
  font-weight: 500;
  letter-spacing: .08em;
  box-shadow: none;
}

.chapter-button.active .chapter-number,
.chapter-item.active .chapter-number {
  box-shadow: none;
  background: transparent;
  color: rgba(225, 196, 135, .88);
}

.chapter-children,
.chapter-child {
  display: none;
}

.book-section {
  display: grid;
  grid-template-columns: 72px minmax(260px, 520px) 72px;
  align-items: center;
  justify-content: center;
  gap: 18px;
  margin-top: 26px;
}

.book-wrap {
  width: min(88vw, 520px);
  position: relative;
  perspective: 1300px;
}

.book-glow {
  position: absolute;
  inset: 8% 6% -4%;
  border-radius: 28px;
  background: radial-gradient(circle, rgba(227, 194, 134, .28), transparent 63%);
  filter: blur(24px);
  transform: translateY(20px);
}

.book {
  position: relative;
  width: 100%;
  aspect-ratio: var(--page-ratio);
  transform-style: preserve-3d;
  border-radius: 18px 24px 24px 18px;
  box-shadow:
    0 34px 70px var(--sombra),
    0 10px 24px rgba(0,0,0,.34),
    inset 0 0 0 1px rgba(255,255,255,.06);
  cursor: pointer;
  background: #1c150e;
  isolation: isolate;
}

.book::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 8;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(236,206,143,.18), inset 0 0 45px rgba(0,0,0,.22);
}

.book-spine {
  position: absolute;
  z-index: 9;
  inset: 0 auto 0 0;
  width: 5.7%;
  border-radius: 16px 0 0 16px;
  pointer-events: none;
  background:
    linear-gradient(90deg, rgba(0,0,0,.64), rgba(0,0,0,.08) 76%, transparent),
    linear-gradient(#5c361e, #1c100a 42%, #5a351f);
  opacity: .34;
  mix-blend-mode: multiply;
}

.page {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
  background: #cdb17a;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.page img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;
}

.page-current {
  z-index: 2;
}

.page-behind {
  z-index: 1;
}

.page-turning {
  z-index: 6;
  opacity: 0;
  transform-style: preserve-3d;
  box-shadow: 0 18px 40px rgba(0,0,0,.28);
}

.page-turning.active {
  opacity: 1;
  transition: transform 840ms cubic-bezier(.2, .72, .16, 1), filter 840ms ease, opacity 180ms ease;
}

.page-turning.next {
  transform-origin: left center;
  transform: rotateY(0deg);
}

.page-turning.next.animate {
  transform: rotateY(-180deg);
  filter: brightness(.84) saturate(.92);
}

.page-turning.prev {
  transform-origin: right center;
  transform: rotateY(0deg);
}

.page-turning.prev.animate {
  transform: rotateY(180deg);
  filter: brightness(.82) saturate(.9);
}

.side-button,
.control-button,
.thumb-toggle,
.whatsapp-button {
  font-family: "Cormorant Garamond", Georgia, "Times New Roman", serif;
}

.side-button {
  width: 58px;
  height: 58px;
  border: 1px solid rgba(225, 196, 135, .34);
  border-radius: 50%;
  color: var(--dourado-claro);
  background: rgba(19, 24, 13, .7);
  box-shadow: 0 12px 28px rgba(0,0,0,.28);
  cursor: pointer;
  backdrop-filter: blur(6px);
  transition: transform 180ms ease, background 180ms ease, opacity 180ms ease;
}

.side-button span {
  display: block;
  transform: translateY(-2px);
  font-size: 3.1rem;
  line-height: 1;
}

.side-button:hover:not(:disabled) {
  transform: translateY(-2px) scale(1.03);
  background: rgba(45, 32, 18, .82);
}

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

.reader-controls {
  display: grid;
  grid-template-columns: 140px minmax(180px, 1fr) 140px;
  gap: 14px;
  align-items: center;
  width: min(620px, 100%);
  margin: 22px auto 0;
}

.control-button,
.thumb-toggle,
.whatsapp-button {
  border: 1px solid rgba(225, 196, 135, .38);
  border-radius: 999px;
  color: #f8e8be;
  background: rgba(14, 20, 13, .62);
  padding: 12px 18px;
  cursor: pointer;
  font-size: .98rem;
  letter-spacing: .02em;
  text-decoration: none;
  box-shadow: 0 12px 30px rgba(0,0,0,.22);
  transition: transform 180ms ease, background 180ms ease;
}

.control-button:hover:not(:disabled),
.thumb-toggle:hover,
.whatsapp-button:hover {
  transform: translateY(-1px);
  background: rgba(52, 37, 20, .76);
}

.control-button.primary,
.whatsapp-button {
  color: #1a2213;
  background: linear-gradient(135deg, #e7ca8b, #b88c4b);
  border-color: rgba(255,255,255,.12);
  font-weight: 700;
}

.page-status {
  text-align: center;
  color: rgba(245, 234, 209, .84);
  line-height: 1.35;
}

.page-status strong,
.page-status span {
  display: block;
}

.page-status strong {
  color: #f5ead1;
  font-weight: 500;
  font-size: 1.08rem;
}

.page-status span {
  margin-top: 2px;
  font-size: .9rem;
  color: rgba(245,234,209,.62);
}

.thumb-panel {
  width: min(920px, 100%);
  margin: 24px auto 0;
  text-align: center;
}

.thumb-toggle {
  padding-inline: 22px;
}

.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.thumb-card {
  border: 1px solid rgba(225, 196, 135, .24);
  border-radius: 14px;
  overflow: hidden;
  padding: 0;
  background: rgba(7, 11, 7, .5);
  cursor: pointer;
  box-shadow: 0 14px 26px rgba(0,0,0,.24);
}

.thumb-card img {
  display: block;
  width: 100%;
  aspect-ratio: var(--page-ratio);
  object-fit: cover;
}

.thumb-card span {
  display: block;
  padding: 8px 6px 10px;
  color: rgba(245,234,209,.78);
  font-size: .78rem;
}

.footer-cta {
  width: min(720px, 100%);
  margin: 34px auto 0;
  padding: 24px 24px 26px;
  text-align: center;
  border: 1px solid rgba(225,196,135,.22);
  border-radius: 22px;
  background: rgba(9, 14, 9, .38);
  box-shadow: inset 0 0 28px rgba(255,255,255,.025);
}

.footer-cta p {
  margin: 0 0 16px;
  color: rgba(245,234,209,.9);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: clamp(1.4rem, 2.8vw, 1.9rem);
  font-weight: 500;
  font-style: italic;
  line-height: 1.35;
  letter-spacing: .01em;
}

.whatsapp-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 48px;
  padding-inline: 24px;
  font-family: "Cinzel", "Cormorant Garamond", serif;
  font-size: 1rem;
  letter-spacing: .04em;
  text-transform: none;
}

.site-credit {
  width: min(720px, 100%);
  margin: 14px auto 0;
  text-align: center;
}

.site-credit p {
  margin: 0;
  color: rgba(245, 234, 209, .48);
  font-family: "Cormorant Garamond", Georgia, serif;
  font-size: .9rem;
  letter-spacing: .02em;
}

.site-credit a {
  color: rgba(225, 196, 135, .72);
  text-decoration: none;
  border-bottom: 1px solid rgba(225, 196, 135, .22);
  transition: color 160ms ease, border-color 160ms ease;
}

.site-credit a:hover {
  color: #e1c487;
  border-bottom-color: rgba(225, 196, 135, .52);
}

@media (max-width: 760px) {
  .site-shell {
    width: min(100% - 18px, 560px);
    padding-top: 24px;
  }

  .brand-header {
    margin-bottom: 14px;
  }

  .subtitle {
    padding-inline: 8px;
  }


  .chapter-nav {
    width: min(100%, 560px);
    margin: 12px auto 2px;
    padding-inline: 0;
  }

  .chapter-nav-inner {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 8px;
    overflow-x: auto;
    padding: 8px 10px;
    border-radius: 999px;
    scrollbar-width: none;
  }

  .chapter-nav-inner::-webkit-scrollbar {
    display: none;
  }

  .chapter-kicker {
    flex: 0 0 auto;
    font-size: .60rem;
    letter-spacing: .19em;
  }

  .chapter-list {
    justify-content: flex-start;
    flex-wrap: nowrap;
    gap: 5px;
  }

  .chapter-item {
    flex: 0 0 auto;
  }

  .chapter-button {
    white-space: nowrap;
    padding: 5px 7px;
    font-size: .82rem;
  }

  .chapter-number {
    font-size: .58rem;
  }

  .book-section {
    grid-template-columns: 1fr;
    gap: 0;
  }

  .side-button {
    display: none;
  }

  .book-wrap {
    width: min(94vw, 430px);
    margin: 0 auto;
  }

  .reader-controls {
    grid-template-columns: 1fr 1fr;
    gap: 10px;
  }

  .page-status {
    grid-column: 1 / -1;
    grid-row: 1;
  }

  #prevBtn {
    grid-column: 1;
    grid-row: 2;
  }

  #nextBtn {
    grid-column: 2;
    grid-row: 2;
  }

  .control-button {
    padding: 12px 13px;
  }

  .footer-cta {
    padding: 18px 14px;
  }

  .site-credit {
    margin-top: 12px;
    padding-bottom: 4px;
  }

  .site-credit p {
    font-size: .84rem;
  }
}

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