/* 1. Main Container with Background Image Support */
.flipbook-wrapper {
    width: 100%;
    max-width: 100vw; 
    margin: 40px auto;
    /* Desktop padding provides 'neutral zone' for shadows */
    padding: 80px 40px; 
    background-color: #0a0a0a; 
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    position: relative;
    overflow: hidden; 
    box-sizing: border-box; 
    display: flex;
    flex-direction: column;
    align-items: center;
    
    border: 1px solid rgba(212, 175, 55, 0.15);
    background-clip: padding-box; 
    box-shadow: 0 30px 60px rgba(0,0,0,0.8);
}

/* 2. Dark Overlay for Background Image */
.flipbook-wrapper::before {
    content: '';
    position: absolute;
    top: -1px; left: -1px; right: -1px; bottom: -1px; 
    background: rgba(0, 0, 0, 0.7); 
    z-index: 1;
    pointer-events: none;
}

/* 3. The Spread Viewport */
#flipbook-viewport {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: flex-start;
    gap: 2px; 
    width: 100%;
    max-width: 100%;
    padding: 30px 0;
    overflow: visible; 
    touch-action: pan-y; 
}

/* 4. Individual Pages */
canvas {
    width: 46%; /* Desktop default */
    max-width: 48%;
    height: auto !important;
    background: white;
    z-index: 5;
    transition: transform 0.3s ease;
    
    /* THE RIM LIGHT border */
    border: 1px solid rgba(255, 255, 255, 0.25);
    
    /* DEEP LIFT SHADOW */
    box-shadow: 
        0 30px 70px rgba(0, 0, 0, 0.95), 
        0 0 20px rgba(255, 255, 255, 0.1);
    
    user-select: none;
    -webkit-user-drag: none;
}

/* Define the Spine (The center fold) */
#canvas-left {
    box-shadow: 
        inset -15px 0 30px rgba(0,0,0,0.2), 
        5px 0 20px rgba(0,0,0,0.5),          
        0 10px 40px rgba(0,0,0,0.9);
    border-right: 1px solid rgba(0,0,0,0.2);
}

#canvas-right {
    box-shadow: 
        inset 15px 0 30px rgba(0,0,0,0.2),  
        0 10px 40px rgba(0,0,0,0.9);
}

/* 5. Bespoke Controls */
.flipbook-controls {
    position: relative;
    z-index: 2;
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 30px;
    margin-top: 40px; 
    font-family: 'Montserrat', sans-serif;
    width: 100%;
}

.flip-btn {
    background: rgba(255,255,255,0.05);
    border: 1px solid rgba(212, 175, 55, 0.5);
    color: #D4AF37;
    padding: 10px 20px;
    cursor: pointer;
    text-transform: uppercase;
    letter-spacing: 2px;
    font-size: 0.7rem;
    transition: all 0.3s ease;
}

.flip-btn:hover {
    background: #D4AF37;
    color: #000;
}

.page-info {
    font-size: 0.8rem;
    color: #888;
    letter-spacing: 1px;
    text-transform: uppercase;
    white-space: nowrap; /* Prevents splitting into two lines */
}

/* 6. RESPONSIVE MOBILE FIXES */
@media (max-width: 768px) {
    .flipbook-wrapper {
        padding: 40px 10px; /* Reduce padding so book can grow */
    }

    #flipbook-viewport {
        padding: 15px 0;
    }

    canvas {
        width: 49%; /* Scale book back up for mobile visibility */
        box-shadow: 0 10px 25px rgba(0,0,0,0.9); /* Subtler shadow for smaller screens */
    }

    .flipbook-controls {
        gap: 15px; /* Tighten button spacing */
        margin-top: 25px;
    }

    .page-info {
        font-size: 0.65rem; /* Shrink font to ensure it fits the row */
        letter-spacing: 0.5px;
    }

    .flip-btn {
        padding: 8px 12px;
    }
}
