:root {
    --bg-color: #050505;
    --card-bg: rgba(255, 255, 255, 0.05); /* Transparente */
    --card-border: rgba(255, 255, 255, 0.1);
    --accent: #bc13fe; /* Un morado neón vibrante */
    --text-main: #ffffff;
    --text-sec: #aaaaaa;
    --gap: 20px;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    background-color: var(--bg-color);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    color: var(--text-main);
    min-height: 100vh;
    padding: 2rem;
    
    /* Fondo con un degradado sutil en el centro */
    background-image: radial-gradient(circle at 50% 0%, #1a0b2e 0%, #050505 60%);
}

/* --- CABECERA --- */
header {
    max-width: 1200px;
    margin: 0 auto 3rem auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    text-align: center;
}

.title-badge {
    background: var(--accent);
    color: white;
    padding: 5px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: bold;
    text-transform: uppercase;
    letter-spacing: 1px;
}

h1 {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: linear-gradient(to right, #fff, #aaa);
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- BUSCADOR --- */
.search-container {
    width: 100%;
    max-width: 500px;
    position: relative;
}

#searchInput {
    width: 100%;
    padding: 15px 25px;
    border-radius: 50px;
    border: 1px solid var(--card-border);
    background: var(--card-bg);
    color: white;
    font-size: 1rem;
    outline: none;
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

#searchInput:focus {
    border-color: var(--accent);
    box-shadow: 0 0 20px rgba(188, 19, 254, 0.3);
}

/* --- GRID PRINCIPAL --- */
.bento-grid {
    display: grid;
    /* Esto hace la magia: crea columnas automáticas que miden mínimo 280px */
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: var(--gap);
    max-width: 1200px;
    margin: 0 auto;
    padding-bottom: 4rem;
}

/* --- TARJETAS --- */
.card-link {
    text-decoration: none;
    color: inherit;
    display: block; /* Asegura que el link ocupe todo el espacio */
}

.card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 24px;
    padding: 1.5rem;
    height: 100%;
    display: flex;
    flex-direction: column;
    transition: transform 0.3s ease, background 0.3s ease;
    position: relative;
    overflow: hidden;
}

.card:hover {
    transform: translateY(-5px);
    background: rgba(255, 255, 255, 0.1);
    border-color: rgba(255, 255, 255, 0.3);
}

/* Contenedor de imagen con relación de aspecto fija */
.img-container {
    width: 100%;
    aspect-ratio: 16/9; /* Mantiene formato rectangular siempre */
    border-radius: 16px;
    overflow: hidden;
    margin-bottom: 1.2rem;
    background: #111;
}

.img-container img {
    width: 100%;
    height: 100%;
    object-fit: cover; /* Recorta la imagen para que llene el hueco sin deformarse */
    transition: transform 0.5s ease;
}

.card:hover .img-container img {
    transform: scale(1.05); /* Zoom suave a la imagen */
}

.card h2 {
    font-size: 1.2rem;
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.card p {
    font-size: 0.9rem;
    color: var(--text-sec);
    line-height: 1.4;
}

/* Botoncito de flecha */
.arrow-icon {
    margin-top: auto; /* Empuja la flecha al fondo */
    padding-top: 1rem;
    display: flex;
    justify-content: flex-end;
    color: var(--accent);
    font-weight: bold;
    opacity: 0;
    transform: translateX(-10px);
    transition: all 0.3s ease;
}

.card:hover .arrow-icon {
    opacity: 1;
    transform: translateX(0);
}

/* --- FOOTER --- */
footer {
    text-align: center;
    padding: 2rem;
    border-top: 1px solid var(--card-border);
    color: var(--text-sec);
    font-size: 0.9rem;
}

footer a { color: var(--text-main); text-decoration: none; }
footer a:hover { color: var(--accent); }

/* Animación de entrada */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

.card-link {
    animation: fadeIn 0.5s ease forwards;
    animation-delay: calc(var(--order) * 0.1s); /* Retraso escalonado */
    opacity: 0; /* Empieza invisible */
}