/* Book */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Georgia', serif;
    background: linear-gradient(135deg, #2c3e50 0%, #34495e 100%);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.container {
    perspective: 1500px;
    transform-style: preserve-3d;
}

.book-wrapper {
    position: relative;
    width: 320px;
    height: 420px;
    cursor: pointer;
    transition: transform 0.6s ease;
}

.book {
    position: relative;
    width: 100%;
    height: 100%;
    transform-style: preserve-3d;
    transition: all 1s ease;
    transform: rotateY(-15deg) rotateX(5deg);
}

.book-wrapper:hover .book {
    transform: rotateY(-5deg) rotateX(2deg);
}

/* Spine */
.book-spine {
    position: absolute;
    width: 20px;
    height: 420px;
    left: -30px;
    top: 0;
    background: linear-gradient(180deg, #1a252f 0%, #2c3e50 50%, #34495e 100%);
    transform-origin: right center;
    transform: rotateY(90deg);
    z-index: 1;
    border-radius: 4px 0 0 4px;
    box-shadow: inset -3px 0 8px rgba(0,0,0,0.3);
}

/* Front Cover */
.front-cover {
    position: absolute;
    width: 330px;
    height: 420px;
    left: -10px;
    top: 0;
    background: linear-gradient(145deg, #2c3e50, #34495e);
    border-radius: 0 8px 8px 0;
    transform-origin: 0px center;
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    z-index: 100;  /* Highest - covers everything */
    box-shadow: 
        8px 8px 25px rgba(0,0,0,0.4),
        inset -3px 0 8px rgba(0,0,0,0.3);
}

/* Cover opens */
.book-wrapper:hover .front-cover {
    transform: rotateY(-165deg) translateY(-3px) translateZ(8px);
    transition-delay: 0.3s;
    z-index: 5;  /* Moves behind after opening */
}

.front-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -15px;
    width: 15px;
    height: 100%;
    background: linear-gradient(90deg, #0f1419, #1a252f, #2c3e50);
    border-radius: 6px 0 0 6px;
    transform-origin: -20px center;
    transform: rotateY(-90deg);
    box-shadow: inset 0 0 12px rgba(0,0,0,0.6);
}

.front-cover::after {
    content: '';
    position: absolute;
    top: 0;
    left: -10px;
    width: 10px;
    height: 100%;
    background: linear-gradient(90deg, #1a252f, #2c3e50);
    border-radius: 4px 0 0 4px;
}

.cover-content {
    padding: 70px 45px;
    text-align: center;
    color: #ecf0f1;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    position: relative;
    z-index: 2;
    margin-left: 10px;
}

.cover-content h1 {
    font-size: 2.4em;
    font-weight: bold;
    margin-bottom: 15px;
    text-shadow: 3px 3px 6px rgba(0,0,0,0.6);
    background: linear-gradient(135deg, #ecf0f1, #bdc3c7);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.cover-content h2 {
    font-size: 2em;
    font-style: italic;
    color: #f39c12;
    margin-bottom: 25px;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.6);
    background: linear-gradient(135deg, #f39c12, #e67e22);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.decorative-line {
    width: 100px;
    height: 3px;
    background: linear-gradient(90deg, transparent, #f39c12, transparent);
    margin: 25px auto;
    border-radius: 2px;
    box-shadow: 0 2px 4px rgba(243, 156, 18, 0.3);
}

.cover-content p {
    font-size: 1.2em;
    color: #bdc3c7;
    text-transform: uppercase;
    letter-spacing: 3px;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.5);
}


/* Navigation Right Page */
.navigation-page-right {
    position: absolute;
    width: 320px;
    height: 420px;
    left: 0;           /* Start at same position as left page */
    top: 0;
    background: linear-gradient(135deg, #ffffff, #fefefe);
    border-radius: 0 6px 6px 0;  
    transform: translateZ(-6px);
    z-index: 39;       /* Behind left navigation page */
    opacity: 1;
    transition: all 1.5s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    box-shadow: 
        inset -8px 0 15px rgba(0,0,0,0.1),
        2px 2px 8px rgba(0,0,0,0.15);
        border: 1px solid rgba(0,0,0,0.05);
}

/* Right page moving */
.book-wrapper:hover .navigation-page-right {
    left: 318px;      /* Move to right side */
    border-radius: 6px 0 0 6px;  /* Flip border radius */
    box-shadow: 
        inset 8px 0 15px rgba(0,0,0,0.1),   /* Flip shadow */
        -2px 2px 8px rgba(0,0,0,0.15);
    transition-delay: 0.3s;
    z-index: 5;
}
.book-wrapper:hover .navigation-page-right::before {
    border-radius: 6px 0 0 6px;
    transition-delay: 1.8s;
}

/* Navigation left Page */
.navigation-page-left {

    background: linear-gradient(135deg, #ffffff, #fefefe);
    border-radius: 0 6px 6px 0;  
    z-index: 70;       /* Behind left navigation page */
    opacity: 1;
    box-shadow: 
        inset -8px 0 15px rgba(0,0,0,0.1),
        2px 2px 8px rgba(0,0,0,0.15);
    border: 1px solid rgba(0,0,0,0.05);
}
.book-wrapper:hover .navigation-page-left::before {
    border-radius: 6px 0 0 6px;
    transition-delay: 1.8s;
}

/* Book summary paper texture */

.navigation-page-left::before,
.navigation-page-right::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image: 
        repeating-linear-gradient(
            0deg,
            transparent,
            transparent 28px,
            rgba(0,0,0,0.03) 29px
        );
    border-radius: 0 6px 6px 0;
    pointer-events: none;
    z-index: 1;
    transition: all 1.5s ease;
}

/* Page content styling */
.page-content {
    padding: 50px 40px;
    position: relative;
    z-index: 2;
    height: 100%;
    color: #2c3e50;
}

/* Table of Contents style heading */
.page-content h3 {
    color: #2c3e50;
    font-size: 1.8em;
    font-weight: normal;
    margin-bottom: 35px;
    text-align: center;
    font-style: italic;
    position: relative;
}

.page-content h3::after {
    content: '';
    position: absolute;
    bottom: -10px;
    left: 50%;
    width: 60px;
    height: 1px;
    background: #34495e;
    transform: translateX(-50%);
}

/* Book summary navigation list */
.menu {
    list-style: none;
    padding-top: 20px;
}

.menu li {
    margin-bottom: 20px;
    border-bottom: 1px dotted rgba(52, 73, 94, 0.3);
    padding-bottom: 12px;
}

/* Book summary style links */
.menu a {
    color: #2c3e50;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: normal;
    transition: all 0.3s ease;
    display: flex;
    justify-content: flex-start;
    align-items: center;
    padding: 12px 8px; 
    width: 100%;
    position: relative;
    border-bottom: 2px solid transparent; 
}

.menu a::after {
    content: '';
    font-size: 0.9em;
    color: #7f8c8d;
    font-weight: normal;
}

.menu a:hover {
    color: #296dec;
    transform: translateX(1px);
    text-decoration: underline;
    text-decoration-thickness: 2px;
    background: linear-gradient(90deg, transparent, rgba(230, 126, 34, 0.08), transparent);
}
.menu a:hover::before {
    content: '';
    position: absolute;
    bottom: 10px;
    left: 0px;
    right: 0px;
    height: 2px;
    background: #296dec;
    transform-origin: left;
    animation: underlineExpand 0.3s ease forwards;
}

@keyframes underlineExpand {
    to {
        transform: scaleX(1);
    }
}

.menu a:hover::after {
    color: #296dec;
}


/* Better visual feedback for menu items */
.menu li {
    margin-bottom: 20px;
    padding-bottom: 12px;
    transition: all 0.3s ease;
}

.menu li:hover {
    border-bottom: 1px dotted rgba(230, 126, 34, 0.5);
}


/* Weight pages for thickness */
.pages-weight {
    position: absolute;
    width: 320px;
    height: 420px;
    left: 0;
    top: 0;
    z-index: 0;
}

.weight-page {
    position: absolute;
    width: 100%;
    height: 100%;
    border-radius: 0 6px 6px 0;
    border: 1px solid rgba(0,0,0,0.1);
}

.weight-page-1 {
    background: linear-gradient(135deg, #f8f9fa, #f1f2f3);
    transform: translateZ(-8px);
    box-shadow: 
        inset -10px 0 15px rgba(0,0,0,0.15),
        3px 3px 10px rgba(0,0,0,0.25);
}

.weight-page-2 {
    background: linear-gradient(135deg, #f1f2f3, #e9ecef);
    transform: translateZ(-10px);
    box-shadow: 
        inset -12px 0 18px rgba(0,0,0,0.2),
        4px 4px 12px rgba(0,0,0,0.3);
}

.weight-page-3 {
    background: linear-gradient(135deg, #e9ecef, #dee2e6);
    transform: translateZ(-12px);
    box-shadow: 
        inset -15px 0 20px rgba(0,0,0,0.25),
        5px 5px 15px rgba(0,0,0,0.35);
}

/* Back Cover */
.back-cover {
    position: absolute;
    width: 320px;
    height: 420px;
    left: 0;
    top: 0;
    background: linear-gradient(145deg, #1a252f, #2c3e50);
    border-radius: 0 6px 6px 0;
    transform: translateZ(-14px);
    z-index: 20;
    box-shadow: 
        -8px 0 20px rgba(0,0,0,0.4),
        inset 3px 0 8px rgba(0,0,0,0.3);
}

.back-cover::before {
    content: '';
    position: absolute;
    top: 0;
    left: -8px;
    width: 8px;
    height: 100%;
    background: linear-gradient(90deg, #0f1419, #1a252f);
    border-radius: 4px 0 0 4px;
    transform-origin: right center;
    transform: rotateY(-90deg);
    box-shadow: inset 0 0 10px rgba(0,0,0,0.6);
}

/* Loading Animation */
@keyframes bookEntrance {
    0% {
        transform: rotateY(-90deg) rotateX(25deg) translateY(80px);
        opacity: 0;
    }
    50% {
        transform: rotateY(-30deg) rotateX(15deg) translateY(20px);
        opacity: 0.7;
    }
    100% {
        transform: rotateY(-15deg) rotateX(5deg) translateY(0);
        opacity: 1;
    }
}

.book {
    animation: bookEntrance 2s cubic-bezier(0.25, 0.46, 0.45, 0.94);
}

/* Light reflection */
.book-wrapper::before {
    content: '';
    position: absolute;
    top: -10%;
    left: -20%;
    width: 140%;
    height: 120%;
    background: radial-gradient(ellipse at center, rgba(255,255,255,0.1) 0%, transparent 70%);
    pointer-events: none;
    z-index: 300;
    opacity: 0;
    transition: opacity 0.8s ease;
}

.book-wrapper:hover::before {
    opacity: 1;
}

/* Responsive Design */
@media (max-width: 768px) {
    .book-wrapper {
        width: 280px;
        height: 360px;
    }
    
    .front-cover {
        width: 290px;
        left: -5px;
    }
    
    .navigation-page-left, .navigation-page-right, .weight-page, .back-cover {
        width: 280px;
        height: 360px;
    }
    
    .book-wrapper:hover .navigation-page-right {
        left: 278px;
    }
    
    .book-spine {
        width: 15px;
        left: -25px;
        height: 360px;
    }
    
    .page-content {
        padding: 35px 25px;
    }
    
    .cover-content {
        padding: 40px 25px;
        margin-left: 5px;
    }
    
    .cover-content h1 {
        font-size: 1.8em;
    }
    
    .cover-content h2 {
        font-size: 1.4em;
    }
    
    .page-content h3 {
        font-size: 1.4em;
        margin-bottom: 25px;
    }
    
    .menu a {
        font-size: 1em;
    }
}
