/* Project Stacking Effect - High End UI */
:root {
    --card-height: 600px; /* Basis-Höhe für Desktop vergrößert */
    --card-top-offset: 120px; /* Abstand von oben beim Stacking */
    --card-margin: 60px; /* Mehr Abstand zwischen Karten */
}

.projects-section {
    background-color: #0a0a0a; /* Dark Mode Basis für besseren Kontrast */
    color: #fff;
    padding-bottom: 100px;
    position: relative;
    z-index: 1;
}

.reference-stack {
    position: relative;
    max-width: 1400px;
    margin: 0 auto;
    padding: 20px;
}

/* Die Karte an sich */
.reference-card {
    position: sticky;
    top: var(--card-top-offset);
    height: var(--card-height);
    margin-bottom: var(--card-margin);
    
    background: #1a1a1a;
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 24px;
    overflow: hidden;
    
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
    transform-origin: center top;
    transition: transform 0.1s linear, filter 0.1s linear; /* Smooth controlled by JS */
    will-change: transform, filter;
}

/* Linke Seite: Bild */
.reference-media {
    position: relative;
    height: 100%;
    overflow: hidden;
    border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.reference-media img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}

.reference-card:hover .reference-media img {
    transform: scale(1.05);
}

/* Rechte Seite: Content */
.reference-body {
    padding: 40px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    background: linear-gradient(145deg, #1a1a1a 0%, #111 100%);
    position: relative;
}

/* Dekorative Nummerierung oder Kategorie */
.reference-meta {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: #64ffda; /* Akzentfarbe */
    margin-bottom: 16px;
    font-weight: 600;
    display: inline-block;
}

.reference-body h3 {
    font-size: 2.5rem;
    line-height: 1.1;
    margin-bottom: 24px;
    color: #fff;
    font-weight: 700;
}

.reference-body p {
    color: #a0a0a0;
    line-height: 1.6;
    font-size: 1.1rem;
    margin-bottom: 32px;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Button Styling innerhalb der Karte */
.reference-actions .btn {
    background: transparent;
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: #fff;
    padding: 12px 28px;
    border-radius: 50px;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    font-weight: 500;
}

.reference-actions .btn:hover {
    background: #64ffda;
    border-color: #64ffda;
    color: #000;
    transform: translateY(-2px);
}

/* Filter Hide Logic - Wichtig für Sticky Stack */
.reference-card[style*="display: none"] {
    position: static; /* Sticky aufheben wenn ausgeblendet */
}

/* Mobile Responsive */
@media (max-width: 900px) {
    :root {
        --card-top-offset: 80px; /* Kleinerer Offset auf Mobile */
        --card-height: auto;
    }

    .reference-card {
        grid-template-columns: 1fr;
        grid-template-rows: 250px auto;
        height: auto;
        min-height: auto; /* Allow content to dictate height */
        top: var(--card-top-offset); 
        margin-bottom: 60px; /* Mehr Platz zum Atmen */
    }
    
    .reference-media {
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.05);
        height: 250px; /* Fixed height for image area */
    }
    
    .reference-body {
        padding: 30px;
    }

    .reference-body h3 {
        font-size: 1.8rem;
    }
}

@media (max-width: 600px) {
    :root {
        --card-top-offset: 70px; /* Noch kleiner für Phones */
    }

    .projects-section {
        padding-left: 15px;
        padding-right: 15px;
    }

    .reference-stack {
        padding: 0;
    }

    .reference-card {
        border-radius: 16px;
        grid-template-rows: auto auto; /* Content darf wachsen */
    }

    .reference-media {
        height: 240px; /* Etwas mehr Bildfläche */
        min-height: 240px;
    }

    .reference-body {
        padding: 24px 20px; /* Seitlich etwas weniger Padding für mehr Textplatz */
    }

    .reference-body h3 {
        font-size: 1.6rem; /* Titel etwas prägnanter */
        margin-bottom: 12px;
        word-break: break-word; /* Lange Wörter umbrechen */
        hyphens: auto; /* Silbentrennung */
        line-height: 1.2;
    }
    
    .reference-body p {
        font-size: 1rem;
        -webkit-line-clamp: 6; /* Mehr Text sichtbar lassen */
        margin-bottom: 24px;
        line-height: 1.5;
    }

    .reference-meta {
        font-size: 0.75rem;
        margin-bottom: 12px;
    }
    
    .reference-actions .btn {
        padding: 10px 24px;
        font-size: 0.9rem;
        width: 100%; /* Full width button on mobile */
        justify-content: center;
    }
}
