/*--------------------------------------------------------------
 * Five Images Section Widget — Nordic Elementor
 *------------------------------------------------------------*/

/* ── Swiper base rules (mobile only — desktop uses CSS Grid override) ── */
@media (max-width: 767px) {
    .nordic-fi-swiper.swiper {
        overflow: hidden;
    }
    .nordic-fi-swiper .swiper-wrapper {
        display: flex;
        flex-direction: row;
        box-sizing: content-box;
        position: relative;
        z-index: 1;
    }
    .nordic-fi-swiper .swiper-slide {
        flex-shrink: 0;
        width: 100%;
        position: relative;
        transition-property: transform;
        display: block;
    }
}

:root {
    --nfi-dot-active: #FF3333;
    --nfi-dot-border: #FF3333;
}

.nordic-fi {
    width: 100%;
}

/* ── Header ────────────────────────────────────────────────── */
.nordic-fi-header {
    text-align: center;
    max-width: 800px;
    margin: 0 auto 40px;
}

.nordic-fi-header__subtitle {
    font-size: 32px;
    font-weight: 900;
    text-transform: uppercase;
    color: #000;
    margin: 0 0 16px;
    letter-spacing: 1px;
}

.nordic-fi-header__title {
    font-size: 16px;
    line-height: 1.6;
    color: #333;
    margin: 0;
}

/* ── Carousel Wrapper / Grid logic ─────────────────────────── */
.nordic-fi-carousel-wrapper {
    position: relative;
    width: 100%;
}

.nordic-fi-swiper {
    position: relative;
    width: 100%;
    overflow: hidden;
}

/* 
 * DEFAULT (Desktop): Pure CSS Grid, disable Swiper wrapper flexing
 * so all exactly 5 items fit side-by-side.
 */
@media (min-width: 768px) {
    .nordic-fi-grid.swiper-wrapper {
        display: grid;
        grid-template-columns: repeat(5, 1fr);
        gap: 20px;
        /* Override swiper flex behaviors */
        transform: none !important;
        width: 100% !important;
    }
    .nordic-fi-cell.swiper-slide {
        width: 100% !important;
        margin: 0 !important;
    }
    .nordic-fi-dots {
        display: none !important; /* Hide pagination on desktop */
    }
}

/* ── Cards / Items ────────────────────────────────────────── */
.nordic-fi-item {
    position: relative;
    display: flex;
    flex-direction: column;
    height: 400px; /* Base height, adjust as needed */
    border-radius: 20px;
    overflow: hidden;
    text-decoration: none;
    background-color: #000;
    cursor: default;
}

/* Link hover effect */
.nordic-fi-item--link {
    cursor: pointer;
}
.nordic-fi-item--link:hover .nordic-fi-item__bg {
    transform: scale(1.05);
}

.nordic-fi-item__bg {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-size: cover;
    background-position: center;
    transition: transform 0.4s ease;
    z-index: 1;
}

.nordic-fi-item__overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(180deg, rgba(0,0,0,0.1) 0%, rgba(0,0,0,0.6) 100%);
    z-index: 2;
}

/* ── Content Overlays ─────────────────────────────────────── */
.nordic-fi-item__content {
    position: relative;
    z-index: 4;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    text-align: center;
    height: 100%;
    padding: 24px;
    /* We want Title in middle, Subtitle at bottom.
       Use absolute positioning for subtitle to keep title truly centered. */
}

.nordic-fi-item__title {
    font-size: 28px;
    font-weight: 800;
    line-height: 1.1;
    text-transform: uppercase;
    color: #fff;
    margin: 0;
}

.nordic-fi-item__subtitle {
    position: absolute;
    bottom: 24px;
    left: 0;
    width: 100%;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: 2px;
    text-transform: uppercase;
    color: #fff;
}

/* ── Video Play Button & Container ────────────────────────── */
.nordic-fi-item--video {
    cursor: pointer;
}

.nordic-fi-item__play {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 48px;
    height: 48px;
    background: transparent;
    border: none;
    padding: 0;
    z-index: 5;
    cursor: pointer;
    transition: transform 0.2s;
}

.nordic-fi-item__play:hover {
    transform: translate(-50%, -50%) scale(1.1);
}

.nordic-fi-item__video-container {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 3;
    pointer-events: none; /* Let clicks pass to the parent item */
}

/* Hide play button and thumbnail when video is playing */
.nordic-fi-item.is-playing .nordic-fi-item__play,
.nordic-fi-item.is-playing .nordic-fi-item__bg,
.nordic-fi-item.is-playing .nordic-fi-item__content {
    opacity: 0;
    pointer-events: none;
}

.nordic-fi-item__video-container iframe,
.nordic-fi-item__video-container video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    pointer-events: auto; /* Re-enable pointer events for the actual video */
}

/* ── Footer Plugins (Mobile Dots) ────────────────────────── */
.nordic-fi-footer {
    text-align: center;
    margin-top: 24px;
}

.nordic-fi-dots {
    position: static;
    display: flex;
    justify-content: center;
    gap: 8px;
}

.nordic-fi-dots .swiper-pagination-bullet {
    width: 10px;
    height: 10px;
    background-color: transparent;
    opacity: 1;
    border: 1px solid var(--nfi-dot-border);
    margin: 0 !important;
    border-radius: 50%;
    cursor: pointer;
    display: inline-block;
}

.nordic-fi-dots .swiper-pagination-bullet-active {
    background-color: var(--nfi-dot-active);
    border-color: var(--nfi-dot-active);
}

/* ── Mobile Logic (< 768px) ──────────────────────────────── */
@media (max-width: 767px) {
    .nordic-fi-header__subtitle {
        font-size: 24px;
    }
    
    .nordic-fi-item {
        height: 320px;
    }
    
    .nordic-fi-item__title {
        font-size: 22px;
    }
    
    .nordic-fi-dots {
        display: flex; /* Ensure shown on mobile */
    }
}
