/* --- General Styles --- */
body {
    margin: 0;
    padding: 0;
    background-color: #000;
    overflow-x: hidden;
    font-family: Cambria, Cochin, Georgia, Times, 'Times New Roman', serif;
}

/* --- Scroll spacer to make content scrollable --- */
#spacer {
    height: 300vh;
    /* double the scroll space */
}

/* --- Fixed dancing GIFs --- */
.personas {
    position: fixed;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    max-height: 80vh;
    max-width: 90vw;
    width: auto;
    height: auto;
    z-index: 2;
    mix-blend-mode: difference;
    opacity: 0;
}

/* --- Centered title --- */
#memory {
    font-size: 3rem;
    letter-spacing: 0px;
    position: fixed;
    color: #fff;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    opacity: 0;
    text-align: center;
    z-index: 9;
    transition: all 0.3s ease;
    padding: 0 20px;
    max-width: 90vw;
}

#memory span.wave {
    display: inline-block;
    transition: all 0.3s ease;
}

#memory:hover span.wave {
    animation: wave 0.6s ease-in-out infinite;
    color: #4a4c94;
    font-style: italic;
    font-size: 3rem;
}

#memory:hover span.wave:nth-child(2) {
    animation-delay: 0s;
}

#memory:hover span.wave:nth-child(3) {
    animation-delay: 0.1s;
}

#memory:hover span.wave:nth-child(4) {
    animation-delay: 0.2s;
}

#memory:hover span.wave:nth-child(5) {
    animation-delay: 0.3s;
}

#memory:hover span.wave:nth-child(6) {
    animation-delay: 0.4s;
}

#memory:hover span.wave:nth-child(7) {
    animation-delay: 0.6s;
}

#memory:hover span.wave:nth-child(8) {
    animation-delay: 0.7s;
}

@keyframes wave {

    0%,
    100% {
        transform: translateY(0);
    }

    50% {
        transform: translateY(-10px);
    }
}

#memory:hover {
    letter-spacing: 10px;
}

/* --- Gallery --- */
.gallery {
    width: 95vw;
    margin: 30vh auto 0;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
    gap: 20px;
    opacity: 0;
    transition: opacity 0.8s ease;
    z-index: 10;
}


.visible {
    opacity: 1 !important;
    transition: opacity 0.8s ease;
}

.gallery-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    overflow: hidden;
    transition: transform 0.3s ease;
}

.gallery-item:hover {
    transform: scale(1.02);
}

.gallery-item img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: contain;
}

/* --- Captions under images --- */
.caption {
    margin-top: 10px;
    font-size: 1rem;
    color: #fff;
    opacity: 0;
    /* hidden by default */
    transition: opacity 0.3s ease;
    padding: 0 10px;
    text-align: center;
    line-height: 1.5;
}

.gallery-item:hover .caption {
    opacity: 1;
    /* show caption on hover */
}

/* --- Responsive Design --- */

/* Tablet and smaller screens */
@media screen and (max-width: 1024px) {
    #memory {
        font-size: 2.5rem;
    }

    #memory:hover {
        letter-spacing: 5px;
    }

    #memory:hover span.wave {
        font-size: 2.5rem;
    }

    .gallery {
        grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
        gap: 15px;
        width: 90vw;
    }

    .caption {
        font-size: 0.95rem;
    }
}

/* Mobile screens */
@media screen and (max-width: 768px) {
    #memory {
        font-size: 2rem;
    }

    #memory:hover {
        letter-spacing: 3px;
    }

    #memory:hover span.wave {
        font-size: 2rem;
    }

    .personas {
        max-height: 70vh;
    }

    .gallery {
        grid-template-columns: 1fr;
        gap: 20px;
        width: 90vw;
        margin: 20vh auto 0;
    }

    .caption {
        font-size: 0.9rem;
        opacity: 1;
        /* Always show captions on mobile since hover doesn't work well */
    }

    #spacer {
        height: 250vh;
    }
}

/* Small mobile screens */
@media screen and (max-width: 480px) {
    #memory {
        font-size: 1.5rem;
        padding: 0 10px;
    }

    #memory:hover {
        letter-spacing: 2px;
    }

    #memory:hover span.wave {
        font-size: 1.5rem;
    }

    .personas {
        max-height: 60vh;
    }

    .gallery {
        width: 95vw;
        gap: 15px;
    }

    .caption {
        font-size: 0.85rem;
    }

    @keyframes wave {

        0%,
        100% {
            transform: translateY(0);
        }

        50% {
            transform: translateY(-5px);
        }
    }
}

/* Extra small screens */
@media screen and (max-width: 360px) {
    #memory {
        font-size: 1.2rem;
    }

    #memory:hover span.wave {
        font-size: 1.2rem;
    }

    .caption {
        font-size: 0.8rem;
    }
}