/* ============================================================
   LUX BUILDERS FLORIDA — GALLERY STYLES
   Loaded after style.css. Uses your existing --brand-red,
   --font-heading, --text-gray-* tokens and the .portfolio-card
   component styling directly, so new UI (filters + lightbox)
   matches the rest of the site without redefining it.
   ============================================================ */

/* ---------- Filter tabs ---------- */
.gallery-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin: 0 0 3rem;
}

.filter-btn {
    font-family: inherit;
    font-size: 0.8125rem;
    font-weight: 600;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-gray-300);
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 0.125rem;
    padding: 0.6rem 1.25rem;
    cursor: pointer;
    transition: color 0.3s, border-color 0.3s, background-color 0.3s, box-shadow 0.3s;
}

.filter-btn:hover {
    color: white;
    border-color: rgba(255, 255, 255, 0.3);
}

.filter-btn.active {
    color: white;
    background-color: var(--brand-red);
    border-color: var(--brand-red);
    box-shadow: 0 10px 15px -3px rgba(220, 38, 38, 0.2);
}
.filter-btn.active:hover {
    background-color: var(--brand-redhover);
    border-color: var(--brand-redhover);
}

.filter-btn:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}

/* ---------- Gallery grid ---------- */
.gallery-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.5rem;
}
@media (min-width: 768px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }
@media (min-width: 1024px) { .gallery-grid { grid-template-columns: repeat(2, 1fr); } }

/*
 * .gallery-card carries .portfolio-card too, so it already inherits
 * position/overflow/border-radius/aspect-ratio/box-shadow/cursor from
 * that rule in style.css. Here we ONLY reset native <button> chrome
 * (border, background, font, text-align) — we deliberately do not
 * touch the properties above, so the visual shell stays identical to
 * your existing portfolio cards.
 */
.gallery-card {
    display: block;
    width: 100%;
    margin: 0;
    padding: 0;
    border: none;
    background: none;
    font: inherit;
    color: inherit;
    text-align: left;
    -webkit-appearance: none;
    appearance: none;
    isolation: isolate;

    /* scroll-in fade, independent of the hover states already defined
       on .portfolio-card in style.css */
    opacity: 0;
    transform: translateY(24px);
    transition: opacity 0.6s ease, transform 0.6s ease;
}

.gallery-card.in-view {
    opacity: 1;
    transform: translateY(0);
}

@media (prefers-reduced-motion: reduce) {
    .gallery-card {
        transition: none;
        opacity: 1;
        transform: none;
    }
}

/* Fixes the few-px inline-image gap; everything else (width/height/
   object-fit/hover scale/grayscale) already comes from .portfolio-img
   in style.css and is untouched. */
.gallery-card .portfolio-img { display: block; }

.gallery-card:hover .portfolio-img,
.gallery-card:focus-visible .portfolio-img {
    filter: brightness(1.08);
}

.gallery-card:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 3px;
}

.gallery-card .portfolio-card-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.gallery-count-badge {
    position: absolute;
    top: 1rem;
    left: 1rem;
    z-index: 25;
    background-color: rgba(10, 10, 10, 0.6);
    color: white;
    font-size: 0.6875rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    padding: 0.3rem 0.6rem;
    border-radius: 0.125rem;
    border: 1px solid rgba(255, 255, 255, 0.15);
}

.gallery-expand-icon {
    position: absolute;
    top: 1rem;
    right: 1rem;
    width: 2.25rem;
    height: 2.25rem;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background: rgba(10, 10, 10, 0.55);
    border: 1px solid rgba(255, 255, 255, 0.25);
    border-radius: 50%;
    opacity: 0;
    transform: scale(0.85);
    transition: opacity 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
    pointer-events: none;
    z-index: 35;
}
.gallery-expand-icon svg { width: 1rem; height: 1rem; }

.gallery-card:hover .gallery-expand-icon,
.gallery-card:focus-visible .gallery-expand-icon {
    opacity: 1;
    transform: scale(1);
    border-color: rgba(220, 38, 38, 0.5);
}

/* ---------- Empty state ---------- */
.gallery-empty {
    text-align: center;
    padding: 4rem 1rem;
    color: var(--text-gray-500);
    font-size: 0.9375rem;
}

/* ---------- Load more ---------- */
.gallery-load-more-wrap {
    display: flex;
    justify-content: center;
    margin-top: 3rem;
}

/* ============================================================
   LIGHTBOX
   These are standalone elements (no shared classes with the rest
   of the site), so a full reset is safe here.
   ============================================================ */
.lightbox-overlay {
    position: fixed;
    inset: 0;
    z-index: 999;
    background: rgba(10, 10, 10, 0.94);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2rem;
    animation: lightboxFadeIn 0.25s ease;
}

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

@keyframes lightboxFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.lightbox-content {
    display: flex;
    flex-direction: column;
    max-width: 1100px;
    width: 100%;
    max-height: 90vh;
    overflow-y: auto;
}

.lightbox-image-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 0;
    flex: 1;
}

.lightbox-image {
    max-width: 100%;
    max-height: 70vh;
    object-fit: contain;
    border-radius: 0.125rem;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
}

.lightbox-photo-caption {
    text-align: center;
    color: var(--text-gray-400);
    font-size: 0.875rem;
    font-weight: 300;
    margin: 0.75rem 0 0;
}
.lightbox-photo-caption[hidden] { display: none; }

.lightbox-strip {
    display: flex;
    gap: 0.5rem;
    overflow-x: auto;
    margin-top: 1rem;
    padding-bottom: 0.25rem;
    scrollbar-width: thin;
}
.lightbox-strip[hidden] { display: none; }

.lightbox-strip-thumb {
    all: unset;
    box-sizing: border-box;
    flex: 0 0 auto;
    width: 4.5rem;
    height: 3.375rem;
    border-radius: 0.125rem;
    overflow: hidden;
    cursor: pointer;
    opacity: 0.5;
    border: 2px solid transparent;
    transition: opacity 0.25s, border-color 0.25s;
}
.lightbox-strip-thumb:hover { opacity: 0.8; }
.lightbox-strip-thumb.active {
    opacity: 1;
    border-color: var(--brand-red);
}
.lightbox-strip-thumb:focus-visible {
    opacity: 1;
    outline: 2px solid var(--brand-red);
    outline-offset: 2px;
}
.lightbox-strip-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.lightbox-caption {
    text-align: center;
    padding-top: 1.5rem;
    color: white;
}

.lightbox-tag {
    display: block;
    color: var(--brand-red);
    font-size: 0.75rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.6rem;
}

.lightbox-title {
    font-family: var(--font-heading);
    font-size: 1.5rem;
    font-weight: bold;
    color: white;
    margin: 0 0 0.4rem;
}

.lightbox-location {
    font-size: 0.875rem;
    color: var(--text-gray-400);
    margin: 0 0 0.75rem;
}

.lightbox-desc {
    font-size: 0.9375rem;
    font-weight: 300;
    line-height: 1.625;
    color: var(--text-gray-300);
    max-width: 42rem;
    margin: 0 auto;
}

.lightbox-counter {
    display: inline-block;
    margin-top: 1rem;
    font-size: 0.75rem;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-gray-500);
}

.lightbox-close,
.lightbox-nav {
    all: unset;
    box-sizing: border-box;
    position: fixed;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    background-color: var(--brand-dark);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    cursor: pointer;
    transition: background-color 0.3s, border-color 0.3s, box-shadow 0.3s;
    z-index: 1000;
}

.lightbox-close:hover,
.lightbox-nav:hover {
    background-color: var(--brand-red);
    border-color: var(--brand-red);
    box-shadow: 0 0 15px rgba(220, 38, 38, 0.4);
}

.lightbox-close:focus-visible,
.lightbox-nav:focus-visible {
    outline: 2px solid var(--brand-red);
    outline-offset: 3px;
}

.lightbox-close {
    top: 1.5rem;
    right: 1.5rem;
    width: 2.75rem;
    height: 2.75rem;
}
.lightbox-close svg { width: 1.1rem; height: 1.1rem; }

.lightbox-nav {
    top: 50%;
    transform: translateY(-50%);
    width: 3rem;
    height: 3rem;
}
.lightbox-nav svg { width: 1.25rem; height: 1.25rem; }
.lightbox-prev { left: 1.5rem; }
.lightbox-next { right: 1.5rem; }

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

/* ---------- Responsive ---------- */
@media (max-width: 720px) {
    .lightbox-overlay { padding: 1rem; }

    .lightbox-close {
        top: 1rem;
        right: 1rem;
        width: 2.25rem;
        height: 2.25rem;
    }

    .lightbox-nav {
        width: 2.5rem;
        height: 2.5rem;
        top: auto;
        bottom: 1rem;
        transform: none;
    }
    .lightbox-prev { left: 1rem; }
    .lightbox-next { right: 1rem; }

    .lightbox-image { max-height: 45vh; }

    .lightbox-strip-thumb {
        width: 3.5rem;
        height: 2.625rem;
    }
}