/* =================================================================
   1. VARIABLES Y ESTILOS BASE
================================================================= */
:root {
    /* Paleta oscura de ALTO CONTRASTE */
    --color-dark-bg: #0A192F;       /* Azul marino muy oscuro */
    --color-primary: #64FFDA;       /* Cian/Menta brillante (para acentos) */
    --color-secondary: #00A693;     /* Cian más oscuro */
    --color-text-light: #CCD6F6;    /* Gris azulado claro (texto principal) */
    --color-text-mid: #8892B0;       /* Gris azulado medio (subtítulos) */
    
    /* Paleta de Acentos para Proyectos */
    --color-accent-blue: #81A1C1;   /* Azul claro nórdico */
    --color-accent-purple: #B48EAD; /* Púrpura suave nórdico */
    --color-accent-orange: #D08770; /* Naranja/coral nórdico */
    --color-card-bg: #112240;       /* Fondo de tarjeta principal */

    /* Fuentes */
    --font-display: 'Space Grotesk', sans-serif;
    --font-body: 'Inter', sans-serif;
}

body {
    background-color: var(--color-dark-bg);
    color: var(--color-text-light);
    font-family: var(--font-body);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.container {
    width: 90%;
    max-width: 1200px;
    margin: 0 auto;
}

/* =================================================================
   2. HEADER, BOTONES Y NAVEGACIÓN
================================================================= */
.main-header {
    position: fixed; top: 0; left: 0; width: 100%; z-index: 100;
    padding: 1rem 0; background-color: rgba(10, 25, 47, 0.85);
    backdrop-filter: blur(10px); transition: top 0.3s ease-in-out; opacity: 0;
}
.header-container { display: flex; justify-content: space-between; align-items: center; }
.logo a { text-decoration: none; }
.logo img { height: 45px; transition: transform 0.3s ease; }
.logo img:hover { transform: scale(1.1); }
.main-nav ul { list-style: none; margin: 0; padding: 0; display: flex; align-items: center; gap: 2rem; }
.main-nav a { font-family: var(--font-body); font-weight: 500; text-decoration: none; color: var(--color-text-mid); transition: color 0.3s ease; padding-bottom: 0.25rem; position: relative; }
.main-nav a:not(.cta-button):hover { color: var(--color-primary); }
.main-nav a:not(.cta-button)::after { content: ''; position: absolute; bottom: 0; left: 0; width: 100%; height: 1px; background-color: var(--color-primary); transform: scaleX(0); transform-origin: right; transition: transform 0.4s cubic-bezier(0.19, 1, 0.22, 1); }
.main-nav a:not(.cta-button):hover::after { transform: scaleX(1); transform-origin: left; }
.mobile-menu-button { display: none; background: none; border: none; color: var(--color-primary); cursor: pointer; z-index: 1001; }

/* Botones CTA (Unificados) */
.cta-button, .cta-button-secondary { font-family: var(--font-display); padding: 0.8rem 1.8rem; border-radius: 4px; border: 1px solid var(--color-primary); font-weight: 500; font-size: 0.9rem; transition: all 0.25s ease; display: inline-flex; align-items: center; gap: 0.75rem; text-decoration: none; cursor: pointer; }
.cta-button { background-color: var(--color-primary); color: #0A192F; }
.cta-button:hover { background-color: transparent; color: var(--color-primary); transform: translateY(-3px); }
.main-nav .cta-button { background-color: transparent; color: var(--color-primary); }
.main-nav .cta-button:hover { background-color: rgba(100, 255, 218, 0.1); transform: none; }
.cta-button-secondary { background-color: transparent; color: var(--color-primary); border: 1px solid var(--color-primary); }
.cta-button-secondary:hover { background-color: rgba(100, 255, 218, 0.1); transform: translateY(-3px); }
.button-icon { width: 18px; height: 18px; }

/* =================================================================
   3. SECCIONES Y TÍTULOS
================================================================= */
.content-section { padding: 100px 0; }
.content-section.placeholder { min-height: 60vh; }
.section-title { font-family: var(--font-display); font-size: clamp(1.8rem, 5vw, 2.5rem); color: var(--color-text-light); margin-bottom: 3rem; position: relative; padding-bottom: 1rem; }
.section-title::after { content: ''; position: absolute; bottom: 0; left: 0; width: 80px; height: 3px; background-color: var(--color-primary); }

/* =================================================================
   4. SECCIÓN HERO
================================================================= */
.hero-section { min-height: 100vh; display: flex; align-items: center; position: relative; background-image: url('../images/imagen-portada.jpg'); background-size: cover; background-position: center center; background-attachment: fixed; }
.hero-section::before { content: ''; position: absolute; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(10, 25, 47, 0.65); z-index: 1; }
.hero-content { position: relative; z-index: 2; }
.hero-title { font-family: var(--font-display); font-size: clamp(2.5rem, 8vw, 6rem); font-weight: 700; line-height: 1.1; margin: 0; color: var(--color-text-light); }
.hero-title .role { color: var(--color-primary); }
.hero-subtitle { font-size: clamp(1rem, 2vw, 1.1rem); color: var(--color-text-mid); max-width: 700px; margin: 2rem 0; line-height: 1.6; opacity: 0; }
.hero-buttons { margin-top: 2.5rem; display: flex; flex-wrap: wrap; gap: 1rem; opacity: 0; }

/* =================================================================
   5. SECCIÓN "SOBRE MÍ"
================================================================= */
.about-content { display: grid; grid-template-columns: 3fr 2fr; gap: 50px; align-items: flex-start; }
.about-text p { color: var(--color-text-mid); margin-bottom: 1rem; line-height: 1.6; }
.skills-list { list-style: none; padding: 0; margin-top: 2rem; display: grid; grid-template-columns: repeat(2, minmax(140px, 200px)); gap: 10px; }
.skills-list li { color: var(--color-text-mid); font-family: var(--font-display); position: relative; padding-left: 20px; }
.skills-list li::before { content: '▹'; position: absolute; left: 0; color: var(--color-primary); }
.about-image { max-width: 300px; margin: 0 auto; }
.image-wrapper { position: relative; width: 100%; border-radius: 4px; background-color: var(--color-primary); }
.image-wrapper::after { content: ''; position: absolute; top: 15px; left: 15px; width: 100%; height: 100%; border: 2px solid var(--color-primary); border-radius: 4px; z-index: -1; transition: all 0.3s ease-in-out; }
.image-wrapper:hover::after { top: 10px; left: 10px; }
.image-wrapper img { width: 100%; height: auto; display: block; position: relative; border-radius: 4px; mix-blend-mode: multiply; filter: grayscale(100%) contrast(1); transition: all 0.3s ease-in-out; }
.image-wrapper:hover img { mix-blend-mode: normal; filter: none; }

/* =================================================================
   6. SECCIÓN EXPERIENCIA (TIMELINE)
================================================================= */
.experience-intro { max-width: 800px; margin-bottom: 3rem; color: var(--color-text-mid); }
.timeline { position: relative; max-width: 800px; margin: 0 auto; padding: 2rem 0; }
.timeline::after { content: ''; position: absolute; width: 2px; background-color: #233554; top: 0; bottom: 0; left: 30px; }
.timeline-item { padding: 10px 40px; padding-left: 70px; position: relative; background-color: transparent; }
.timeline-item::before { content: ''; position: absolute; width: 15px; height: 15px; left: 23px; background-color: var(--color-dark-bg); border: 2px solid var(--color-primary); top: 24px; border-radius: 50%; z-index: 1; }
.timeline-content { padding: 20px 30px; background-color: #112240; position: relative; border-radius: 6px; transition: all 0.3s ease; }
.timeline-item:hover .timeline-content { transform: translateY(-3px); box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.timeline-date { font-family: var(--font-display); color: var(--color-primary); font-size: 0.8rem; display: block; margin-bottom: 0.5rem; }
.timeline-title { font-family: var(--font-display); font-weight: 700; color: var(--color-text-light); margin: 0; font-size: 1.2rem; }
.timeline-company { color: var(--color-text-mid); margin: 0.25rem 0 0.75rem 0; font-style: italic; }
.timeline-description { color: var(--color-text-mid); font-size: 0.9rem; line-height: 1.5; margin: 0; }
.more-info-button { text-align: center; margin-top: 3rem; }

/* =================================================================
   7. SECCIÓN PROYECTOS (PÁGINA DE INICIO)
================================================================= */
.project-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 1.5rem; }
.project-card { background-color: #112240; border-radius: 4px; transition: all 0.3s ease; display: flex; }
.project-card:hover { transform: translateY(-5px); box-shadow: 0 10px 30px -15px rgba(2,12,27,0.7); }
.project-content { padding: 2rem; display: flex; flex-direction: column; justify-content: space-between; width: 100%; }
.project-title { font-family: var(--font-display); font-size: 1.25rem; color: var(--color-text-light); margin-bottom: 1rem; }
.project-title:hover { color: var(--color-primary); }
.project-description p { color: var(--color-text-mid); font-size: 0.95rem; line-height: 1.6; }
.project-card footer { margin-top: 1.5rem; display: flex; justify-content: space-between; align-items: flex-end; }
.project-tech-list { list-style: none; padding: 0; margin: 0; display: flex; flex-wrap: wrap; gap: 0.75rem; }
.project-tech-list li { font-family: var(--font-display); font-size: 0.8rem; color: var(--color-text-mid); }
.project-links a { color: var(--color-text-mid); transition: color 0.3s ease; }
.project-links a:hover { color: var(--color-primary); }

/* =================================================================
   8. PÁGINA DE PROYECTOS DETALLADOS
================================================================= */
.project-detail-list { display: flex; flex-direction: column; gap: 3rem; }
.project-detail-card { background-color: var(--color-card-bg); border-radius: 4px; padding: 2.5rem; display: grid; gap: 2rem 3rem; align-items: start; border-left: 4px solid; transition: all 0.3s ease; grid-template-columns: 1fr 2.5fr; }
.project-detail-card:hover { background-color: #162B4D; transform: translateY(-5px); border-color: var(--color-primary); }
.project-detail-header { text-align: center; position: sticky; top: 120px; }
.project-detail-icon { width: 48px; height: 48px; margin-bottom: 1rem; stroke-width: 1.5; }
.project-detail-header h3 { font-family: var(--font-display); font-size: 1.5rem; color: var(--color-text-light); margin: 0; }
.project-detail-body > p { color: var(--color-text-mid); line-height: 1.6; margin-top: 0; margin-bottom: 2rem; }
.project-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1.5rem 2rem; padding-top: 1.5rem; border-top: 1px solid #233554; }
.breakdown-item h4 { font-family: var(--font-display); color: var(--color-text-light); margin-bottom: 1rem; font-size: 1rem; }
.breakdown-item ul { list-style: none; padding: 0; margin: 0; }
.breakdown-item ul li { color: var(--color-text-mid); margin-bottom: 0.5rem; font-size: 0.9rem; }
.breakdown-item ul li strong { color: var(--color-text-light); font-weight: 500; }
.project-detail-footer { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid #233554; display: flex; flex-wrap: wrap; gap: 1.5rem; }
.project-link-button { display: inline-flex; align-items: center; gap: 0.5rem; text-decoration: none; color: var(--color-text-mid); font-family: var(--font-body); font-weight: 500; transition: color 0.3s ease; }
.project-link-button:hover { color: var(--color-primary); }
.project-link-button span { margin-top: 2px; }
.project-detail-card.alternate-layout { direction: rtl; }
.project-detail-card.alternate-layout > * { direction: ltr; }
.project-detail-card:nth-child(1) { border-color: var(--color-primary); }
.project-detail-card:nth-child(1) .project-detail-icon { color: var(--color-primary); }
.project-detail-card:nth-child(2) { border-color: var(--color-accent-blue); }
.project-detail-card:nth-child(2) .project-detail-icon { color: var(--color-accent-blue); }
.project-detail-card:nth-child(3) { border-color: var(--color-accent-purple); }
.project-detail-card:nth-child(3) .project-detail-icon { color: var(--color-accent-purple); }
.project-detail-card:nth-child(4) { border-color: var(--color-accent-orange); }
.project-detail-card:nth-child(4) .project-detail-icon { color: var(--color-accent-orange); }

/* =================================================================
   9. PÁGINA DE EXPERIENCIA DETALLADA
================================================================= */
.experience-header { text-align: center; max-width: 800px; margin: 0 auto 4rem auto; }
.experience-summary { color: var(--color-text-mid); font-size: 1.1rem; line-height: 1.6; }
.specialization-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; margin-bottom: 5rem; }
.specialization-card { background-color: #112240; padding: 2rem; border-radius: 4px; border: 1px solid #233554; transition: all 0.3s ease; }
.specialization-card:hover { transform: translateY(-5px); border-color: var(--color-primary); }
.card-icon { color: var(--color-primary); margin-bottom: 1rem; width: 32px; height: 32px; }
.card-title { font-family: var(--font-display); font-size: 1.2rem; color: var(--color-text-light); margin-bottom: 0.5rem; }
.card-description { color: var(--color-text-mid); font-size: 0.9rem; line-height: 1.5; }
.subsection-title { font-family: var(--font-display); font-size: 1.5rem; color: var(--color-text-light); margin-bottom: 1.5rem; }
.history-table-wrapper { overflow-x: auto; }
.history-table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.history-table th, .history-table td { padding: 1rem; text-align: left; border-bottom: 1px solid #233554; }
.history-table th { color: var(--color-text-light); font-family: var(--font-display); }
.history-table td { color: var(--color-text-mid); }
.history-table td:first-child, .history-table th:first-child { color: var(--color-text-light); white-space: nowrap; }
.experience-cta { text-align: center; margin-top: 4rem; }
.experience-cta p { color: var(--color-text-mid); margin-bottom: 1.5rem; }

/* =================================================================
   10. SECCIÓN DE CONTACTO
================================================================= */
.contact-wrapper { display: grid; grid-template-columns: 1fr 1fr; gap: 3rem; }
.contact-info h3 { font-family: var(--font-display); font-size: 1.5rem; color: var(--color-text-light); margin-bottom: 1rem; }
.contact-info p { color: var(--color-text-mid); line-height: 1.6; margin-bottom: 2rem; }
.map-container { width: 100%; height: 300px; border-radius: 4px; overflow: hidden; border: 1px solid #233554; }
.map-container iframe { width: 100%; height: 100%; filter: grayscale(1) invert(1) contrast(0.8); }
.contact-form .form-group { margin-bottom: 1.5rem; }
.contact-form label { display: block; margin-bottom: 0.5rem; color: var(--color-text-mid); font-size: 0.9rem; }
.contact-form input[type="text"],
.contact-form input[type="tel"],
.contact-form textarea { width: 100%; background-color: #112240; border: 1px solid #233554; color: var(--color-text-light); padding: 0.8rem; border-radius: 4px; font-family: var(--font-body); font-size: 1rem; transition: border-color 0.3s ease; }
.contact-form input[type="text"]:focus,
.contact-form input[type="tel"]:focus,
.contact-form textarea:focus { outline: none; border-color: var(--color-primary); }
.contact-form .cta-button { width: 100%; justify-content: center; }

/* =================================================================
   11. PÁGINA FORMULARIO PODEMOS
================================================================= */
#podemos-form-section {
    min-height: 100vh;
}
.form-text-header {
    text-align: center;
    margin-bottom: 3rem;
}
.form-text-header h1 {
    font-family: var(--font-display);
    font-size: clamp(2rem, 5vw, 3rem); /* Hacemos el título grande y responsive */
    color: var(--color-text-light);
    margin-bottom: 0.5rem;
}
.form-text-header p {
    font-size: 1.2rem;
    color: var(--color-text-mid);
    margin-top: 0;
}
.form-header-image { position: relative; width: 100%; height: 250px; border-radius: 8px; overflow: hidden; margin-bottom: 3rem; background-color: #112240; }
.form-header-image > img { width: 100%; height: 100%; object-fit: cover; opacity: 0.3; }
.form-header-logo { position: absolute; top: 50%; left: 50%; transform: translate(-50%, -50%); width: 150px; }
.form-header-logo > img { width: 100%; }
.podemos-form { max-width: 900px; margin: 0 auto; }
.podemos-form fieldset { 
    border: 1px solid #233554; 
    padding: 2.5rem; 
    border-radius: 4px; 
    margin-bottom: 2.5rem; 
    background-color: transparent; 
    /* La opacidad ya no se establece aquí, será controlada por JS si es necesario */
}
.podemos-form legend { font-family: var(--font-display); color: var(--color-primary); font-size: 1.3rem; padding: 0 1rem; margin-left: 1rem; font-weight: 700; }
.form-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(250px, 1fr)); gap: 1.5rem; }
.form-group.full-width { grid-column: 1 / -1; }
.podemos-form .form-group label { display: block; margin-bottom: 0.5rem; color: var(--color-text-mid); font-size: 0.9rem; }
.podemos-form .form-group input,
.podemos-form .form-group select { width: 100%; background-color: #112240; border: 1px solid #233554; color: var(--color-text-light); padding: 0.8rem; border-radius: 4px; font-family: var(--font-body); font-size: 1rem; transition: border-color 0.3s ease; }
.podemos-form .form-group input:focus,
.podemos-form .form-group select:focus { outline: none; border-color: var(--color-primary); }
.podemos-form .form-group select option { background-color: var(--color-dark-bg); color: var(--color-text-light); }
.form-submit-area { text-align: center; margin-top: 1rem; }

/* =================================================================
   12. FOOTER
================================================================= */
.main-footer { position: relative; z-index: 100; padding: 1.5rem 0; border-top: 1px solid rgba(100, 255, 218, 0.1); opacity: 0; }
.footer-container { display: flex; justify-content: space-between; align-items: center; }
.social-links { display: flex; gap: 1.5rem; }
.social-links a { color: var(--color-text-mid); transition: all 0.3s ease; }
.social-links a:hover { color: var(--color-primary); transform: translateY(-3px); }
.copyright p { font-family: var(--font-body); font-size: 0.9rem; color: var(--color-text-mid); text-decoration: none; }

/* =================================================================
   13. PÁGINA DE ERROR 404
================================================================= */
.error-404-section { display: flex; flex-direction: column; justify-content: center; align-items: center; min-height: 100vh; padding: 2rem; }
.terminal-window { width: 100%; max-width: 700px; background-color: #112240; border: 1px solid #233554; border-radius: 8px; box-shadow: 0 15px 30px rgba(0,0,0,0.3); opacity: 0; }
.terminal-header { background-color: #233554; padding: 0.75rem; display: flex; align-items: center; border-top-left-radius: 8px; border-top-right-radius: 8px; }
.terminal-buttons { display: flex; gap: 0.5rem; }
.terminal-buttons .btn { display: block; width: 12px; height: 12px; border-radius: 50%; }
.terminal-buttons .red { background-color: #ff5f56; }
.terminal-buttons .yellow { background-color: #ffbd2e; }
.terminal-buttons .green { background-color: #27c93f; }
.terminal-title { margin: 0; margin-left: auto; color: var(--color-text-mid); font-size: 0.8rem; }
.terminal-body { padding: 2rem; font-family: var(--font-display); font-size: 1.1rem; }
.terminal-line { margin: 0 0 0.75rem 0; white-space: nowrap; overflow: hidden; opacity: 0; }
.terminal-line .prompt { color: var(--color-primary); margin-right: 0.75rem; }
.terminal-line .path { color: #ffbd2e; }
.terminal-line .error-code { color: #ff5f56; font-weight: 700; }
.cursor { animation: blink 1s step-end infinite; color: var(--color-text-light); }
@keyframes blink { from, to { opacity: 1; } 50% { opacity: 0; } }
.error-404-cta { margin-top: 2rem; opacity: 0; }

/* =================================================================
   14. RESPONSIVE DESIGN (TABLET & MOBILE)
================================================================= */
@media (max-width: 900px) {
    /* Ajustes generales */
    .container { width: 85%; }

    /* Navegación */
    .main-nav { position: fixed; top: 0; right: -100%; width: 75%; height: 100vh; background-color: #112240; flex-direction: column; justify-content: center; align-items: center; padding: 2rem; transition: right 0.4s cubic-bezier(0.65, 0.05, 0.36, 1); }
    .main-nav.is-open { right: 0; box-shadow: -10px 0px 30px -15px rgba(2, 12, 27, 0.7); }
    .main-nav ul { flex-direction: column; font-size: 1.2rem; text-align: center; }
    .main-nav .cta-button { padding: 1rem 2.5rem; margin-top: 1rem; }
    .mobile-menu-button { display: block; }

    /* Secciones */
    .hero-section { text-align: center; align-items: center; }
    .hero-buttons { justify-content: center; }        
    .about-content { grid-template-columns: 1fr; gap: 60px; }
    .about-image { grid-row: 1; max-width: 250px; }
    .timeline::after { left: 15px; }
    .timeline-item { padding-left: 45px; }
    .timeline-item::before { left: 9px; }
    .contact-wrapper { grid-template-columns: 1fr; }

    /* Página de Proyectos Detallados */
    .project-detail-card,
    .project-detail-card.alternate-layout {
        grid-template-columns: 1fr;
        direction: ltr !important;
        padding: 2rem;
    }
    .project-detail-header {
        text-align: left;
        display: flex;
        align-items: center;
        gap: 1rem;
        position: static;
        margin-bottom: 2rem;
    }
    .project-detail-icon {
        width: 32px;
        height: 32px;
        margin-bottom: 0;
    }
    .project-detail-header h3 {
        font-size: 1.3rem;
    }

    /* Footer */
    .footer-container { flex-direction: column; gap: 1rem; }
}