/* index.css */

.book-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    align-items: start;
    gap: 4rem 2rem;
    padding: 0 20px;
}

.book {
    display: flex;
    flex-direction: column;
}

.book img {
    width: 100%;
    height: auto;
    box-shadow: 5px 15px 30px rgba(0,0,0,0.15);
    transition: transform 0.3s ease;
}

.book img:hover { transform: translateY(-10px); }

.book-actions {
    display: flex;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.book-actions a {
    font-size: 0.95rem;
    text-decoration: none;
    color: inherit;
    padding: 0.3rem 0.75rem;
    border-radius: 4px;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.2), 0 2px 6px rgba(0,0,0,0.1);
    transition: background-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.book-actions a:hover {
    background-color: #333;
    color: #fff;
    box-shadow: 0 0 0 1px rgba(0,0,0,0.3), 0 4px 10px rgba(0,0,0,0.15);
}

@media (max-width: 650px) {
  .book-actions a {
    font-size: 0.9rem;
    padding: 0.2rem 0.5rem;
  }
}

.portrait { grid-column: span 1; }
.landscape { grid-column: span 2; }

/* Desktop Stacking & Specific Row Height Logic */
@media (min-width: 1025px) {
    .book-grid {
        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 --- */
@media (max-width: 1024px) {
    .book-grid {
        grid-template-columns: repeat(3, 1fr);
        align-items: end;
    }
}

@media (max-width: 650px) {
    .book-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 2rem 1rem;
        align-items: end;
    }
    .landscape { grid-column: span 2; }
}
