/*
 * 1. RESET BÁSICO Y FUENTES
 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    /* Usando font-family más simple para evitar problemas de compatibilidad */
    font-family: "Comic Neue", cursive, sans-serif; 
}

body {
    min-height: 100vh;
    display: grid;
    place-content: center;
    background: #f8f6f1; /* Fondo muy claro */
    overflow: hidden;
}

/*
 * 2. ESTILOS DEL ENCABEZADO Y ANIMACIÓN DE BRILLO
 * Usamos propiedades estándar para asegurar la compatibilidad con navegadores modernos.
 */
#encabezado-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    margin-bottom: 60px;
}

#brillo {
    font-size: 60px;
    font-weight: bold;
    color: rgba(255, 0, 102, 0.3); /* Color base del texto */
    z-index: 10;
    
    /* Configuración para el efecto de brillo (barra deslizante blanca) */
    background: linear-gradient(to right, #222 0%, #fff 50%, #222 100%) 0 0 no-repeat;
    background-size: 150px;
    background-clip: text;
    -webkit-background-clip: text; /* Prefijo para asegurar compatibilidad */
    -webkit-text-fill-color: transparent; /* Hace que solo se vea el gradiente */
    
    animation: shine 3s infinite; /* Usamos 'shine' en lugar de 'brillo' */
    text-shadow: 0 0px 0px rgba(233, 85, 189, 0.419);
}

/* Animación del brillo (barra blanca que se mueve) */
@keyframes shine {
    0%, 10% { background-position: -1000px; }
    20% { background-position: top left; }
    90% { background-position: top right; }
    100% { background-position: 1000px; }
}

/*
 * 3. GALERÍA DE EFECTO PILA (STACK/DECK EFFECT)
 * Coloca las imágenes una encima de la otra y aplica las animaciones de movimiento y z-index.
 */
.galeria {
    --d: 10s; /* Duración de la animación */
    --num-imgs: 5; /* ¡IMPORTANTE! Número total de imágenes. */
    
    display: grid;
    place-items: center;
    width: 220px;
    margin-left: 220px;
}

.galeria > img {
    grid-area: 1/1; /* Superpone todas las imágenes */
    width: 100%;
    aspect-ratio: 1;
    object-fit: cover;
    border: 10px solid #f2f2f2;
    box-shadow: 0 0 4px #0007;
    z-index: 2;
    
    /* Animación combinada: slide (movimiento) y z-order (apilamiento) */
    animation: 
        slide var(--d) infinite, 
        z-order var(--d) infinite steps(1);
}

/* La última imagen necesita una animación de z-order diferente para el bucle */
.galeria img:last-child {
    animation-name: slide, z-order-last;
}

/* Define el retraso y la rotación para cada una de las 5 imágenes */
/* Nota: Si tienes más de 5 imágenes, debes añadir más líneas aquí. */
.galeria > img:nth-child(1) { animation-delay: calc(0 * var(--d)); --r: 16deg; }
.galeria > img:nth-child(2) { animation-delay: calc(-1 * var(--d) / var(--num-imgs)); --r: -1deg; }
.galeria > img:nth-child(3) { animation-delay: calc(-2 * var(--d) / var(--num-imgs)); --r: -19deg; }
.galeria > img:nth-child(4) { animation-delay: calc(-3 * var(--d) / var(--num-imgs)); --r: 6deg; }
.galeria > img:nth-child(5) { animation-delay: calc(-4 * var(--d) / var(--num-imgs)); --r: -8deg; }

/* Mueve la imagen que está en la parte superior hacia la derecha */
@keyframes slide {
    /* 10% del tiempo se mueve */
    10% { transform: translateX(120%) rotate(var(--r)); } 
    /* El resto del tiempo se queda en el centro */
    0%, 100%, 20% { transform: translateX(0%) rotate(var(--r)); }
}

/* Controla el orden de apilamiento (z-index) de las imágenes */
@keyframes z-order {
    /* Cuando se está moviendo o justo después, tiene z-index: 1 */
    10%, 20% { z-index: 1; } 
    /* El resto del tiempo (cuando está debajo), tiene z-index: 2 */
    80% { z-index: 2; }
}

/* Z-order especial para la última imagen, ya que tiene que volver al fondo */
@keyframes z-order-last {
    10%, 20% { z-index: 1; }
    90% { z-index: 2; }
}

/*
 * 4. RESPONSIVE DESIGN
 */
@media only screen and (max-width: 600px) {
    #brillo { font-size: 22px; }
    
    .galeria {
        width: 150px;
        margin-left: 60px;
    }
}