/**
 * Banner Sections Module - Frontend styles
 * 
 * @author    Woohoo.pl
 * @copyright 2025 Woohoo.pl
 * @license   https://opensource.org/licenses/AFL-3.0
 */

/* =============================================
   Base section container
   ============================================= */
.wh-banners {
    box-sizing: border-box;
    padding: 15px 0;
}

/* =============================================
   Section title
   ============================================= */
.wh-banners__title {
    margin-bottom: 15px;
}

.wh-banners__title h2 {
    font-size: 24px;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
    color: #333;
}

.wh-banners__title--left {
    text-align: left;
}

.wh-banners__title--center {
    text-align: center;
}

.wh-banners__title--right {
    text-align: right;
}

/* =============================================
   Grid layout
   ============================================= */
.wh-banners__grid {
    display: flex;
    flex-wrap: wrap;
    gap: 15px;
}

/* 1 column = full width */
.wh-banners--cols-1 .wh-banners__item {
    flex: 0 0 100%;
}

/* 2 columns */
.wh-banners--cols-2 .wh-banners__item {
    flex: 0 0 calc(50% - 8px);
}

/* 3 columns */
.wh-banners--cols-3 .wh-banners__item {
    flex: 0 0 calc(33.333% - 10px);
}

/* 4 columns */
.wh-banners--cols-4 .wh-banners__item {
    flex: 0 0 calc(25% - 12px);
}

/* 5 columns */
.wh-banners--cols-5 .wh-banners__item {
    flex: 0 0 calc(20% - 12px);
}

/* =============================================
   Item (single banner tile)
   ============================================= */
.wh-banners__item {
    display: block;
    position: relative;
    overflow: hidden;
    border-radius: 8px;
    box-sizing: border-box;
    text-decoration: none;
    color: inherit;
    transition: opacity 0.2s ease, transform 0.2s ease;
}

a.wh-banners__item:hover {
    opacity: 0.92;
    text-decoration: none;
    color: inherit;
}

/* =============================================
   Media containers (desktop / mobile switch)
   ============================================= */
.wh-banners__media--desktop {
    display: block;
}

.wh-banners__media--mobile {
    display: none;
}

/* =============================================
   Image & Video
   ============================================= */
.wh-banners__img {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.wh-banners__video {
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

/* =============================================
   Responsive visibility
   ============================================= */
.wh-desktop-only {
    display: block;
}

a.wh-desktop-only,
a.wh-banners__item.wh-desktop-only {
    display: block;
}

.wh-mobile-only {
    display: none;
}

/* =============================================
   Tablet (769px - 1024px)
   ============================================= */
@media (min-width: 769px) and (max-width: 1024px) {
    .wh-banners--cols-5 .wh-banners__item {
        flex: 0 0 calc(33.333% - 10px);
    }

    .wh-banners--cols-4 .wh-banners__item {
        flex: 0 0 calc(50% - 8px);
    }
}

/* =============================================
   Mobile (max-width: 768px)
   ============================================= */
@media (max-width: 768px) {
    .wh-desktop-only {
        display: none !important;
    }

    .wh-mobile-only {
        display: block !important;
    }

    a.wh-mobile-only,
    a.wh-banners__item.wh-mobile-only {
        display: block !important;
    }

    /* Switch media containers */
    .wh-banners__media--desktop {
        display: none;
    }

    .wh-banners__media--mobile {
        display: block;
    }

    /* Mobile: 2 columns for 3+ items, full width for 1-2 */
    .wh-banners--cols-3 .wh-banners__item,
    .wh-banners--cols-4 .wh-banners__item,
    .wh-banners--cols-5 .wh-banners__item {
        flex: 0 0 calc(50% - 8px);
    }

    .wh-banners--cols-1 .wh-banners__item,
    .wh-banners--cols-2 .wh-banners__item {
        flex: 0 0 100%;
    }

    .wh-banners__title h2 {
        font-size: 20px;
    }

    .wh-banners__grid {
        gap: 10px;
    }

    .wh-banners__item {
        border-radius: 6px;
    }
}

/* =============================================
   Very small mobile (max-width: 480px)
   ============================================= */
@media (max-width: 480px) {
    .wh-banners--cols-3 .wh-banners__item,
    .wh-banners--cols-4 .wh-banners__item,
    .wh-banners--cols-5 .wh-banners__item {
        flex: 0 0 100%;
    }

    .wh-banners__title h2 {
        font-size: 18px;
    }
}
