/**
 * File Path: assets/css/front/mbs-front-pro-flip.css
 * Flip Layout — flat rules (CSS-002 pattern)
 * Component of mbs-front-pro.css — extracted Session 94.
 * Enqueued by MBS_Front_Assets with dep: mbs-front-pro (PRO tier only).
 */
/* ============================================================================
   FLIP LAYOUT — flat rules (CSS-002 pattern)
   DOM: .mbs-wrapper > .mbs-layout-flip > .mbs-flip-card > .mbs-flip-inner >
        [.mbs-flip-front + .mbs-flip-back]
   ============================================================================ */

/* Grid container */
.mbs-wrapper .mbs-layout-flip {
    display: grid !important;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 24px;
}

/* Card: establishes perspective */
.mbs-wrapper .mbs-layout-flip .mbs-flip-card {
    perspective: 1000px;
    height: 320px;
    cursor: pointer;
    border: none !important;
    background: transparent !important;
    overflow: visible !important;
}

/* Inner rotating element */
.mbs-wrapper .mbs-layout-flip .mbs-flip-inner {
    position: relative;
    width: 100%;
    height: 100%;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    -webkit-transform-style: preserve-3d;
}

/* Flip on hover or focus */
.mbs-wrapper .mbs-layout-flip .mbs-flip-card:hover .mbs-flip-inner,
.mbs-wrapper .mbs-layout-flip .mbs-flip-card:focus .mbs-flip-inner {
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
}

/* Both faces: fill card, hide when facing away */
.mbs-wrapper .mbs-layout-flip .mbs-flip-front,
.mbs-wrapper .mbs-layout-flip .mbs-flip-back {
    position: absolute;
    width: 100%;
    height: 100%;
    -webkit-backface-visibility: hidden;
    backface-visibility: hidden;
    overflow: hidden;
    border-radius: 8px;
    border: 1px solid var(--mbs-border);
}

/* Front: cover image fills the card */
.mbs-wrapper .mbs-layout-flip .mbs-flip-front {
    background: var(--mbs-card-bg);
}

/* Cover renderer wrapper and .mbs-cover must fill full card height */
.mbs-wrapper .mbs-layout-flip .mbs-flip-front > .mbs-wrapper {
    width: 100%;
    height: 100%;
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-front .mbs-cover {
    width: 100%;
    height: 100%;
    display: block;
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-front .mbs-cover img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    display: block;
}

/* Back: book info, rotated 180deg so it starts face-down */
.mbs-wrapper .mbs-layout-flip .mbs-flip-back {
    background: var(--mbs-button-bg);
    color: var(--mbs-button-text);
    transform: rotateY(180deg);
    -webkit-transform: rotateY(180deg);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    border-color: var(--mbs-button-bg);
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-back-content {
    text-align: center;
    width: 100%;
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-back .mbs-book-title {
    font-size: 1rem;
    font-weight: 700;
    margin: 0 0 8px;
    line-height: 1.3;
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-back .mbs-book-title a {
    color: #fff;
    text-decoration: none;
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-back .mbs-book-author {
    font-size: 0.85rem;
    margin: 0 0 8px;
    color: rgba(255, 255, 255, 0.85);
}

.mbs-wrapper .mbs-layout-flip .mbs-flip-back .mbs-book-excerpt {
    font-size: 0.8rem;
    line-height: 1.4;
    margin: 0 0 12px;
    color: rgba(255, 255, 255, 0.9);
}


/* ── Spinning Book Video — Hover-Play Overlay (PRO) ────────────────────────
   Structure: .mbs-wrapper > .mbs-cover-video-hover > img.mbs-cover-img
                                                     + video.mbs-cover-video
   The <img> establishes the cover dimensions at rest.
   The <video> is absolutely positioned to fill the same box.
   JS (MBS.CoverVideo) calls video.play() on mouseenter and
   video.pause()/currentTime=0 on mouseleave.
   CSS transitions handle the opacity cross-fade.
   All rules are flat (no nesting) for broad browser compatibility.
   ─────────────────────────────────────────────────────────────────────── */

.mbs-cover-video-hover {
    position: relative !important;
    display: block !important;
    overflow: hidden;
    cursor: pointer;
}

.mbs-cover-video-hover .mbs-cover-img {
    width: 100% !important;
    height: auto !important;
    display: block !important;
    transition: opacity 0.35s ease;
    position: relative;
    z-index: 1;
}

.mbs-cover-video-hover .mbs-cover-video {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover;
    opacity: 0 !important;
    transition: opacity 0.35s ease;
    z-index: 2;
    pointer-events: none;
}

.mbs-cover-video-hover:hover .mbs-cover-img,
.mbs-cover-video-hover:focus-within .mbs-cover-img {
    opacity: 0 !important;
}

.mbs-cover-video-hover:hover .mbs-cover-video,
.mbs-cover-video-hover:focus-within .mbs-cover-video {
    opacity: 1 !important;
    transition: none; /* CV-001: appear instantly — fade-out handled by default state transition */
}
