.chaos-grid {
    display: grid;
    grid-template-columns: repeat(12, 1fr);
    grid-auto-rows: 100px;
    gap: 1rem;
    padding: 4rem 1rem;
    position: relative;
}

.chaos-item {
    position: relative;
    overflow: hidden;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.15);
    transition: all 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    z-index: 1;
}

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

.chaos-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.2);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.chaos-item:hover {
    transform: scale(1.05) translateY(-10px);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.25);
    z-index: 10 !important;
}

.chaos-item:hover .chaos-overlay {
    opacity: 1;
}

.chaos-item:hover img {
    transform: scale(1.1);
}

/* --- Broken Grid Chaos Style (Desktop & Tablet) --- */
@media (min-width: 769px) {
    .chaos-item:nth-child(1) {
        grid-column: 1 / span 4;
        grid-row: 1 / span 4;
        transform: rotate(-2deg);
    }

    .chaos-item:nth-child(2) {
        grid-column: 5 / span 3;
        grid-row: 2 / span 3;
        transform: rotate(1deg);
        margin-top: -20px;
        z-index: 2;
    }

    .chaos-item:nth-child(3) {
        grid-column: 8 / span 5;
        grid-row: 1 / span 5;
        transform: rotate(-1deg);
        margin-left: -30px;
    }

    .chaos-item:nth-child(4) {
        grid-column: 1 / span 3;
        grid-row: 5 / span 3;
        transform: rotate(3deg);
        margin-top: -40px;
    }

    .chaos-item:nth-child(5) {
        grid-column: 4 / span 5;
        grid-row: 5 / span 4;
        transform: rotate(-1.5deg);
        z-index: 3;
        margin-top: -10px;
    }

    .chaos-item:nth-child(6) {
        grid-column: 9 / span 4;
        grid-row: 6 / span 3;
        transform: rotate(2deg);
        margin-left: -20px;
    }

    .chaos-item:nth-child(7) {
        grid-column: 2 / span 4;
        grid-row: 8 / span 4;
        transform: rotate(-1deg);
        margin-top: -30px;
    }

    .chaos-item:nth-child(8) {
        grid-column: 6 / span 4;
        grid-row: 9 / span 3;
        transform: rotate(1.5deg);
        margin-left: -40px;
        margin-top: -20px;
        z-index: 2;
    }

    .chaos-item:nth-child(9) {
        grid-column: 10 / span 3;
        grid-row: 9 / span 4;
        transform: rotate(-2.5deg);
    }

    .chaos-item:nth-child(10) {
        grid-column: 1 / span 5;
        grid-row: 12 / span 3;
        transform: rotate(1deg);
        margin-top: -50px;
    }

    .chaos-item:nth-child(11) {
        grid-column: 6 / span 7;
        grid-row: 12 / span 4;
        transform: rotate(-1deg);
        margin-left: -20px;
    }

    /* Staggered entry animation */
    .chaos-item {
        opacity: 0;
        animation: fadeInUp 0.8s forwards;
    }

    .chaos-item:nth-child(odd) {
        animation-delay: 0.2s;
    }

    .chaos-item:nth-child(even) {
        animation-delay: 0.4s;
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px) rotate(0);
    }

    to {
        opacity: 1;
        transform: translateY(0) rotate(inherit);
    }
}

/* --- Instagram Style Grid (Mobile) --- */
@media (max-width: 768px) {
    .chaos-grid {
        grid-template-columns: repeat(3, 1fr);
        grid-auto-rows: minmax(100px, auto);
        gap: 2px;
        /* Typical Instagram gap */
        padding: 1rem 0;
        margin-left: -1.5rem;
        /* Offset parent .section-padding */
        margin-right: -1.5rem;
        width: calc(100% + 3rem);
    }

    .chaos-item {
        border-radius: 0;
        /* Square/Flat look */
        box-shadow: none;
        aspect-ratio: 1 / 1;
    }

    .chaos-item:hover {
        transform: none;
    }
}