/* =========================================================
   ZENITH KARATE ACADEMY
   PUBLIC GALLERY
========================================================= */

/* =========================================================
   GALLERY SECTION
========================================================= */

.gallery-section {
    position: relative;
    width: 100%;
    padding: 5rem clamp(1rem, 6vw, 5rem) 7rem;
    overflow: hidden;
}

.gallery-section-header {
    width: min(100%, 80rem);
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    margin: 0 auto 2.5rem;
}

.gallery-section-header h2 {
    margin: 0.5rem 0 0;
    color: white;
    font-family: 'Bebas Neue', sans-serif;
    font-size: clamp(2.5rem, 5vw, 4rem);
    font-weight: 900;
    line-height: 0.95;
    letter-spacing: 0.08rem;
}

.gallery-section-header p {
    width: min(100%, 30rem);
    margin: 0;
    color: #aaa;
    font-size: 0.9rem;
    line-height: 1.7;
}


/* =========================================================
   FILTERS
========================================================= */

.gallery-filters {
    width: min(100%, 80rem);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.65rem;
    margin: 0 auto 2.5rem;
}

.gallery-filter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.5rem;
    padding: 0.7rem 1rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.3rem;
    background: rgba(255, 255, 255, 0.025);
    color: #888;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1rem;
    cursor: pointer;

    transition:
        color 0.25s ease,
        background 0.25s ease,
        border-color 0.25s ease,
        transform 0.25s ease;
}

.gallery-filter:hover {
    color: #fdb203;
    border-color: rgba(253, 178, 3, 0.35);
    transform: translateY(-2px);
}

.gallery-filter.active {
    color: #0a0a0a;
    background: #fdb203;
    border-color: #fdb203;
}


/* =========================================================
   GALLERY GRID
========================================================= */

.gallery-section .gallery-grid {
    width: min(100%, 80rem);
    margin: 0 auto;

    display: grid;

    grid-template-columns:
        repeat(
            3,
            minmax(
                0,
                1fr
            )
        );

    gap: 1.2rem;
}


/* =========================================================
   GALLERY ITEM
========================================================= */

.gallery-section .gallery-item {
    position: relative;

    display: flex;
    flex-direction: column;

    min-width: 0;

    overflow: hidden;

    background: rgba(18, 18, 18, 0.72);

    border: 1px solid rgba(255, 255, 255, 0.08);

    border-radius: 1rem;

    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);

    cursor: zoom-in;

    transition:
        transform 0.3s ease,
        border-color 0.3s ease,
        box-shadow 0.3s ease;
}

.gallery-section .gallery-item:focus-visible {
    outline: 2px solid #fdb203;
    outline-offset: 4px;
}

.gallery-section .gallery-item:hover {
    transform: translateY(-7px);

    border-color:
        rgba(
            230,
            15,
            50,
            0.45
        );

    box-shadow:
        0
        15px
        35px
        rgba(
            0,
            0,
            0,
            0.45
        );
}


/* =========================================================
   IMAGE
========================================================= */

.gallery-item-image {
    width: 100%;
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: #0b0b0b;
}

.gallery-item-image img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;

    transition:
        transform 0.5s ease;
}

.gallery-section .gallery-item:hover .gallery-item-image img {
    transform: scale(1.05);
}


/* =========================================================
   CAPTION
========================================================= */

.gallery-section .gallery-caption {
    min-height: 5rem;

    display: flex;
    flex-direction: column;
    justify-content: center;

    gap: 0.35rem;

    padding: 0.9rem 1rem;

    background: rgba(10, 10, 10, 0.95);
}

.gallery-caption-category {
    color: #fdb203;
    font-size: 0.63rem;
    font-weight: 800;
    letter-spacing: 0.13rem;
    text-transform: uppercase;
}

.gallery-caption-text {
    color: #bdbdbd;
    font-size: 0.78rem;
    line-height: 1.5;
}


/* =========================================================
   LIGHTBOX
========================================================= */

body.gallery-lightbox-open {
    overflow: hidden;
}

.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10000;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: clamp(0.75rem, 3vw, 2rem);

    visibility: hidden;
    opacity: 0;
    pointer-events: none;

    transition:
        opacity 0.25s ease,
        visibility 0.25s ease;
}

.gallery-lightbox.open {
    visibility: visible;
    opacity: 1;
    pointer-events: auto;
}

.gallery-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.88);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.gallery-lightbox-content {
    position: relative;
    z-index: 1;

    width: min(96vw, 110rem);
    height: min(94vh, 70rem);

    display: flex;
    align-items: center;
    justify-content: center;
}

.gallery-lightbox-image-wrap {
    width: 100%;
    height: 100%;

    display: flex;
    align-items: center;
    justify-content: center;

    overflow: auto;

    padding: clamp(3.5rem, 7vw, 5rem) 0.5rem 0.75rem;

    scrollbar-width: thin;
}

.gallery-lightbox-image {
    --gallery-lightbox-zoom: 1;

    display: block;

    width: auto;
    height: auto;
    max-width: 100%;
    max-height: 100%;

    object-fit: contain;

    user-select: none;
    -webkit-user-drag: none;
    touch-action: none;

    transform: scale(var(--gallery-lightbox-zoom));
    transform-origin: center center;

    cursor: zoom-out;

    transition: transform 0.18s ease;
}

.gallery-lightbox-toolbar {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    z-index: 3;

    display: flex;
    align-items: center;
    gap: 0.45rem;
}

.gallery-lightbox-control {
    width: 2.75rem;
    height: 2.75rem;

    display: inline-flex;
    align-items: center;
    justify-content: center;

    padding: 0;

    border: 1px solid rgba(255, 255, 255, 0.16);
    border-radius: 0.55rem;

    background: rgba(14, 14, 14, 0.88);
    color: #fff;

    font: inherit;
    font-size: 1.2rem;
    font-weight: 800;

    cursor: pointer;

    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);

    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease,
        transform 0.2s ease;
}

.gallery-lightbox-control:hover:not(:disabled) {
    background: #fdb203;
    color: #0a0a0a;
    border-color: #fdb203;
    transform: translateY(-2px);
}

.gallery-lightbox-control:focus-visible {
    outline: 2px solid #fdb203;
    outline-offset: 2px;
}

.gallery-lightbox-control:disabled {
    opacity: 0.35;
    cursor: not-allowed;
}

.gallery-lightbox-reset {
    width: auto;
    min-width: 3.4rem;
    padding-inline: 0.7rem;
    font-size: 0.68rem;
    letter-spacing: 0.04rem;
}

.gallery-lightbox-close {
    margin-left: 0.3rem;
    font-size: 1.8rem;
    line-height: 1;
}


/* =========================================================
   LOADING / EMPTY / ERROR
========================================================= */

.gallery-loading {
    grid-column: 1 / -1;

    width: 100%;
    min-height: 12rem;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 2rem;

    border: 1px dashed rgba(255, 255, 255, 0.12);

    border-radius: 0.8rem;

    color: #777;

    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.12rem;

    text-align: center;
}

.gallery-loading.error {
    color: #e06b6b;
    border-color: rgba(230, 15, 50, 0.2);
}


/* =========================================================
   COMPETITION SECTION SPACING
========================================================= */

.gallery-section + .competition-section {
    padding-top: 2rem;
}


/* =========================================================
   MOBILE / TABLETS
========================================================= */

@media (max-width: 950px) {

    .gallery-section {
        padding:
            4rem
            1.5rem
            6rem;
    }

    .gallery-section-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.75rem;
    }

    .gallery-section-header p {
        width: 100%;
    }

    .gallery-section .gallery-grid {
        grid-template-columns:
            repeat(
                2,
                minmax(
                    0,
                    1fr
                )
            );
    }

}


/* =========================================================
   MOBILE
========================================================= */

@media (max-width: 600px) {

    .gallery-section {
        padding:
            3.5rem
            1rem
            5rem;
    }

    .gallery-section-header h2 {
        font-size:
            clamp(
                2.4rem,
                11vw,
                3.5rem
            );
    }

    .gallery-section-header p {
        font-size: 0.85rem;
    }

    .gallery-filters {
        justify-content: flex-start;

        overflow-x: auto;

        flex-wrap: nowrap;

        padding-bottom: 0.35rem;

        scrollbar-width: none;
    }

    .gallery-filters::-webkit-scrollbar {
        display: none;
    }

    .gallery-filter {
        flex: 0 0 auto;
    }

    .gallery-section .gallery-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .gallery-section .gallery-item {
        border-radius: 0.75rem;
    }

    .gallery-section .gallery-caption {
        min-height: 4.5rem;
    }

    .gallery-lightbox {
        padding: 0.5rem;
    }

    .gallery-lightbox-content {
        width: 100%;
        height: 100%;
    }

    .gallery-lightbox-image-wrap {
        padding: 4.5rem 0.25rem 0.5rem;
    }

    .gallery-lightbox-toolbar {
        top: 0.4rem;
        right: 0.4rem;
        left: 0.4rem;
        justify-content: flex-end;
    }

    .gallery-lightbox-control {
        width: 2.6rem;
        height: 2.6rem;
    }

    .gallery-lightbox-reset {
        min-width: 3.25rem;
    }

}


/* =========================================================
   SMALL PHONES
========================================================= */

@media (max-width: 380px) {

    .gallery-section {
        padding-inline: 0.8rem;
    }

    .gallery-filter {
        padding:
            0.65rem
            0.85rem;

        font-size: 0.62rem;
    }

    .gallery-caption-text {
        font-size: 0.74rem;
    }

    .gallery-lightbox-control {
        width: 2.45rem;
        height: 2.45rem;
    }

}


/* =========================================================
   TOUCH DEVICES
========================================================= */

@media (hover: none) and (pointer: coarse) {

    .gallery-section .gallery-item:hover {
        transform: none;
        box-shadow: none;
    }

    .gallery-section
    .gallery-item:hover
    .gallery-item-image img {
        transform: none;
    }

    .gallery-filter:hover {
        transform: none;
    }

    .gallery-lightbox-image {
        cursor: default;
    }

    .gallery-lightbox-control:hover:not(:disabled) {
        transform: none;
    }

}


/* =========================================================
   REDUCED MOTION
========================================================= */

@media (prefers-reduced-motion: reduce) {

    .gallery-section .gallery-item,
    .gallery-item-image img,
    .gallery-filter,
    .gallery-lightbox,
    .gallery-lightbox-image,
    .gallery-lightbox-control {
        transition: none !important;
    }

}