﻿/* 3D Book Styling 
   Aspect Ratio: 2:3
   Dimensions: 200px x 300px
*/

.book-scene {
    width: 200px;
    height: 300px;
    margin: 0 auto;
    perspective: 1500px; /* Determines the intensity of the 3D effect */
    position: relative;
    z-index: 10;
}

.book {
    width: 100%;
    height: 100%;
    position: relative;
    transform-style: preserve-3d;
    transform: rotateY(-25deg) rotateX(5deg); /* Initial resting position */
    transition: transform 1s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    cursor: pointer;
}

    /* Hover Effect: Show Front */
    .book:hover {
        transform: rotateY(0deg) rotateX(0deg) scale(1.05);
    }

.book__face {
    position: absolute;
    width: 200px;
    height: 300px;
    background-color: #fff;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.1);
}

/* --- Face Positioning --- */

/* Front Cover */
.book__face--front {
    /* Assuming cover.jpg is in the root */
    background: url('cover.jpg') center/cover no-repeat;
    background-color: #0F172A; /* Fallback color */
    transform: rotateY(0deg) translateZ(25px); /* Half of spine width (50px / 2) */
    border-radius: 2px 4px 4px 2px;
}

/* Back Cover */
.book__face--back {
    background-color: #0F172A; /* Dark blue matching theme */
    transform: rotateY(180deg) translateZ(25px);
    border-radius: 4px 2px 2px 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}
    /* Add some text or branding to the back if needed */
    .book__face--back::after {
        content: '';
        display: block;
        width: 80%;
        height: 80%;
        border: 2px solid rgba(255,255,255,0.1);
    }

/* Spine */
.book__face--spine {
    width: 50px; /* Spine Thickness */
    height: 300px;
    background-color: #1e293b; /* Slightly lighter than cover for contrast */
    transform: rotateY(-90deg) translateZ(25px); /* Offset is width of front/back (200px) / 2 ? NO. */
    /* Logic for Spine Position:
       It is a separate plane rotated 90deg.
       Distance from center: Width of the book face (200px) / 2 is NOT correct for spine.
       The spine sits at the LEFT edge of the front face.
       If Front is at Z=25 and Back is at Z=-25 (relative to book center visually), 
       Spine needs to be pushed to the left.
       
       Standard Cube Logic flattened:
       TranslateZ for side face = Width/2. 
       Here 'Width' of the book is 200. 'Depth' is 50.
       Side face (Spine) is at X = -100 (Left edge).
    */
    transform: rotateY(-90deg) translateZ(100px);
    /* Wait, rotateY(-90) makes it face left. TranslateZ pushes it "forward" relative to its own facing. */

    border-radius: 2px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    box-shadow: inset 0 0 20px rgba(0,0,0,0.4);
}

.spine-text {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 2px;
    margin-bottom: 20px;
}

.spine-author {
    writing-mode: vertical-rl;
    text-orientation: mixed;
    font-family: 'Open Sans', sans-serif;
    font-size: 10px;
    opacity: 0.7;
}

/* Right Edge (Pages) */
.book__face--right {
    width: 50px;
    height: 300px;
    background: linear-gradient(to right, #e2e8f0, #ffffff 10%, #e2e8f0 20%, #ffffff 30%, #e2e8f0 40%, #ffffff 50%, #e2e8f0 60%, #ffffff 70%, #e2e8f0 80%, #ffffff 90%, #e2e8f0);
    transform: rotateY(90deg) translateZ(100px);
}

/* Top Edge */
.book__face--top {
    width: 200px;
    height: 50px;
    background-color: #f1f5f9;
    transform: rotateX(90deg) translateZ(25px);
}

/* Bottom Edge */
.book__face--bottom {
    width: 200px;
    height: 50px;
    background-color: #f1f5f9;
    transform: rotateX(-90deg) translateZ(275px); /* 300 height - 25 offset */
    box-shadow: 0 10px 30px rgba(0,0,0,0.3); /* Shadow for the book on the 'table' */
}
