/* index.css */

.book-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    /* Changed align-items to start so all books align to the top */
    align-items: start;
    gap: 4rem 2rem;
    padding: 0 20px;
}

.book {
    display: flex;
    flex-direction: column;
    text-decoration: none;
    color: inherit;
    transition: transform 0.3s ease;
}

.book:hover { transform: translateY(-10px); }

.book img {
    width: 100%; 
    height: auto;
    box-shadow: 5px 15px 30px rgba(0,0,0,0.15);
}

.book-title {
    margin-top: 1.2rem;
    font-size: 1.5rem;
    text-align: center;
    font-weight: 500;
}

.portrait { grid-column: span 1; }
.landscape { grid-column: span 2; }

/* Desktop Stacking & Specific Row Height Logic */
@media (min-width: 1025px) {
    .book-grid {
        /* Row 1 is auto-height; Row 2 is tall enough for 2 landscapes */
        grid-template-rows: auto minmax(550px, auto); 
    }
    
    /* Top Landscape */
    .book:nth-child(7) {
        grid-column: 3 / 5;
        grid-row: 2;
        align-self: start;
        margin-bottom: 4rem; 
    }
    
    /* Bottom Landscape */
    .book:nth-child(8) {
        grid-column: 3 / 5;
        grid-row: 2;
        align-self: end;
    }
}

/* --- OTHER DEVICES (Untouched) --- */
@media (max-width: 1024px) {
    .book-grid { 
        grid-template-columns: repeat(3, 1fr);
        align-items: end; /* Keeping original alignment for other devices */
    }
}

@media (max-width: 650px) {
    .book-grid { 
        grid-template-columns: repeat(2, 1fr); 
        gap: 2rem 1rem; 
        align-items: end; /* Keeping original alignment for other devices */
    }
    .landscape { grid-column: span 2; }
}