/* ==========================================
   BLOG GRID FIX - KOMPAKT MIT KLEINEREN SCHRIFTEN
   Version: 4.2 - Fix für gequetschte letzte Card
   ========================================== */

/* ========================================
   KLEINERE BLOG CARDS
   ======================================== */

/* BLOG GRID CONTAINER */
html body.blog .blog-section .container,
html body.archive .blog-section .container,
.blog-section .container {
    max-width: 1400px !important;
    padding: 0 2rem !important;
}

/* GRID LAYOUT - 4 Spalten */
@media (min-width: 1200px) {
    html body.blog .blog-section .blog-grid-elegant,
    html body.archive .blog-section .blog-grid-elegant,
    html body .blog-section .blog-grid-elegant,
    .blog-section .blog-grid-elegant {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.25rem !important;
        max-width: 100% !important;
        margin: 0 auto !important;
    }
}

/* Desktop: 3 Spalten */
@media (min-width: 992px) and (max-width: 1199px) {
    html body.blog .blog-section .blog-grid-elegant,
    html body.archive .blog-section .blog-grid-elegant,
    html body .blog-section .blog-grid-elegant,
    .blog-section .blog-grid-elegant {
        display: grid !important;
        grid-template-columns: repeat(3, 1fr) !important;
        gap: 1.25rem !important;
    }
}

/* Tablet: 2 Spalten */
@media (min-width: 768px) and (max-width: 991px) {
    html body.blog .blog-section .blog-grid-elegant,
    html body.archive .blog-section .blog-grid-elegant,
    html body .blog-section .blog-grid-elegant,
    .blog-section .blog-grid-elegant {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 1rem !important;
    }
}

/* Mobile: 1 Spalte */
@media (max-width: 767px) {
    html body.blog .blog-section .blog-grid-elegant,
    html body.archive .blog-section .blog-grid-elegant,
    html body .blog-section .blog-grid-elegant,
    .blog-section .blog-grid-elegant {
        display: grid !important;
        grid-template-columns: 1fr !important;
        gap: 1rem !important;
    }
}

/* ========================================
   NORMALE BLOG CARDS
   ======================================== */

html body.blog .blog-section .container .blog-grid-elegant article.blog-card-elegant,
html body.archive .blog-section .container .blog-grid-elegant article.blog-card-elegant,
html body.blog article.blog-card-elegant,
html body.archive article.blog-card-elegant,
html body article.post.blog-card-elegant,
article.blog-card-elegant,
.blog-post-card {
    height: auto !important;
    min-height: 360px !important;
    display: flex !important;
    flex-direction: column !important;
    background: var(--white) !important;
    border-radius: 8px !important;
    overflow: hidden !important;
    box-shadow: 0 4px 20px rgba(74, 63, 53, 0.08) !important;
    transition: transform 0.3s ease !important;
}

html body .blog-card-elegant:hover,
.blog-card-elegant:hover,
.blog-post-card:hover {
    transform: translateY(-4px) !important;
    box-shadow: 0 8px 30px rgba(74, 63, 53, 0.12) !important;
}

/* ========================================
   FIX: CARDS GLEICHMÄSSIG
   3-Spalten-Grid: bei 2 Cards je span 1,
   bei ungerader Anzahl letzte Card halbe Breite
   ======================================== */

/* ========================================
   THUMBNAIL
   ======================================== */

html body.blog .blog-section .blog-grid-elegant .blog-card-elegant .post-thumbnail-elegant,
html body.archive .blog-section .blog-grid-elegant .blog-card-elegant .post-thumbnail-elegant,
html body.blog .post-thumbnail-elegant,
html body.archive .post-thumbnail-elegant,
html body .blog-card-elegant .post-thumbnail-elegant,
.blog-card-elegant .post-thumbnail-elegant,
.blog-post-card .post-thumbnail {
    height: 160px !important;
    min-height: 160px !important;
    max-height: 160px !important;
    overflow: hidden !important;
    flex-shrink: 0 !important;
    position: relative !important;
}

html body.blog .blog-card-elegant .post-thumbnail-elegant img,
html body.archive .blog-card-elegant .post-thumbnail-elegant img,
html body .blog-card-elegant .post-thumbnail-elegant .thumbnail-image,
.blog-card-elegant .post-thumbnail-elegant img,
.blog-card-elegant .post-thumbnail-elegant .thumbnail-image,
.blog-post-card .post-thumbnail img {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    display: block !important;
}

/* ========================================
   CONTENT BEREICH
   ======================================== */

html body.blog .blog-card-elegant .post-content-elegant,
html body.archive .blog-card-elegant .post-content-elegant,
html body .blog-card-elegant .post-content-elegant,
.blog-card-elegant .post-content-elegant,
.blog-post-card .post-content {
    padding: 1rem !important;
    flex-grow: 1 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
}

/* ========================================
   SCHRIFTGRÖSSEN - KLEINER
   ======================================== */

/* META */
html body .blog-card-elegant .post-meta-elegant,
.blog-card-elegant .post-meta-elegant,
.blog-post-card .post-meta {
    font-size: 0.65rem !important;
    margin-bottom: 0.5rem !important;
    color: var(--bronze-accent, #895954) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
}

/* TITLE - KLEINER */
html body.blog .blog-card-elegant .post-title-elegant,
html body.archive .blog-card-elegant .post-title-elegant,
html body.blog .blog-card-elegant h3.post-title-elegant,
html body.archive .blog-card-elegant h3.post-title-elegant,
html body .blog-card-elegant .post-title-elegant,
html body .blog-card-elegant h3.post-title-elegant,
.blog-card-elegant .post-title-elegant,
.blog-card-elegant h3.post-title-elegant,
.blog-post-card h3 {
    font-size: 1.05rem !important;
    line-height: 1.35 !important;
    margin-bottom: 0.5rem !important;
    max-height: 2.8rem !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    font-weight: 600 !important;
    color: var(--deep-brown, #4A3F35) !important;
}

/* EXCERPT */
html body.blog .blog-card-elegant .post-excerpt-elegant,
html body.archive .blog-card-elegant .post-excerpt-elegant,
html body .blog-card-elegant .post-excerpt-elegant,
.blog-card-elegant .post-excerpt-elegant,
.blog-post-card .post-excerpt {
    font-size: 0.85rem !important;
    line-height: 1.5 !important;
    margin-bottom: 0.75rem !important;
    flex-grow: 1 !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 2 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
    max-height: 2.55rem !important;
    color: var(--deep-brown, #4A3F35) !important;
    opacity: 0.8 !important;
}

/* READ MORE */
html body .blog-card-elegant .read-more-link,
html body .blog-card-elegant .read-more-elegant,
.blog-card-elegant .read-more-link,
.blog-card-elegant .read-more-elegant,
.blog-post-card .read-more {
    font-size: 0.7rem !important;
    margin-top: auto !important;
    color: var(--estelle-gold, #89564A) !important;
    text-transform: uppercase !important;
    letter-spacing: 0.5px !important;
    font-weight: 600 !important;
}

/* ========================================
   FEATURED POST
   ======================================== */

html body.blog .blog-card-featured,
html body.archive .blog-card-featured,
html body .blog-card-featured,
.blog-card-featured {
    grid-column: 1 / -1 !important;
    max-height: 300px !important;
    height: 300px !important;
    min-height: 300px !important;
    display: grid !important;
    grid-template-columns: 1fr 1fr !important;
    gap: 0 !important;
    margin-bottom: 1.5rem !important;
}

html body.blog .post-thumbnail-featured,
html body.archive .post-thumbnail-featured,
html body .post-thumbnail-featured,
.post-thumbnail-featured {
    height: 300px !important;
    min-height: 300px !important;
    max-height: 300px !important;
}

html body .post-thumbnail-featured img,
html body .post-thumbnail-featured .featured-image,
.post-thumbnail-featured img,
.post-thumbnail-featured .featured-image {
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
}

html body .post-content-featured,
.post-content-featured {
    padding: 1.5rem !important;
    display: flex !important;
    flex-direction: column !important;
}

/* FEATURED - SCHRIFT KLEINER */
html body .post-title-featured,
html body h2.post-title-featured,
.post-title-featured,
h2.post-title-featured {
    font-size: 1.5rem !important;
    line-height: 1.3 !important;
    margin-bottom: 0.75rem !important;
    max-height: 3.9rem !important;
    overflow: hidden !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
}

html body .post-excerpt-featured,
.post-excerpt-featured {
    font-size: 0.9rem !important;
    line-height: 1.5 !important;
    margin-bottom: 1rem !important;
    display: -webkit-box !important;
    -webkit-line-clamp: 3 !important;
    -webkit-box-orient: vertical !important;
    overflow: hidden !important;
}

/* ========================================
   MOBILE OPTIMIERUNG
   ======================================== */

@media (max-width: 767px) {
    html body .blog-card-featured,
    .blog-card-featured {
        grid-template-columns: 1fr !important;
        max-height: none !important;
        height: auto !important;
        min-height: auto !important;
    }
    
    html body .post-thumbnail-featured,
    .post-thumbnail-featured {
        height: 220px !important;
        min-height: 220px !important;
        max-height: 220px !important;
    }
    
    html body .post-content-featured,
    .post-content-featured {
        padding: 1.25rem !important;
    }
    
    html body article.blog-card-elegant,
    article.blog-card-elegant,
    .blog-post-card {
        max-height: 400px !important;
        height: auto !important;
        min-height: 340px !important;
    }
    
    html body .blog-card-elegant .post-thumbnail-elegant,
    .blog-card-elegant .post-thumbnail-elegant,
    .blog-post-card .post-thumbnail {
        height: 180px !important;
        min-height: 180px !important;
        max-height: 180px !important;
    }
    
    .blog-card-elegant .post-title-elegant,
    .blog-card-elegant h3.post-title-elegant {
        font-size: 1.1rem !important;
    }
    
    .blog-card-elegant .post-excerpt-elegant {
        font-size: 0.9rem !important;
    }
}

/* ========================================
   SECTION SPACING
   ======================================== */

html body.blog .blog-section,
html body.archive .blog-section,
.blog-section {
    padding: 2.5rem 0 !important;
}

/* ========================================
   INLINE STYLE ÜBERSCHREIBUNGEN
   ======================================== */

html body .blog-card-elegant[style*="height"],
.blog-card-elegant[style*="height"],
.blog-post-card[style*="height"] {
    height: auto !important;
    min-height: 360px !important;
}

html body .blog-card-elegant[style*="box-shadow"],
.blog-card-elegant[style*="box-shadow"] {
    box-shadow: 0 4px 20px rgba(74, 63, 53, 0.08) !important;
}

/* ========================================
   ESTELLE GALLERY WIDGET – IMAGE FILL FIX
   Landscape-Bilder einheitlich als Hochformat-Kachel
   ======================================== */

.egc-item__inner {
    aspect-ratio: 2/3 !important;
    position: relative !important;
    overflow: hidden !important;
}

/* Landscape: gleiche Kachel wie Portrait – kein span 2, kein 16/9 */
.egc-item--landscape {
    grid-column: span 1 !important;
}

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

/* Portrait-Bilder: von oben croppen */
.egc-item__img {
    position: absolute !important;
    inset: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: top center !important;
}

/* Landscape-Bilder: mittig croppen (nicht oben abschneiden) */
.egc-item--landscape .egc-item__img {
    object-position: center center !important;
}

@media (max-width: 900px) {
    .egc-item__inner,
    .egc-item--landscape .egc-item__inner {
        aspect-ratio: 2/3 !important;
    }
}

@media (max-width: 600px) {
    .egc-item__inner,
    .egc-item--landscape .egc-item__inner {
        aspect-ratio: 2/3 !important;
    }
}

/* ========================================
   LIGHTBOX – ELEMENTOR TRANSFORM FIX
   ======================================== */

.egc-lightbox {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 999999 !important;
    transform: none !important;
    will-change: auto !important;
}

.egc-lightbox:not(.egc-lightbox--open) {
    pointer-events: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}
