/**
 * Favthon Enterprise — Gallery page
 * Masonry-style portfolio grid + click-to-open lightbox popup.
 */

/* ---------- Intro ---------- */

.favthon-gallery-intro__text {
    color: var(--gray);
    font-size: 1rem;
    line-height: 1.75;
    margin-bottom: 0;
}

/* ---------- Filter tabs ---------- */

.favthon-gallery-filters {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 10px;
    margin-top: 2.25rem;
}

.favthon-gallery-filter {
    border: 1px solid var(--border-color);
    background: var(--white);
    color: var(--body-color);
    font-weight: 600;
    font-size: 0.85rem;
    padding: 10px 22px;
    border-radius: 999px;
    cursor: pointer;
    transition: var(--transition);
}

.favthon-gallery-filter:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.favthon-gallery-filter.is-active {
    background: var(--primary);
    border-color: var(--primary);
    color: var(--white);
}

/* ---------- Grid ---------- */

.favthon-gallery-grid-section {
    padding-top: 10px;
}

.favthon-gallery-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 220px;
    grid-auto-flow: dense;
    gap: 18px;
}

.favthon-gallery-item {
    position: relative;
    grid-column: span 1;
    grid-row: span 1;
    border: 0;
    padding: 0;
    margin: 0;
    border-radius: 14px;
    overflow: hidden;
    cursor: pointer;
    background: var(--light);
    box-shadow: 0 6px 18px rgba(11, 46, 99, 0.08);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.favthon-gallery-item--wide {
    grid-column: span 2;
}

.favthon-gallery-item--tall {
    grid-row: span 2;
}

.favthon-gallery-item:hover {
    transform: translateY(-4px);
    box-shadow: 0 16px 32px rgba(11, 46, 99, 0.18);
}

.favthon-gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}

.favthon-gallery-item:hover img {
    transform: scale(1.06);
}

.favthon-gallery-item.is-hidden {
    display: none;
}

.favthon-gallery-item__overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: flex-end;
    padding: 18px 20px;
    text-align: left;
    background: linear-gradient(180deg, rgba(11, 46, 99, 0) 45%, rgba(9, 20, 38, 0.88) 100%);
    opacity: 0;
    transition: opacity 0.3s ease;
}

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

.favthon-gallery-item__cat {
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.7rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.favthon-gallery-item__title {
    color: var(--white);
    font-weight: 700;
    font-size: 1.05rem;
    line-height: 1.3;
}

.favthon-gallery-item__icon {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 38px;
    height: 38px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.16);
    border: 1px solid rgba(255, 255, 255, 0.5);
    color: var(--white);
    border-radius: 50%;
    font-size: 0.85rem;
    backdrop-filter: blur(2px);
    transform: translateY(-6px);
    opacity: 0;
    transition: opacity 0.3s ease, transform 0.3s ease;
}

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

.favthon-gallery-empty {
    text-align: center;
    color: var(--gray);
    padding: 40px 0;
}

/* ---------- Responsive grid ---------- */

@media (max-width: 991.98px) {
    .favthon-gallery-grid {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 200px;
    }
    .favthon-gallery-item--wide {
        grid-column: span 2;
    }
    .favthon-gallery-item--tall {
        grid-row: span 2;
    }
}

@media (max-width: 575.98px) {
    .favthon-gallery-grid {
        grid-template-columns: 1fr;
        grid-auto-rows: 260px;
        gap: 14px;
    }
    .favthon-gallery-item--wide,
    .favthon-gallery-item--tall {
        grid-column: span 1;
        grid-row: span 1;
    }
    .favthon-gallery-filters {
        gap: 8px;
    }
    .favthon-gallery-filter {
        padding: 8px 16px;
        font-size: 0.8rem;
    }
}

/* ---------- Lightbox popup ---------- */

.favthon-lightbox {
    position: fixed;
    inset: 0;
    z-index: 10050;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.28s ease, visibility 0.28s ease;
}

.favthon-lightbox.is-open {
    opacity: 1;
    visibility: visible;
}

.favthon-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(6, 12, 24, 0.92);
    backdrop-filter: blur(3px);
}

.favthon-lightbox__stage {
    position: relative;
    z-index: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    max-width: min(1000px, 90vw);
    max-height: 88vh;
    transform: scale(0.94);
    opacity: 0;
    transition: transform 0.32s ease, opacity 0.32s ease;
}

.favthon-lightbox.is-open .favthon-lightbox__stage {
    transform: scale(1);
    opacity: 1;
}

.favthon-lightbox__frame {
    border: 1px solid rgba(255, 255, 255, 0.15);
    border-radius: 10px;
    overflow: hidden;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.55);
    background: #0b1524;
    max-height: 74vh;
    display: flex;
}

.favthon-lightbox__img {
    display: block;
    max-width: min(1000px, 90vw);
    max-height: 74vh;
    width: auto;
    height: auto;
    object-fit: contain;
}

.favthon-lightbox__caption {
    margin-top: 18px;
    text-align: center;
    color: var(--white);
}

.favthon-lightbox__cat {
    display: block;
    color: var(--accent);
    text-transform: uppercase;
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 1.5px;
    margin-bottom: 4px;
}

.favthon-lightbox__title {
    display: block;
    font-size: 1.15rem;
    font-weight: 700;
}

.favthon-lightbox__close,
.favthon-lightbox__nav {
    position: absolute;
    z-index: 3;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, 0.25);
    background: rgba(255, 255, 255, 0.08);
    color: var(--white);
    font-size: 1.05rem;
    cursor: pointer;
    transition: var(--transition);
}

.favthon-lightbox__close:hover,
.favthon-lightbox__nav:hover {
    background: var(--accent);
    border-color: var(--accent);
    color: var(--secondary);
}

.favthon-lightbox__close {
    top: 24px;
    right: 24px;
}

.favthon-lightbox__nav--prev {
    left: 24px;
    top: 50%;
    transform: translateY(-50%);
}

.favthon-lightbox__nav--next {
    right: 24px;
    top: 50%;
    transform: translateY(-50%);
}

body.favthon-lightbox-open {
    overflow: hidden;
}

@media (max-width: 575.98px) {
    .favthon-lightbox__close {
        top: 14px;
        right: 14px;
        width: 40px;
        height: 40px;
    }
    .favthon-lightbox__nav {
        width: 40px;
        height: 40px;
    }
    .favthon-lightbox__nav--prev {
        left: 10px;
    }
    .favthon-lightbox__nav--next {
        right: 10px;
    }
    .favthon-lightbox__title {
        font-size: 1rem;
    }
}
