/* caferiabar/menu/css/libro.css — Visor del menú tipo libro */
.libro {
    position: fixed; inset: 0; z-index: 1000;
    display: flex; flex-direction: column;
    height: 100vh; height: 100dvh;
    color: #F3E9DC; font-family: 'Inter', system-ui, sans-serif;
    opacity: 0; visibility: hidden; transition: opacity .35s ease, visibility 0s .35s;
    -webkit-user-select: none; user-select: none;
    -webkit-tap-highlight-color: transparent;
}
.libro.abierto { opacity: 1; visibility: visible; transition: opacity .35s ease; }
.libro-fondo {
    position: absolute; inset: 0; z-index: -1;
    background:
        radial-gradient(120% 80% at 50% 45%, rgba(92,66,50,.55), rgba(20,13,10,0) 70%),
        #1c1310;
}

/* Barra superior */
.libro-barra {
    flex: none; display: flex; align-items: center; justify-content: space-between; gap: 10px;
    padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top));
}
.libro-titulo { display: flex; align-items: baseline; gap: 8px; min-width: 0; padding-left: 4px; }
.libro-titulo b { font-weight: 600; letter-spacing: .14em; font-size: 13px; color: #8DBBE6; }
.libro-titulo i { font-family: 'Great Vibes', cursive; font-style: normal; font-size: 26px; color: #D7AE5E; line-height: 1; }
.libro-contador { font-size: 13px; font-variant-numeric: tabular-nums; opacity: .85; letter-spacing: .06em; }
.libro-acciones { display: flex; gap: 4px; }
.libro-boton {
    width: 42px; height: 42px; border-radius: 50%; border: 0; cursor: pointer;
    display: grid; place-items: center; font-size: 17px;
    background: rgba(255,255,255,.07); color: #F3E9DC; text-decoration: none;
    transition: background .2s, transform .2s;
}
.libro-boton:hover { background: rgba(255,255,255,.16); }
.libro-boton:active { transform: scale(.94); }
.libro-boton[aria-pressed="false"] { opacity: .6; }
.libro-boton.cerrar { background: rgba(255,255,255,.14); }

/* Escena */
.libro-escena {
    flex: 1; min-height: 0; position: relative;
    display: flex; align-items: center; justify-content: center;
    perspective: 2400px;
}
.libro-marco {
    position: relative; touch-action: none; cursor: grab;
    transform-style: preserve-3d;
}
.libro-marco.arrastrando { cursor: grabbing; }
.libro-marco.ampliado { cursor: move; }

/* Pila de hojas a la derecha y lomo a la izquierda */
.libro-pila {
    position: absolute; top: 4px; bottom: 4px; right: -1px; width: 0;
    box-shadow:
        2px 0 0 #efe7db, 3px 1px 0 #d8ccbb,
        5px 0 0 #efe7db, 6px 1px 0 #d8ccbb,
        8px 0 0 #efe7db, 9px 1px 0 #cdbfac;
    border-radius: 0 3px 3px 0; transition: box-shadow .4s;
}
.libro-marco[data-restantes="2"] .libro-pila { box-shadow: 2px 0 0 #efe7db, 3px 1px 0 #d8ccbb, 5px 0 0 #efe7db, 6px 1px 0 #cdbfac; }
.libro-marco[data-restantes="1"] .libro-pila { box-shadow: 2px 0 0 #efe7db, 3px 1px 0 #cdbfac; }
.libro-marco[data-restantes="0"] .libro-pila { box-shadow: none; }

.libro-hoja {
    position: absolute; inset: 0; border-radius: 2px 6px 6px 2px; background: #fff;
    overflow: hidden;
}
.libro-hoja.base { box-shadow: 0 30px 60px -20px rgba(0,0,0,.7), 0 10px 22px -10px rgba(0,0,0,.6); }
.libro-hoja img { width: 100%; height: 100%; object-fit: contain; pointer-events: none; -webkit-user-drag: none; }
.libro-zoom { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; }
.libro-lomo {
    position: absolute; left: 0; top: 0; bottom: 0; width: 26px; pointer-events: none; z-index: 2;
    background: linear-gradient(90deg, rgba(0,0,0,.22), rgba(0,0,0,.04) 45%, rgba(255,255,255,.12) 70%, rgba(0,0,0,0));
}
.libro-sombra {
    position: absolute; inset: 0; pointer-events: none; opacity: 0; z-index: 3;
    background: linear-gradient(90deg, rgba(0,0,0,.55) 0%, rgba(0,0,0,.18) 30%, rgba(0,0,0,0) 65%);
}

/* Hoja que gira */
.libro-hoja.giro {
    overflow: visible; background: transparent; z-index: 5;
    transform-origin: left center; transform-style: preserve-3d;
    display: none; will-change: transform;
}
.libro-hoja.giro.activa { display: block; }
.libro-cara {
    position: absolute; inset: 0; overflow: hidden; border-radius: 2px 6px 6px 2px;
    -webkit-backface-visibility: hidden; backface-visibility: hidden;
}
.libro-cara.frente { background: #fff; box-shadow: 0 20px 40px -18px rgba(0,0,0,.6); }
.libro-cara.dorso {
    transform: rotateY(180deg);
    background: #f4ede3;
    box-shadow: 0 20px 40px -18px rgba(0,0,0,.6);
}
.libro-cara.dorso img { opacity: .07; transform: scaleX(-1); filter: grayscale(1); }
.libro-cara .libro-brillo {
    position: absolute; inset: 0; pointer-events: none; opacity: 0;
    background: linear-gradient(90deg, rgba(255,255,255,0) 40%, rgba(255,255,255,.35) 78%, rgba(0,0,0,.22) 100%);
}
.libro-cara.dorso .libro-brillo { background: linear-gradient(270deg, rgba(0,0,0,.25), rgba(0,0,0,0) 40%); }

/* Flechas */
.libro-flecha {
    position: absolute; top: 50%; transform: translateY(-50%); z-index: 10;
    width: 52px; height: 52px; border-radius: 50%; border: 0; cursor: pointer;
    background: rgba(255,255,255,.1); color: #fff; font-size: 18px;
    display: grid; place-items: center; transition: background .2s, opacity .2s;
}
.libro-flecha:hover { background: rgba(255,255,255,.2); }
.libro-flecha[disabled] { opacity: 0; pointer-events: none; }
.libro-flecha.ant { left: 18px; }
.libro-flecha.sig { right: 18px; }
@media (max-width: 720px), (pointer: coarse) {
    .libro-flecha { display: none; }
}

/* Carga y error */
.libro-cargando {
    position: absolute; inset: 0; z-index: 8; display: flex; flex-direction: column; gap: 14px;
    align-items: center; justify-content: center; background: #fbf8f3; color: #6b5a50;
    font-size: 14px; text-align: center; padding: 20px; border-radius: 2px 6px 6px 2px;
}
.libro-cargando[hidden] { display: none; }
.libro-giro-icono {
    width: 34px; height: 34px; border-radius: 50%;
    border: 3px solid rgba(184,138,53,.25); border-top-color: #B88A35;
    animation: libro-girar .9s linear infinite;
}
@keyframes libro-girar { to { transform: rotate(360deg); } }
.libro-cargando a { color: #B88A35; font-weight: 600; }

/* Pie */
.libro-pie {
    flex: none; display: flex; flex-direction: column; align-items: center; gap: 8px;
    padding: 12px 12px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
}
.libro-puntos { display: flex; gap: 8px; }
.libro-punto {
    width: 8px; height: 8px; border-radius: 999px; border: 0; padding: 0; cursor: pointer;
    background: rgba(255,255,255,.28); transition: width .3s, background .3s;
}
.libro-punto.activo { width: 24px; background: #D7AE5E; }
.libro-ayuda { font-size: 12px; opacity: .6; text-align: center; transition: opacity .6s; }
.libro-ayuda.oculta { opacity: 0; }

@media (max-width: 460px) {
    .libro-titulo { display: none; }
    .libro-contador { padding-left: 8px; }
    .libro-boton { width: 40px; height: 40px; font-size: 16px; }
}

/* Accesibilidad: sin animaciones */
@media (prefers-reduced-motion: reduce) {
    .libro, .libro.abierto { transition: none; }
}
html.libro-bloqueo, html.libro-bloqueo body { overflow: hidden; overscroll-behavior: none; }
