/* Performance and responsive fixes shared by every page. */

html,
body {
    max-width: 100%;
    overflow-x: hidden;
}
@supports (overflow-x: clip) {
    html,
    body {
        overflow-x: clip;
    }
}

/* Banner image: painted under .overlay by document order, so no z-index is needed
   (a stacking context here would trap the mobile menu under its backdrop). */
.hero-section {
    position: relative;
    overflow: hidden;
    background-color: #092650;
}
.hero-bg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
}

/* Book covers are links now; keep them looking exactly as before. */
.book-cover-link {
    display: block;
    width: 100%;
    height: 100%;
}
.book-title a {
    color: inherit;
    text-decoration: none;
}
.book-overlay-actions {
    z-index: 6;
}

/* Swiper's stylesheet loads after the first paint. These rules keep the carousels in their
   final size from the start, so nothing jumps when it arrives. */
.swiper {
    position: relative;
    overflow: hidden;
    display: block;
}
.swiper-wrapper {
    display: flex;
    width: 100%;
    position: relative;
}
.swiper-slide {
    flex-shrink: 0;
    width: 100%;
    position: relative;
}
.swiper-recent:not(.swiper-initialized) .swiper-slide { width: 25%; }
.swiper-category:not(.swiper-initialized) .swiper-slide { width: 20%; }
.swiper-author:not(.swiper-initialized) .swiper-slide { width: 20%; }
@media (max-width: 1199.98px) {
    .swiper-author:not(.swiper-initialized) .swiper-slide { width: 25%; }
}
@media (max-width: 991.98px) {
    .swiper-recent:not(.swiper-initialized) .swiper-slide { width: 33.333%; }
    .swiper-author:not(.swiper-initialized) .swiper-slide { width: 33.333%; }
}
@media (max-width: 767.98px) {
    .swiper-recent:not(.swiper-initialized) .swiper-slide,
    .swiper-author:not(.swiper-initialized) .swiper-slide,
    .swiper-category:not(.swiper-initialized) .swiper-slide { width: 50%; }
}
@media (max-width: 575.98px) {
    .swiper-author:not(.swiper-initialized) .swiper-slide { width: 100%; }
}
@media (max-width: 479.98px) {
    .swiper-recent:not(.swiper-initialized) .swiper-slide { width: 100%; }
}

/* Icon font arrives late: reserve its width. */
.fa-solid, .fa-regular, .fa-brands { display: inline-block; min-width: 1em; }

/* Long names, pasted HTML and wide tables must never push the page sideways. */
h1, h2, h3, h4, p, li, a, .card-body { overflow-wrap: break-word; }
.blog-content { overflow-wrap: anywhere; }
.blog-content img, .gray-text img, .about__library img { max-width: 100%; height: auto; }
.blog-content table, .gray-text table { display: block; max-width: 100%; overflow-x: auto; }
.blog-content iframe, .about__library iframe, main iframe { max-width: 100%; }
.page-intro { line-height: 1.9; color: rgba(96, 98, 102, 1); }

.pagination { flex-wrap: wrap; }

@media (max-width: 767.98px) {
    /* Touch screens have no hover: show the card buttons. */
    .book-overlay-actions { opacity: 1 !important; transform: none !important; }
    .category-title { width: auto !important; min-width: 45%; }
    .overlay { padding: 7rem 0 3rem !important; }
    .content-hero-section { padding-inline: 16px; }
    .content-hero-section h1 { font-size: 1.6rem; }
    .content-hero-section ol { flex-wrap: wrap; padding: 0; }
}

/* Book cards on two columns: covers scale down instead of overflowing narrow phones. */
@media (max-width: 575.98px) {
    .allBooks .book-cover { width: 100%; max-width: 180px; height: auto; aspect-ratio: 3 / 4; }
    .allBooks .book-card-container { padding: 8px; max-width: 100%; }
    .allBooks .book-title { font-size: .92rem; }
    .floating-whatsapp { left: 12px; bottom: 12px; }
}

.newsletter-message.is-error { color: #ffc9c9; }
.newsletter-message.is-ok { color: #c8f7d4; }
.follow .input_follow { min-width: 96px; }
.follow input[type="email"] { min-width: 0; }

@media (prefers-reduced-motion: reduce) {
    .marquee-content, .discount-ribbon { animation: none !important; }
}

/* Bot trap: hidden in place. An off-screen offset would widen an RTL page. */
.newsletter-trap { position: absolute; width: 0 !important; height: 0 !important; padding: 0 !important; opacity: 0; pointer-events: none; }
.follow { position: relative; }

.floating-whatsapp i { color: #fff; }

/* Cart, wishlist and account are buttons now; same look as the links they replaced. */
button.bg-icon { padding: 0; color: inherit; font: inherit; }
button.main-button, button.primary-button { font-family: inherit; }
button.primary-button { padding: 0.5rem 1rem; }
.footer-categories a { opacity: .85; }

.page-link { overflow-wrap: normal; white-space: nowrap; width: auto !important; min-width: 40px; text-align: center; }

/* The arrows are ordinary blocks until Swiper's stylesheet arrives; keep them out of the flow. */
.swiper > .swiper-button-prev,
.swiper > .swiper-button-next { position: absolute; top: 50%; z-index: 10; }
