/* ==========================================================================
   SECCIÓN: REVISTA DEL TALLER (js/revista.js)
   ========================================================================== */
.rv-box {
  width: 100%;
  max-width: 760px;
  margin: 20px auto 0;
  padding: 34px 28px;
  background: var(--surface);
  border-radius: 18px;
  border: 1px solid var(--line);
  box-shadow: var(--shadow);
  text-align: center;
  box-sizing: border-box;
}

.rv-estante {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 22px;
  margin-top: 6px;
}

.rv-numero {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 14px;
  padding: 18px 16px 20px;
  background: var(--surface-strong);
  border: 1px solid var(--line);
  border-radius: 16px;
  cursor: pointer;
  font: inherit;
  color: inherit;
  transition: transform .25s ease, box-shadow .25s ease;
}
.rv-numero:hover { transform: translateY(-4px); box-shadow: 0 16px 30px rgba(68,43,25,0.16); }

.rv-portada {
  display: block;
  width: 72%;
  max-width: 190px;
  aspect-ratio: 1 / 1.414;
  border-radius: 3px 8px 8px 3px;
  overflow: hidden;
  background: #e9e1d3;
  box-shadow: -3px 0 0 rgba(0,0,0,0.08) inset, 6px 10px 22px rgba(43,33,28,0.28);
  transition: transform .35s ease;
  transform: perspective(700px) rotateY(-8deg);
}
.rv-numero:hover .rv-portada { transform: perspective(700px) rotateY(0deg); }
.rv-portada img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rv-numero-texto { display: flex; flex-direction: column; gap: 4px; }
.rv-numero-texto small { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; }
.rv-numero-texto strong { font-family: 'Cormorant Garamond', serif; font-size: 22px; color: var(--accent-dark); line-height: 1.15; }
.rv-leer { margin-top: 6px; font-size: 14px; font-weight: 700; color: var(--btn-blue); }

/* ---------- Lector ---------- */
.rv-lector {
  width: 100%;
  max-width: 1180px;
  margin: 18px auto 0;
  padding: 16px;
  box-sizing: border-box;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.rv-barra {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 12px;
}
.rv-barra .seg-btn { font-size: 14px; padding: 8px 12px; }
.rv-titulo {
  flex: 1;
  min-width: 0;
  font-family: 'Cormorant Garamond', serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--accent-dark);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.rv-escenario {
  position: relative;
  height: min(78vh, 900px);
  min-height: 360px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background:
    radial-gradient(ellipse at center, rgba(255,255,255,0.35), transparent 70%),
    linear-gradient(180deg, #3b2e26, #2b211c);
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}

.rv-libro {
  --pw: 300px;
  --ph: 424px;
  position: relative;
  display: flex;
  perspective: 2200px;
}
.rv-hoja {
  width: var(--pw);
  height: var(--ph);
  background: #fdfbf6;
  position: relative;
  box-shadow: 0 18px 40px rgba(0,0,0,0.35);
}
.rv-hoja canvas { width: 100%; height: 100%; display: block; }
.rv-hoja.is-vacia { background: transparent; box-shadow: none; }

/* Pliego de dos páginas: sombra del lomo */
.rv-libro.is-doble .rv-izq::after,
.rv-libro.is-doble .rv-der::after {
  content: "";
  position: absolute;
  top: 0; bottom: 0;
  width: 9%;
  pointer-events: none;
}
.rv-libro.is-doble .rv-izq::after { right: 0; background: linear-gradient(90deg, transparent, rgba(0,0,0,0.16)); }
.rv-libro.is-doble .rv-der::after { left: 0; background: linear-gradient(270deg, transparent, rgba(0,0,0,0.18)); }
.rv-libro.is-doble .rv-hoja.is-vacia::after { display: none; }

/* Hoja que gira */
.rv-volante {
  position: absolute;
  top: 0;
  width: var(--pw);
  height: var(--ph);
  transform-style: preserve-3d;
  transition: transform .62s cubic-bezier(.45,.05,.3,1);
  z-index: 5;
  pointer-events: none;
}
.rv-volante-der { left: var(--pw); transform-origin: left center; }
.rv-volante-der.is-girando { transform: rotateY(-180deg); }
.rv-volante-izq { left: 0; transform-origin: right center; }
.rv-volante-izq.is-girando { transform: rotateY(180deg); }
.rv-libro:not(.is-doble) .rv-volante { left: 0; }
.rv-volante-sola { transform-origin: left center; }
.rv-volante-sola.is-girando { transform: rotateY(-100deg); opacity: 0.2; transition: transform .55s ease-in, opacity .55s ease-in; }
.rv-volante-sola-atras { transform-origin: left center; transform: rotateY(-100deg); opacity: 0.2; }
.rv-volante-sola-atras.is-girando { transform: rotateY(0deg); opacity: 1; transition: transform .55s ease-out, opacity .45s ease-out; }

.rv-cara {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: #fdfbf6;
  overflow: hidden;
}
.rv-cara canvas { width: 100%; height: 100%; display: block; }
.rv-dorso { transform: rotateY(180deg); }
.rv-frente::after, .rv-dorso::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: linear-gradient(90deg, rgba(0,0,0,0.12), transparent 30%);
}
.rv-volante-izq .rv-frente::after { background: linear-gradient(270deg, rgba(0,0,0,0.12), transparent 30%); }

/* Zonas para tocar los bordes */
.rv-zona {
  position: absolute;
  top: 0; bottom: 0;
  width: 22%;
  border: none;
  background: transparent;
  padding: 0;
  cursor: pointer;
  z-index: 6;
}
.rv-zona:hover { background: rgba(255,255,255,0.04); }
.rv-zona-izq { left: 0; cursor: w-resize; }
.rv-zona-der { right: 0; cursor: e-resize; }

.rv-cargando {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-size: 15px;
  z-index: 7;
}

.rv-controles {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}
.rv-controles input[type=range] { flex: 1; accent-color: var(--accent); }
.rv-controles .seg-btn { min-width: 56px; font-weight: 700; }
.rv-controles .seg-btn.primary { background: var(--btn-blue); color: #fff; border-color: var(--btn-blue-dark); }
.rv-controles .seg-btn:disabled { opacity: .45; cursor: not-allowed; }
.rv-contador { margin-top: 8px; font-size: 13px; font-weight: 600; color: var(--accent-dark); }

/* Pantalla completa */
.rv-lector:fullscreen { max-width: none; border-radius: 0; display: flex; flex-direction: column; background: #2b211c; border: 0; }
.rv-lector:fullscreen .rv-escenario { flex: 1; height: auto; }
.rv-lector:fullscreen .rv-titulo, .rv-lector:fullscreen .rv-contador { color: #f6f0e7; }
.rv-lector:-webkit-full-screen { max-width: none; border-radius: 0; display: flex; flex-direction: column; background: #2b211c; }
.rv-lector:-webkit-full-screen .rv-escenario { flex: 1; height: auto; }

@media (max-width: 768px) {
  .rv-box { padding: 24px 16px; }
  .rv-lector { padding: 10px; border-radius: 14px; }
  .rv-escenario { height: 72vh; min-height: 300px; }
  .rv-titulo { font-size: 18px; }
  .rv-zona { width: 30%; }
}
