/* Knjige — listing (books/) */

@keyframes booksFadeIn {
    from { opacity: 0; transform: translateY(24px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes letterFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.books-intro {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.6s ease;
}

.books-intro.books-intro--out {
    opacity: 0;
    pointer-events: none;
}

.books-intro__text {
    font-family: "BrittanySignature", cursive;
    font-size: clamp(36px, 5.2vw, 55px);
    line-height: 1.8;
    color: #fff;
    margin: 0;
    text-align: center;
    padding: 0 20px;
}

.books-intro-letter {
    opacity: 0;
    animation: letterFadeIn 0.25s ease forwards;
}

.books {
    position: relative;
}

.books-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: #000;
    opacity: 0.5;
    z-index: 0;
}

.books.background {
    background: url("../images/books/background.jpg") center no-repeat;
    background-size: cover !important;
}

.books-grid {
    position: relative;
    z-index: 1;
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: flex-start;
}

/* Desktop: 3 kolone, isti raspored + animacija ulaska */
.books-item {
    box-sizing: border-box;
    width: 25%;
    margin: 0 4%;
    padding: 50px 0;
    opacity: 0;
    animation: booksFadeIn 1s ease forwards;
}

.books-item:nth-child(1) { animation-delay: 6s; }
.books-item:nth-child(2) { animation-delay: 6.5s; }
.books-item:nth-child(3) { animation-delay: 7s; }

.books-item a {
    display: block;
    color: #fff;
}

.books-item__name {
    font-size: 20px;
    text-align: center;
    margin: 0 0 20px 0;
    font-weight: bold;
    color: #fff;
}

.books-item__description {
    font-size: 18px;
    text-align: center;
    margin: 0 0 20px 0;
    min-height: 20px;
    color: #ffffffbd;
}

.books-item__image {
    text-align: center;
    margin-bottom: 20px;
}

.books-item__image img {
    width: 45%;
    height: auto;
    transition: transform 0.25s ease;
}

.books-item__image:hover img {
    transform: scale(1.05);
}

.books-item__cta {
    text-align: center;
}

.books .btn-primary {
    background-color: var(--color-cream) !important;
    color: #000 !important;
    border-color: var(--color-cream) !important;
    box-shadow: none !important;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.books .btn-primary:hover,
.books .btn-primary:focus,
.books .btn-primary.focus {
    background-color: var(--color-cream) !important;
    color: #000 !important;
    border-color: var(--color-cream) !important;
    box-shadow: 0 0 0 0.2rem rgba(201, 184, 150, 0.5) !important;
}

.books .btn-primary:active,
.books .btn-primary.active,
.books .btn-primary:active:focus,
.books .btn-primary.active:focus {
    background-color: #b8a784 !important;
    color: #000 !important;
    border-color: #b8a784 !important;
    box-shadow: 0 0 0 0.2rem rgba(201, 184, 150, 0.5) !important;
}

/* Tablet: 2 kolone + intro na vrhu */
@media (max-width: 991px) {
    .books-intro {
        align-items: flex-start;
        padding-top: 60px;
    }

    .books-item {
        width: 46%;
        margin: 0 2%;
    }
}

/* Mobilni: 1 kolona, intro na vrhu, knjige u stacku */
@media (max-width: 767px) {
    .books-intro {
        align-items: flex-start;
        padding-top: 50px;
    }

    .books-grid {
        flex-direction: column;
        align-items: center;
    }

    .books-item {
        width: 100%;
        max-width: 320px;
        margin: 0 auto;
        padding: 30px 20px;
    }
}
