/* Visor de PDF (flipbook) — construye sobre las variables de marca de ../style.css */

.viewer-shell {
  max-width: 1040px;
  margin: 0 auto;
  padding: 22px 20px 72px;
}

.viewer-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 28px;
}

.viewer-back,
.viewer-download {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  padding: 10px 16px;
  border-radius: 999px;
  border: 1px solid var(--border);
  color: var(--ink);
  background: var(--surface);
  box-shadow: 0 2px 10px var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.viewer-download {
  background: var(--accent);
  color: var(--accent-ink);
  border-color: transparent;
}

@media (hover: hover) {
  .viewer-back:hover,
  .viewer-download:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--shadow);
  }
}

.viewer-back svg,
.viewer-download svg {
  width: 16px;
  height: 16px;
}

/* Hero */

.viewer-hero {
  text-align: center;
  max-width: 720px;
  margin: 0 auto 48px;
}

.viewer-eyebrow {
  margin: 0 0 10px;
}

.viewer-hero h1 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.6rem, 4vw, 2.3rem);
  line-height: 1.2;
  margin: 0 0 16px;
}

.viewer-lede {
  color: var(--ink-muted);
  font-size: 1rem;
  line-height: 1.6;
  margin: 0 auto 28px;
  max-width: 62ch;
}

.stat-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
}

.stat-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 108px;
  padding: 14px 16px;
  border-radius: var(--radius-md);
  background: var(--surface);
  border: 1px solid var(--border);
  box-shadow: 0 2px 10px var(--shadow);
}

.stat-tile strong {
  font-family: var(--font-display);
  font-size: 1.35rem;
  color: var(--accent);
}

.stat-tile span {
  font-size: 0.76rem;
  color: var(--ink-muted);
  text-align: center;
}

/* Summary timeline */

.summary-section {
  max-width: 720px;
  margin: 0 auto 56px;
}

.summary-section .section-eyebrow {
  text-align: center;
}

.timeline {
  list-style: none;
  margin: 24px 0 0;
  padding: 0;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  left: 19px;
  top: 6px;
  bottom: 6px;
  width: 2px;
  background: var(--border);
}

.timeline-step {
  position: relative;
  padding-left: 0;
}

.timeline-step + .timeline-step {
  margin-top: 26px;
}

.timeline-link {
  display: flex;
  gap: 18px;
  text-decoration: none;
  color: inherit;
  border-radius: var(--radius-md);
  padding: 6px;
  margin: -6px;
  transition: transform 0.18s ease, background 0.18s ease;
}

@media (hover: hover) {
  .timeline-link:hover {
    transform: translateX(3px);
    background: var(--surface);
  }
  .timeline-link:hover .timeline-cta {
    color: var(--accent);
  }
  .timeline-link:hover .timeline-cta svg {
    transform: translateX(2px);
  }
}

.timeline-num {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: var(--surface);
  border: 2px solid var(--accent);
  color: var(--accent);
  font-family: var(--font-display);
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
}

.timeline-body {
  min-width: 0;
}

.timeline-body h3 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.05rem;
  margin: 6px 0 6px;
}

.timeline-body p {
  margin: 0;
  color: var(--ink-muted);
  font-size: 0.92rem;
  line-height: 1.55;
}

.timeline-cta {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 10px;
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--ink-muted);
  transition: color 0.18s ease;
}

.timeline-cta svg {
  width: 14px;
  height: 14px;
  transition: transform 0.18s ease;
}

/* Book section */

.book-section {
  max-width: 900px;
  margin: 0 auto 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.book-section .section-eyebrow {
  text-align: center;
}

.book-hint {
  margin: 0 0 20px;
  color: var(--ink-muted);
  font-size: 0.84rem;
  text-align: center;
}

.book-reader {
  display: flex;
  flex-direction: column;
  align-items: center;
  width: 100%;
}

.book-stage {
  position: relative;
  width: 100%;
  height: min(64vh, 620px);
  display: flex;
  align-items: center;
  justify-content: center;
}

:fullscreen .book-reader {
  height: 100vh;
  width: 100vw;
  justify-content: center;
  background: var(--bg);
  padding: 20px;
}

:fullscreen .book-stage {
  flex: 1;
  height: auto;
  min-height: 0;
  width: 100%;
  align-self: stretch;
}

:fullscreen .book-controls,
:fullscreen .thumb-strip {
  flex-shrink: 0;
}

:fullscreen .book-expand-btn {
  display: none;
}

.book {
  position: relative;
  overflow: hidden;
  background: var(--surface-muted);
  border-radius: 4px;
  perspective: 2600px;
  filter: drop-shadow(0 22px 46px var(--shadow));
}

.leaf {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 50%;
  transform-style: preserve-3d;
  transform-origin: left center;
  will-change: transform;
}

.leaf.flipping {
  transition: transform 0.62s cubic-bezier(0.45, 0, 0.2, 1);
}

.leaf-face {
  position: absolute;
  inset: 0;
  overflow: hidden;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 4px;
  background: var(--surface);
}

.leaf-face img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  background: var(--surface-muted);
}

.leaf-back {
  transform: rotateY(180deg);
  background: linear-gradient(115deg, var(--surface-muted) 0%, var(--surface) 60%);
}

.leaf-back::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(0, 0, 0, 0.06), transparent 30%);
}

.leaf-back--dark {
  background: linear-gradient(150deg, #1b2b36 0%, #233845 100%);
}

.leaf-back--dark::after {
  display: none;
}

.leaf-shade {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, transparent 0%, rgba(0, 0, 0, 0.55) 100%);
  opacity: 0;
}

/* Cover & back cover faces */

.leaf-cover,
.leaf-backcover {
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  color: #fff;
  padding: 10% 8%;
  background: linear-gradient(150deg, #1b2b36 0%, #233845 45%, #a77a3b 130%);
}

.leaf-cover .cover-ribbon {
  font-family: var(--font-display);
  font-size: 0.68rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  background: rgba(255, 255, 255, 0.16);
  padding: 6px 14px;
  border-radius: 999px;
  margin-bottom: 22px;
}

.leaf-cover h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: clamp(1.1rem, 5vw, 1.6rem);
  line-height: 1.25;
  margin: 0 0 14px;
}

.leaf-cover p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  margin: 0;
  line-height: 1.5;
}

.leaf-cover .cover-brand {
  margin-top: auto;
  padding-top: 22px;
  font-family: var(--font-display);
  font-size: 0.82rem;
  letter-spacing: 0.04em;
  color: rgba(255, 255, 255, 0.9);
}

.leaf-backcover .backcover-mono {
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-display);
  font-size: 1rem;
  margin-bottom: 16px;
}

.leaf-backcover h2 {
  font-family: var(--font-display);
  font-weight: 500;
  font-size: 1.2rem;
  margin: 0 0 8px;
}

.leaf-backcover p {
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.78);
  max-width: 30ch;
  margin: 0;
}

/* Interaction overlay (captures drag / tap) */

.book-input {
  position: absolute;
  inset: 0;
  z-index: 9000;
  cursor: grab;
  touch-action: none;
}

.book-input:active {
  cursor: grabbing;
}

.book-expand-btn {
  position: absolute;
  bottom: 10px;
  right: 10px;
  z-index: 9500;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.92);
  color: #233845;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
}

.book-expand-btn svg {
  width: 17px;
  height: 17px;
}

/* Controls */

.book-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  max-width: 480px;
  margin-top: 20px;
}

.book-nav-btn {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 10px var(--shadow);
}

.book-nav-btn:disabled {
  opacity: 0.35;
  cursor: default;
}

.book-nav-btn svg {
  width: 17px;
  height: 17px;
}

.book-progress {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.book-progress input[type="range"] {
  width: 100%;
  accent-color: var(--accent);
}

.book-page-label {
  font-size: 0.76rem;
  color: var(--ink-muted);
  font-family: var(--font-display);
}

/* Thumbnail strip */

.thumb-strip {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  width: 100%;
  max-width: 900px;
  padding: 18px 4px 6px;
  scroll-snap-type: x proximity;
}

.thumb-strip::-webkit-scrollbar {
  height: 6px;
}

.thumb-strip::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 999px;
}

.thumb-btn {
  flex-shrink: 0;
  width: 44px;
  aspect-ratio: 1311 / 1853;
  border-radius: 6px;
  overflow: hidden;
  border: 2px solid transparent;
  padding: 0;
  cursor: pointer;
  background: var(--surface-muted);
  scroll-snap-align: center;
  opacity: 0.6;
  transition: opacity 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.thumb-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.thumb-btn.is-active {
  opacity: 1;
  border-color: var(--accent);
  transform: translateY(-2px);
}

/* CTA strip */

.cta-strip {
  max-width: 520px;
  margin: 56px auto 0;
  text-align: center;
}

.cta-strip p {
  margin: 0 0 12px;
  font-family: var(--font-display);
  font-size: 1.02rem;
}

.cta-strip-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 13px 24px;
  border-radius: 999px;
  background: var(--surface);
  border: 1px solid var(--border);
  text-decoration: none;
  color: var(--ink);
  font-weight: 600;
  font-size: 0.94rem;
  box-shadow: 0 4px 16px var(--shadow);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
}

@media (hover: hover) {
  .cta-strip-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 10px 24px var(--shadow);
  }
}

.cta-strip-btn svg {
  width: 19px;
  height: 19px;
}

/* Responsive */

@media (min-width: 720px) {
  .viewer-hero h1 {
    font-size: 2.3rem;
  }

  .timeline-step {
    gap: 22px;
  }
}

/* Lector móvil a pantalla completa — una página por pantalla, deslizable,
   con barra de paginación semitransparente que se autooculta. */

.mobile-reader {
  position: fixed;
  inset: 0;
  z-index: 30000;
  background: #14181c;
  display: none;
}

.mobile-reader.is-open {
  display: block;
}

.mobile-reader-scroller {
  width: 100%;
  height: 100%;
  display: flex;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-snap-type: x mandatory;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

.mobile-reader-scroller::-webkit-scrollbar {
  display: none;
}

.mobile-reader-slide {
  flex: 0 0 100%;
  width: 100%;
  height: 100%;
  scroll-snap-align: start;
  scroll-snap-stop: always;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: env(safe-area-inset-top, 0) 0 env(safe-area-inset-bottom, 0);
}

.mobile-reader-slide img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
}

.mobile-reader-slide.is-cover,
.mobile-reader-slide.is-backcover {
  width: 100%;
  height: 100%;
  padding: 12% 10%;
}

.mobile-reader-top,
.mobile-reader-bottom {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 2;
  background: linear-gradient(rgba(0, 0, 0, 0.55), transparent);
  transition: opacity 0.35s ease;
  pointer-events: none;
}

.mobile-reader-top {
  top: 0;
  padding: max(14px, env(safe-area-inset-top)) 14px 30px;
  display: flex;
  justify-content: flex-end;
}

.mobile-reader-bottom {
  bottom: 0;
  padding: 30px 20px max(16px, env(safe-area-inset-bottom));
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.6));
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}

.mobile-reader.controls-hidden .mobile-reader-top,
.mobile-reader.controls-hidden .mobile-reader-bottom {
  opacity: 0;
}

.mobile-reader-close {
  pointer-events: auto;
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.16);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}

.mobile-reader-close svg {
  width: 17px;
  height: 17px;
}

.mobile-reader-track {
  pointer-events: none;
  width: 100%;
  max-width: 280px;
  height: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  overflow: hidden;
}

.mobile-reader-fill {
  height: 100%;
  background: #cf9d5e;
  width: 0%;
  transition: width 0.25s ease;
}

.mobile-reader-label {
  pointer-events: none;
  font-family: var(--font-display);
  font-size: 0.78rem;
  color: rgba(255, 255, 255, 0.85);
}

@media (max-width: 460px) {
  .book-stage {
    height: min(58vh, 520px);
  }

  .cta-strip p {
    font-size: 0.94rem;
  }
}
