/* =========================================================
   Visor de la revista Business Leaders (hojeo tipo flipbook)
   ========================================================= */
:root {
  --bl-white: #FFFFFF;
  --bl-navy: #103669;
  --bl-blue: #004AAD;
  --bl-gray: #DEDEDE;
  --bl-black: #000000;
  --bar-h: 64px;
  --foot-h: 76px;
}

*, *::before, *::after { box-sizing: border-box; }
img { height: auto; }

html, body { height: 100%; }
body {
  margin: 0;
  overflow: hidden;
  background: radial-gradient(ellipse at 50% 40%, #F3F3F3 0%, #E2E2E2 60%, #D4D4D4 100%);
  color: var(--bl-navy);
  font-family: "Source Sans 3", "Source Sans Pro", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
  user-select: none;
}

.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--bl-blue); outline-offset: 3px; }

/* ---------- Barra superior ---------- */
.rv-bar {
  position: fixed;
  inset: 0 0 auto 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  height: var(--bar-h);
  padding: 0 clamp(12px, 2vw, 24px);
}

.rv-back {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  justify-self: start;
  padding: 8px 14px 8px 10px;
  border-radius: 99px;
  color: var(--bl-navy);
  text-decoration: none;
  transition: background-color 0.2s ease;
}
.rv-back:hover { background: rgba(16, 54, 105, 0.08); }
.rv-logo { height: 30px; width: auto; }

.rv-title {
  margin: 0;
  font-family: "Anton", Impact, sans-serif;
  font-size: clamp(16px, 1.6vw, 22px);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  white-space: nowrap;
}

.rv-tools { display: flex; gap: 4px; justify-self: end; }

.rv-tool {
  display: grid;
  place-items: center;
  width: 42px;
  height: 42px;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: var(--bl-navy);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease;
}
.rv-tool svg { width: 22px; height: 22px; }
.rv-tool:hover { background: rgba(16, 54, 105, 0.1); }
.rv-tool[aria-pressed="true"] { background: var(--bl-blue); color: var(--bl-white); }
.rv-sound-on { display: none; }
.rv-tool[aria-pressed="true"] .rv-sound-on { display: block; }
.rv-tool[aria-pressed="true"] .rv-sound-off { display: none; }

/* ---------- Escenario y libro ---------- */
.rv-stage {
  position: fixed;
  inset: var(--bar-h) 0 var(--foot-h) 0;
  display: flex;
  align-items: center;
  justify-content: center;
}

.rv-book-wrap { position: relative; }

.rv-book { margin: 0 auto; }
.rv-book .page {
  background: var(--bl-white);
  overflow: hidden;
}
.rv-book .page img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.35s ease;
}
.rv-book .page img.is-loaded { opacity: 1; }
/* Lomo: sombra donde el papel se curva hacia el centro, como una revista impresa.
   Pliegue oscuro pegado al lomo, caída suave y un leve brillo donde la hoja vuelve a quedar plana. */
.rv-book .page::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.rv-book .page.--left::after {
  background:
    linear-gradient(to left,
      rgba(0, 0, 0, 0.30) 0%,
      rgba(0, 0, 0, 0.16) 1.6%,
      rgba(0, 0, 0, 0.07) 4.5%,
      rgba(0, 0, 0, 0.02) 8%,
      rgba(255, 255, 255, 0.10) 11%,
      rgba(255, 255, 255, 0) 16%);
}
.rv-book .page.--right::after {
  background:
    linear-gradient(to right,
      rgba(0, 0, 0, 0.24) 0%,
      rgba(0, 0, 0, 0.12) 1.6%,
      rgba(0, 0, 0, 0.05) 4.5%,
      rgba(0, 0, 0, 0.015) 8%,
      rgba(255, 255, 255, 0.08) 11%,
      rgba(255, 255, 255, 0) 16%);
}
/* Portada y contraportada son de cartulina: solo se nota la bisagra */
.rv-book .page.--hard::after {
  background: linear-gradient(to right, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0.04) 2.5%, rgba(0, 0, 0, 0) 6%);
}
.rv-book .page.--hard.--left::after {
  background: linear-gradient(to left, rgba(0, 0, 0, 0.14) 0%, rgba(0, 0, 0, 0.04) 2.5%, rgba(0, 0, 0, 0) 6%);
}
/* Sombra del libro sobre el fondo */
.rv-book .stf__block { filter: drop-shadow(0 22px 36px rgba(0, 0, 0, 0.22)); }

.rv-loading {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  font-weight: 600;
  transition: opacity 0.4s ease;
}
.rv-loading img { width: 72px; animation: rv-pulse 1.2s ease-in-out infinite; }
.rv-loading.is-hidden { opacity: 0; pointer-events: none; }
@keyframes rv-pulse { 50% { transform: scale(0.9); opacity: 0.6; } }

.rv-arrow {
  position: absolute;
  top: 50%;
  z-index: 5;
  display: grid;
  place-items: center;
  width: 52px;
  height: 52px;
  margin-top: -26px;
  border: 0;
  border-radius: 50%;
  background: var(--bl-white);
  color: var(--bl-navy);
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.12);
  cursor: pointer;
  transition: background-color 0.2s ease, color 0.2s ease, transform 0.2s ease, opacity 0.2s ease;
}
.rv-arrow:hover { background: var(--bl-blue); color: var(--bl-white); }
.rv-arrow:active { transform: scale(0.94); }
.rv-arrow[disabled] { opacity: 0.35; pointer-events: none; }
.rv-arrow--prev { left: clamp(8px, 2vw, 28px); }
.rv-arrow--next { right: clamp(8px, 2vw, 28px); }

/* ---------- Barra inferior ---------- */
.rv-foot {
  position: fixed;
  inset: auto 0 0 0;
  z-index: 20;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--foot-h);
  padding: 0 clamp(16px, 4vw, 64px) env(safe-area-inset-bottom);
}

.rv-progress { flex: 1; display: flex; }
.rv-progress input {
  width: 100%;
  height: 22px;
  margin: 0;
  background: transparent;
  cursor: pointer;
  -webkit-appearance: none;
  appearance: none;
  --pct: 0%;
}
.rv-progress input::-webkit-slider-runnable-track {
  height: 4px;
  border-radius: 99px;
  background: linear-gradient(90deg, var(--bl-blue) var(--pct), rgba(16, 54, 105, 0.18) var(--pct));
}
.rv-progress input::-moz-range-track { height: 4px; border-radius: 99px; background: rgba(16, 54, 105, 0.18); }
.rv-progress input::-moz-range-progress { height: 4px; border-radius: 99px; background: var(--bl-blue); }
.rv-progress input::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  margin-top: -7px;
  border: 3px solid var(--bl-white);
  border-radius: 50%;
  background: var(--bl-blue);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.rv-progress input::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border: 3px solid var(--bl-white);
  border-radius: 50%;
  background: var(--bl-blue);
}

.rv-pages {
  min-width: 96px;
  margin: 0;
  font-weight: 700;
  font-size: 16px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}

/* ---------- Índice ---------- */
.rv-scrim {
  position: fixed;
  inset: 0;
  z-index: 30;
  background: rgba(16, 54, 105, 0.25);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s ease;
}
.rv-toc {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 31;
  width: min(380px, 88vw);
  padding: 20px 24px 32px;
  overflow-y: auto;
  background: var(--bl-white);
  box-shadow: -20px 0 40px rgba(0, 0, 0, 0.15);
  transform: translateX(102%);
  transition: transform 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}
.is-toc-open .rv-toc { transform: none; }
.is-toc-open .rv-scrim { opacity: 1; pointer-events: auto; }

.rv-toc-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.rv-toc-head h2 {
  margin: 0;
  font-family: "Anton", Impact, sans-serif;
  font-weight: 400;
  font-size: 30px;
  text-transform: uppercase;
}

.rv-toc-list { margin: 0; padding: 0; list-style: none; }
.rv-toc-list button {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  width: 100%;
  padding: 14px 4px;
  border: 0;
  border-bottom: 1px solid var(--bl-gray);
  background: none;
  color: var(--bl-navy);
  font: 600 17px/1.3 inherit;
  font-family: inherit;
  text-align: left;
  cursor: pointer;
  transition: color 0.2s ease, padding 0.2s ease;
}
.rv-toc-list button:hover { color: var(--bl-blue); padding-left: 10px; }
.rv-toc-list span:last-child { color: var(--bl-blue); font-variant-numeric: tabular-nums; }

/* ---------- Vista ampliada ---------- */
.rv-zoom {
  position: fixed;
  inset: 0;
  z-index: 40;
  overflow: auto;
  background: rgba(20, 24, 33, 0.92);
  cursor: grab;
  overscroll-behavior: contain;
}
.rv-zoom.is-dragging { cursor: grabbing; }
.rv-zoom[hidden] { display: none; }
.rv-zoom-close {
  position: fixed;
  top: 14px;
  right: 14px;
  z-index: 2;
  background: var(--bl-white);
}
.rv-zoom-close:hover { background: var(--bl-gray); }
.rv-zoom-spread {
  display: flex;
  justify-content: center;
  width: max-content;
  min-width: 100%;
  padding: 72px 24px 40px;
}
.rv-zoom-spread img {
  display: block;
  width: var(--zoom-w, 900px);
  height: auto;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.45);
  pointer-events: none;
}

@media (max-width: 700px) {
  :root { --bar-h: 58px; --foot-h: 64px; }
  .rv-title { display: none; }
  .rv-bar { grid-template-columns: 1fr auto; }
  .rv-arrow { width: 44px; height: 44px; margin-top: -22px; opacity: 0.9; }
  .rv-tool[data-rv-sound] { display: none; }
}
