/*
 * Adaptive homepage category sections (resources/views/frontend/partials/home_section.blade.php).
 * This file loads in <head> before Bootstrap and the theme, so selectors are
 * deliberately specific, and the few layout properties that must win over
 * Bootstrap's .card and the theme's fixed image heights use !important.
 */

.home-section__title {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 16px;
}

.home-section__title .home-section__more {
    flex-shrink: 0;
    color: #c8102e;
    font-size: 14px;
    font-weight: 600;
    white-space: nowrap;
}

.home-section__title .home-section__more:hover {
    color: #a10c25;
    text-decoration: underline;
}

.card.maan-default-post.home-story {
    height: calc(100% - 24px);
    margin-bottom: 24px;
}

.card.maan-default-post.home-story .maan-post-img img {
    width: 100% !important;
    height: auto !important;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    object-position: center;
}

/* A lone story (or the lead of an odd-numbered narrow section) is a wide
   feature: image beside the text, so the row is filled edge to edge. */
.card.maan-default-post.home-story--wide {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch;
    overflow: hidden;
}

.card.maan-default-post.home-story--wide .maan-post-img {
    flex: 0 0 55% !important;
    max-width: 55% !important;
    width: 55% !important;
    margin: 0 !important;
}

.card.maan-default-post.home-story--wide .maan-post-img a {
    display: block;
    height: 100%;
}

/* Fixed height so a portrait photo cannot stretch the card. */
.card.maan-default-post.home-story--wide .maan-post-img img {
    height: 340px !important;
    aspect-ratio: auto;
}

.card.maan-default-post.home-story--wide .maan-card-body {
    flex: 1 1 auto;
    display: flex;
    align-items: center;
    padding: 28px 32px !important;
}

.card.maan-default-post.home-story--wide h4 {
    font-size: 26px;
    line-height: 1.25;
}

.card.maan-default-post.home-story--wide .home-story__summary {
    margin: 12px 0 16px;
    color: #4b5563;
    font-size: 15px;
    line-height: 1.6;
}

/* Most Popular slider: one photo height for every slide. The slider takes
   the height of its tallest slide, so a single portrait photo left a large
   blank area under the shorter ones. */
.maan-most-popular-section .maan-big-post .maan-post-img img {
    width: 100% !important;
    height: 380px !important;
    object-fit: cover;
    object-position: center;
}

@media (max-width: 767.98px) {
    .maan-most-popular-section .maan-big-post .maan-post-img img {
        height: 240px !important;
    }

    .card.maan-default-post.home-story--wide {
        flex-direction: column !important;
    }

    .card.maan-default-post.home-story--wide .maan-post-img {
        flex-basis: auto !important;
        max-width: 100% !important;
        width: 100% !important;
    }

    .card.maan-default-post.home-story--wide .maan-post-img img {
        height: auto !important;
        aspect-ratio: 16 / 10;
    }

    .card.maan-default-post.home-story--wide .maan-card-body {
        padding: 16px !important;
    }

    .card.maan-default-post.home-story--wide h4 {
        font-size: 20px;
    }
}

/* The theme pins Most Popular's category pill to both the top and the bottom
   of the photo, which stretched it into a tall empty bar. Keep it at the top. */
.card.maan-big-post .maan-post-img [class*="maan-tag-"] {
    bottom: auto !important;
}
