/* REQUISITO: Uso de variables CSS para colores y transiciones */
:root {
    --primary-color: #2563eb;
    --primary-dark: #1d4ed8;
    --secondary-color: #64748b;
    --background: #f8fafc;
    --surface: #ffffff;
    --surface-hover: #f1f5f9;
    --text-primary: #1e293b;
    --text-secondary: #475569;
    --border-color: #e2e8f0;
    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --font-stack: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

/* Comentario: Reset básico y configuración del cuerpo */
body {
    background-color: var(--background);
    color: var(--text-primary);
    font-family: var(--font-stack);
    margin: 0;
    padding: 20px;
    line-height: 1.6;
}

h1, h2, h3 {
    color: var(--text-primary);
    text-shadow: none;
    margin: 0;
}

/* Comentario: Estilos del header principal */
.main-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--border-color);
    margin-bottom: 40px;
    padding-bottom: 20px;
    background: transparent;
    padding: 10px 0;
    box-shadow: none;

    h1 {
        font-size: 1.75rem;
        font-weight: 700;
        color: var(--text-primary);
        background: none;
        -webkit-text-fill-color: var(--text-primary);
        filter: none;
    }
    
    p {
        color: var(--text-secondary);
        margin: 0;
    }
}

/* REQUISITO: Configuración de CSS GRID */
.grid-container {
    display: grid;
    gap: 24px;
    grid-template-columns: repeat(4, 1fr);
    grid-template-areas: 
        "intro intro tech inter"
        "filo city city inter"
        "proy proy proy proy";
    max-width: 1200px;
    margin: 0 auto;
}

/* Comentario: Asignación de clases a las áreas del grid */
.intro { 
    grid-area: intro; 
}
.img-tech { grid-area: tech; }
.filosofia { grid-area: filo; }
.img-city { grid-area: city; }
.intereses { grid-area: inter; }
.proyectos { grid-area: proy; }

/* Comentario: Estilo base de los contenedores (Cards) */
.card {
    background-color: var(--surface);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    padding: 24px;
    transition: all 0.3s ease;
    overflow: hidden;
    box-shadow: var(--shadow-sm);
    min-height: 150px;
    word-wrap: break-word;
    overflow-wrap: break-word;
    max-width: 100%;

    img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
        border-radius: 4px;
    }

    &:hover {
        transform: translateY(-2px);
        border-color: var(--primary-color);
        box-shadow: var(--shadow-lg);
    }
}

.card-flip {
    position: relative;
    cursor: pointer;
    perspective: 1000px;
    
    input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
    }
    
    .card-front, .card-back {
        backface-visibility: hidden;
        transition: transform 0.6s;
    }
    
    .card-front {
        position: relative;
        z-index: 1;
    }
    
    .card-back {
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        transform: rotateY(180deg);
        background: var(--surface);
        border: 1px solid var(--primary-color);
        display: flex;
        align-items: center;
        justify-content: center;
        text-align: center;
        padding: 24px;
        box-shadow: var(--shadow-lg);
        z-index: 2;
    }
    
    input:checked ~ .card-front {
        transform: rotateY(180deg);
    }
    
    input:checked ~ .card-back {
        transform: rotateY(0deg);
    }
}

/* Comentario: Estilos para las etiquetas de categoría (LABORATORIO, FILOSOFÍA...) */
.label {
    color: var(--primary-color);
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
    text-shadow: none;
}

/* Comentario: Disposición de los enlaces de proyectos usando Flexbox */
.project-links {
    display: flex;
    gap: 24px;
    margin-top: 15px;
    flex-wrap: wrap;
}

/* REQUISITO: Enlaces funcionales con hover */
.btn {
    display: inline-block;
    background: var(--primary-color);
    color: white;
    padding: 10px 20px;
    border-radius: 6px;
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
    border: none;
    box-shadow: var(--shadow-sm);
    text-transform: none;
    font-size: 0.9rem;

    &:hover {
        background: var(--primary-dark);
        box-shadow: var(--shadow-md);
    }
}

.btn-explode {
    &:hover {
        animation: explode 0.4s ease-out;
    }
}

/* Comentario: Línea decorativa superior de la caja principal */
.decorator-line {
    width: 40px;
    height: 3px;
    background: var(--primary-color);
    margin-bottom: 15px;
}

/* Comentario: Estilos de la lista de intereses */
.interest-list {
    list-style: none;
    padding: 0;
    margin: 0;
    
    li {
        margin-bottom: 12px;
        line-height: 1.5;
        color: var(--text-secondary);
    }
    
    strong {
        color: var(--text-primary);
    }
}

/* REQUISITO: Diseño Responsive mediante Media Queries */
@keyframes explode {
    0% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.1);
        box-shadow: 
            0 0 10px #3b82f6,
            0 0 20px #3b82f6,
            0 0 30px #2563eb;
    }
    100% {
        transform: scale(1);
    }
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.main-header {
    animation: fadeInUp 0.5s ease-out forwards;
}

.card {
    animation: fadeInUp 0.5s ease-out forwards;
    opacity: 0;
}

.intro { animation-delay: 0.1s; }
.img-tech { animation-delay: 0.15s; }
.filosofia { animation-delay: 0.2s; }
.img-city { animation-delay: 0.25s; }
.intereses { animation-delay: 0.3s; }
.proyectos { animation-delay: 0.35s; }

@media (max-width: 1024px) {
    .grid-container {
        grid-template-columns: repeat(2, 1fr);
        grid-template-areas: 
            "intro intro"
            "tech filo"
            "city city"
            "inter inter"
            "proy proy";
    }
}

@media (max-width: 640px) {
    .grid-container {
        grid-template-columns: 1fr;
        grid-template-areas: 
            "intro"
            "tech"
            "filo"
            "city"
            "inter"
            "proy";
    }
    
    .main-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 8px;
    }
    
    .project-links {
        flex-direction: column;
        gap: 12px;
    }
}