/* ============================================================
   Interactive Gallery – [interactive_gallery] shortcode
   Tabbed / filtered gallery with animated transitions
   Supports both image and video cards
   ============================================================ */

/* ── Wrapper ─────────────────────────────────────────────── */

.igc-tabbed-gallery {
    --igc-cols-desktop: 4;
    --igc-cols-tablet: 2;
    --igc-cols-mobile: 1;
    --igc-gap: 12px;
    --igc-radius: 14px;
    --igc-overlay-base: rgba(0, 0, 0, 0.42);
    --igc-overlay-hover: rgba(0, 0, 0, 0.58);
    --igc-transition: 0.42s cubic-bezier(0.4, 0, 0.2, 1);
    --igc-zoom: 1.08;

    /* Tab bar tokens */
    --igc-tab-bg: transparent;
    --igc-tab-bg-active: #111;
    --igc-tab-color: #555;
    --igc-tab-color-active: #fff;
    --igc-tab-radius: 80px;
    --igc-tab-gap: 8px;
    --igc-tab-font: inherit;

    width: 100%;
    min-width: 0;
    box-sizing: border-box;
    position: relative;
    z-index: 1;
}

/* ── Tab Bar ─────────────────────────────────────────────── */

.igc-tabs {
    display: flex;
    flex-wrap: wrap;
    gap: var(--igc-tab-gap);
    padding: 0;
    margin-bottom: 24px;
    list-style: none;
    justify-content: flex-start;
    align-items: center;
}

.igc-tab {
    appearance: none;
    border: 1.5px solid #d1d5db;
    background: var(--igc-tab-bg);
    color: var(--igc-tab-color);
    font-family: var(--igc-tab-font);
    font-size: 0.875rem;
    font-weight: 500;
    line-height: 1;
    padding: 10px 22px;
    border-radius: var(--igc-tab-radius);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.28s ease,
        color 0.28s ease,
        border-color 0.28s ease,
        box-shadow 0.28s ease;
    user-select: none;
}

.igc-tab:hover {
    background: #f3f4f6;
    border-color: #9ca3af;
    color: #111;
}

.igc-tab--active,
.igc-tab--active:hover {
    background: var(--igc-tab-bg-active);
    color: var(--igc-tab-color-active);
    border-color: var(--igc-tab-bg-active);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* Focus ring for accessibility */
.igc-tab:focus-visible {
    outline: 3px solid rgba(59, 130, 246, 0.5);
    outline-offset: 2px;
}

/* ── Gallery Grid ────────────────────────────────────────── */

.igc-gallery {
    display: grid;
    grid-template-columns: repeat(var(--igc-cols-desktop), 1fr);
    gap: var(--igc-gap);
    width: 100%;
    min-width: 0;
}

/* ── Card (shared styles for both <a> and <div>) ─────────── */

.igc-gallery .igc-card {
    position: relative;
    display: block;
    border-radius: var(--igc-radius);
    overflow: hidden;
    cursor: pointer;
    text-decoration: none;
    color: inherit;
    background: #111;
    aspect-ratio: 4 / 3;

    /* Transition for tab filtering */
    opacity: 1;
    transform: scale(1);
    transition: opacity 0.35s ease,
        transform 0.35s ease;
}

/* Hidden state when filtered out by tab */
.igc-gallery .igc-card.igc-card--hidden {
    display: none;
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 4/3) {
    .igc-gallery .igc-card::before {
        content: "";
        display: block;
        padding-top: 56%;
    }
}

/* ── Media Wrapper (shared for image & video) ───────────── */

.igc-gallery .igc-card__media-wrap {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
}

/* ── Image ───────────────────────────────────────────────── */

.igc-gallery .igc-card__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform var(--igc-transition);
    will-change: transform;
}

/* ── Video ───────────────────────────────────────────────── */

.igc-gallery .igc-card__video {
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center;
    display: block;
    transition: transform var(--igc-transition);
    will-change: transform;
}

/* ── Play Icon Overlay (video cards only) ────────────────── */

.igc-gallery .igc-card__play-icon {
    position: absolute;
    bottom: 14px;
    right: 14px;
    z-index: 3;
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    border-radius: 50%;
    color: #fff;
    pointer-events: none;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.igc-gallery .igc-card__play-icon svg {
    width: 22px;
    height: 22px;
    margin-left: 2px;
    /* visual centering for play triangle */
}

/* Hide play icon when video is playing */
.igc-gallery .igc-card--playing .igc-card__play-icon {
    opacity: 0;
    transform: scale(0.7);
}

/* ── Overlay ─────────────────────────────────────────────── */

.igc-gallery .igc-card__overlay {
    position: absolute;
    inset: 0;
    background: var(--igc-overlay-base);
    transition: background var(--igc-transition);
    pointer-events: none;
}

/* ── Content / Heading ───────────────────────────────────── */

.igc-gallery .igc-card__content {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    z-index: 2;
}

.igc-gallery .igc-card__heading {
    font-size: clamp(0.85rem, 1.6vw, 1.5rem);
    font-weight: 400;
    line-height: 1.4;
    color: #ffffff;
    text-align: center;
    margin: 0;
    padding: 0;
    letter-spacing: 0.02em;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.55);
    text-transform: capitalize;
}

/* ── Hover Effects ───────────────────────────────────────── */

.igc-gallery .igc-card:hover .igc-card__img,
.igc-gallery .igc-card:focus-visible .igc-card__img {
    transform: scale(var(--igc-zoom));
}

.igc-gallery .igc-card:hover .igc-card__video,
.igc-gallery .igc-card:focus-visible .igc-card__video {
    transform: scale(var(--igc-zoom));
}

.igc-gallery .igc-card:hover .igc-card__overlay,
.igc-gallery .igc-card:focus-visible .igc-card__overlay {
    background: var(--igc-overlay-hover);
}

/* Focus ring for accessibility */
.igc-gallery .igc-card:focus-visible {
    outline: 3px solid rgba(255, 255, 255, 0.7);
    outline-offset: 3px;
}

/* ── Tablet ──────────────────────────────────────────────── */

@media (max-width: 1024px) {
    .igc-gallery {
        grid-template-columns: repeat(var(--igc-cols-tablet), 1fr);
    }

    .igc-gallery .igc-card__heading {
        font-size: clamp(0.82rem, 2.2vw, 1rem);
    }

    .igc-tab {
        font-size: 0.82rem;
        padding: 8px 18px;
    }

    .igc-gallery .igc-card__play-icon {
        width: 38px;
        height: 38px;
        bottom: 10px;
        right: 10px;
    }

    .igc-gallery .igc-card__play-icon svg {
        width: 18px;
        height: 18px;
    }
}

/* ── Mobile ──────────────────────────────────────────────── */

@media (max-width: 600px) {
    .igc-gallery {
        grid-template-columns: repeat(var(--igc-cols-mobile), 1fr);
        --igc-gap: 10px;
        min-width: 0;
        max-width: 100%;
    }

    .igc-gallery .igc-card {
        aspect-ratio: 3 / 2;
        min-width: 0;
    }

    .igc-gallery .igc-card__heading {
        font-size: 0.95rem;
    }

    .igc-tabs {
        gap: 6px;
        margin-bottom: 16px;
        overflow-x: auto;
        flex-wrap: nowrap;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
    }

    .igc-tabs::-webkit-scrollbar {
        display: none;
    }

    .igc-tab {
        font-size: 0.78rem;
        padding: 7px 16px;
    }

    .igc-gallery .igc-card__play-icon {
        width: 34px;
        height: 34px;
        bottom: 8px;
        right: 8px;
    }

    .igc-gallery .igc-card__play-icon svg {
        width: 16px;
        height: 16px;
    }
}

/* ── Video Lightbox ──────────────────────────────────────── */

.igc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.35s ease, visibility 0.35s ease;
}

.igc-lightbox--open {
    opacity: 1;
    visibility: visible;
}

.igc-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
}

.igc-lightbox__content {
    position: relative;
    z-index: 1;
    width: 90vw;
    max-width: 960px;
    max-height: 85vh;
    display: flex;
    align-items: center;
    justify-content: center;
    transform: scale(0.92);
    transition: transform 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.igc-lightbox--open .igc-lightbox__content {
    transform: scale(1);
}

.igc-lightbox__video {
    width: 100%;
    max-height: 85vh;
    border-radius: 12px;
    background: #000;
    outline: none;
}

.igc-lightbox__close {
    position: absolute;
    top: -44px;
    right: 0;
    width: 40px;
    height: 40px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.12);
    border: none;
    border-radius: 50%;
    color: #fff;
    cursor: pointer;
    transition: background 0.2s ease;
}

.igc-lightbox__close:hover {
    background: rgba(255, 255, 255, 0.25);
}

.igc-lightbox__close:focus-visible {
    outline: 2px solid rgba(59, 130, 246, 0.7);
    outline-offset: 2px;
}

/* Video card cursor */
.igc-gallery .igc-card--video {
    cursor: pointer;
}