/* 3D Menu Book Stylesheet */

.book-section {
    padding: 80px 0;
    background: radial-gradient(circle at center, #161920 0%, #0a0b0d 100%);
    overflow: hidden;
    position: relative;
}

.book-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    position: relative;
    width: 100%;
    min-height: 650px;
    perspective: 2000px; /* Crucial for 3D depth effect */
}

/* The actual book container */
.menu-book {
    position: relative;
    width: 900px;
    height: 580px;
    transition: transform 0.6s ease;
    transform-style: preserve-3d;
    box-shadow: 0 30px 60px rgba(0, 0, 0, 0.7);
}

/* Book Cover background / Leather design */
.page-face.cover-side {
    background: radial-gradient(circle at center, #ffd633 0%, #ff5522 55%, #b30030 100%) !important;
    box-shadow: inset 0 0 35px rgba(0, 0, 0, 0.75) !important;
    border: 5px solid var(--gold) !important;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 40px;
    text-align: center;
    border-radius: 4px;
    position: relative;
}

.cover-side::after {
    content: '';
    position: absolute;
    top: 15px;
    bottom: 15px;
    left: 15px;
    right: 15px;
    border: 1px solid var(--gold);
    pointer-events: none;
    opacity: 0.7;
}

.cover-title {
    font-size: 40px;
    color: var(--gold-light);
    text-transform: uppercase;
    font-family: var(--font-heading);
    margin-bottom: 20px;
    text-shadow: 0 3px 6px rgba(0,0,0,0.8);
}

.cover-subtitle {
    font-size: 16px;
    color: var(--text-white);
    letter-spacing: 3px;
    text-transform: uppercase;
    margin-bottom: 30px;
}

.cover-emboss {
    width: 80px;
    height: 80px;
    margin-bottom: 20px;
    border: 2px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gold);
    font-size: 32px;
}

/* A single Page block (which holds front & back sheet) */
.book-page {
    position: absolute;
    width: 450px; /* Exactly half of the book width */
    height: 580px;
    top: 0;
    right: 0;
    transform-origin: left center;
    transform-style: preserve-3d;
    transition: transform 0.8s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
    cursor: pointer;
}

/* The front and back of each page card */
.page-face {
    position: absolute;
    width: 100%;
    height: 100%;
    top: 0;
    left: 0;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    padding: 45px 35px;
    overflow: hidden;
    background-color: #fcfaf2; /* Soft rich parchment paper */
    box-shadow: inset 3px 0 20px rgba(0, 0, 0, 0.08);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
}

/* Shadow effect to create a 3D gutter line down the center */
.page-face.face-front::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 15px;
    height: 100%;
    background: linear-gradient(to right, rgba(0,0,0,0.15) 0%, rgba(0,0,0,0) 100%);
    pointer-events: none;
}

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

/* Back of the page card is rotated 180deg */
.face-back {
    transform: rotateY(180deg);
}

/* Page states */
.book-page.flipped {
    transform: rotateY(-180deg);
}

/* Page content elements */
.page-header {
    border-bottom: 1px solid rgba(212, 175, 55, 0.25);
    padding-bottom: 10px;
    margin-bottom: 15px;
    text-align: center;
}

.page-header h3 {
    color: #4a1515; /* Matching maroon headers */
    font-size: 26px;
    font-family: var(--font-heading);
    letter-spacing: 1px;
}

.page-body {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
}

.page-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-top: 1px solid rgba(212, 175, 55, 0.15);
    padding-top: 10px;
    color: #8b7355;
    font-size: 13px;
    font-weight: 500;
}

.page-footer .page-number {
    font-weight: bold;
}

/* Table of Contents style */
.toc-list {
    list-style: none;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    margin-top: 10px;
}

.toc-item {
    font-family: var(--font-heading);
    font-size: 18px;
    color: #4a1515;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 6px;
}

.toc-item:hover {
    color: var(--gold-dark);
    transform: translateX(3px);
}

/* Menu items listing style */
.menu-items-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 8px;
    margin-top: 5px;
}

.menu-item-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    font-size: 15px;
    color: #2b2b2b;
    border-bottom: 1px dashed rgba(139, 115, 85, 0.2);
    padding-bottom: 4px;
}

.menu-item-name {
    font-weight: 500;
}

/* Book Controls / Navigation buttons */
.book-controls {
    display: flex;
    gap: 20px;
    margin-top: 40px;
    z-index: 5;
}

.control-btn {
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-white);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 20px;
    transition: var(--transition);
    box-shadow: var(--shadow);
}

.control-btn:hover {
    background: var(--gold-gradient);
    color: var(--bg-dark);
    border-color: transparent;
    transform: scale(1.1);
}

/* Page Corner Turn Indicator */
.page-corner-indicator {
    position: absolute;
    width: 30px;
    height: 30px;
    bottom: 0;
    right: 0;
    background: linear-gradient(135deg, transparent 50%, rgba(212, 175, 55, 0.3) 100%);
    border-bottom-right-radius: 4px;
    pointer-events: none;
    transition: var(--transition);
}

.book-page:hover .page-corner-indicator {
    background: linear-gradient(135deg, transparent 50%, rgba(212, 175, 55, 0.6) 100%);
}

/* Mobile responsive handling for 3D Book */
@media (max-width: 991px) {
    .menu-book {
        width: 700px;
        height: 500px;
    }
    .book-page {
        width: 350px;
        height: 500px;
    }
    .page-face {
        padding: 30px 25px;
    }
    .cover-title {
        font-size: 30px;
    }
    .page-header h3 {
        font-size: 22px;
    }
    .menu-item-row {
        font-size: 13px;
    }
}

@media (max-width: 767px) {
    /* Switch to single page flip orientation */
    .menu-book {
        width: 340px;
        height: 500px;
    }
    .book-page {
        width: 100%;
        height: 100%;
        left: 0; /* Center it */
        transform-origin: center center; /* Flip relative to center */
    }
    .page-face {
        box-shadow: none;
    }
    .toc-list {
        grid-template-columns: 1fr;
    }
}

/* Category header images inside the Menu Book */
.page-img-wrapper {
    width: 100%;
    height: 145px;
    border-radius: 6px;
    overflow: hidden;
    margin-bottom: 15px;
    border: 1px solid rgba(139, 115, 85, 0.25);
    box-shadow: 0 4px 10px rgba(0,0,0,0.06);
}

.page-menu-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: var(--transition);
}

.page-img-wrapper:hover .page-menu-img {
    transform: scale(1.04);
}

/* Cover Logo Emboss */
.cover-emboss-logo {
    width: 140px;
    height: 140px;
    margin-bottom: 20px;
    border: 3px solid var(--gold);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(10, 11, 13, 0.8);
    box-shadow: 0 6px 15px rgba(0,0,0,0.5);
    overflow: hidden;
    transition: var(--transition);
}
.cover-emboss-logo:hover {
    transform: scale(1.05) rotate(5deg);
    border-color: var(--gold-light);
    box-shadow: 0 8px 25px rgba(212, 175, 55, 0.6);
}
.cover-logo-img {
    width: 90%;
    height: 90%;
    object-fit: contain;
}
