/**
 * gallery.css
 * Masonry-style image gallery with lightbox
 */

/* ══════════════════════════════════════════════════════
   GALLERY SECTION
═══════════════════════════════════════════════════════ */

.gallery {
    background: var(--clr-warm);
}

/* ── Header ──────────────────────────────────────────── */

.gallery__header {
    text-align: center;
    margin-bottom: var(--space-10);
}

.gallery__heading {
    font-size: clamp(34px, 3.5vw, 52px);
    color: var(--clr-navy);
    margin-top: var(--space-3);
}

.gallery__heading em {
    font-style: italic;
    color: var(--clr-gold);
}

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

.gallery__grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 265px;
    gap: 3px;
    margin-bottom: 3px;
}

/* Featured — 2 columns × 2 rows */
.gallery-item:nth-child(1) {
    grid-column: span 2;
    grid-row: span 2;
}

/* Last — wide */
.gallery-item:nth-child(12) {
    grid-column: span 2;
}

/* ── Item ────────────────────────────────────────────── */

.gallery-item {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: var(--clr-warm-2);
    outline: none;
}

.gallery-item__img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.55s cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

.gallery-item:hover .gallery-item__img,
.gallery-item:focus-visible .gallery-item__img {
    transform: scale(1.06);
}

/* ── Overlay — opacity + translateY only (GPU) ───────── */

.gallery-item__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(7, 18, 42, 0.86) 0%,
        rgba(7, 18, 42, 0.22) 48%,
        transparent 72%
    );
    opacity: 0;
    transition: opacity 0.28s ease-out;
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    padding: 14px 18px 18px;
    pointer-events: none;
}

.gallery-item:hover .gallery-item__overlay,
.gallery-item:focus-visible .gallery-item__overlay {
    opacity: 1;
}

/* Index number — top left */
.gallery-item__num {
    font-family: var(--font-display);
    font-size: 11px;
    letter-spacing: 0.10em;
    color: rgba(200, 169, 106, 0.65);
    display: block;
    align-self: flex-start;
}

/* Bottom row — title + icon */
.gallery-item__bottom {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 12px;
    transform: translateY(8px);
    transition: transform 0.30s ease-out;
}

.gallery-item:hover .gallery-item__bottom,
.gallery-item:focus-visible .gallery-item__bottom {
    transform: translateY(0);
}

.gallery-item__title {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.13em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.90);
    line-height: 1.4;
    max-width: none;
}

.gallery-item__icon {
    width: 26px;
    height: 26px;
    border: 1px solid rgba(200, 169, 106, 0.50);
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--clr-gold);
    flex-shrink: 0;
}

/* Gold inset border on hover */
.gallery-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border: 2px solid rgba(200, 169, 106, 0.50);
    opacity: 0;
    transition: opacity 0.28s ease-out;
    pointer-events: none;
    z-index: 2;
}

.gallery-item:hover::after,
.gallery-item:focus-visible::after {
    opacity: 1;
}

/* ── Footer ──────────────────────────────────────────── */

.gallery__footer {
    padding-block: var(--space-8) 0;
}

.gallery__count {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.10em;
    text-transform: uppercase;
    color: var(--clr-text-light);
}

.gallery__count em {
    font-style: normal;
    color: var(--clr-gold);
    margin-right: 4px;
}

/* ══════════════════════════════════════════════════════
   LIGHTBOX
═══════════════════════════════════════════════════════ */

.lightbox {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.94);
    z-index: var(--z-lightbox);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    pointer-events: none;
    transition: opacity var(--duration-base) var(--ease-out);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.lightbox.active {
    opacity: 1;
    pointer-events: all;
}

.lightbox__img {
    max-width: 90vw;
    max-height: 88vh;
    object-fit: contain;
    box-shadow: 0 40px 120px rgba(0, 0, 0, 0.6);
    transition: opacity var(--duration-base) var(--ease-out);
    display: block;
}

.lightbox__img.loading {
    opacity: 0;
}

/* Close button */
.lightbox__close {
    position: absolute;
    top: 24px;
    right: 28px;
    background: rgba(255, 255, 255, 0.08);
    border: 1px solid rgba(255, 255, 255, 0.12);
    color: rgba(255, 255, 255, 0.8);
    font-size: 28px;
    width: 48px;
    height: 48px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition:
        background var(--duration-fast) var(--ease-out),
        color      var(--duration-fast) var(--ease-out);
    backdrop-filter: blur(8px);
}

.lightbox__close:hover {
    background: rgba(200, 169, 106, 0.2);
    color: var(--clr-gold);
}

/* Navigation arrows */
.lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: rgba(255, 255, 255, 0.75);
    width: 56px;
    height: 56px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 30px;
    line-height: 1;
    transition:
        background var(--duration-fast) var(--ease-out),
        color      var(--duration-fast) var(--ease-out);
    backdrop-filter: blur(8px);
}

.lightbox__nav:hover {
    background: rgba(200, 169, 106, 0.25);
    color: var(--clr-gold);
}

.lightbox__prev { left: 24px; }
.lightbox__next { right: 24px; }

/* Counter */
.lightbox__counter {
    position: absolute;
    bottom: 28px;
    left: 50%;
    transform: translateX(-50%);
    color: rgba(255, 255, 255, 0.4);
    font-size: 12px;
    font-weight: 500;
    letter-spacing: 0.12em;
    white-space: nowrap;
}
