/* =========================================================
   xGallery — gallery.css
   Fonts, background (Chisa), CSS variables: main.css
   Header (.xs-header, .xs-brand-*): index.css via xs-wrapper
   ========================================================= */

/* =========================================================
   Layout — xg-main ergänzt xs-main aus index.css
   ========================================================= */

.xg-main
{
    max-width: 1400px;
    display: flex;
    flex-direction: column;
    align-items: center;
}

/* =========================================================
   Search Card
   ========================================================= */

.xg-search-card
{
    width: 100%;
    max-width: 560px;
    background: rgba(12, 9, 22, 0.84);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-lg);
    padding: 20px 24px;
    box-shadow: var(--shadow), 0 0 60px rgba(0, 0, 0, 0.3);
    margin-bottom: 28px;
    position: relative;
    z-index: 100;
}

/* =========================================================
   Search Row
   ========================================================= */

.xg-search-row
{
    position: relative;
    display: flex;
    gap: 8px;
    align-items: center;
    width: 100%;
    margin-bottom: 12px;
}

.xg-search
{
    flex: 1;
    height: 42px;
    background: rgba(255, 255, 255, 0.07);
    border: 1px solid rgba(255, 255, 255, 0.14);
    border-radius: var(--radius-sm);
    padding: 0 18px;
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font);
    outline: none;
    transition: border-color 0.2s, background 0.2s;
}

.xg-search::placeholder
{
    color: rgba(255, 255, 255, 0.4);
}

.xg-search:focus
{
    border-color: var(--accent-glow);
    background: rgba(255, 255, 255, 0.11);
}

.xg-filter-btn
{
    position: relative;
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-muted);
    transition: background 0.2s, border-color 0.2s, color 0.2s;
    user-select: none;
}

.xg-filter-btn svg
{
    width: 18px;
    height: 18px;
}

.xg-filter-btn:hover
{
    background: var(--glass-hover);
    color: var(--text-primary);
}

.xg-filter-btn.active
{
    background: var(--accent-soft);
    border-color: var(--accent-glow);
    color: var(--accent);
}

.xg-filter-badge
{
    position: absolute;
    top: -6px;
    right: -6px;
    min-width: 17px;
    height: 17px;
    padding: 0 4px;
    border-radius: 9px;
    background: var(--accent);
    font-size: 10px;
    font-weight: 700;
    color: #fff;
    display: none;
    align-items: center;
    justify-content: center;
    font-family: var(--font);
}

.xg-filter-badge.visible
{
    display: flex;
}

.xg-search-hint
{
    font-family: var(--font);
    font-size: 12px;
    color: var(--text-muted);
    align-self: center;
}

.xg-hint-tipp
{
    color: var(--accent);
    font-weight: 600;
}

/* =========================================================
   Tag Panel
   ========================================================= */

.xg-tag-panel
{
    position: absolute;
    top: calc(100% + 56px);
    right: 0;
    left: 0;
    width: 100%;
    background: rgb(16, 10, 28);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px 20px;
    z-index: 200;
    display: none;
    box-shadow: var(--shadow);
}

.xg-tag-panel.open
{
    display: block;
}

.xg-tag-panel-header
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px;
}

.xg-tag-panel-title
{
    font-family: var(--font);
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.xg-tag-panel-clear
{
    font-family: var(--font);
    font-size: 11px;
    color: rgba(232, 99, 122, 0.65);
    cursor: pointer;
    padding: 3px 8px;
    border-radius: var(--radius-sm);
    transition: color 0.15s, background 0.15s;
}

.xg-tag-panel-clear:hover
{
    color: var(--accent);
    background: var(--accent-soft);
}

.xg-tag-panel-grid
{
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
}

.xg-tag-chip
{
    height: 29px;
    padding: 0 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-mono);
    display: flex;
    align-items: center;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    background: var(--glass);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    user-select: none;
}

.xg-tag-chip::before
{
    content: '#';
    margin-right: 1px;
    opacity: 0.5;
}

.xg-tag-chip:hover
{
    background: var(--accent-soft);
    border-color: var(--accent-glow);
    color: var(--text-primary);
}

.xg-tag-chip.selected
{
    background: var(--accent-soft);
    border-color: var(--accent);
    color: var(--accent);
}

/* =========================================================
   Gallery Grid (Masonry)
   ========================================================= */

.xg-grid
{
    columns: 4;
    column-gap: 14px;
    width: 100%;
    padding-bottom: 40px;
}

.xg-empty
{
    display: none;
    text-align: center;
    color: var(--text-muted);
    font-family: var(--font);
    font-size: 15px;
    padding: 60px 0;
    width: 100%;
}

.xg-empty.visible
{
    display: block;
}

/* =========================================================
   Gallery Card
   ========================================================= */

.xg-card
{
    break-inside: avoid;
    margin-bottom: 14px;
    border-radius: var(--radius-sm);
    overflow: hidden;
    position: relative;
    cursor: pointer;
    border: 1px solid var(--glass-border);
    transition: border-color 0.25s, transform 0.25s, opacity 0.25s;
}

.xg-card:hover
{
    border-color: var(--accent-glow);
    transform: translateY(-3px);
}

.xg-card.filtered-out
{
    opacity: 0.1;
    pointer-events: none;
}

.xg-card img
{
    display: block;
    width: 100%;
    height: auto;
    object-fit: cover;
}

.xg-card-overlay
{
    position: absolute;
    inset: 0;
    background: linear-gradient(to top, rgba(0, 0, 0, 0.9) 0%, rgba(0, 0, 0, 0.2) 50%, transparent 100%);
    opacity: 0;
    transition: opacity 0.25s ease;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 14px;
}

.xg-card:hover .xg-card-overlay
{
    opacity: 1;
}

.xg-card-title
{
    font-family: var(--font);
    font-size: 13px;
    font-weight: 600;
    color: #fff;
    margin-bottom: 6px;
    line-height: 1.3;
}

.xg-card-tags
{
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
}

.xg-card-tag
{
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 20px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-glow);
    color: #f0a0b0;
    font-weight: 500;
    font-family: var(--font-mono);
}

/* =========================================================
   Lightbox
   ========================================================= */

.xg-lightbox
{
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
}

.xg-lightbox.open
{
    opacity: 1;
    pointer-events: auto;
}

.xg-lightbox-backdrop
{
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.75);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.xg-lightbox-panel
{
    position: relative;
    z-index: 1;
    background: var(--surface-raised);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    overflow: hidden;
    max-width: 800px;
    width: 100%;
    transform: scale(0.96) translateY(10px);
    transition: transform 0.25s ease;
}

.xg-lightbox.open .xg-lightbox-panel
{
    transform: scale(1) translateY(0);
}

.xg-lightbox-img-wrap
{
    width: 100%;
    background: rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    max-height: 70vh;
    overflow: hidden;
}

.xg-lightbox-img
{
    width: 100%;
    height: auto;
    max-height: 70vh;
    object-fit: contain;
    display: block;
}

.xg-lightbox-body
{
    padding: 22px 26px;
}

.xg-lightbox-title
{
    font-family: var(--font);
    font-size: 17px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.xg-lightbox-desc
{
    font-family: var(--font);
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.7;
    margin-bottom: 18px;
}

.xg-lightbox-meta
{
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
}

.xg-lightbox-tags
{
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.xg-lightbox-tag
{
    font-size: 11px;
    padding: 3px 10px;
    border-radius: 20px;
    background: var(--accent-soft);
    border: 1px solid var(--accent-glow);
    color: var(--accent);
    font-weight: 500;
    font-family: var(--font-mono);
}

.xg-lightbox-tag::before
{
    content: '#';
    opacity: 0.6;
}

.xg-lightbox-date
{
    font-size: 11px;
    color: var(--text-subtle);
    font-family: var(--font-mono);
}

.xg-lightbox-close
{
    position: absolute;
    top: 14px;
    right: 14px;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.45);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    font-size: 13px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    z-index: 2;
}

.xg-lightbox-close:hover
{
    background: var(--accent-soft);
    color: #fff;
}

/* =========================================================
   Responsive
   ========================================================= */

@media (max-width: 1100px)
{
    .xg-grid
    {
        columns: 3;
    }
}

@media (max-width: 900px)
{
    .xg-main
    {
        padding: 0 18px;
    }
}

@media (max-width: 750px)
{
    .xg-grid
    {
        columns: 2;
    }
}

@media (max-width: 480px)
{
    .xg-grid
    {
        columns: 1;
    }
}
