/* Visor Flipbook — Los viajes de Gabriela
 * Incluye los estilos base de StPageFlip (MIT), con la clase .stf__wrapper corregida
 * (en la librería original viene mal escrita como .sft__wrapper).
 * Las instrucciones de uso y actualización están al inicio de flipbook.js.
 */

/* ---------- StPageFlip (base) ---------- */
.stf__parent { position: relative; display: block; box-sizing: border-box; transform: translateZ(0); -ms-touch-action: pan-y; touch-action: pan-y; }
.stf__wrapper { position: relative; width: 100%; box-sizing: border-box; }
.stf__parent canvas { position: absolute; width: 100%; height: 100%; left: 0; top: 0; }
.stf__block { position: absolute; width: 100%; height: 100%; box-sizing: border-box; perspective: 2000px; }
.stf__item { display: none; position: absolute; transform-style: preserve-3d; }
.stf__outerShadow, .stf__innerShadow, .stf__hardShadow, .stf__hardInnerShadow { position: absolute; left: 0; top: 0; }

/* ---------- Contenedor ---------- */
/* El bloque del constructor (components/flipbook.php) debe ocupar todo el ancho de la columna:
   el visor calcula su tamaño a partir del ancho disponible. */
.component.flipbook, .vxfb-wrapper { width: 100%; }
.vxfb {
    --vxfb-bg: #f3f3f1;
    --vxfb-ink: #2b2b2b;
    --vxfb-muted: #6b6b6b;
    --vxfb-accent: #726100;
    --vxfb-border: lightgray;
    position: relative;
    width: 100%;
    box-sizing: border-box;
    border: 1px solid var(--vxfb-border);
    background: var(--vxfb-bg);
    color: var(--vxfb-ink);
    outline: none;
    display: flex;
    flex-direction: column;
    user-select: none;
    -webkit-user-select: none;
}
.vxfb *, .vxfb *::before, .vxfb *::after { box-sizing: border-box; }
.vxfb:focus-visible { box-shadow: 0 0 0 3px rgba(114, 97, 0, .35); }
.vxfb--loading { min-height: 240px; align-items: center; justify-content: center; }
.vxfb-msg { margin: 0; padding: 24px; color: var(--vxfb-muted); font-size: 15px; text-align: center; }

.vxfb-main {
    position: relative;
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 24px 56px 12px;
    flex: 1 1 auto;
    min-height: 0;
}
.vxfb-stage { position: relative; max-width: 100%; }

/* ---------- Botones ---------- */
.vxfb-btn {
    appearance: none;
    -webkit-appearance: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 38px;
    height: 38px;
    margin: 0;
    padding: 0 8px;
    border: 0;
    border-radius: 6px;
    background: transparent;
    color: var(--vxfb-ink);
    font: inherit;
    font-size: 14px;
    line-height: 1;
    cursor: pointer;
    transition: background-color .15s, opacity .15s;
}
.vxfb-btn:hover { background: rgba(0, 0, 0, .07); }
.vxfb-btn:focus-visible { outline: 2px solid var(--vxfb-accent); outline-offset: 1px; }
.vxfb-btn:disabled { opacity: .3; cursor: default; background: transparent; }
.vxfb-btn svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }

.vxfb-arrow {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 5;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    background: rgba(255, 255, 255, .85);
    box-shadow: 0 1px 4px rgba(0, 0, 0, .18);
}
.vxfb-arrow:hover { background: #fff; }
.vxfb-arrow:disabled { opacity: 0; pointer-events: none; }
.vxfb-arrow--prev { left: 6px; }
.vxfb-arrow--next { right: 6px; }

/* ---------- Barra inferior ---------- */
.vxfb-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 6px 12px 10px;
    flex: none;
}
.vxfb-range {
    flex: 1 1 auto;
    min-width: 60px;
    margin: 0;
    accent-color: var(--vxfb-accent);
    cursor: pointer;
}
.vxfb-count {
    flex: none;
    min-width: 70px;
    font-size: 14px;
    font-variant-numeric: tabular-nums;
    color: var(--vxfb-muted);
    text-align: center;
    white-space: nowrap;
}
.vxfb-tools { display: flex; align-items: center; gap: 2px; flex: none; }

/* ---------- Libro ---------- */
.vxfb-book { margin: 0 auto; }
.vxfb-page { background: #fff; overflow: hidden; }
.vxfb-page img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: none;
}
/* sombra del lomo (centro del libro) */
.vxfb--landscape .vxfb-page::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    width: 7%;
    pointer-events: none;
}
.vxfb--landscape .vxfb-page.--left::after { right: 0; background: linear-gradient(to left, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0)); }
.vxfb--landscape .vxfb-page.--right::after { left: 0; background: linear-gradient(to right, rgba(0, 0, 0, .18), rgba(0, 0, 0, 0)); }
.vxfb--landscape .vxfb-page.--hard::after { display: none; }
/* sombra general del libro */
.vxfb-book .stf__block { filter: drop-shadow(0 4px 10px rgba(0, 0, 0, .18)); }
.vxfb--flipping .vxfb-link { pointer-events: none; }

/* bordes de grosor (páginas apiladas) */
.vxfb-edge {
    position: absolute;
    z-index: 0;
    pointer-events: none;
    background: repeating-linear-gradient(90deg, #fdfdfb 0, #fdfdfb 1px, #d9d9d4 1px, #d9d9d4 2px);
    box-shadow: 0 3px 8px rgba(0, 0, 0, .15);
    transition: width .3s, left .3s;
}
.vxfb-edge--left { border-radius: 2px 0 0 2px; }
.vxfb-edge--right { border-radius: 0 2px 2px 0; }
.vxfb--flipping .vxfb-edge { transition: none; }
.vxfb-book { position: relative; z-index: 1; }

/* ---------- Enlaces sobre las páginas ---------- */
.vxfb-link {
    position: absolute;
    z-index: 3;
    display: block;
    border-radius: 2px;
    background: rgba(114, 97, 0, 0);
    cursor: pointer;
    transition: background-color .15s;
}
.vxfb-link:hover, .vxfb-link:focus-visible { background: rgba(114, 97, 0, .18); outline: none; }

/* ---------- Tarjetas ---------- */
.vxfb-card {
    position: relative;
    width: 100%;
    perspective: 1800px;
    transition: transform .22s ease, opacity .22s ease;
}
.vxfb-card.is-out-left { transform: translateX(-12%); opacity: 0; }
.vxfb-card.is-out-right { transform: translateX(12%); opacity: 0; }
.vxfb-card.is-in-left { transform: translateX(-12%); opacity: 0; }
.vxfb-card.is-in-right { transform: translateX(12%); opacity: 0; }
.vxfb-card.no-anim, .vxfb-card-inner.no-anim { transition: none !important; }
.vxfb-card-inner {
    position: absolute;
    inset: 0;
    transform-style: preserve-3d;
    transition: transform .7s cubic-bezier(.3, .7, .3, 1);
    cursor: pointer;
}
.vxfb-card-inner.is-flipped { transform: rotateY(180deg); }
.vxfb-face {
    position: absolute;
    inset: 0;
    border-radius: 14px;
    overflow: hidden;
    background: #fff;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    box-shadow: 0 6px 18px rgba(0, 0, 0, .2);
}
.vxfb-face--back { transform: rotateY(180deg); }
.vxfb-face img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.vxfb-turn span { font-size: 14px; }

/* ---------- Zoom ---------- */
.vxfb-zoom {
    position: absolute;
    inset: 0;
    z-index: 20;
    background: var(--vxfb-bg);
}
.vxfb-zoom[hidden] { display: none; }
.vxfb-zoom-scroll {
    position: absolute;
    inset: 0;
    overflow: auto;
    cursor: grab;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
}
.vxfb-zoom-scroll.is-panning { cursor: grabbing; }
.vxfb-zoom-scroll.is-panning .vxfb-link { pointer-events: none; }
.vxfb-zoom-content {
    display: grid;
    grid-template-columns: repeat(var(--vxfb-cols, 1), 1fr);
    margin: 0 auto;
}
.vxfb-zoom-page { position: relative; background: #fff; }
.vxfb-zoom-page img { display: block; width: 100%; height: 100%; pointer-events: none; }
.vxfb-zoom-tools {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    gap: 2px;
    padding: 3px;
    border-radius: 8px;
    background: rgba(255, 255, 255, .92);
    box-shadow: 0 1px 6px rgba(0, 0, 0, .2);
}
.vxfb--zooming .vxfb-bar { visibility: hidden; }

/* ---------- Pantalla completa ---------- */
.vxfb--full {
    border: 0;
    width: 100%;
    height: 100%;
    background: #e9e9e6;
}
.vxfb--full:not(:fullscreen) {
    /* iPhone u otros sin API de pantalla completa */
    position: fixed;
    inset: 0;
    z-index: 99999;
    height: 100dvh;
}
.vxfb--full .vxfb-main { padding-top: 16px; }
html.vxfb-noscroll, html.vxfb-noscroll body { overflow: hidden !important; }

/* ---------- Celular ---------- */
@media (max-width: 600px) {
    .vxfb-main { padding: 14px 14px 8px; }
    .vxfb-arrow { width: 38px; height: 38px; }
    .vxfb-arrow--prev { left: 2px; }
    .vxfb-arrow--next { right: 2px; }
    .vxfb-bar { gap: 6px; padding: 4px 6px 8px; flex-wrap: wrap; }
    .vxfb-range { order: 3; flex-basis: 100%; }
    .vxfb-count { text-align: left; min-width: 0; flex: 1 1 auto; }
    .vxfb-turn span { display: none; }
}
@media (prefers-reduced-motion: reduce) {
    .vxfb-card, .vxfb-card-inner, .vxfb-edge { transition: none !important; }
}
