/* ==========================================================================
   Public Photo Gallery
   Large proof-focused presentation inspired by Project Highlights.
   ========================================================================== */


/* ==========================================================================
   Page
   ========================================================================== */

.visual-gallery-page {
    min-height: 65vh;
    background: #f7fafc;
    color: #17334b;
}

.visual-gallery-shell {
    width: min(1380px, calc(100% - 2rem));
    margin: 0 auto;
    padding:
        clamp(2rem, 4vw, 3.75rem)
        0
        clamp(3rem, 6vw, 5rem);
}


/* ==========================================================================
   Header
   ========================================================================== */

.visual-gallery-header {
    max-width: 760px;
    margin-bottom: 1.25rem;
}

.visual-gallery-eyebrow {
    display: block;
    margin-bottom: .32rem;
    color: #0f6ea9;
    font-size: .68rem;
    font-weight: 900;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.visual-gallery-header h1 {
    margin: 0;
    color: #072a48;
    font-size: clamp(2.35rem, 5vw, 4rem);
    font-weight: 800;
    letter-spacing: -.04em;
    line-height: 1;
}

.visual-gallery-header p {
    margin: .65rem 0 0;
    color: #6a7d8c;
    font-size: .9rem;
}


/* ==========================================================================
   Filters
   ========================================================================== */

.visual-gallery-filters {
    display: grid;
    gap: .65rem;
    width: 100%;
    margin-bottom: .75rem;
    padding: .7rem .75rem;
    border: 1px solid #dae4eb;
    border-radius: .75rem;
    background: #fff;
}

.visual-gallery-filter-group {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .65rem;
}

.visual-gallery-filter-label {
    flex: 0 0 auto;
    color: #788b99;
    font-size: .57rem;
    font-weight: 850;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.visual-gallery-filter-chips {
    display: flex;
    flex-wrap: wrap;
    gap: .35rem;
}

.visual-gallery-filter-chip {
    position: relative;
    display: inline-flex;
    margin: 0;
    cursor: pointer;
}

.visual-gallery-filter-chip input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

.visual-gallery-filter-chip span {
    display: inline-flex;
    min-height: 2rem;
    align-items: center;
    justify-content: center;
    padding: .35rem .7rem;
    border: 1px solid #d4e0e8;
    border-radius: 999px;
    background: #fff;
    color: #4e677a;
    font-size: .67rem;
    font-weight: 800;
    line-height: 1;
    cursor: pointer;
    transition:
        border-color .15s ease,
        background .15s ease,
        color .15s ease,
        box-shadow .15s ease;
}

.visual-gallery-filter-chip:hover span {
    border-color: #9fc5dd;
    background: #f4f9fc;
    color: #0f6ea9;
}

.visual-gallery-filter-chip input:checked + span {
    border-color: #0f6ea9;
    background: #0f6ea9;
    color: #fff;
}

.visual-gallery-filter-chip input:focus-visible + span {
    outline: 2px solid rgba(15, 110, 169, .28);
    outline-offset: 2px;
}

.visual-gallery-filter-secondary {
    display: flex;
    flex-wrap: wrap;
    align-items: flex-end;
    gap: .5rem;
    padding-top: .6rem;
    border-top: 1px solid #e7eef3;
}

.visual-gallery-filter-secondary label {
    display: grid;
    min-width: 155px;
    gap: .18rem;
}

.visual-gallery-filter-secondary label > span {
    color: #788b99;
    font-size: .55rem;
    font-weight: 850;
    letter-spacing: .05em;
    text-transform: uppercase;
}

.visual-gallery-filter-secondary select {
    box-sizing: border-box;
    height: 2.15rem;
    padding: 0 2rem 0 .55rem;
    border: 1px solid #d1dde5;
    border-radius: .48rem;
    background: #fff;
    color: #314f66;
    font-size: .7rem;
}

.visual-gallery-clear {
    display: inline-flex;
    min-height: 2.15rem;
    align-items: center;
    padding: 0 .25rem;
    border: 0;
    background: transparent;
    color: #607587;
    font-size: .65rem;
    font-weight: 800;
    text-decoration: none;
}

.visual-gallery-clear:hover {
    color: #0f6ea9;
    text-decoration: none;
}


/* ==========================================================================
   Gallery Meta
   ========================================================================== */

.visual-gallery-meta {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    width: min(100%, 1020px);
    margin: 0 auto .7rem;
    padding: 0 .1rem;
    color: #8796a1;
    font-size: .62rem;
}

.visual-gallery-meta span:first-child {
    color: #607586;
    font-weight: 800;
}


/* ==========================================================================
   Gallery Layout
   ========================================================================== */

.visual-gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: .9rem;
    width: min(100%, 1020px);
    margin: 0 auto;
}

.visual-gallery-item {
    position: relative;
    display: block;
    width: 100%;
    padding: 0;
    overflow: hidden;
    border: 1px solid #dbe5eb;
    border-radius: .8rem;
    background: #e9eff3;
    cursor: zoom-in;
    text-align: left;
    box-shadow: 0 5px 18px rgba(18, 49, 70, .055);
    transition:
        border-color .16s ease,
        box-shadow .16s ease,
        transform .16s ease;
}

.visual-gallery-item:hover {
    border-color: #c4d6e1;
    transform: translateY(-1px);
    box-shadow: 0 10px 28px rgba(18, 49, 70, .09);
}

.visual-gallery-item::after {
    content: "";
    position: absolute;
    z-index: 2;
    inset: 0;
    background:
        linear-gradient(
            180deg,
            transparent 72%,
            rgba(4, 26, 42, .16) 100%
        );
    opacity: 0;
    pointer-events: none;
    transition: opacity .15s ease;
}

.visual-gallery-item:hover::after {
    opacity: 1;
}


/* ==========================================================================
   Before / After Pair
   ========================================================================== */

.visual-gallery-item.is-pair {
    aspect-ratio: 16 / 5;
    cursor: pointer;
}

.visual-gallery-item__pair {
    position: absolute;
    inset: 0;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    width: 100%;
    height: 100%;
    gap: 1px;
    background: #d7e1e8;
}

.visual-gallery-item__panel {
    position: relative;
    display: block;
    min-width: 0;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: #dfe7ec;
}

.visual-gallery-item__panel img {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    max-width: none;
    object-fit: cover;
    object-position: center center;
    transition: transform .18s ease;
}

.visual-gallery-item:hover .visual-gallery-item__panel img {
    transform: scale(1.01);
}


/* ==========================================================================
   Pair Labels
   ========================================================================== */

.visual-gallery-pair-label {
    position: absolute;
    z-index: 4;
    top: .55rem;
    padding: .24rem .46rem;
    border-radius: 999px;
    background: rgba(7, 42, 72, .88);
    color: #fff;
    font-size: .55rem;
    font-weight: 900;
    letter-spacing: .06em;
    line-height: 1;
    text-transform: uppercase;
    pointer-events: none;
}

.visual-gallery-pair-label--before {
    left: .55rem;
}

.visual-gallery-pair-label--after {
    right: .55rem;
    background: rgba(15, 110, 169, .92);
}

.visual-gallery-pair-divider {
    position: absolute;
    z-index: 3;
    top: 0;
    bottom: 0;
    left: 50%;
    width: 1px;
    background: rgba(255, 255, 255, .94);
    pointer-events: none;
}


/* ==========================================================================
   Compare Hint
   ========================================================================== */

.visual-gallery-item__compare-hint {
    position: absolute;
    z-index: 5;
    left: 50%;
    bottom: .55rem;
    display: inline-flex;
    min-height: 1.75rem;
    align-items: center;
    justify-content: center;
    padding: .25rem .58rem;
    border: 1px solid rgba(255, 255, 255, .42);
    border-radius: 999px;
    background: rgba(7, 42, 72, .88);
    color: #fff;
    font-size: .56rem;
    font-weight: 850;
    line-height: 1;
    opacity: .94;
    transform: translateX(-50%);
    pointer-events: none;
    transition:
        background .15s ease,
        border-color .15s ease;
}

.visual-gallery-item:hover .visual-gallery-item__compare-hint {
    border-color: rgba(255, 255, 255, .6);
    background: rgba(15, 110, 169, .94);
}


/* ==========================================================================
   Standalone Images
   ========================================================================== */

.visual-gallery-item:not(.is-pair) {
    aspect-ratio: 16 / 7;
}

.visual-gallery-item:not(.is-pair) > img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform .18s ease;
}

.visual-gallery-item:not(.is-pair):hover > img {
    transform: scale(1.01);
}

.visual-gallery-item__zoom {
    position: absolute;
    z-index: 4;
    right: .55rem;
    bottom: .55rem;
    display: inline-flex;
    width: 1.8rem;
    height: 1.8rem;
    align-items: center;
    justify-content: center;
    border-radius: 999px;
    background: rgba(7, 42, 72, .82);
    color: #fff;
    font-size: .65rem;
    opacity: 0;
    transform: translateY(3px);
    transition:
        opacity .15s ease,
        transform .15s ease;
}

.visual-gallery-item:hover .visual-gallery-item__zoom {
    opacity: 1;
    transform: translateY(0);
}

.visual-gallery-item.is-pair .visual-gallery-item__zoom {
    display: none;
}


/* ==========================================================================
   Empty State
   ========================================================================== */

.visual-gallery-empty {
    width: min(100%, 1020px);
    margin: 0 auto;
    padding: 2rem 1rem;
    border: 1px solid #d8e2e9;
    border-radius: .8rem;
    background: #fff;
    text-align: center;
}

.visual-gallery-empty strong {
    display: block;
    color: #294b62;
}

.visual-gallery-empty p {
    margin: .45rem 0;
    color: #718593;
}


/* ==========================================================================
   Lightbox
   ========================================================================== */

.visual-gallery-lightbox[hidden] {
    display: none;
}

.visual-gallery-lightbox {
    position: fixed;
    z-index: 11000;
    inset: 0;
    display: grid;
    place-items: center;
    padding: 1rem;
}

.visual-gallery-lightbox__backdrop {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    border: 0;
    background: rgba(4, 18, 29, .9);
    cursor: zoom-out;
}

.visual-gallery-lightbox__dialog {
    position: relative;
    z-index: 1;
    width: min(1500px, 97vw);
    max-height: 96vh;
    overflow: hidden;
    border-radius: .8rem;
    background: #0b1d2a;
    box-shadow: 0 24px 70px rgba(0, 0, 0, .34);
}

.visual-gallery-lightbox__close {
    position: absolute;
    z-index: 10;
    top: .6rem;
    right: .6rem;
    display: inline-flex;
    width: 2.2rem;
    height: 2.2rem;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 999px;
    background: rgba(255, 255, 255, .94);
    color: #17334b;
    font-size: 1.4rem;
    line-height: 1;
    cursor: pointer;
}


/* ==========================================================================
   Lightbox Navigation
   ========================================================================== */

.visual-gallery-lightbox__nav[hidden] {
    display: none;
}

.visual-gallery-lightbox__nav {
    position: absolute;
    z-index: 9;
    top: 50%;
    display: inline-flex;
    width: 2.8rem;
    height: 2.8rem;
    align-items: center;
    justify-content: center;
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 999px;
    background: rgba(5, 29, 45, .78);
    color: #fff;
    font-size: .95rem;
    cursor: pointer;
    transform: translateY(-50%);
    backdrop-filter: blur(8px);
    transition:
        background .15s ease,
        transform .15s ease,
        border-color .15s ease;
}

.visual-gallery-lightbox__nav:hover {
    border-color: rgba(255, 255, 255, .52);
    background: rgba(15, 110, 169, .9);
}

.visual-gallery-lightbox__nav:focus-visible {
    outline: 2px solid rgba(255, 255, 255, .92);
    outline-offset: 2px;
}

.visual-gallery-lightbox__nav--previous {
    left: .75rem;
}

.visual-gallery-lightbox__nav--next {
    right: .75rem;
}


/* ==========================================================================
   Lightbox Mode Controls
   ========================================================================== */

.visual-gallery-lightbox__mode {
    position: absolute;
    z-index: 7;
    top: .65rem;
    left: 50%;
    display: flex;
    padding: .2rem;
    border: 1px solid rgba(255, 255, 255, .25);
    border-radius: 999px;
    background: rgba(5, 29, 45, .78);
    transform: translateX(-50%);
    backdrop-filter: blur(8px);
}

.visual-gallery-lightbox__mode button {
    min-height: 1.8rem;
    padding: .3rem .62rem;
    border: 0;
    border-radius: 999px;
    background: transparent;
    color: rgba(255, 255, 255, .72);
    font-size: .6rem;
    font-weight: 850;
    cursor: pointer;
}

.visual-gallery-lightbox__mode button[aria-pressed="true"] {
    background: #fff;
    color: #173b57;
}


/* ==========================================================================
   Static Lightbox Image
   ========================================================================== */

.visual-gallery-lightbox__image-wrap {
    display: grid;
    place-items: center;
    min-height: 300px;
    max-height: calc(96vh - 64px);
    background: #071722;
}

.visual-gallery-lightbox__image-wrap img {
    display: block;
    width: auto;
    height: auto;
    max-width: 100%;
    max-height: calc(96vh - 64px);
    object-fit: contain;
}


/* ==========================================================================
   Interactive Before / After Comparison
   ========================================================================== */

.visual-gallery-compare {
    min-height: 300px;
    max-height: calc(96vh - 64px);
    background: #071722;
}

.visual-gallery-compare__stage {
    --compare-position: 50%;

    position: relative;
    width: 100%;
    height: min(calc(96vh - 64px), 900px);
    min-height: 420px;
    overflow: hidden;
    background: #071722;
    touch-action: pan-y;
}

.visual-gallery-compare__after,
.visual-gallery-compare__before {
    position: absolute;
    inset: 0;
    display: block;
    width: 100%;
    height: 100%;
    object-fit: contain;
    background: #071722;
    user-select: none;
    pointer-events: none;
}

.visual-gallery-compare__before-wrap {
    position: absolute;
    inset: 0;
    overflow: hidden;
    clip-path: inset(
        0
        calc(100% - var(--compare-position))
        0
        0
    );
}

.visual-gallery-compare__line {
    position: absolute;
    z-index: 4;
    top: 0;
    bottom: 0;
    left: var(--compare-position);
    width: 2px;
    background: rgba(255, 255, 255, .94);
    transform: translateX(-1px);
    pointer-events: none;
    box-shadow: 0 0 0 1px rgba(0, 0, 0, .15);
}

.visual-gallery-compare__handle {
    position: absolute;
    top: 50%;
    left: 50%;
    display: flex;
    width: 2.8rem;
    height: 2.8rem;
    align-items: center;
    justify-content: space-around;
    padding: 0 .45rem;
    border: 2px solid #fff;
    border-radius: 999px;
    background: rgba(8, 54, 83, .9);
    color: #fff;
    font-size: 1.15rem;
    font-weight: 900;
    transform: translate(-50%, -50%);
    box-shadow: 0 3px 12px rgba(0, 0, 0, .28);
}

.visual-gallery-compare__label {
    position: absolute;
    z-index: 4;
    top: .7rem;
    padding: .28rem .5rem;
    border-radius: 999px;
    background: rgba(7, 42, 72, .86);
    color: #fff;
    font-size: .58rem;
    font-weight: 900;
    letter-spacing: .06em;
    text-transform: uppercase;
    pointer-events: none;
}

.visual-gallery-compare__label.is-before {
    left: .7rem;
}

.visual-gallery-compare__label.is-after {
    right: .7rem;
    background: rgba(15, 110, 169, .9);
}

.visual-gallery-compare__range {
    position: absolute;
    z-index: 6;
    inset: 0;
    width: 100%;
    height: 100%;
    margin: 0;
    opacity: 0;
    cursor: ew-resize;
}


/* ==========================================================================
   Footer
   ========================================================================== */

.visual-gallery-after {
    display: flex;
    justify-content: center;
    width: min(100%, 1020px);
    margin: 1.5rem auto 0;
    padding-top: 1.1rem;
    border-top: 1px solid #d8e3ea;
}

.visual-gallery-after a {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    padding: .5rem .85rem;
    border: 1px solid #d4e0e8;
    border-radius: 999px;
    background: #fff;
    color: #0f6ea9;
    font-size: .7rem;
    font-weight: 850;
    text-decoration: none;
    transition:
        border-color .15s ease,
        background .15s ease,
        color .15s ease;
}

.visual-gallery-after a:hover {
    border-color: #9fc5dd;
    background: #f4f9fc;
    color: #0b5e91;
    text-decoration: none;
}


/* ==========================================================================
   Tablet / Mobile
   ========================================================================== */

@media (max-width: 700px) {
    .visual-gallery-shell {
        width: min(100% - 1rem, 1380px);
    }

    .visual-gallery-filter-group {
        align-items: flex-start;
    }

    .visual-gallery-filter-label {
        width: 100%;
    }

    .visual-gallery-filter-chips {
        width: 100%;
    }

    .visual-gallery-filter-secondary {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .visual-gallery-filter-secondary label {
        min-width: 0;
    }

    .visual-gallery-filters {
        width: 100%;
    }

    .visual-gallery-meta {
        font-size: .58rem;
    }

    .visual-gallery-grid {
        grid-template-columns: 1fr;
        width: 100%;
        gap: .65rem;
    }

    .visual-gallery-item.is-pair {
        aspect-ratio: 16 / 9;
    }

    .visual-gallery-item:not(.is-pair) {
        aspect-ratio: 16 / 9;
    }

    .visual-gallery-pair-label {
        top: .4rem;
    }

    .visual-gallery-pair-label--before {
        left: .4rem;
    }

    .visual-gallery-pair-label--after {
        right: .4rem;
    }

    .visual-gallery-item__compare-hint {
        bottom: .4rem;
    }

    /*
     * Mobile uses the static composite/image lightbox.
     * The interactive slider is intentionally disabled.
     */
    .visual-gallery-lightbox__mode,
    .visual-gallery-compare {
        display: none !important;
    }

    .visual-gallery-lightbox__nav {
        width: 2.45rem;
        height: 2.45rem;
        background: rgba(5, 29, 45, .72);
        font-size: .82rem;
    }

    .visual-gallery-lightbox__nav--previous {
        left: .4rem;
    }

    .visual-gallery-lightbox__nav--next {
        right: .4rem;
    }
}


/* ==========================================================================
   Small Mobile
   ========================================================================== */

@media (max-width: 480px) {
    .visual-gallery-filter-secondary {
        grid-template-columns: 1fr;
    }

    .visual-gallery-meta {
        align-items: flex-start;
        flex-direction: column;
        gap: .25rem;
    }

    .visual-gallery-item.is-pair {
        aspect-ratio: 4 / 3;
    }

    .visual-gallery-compare__label {
        transition:
            opacity .12s ease,
            visibility .12s ease;
    }

    .visual-gallery-compare__label.is-hidden {
        opacity: 0;
        visibility: hidden;
    }
}