/*
 * NORYX DESIGN SYSTEM — GALLERY COMPONENT v1.0.0
 * Date: 2026-10-07
 *
 * Requires: assets/css/noryx-design-system.css (Foundation v1.1+)
 *
 * Gallery-specific presentation only.
 * Structural primitives come from Foundation.
 * JavaScript is reserved for lightbox behavior; no DOM/geometry visual binder.
 */

body.gallery {
    background:
        url('../../../img/backgrounds/bg-gallery-noryx.jpg')
        no-repeat center center fixed;
    background-size: cover;
    min-height: 100vh;
}

.nx-gallery-page {
    position: relative;
    z-index: 10;
    padding-inline: clamp(1.5rem, 3vw, 3rem);
}

.nx-gallery-page__container {
    width: 100%;
    max-width: 80rem;
    margin: 0 auto;
}

.nx-gallery-matrix {
    padding: 2.5rem;
}

/* ============================================================
   PAGE HEADER
   ============================================================ */
.nx-gallery-header {
    margin-bottom: 2rem;
    text-align: center;
}

.nx-gallery-page-title {
    font-size: clamp(2.25rem, 4vw, 3rem);
    line-height: 1.08;
    overflow-wrap: anywhere;
}

.nx-gallery-subtitle {
    margin: .5rem 0 0;
    font-size: .875rem;
    text-shadow: 0 0 10px rgba(0,0,0,.50);
}

/* ============================================================
   FILTER / CATEGORY TABS
   ============================================================ */
.nx-gallery-filters {
    width: 100%;
    margin-bottom: 1.5rem;
    padding: .65rem;
    justify-content: center;
    gap: .45rem;
    box-shadow:
        inset 0 1px 0 rgba(255,255,255,.05),
        0 10px 28px rgba(0,0,0,.35);
    backdrop-filter: blur(var(--nx-blur-glass));
    -webkit-backdrop-filter: blur(var(--nx-blur-glass));
}

.nx-gallery-tab {
    padding: .65rem 1.25rem;
    clip-path:
        polygon(
            8px 0,
            100% 0,
            100% calc(100% - 8px),
            calc(100% - 8px) 100%,
            0 100%,
            0 8px
        );
    font-family: var(--nx-font-display);
    font-size: .875rem;
    font-weight: 700;
    letter-spacing: .04em;
}

.nx-gallery-tab:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 18px rgba(0,0,0,.35);
}

.nx-gallery-tab > i,
.nx-gallery-tab > svg {
    color: currentColor;
}

.nx-gallery-tab--all {
    color: #FFFFFF;
    background: rgba(255,255,255,.08);
    border-color: rgba(255,255,255,.25);
}

.nx-gallery-tab--all:hover {
    color: #FFFFFF;
    background: rgba(255,255,255,.18);
    border-color: rgba(255,255,255,.50);
}

.nx-gallery-tab--all.is-active {
    color: var(--nx-surface-base);
    background: #FFFFFF;
    border-color: #FFFFFF;
    box-shadow: 0 0 30px rgba(255,255,255,.40);
}

.nx-gallery-tab.nx-tab--update.is-active {
    color: var(--nx-surface-base);
}

/* ============================================================
   ALBUM GRID / CARDS
   ============================================================ */
.nx-gallery-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1.5rem;
}

.nx-gallery-card {
    min-width: 0;
    height: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    color: inherit;
    text-decoration: none;
    border-top-width: 4px;
    backdrop-filter: blur(var(--nx-blur-glass));
    -webkit-backdrop-filter: blur(var(--nx-blur-glass));
    transition:
        transform .30s ease,
        border-color .30s ease,
        box-shadow .30s ease,
        background-color .20s ease;
}

.nx-gallery-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 10px 20px rgba(0,0,0,.60);
}

.nx-gallery-card--update {
    border-top-color: var(--nx-sem-update);
}
.nx-gallery-card--event {
    border-top-color: var(--nx-sem-event);
}
.nx-gallery-card--maintenance {
    border-top-color: var(--nx-sem-maintenance);
}
.nx-gallery-card--other {
    border-top-color: var(--nx-sem-other);
}

.nx-gallery-card--update:hover {
    border-color: var(--nx-sem-update);
}
.nx-gallery-card--event:hover {
    border-color: var(--nx-sem-event);
}
.nx-gallery-card--maintenance:hover {
    border-color: var(--nx-sem-maintenance);
}
.nx-gallery-card--other:hover {
    border-color: var(--nx-sem-other);
}

.nx-gallery-card__image {
    width: 100%;
    height: auto;
    max-height: 200px;
    object-fit: contain;
    background: rgba(0,0,0,.30);
    border-bottom: 1px solid var(--nx-border-inner);
}

.nx-gallery-card__placeholder {
    min-height: 200px;
}

.nx-gallery-card__body {
    min-width: 0;
    min-height: 180px;
    padding: 1.25rem;
    display: flex;
    flex: 1 1 auto;
    flex-direction: column;
}

.nx-gallery-card__meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .75rem;
    margin-bottom: .75rem;
    color: var(--nx-text-muted);
    font-size: .75rem;
}

.nx-gallery-meta-item {
    display: inline-flex;
    align-items: center;
    gap: .25rem;
}

.nx-gallery-meta-item i,
.nx-gallery-meta-item svg {
    color: var(--nx-accent);
}

.nx-gallery-card__title {
    min-width: 0;
    margin: 0 0 .5rem;
    color: var(--nx-text-primary);
    font-family: var(--nx-font-display);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.38;
    overflow-wrap: anywhere;
}

.nx-gallery-card__excerpt {
    min-width: 0;
    margin: 0;
    flex: 1 1 auto;
    color: var(--nx-text-content);
    font-size: .875rem;
    line-height: 1.625;
    overflow-wrap: anywhere;
}

/* ============================================================
   SEMANTIC BADGES
   ============================================================ */
.nx-gallery-badge {
    padding: .15rem .75rem;
    clip-path:
        polygon(
            4px 0,
            100% 0,
            100% calc(100% - 4px),
            calc(100% - 4px) 100%,
            0 100%,
            0 4px
        );
    font-size: .65rem;
    font-weight: 700;
    letter-spacing: .06em;
    line-height: 1.35;
    text-transform: uppercase;
}

/* ============================================================
   SINGLE ALBUM
   ============================================================ */
.nx-gallery-article {
    width: 100%;
    max-width: 72rem;
    margin: 0 auto;
}

.nx-gallery-cover-frame {
    display: block;
    width: 100%;
    margin: 0 0 1.5rem;
    padding: 0;
    overflow: hidden;
    background: rgba(0,0,0,.20);
    border: 1px solid var(--nx-border-inner);
    cursor: zoom-in;
}

.nx-gallery-cover {
    display: block;
    width: 100%;
    max-height: 620px;
    object-fit: contain;
    border: 1px solid var(--nx-border-inner);
}

.nx-gallery-single-title {
    margin-bottom: 1rem;
    font-size: clamp(1.875rem, 3vw, 2.25rem);
    line-height: 1.2;
    overflow-wrap: anywhere;
}

.nx-gallery-single-meta {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.5rem;
    color: var(--nx-text-muted);
    font-size: .875rem;
    border-bottom: 1px solid var(--nx-border-inner);
}

.nx-gallery-content {
    margin-bottom: 2rem;
    color: var(--nx-text-content);
    font-size: 1rem;
    line-height: 1.75;
    overflow-wrap: anywhere;
}

.nx-gallery-photo-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 1rem;
}

.nx-gallery-thumb-btn {
    min-width: 0;
    padding: 0;
    overflow: hidden;
    text-align: left;
    background: rgba(var(--nx-surface-rgb), .25);
    border: 1px solid var(--nx-border-inner);
    color: var(--nx-text-content);
    cursor: zoom-in;
    transition:
        border-color .20s ease,
        box-shadow .20s ease;
}

.nx-gallery-thumb-btn:hover {
    border-color: var(--nx-accent);
    box-shadow: 0 0 14px rgba(var(--nx-accent-rgb), .10);
}

.nx-gallery-thumb {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 10;
    object-fit: cover;
    transition:
        transform .20s ease,
        filter .20s ease;
}

.nx-gallery-thumb-btn:hover .nx-gallery-thumb {
    transform: scale(1.025);
    filter: brightness(1.08);
}

.nx-gallery-thumb-caption {
    display: block;
    padding: .5rem .75rem;
    color: var(--nx-text-content);
    font-size: .75rem;
    line-height: 1.45;
    overflow-wrap: anywhere;
}

.nx-gallery-back {
    margin-top: 2rem;
    padding: .5rem 1.5rem;
    border-color: var(--nx-border-outer);
    clip-path:
        polygon(
            4px 0,
            100% 0,
            100% calc(100% - 4px),
            calc(100% - 4px) 100%,
            0 100%,
            0 4px
        );
    font-family: var(--nx-font-display);
    letter-spacing: .02em;
    box-shadow:
        inset 0 0 0 1px rgba(var(--nx-border-inner-rgb), .35),
        0 6px 18px rgba(var(--nx-surface-rgb), .45);
}

.nx-gallery-back:hover {
    background: var(--nx-accent-bg-active);
    border-color: var(--nx-accent);
    color: var(--nx-text-primary);
}

.nx-gallery-back:hover i,
.nx-gallery-back:hover svg {
    color: var(--nx-accent);
}

/* ============================================================
   PLACEHOLDERS / EMPTY / 404
   ============================================================ */
.nx-gallery-placeholder {
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0,0,0,.30);
    color: rgba(var(--nx-accent-rgb), .30);
}

.nx-gallery-placeholder--cover {
    min-height: 200px;
    margin-bottom: 1.5rem;
    border: 1px solid var(--nx-border-inner);
}

.nx-gallery-placeholder--cover i {
    font-size: 4.5rem;
}

.nx-gallery-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    padding: 3rem 1rem;
    color: var(--nx-text-muted);
    font-size: 1.25rem;
    text-align: center;
}

.nx-gallery-empty p {
    margin: 0;
}

.nx-gallery-empty--photos {
    margin-top: .5rem;
    border: 1px solid var(--nx-border-inner);
    background: rgba(var(--nx-surface-rgb), .25);
}

.nx-gallery-empty__icon {
    color: rgba(var(--nx-accent-rgb), .45);
    font-size: 3rem;
}

.nx-gallery-404 {
    max-width: 900px;
    margin: 0 auto;
    padding-block: 2rem;
    text-align: center;
}

.nx-gallery-404__icon {
    display: block;
    margin-bottom: 1.25rem;
    color: rgba(var(--nx-accent-rgb), .45);
    font-size: 3rem;
}

.nx-gallery-404__copy {
    margin: 1rem auto 0;
    max-width: 46rem;
}

/* ============================================================
   PAGINATION — structural NORYX, never category-colored
   ============================================================ */
.nx-gallery-pagination {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: .5rem;
    margin-top: 2rem;
}

.nx-gallery-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .35rem;
    min-width: 2.5rem;
    padding: .5rem 1rem;
    color: var(--nx-text-muted);
    background: var(--nx-surface-control);
    border: 1px solid var(--nx-border-inner);
    clip-path:
        polygon(
            4px 0,
            100% 0,
            100% calc(100% - 4px),
            calc(100% - 4px) 100%,
            0 100%,
            0 4px
        );
    font-family: var(--nx-font-display);
    font-size: .875rem;
    font-weight: 700;
    text-decoration: none;
    transition:
        color .20s ease,
        background-color .20s ease,
        border-color .20s ease,
        box-shadow .20s ease,
        transform .20s ease;
}

.nx-gallery-page-link:hover {
    color: var(--nx-text-primary);
    background: var(--nx-accent-bg-hover);
    border-color: var(--nx-accent);
    box-shadow: 0 0 14px rgba(var(--nx-accent-rgb), .10);
    transform: translateY(-2px);
}

.nx-gallery-page-link.is-active {
    color: var(--nx-cta-primary-text);
    background: var(--nx-accent);
    border-color: var(--nx-accent);
    box-shadow: 0 0 16px rgba(var(--nx-accent-rgb), .22);
}

.nx-gallery-page-link:focus-visible {
    outline: 2px solid var(--nx-accent);
    outline-offset: 2px;
}

/* ============================================================
   LIGHTBOX — functional overlay, NORYX visual contract
   ============================================================ */
.gallery-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    isolation: isolate;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(0,0,0,.94);
    backdrop-filter: blur(5px);
    -webkit-backdrop-filter: blur(5px);
}

.gallery-lightbox.is-open {
    display: flex;
}

.gallery-lightbox-stage {
    display: flex;
    max-width: 100%;
    max-height: 100%;
    flex-direction: column;
    align-items: center;
}

.gallery-lightbox-image {
    max-width: min(92vw, 1500px);
    max-height: 82vh;
    object-fit: contain;
}

.gallery-lightbox-meta {
    max-width: 64rem;
    margin-top: .75rem;
    padding-inline: 3rem;
    text-align: center;
}

.nx-gallery-counter {
    margin-bottom: .25rem;
    color: var(--nx-accent);
    font-size: .75rem;
    font-weight: 700;
    letter-spacing: .12em;
}

.gallery-lightbox-caption {
    color: var(--nx-text-content);
    font-size: .875rem;
    overflow-wrap: anywhere;
}

.gallery-lightbox-control {
    position: absolute;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    background: var(--nx-surface-base);
    border: 1px solid var(--nx-border-inner);
    color: var(--nx-accent);
    cursor: pointer;
    transition:
        border-color .20s ease,
        color .20s ease;
}

.gallery-lightbox-control:hover {
    background: var(--nx-surface-base);
    border-color: var(--nx-accent);
    color: var(--nx-text-primary);
}

.gallery-lightbox-control:focus-visible {
    outline: 2px solid var(--nx-accent);
    outline-offset: 2px;
}

.gallery-lightbox-close {
    top: 1rem;
    right: 1rem;
    width: 2.75rem;
    height: 2.75rem;
    font-size: 1.25rem;
}

.gallery-lightbox-prev,
.gallery-lightbox-next {
    top: 50%;
    width: 3rem;
    height: 3.5rem;
    transform: translateY(-50%);
    font-size: 1.25rem;
}

.gallery-lightbox-prev {
    left: 1.5rem;
}

.gallery-lightbox-next {
    right: 1.5rem;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (max-width: 1023px) {
    .nx-gallery-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .nx-gallery-photo-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }
}

@media (max-width: 767px) {
    .nx-gallery-page {
        padding-inline: 1.5rem;
    }

    .nx-gallery-matrix {
        padding: 1.5rem;
    }

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

    .nx-gallery-photo-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: .75rem;
    }

    .nx-gallery-filters {
        align-items: stretch;
    }

    .nx-gallery-tab {
        flex: 1 1 calc(50% - .45rem);
        min-width: 0;
        padding-inline: .75rem;
    }

    .nx-gallery-single-meta {
        gap: .75rem;
    }

    .gallery-lightbox {
        padding: .75rem;
    }

    .gallery-lightbox-prev {
        left: .75rem;
    }

    .gallery-lightbox-next {
        right: .75rem;
    }
}

@media (max-width: 430px) {
    .nx-gallery-page {
        padding-inline: 1rem;
    }

    .nx-gallery-matrix {
        padding: 1.25rem;
    }

    .nx-gallery-tab {
        flex-basis: 100%;
    }

    .nx-gallery-photo-grid {
        grid-template-columns: minmax(0, 1fr);
    }

    .gallery-lightbox-meta {
        padding-inline: 2rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    .nx-gallery-card,
    .nx-gallery-tab,
    .nx-gallery-page-link,
    .nx-gallery-thumb,
    .nx-gallery-thumb-btn,
    .gallery-lightbox-control {
        transition-duration: .01ms;
    }

    .nx-gallery-card:hover,
    .nx-gallery-tab:hover,
    .nx-gallery-page-link:hover {
        transform: none;
    }

    .nx-gallery-thumb-btn:hover .nx-gallery-thumb {
        transform: none;
    }
}
