/* ============================================================
   Frontend del catálogo: imágenes reales + visor flipbook
   Complementa catalogo.css (el diseño A4 original).
   ============================================================ */

/* ---- Imágenes reales ocupando los antiguos slots ---- */
.r-img { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
/* Por defecto las imágenes a toda página (portadas, categorías con foto de
   banco) rellenan el área a sangre. */
.r-img img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* En portadas/categoría/feature el contenedor es el área de la imagen */
.coverA .hero .r-img,
.coverB .bottom .r-img,
.coverC .frame .r-img,
.catpage .r-img,
.fband__media .r-img { position: absolute; inset: 0; }

/* Fotos de PRODUCTO con fondo BLANCO (sin transparencia): se muestran
   COMPLETAS, centradas, sobre fondo blanco igual que en mobiocasion.com.
   El área de la foto es blanca para que el fondo blanco de la imagen
   se funda sin bordes visibles. */
.fband__media { background: #fff; }
.fband__media .r-img { background: #fff; }
.fband__media .r-img img { object-fit: contain; padding: 7mm; }

/* En la rejilla, .r-img va dentro de .prod__media (relativo) */
.prod__media .r-img { position: absolute; inset: 0; background: #fff; }
.prod__media .r-img img { object-fit: contain; padding: 6mm; }

/* Marcador hatched de portadas vacías (cuando no hay foto) */
.cover .ph, .catpage .ph {
  position: absolute; inset: 0;
  background: var(--gray-100);
  background-image: repeating-linear-gradient(45deg, transparent 0 11px, rgba(32,25,22,.05) 11px 12px);
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px;
}
.cover .ph svg, .catpage .ph svg { width: 90px; height: 90px; color: var(--gray-400); }
.cover .ph .mdl, .catpage .ph .mdl { font-weight: 800; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; color: var(--gray-400); }

/* ============================================================
   VISOR FLIPBOOK
   ============================================================ */
:root { --fb-bg: #1a1512; }

body.flip {
  margin: 0; background: var(--fb-bg);
  font-family: var(--font-sans); color: #fff;
  overflow: hidden; height: 100vh;
}

.fb-topbar {
  position: fixed; top: 0; left: 0; right: 0; height: 58px; z-index: 50;
  display: flex; align-items: center; gap: 16px; padding: 0 20px;
  background: rgba(20,16,14,.86); backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.fb-topbar img.logo { height: 22px; width: auto; }
.fb-topbar .title { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: var(--lime-400); }
.fb-topbar .spacer { flex: 1; }
.fb-topbar a, .fb-topbar button {
  display: inline-flex; align-items: center; gap: 7px;
  background: rgba(255,255,255,.08); color: #fff; border: 0;
  padding: 9px 15px; border-radius: 999px; font-weight: 800; font-size: 13px;
  cursor: pointer; text-decoration: none; font-family: var(--font-sans);
  transition: background .15s;
}
.fb-topbar a:hover, .fb-topbar button:hover { background: rgba(255,255,255,.16); }
.fb-topbar .primary { background: var(--lime-500); color: var(--ink-900); }
.fb-topbar .primary:hover { filter: brightness(.94); }
.fb-topbar svg { width: 16px; height: 16px; }
.fb-topbar button:disabled { opacity: .4; cursor: default; }
.fb-topbar button:disabled:hover { background: rgba(255,255,255,.08); }
.fb-zoom-level {
  font-family: var(--font-sans); font-weight: 800; font-size: 12px;
  color: #fff; min-width: 42px; text-align: center; opacity: .85;
}

/* Stage */
.fb-stage {
  position: absolute; inset: 58px 0 76px; display: flex;
  align-items: center; justify-content: center; perspective: 2600px;
  touch-action: pan-y;
}
/* Ampliado: el stage se puede desplazar para ver el detalle */
.fb-stage.is-zoomed {
  display: block; overflow: auto; perspective: none;
  align-items: flex-start; justify-content: flex-start;
  cursor: grab; touch-action: pan-x pan-y; scroll-behavior: smooth;
}
.fb-stage.is-zoomed .fb-viewport { margin: 0 auto; }
.fb-book {
  position: relative;
  transform-style: preserve-3d;
  transition: transform .25s ease;
}

/* Cada hoja del flipbook (una cara visible a la vez en móvil; doble en desktop) */
.fb-viewport { position: relative; }

/* Las .sheet heredan tamaño del diseño (210x297mm). Las escalamos con transform. */
.fb-stage .sheet {
  box-shadow: 0 30px 80px rgba(0,0,0,.55);
  margin: 0;
}
.fb-stage .sheet__tag { display: none; }

/* Spread (dos páginas) en escritorio */
.fb-spread { display: flex; gap: 0; }
.fb-spread .sheet + .sheet { box-shadow: 0 30px 80px rgba(0,0,0,.55); }
.fb-page-shadow {
  position: absolute; top: 0; bottom: 0; width: 60px; pointer-events: none; z-index: 5;
}

/* Animación de pasar página */
.fb-book.turning-next { animation: fbNext .5s ease; }
.fb-book.turning-prev { animation: fbPrev .5s ease; }
@keyframes fbNext {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(-7deg); }
  100% { transform: rotateY(0deg); }
}
@keyframes fbPrev {
  0% { transform: rotateY(0deg); }
  50% { transform: rotateY(7deg); }
  100% { transform: rotateY(0deg); }
}
.fb-fade { animation: fbFade .42s ease; }
@keyframes fbFade { from { opacity: .25; transform: scale(.985); } to { opacity: 1; transform: scale(1); } }

/* Bottom bar / navegación */
.fb-bottombar {
  position: fixed; bottom: 0; left: 0; right: 0; height: 76px; z-index: 50;
  display: flex; align-items: center; justify-content: center; gap: 22px;
  background: rgba(20,16,14,.86); backdrop-filter: blur(10px);
  border-top: 1px solid rgba(255,255,255,.08);
}
.fb-nav {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--lime-500); color: var(--ink-900); border: 0;
  display: flex; align-items: center; justify-content: center; cursor: pointer;
  transition: filter .15s, transform .1s;
}
.fb-nav:hover { filter: brightness(.94); }
.fb-nav:active { transform: scale(.93); }
.fb-nav:disabled { background: rgba(255,255,255,.12); color: rgba(255,255,255,.3); cursor: default; }
.fb-nav svg { width: 22px; height: 22px; }
.fb-counter { font-family: var(--font-display); font-weight: 700; font-size: 15px; color: #fff; min-width: 90px; text-align: center; }
.fb-counter b { color: var(--lime-400); }

/* Slider de progreso */
.fb-progress { width: 220px; height: 5px; border-radius: 3px; background: rgba(255,255,255,.14); position: relative; cursor: pointer; }
.fb-progress__fill { position: absolute; left: 0; top: 0; bottom: 0; background: var(--lime-500); border-radius: 3px; }

/* Miniaturas */
.fb-thumbs-toggle { }
.fb-thumbs {
  position: fixed; bottom: 76px; left: 0; right: 0; z-index: 49;
  background: rgba(20,16,14,.96); border-top: 1px solid rgba(255,255,255,.08);
  padding: 14px; display: none; gap: 10px; overflow-x: auto; white-space: nowrap;
}
.fb-thumbs.open { display: flex; }
.fb-thumb {
  flex: 0 0 auto; width: 70px; height: 99px; border-radius: 6px; overflow: hidden;
  border: 2px solid transparent; cursor: pointer; background: #fff; position: relative;
}
.fb-thumb.is-active { border-color: var(--lime-500); }
.fb-thumb .mini { transform-origin: top left; pointer-events: none; }
.fb-thumb__no { position: absolute; bottom: 2px; right: 4px; font-size: 9px; font-weight: 800; color: var(--ink-900); background: var(--lime-400); border-radius: 3px; padding: 0 4px; }

/* Loader */
.fb-loader { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; background: var(--fb-bg); z-index: 100; flex-direction: column; gap: 18px; }
.fb-loader img { height: 30px; opacity: .9; }
.fb-loader .bar { width: 160px; height: 4px; background: rgba(255,255,255,.15); border-radius: 3px; overflow: hidden; }
.fb-loader .bar i { display: block; height: 100%; width: 40%; background: var(--lime-500); border-radius: 3px; animation: fbLoad 1s infinite ease-in-out; }
@keyframes fbLoad { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

@media (max-width: 720px) {
  .fb-topbar .title { display: none; }
  .fb-topbar a span, .fb-topbar button span { display: none; }
  .fb-progress { width: 120px; }
  .fb-counter { min-width: 70px; font-size: 13px; }
}

/* ---- Precios en el catálogo (si show_prices=1) ---- */
.prod__foot { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; margin-top: 2px; }
.prod__price { font-family: var(--font-display); font-weight: 800; font-size: 14px; color: var(--ink-900); white-space: nowrap; }
.feature__price { font-family: var(--font-display); font-weight: 800; font-size: 22px; color: var(--lime-400); margin-left: 2px; }

/* QR real (PNG) ocupando la caja blanca */
.qr__img { width: 100%; height: 100%; object-fit: contain; display: block; }
