/* ==========================================================================
   IMAGE GALLERY / VIDEO GALLERY LISTING SECTIONS (Scoped: bos-ml-)
   ========================================================================== */

.bos-ml-section {
    --ml-orange: #DB4101;
    --ml-navy: #343985;
    --ml-radius: 16px;
    position: relative;
    z-index: 2; /* above the footer's upward glow */
    padding: clamp(40px, 6vw, 80px) 0;
    background: linear-gradient(180deg, #FFFFFF 0%, #F7F9FD 100%);
    font-family: var(--font-spartan, 'Spartan', sans-serif);
}

/* Heading */
.bos-ml-head {
    text-align: center;
    max-width: 680px;
    margin: 0 auto clamp(24px, 4vw, 40px);
}

.bos-ml-title {
    position: relative;
    display: inline-block;
    margin: 0 0 14px;
    padding-bottom: 14px;
    font-size: clamp(26px, 4vw, 40px);
    font-weight: 800;
    line-height: 1.2;
    color: #000000;
}

.bos-ml-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    width: 64px;
    height: 4px;
    border-radius: 4px;
    background: var(--ml-orange);
    transform: translateX(-50%);
}

.bos-ml-subtitle {
    margin: 0;
    font-size: clamp(14px, 1.6vw, 16px);
    line-height: 1.6;
    color: #6b7280;
}

/* Category chips: wrap on desktop, one swipeable row on phones */
.bos-ml-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-bottom: clamp(20px, 3vw, 32px);
}

.bos-ml-chip {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 18px;
    border: 1px solid #E2E8F0;
    border-radius: 50px;
    background: #FFFFFF;
    font: inherit;
    font-size: 14px;
    font-weight: 600;
    color: #1f2937;
    white-space: nowrap;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s, box-shadow 0.2s;
}

.bos-ml-chip:hover {
    border-color: var(--ml-orange);
    color: var(--ml-orange);
}

.bos-ml-chip.is-active {
    background: var(--ml-orange);
    border-color: var(--ml-orange);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(219, 65, 1, 0.28);
}

.bos-ml-chip:focus-visible,
.bos-ml-page:focus-visible,
.bos-ml-card:focus-visible {
    outline: 3px solid var(--ml-navy);
    outline-offset: 3px;
}

/* Grid */
.bos-ml-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: clamp(14px, 2vw, 24px);
}

.bos-ml-card {
    position: relative;
    display: block;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    border-radius: var(--ml-radius);
    background: #E5E7EB;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.10);
    text-decoration: none;
    isolation: isolate;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.bos-ml-card[hidden] {
    display: none;
}

.bos-ml-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s ease;
}

/* Bottom gradient keeps the caption readable on any photo */
.bos-ml-shade {
    position: absolute;
    inset: 0;
    background: linear-gradient(180deg, rgba(0, 0, 0, 0) 45%, rgba(0, 0, 0, 0.72) 100%);
    opacity: 0.85;
    transition: opacity 0.3s ease;
}

.bos-ml-meta {
    position: absolute;
    left: 16px;
    right: 16px;
    bottom: 14px;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    color: #FFFFFF;
}

.bos-ml-tag {
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--ml-orange);
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.bos-ml-caption {
    max-width: 100%;
    font-size: 15px;
    font-weight: 700;
    line-height: 1.3;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.5);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Zoom icon (images) */
.bos-ml-zoom {
    position: absolute;
    top: 14px;
    right: 14px;
    display: grid;
    place-items: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.92);
    color: var(--ml-orange);
    font-size: 15px;
    opacity: 0;
    transform: scale(0.8);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

/* Play button (videos) */
.bos-ml-play {
    position: absolute;
    top: 50%;
    left: 50%;
    display: grid;
    place-items: center;
    width: 64px;
    height: 64px;
    border-radius: 50%;
    background: var(--ml-orange);
    color: #FFFFFF;
    font-size: 20px;
    padding-left: 4px;
    transform: translate(-50%, -50%);
    box-shadow: 0 0 0 8px rgba(255, 255, 255, 0.28), 0 10px 24px rgba(0, 0, 0, 0.3);
    transition: transform 0.25s ease, box-shadow 0.25s ease;
}

@media (hover: hover) {
    .bos-ml-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 16px 36px rgba(15, 23, 42, 0.18);
    }
    .bos-ml-card:hover .bos-ml-img { transform: scale(1.08); }
    .bos-ml-card:hover .bos-ml-shade { opacity: 1; }
    .bos-ml-card:hover .bos-ml-zoom { opacity: 1; transform: scale(1); }
    .bos-ml-card:hover .bos-ml-play {
        transform: translate(-50%, -50%) scale(1.1);
        box-shadow: 0 0 0 12px rgba(255, 255, 255, 0.3), 0 12px 28px rgba(0, 0, 0, 0.35);
    }
}

/* Touch screens have no hover: keep the zoom icon visible */
@media (hover: none) {
    .bos-ml-zoom { opacity: 1; transform: none; }
}

/* Pagination (shown only when there are more items than one page) */
.bos-ml-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    gap: 8px;
    margin-top: clamp(24px, 4vw, 40px);
}

.bos-ml-pagination[hidden] {
    display: none;
}

.bos-ml-page {
    display: inline-grid;
    place-items: center;
    min-width: 42px;
    height: 42px;
    padding: 0 12px;
    border: 1px solid #E2E8F0;
    border-radius: 50px;
    background: #FFFFFF;
    font: inherit;
    font-size: 14px;
    font-weight: 700;
    color: #1f2937;
    cursor: pointer;
    transition: background-color 0.2s, color 0.2s, border-color 0.2s;
}

.bos-ml-page:hover:not(:disabled):not(.is-active) {
    border-color: var(--ml-orange);
    color: var(--ml-orange);
}

.bos-ml-page.is-active {
    background: var(--ml-orange);
    border-color: var(--ml-orange);
    color: #FFFFFF;
    box-shadow: 0 6px 16px rgba(219, 65, 1, 0.28);
    cursor: default;
}

.bos-ml-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.bos-ml-gap {
    padding: 0 4px;
    color: #94a3b8;
    font-weight: 700;
}

/* Empty state */
.bos-ml-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    max-width: 560px;
    margin: 0 auto;
    padding: 28px 20px;
    border: 1px dashed #CBD5E1;
    border-radius: var(--ml-radius);
    background: #FFFFFF;
    text-align: center;
    color: #64748b;
}

/* Tablet */
@media (max-width: 991.98px) {
    .bos-ml-grid {
        grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    }
}

/* Phone: 2 per row, chips become one swipeable row */
@media (max-width: 575.98px) {
    .bos-ml-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 10px;
    }
    .bos-ml-card {
        aspect-ratio: 1 / 1;
        border-radius: 12px;
    }
    .bos-ml-meta { left: 10px; right: 10px; bottom: 10px; }
    .bos-ml-caption { font-size: 12px; }
    .bos-ml-tag { font-size: 10px; padding: 2px 8px; }
    .bos-ml-zoom { width: 32px; height: 32px; top: 8px; right: 8px; font-size: 12px; }
    .bos-ml-play { width: 46px; height: 46px; font-size: 15px; }

    .bos-ml-filters {
        flex-wrap: nowrap;
        justify-content: flex-start;
        overflow-x: auto;
        margin-left: -12px;
        margin-right: -12px;
        padding: 4px 12px 10px;
        scrollbar-width: none;
        -webkit-overflow-scrolling: touch;
    }
    .bos-ml-filters::-webkit-scrollbar { display: none; }
    .bos-ml-chip { flex: 0 0 auto; padding: 8px 14px; font-size: 13px; }

    .bos-ml-page { min-width: 38px; height: 38px; padding: 0 8px; font-size: 13px; }
    .bos-ml-pagination { gap: 6px; }
}

@media (prefers-reduced-motion: reduce) {
    .bos-ml-card,
    .bos-ml-img,
    .bos-ml-zoom,
    .bos-ml-play,
    .bos-ml-chip { transition: none; }
}
