:root {
  --ink: #102a25;
  --forest: #173c34;
  --forest-dark: #071d19;
  --yellow: #f7bd42;
  --paper: #f8f3e9;
}

* { box-sizing: border-box; }
html { background: var(--forest-dark); }
body { min-height: 100vh; margin: 0; background: radial-gradient(circle at 50% 20%, #31544b 0%, var(--forest-dark) 58%); color: white; font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: inherit; text-decoration: none; }
button { font: inherit; }

.catalog-header { position: relative; z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem max(3vw, 1rem); border-bottom: 1px solid rgba(255,255,255,.12); background: rgba(7,29,25,.88); backdrop-filter: blur(14px); }
.catalog-brand { display: flex; align-items: center; gap: .75rem; }
.catalog-brand img { width: 52px; height: 52px; border-radius: 14px; object-fit: cover; background: white; }
.catalog-brand strong, .catalog-brand small { display: block; }
.catalog-brand strong { font-family: Georgia, serif; font-size: 1.05rem; }
.catalog-brand small { margin-top: .1rem; color: rgba(255,255,255,.68); font-size: .68rem; }
.header-actions { display: flex; align-items: center; gap: .75rem; }
.header-link, .download-link { min-height: 42px; padding: .65rem 1rem; border-radius: 999px; font-size: .84rem; font-weight: 800; }
.header-link { border: 1px solid rgba(255,255,255,.28); }
.download-link { background: var(--yellow); color: var(--ink); }

.catalog-main { width: min(1240px, 100%); margin: 0 auto; padding: clamp(1.4rem, 4vw, 3rem) 1rem 3rem; }
.catalog-heading { margin: 0 auto 1.5rem; text-align: center; }
.catalog-heading p { margin: 0 0 .35rem; color: var(--yellow); font-size: .75rem; font-weight: 850; letter-spacing: .16em; }
.catalog-heading h1 { margin: 0; font-family: Georgia, serif; font-size: clamp(2.1rem, 5vw, 4.4rem); font-weight: 500; letter-spacing: -.035em; }
.catalog-heading span { display: block; margin-top: .65rem; color: rgba(255,255,255,.72); font-size: .95rem; }

.viewer { width: 100%; }
.book-stage { display: grid; min-height: min(70vh, 760px); place-items: center; overflow: hidden; padding: 1.4rem 3.5rem 1rem; touch-action: pan-y; perspective: 2200px; }
.book { position: relative; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); width: min(100%, 940px); aspect-ratio: 1.414 / 1; filter: drop-shadow(0 28px 30px rgba(0,0,0,.42)); transform-style: preserve-3d; }
.book.is-cover { grid-template-columns: 1fr; width: min(52%, 470px); aspect-ratio: .707 / 1; }
.book-page { position: relative; overflow: hidden; margin: 0; background: white; backface-visibility: hidden; }
.book-page img { width: 100%; height: 100%; object-fit: contain; user-select: none; -webkit-user-drag: none; }
.page-left { border-radius: 10px 2px 2px 10px; box-shadow: inset -18px 0 22px -23px rgba(0,0,0,.85); }
.page-right { border-radius: 2px 10px 10px 2px; box-shadow: inset 18px 0 22px -23px rgba(0,0,0,.85); }
.book.is-cover .page-left { display: none; }
.book.is-cover .page-right { border-radius: 10px; box-shadow: inset 10px 0 18px -20px rgba(0,0,0,.85); }
.book-spine { position: absolute; z-index: 4; top: 1%; bottom: 1%; left: 50%; width: 1px; background: linear-gradient(transparent, rgba(0,0,0,.38), transparent); box-shadow: 0 0 14px 5px rgba(0,0,0,.18); pointer-events: none; }
.book.is-cover .book-spine { display: none; }
.turning-page { position: absolute; z-index: 6; top: 0; right: 0; display: none; width: 50%; height: 100%; overflow: hidden; border-radius: 2px 10px 10px 2px; background: white; box-shadow: -8px 6px 20px rgba(0,0,0,.25); transform-origin: left center; backface-visibility: hidden; }
.turning-page img { width: 100%; height: 100%; object-fit: contain; }
.turning-page.turn-forward { display: block; animation: turnForward .48s ease-in-out forwards; }
.turning-page.turn-back { right: auto; left: 0; display: block; transform-origin: right center; animation: turnBack .48s ease-in-out forwards; }
@keyframes turnForward { from { transform: rotateY(0); } to { transform: rotateY(-178deg); } }
@keyframes turnBack { from { transform: rotateY(0); } to { transform: rotateY(178deg); } }

.catalog-controls { display: flex; align-items: center; justify-content: center; gap: 1rem; margin-top: .5rem; }
.catalog-controls button, .secondary-button { min-height: 46px; padding: .7rem 1.15rem; border: 1px solid rgba(255,255,255,.32); border-radius: 999px; background: rgba(255,255,255,.08); color: white; cursor: pointer; font-weight: 800; }
.catalog-controls button:disabled { cursor: not-allowed; opacity: .35; }
.catalog-controls button:hover:not(:disabled), .catalog-controls button:focus-visible:not(:disabled), .secondary-button:hover, .secondary-button:focus-visible { background: white; color: var(--ink); }
.page-status { min-width: 125px; text-align: center; color: rgba(255,255,255,.78); font-size: .88rem; font-weight: 700; }
.viewer-actions { display: flex; align-items: center; justify-content: center; flex-wrap: wrap; gap: .8rem; margin-top: 1rem; }
.whatsapp-button { display: inline-flex; align-items: center; justify-content: center; min-height: 46px; padding: .7rem 1.2rem; border-radius: 999px; background: #25d366; color: #062f1a; font-weight: 850; }

.page-zoom { width: min(96vw, 1100px); height: min(94vh, 1100px); padding: 0; border: 0; border-radius: 18px; background: #101814; color: white; }
.page-zoom::backdrop { background: rgba(0,0,0,.82); backdrop-filter: blur(4px); }
.zoom-close { position: sticky; z-index: 3; top: .75rem; float: right; margin: .75rem .75rem 0 0; padding: .65rem 1rem; border: 0; border-radius: 999px; background: white; color: var(--ink); cursor: pointer; font-weight: 800; }
.zoom-scroll { width: 100%; height: 100%; overflow: auto; padding: 1rem; text-align: center; }
.zoom-scroll img { width: min(100%, 820px); height: auto; border-radius: 8px; box-shadow: 0 16px 40px rgba(0,0,0,.38); }

@media (max-width: 760px) {
  .catalog-header { align-items: flex-start; }
  .catalog-brand small { display: none; }
  .header-actions { gap: .4rem; }
  .header-link, .download-link { min-height: 40px; padding: .58rem .72rem; font-size: .72rem; }
  .catalog-main { padding-top: 1.2rem; }
  .catalog-heading { margin-bottom: .6rem; }
  .catalog-heading h1 { font-size: 2.35rem; }
  .catalog-heading span { font-size: .82rem; }
  .book-stage { min-height: 62vh; padding: .8rem .25rem; }
  .book, .book.is-cover { display: block; width: min(92%, 430px); aspect-ratio: .707 / 1; }
  .book-page { position: absolute; inset: 0; border-radius: 8px; box-shadow: none; }
  .page-left { display: none; }
  .book-spine { display: none; }
  .turning-page { width: 100%; border-radius: 8px; }
  .catalog-controls { gap: .55rem; }
  .catalog-controls button { padding-inline: .85rem; }
  .page-status { min-width: 104px; font-size: .78rem; }
  .zoom-scroll img { width: 170%; max-width: none; }
}

@media (prefers-reduced-motion: reduce) {
  .turning-page.turn-forward, .turning-page.turn-back { animation-duration: .01ms; }
}
