/**
 * Ballistic Edge Theme — gallery.css
 * Styles for the "Field Recon Gallery" page (page-gallery.php).
 * Covers: shared .page-hero block, CSS masonry grid, hover overlay,
 *         "VIEW INTEL" label, crosshair icon, lightbox overlay,
 *         responsive breakpoints.
 *
 * @package Ballistic_Edge
 */

/* ═══════════════════════════════════════════════════════════════════
   0. SHARED PAGE HERO  (mirrors contact.css — self-contained copy)
   ═══════════════════════════════════════════════════════════════════ */

.page-hero {
    position: relative;
    background: var(--color-black);
    padding: 7rem var(--gutter) 9.5rem;
    overflow: hidden;
    clip-path: polygon(0 0, 100% 0, 100% 87%, 0 100%);
    margin-bottom: -3rem;
    text-align: center;
}

.page-hero__glow {
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse 55% 60% at 50% 35%, rgba(232, 99, 10, 0.16) 0%, transparent 70%);
    pointer-events: none;
}

.page-hero__grid {
    position: absolute;
    inset: 0;
    background-image:
        repeating-linear-gradient(90deg, rgba(255,255,255,0.022) 0px, rgba(255,255,255,0.022) 1px, transparent 1px, transparent 65px),
        repeating-linear-gradient(0deg,  rgba(255,255,255,0.022) 0px, rgba(255,255,255,0.022) 1px, transparent 1px, transparent 65px);
    pointer-events: none;
}

.page-hero__inner {
    position: relative;
    z-index: 1;
    max-width: var(--max-width);
    margin: 0 auto;
}

.page-hero__eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 700;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-orange);
    margin-bottom: 1rem;
}

.page-hero__title {
    font-family: var(--font-display);
    font-size: clamp(3rem, 7vw, 6rem);
    font-weight: 800;
    letter-spacing: 0.04em;
    line-height: 1.0;
    color: var(--color-white);
    margin: 0 0 1.1rem;
    text-transform: uppercase;
}

.page-hero__title-accent {
    color: var(--color-orange);
    display: block;
}

.page-hero__sub {
    font-family: var(--font-body);
    font-size: clamp(0.95rem, 1.6vw, 1.1rem);
    color: var(--color-silver);
    max-width: 620px;
    margin: 0 auto 2rem;
    line-height: 1.7;
}

.page-hero__badges {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1rem;
}

.page-hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    background: rgba(232, 99, 10, 0.1);
    border: 1px solid rgba(232, 99, 10, 0.28);
    color: var(--color-white);
    font-family: var(--font-heading);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.07em;
    text-transform: uppercase;
    padding: 0.42rem 1rem;
    border-radius: 2px;
}

.page-hero-badge i {
    color: var(--color-orange);
}

/* ═══════════════════════════════════════════════════════════════════
   1. GALLERY PAGE WRAPPER
   ═══════════════════════════════════════════════════════════════════ */

.be-gallery-main {
    background: var(--color-black);
    color: var(--color-white);
    min-height: 80vh;
}

/* Hero colour override (teal-shift for visual differentiation) */
.page-hero--gallery {
    background: linear-gradient(150deg, #0d0d0d 0%, #0a0f0f 100%);
}

.page-hero--gallery .page-hero__glow {
    background: radial-gradient(ellipse 60% 55% at 50% 35%, rgba(232, 99, 10, 0.14) 0%, transparent 70%);
}

/* ═══════════════════════════════════════════════════════════════════
   2. FILTER BAR (shown only if gallery_category taxonomy exists)
   ═══════════════════════════════════════════════════════════════════ */

.gallery-filter-bar {
    position: sticky;
    top: 70px;
    z-index: 80;
    background: rgba(13, 13, 13, 0.88);
    backdrop-filter: blur(18px);
    -webkit-backdrop-filter: blur(18px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
    padding: 0.8rem var(--gutter);
}

.gallery-filter-inner {
    max-width: var(--max-width);
    margin: 0 auto;
}

.gallery-filter-pills {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.gallery-pill {
    display: inline-flex;
    align-items: center;
    background: rgba(42, 42, 42, 0.5);
    border: 1px solid rgba(255, 255, 255, 0.07);
    border-radius: 2px;
    color: var(--color-silver);
    font-family: var(--font-heading);
    font-size: 0.76rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    padding: 0.4rem 0.85rem;
    text-decoration: none;
    transition: background var(--transition-fast), color var(--transition-fast), border-color var(--transition-fast);
}

.gallery-pill:hover {
    background: rgba(232, 99, 10, 0.12);
    border-color: rgba(232, 99, 10, 0.35);
    color: var(--color-white);
    text-decoration: none;
}

.gallery-pill.is-active {
    background: var(--color-orange);
    border-color: var(--color-orange);
    color: #fff;
}

/* ═══════════════════════════════════════════════════════════════════
   3. GALLERY SECTION
   ═══════════════════════════════════════════════════════════════════ */

.gallery-section {
    padding: 3.5rem var(--gutter) 6rem;
    background: var(--color-black);
    max-width: calc(var(--max-width) + 2 * var(--gutter));
    margin: 0 auto;
    box-sizing: border-box;
}

/* ═══════════════════════════════════════════════════════════════════
   4. CSS MASONRY GRID  (column-count approach)
   ═══════════════════════════════════════════════════════════════════ */

.gallery-grid {
    columns: 4;
    column-gap: 5px;
}

/* ── Individual gallery item ── */
.gallery-item {
    position: relative;
    display: block;            /* block so it fills column width */
    break-inside: avoid;       /* prevent column breaks mid-image */
    -webkit-column-break-inside: avoid;
    overflow: hidden;
    cursor: pointer;
    margin-bottom: 5px;
    border-radius: 3px;

    /* Subtle hover cursor hint */
    cursor: zoom-in;
}

/* Keep images block so no baseline gap */
.gallery-item__img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
    transition: transform 420ms cubic-bezier(0.25, 0.46, 0.45, 0.94);
    will-change: transform;
}

/* ── Image scale on hover ── */
.gallery-item:hover .gallery-item__img {
    transform: scale(1.06);
}

/* ── Dark gradient overlay ── */
.gallery-item__overlay {
    position: absolute;
    inset: 0;
    background: linear-gradient(
        to top,
        rgba(0, 0, 0, 0.82) 0%,
        rgba(0, 0, 0, 0.45) 40%,
        rgba(0, 0, 0, 0) 70%
    );
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding: 1.2rem;
    opacity: 0;
    transition: opacity 300ms ease;
    pointer-events: none;
}

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

.gallery-item__overlay-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.4rem;
    text-align: center;
}

/* ── Orange crosshair icon ── */
.gallery-item__crosshair {
    display: block;
    width: 28px;
    height: 28px;
    position: relative;
    margin-bottom: 0.2rem;
}

.gallery-item__crosshair::before,
.gallery-item__crosshair::after {
    content: '';
    position: absolute;
    background: var(--color-orange);
    border-radius: 1px;
}

/* Horizontal bar */
.gallery-item__crosshair::before {
    width: 100%;
    height: 2px;
    top: 50%;
    left: 0;
    transform: translateY(-50%);
    box-shadow: 0 0 6px rgba(232, 99, 10, 0.8);
}

/* Vertical bar */
.gallery-item__crosshair::after {
    width: 2px;
    height: 100%;
    left: 50%;
    top: 0;
    transform: translateX(-50%);
    box-shadow: 0 0 6px rgba(232, 99, 10, 0.8);
}

/* Circle ring for crosshair */
.gallery-item__crosshair::before {
    box-shadow: 0 0 0 1px rgba(232, 99, 10, 0.5) inset, 0 0 6px rgba(232, 99, 10, 0.8);
}

/* ── "VIEW INTEL" label ── */
.gallery-item__label {
    font-family: var(--font-heading);
    font-size: 0.72rem;
    font-weight: 800;
    letter-spacing: 0.18em;
    text-transform: uppercase;
    color: var(--color-white);
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.8);
}

/* ── Caption ── */
.gallery-item__caption {
    font-family: var(--font-body);
    font-size: 0.72rem;
    color: rgba(200, 200, 200, 0.8);
    max-width: 180px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ── Keyboard focus ring ── */
.gallery-item:focus-visible {
    outline: 2px solid var(--color-orange);
    outline-offset: 2px;
    z-index: 1;
}

/* ── Empty state ── */
.gallery-empty {
    text-align: center;
    padding: 6rem 2rem;
}

.gallery-empty__icon {
    display: block;
    font-size: 4rem;
    color: rgba(232, 99, 10, 0.3);
    margin-bottom: 1.5rem;
}

.gallery-empty__heading {
    font-family: var(--font-display);
    font-size: 2rem;
    letter-spacing: 0.1em;
    color: var(--color-white);
    margin-bottom: 0.75rem;
    text-transform: uppercase;
}

.gallery-empty__text {
    font-family: var(--font-body);
    font-size: 0.95rem;
    color: var(--color-silver);
    max-width: 520px;
    margin: 0 auto;
    line-height: 1.65;
}

/* ═══════════════════════════════════════════════════════════════════
   5. LIGHTBOX
   ═══════════════════════════════════════════════════════════════════ */

.be-lightbox {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(6, 6, 6, 0.96);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;

    /* Hidden state */
    opacity: 0;
    pointer-events: none;
    transition: opacity 250ms ease;
}

.be-lightbox.is-open {
    opacity: 1;
    pointer-events: auto;
}

/* ── Close button ── */
.be-lightbox__close {
    position: absolute;
    top: 1.2rem;
    right: 1.2rem;
    width: 46px;
    height: 46px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(42, 42, 42, 0.7);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50%;
    color: var(--color-white);
    font-size: 1.1rem;
    cursor: pointer;
    transition: background var(--transition-fast), color var(--transition-fast), transform var(--transition-fast);
    z-index: 10;
}

.be-lightbox__close:hover {
    background: var(--color-orange);
    border-color: var(--color-orange);
    transform: rotate(90deg);
}

/* ── Nav buttons ── */
.be-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 52px;
    height: 52px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(42, 42, 42, 0.65);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    color: var(--color-white);
    font-size: 1rem;
    cursor: pointer;
    z-index: 10;
    transition: background var(--transition-fast), border-color var(--transition-fast), transform 200ms ease;
}

.be-lightbox__prev { left: 1.5rem; }
.be-lightbox__next { right: 1.5rem; }

.be-lightbox__prev:hover {
    background: var(--color-orange);
    border-color: var(--color-orange);
    transform: translateY(-50%) translateX(-3px);
}

.be-lightbox__next:hover {
    background: var(--color-orange);
    border-color: var(--color-orange);
    transform: translateY(-50%) translateX(3px);
}

/* ── Image stage ── */
.be-lightbox__stage {
    display: flex;
    align-items: center;
    justify-content: center;
    max-width: calc(100vw - 160px);
    max-height: calc(100vh - 120px);
    padding: 0 1rem;
}

.be-lightbox__img {
    max-width: 100%;
    max-height: calc(100vh - 120px);
    width: auto;
    height: auto;
    object-fit: contain;
    display: block;
    border-radius: 4px;
    box-shadow: 0 20px 80px rgba(0, 0, 0, 0.8);
    transition: opacity 200ms ease;
}

/* ── Footer (counter + caption) ── */
.be-lightbox__footer {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.3rem;
    text-align: center;
}

.be-lightbox__counter {
    font-family: var(--font-heading);
    font-size: 0.75rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    color: rgba(255, 255, 255, 0.5);
    text-transform: uppercase;
}

.be-lightbox__caption {
    font-family: var(--font-body);
    font-size: 0.88rem;
    color: rgba(245, 245, 245, 0.8);
    max-width: 500px;
    line-height: 1.5;
}

/* ── Orange crosshair decoration on lightbox backdrop ── */
.be-lightbox::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 60px;
    height: 60px;
    transform: translate(-50%, -50%);
    border: 1px solid rgba(232, 99, 10, 0.12);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
}

/* ═══════════════════════════════════════════════════════════════════
   6. RESPONSIVE
   ═══════════════════════════════════════════════════════════════════ */

/* ─── ≤ 1100px — 3 columns ─── */
@media (max-width: 1100px) {
    .gallery-grid {
        columns: 3;
    }
}

/* ─── ≤ 768px — 2 columns, filter bar no longer sticky ─── */
@media (max-width: 768px) {
    .gallery-grid {
        columns: 2;
    }

    .gallery-filter-bar {
        position: static;
        top: auto;
    }

    .gallery-filter-pills {
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        padding-bottom: 0.2rem;
        scrollbar-width: none;
    }

    .gallery-filter-pills::-webkit-scrollbar {
        display: none;
    }

    .be-lightbox__stage {
        max-width: 100vw;
        padding: 0 0.5rem;
    }

    .be-lightbox__prev { left: 0.5rem; }
    .be-lightbox__next { right: 0.5rem; }

    .be-lightbox__nav {
        width: 42px;
        height: 42px;
        font-size: 0.85rem;
    }
}

/* ─── ≤ 420px — 2 tight columns ─── */
@media (max-width: 420px) {
    .gallery-section {
        padding: 2rem 0.5rem 4rem;
    }

    .gallery-grid {
        columns: 2;
        column-gap: 3px;
    }

    .gallery-item {
        margin-bottom: 3px;
    }

    .be-lightbox__footer {
        bottom: 0.75rem;
    }
}

/* ══════════════════════════════════════════════════════════════
   RESPONSIVE ADDITIONS — ensure full tablet/mobile grid coverage
   ══════════════════════════════════════════════════════════════ */

/* Mobile < 480px: single-column gallery for very small phones */
@media (max-width: 479px) {
    .gallery-grid {
        columns: 1;
        column-gap: 0;
    }

    .gallery-item {
        margin-bottom: 6px;
    }

    .gallery-section {
        padding: 2rem max(15px, 0.5rem) 4rem;
    }
}

/* ═══════════════════════════════════════════════════════════════════
   STATIC FILTER — button pill reset + JS hidden-item rule
   ═══════════════════════════════════════════════════════════════════ */

/* Normalise <button> elements that carry .gallery-pill so they
   inherit the same look as the <a> taxonomy pills above */
button.gallery-pill {
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    line-height: 1;
}

button.gallery-pill:focus-visible {
    outline: 2px solid var(--color-orange);
    outline-offset: 2px;
}

/* Items hidden by the JS category filter */
.gallery-item--hidden {
    display: none;
}

/* Smooth column reflow after items are hidden
   (column-count masonry doesn't reflow unless we tell it to) */
.gallery-grid:has(.gallery-item--hidden) {
    column-fill: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   7. ANTI-THEFT IMAGE PROTECTION
   ═══════════════════════════════════════════════════════════════════ */

/* Prevent text-selection drag and HTML5 drag on gallery images */
.gallery-item__img {
    user-select: none;
    -webkit-user-select: none;
    -webkit-user-drag: none;
    -moz-user-drag: none;
}

/* Overlay children that contain action buttons need pointer-events
   to pass through the overlay but be active on the buttons themselves */
.gallery-item__dl-btn,
.gallery-item__buy-btn {
    pointer-events: auto;
}

/* ═══════════════════════════════════════════════════════════════════
   8. PREMIUM WATERMARK OVERLAY (always visible, deters screenshotting)
   ═══════════════════════════════════════════════════════════════════ */

.gallery-item__premium-overlay {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    grid-template-rows: repeat(3, 1fr);
    place-items: center;
    pointer-events: none;
    user-select: none;
    -webkit-user-select: none;
    overflow: hidden;
}

.gallery-item__premium-wm {
    font-family: var(--font-display);
    font-size: clamp(0.45rem, 2.2vw, 1rem);
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: rgba(255, 255, 255, 0.22);
    transform: rotate(-35deg);
    white-space: nowrap;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    padding: 0 0.25em;
}

/* ═══════════════════════════════════════════════════════════════════
   9. TIER BADGE
   ═══════════════════════════════════════════════════════════════════ */

.gallery-item__tier-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(232, 99, 10, 0.15);
    border: 1px solid rgba(232, 99, 10, 0.45);
    color: var(--color-orange);
    font-family: var(--font-heading);
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    padding: 0.3rem 0.65rem;
    border-radius: 2px;
    margin-bottom: 0.35rem;
}

.gallery-item__tier-badge--soon {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.15);
    color: rgba(255, 255, 255, 0.45);
}

/* ═══════════════════════════════════════════════════════════════════
   10. ACTION BUTTONS — Download Free & Purchase High-Res
   ═══════════════════════════════════════════════════════════════════ */

/* Shared base for both buttons */
.gallery-item__dl-btn,
.gallery-item__buy-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.45rem;
    font-family: var(--font-heading);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    text-decoration: none;
    border-radius: 4px;
    padding: 0.48rem 1rem;
    margin-top: 0.5rem;
    cursor: pointer;
    transition:
        background var(--transition-fast),
        border-color var(--transition-fast),
        transform 150ms ease,
        box-shadow var(--transition-fast);
}

/* Free download button — outlined orange */
.gallery-item__dl-btn {
    background: rgba(232, 99, 10, 0.12);
    border: 1px solid rgba(232, 99, 10, 0.55);
    color: #fff;
}

.gallery-item__dl-btn:hover {
    background: var(--color-orange);
    border-color: var(--color-orange);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(232, 99, 10, 0.4);
    text-decoration: none;
}

/* Premium purchase button — solid orange */
.gallery-item__buy-btn {
    background: var(--color-orange);
    border: 1px solid var(--color-orange);
    color: #fff;
}

.gallery-item__buy-btn:hover {
    background: var(--color-orange-dark, #cc5500);
    border-color: var(--color-orange-dark, #cc5500);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 4px 18px rgba(232, 99, 10, 0.5);
    text-decoration: none;
}

/* ── Premium item cursor hint ── */
.gallery-item--premium {
    cursor: default;
}

/* ── Keep the premium overlay above the image but below hover UI ── */
.gallery-item--premium .gallery-item__overlay {
    z-index: 3;
}
