/* --- CONFIGURACIÓN DE TEMAS Y VARIABLES --- */
:root {
    /* Tema Claro (Por defecto) */
    --color-background: #f4f4f4;
    --color-surface: #ffffff;
    --color-text-primary: #1a252f;
    --color-text-secondary: #5c6a77;
    --color-accent: #3498db;
    --color-hero-title: #2c3e50;
    --color-border: #e0e0e0;
}

.dark-theme {
    /* Tema Oscuro */
    --color-background: #121212;
    --color-surface: #1e1e1e;
    --color-text-primary: #e0e0e0;
    --color-text-secondary: #a0a0a0;
    --color-accent: #4dabf7;
    --color-hero-title: #ffffff;
    --color-border: #333333;
}

/* --- ESTILOS GENERALES --- */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--color-background);
    color: var(--color-text-primary);
    font-family: 'Poppins', sans-serif;
    transition: background-color 0.3s ease, color 0.3s ease;
}

body.modal-open {
    overflow: hidden;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* --- HEADER --- */
.header {
    background-color: #2c3e50; /* Color de fondo unificado */
    border-bottom: 1px solid #4a6fa5; /* Un borde sutil que combine */
    padding: 1rem 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    display: flex;
    align-items: center;
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    color: #ffffff; /* Color de texto blanco */
}

.logo-img {
    height: 50px;
    margin-right: 15px;
    /* Se elimina el filtro */
}

.controls {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.contact-button {
    background-color: var(--color-accent);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease;
}

.contact-button:hover {
    background-color: #2980b9;
}

.dark-theme .contact-button:hover {
    background-color: #74c0fc;
}

/* --- BOTÓN DE TEMA --- */
.theme-toggle {
    background-color: transparent;
    border: 1px solid #4a6fa5; /* Borde que contrasta con el fondo oscuro */
    border-radius: 5px;
    width: 40px;
    height: 40px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    color: #ffffff; /* Iconos en blanco */
    position: relative;
    overflow: hidden;
}
.theme-toggle .fa-sun, .theme-toggle .fa-moon {
    position: absolute;
    transition: transform 0.3s ease, opacity 0.3s ease;
}
.theme-toggle .fa-sun {
    transform: translateY(0);
    opacity: 1;
}
.theme-toggle .fa-moon {
    transform: translateY(150%);
    opacity: 0;
}

.dark-theme .theme-toggle .fa-sun {
    transform: translateY(-150%);
    opacity: 0;
}
.dark-theme .theme-toggle .fa-moon {
    transform: translateY(0);
    opacity: 1;
}


/* --- HERO PORTFOLIO --- */
.hero-portfolio {
    text-align: center;
    padding: 4rem 0;
}
.hero-portfolio h1 {
    font-size: 3rem;
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 1rem;
    color: var(--color-hero-title);
}
.hero-portfolio p {
    font-size: 1.2rem;
    color: var(--color-text-secondary);
    max-width: 700px;
    margin: 0 auto;
}

/* --- GRID DE PORTFOLIO --- */
.portfolio-grid-section {
    padding: 2rem 0 4rem 0;
}

.portfolio-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 2rem;
}

.project-card {
    background-color: var(--color-surface);
    border-radius: 8px;
    overflow: hidden;
    text-decoration: none;
    color: var(--color-text-primary);
    border: 1px solid var(--color-border);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    cursor: pointer;
    display: flex;
    flex-direction: column;
}

.project-card:hover {
    transform: translateY(-10px);
    box-shadow: 0 10px 30px rgba(0,0,0,0.1);
}

.dark-theme .project-card:hover {
    box-shadow: 0 10px 30px rgba(0,0,0,0.3);
}

.project-card-image-container {
    height: 250px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    background-color: rgba(0,0,0,0.02);
}

.dark-theme .project-card-image-container {
    background-color: rgba(255,255,255,0.02);
}

.project-card img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.project-info {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.project-info h3 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.project-info span {
    color: var(--color-text-secondary);
    font-weight: 500;
    margin-top: auto;
}


/* --- FOOTER --- */
.footer {
    text-align: center;
    padding: 2rem 0;
    border-top: 1px solid var(--color-border);
    color: var(--color-text-secondary);
}

.footer a {
    color: var(--color-accent);
    text-decoration: none;
    font-weight: 600;
}

/* --- ESTILOS DEL MODAL --- */
.modal {
    display: none;
    position: fixed;
    z-index: 2000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.7);
    padding-top: 50px;
}

.modal-content {
    background-color: var(--color-surface);
    margin: auto;
    padding: 2rem;
    border-radius: 8px;
    max-width: 800px;
    width: 90%;
    position: relative;
    box-shadow: 0 5px 20px rgba(0,0,0,0.3);
    animation: modal-fade-in 0.3s ease;
}

@keyframes modal-fade-in {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.close-modal {
    position: absolute;
    top: 1rem;
    right: 1.5rem;
    font-size: 2rem;
    color: var(--color-text-secondary);
    cursor: pointer;
    transition: transform 0.2s ease, color 0.2s ease;
}

.close-modal:hover {
    transform: rotate(90deg);
    color: var(--color-text-primary);
}

#modal-text-content h2 {
    font-family: 'Montserrat', sans-serif;
    margin-bottom: 0.5rem;
}

#modal-text-content .tags {
    font-weight: 600;
    color: var(--color-accent);
    margin-bottom: 1.5rem;
    display: block;
}

#modal-text-content p {
    color: var(--color-text-secondary);
    line-height: 1.7;
    margin-bottom: 1.5rem;
}

.case-study-section {
    margin-top: 2rem;
}

.case-study-section h4 {
    font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    color: var(--color-text-primary);
    margin-bottom: 0.5rem;
    border-left: 4px solid var(--color-accent);
    padding-left: 10px;
}

.portfolio-button {
    display: inline-block;
    background-color: var(--color-accent);
    color: white;
    padding: 0.8rem 1.5rem;
    border-radius: 5px;
    text-decoration: none;
    font-weight: 600;
    transition: background-color 0.2s ease;
    margin-top: 1rem;
}

.portfolio-button:hover {
    background-color: #2980b9;
}

.dark-theme .portfolio-button:hover {
    background-color: #74c0fc;
}


/* --- AJUSTES PARA DISPOSITIVOS MÓVILES --- */
@media (max-width: 768px) {
    .logo span {
        display: none;
    }

    .hero-portfolio h1 {
        font-size: 2.2rem;
    }

    .hero-portfolio p {
        font-size: 1rem;
    }

    .portfolio-grid {
        gap: 1.5rem;
    }

    .modal-content {
        padding: 1.5rem;
        margin-top: 0;
        margin-bottom: 50px;
    }
}