/* ── Botón nav "Ver en 3D" ─────────────────────── */
#b3d-nav-btn {
    height: 36px;
    padding: 0 16px;
    margin: 9px 0px 0px 10px;
    background: #DEB900;
    color: #373435;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    border-radius: 3px;
    border: none;
    cursor: pointer;
    outline: none;
    position: relative;
    float: left;
    line-height: 36px;
    white-space: nowrap;
}
#b3d-nav-btn:hover {
    background: #c7a500;
}

/* ── Tutorial tip ──────────────────────────────── */
.b3d-tutorial-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000000001;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .24s ease;
}
.b3d-tutorial-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 14, .58);
}
.b3d-tutorial-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}
.b3d-tutorial-card {
    position: relative;
    width: min(92vw, 430px);
    margin: 20px;
    padding: 22px 22px 20px;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, .25);
    color: #373435;
    overflow: hidden;
    font-family: 'Brandon Sans Serif', 'Brandon Sans', 'Brandon Grotesque', 'Helvetica Neue', Arial, sans-serif;
}
.b3d-tutorial-badge {
    display: inline-block;
    margin-bottom: 14px;
    padding: 6px 10px;
    border-radius: 999px;
    background: #f7e7a1;
    color: #8f7300;
    font-size: 12px;
    font-weight: 700;
    letter-spacing: .6px;
    text-transform: uppercase;
}
.b3d-tutorial-card h3 {
    margin: 0 0 12px;
    font-size: 20px;
    line-height: 1.2;
    color: #252525;
}
.b3d-tutorial-card p {
    margin: 0 0 12px;
    font-size: 16px;
    line-height: 1.55;
    color: #4a4a4a;
}
.b3d-tutorial-note {
    margin: 0 0 18px;
    padding: 12px 14px;
    background: #f8f8f8;
    border-left: 4px solid #DEB900;
    border-radius: 8px;
    font-size: 16px;
    line-height: 1.5;
    color: #555;
}
.b3d-tutorial-ok {
    min-width: 130px;
    height: 38px;
    padding: 0 18px;
    border: none;
    border-radius: 6px;
    background: #DEB900;
    color: #373435;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .4px;
    cursor: pointer;
    float: right;
}
.b3d-tutorial-ok:hover {
    background: #c7a500;
}
.b3d-tutorial-close {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 30px;
    height: 30px;
    border: none;
    border-radius: 50%;
    background: transparent;
    color: #797979;
    font-size: 24px;
    line-height: 30px;
    cursor: pointer;
}
.b3d-tutorial-close:hover {
    color: #252525;
}

/* ── Backdrop ──────────────────────────────────── */
/* backdrop-filter NO puede estar en el mismo elemento que preserve-3d children
   (aplana el 3D en Chrome/Safari). Se mueve a ::before pseudo-elemento. */
.b3d-backdrop {
    position: fixed;
    inset: 0;
    z-index: 10000000000;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity .3s;
}
.b3d-backdrop::before {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(10, 10, 14, .82);
    backdrop-filter: blur(4px);
    z-index: -1;
    transition: background .25s ease;
}
/* Portadas oscuras: superficie clara para conservar su silueta y profundidad. */
.b3d-backdrop.b3d-contrast-light::before {
    background: rgba(241, 244, 247, .93);
}
.b3d-backdrop.open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Stage 3D ──────────────────────────────────── */
.b3d-stage {
    perspective: 1400px;
    perspective-origin: 50% 42%;
}

/* ── Book container (closed box) ────────────────── */
/* IMPORTANTE: filter/backdrop-filter NUNCA van aquí — aplana preserve-3d */
.b3d-book {
    position: relative;
    transform-style: preserve-3d;
    /* Base 3/4 vista: 6° arriba + 30° giro hacia la izquierda → revela portada + lomo izquierdo.
       --b3d-rotY se ajusta por JS durante el drag. */
    transform: rotateX(6deg) rotateY(calc(30deg + var(--b3d-rotY, 0deg))) scale(.7);
    transition: transform .6s cubic-bezier(.22, 1, .36, 1);
    /* Sin sombra — filter sobre preserve-3d destruye la 3D */
}
.b3d-book.folded {
    transform: rotateX(6deg) rotateY(calc(30deg + var(--b3d-rotY, 0deg))) scale(1);
}

/* ── Panels (absolute, centered by JS margins) ─── */
.b3d-panel {
    position: absolute;
    top: 50%;
    left: 50%;
    background-repeat: no-repeat;
    background-color: #fff;
    backface-visibility: hidden;
    box-shadow: 0 0 0 1px rgba(255, 255, 255, .28), 0 10px 24px rgba(0, 0, 0, .18);
}
.b3d-contrast-light .b3d-panel {
    box-shadow: 0 0 0 1px rgba(20, 30, 40, .35), 0 10px 24px rgba(20, 30, 40, .2);
}

/* Frente (portada) — mira al viewer, adelantada depth/2 */
.b3d-panel.front {
    transform: translateZ(calc(var(--b3d-depth, 20px) / 2));
}

/* Lomo (spine lateral izquierdo) — perpendicular, borde a la izquierda */
/* rotateY(-90deg) mapea +Z local → −X world; translateZ(coverW/2) la lleva
   al borde izquierdo de la portada. Grosor = depth = ancho del lomo. */
.b3d-panel.spine {
    transform: rotateY(-90deg) translateZ(calc(var(--b3d-coverW, 100px) / 2));
}

/* Contraportada (back) — paralela a la portada, detrás */
.b3d-panel.back {
    transform: rotateY(180deg) translateZ(calc(var(--b3d-depth, 20px) / 2));
}

/* ── Close button ──────────────────────────────── */
.b3d-close {
    position: fixed;
    top: 20px;
    right: 24px;
    z-index: 10000000001;
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 50%;
    background: #DEB900;
    color: #373435;
    font-size: 22px;
    cursor: pointer;
    transition: background .2s;
}
.b3d-close:hover {
    background: #c7a500;
}
