/* --- General Reset --- */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}

body {
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: center;
    min-height: 100vh;
    padding-top: 20px;

    /* --- BACKGROUND GIF SETTINGS --- */
    background-color: #111; /* Fallback color */
    background-image: url('black\ and\ white\ falling\ GIF\ by\ Erica\ Anderson.gif'); /* REPLACE THIS with your gif filename */
    background-size: cover; /* Stretches gif to fill screen */
    background-repeat: no-repeat;
    background-attachment: fixed; /* Keeps background still when scrolling */
    background-position: center;
}

/* --- Title Styling --- */
h1 {
    color: #d4af37; /* Gold color */
    font-family: 'Georgia', serif;
    font-size: 48px;
    letter-spacing: 4px;
    margin-bottom: 30px; /* Space between title and bookshelf */
    text-shadow: 0 2px 10px rgba(0,0,0,0.8);
}

/* --- Cupboard Structure --- */
.cupboard {
    /* Dimensions adjusted for the portrait image provided */
    width: 600px;  
    height: 1000px; 
    
    /* Background Image Settings */
    /* IMPORTANT: Make sure 'shelf.jpg' is in the same folder as your HTML and CSS files */
    background-image: url('shelf.png'); 
    background-size: 100% 100%;
    background-position: center;
    background-repeat: no-repeat;
    
    /* PADDING ORDER: Top | Right | Bottom | Left */
    padding: 215px 100px 50px 70px; 
    
    display: flex;
    flex-direction: column;
    /* This gap controls the vertical space between book rows */
    justify-content: flex-start;
    gap: 25px;
    
}

.shelf {
    /* Fixed height for each shelf row */
    height: 135px;
    width: 400px;
    margin-left: 50px;
    display: flex;
    align-items: flex-end; /* Align books to bottom of the shelf */
    padding: 100px 10px 5px 0;
    
    /* Temporary border to help you visualize alignment (remove later) */
    /*border: 4px dashed rgba(255, 255, 255, 0.3);*/
}

/* --- Book Spines --- */
.book-spine {
    width: 15px; /* Slightly thinner for this shelf scale */
    height: 111px; /* Base height */
    margin: 0 1px;
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    transition: transform 0.3s ease;
    box-shadow: 2px 2px 5px rgba(0,0,0,0.6);

    background-size: 100% 100%; /* Stretches image to fill spine exactly */
    background-position: center;
    background-repeat: no-repeat;
    
    /* Text Styling */
    writing-mode: vertical-rl;
    text-orientation: mixed;
    display: flex;
    justify-content: center;
    align-items: center;
    color: #e0e0e0;
    font-size: 12px;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
    overflow: hidden;
    
    /* Old book texture effect */
    border-left: 1px solid rgba(255,255,255,0.15);
    border-right: 1px solid rgba(0,0,0,0.3);
}

.book-spine:hover {
    transform: translateY(-5px) scale(1.05);
    z-index: 10;
    box-shadow: 0 0 15px rgba(255, 215, 0, 0.3); /* Golden glow */
}



/* Book Colors - Darker/Antique Palette */
.color-1 { background: linear-gradient(to right, #3e2723, #5d4037); } /* Dark Brown */
.color-2 { background: linear-gradient(to right, #1a237e, #283593); } /* Deep Blue */
.color-3 { background: linear-gradient(to right, #004d40, #00695c); } /* Deep Green */
.color-4 { background: linear-gradient(to right, #263238, #37474f); } /* Charcoal */
.color-5 { background: linear-gradient(to right, #311b92, #4527a0); } /* Deep Purple */

/* --- Modal Overlay --- */
.modal-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
    z-index: 1000;
    justify-content: center;
    align-items: center;
    flex-direction: column;
    animation: fadeIn 0.4s ease;
}

.modal-content {
    position: relative;
    max-width: 90%;
    max-height: 80vh;
}

.modal-content img {
    max-width: 100%;
    max-height: 80vh;
    border: 8px solid #222;
    border-radius: 4px;
    box-shadow: 0 0 30px rgba(0,0,0,0.8);
}

.close-btn {
    position: absolute;
    top: -40px;
    right: -20px;
    color: #fff;
    font-size: 35px;
    cursor: pointer;
}

.book-title-display {
    color: #d4af37; /* Gold color */
    margin-top: 25px;
    font-family: 'Georgia', serif;
    font-size: 28px;
    letter-spacing: 2px;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}