/* ==========================================
   ESTELLE GALLERY WIDGET – KATEGORISIERT
   Luxury Editorial · Estelle Theme v2.0
   ========================================== */

:root {
    --egc-gold:     #B8956A;
    --egc-gold-lt:  #D4B896;
    --egc-gold-dk:  #8B6F47;
    --egc-dark:     #2C2118;
    --egc-mid:      #4A3F35;
    --egc-muted:    #6B5D52;
    --egc-border:   rgba(184,149,106,0.20);
    --egc-cols:     4;
}

/* ==========================================
   ELEMENTOR OVERRIDE
   ========================================== */
.elementor-widget-estelle-gallery {
    overflow: visible !important;
    height: auto !important;
    min-height: 0 !important;
    /* Volle Breite auch wenn Elementor-Container flex-direction:row hat */
    width: 100% !important;
    max-width: 100% !important;
    flex: 0 0 100% !important;
    align-self: auto !important;
}

.elementor-widget-estelle-gallery .elementor-widget-container {
    overflow: visible !important;
    height: auto !important;
    width: 100% !important;
}

/* ==========================================
   WRAP
   ========================================== */
.egc-wrap {
    font-family: 'Questrial', sans-serif;
    color: var(--egc-dark);
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
}

/* ==========================================
   CATEGORY BLOCK
   ========================================== */
.egc-category {
    margin-bottom: 64px;
}

.egc-category:last-child {
    margin-bottom: 0;
}

/* ==========================================
   CATEGORY HEADER
   ========================================== */
.egc-cat-header {
    margin-bottom: 24px;
}

.egc-cat-title-wrap {
    display: flex;
    align-items: baseline;
    gap: 12px;
    margin-bottom: 10px;
}

.egc-cat-title {
    font-family: 'Lora', serif;
    font-style: italic;
    font-weight: 400;
    font-size: clamp(1.3rem, 2.5vw, 1.7rem);
    color: var(--egc-dark);
    margin: 0;
    letter-spacing: 0.01em;
}

.egc-cat-count {
    font-family: 'Questrial', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.14em;
    color: var(--egc-gold);
    border: 1px solid var(--egc-gold);
    padding: 2px 8px;
    border-radius: 20px;
}

.egc-cat-line {
    height: 1px;
    background: linear-gradient(to right, var(--egc-gold), transparent);
    width: 100%;
}

/* ==========================================
   GRID – Preview (immer sichtbar)
   ========================================== */
.egc-grid {
    display: grid;
    grid-template-columns: repeat(var(--egc-cols), 1fr);
    gap: 6px;
    width: 100%;
    box-sizing: border-box;
}

/* ==========================================
   GRID EXTRA – versteckte Items
   CSS-only Expand via grid-template-rows
   Kein display:none → Elementor kennt immer die echte Höhe
   ========================================== */
.egc-grid-extra {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.4s ease;
    /* gap nur wenn offen */
    gap: 0;
    margin-top: 0;
}

.egc-grid-extra--open {
    grid-template-rows: 1fr;
    gap: 6px;
    margin-top: 6px;
}

/* Inner-Wrapper verhindert sichtbaren Overflow bei 0fr */
.egc-grid-extra__inner {
    overflow: hidden;
    min-height: 0;
    /* Grid für die Items drin */
    display: grid;
    grid-template-columns: repeat(var(--egc-cols), 1fr);
    gap: 6px;
    /* Bei collapsed: gap wegblenden */
    align-content: start;
}

/* ==========================================
   GRID ITEM
   ========================================== */
.egc-item {
    min-width: 0;
    min-height: 0;
}

.egc-item__inner {
    position: relative;
    overflow: hidden;
    cursor: pointer;
    background: #f0e8dc;
    aspect-ratio: 2/3;
    width: 100%;
}

.egc-item__img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: top center;
    display: block;
    transition: transform 0.5s ease;
}

.egc-item__inner:hover .egc-item__img {
    transform: scale(1.04);
}

/* Overlay on hover */
.egc-item__overlay {
    position: absolute;
    inset: 0;
    background: rgba(26, 20, 16, 0.35);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
    color: rgba(255,255,255,0.9);
}

.egc-item__inner:hover .egc-item__overlay {
    opacity: 1;
}

/* ==========================================
   EXPAND BUTTON
   ========================================== */
.egc-expand-row {
    display: flex;
    justify-content: center;
    margin-top: 20px;
}

.egc-expand-btn {
    font-family: 'Questrial', sans-serif;
    font-size: 0.72rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--egc-gold-dk);
    background: transparent;
    border: 1px solid var(--egc-gold);
    padding: 11px 28px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 8px;
    transition: background 0.25s ease, color 0.25s ease;
    -webkit-appearance: none;
}

.egc-expand-btn:hover {
    background: var(--egc-gold);
    color: #fff;
}

.egc-btn-count {
    opacity: 0.6;
    font-size: 0.68rem;
}

.egc-btn-icon svg {
    transition: transform 0.3s ease;
}

.egc-expand-btn[data-expanded="true"] .egc-btn-icon svg {
    transform: rotate(180deg);
}

/* ==========================================
   LIGHTBOX
   ========================================== */
.egc-lightbox {
    position: fixed;
    inset: 0;
    z-index: 99999;
    display: none;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.egc-lightbox--open {
    display: flex;
    opacity: 1;
}

.egc-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(20, 15, 10, 0.94);
    cursor: pointer;
}

.egc-lightbox__inner {
    position: relative;
    z-index: 1;
    display: flex;
    align-items: center;
    gap: 16px;
    max-width: 92vw;
    max-height: 92vh;
    padding: 0 8px;
}

.egc-lightbox__img-wrap {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    min-width: 60px;
    min-height: 60px;
}

.egc-lightbox__img {
    max-width: min(520px, 80vw);
    max-height: 88vh;
    object-fit: contain;
    display: block;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.egc-lightbox__img--loaded {
    opacity: 1;
}

.egc-lightbox__loader {
    position: absolute;
    color: var(--egc-gold);
    animation: egc-spin 0.9s linear infinite;
    opacity: 1;
    transition: opacity 0.2s ease;
}

.egc-lightbox__loader--hidden {
    opacity: 0;
}

@keyframes egc-spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

/* Prev / Next / Close */
.egc-lightbox__prev,
.egc-lightbox__next {
    background: transparent;
    border: 1px solid rgba(184,149,106,0.35);
    color: rgba(255,255,255,0.8);
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: border-color 0.2s ease, color 0.2s ease, background 0.2s ease;
    border-radius: 0;
    -webkit-appearance: none;
}

.egc-lightbox__prev:hover,
.egc-lightbox__next:hover {
    border-color: var(--egc-gold);
    color: var(--egc-gold);
    background: rgba(184,149,106,0.08);
}

.egc-lightbox__close {
    position: absolute;
    top: -44px;
    right: 8px;
    background: transparent;
    border: 1px solid rgba(184,149,106,0.35);
    color: rgba(255,255,255,0.7);
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s ease, color 0.2s ease;
    -webkit-appearance: none;
}

.egc-lightbox__close:hover {
    border-color: var(--egc-gold);
    color: var(--egc-gold);
}

/* ==========================================
   ORIENTIERUNG – Portrait / Landscape
   Landscape-Bilder werden wie Portrait behandelt
   (gleiche Spalte, gleiches Seitenverhältnis, zentrierter Ausschnitt)
   ========================================== */
.egc-item--landscape {
    grid-column: span 1;
}

.egc-item--landscape .egc-item__inner {
    aspect-ratio: 2/3;
}

/* Querformat-Bild mittig croppen (nicht oben abschneiden) */
.egc-item--landscape .egc-item__img {
    object-position: center center;
}

/* ==========================================
   RESPONSIVE – TABLET
   ========================================== */
@media (max-width: 900px) {
    .egc-wrap {
        --egc-cols: 3;
    }
}

/* ==========================================
   RESPONSIVE – MOBILE
   ========================================== */
@media (max-width: 600px) {
    .egc-wrap {
        --egc-cols: 2;
    }

    .egc-category {
        margin-bottom: 44px;
    }

    .egc-category:last-child {
        margin-bottom: 0;
    }

    .egc-lightbox__prev,
    .egc-lightbox__next {
        width: 36px;
        height: 36px;
    }

    .egc-lightbox__img {
        max-width: 85vw;
        max-height: 80vh;
    }

    .egc-lightbox__inner {
        gap: 8px;
        padding: 0;
    }
}
