/* =========================================================================
   FOUC Prevention - Make content visible with smooth transition
   ========================================================================== */
.page-container {
    opacity: 1 !important;
    visibility: visible !important;
    transition: opacity 0.4s ease-out, visibility 0.4s ease-out;
}

/* =========================================================================
   Typography - Strong/Bold Elements
   ========================================================================== */
strong, b {
    font-weight: 550; /* Konsistent mit anderen Gewichtungen im Theme */
}

/* ==========================================================================
   Layout Container System
   ========================================================================== */

/* =========================================================================
   Writing Page Progressive Loading System - Safari-kompatibel
   ========================================================================== */
.right-container--main {
    visibility: hidden;
    opacity: 0;
    transition: all 0.4s ease-out;
}

.sorting-menu-container--large,
.sorting-menu-container--small {
    visibility: hidden;
    opacity: 0;
    transition: all 0.4s ease-out;
}

/* Layout Ready - sowohl für CSS-Klasse als auch direkte Styles */
.layout-ready .right-container--main,
.right-container--main.show {
    visibility: visible;
    opacity: 1;
}

.layout-ready .sorting-menu-container--large,
.layout-ready .sorting-menu-container--small,
.sorting-menu-container--large.show,
.sorting-menu-container--small.show {
    visibility: visible;
    opacity: 1;
}

/* Progressive Image Loading Styles */
.article-preview {
    position: relative;
}

.article-preview::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 32px;
    height: 32px;
    border: 3px solid rgba(0, 0, 0, 0.1);
    border-top: 3px solid rgba(0, 0, 0, 0.4);
    border-radius: 50%;
    animation: spin 1s linear infinite;
    transform: translate(-50%, -50%);
    z-index: 10;
}

.article-preview.image-loaded::before {
    display: none;
}

.lazy-image {
    opacity: 0;
    transition: opacity 0.6s ease-out;
    position: relative;
    z-index: 1;
}

.lazy-image.loaded {
    opacity: 1;
}

@keyframes spin {
    0% { transform: translate(-50%, -50%) rotate(0deg); }
    100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* Mobile Responsive Spinner */
@media (max-width: 768px) {
    .article-preview::before {
        width: 28px;
        height: 28px;
        border-width: 2.5px;
    }
}

/* WebGL Canvas - fullscreen background */
.webgl {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    z-index: -1;
    pointer-events: none;
}

/* Section Title - positioned like single.php, directly after header */
.section-title {
    max-width: 720px;
    margin: 0 auto;
    padding: 0 1rem;
    margin-bottom: 2rem;
}

.section-title-text {
    font-family: "Crimson Pro", serif;
    font-size: 2rem;
    font-weight: 100;
    color: #111;
    margin: 0;
    padding-left: 1rem;
    text-align: left;
}

.section-container {
    width: 100%;
    min-height: 90vh;
    display: flex;
    flex-direction: row;
}

.left-container--aside {
    flex: 1;
    padding: 2rem;
    text-align: right;
}

.right-container--main {
    flex: 1;
    min-width: 680px;
    padding: 20px;
    position: relative;
}

/* ==========================================================================
   Sortier- & Kategorisierungsmenüs
   ========================================================================== */

.sorting-menu {
    position: fixed;
    left: 2rem;
    top: max(350px, 50%);
    transform: translateY(-50%);
    line-height: 1.3;
    color: #333;
}

.sorting-menu p {
    margin-bottom: 0.25rem; /* Zum Beispiel für weniger Abstand */
}

/* Card Animation & Positioning */
.card-positioner {
    position: absolute;
    top: 0;
    left: 0;
    transition: none;
    will-change: transform;
}

.card-content--hidden {
    opacity: 0 !important;
    visibility: hidden;
    transition: opacity 0.3s ease;
}

.placeholder-container {
    position: relative;
    z-index: 1;
}

.placeholder {
    width: 100%;
    max-width: 650px;
    min-width: 200px;
    height: 210px;
    background-color: rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(0, 0, 0, 0.15);
    border-radius: 16px;
    padding: 20px;
    margin-bottom: 20px;
    visibility: visible;
}

.article-card--deselected {
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.article-card--deselected:hover {
    opacity: 1;
}

.article-card--selected {
    opacity: 1;
    transition: opacity 0.4s ease, border 0.4s ease;
}

/* ==========================================================================
   Sortier- & Kategorisierungsmenüs
   ========================================================================== */

/* Fixed Left Menu (Desktop) */
.sorting-menu {
    position: fixed;
    left: 2rem;
    top: max(350px, 50%);
    transform: translateY(-50%);
    line-height: 1.3;
    color: #333;
}

.sorting-menu-list {
    list-style: none !important;
    padding-left: 1rem;
    margin-bottom: 1.0rem; 
}

.sorting-menu-link,
.category-menu-link {
    color: #777;
    text-decoration: none;
    font-weight: 300;
}

.sorting-menu-link:hover,
.category-menu-link:hover,
.category-menu-link--hover,
.category-menu-link--hover.sorting-menu-link--selected {
    color: #111;
    font-weight: 400;
}

.sorting-menu-link--selected,
.sorting-menu-link--selected:hover {
    color: #555;
    font-weight: 400;
}

.sorting-menu-container--large {
    display: block;
}

.sorting-menu-container--small {
    display: none;
    container-type: inline-size;
}

.sorting-menu-dropdown-container {
    display: flex;
    flex-direction: row;
    align-items: baseline;
}

/* Container Query für das Sorting-Menu */
@container (max-width: 520px) {
    .sorting-menu-dropdown-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .sorting-menu-dropdown {
        padding: 0.5rem !important;
        text-align: left;
    }
    .sorting-menu-dropdown-container p {
        margin: 0 0 0.5rem 0;
        text-align: center;
    }
    .sorting-title-container {
        padding-left: 1rem;
    }
}

.sorting-menu-dropdown {
    appearance: none; /* Entfernt das Standard-Browser-Design */
    -webkit-appearance: none;
    -moz-appearance: none;
    background-color: rgba(200, 200, 200, 0.2);
    border: 1px solid #ccc;
    border-radius: 8px;
    padding: 10px 40px 10px 15px;
    margin-left: 1rem;
    margin-right: 1rem;
    font-size: 16px;
    cursor: pointer;
    background-position: right 15px center;
    background-size: 16px;
    width: 100%;
    transition: border-color 0.3s, box-shadow 0.3s;
    color: #333;
    text-align: left;
    font-weight: 550;
}

.sorting-menu-dropdown:focus {
    outline: none;
}

/* ==========================================================================
   Karten-System (Original)
   ========================================================================== */

/* Platzhalter Container */
.placeholder-container {
    display: flex;
    flex-direction: column;
    gap: 20px;
    position: relative;
    z-index: 1;
    margin: 0px;
    padding: 0px;
}

.card-positioner {
    position: absolute; 
    background-color: transparent;
    border-radius: 16px;
    z-index: 1;
}

/* Article Card Container - für Fallback ohne Animation */
.article-card-container {
    display: flex;
    flex-direction: column;
    gap: 2rem;
    padding: 0;
    position: relative;
    z-index: 10;
    width: 100%;
    min-height: 200px;
}

.article-card {
    text-decoration: none;
    color: black;
    width: 100%;
    max-width: 650px;
    height: 210px;
    padding: 0.5rem;
    display: flex;
    flex-direction: row;
    align-items: center;
    background-color: #fff;
    border-radius: 16px;
    box-shadow: 5px 5px 10px 0 rgba(0, 0, 0, 0.1);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
    border: 1px solid rgba(0, 0, 0, 0.3);
}

.article-card:hover {
    transform: translate(-4px, -4px);
    box-shadow: 8px 8px 10px 0 rgba(0, 0, 0, 0.15);
    transition: transform 0.2s ease-in-out, box-shadow 0.2s ease-in-out;
}
.article-card-image-container {
    min-width: 200px;
    max-width: 200px;
    align-self: center;
}

.article-card-image {
    width: 100%;
    max-width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 8px;
}

.preview-container {
    padding: 1rem;
    padding-top: 0.5rem;
    padding-bottom: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    justify-content: space-between;
    height: 100%;
}

.preview-container-textbox {
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 3; 
    -webkit-box-orient: vertical;
    max-height: 3rem;
}

.preview-container p {
    font-size: 1rem !important;
    padding-left: 0.5rem;
    margin-bottom: 0.75rem;
}

.article-card h2 {
    font-size: 1rem;
    line-height: 1.25rem;
    padding-left: 0.5rem;
    padding-bottom: 0.5rem;
}

.article-date-and-views {
    font-family: "Crimson Pro", serif;
    font-optical-sizing: auto;
    color: #999;
    font-weight: 300;
    font-style: normal;
    font-size: 0.75rem !important;
    line-height: 1rem;
    text-align: left;
    margin-top: 0rem;
    margin-bottom: 0.5rem;
}

/* Animation states for sorting/filtering */
.article-card--selected {
    opacity: 1;
    border: 2px solid rgb(51, 51, 51); /* Gleiche Farbe wie Selected-Connections (0.2*255 ≈ 51) */
    transition: opacity 0.4s ease, border 0.4s ease;
}

.article-card--deselected {
    opacity: 0.3;
    transition: opacity 0.4s ease;
}

.article-card--deselected:hover {
    opacity: 1;
}

/* Rounded Buttons - same as homepage */
.rounded-button {
    background-color: rgba(0, 0, 0, 0.7);
    color: #ddd;
    border: 1.5px solid #333;
    padding: 4px 16px;
    border-radius: 12px;
    font-family: "Crimson Pro", serif;
    font-optical-sizing: auto;
    font-weight: 350;
    font-style: normal;
    font-size: 1rem;
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
    display: inline-block;
    margin-top: 1rem;
}

.rounded-button:hover {
    background-color: rgba(250, 250, 250, 0.7);
    color: black;
    border: 1.5px solid #333;
}

.article-card:hover .rounded-button {
    background-color: rgba(240, 240, 240, 0.7);
    color: black;
    border: 1.5px solid #333;
}

.article-card .rounded-button {
    background-color: rgba(255, 255, 255, 1);
    color: #666;
    border: 1.5px solid #bbb;
}

.article-card--selected {
    border: 3px solid rgba(60, 60, 60, 0.8); /* Gleiche Farbe wie Selected-Connections (0.2*255 ≈ 51) */
} 

.article-card--deselected {
    opacity: 0.7;
}

.article-card--deselected:hover {
    opacity: 1;
}

/* Mobile Anpassungen */
/* Responsive Anpassungen */
@media (max-width: 1024px) {
    .sorting-menu-container--large {
        display: none;
    }
    .sorting-menu-container--small {
        margin-top: 2rem;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 1rem;
        max-width: 720px;
        margin-left: auto;
        margin-right: auto;
        padding: 0 1rem;
    }
    
    /* Mehr Abstand zwischen den beiden Dropdown-Gruppen */
    .sorting-menu-container--small .sorting-menu-dropdown-container:nth-child(2) {
        margin-left: 1rem;
    }

    
    
    /* Section Title zentriert im Mid-Modus */
    .section-title {
        padding: 0 1rem;
        padding-top: 1.5rem;
        padding-bottom: 0;
        text-align: center;
    }
    
    .section-title-text {
        padding-left: 0;
        text-align: center;
    }
    
    /* Cards zentriert im Mid-Modus */
    .section-container {
        flex-direction: column;
        align-items: center;
    }
    
    .left-container--aside {
        display: none;
    }
    
    .right-container--main {
        flex: none;
        max-width: 720px;
        width: 100%;
        min-width: unset;
        margin: 0 auto;
    }
}

@media (max-width: 768px) {
    /* Excerpt in mobiler Version ausblenden */
    .preview-container-textbox {
        display: none;
    }
    
    /* Button-Anpassungen für mobile Version */
    .rounded-button {
        margin-top: 1rem; /* Abstand oberhalb des Buttons */
        padding: 6px 16px; /* Weniger vertikales Padding */
        width: 100%; /* Volle Breite */
        display: block; /* Block-Element für volle Breite */
        text-align: center; /* Text zentriert */
    }
    
    /* H2-Anpassungen für mobile Version */
    .preview-container-text h2 {
        margin-bottom: 0.25rem; /* Kleiner Abstand unterhalb der Überschrift */
        line-height: 1.4; /* Kompakte Zeilenhöhe für mobile */
    }
    
    /* Preview-Container für mobile Version anpassen */
    .preview-container {
        justify-content: space-around; /* Gleichmäßige Abstände um alle Elemente */
    }
    
    /* Cards zentriert wie in Mid-Version */
    .section-container {
        flex-direction: column;
        align-items: center;
    }
    
    .left-container--aside {
        display: none;
    }
    
    .right-container--main {
        flex: none;
        max-width: 720px;
        width: 100%;
        min-width: unset;
        margin: 0 auto;
    }
    
    /* Section Title zentriert wie in Mid-Version */
    .section-title {
        padding: 0 1rem;
        text-align: center;
        margin-top: 1rem; /* Mehr Abstand oberhalb der Überschrift in mobiler Version */
    }
    
    .section-title-text {
        padding-left: 0;
        text-align: center;
    }
    
    /* Sorting-Dropdown Abstände für 768px Breakpoint */
    .sorting-menu-dropdown {
        margin-left: 0.5rem;
    }
    
    /* Sorting-Container Ausrichtung für 768px Breakpoint */
    .sorting-menu-container--small {
        justify-content: space-around;
    }
}

@media (max-width: 480px) {
    /* Card-Layout für ganz kleine Screens */
    .article-card {
        flex-direction: column; /* Vertikale Ausrichtung: Bild oben, Text unten */
        gap: 0; /* Kein Abstand zwischen Bild und Text */
        height: auto !important; /* Automatische Höhe für vertikales Layout - forciert */
        min-height: auto !important; /* Entfernt auch min-height falls vorhanden */
        align-items: stretch; /* Elemente nehmen volle Breite ein */
    }
    
    .article-card-image-container {
        width: 100%;
        height: 200px;
        min-width: unset; /* Entfernt min-width für mobile */
        max-width: 200px; /* Maximale Breite 200px */
        align-self: center; /* Zentriert das Bild horizontal */
    }
    
    .preview-container-text h2 {
        font-size: 1rem;
        line-height: 1.4; /* Erhöhte Zeilenhöhe für bessere Lesbarkeit */
        padding: 0; /* Kein Padding für h2 in mobiler Version */
        margin-bottom: 0.5rem; /* Kleiner Abstand unterhalb der Überschrift */
    }
    
    /* Excerpt in ganz kleiner Version ausblenden */
    .preview-container-textbox {
        display: none;
    }
    
    /* Button-Anpassungen für ganz kleine Version */
    .rounded-button {
        margin-top: 1rem; /* Abstand oberhalb des Buttons */
        margin-bottom: 0; /* Kein Abstand unterhalb des Buttons */
        width: 100%; /* Volle Breite */
        text-align: center; /* Text zentriert */
        display: block; /* Block-Element für volle Breite */
        padding: 8px 16px; /* Mehr vertikales Padding für mobile */
    }
    
    /* Preview-Container für vertikales Layout anpassen */
    .preview-container {
        padding: 0.5rem 1rem 1rem 1rem; /* Angepasstes Padding für vertikales Layout */
        justify-content: space-between; /* Button unten positionieren in ganz kleiner Version */
    }
    
    /* Sorting-Menu Anpassungen für ganz kleine Screens */
    .sorting-menu-container--small {
        justify-content: space-between;
        margin-top: 1rem !important;
    }
    .sorting-menu-dropdown-container {
        flex-direction: column;
        align-items: flex-start;
    }
    .sorting-menu-dropdown {
        padding: 0.5rem !important;
        text-align: left;
    }
    .sorting-menu-dropdown-container p {
        margin: 0 0 0.5rem 0;
        text-align: center;
    }
    .sorting-title-container {
        padding-left: 1rem;
    }
    
    .placeholder {
        height: 360px;
    }
}
