/* Referenzen Page Styles */
.referenzen-main {
    padding: 150px 80px 100px;
    background-color: var(--bg-color);
    min-height: 100vh;
}

.ref-header {
    text-align: center;
    margin-bottom: 80px;
}

.ref-header .headline {
    font-size: 4rem;
    font-weight: 800;
    margin-bottom: 20px;
}

.ref-header .subtitle {
    font-size: 1.2rem;
    color: #ccc;
}

.matrix-gallery-container {
    width: 100%;
    max-width: 1400px;
    margin: 0 auto;
    overflow: visible;
}

.matrix-gallery {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 30px;
}

.gallery-item {
    position: relative;
    width: 100%;
    aspect-ratio: 4 / 3;
    border-radius: 12px;
    overflow: hidden;
    cursor: none;
    box-shadow: 0 0 10px rgba(255, 107, 0, 0.4), 0 0 20px rgba(255, 107, 0, 0.2);
    border: 1px solid rgba(255, 107, 0, 0.3);
    background-color: #1a1a1a;
    /* Starting state handled by GSAP */
}

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.gallery-item:hover img {
    transform: scale(1.1); /* Subtle zoom on hover */
}

/* Responsive adjustments */
@media (max-width: 1200px) {
    .matrix-gallery {
        grid-template-columns: repeat(3, 1fr);
    }
}

@media (max-width: 768px) {
    .ref-header .headline {
        font-size: 2.8rem; /* Reduced further to prevent touching edges */
    }
    .matrix-gallery {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    .gallery-item {
        width: calc(50% - 7.5px);
        flex: 0 0 calc(50% - 7.5px);
    }
    .referenzen-main {
        padding: 120px 20px 50px;
    }
}

@media (max-width: 480px) {
    .matrix-gallery {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 15px;
    }
    .gallery-item {
        width: 100%;
        flex: 0 0 100%;
    }
}

/* Fullscreen Gallery Overlay */
.gallery-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: rgba(10, 10, 10, 0.95);
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    cursor: pointer;
}

.gallery-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.zoomed-clone {
    position: fixed;
    z-index: 1001;
    border-radius: 8px;
    box-shadow: 0 0 50px rgba(255, 107, 0, 0.4);
    object-fit: cover;
    pointer-events: none; /* Let clicks pass to the overlay to close */
}
