/* =========================================
   Variables & Configuration
   ========================================= */
:root {
    /* Colors */
    --card-bg: rgba(15, 23, 42, 0.65); /* Etwas dunklerer, transparenterer Hintergrund */
    --card-border: rgba(255, 255, 255, 0.1);
    --accent: #50e3c2;
    --accent-hover: #3bc7a9;
    --text-main: #f7fbff;
    --text-muted: rgba(247, 251, 255, 0.75);

    /* Spacing & Layout */
    --header-height: 70px;
    --container-max: 1200px;
    --radius-lg: 16px;
    --radius-md: 10px;
}

/* =========================================
   Layout & Container
   ========================================= */
.projects-page {
    /* Dynamischer Abstand basierend auf Header-Höhe + Puffer */
    padding-top: calc(var(--header-height) + 2rem);
    padding-bottom: 3rem;
    position: relative;
    width: 100%;
}

.projects-page .container {
    width: 100%;
    max-width: var(--container-max);
    margin: 0 auto;
    padding: 0 1.5rem; /* Etwas mehr Seitenabstand */
    position: relative;
    z-index: 2; /* Über dem Canvas */
}

/* Background Handling */
#particle-canvas {
    position: fixed;
    inset: 0;
    z-index: 1;
    pointer-events: none;
}

/* =========================================
   Typography
   ========================================= */
.page-title {
    /* Fluid Typography: Skaliert zwischen 1.75rem und 2.5rem */
    font-size: clamp(1.75rem, 5vw, 2.5rem);
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text-main);
    line-height: 1.2;
}

.lead {
    color: var(--text-muted);
    margin-bottom: 2rem;
    font-size: 1.1rem;
    max-width: 600px;
    line-height: 1.6;
}

/* =========================================
   Grid System
   ========================================= */
.projects-grid {
    display: grid;
    /* auto-fit zentriert Elemente besser als auto-fill bei wenigen Items */
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 2rem;
    width: 100%;
}

/* =========================================
   Card Component
   ========================================= */
.project-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    display: flex;
    flex-direction: column;
    /* Glassmorphism Effect */
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), 
                box-shadow 0.3s ease, 
                border-color 0.3s ease;
    height: 100%; /* Stellt sicher, dass alle Karten gleich hoch sind */
}

.project-card:hover,
.project-card:focus-within {
    transform: translateY(-8px);
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.5), 0 10px 10px -5px rgba(0, 0, 0, 0.4);
    border-color: rgba(80, 227, 194, 0.3); /* Subtle accent glow */
}

/* Card Media / Image Area */
.card-media {
    background: linear-gradient(180deg, rgba(255, 255, 255, 0.03), rgba(0, 0, 0, 0.1));
    padding: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 140px;
    border-bottom: 1px solid rgba(255,255,255,0.03);
}

.card-media img {
    max-height: 80px;
    max-width: 100%;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 4px 6px rgba(0,0,0,0.3));
    transition: transform 0.3s ease;
}

.project-card:hover .card-media img {
    transform: scale(1.05);
}

/* Card Body */
.card-body {
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    flex: 1; /* Füllt den restlichen Platz */
}

.card-title {
    font-size: 1.25rem;
    font-weight: 600;
    margin: 0;
    color: #fff;
}

.card-subtitle {
    font-size: 0.85rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--accent);
    font-weight: 600;
}

.card-desc {
    flex: 1; /* Drückt die Buttons nach unten */
    color: var(--text-muted);
    font-size: 0.95rem;
    line-height: 1.6;
    margin-bottom: 1rem;
}

/* Card Actions / Buttons */
.card-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
    margin-top: auto;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.6rem 1.2rem;
    border-radius: var(--radius-md);
    text-decoration: none;
    font-weight: 600;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    cursor: pointer;
    border: none;
}

/* Primary Button */
.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, #3bbcb8 100%);
    color: #08101c;
    box-shadow: 0 4px 12px rgba(80, 227, 194, 0.2);
}

.btn-primary:hover {
    filter: brightness(1.1);
    box-shadow: 0 6px 16px rgba(80, 227, 194, 0.4);
    transform: translateY(-1px);
}

.btn-primary:active {
    transform: translateY(0);
}

/* Secondary/Outline Button (Optional, falls benötigt) */
.btn-outline {
    background: transparent;
    border: 1px solid rgba(255,255,255,0.2);
    color: var(--text-main);
}
.btn-outline:hover {
    background: rgba(255,255,255,0.05);
    border-color: #fff;
}

/* =========================================
    Single Project View (show.php)
    ========================================= */
.projects-single {
     max-width: 800px;
     width: 100%;
     margin: calc(var(--header-height) + 2rem) auto 3rem;
     padding: 2.5rem;
     background: var(--card-bg);
     border: 1px solid var(--card-border);
     border-radius: var(--radius-lg);
     box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.5);
     backdrop-filter: blur(15px);
     -webkit-backdrop-filter: blur(15px);

     /* Make the single project card scrollable once it exceeds a certain height */
     max-height: calc(100vh - var(--header-height) - 4rem); /* adjust 4rem as needed for top/bottom spacing */
     overflow: auto;
     -webkit-overflow-scrolling: touch;
     overscroll-behavior: contain;
}

/* Optional: keep content typography inside the scrollable area */
.projects-content {
     margin-top: 2rem;
     color: var(--text-muted);
     line-height: 1.8;
     font-size: 1.05rem;
}

.projects-content p {
     margin-bottom: 1.25em;
}

.projects-content a {
     color: var(--accent);
     text-decoration: underline;
     transition: color 0.2s ease;
}

.projects-content a:hover {
     color: var(--accent-hover);
}

.projects-content h1 {
     color: var(--text-main);
     margin-bottom: 1rem;
}

.projects-content ul {
     list-style-type: disc;
     padding-left: 1.5rem;
     margin-bottom: 1.5rem;
}

.projects-content h2, 
.projects-content h3 {
     color: var(--text-main);
     margin-top: 1.5em;
     margin-bottom: 0.5em;
}

/* =========================================
   Responsiveness & Mobile
   ========================================= */

/* Tablet & Mobile tweaks */
@media (max-width: 768px) {
    .projects-page {
        padding-top: calc(var(--header-height) + 1.5rem);
    }
    
    .projects-grid {
        gap: 1.5rem;
        /* Bei Mobile kleiner als 600px wird es automatisch 1 Spalte durch minmax(280px) */
    }

    .project-card {
        min-height: auto; /* Höhe flexibel lassen auf Mobile */
    }

    .projects-single {
        padding: 1.5rem;
        margin-top: calc(var(--header-height) + 1rem);
        border-radius: var(--radius-md);
        border-left: none;
        border-right: none;
    }
}

/* Very Small Screens */
@media (max-width: 480px) {
    .projects-grid {
        grid-template-columns: 1fr; /* Forciert 1 Spalte */
    }

    .container {
        padding: 0 1rem;
    }

    .card-actions {
        flex-direction: column; /* Buttons untereinander auf sehr kleinen Screens */
        width: 100%;
    }

    .btn {
        width: 100%; /* Volle Breite für Touch-Freundlichkeit */
    }
    
    .card-media {
        padding: 1rem;
    }
}

/* Modal Fix */
.project-modal {
    max-height: 85vh;
    overflow-y: auto;
    overscroll-behavior: contain; /* Verhindert Scrollen des Body */
    padding: 1rem;
}