/* Frontend Gallery — responsive grid, fixed width, natural image ratio */
.fg-page {
    --fg-gap: 20px;
    --fg-cols: 4;
    --fg-text: #0f172a;
    --fg-muted: #64748b;
    --fg-border: #e2e8f0;
    --fg-bg: #f8fafc;
    --fg-card: #ffffff;
    --fg-radius: 12px;
    --fg-shadow: 0 4px 24px rgba(15, 23, 42, 0.07);
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 16px 48px;
    font-family: inherit;
    box-sizing: border-box;
}

.fg-wrap {
    background: var(--fg-bg, #f8fafc);
}

.fg-intro {
    max-width: 900px;
    margin: 0 auto 8px;
    padding: 0 16px;
    text-align: center;
    color: var(--fg-muted, #64748b);
    line-height: 1.65;
}

.fg-intro:empty {
    display: none;
}

/* Filters */
.fg-toolbar {
    margin-bottom: var(--fg-gap);
    padding: 4px 0;
}

.fg-toolbar-inner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 10px 14px;
    background: var(--fg-card);
    border: 1px solid var(--fg-border);
    border-radius: 999px;
    box-shadow: var(--fg-shadow);
}

.fg-toolbar-label {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 0 4px 0 8px;
    font-size: 0.78rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--fg-muted);
    white-space: nowrap;
}

.fg-toolbar-label i {
    color: var(--c1, #2563eb);
}

.fg-cats {
    display: flex;
    gap: 8px;
    overflow-x: auto;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
    padding: 2px 0;
}

.fg-cats::-webkit-scrollbar {
    display: none;
}

.fg-cat {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    padding: 8px 16px;
    border-radius: 999px;
    font-size: 0.84rem;
    font-weight: 600;
    text-decoration: none !important;
    color: var(--fg-muted) !important;
    background: #f1f5f9;
    border: 1px solid transparent;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.fg-cat:hover {
    color: var(--fg-text) !important;
    background: #e2e8f0;
}

.fg-cat.is-active {
    color: #fff !important;
    background: linear-gradient(135deg, var(--c1, #2563eb), var(--c2, #7c3aed));
    box-shadow: 0 4px 14px rgba(37, 99, 235, 0.28);
}

/* Masonry columns — images flow up, no row gaps from mixed heights */
.fg-grid {
    column-count: var(--fg-cols);
    column-gap: var(--fg-gap);
    width: 100%;
}

.fg-item {
    break-inside: avoid;
    -webkit-column-break-inside: avoid;
    page-break-inside: avoid;
    margin: 0 0 var(--fg-gap);
    padding: 0;
    width: 100%;
    display: inline-block;
    vertical-align: top;
}

.fg-item-media {
    position: relative;
    display: block;
    overflow: hidden;
    width: 100%;
    height: auto;
    border-radius: var(--fg-radius);
    background: #e2e8f0;
    text-decoration: none !important;
    line-height: 0;
}

.fg-item-media img {
    width: 100%;
    max-width: 100%;
    height: auto;
    display: block;
    vertical-align: top;
    transition: transform 0.35s ease;
}

.fg-item:hover .fg-item-media img {
    transform: scale(1.03);
}

.fg-item-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    opacity: 0;
    transition: opacity 0.25s ease;
    line-height: normal;
}

.fg-item:hover .fg-item-overlay {
    opacity: 1;
}

.fg-item-zoom {
    width: 44px;
    height: 44px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(255, 255, 255, 0.95);
    color: var(--c1, #2563eb);
    font-size: 1rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.18);
}

/* Empty state */
.fg-empty {
    text-align: center;
    padding: 64px 24px;
    background: var(--fg-card);
    border-radius: var(--fg-radius);
    border: 1px dashed var(--fg-border);
}

.fg-empty-icon {
    width: 72px;
    height: 72px;
    margin: 0 auto 16px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(135deg, rgba(37, 99, 235, 0.1), rgba(124, 58, 237, 0.1));
    color: var(--c1, #2563eb);
    font-size: 1.6rem;
}

.fg-empty h3 {
    margin: 0 0 8px;
    font-size: 1.1rem;
    color: var(--fg-text);
}

.fg-empty p {
    margin: 0 0 18px;
    color: var(--fg-muted);
    font-size: 0.9rem;
}

.fg-empty-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 10px 18px;
    border-radius: 999px;
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none !important;
    color: #fff !important;
    background: linear-gradient(135deg, var(--c1, #2563eb), var(--c2, #7c3aed));
}

.fg-page.lightgallery {
    z-index: auto !important;
}

/* Responsive column counts */
@media (max-width: 1199px) {
    .fg-page {
        --fg-cols: 3;
    }
}

@media (max-width: 991px) {
    .fg-page {
        --fg-cols: 2;
    }
}

@media (max-width: 767px) {
    .fg-page {
        --fg-cols: 2;
        padding: 0 12px 36px;
    }

    .fg-toolbar-inner {
        border-radius: 16px;
        flex-wrap: wrap;
    }

    .fg-toolbar-label {
        width: 100%;
        padding-left: 4px;
    }

    .fg-cats {
        width: 100%;
    }
}

@media (max-width: 480px) {
    .fg-page {
        --fg-cols: 1;
        --fg-gap: 16px;
    }
}

@media (min-width: 1400px) {
    .fg-page {
        --fg-cols: 5;
    }
}
