/* Book Flip CSS */
:root {
    --book-perspective: 1800px;
    --book-transition: transform 1s cubic-bezier(0.645, 0.045, 0.355, 1);
    --book-bg: #f8f9fa;
}

.book-container {
    width: 50%;
    max-width: 1000px;
    margin: 2rem auto;
    perspective: var(--book-perspective);
    display: flex;
    justify-content: center;
    align-items: center;
}

.book {
    width: 100%;
    aspect-ratio: 2 / 1;
    /* 2:1 spread makes each page 1:1 (square) */
    position: relative;
    transform-style: preserve-3d;
    transition: var(--book-transition);
}

.page {
    width: 50%;
    height: 100%;
    position: absolute;
    right: 0;
    top: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: var(--book-transition);
    z-index: 1;
    cursor: pointer;
}

.page-front,
.page-back {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    background-color: #fff;
    display: flex;
    justify-content: center;
    align-items: center;
    overflow: hidden;
}

/* Gutter Shadow Effect */
.page-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(to right, rgba(48, 46, 46, 0.25) 0%, rgba(44, 40, 40, 0) 100%);
    pointer-events: none;
    z-index: 2;
}

.page-back::after {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 100px;
    height: 100%;
    background: linear-gradient(to left, rgba(0, 0, 0, 0.25) 0%, rgba(0, 0, 0, 0) 100%);
    pointer-events: none;
    z-index: 2;
}

/* Spine Line */
.book::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    width: 2px;
    height: 100%;
    background: rgba(0, 0, 0, 0.3);
    transform: translateX(-50%);
    z-index: 10;
    pointer-events: none;
}

/* Page Depth Shadow */
.page {
    box-shadow: 5px 10px 30px rgba(0, 0, 0, 0.3);
}

.page-back {
    transform: rotateY(180deg);
}

.page img {
    width: 98%;
    height: 98%;
    object-fit: cover;
    background: #fff;
    pointer-events: none;
    user-select: none;
    -webkit-user-drag: none;
}

.page-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 5;
    background: transparent;
}

.page.flipped {
    transform: rotateY(-180deg);
}

/* Controls */
.book-controls {
    display: flex;
    justify-content: center;
    gap: 1rem;
    margin-top: 1rem;
}

.book-controls .btn {
    border-radius: 50px;
    padding: 0.5rem 1.5rem;
}

/* Responsive */
@media (max-width: 768px) {
    .book-container {
        width: 100%;
        height: auto;
        min-height: 200px;
    }

    .book {
        width: 100%;
    }
}