:root {
    --primary-color: #0b5ed7;
    --on-primary: #ffffff;
    --secondary-color: #2c3e50;
    --accent-color: #157347;
    --bg-light: #f8f9fa;
    --bg-main: #ffffff;
    --text-color: #495057;
    --heading-color: #212529;
    --border-color: #e0e0e0;
    --border-radius: 12px;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.1);
    --shadow-dark: 0 8px 25px rgba(0, 0, 0, 0.2);
    --nav-bg: #343a40;
}

body[data-theme="dark"] {
    --primary-color: #4dabf7;
    --on-primary: #0b1220;
    --secondary-color: #e9ecef;
    --accent-color: #51cf66;
    --bg-light: #1c1c27;
    --bg-main: #12121d;
    --text-color: #adb5bd;
    --heading-color: #ffffff;
    --border-color: #495057;
    --shadow-light: 0 4px 15px rgba(0, 0, 0, 0.2);
    --shadow-dark: 0 8px 25px rgba(0, 0, 0, 0.4);
    --nav-bg: #12121d;
}

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

html {
    scroll-behavior: smooth;
}

body {
    font-family: 'Poppins', sans-serif;
    color: var(--text-color);
    line-height: 1.6;
    background-color: var(--bg-main);
    overflow-x: hidden;
    transition: background-color 0.3s ease, color 0.3s ease;
}

h1, h2, h3, h4, h5, h6, .company, .institution {
    font-family: 'Montserrat', sans-serif;
    color: var(--heading-color);
    line-height: 1.2;
    transition: color 0.3s ease;
}

a {
    color: var(--primary-color);
    text-decoration: none;
    transition: color 0.3s ease;
}

a:hover {
    color: var(--accent-color);
}

ul {
    list-style: none;
}

.cookie-consent {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 18px;
    z-index: 2000;
    padding: 0 18px;
    pointer-events: none;
}

.cookie-panel {
    max-width: 980px;
    margin: 0 auto;
    padding: 20px 22px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    background: rgba(13, 20, 31, 0.97);
    border: 1px solid rgba(116, 170, 255, 0.26);
    border-radius: 18px;
    box-shadow: 0 18px 45px rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    pointer-events: auto;
}

.cookie-copy {
    flex: 1 1 auto;
}

.cookie-copy h3 {
    margin: 0 0 6px;
    font-size: clamp(1.1rem, 1.5vw, 1.5rem);
    color: #ffffff;
}

.cookie-copy p {
    margin: 0;
    color: rgba(255, 255, 255, 0.8);
    font-size: 0.96rem;
    line-height: 1.5;
}

.cookie-actions {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}

.cookie-btn {
    border: none;
    border-radius: 999px;
    padding: 0.8rem 1.2rem;
    font-weight: 600;
    cursor: pointer;
    transition: transform 0.2s ease, opacity 0.2s ease, box-shadow 0.2s ease;
    font-family: 'Poppins', sans-serif;
}

.cookie-btn:hover {
    transform: translateY(-1px);
}

.cookie-btn-primary {
    background: linear-gradient(135deg, var(--primary-color), #6ec6ff);
    color: #fff;
    box-shadow: 0 10px 25px rgba(11, 94, 215, 0.35);
}

.cookie-btn-secondary {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.12);
}

.cookie-consent.is-hidden {
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.25s ease, transform 0.25s ease;
}

@media (max-width: 720px) {
    .cookie-consent {
        bottom: 10px;
        padding: 0 10px;
    }

    .cookie-panel {
        flex-direction: column;
        align-items: stretch;
        padding: 18px 16px;
    }

    .cookie-actions {
        width: 100%;
    }

    .cookie-btn {
        flex: 1 1 0;
    }
}

.navbar {
    background-color: var(--nav-bg);
    padding: 15px 40px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    position: sticky;
    top: 0;
    z-index: 1000;
    box-shadow: var(--shadow-dark);
    animation: fadeInDown 1s ease-out;
    transition: background-color 0.3s ease;
}

.nav-brand {
    color: #fff;
    font-size: 1.8em;
    font-weight: 700;
    letter-spacing: 1px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-logo {
    height: 46px;
    width: auto;
    display: block;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.35));
    transition: transform 0.3s ease, filter 0.3s ease;
}

.nav-brand:hover .nav-logo {
    transform: translateY(-1px);
    filter: drop-shadow(0 4px 10px rgba(11, 94, 215, 0.55));
}

.nav-toggle {
    display: none;
    background: none;
    border: 2px solid rgba(255, 255, 255, 0.6);
    color: #fff;
    width: 44px;
    height: 44px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 1.15em;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, border-color 0.2s ease;
}

.nav-toggle:hover,
.nav-toggle[aria-expanded="true"] {
    background-color: rgba(255, 255, 255, 0.12);
    border-color: #fff;
}

.nav-cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px;
    border-radius: 999px;
    background: var(--primary-color);
    color: var(--on-primary) !important;
    font-family: 'Poppins', sans-serif;
    font-size: 0.85em;
    font-weight: 600;
    letter-spacing: 0.4px;
    text-transform: uppercase;
    border: 2px solid transparent;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s ease;
}

.nav-cv-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(11, 94, 215, 0.45);
    color: var(--on-primary) !important;
}

.nav-links {
    flex-grow: 1;
    text-align: center;
}

.nav-links a {
    color: #fff;
    margin: 0 20px;
    font-weight: 400;
    font-size: 0.95em;
    white-space: nowrap;
    position: relative;
}

.nav-links a::after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    display: block;
    margin-top: 5px;
    right: 0;
    background: var(--primary-color);
    transition: width 0.3s ease;
}

.nav-links a:hover::after {
    width: 100%;
    left: 0;
    background: var(--accent-color);
}

/* --- BOTONES DE ACCIÓN EN NAVBAR --- */
.nav-actions {
    display: flex;
    align-items: center;
    gap: 15px;
}

.theme-btn {
    background: none;
    border: 2px solid #fff;
    color: #fff;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 1.2em;
    display: flex;
    justify-content: center;
    align-items: center;
    transition: all 0.3s ease;
}

.theme-btn:hover {
    background-color: #fff;
    color: var(--nav-bg);
}

.lang-switcher {
    position: relative;
}

.lang-btn {
    background: none;
    border: 2px solid #fff;
    color: #fff;
    padding: 8px 15px;
    border-radius: 20px;
    cursor: pointer;
    font-family: 'Poppins', sans-serif;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 8px;
    transition: background-color 0.3s ease;
}

.lang-btn:hover {
    background-color: rgba(255, 255, 255, 0.1);
}

.lang-dropdown {
    display: none;
    position: absolute;
    top: 120%;
    right: 0;
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-dark);
    overflow: hidden;
    z-index: 1001;
}

.lang-dropdown.show {
    display: block;
}

.lang-dropdown a {
    display: block;
    padding: 12px 20px;
    color: var(--heading-color);
    white-space: nowrap;
}

.lang-dropdown a:hover {
    background-color: var(--bg-light);
    color: var(--primary-color);
}

/* --- SECCIÓN HERO --- */
.hero-section {
    min-height: 100vh;
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--primary-color) 100%);
    display: flex;
    justify-content: center;
    align-items: center;
    text-align: center;
    color: #fff;
    position: relative;
    overflow: hidden;
    transition: background 0.3s ease;
}

body[data-theme="dark"] .hero-section {
    background: linear-gradient(135deg, #12121d 0%, #1c1c27 100%);
}

.hero-content {
    max-width: 800px;
    padding: 40px;
    z-index: 1;
    animation: fadeInUp 1.2s ease-out;
}

.hero-pic {
    width: 200px;
    height: 200px;
    border-radius: 50%;
    border: 6px solid #fff;
    object-fit: cover;
    margin-bottom: 20px;
    box-shadow: var(--shadow-dark);
    animation: zoomIn 1s ease-out;
}

.hero-section h1 {
    font-size: 4em;
    margin-bottom: 10px;
    color: #fff;
    text-shadow: 2px 2px 4px rgba(0,0,0,0.3);
}

.hero-section .tagline {
    font-size: 1.5em;
    font-weight: 300;
    opacity: 0.9;
    margin-bottom: 40px;
}

.hero-actions .btn {
    margin: 0 15px;
}

/* --- BOTONES --- */
.btn {
    display: inline-block;
    padding: 12px 30px;
    border-radius: 50px;
    font-weight: 600;
    text-transform: uppercase;
    transition: all 0.3s ease;
    border: 2px solid transparent;
}

.primary-btn {
    background-color: var(--primary-color);
    color: var(--on-primary);
    border-color: var(--primary-color);
}

.primary-btn:hover {
    background-color: transparent;
    color: var(--primary-color);
    border-color: var(--primary-color);
}

.secondary-btn {
    background-color: transparent;
    color: #fff;
    border-color: #fff;
}

.secondary-btn:hover {
    background-color: #fff;
    color: var(--primary-color);
}

/* --- SECCIONES GENERALES --- */
.section-container {
    padding: 80px 40px;
    max-width: 1200px;
    margin: 0 auto;
    text-align: center;
    position: relative;
    overflow: hidden;
    transition: background-color 0.3s ease;
}

.bg-light {
    background-color: var(--bg-light);
}

.section-title {
    font-size: 3em;
    margin-bottom: 60px;
    color: var(--heading-color);
    position: relative;
    display: inline-block;
    padding-bottom: 15px;
}

.section-title::after {
    content: '';
    position: absolute;
    left: 50%;
    bottom: 0;
    transform: translateX(-50%);
    width: 80px;
    height: 4px;
    background-color: var(--primary-color);
    border-radius: 2px;
}

/* --- SOBRE MÍ --- */
.about-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 30px;
    max-width: 800px;
    margin: 0 auto;
    text-align: left;
}

.about-content p {
    font-size: 1.1em;
    line-height: 1.8;
}

.personal-details {
    margin-top: 30px;
    width: 100%;
}

.personal-details h3 {
    font-size: 1.6em;
    color: var(--primary-color);
    margin-bottom: 20px;
}

.personal-details ul {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 15px;
}

.personal-details li {
    font-size: 1.1em;
    display: flex;
    align-items: center;
}

.personal-details li i {
    color: var(--primary-color);
    margin-right: 15px;
    font-size: 1.3em;
}

/* --- HABILIDADES --- */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 30px;
    text-align: left;
    max-width: 1200px;
    margin: 0 auto;
}

@media (min-width: 577px) {
    .skills-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (min-width: 980px) {
    .skills-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

@media (min-width: 1280px) {
    .skills-grid { max-width: 1320px; }
    .skill-category { padding: 28px 24px; }
    .skill-category h3 { font-size: clamp(2rem, 1.6vw, 3rem); }
    .skill-category ul { gap: 18px 16px; }
}

.skill-category {
    background-color: var(--bg-main);
    padding: 30px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background-color 0.3s ease;
    display: flex;
    flex-direction: column;
    min-height: 100%;
}

.skill-category:hover {
    transform: translateY(-10px);
    box-shadow: var(--shadow-dark);
}

.skill-category h3 {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-bottom: 25px;
    border-bottom: 2px solid var(--primary-color);
    padding-bottom: 10px;
}

.skill-category ul {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 14px;
    align-items: stretch;
}

.skill-category li {
    font-size: clamp(0.98rem, 1vw, 1.2rem);
    display: flex;
    align-items: center;
    gap: 12px;
    min-height: 52px;
    line-height: 1.35;
    transition: color 0.3s ease;
    width: 100%;
    word-break: break-word;
}

.skill-category li:hover {
    color: var(--primary-color);
}

.skill-category li i {
    flex-shrink: 0;
    width: 1.5em;
    text-align: center;
    font-size: 1.2em;
    transition: color 0.3s ease;
}

.skill-category li:hover i {
    color: var(--primary-color);
}

/* Barras de Progreso de Idiomas */
.language-item {
    margin-bottom: 20px;
}

.language-item p {
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.progress-bar-container {
    background-color: var(--border-color);
    height: 10px;
    border-radius: 5px;
    overflow: hidden;
    position: relative;
}

.progress-bar-fill {
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    height: 100%;
    border-radius: 5px;
    width: 0%; /* Inicialmente 0% para animación */
    transition: width 1s ease-out;
    position: relative;
}

.progress-bar-fill::after {
    content: attr(data-level);
    position: absolute;
    right: 5px;
    top: 50%;
    transform: translateY(-50%);
    color: white;
    font-size: 0.8em;
    font-weight: 600;
    opacity: 0;
    transition: opacity 0.5s ease;
}

.progress-bar-fill.animated::after {
    opacity: 1;
}

/* --- EXPERIENCIA (TIMELINE) --- */
.timeline {
    position: relative;
    max-width: 1000px;
    margin: 0 auto;
    padding-bottom: 50px;
}

.timeline::after {
    content: '';
    position: absolute;
    width: 4px;
    background-color: var(--primary-color);
    top: 0;
    bottom: 0;
    left: 50%;
    margin-left: -2px;
}

.timeline-item {
    padding: 10px 0;
    position: relative;
    background-color: inherit;
    width: 50%;
}

.timeline-item::after {
    content: '';
    position: absolute;
    width: 25px;
    height: 25px;
    right: -17px;
    background-color: var(--bg-main);
    border: 4px solid var(--accent-color);
    top: 15px;
    border-radius: 50%;
    z-index: 1;
    transition: background-color 0.3s ease;
}

.timeline-item.left {
    left: 0;
    padding-right: 90px;
}

.timeline-item.right {
    left: 50%;
    padding-left: 90px;
}

.timeline-item.right::after {
    left: -17px;
}

.timeline-content {
    padding: 20px 30px;
    background-color: var(--bg-main);
    position: relative;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
}

.timeline-content:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-dark);
}

.timeline-content h3 {
    font-size: 1.4em;
    color: var(--primary-color);
    margin-bottom: 5px;
}

.timeline-content .description {
    font-size: 0.95em;
}

/* --- FORMACIÓN & CURSOS --- */
.education-grid, .courses-list {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 30px;
    max-width: 1000px;
    margin: 0 auto;
    text-align: left;
}

.education-item, .course-item {
    background-color: var(--bg-main);
    padding: 25px;
    border-radius: var(--border-radius);
    box-shadow: var(--shadow-light);
    transition: all 0.3s ease;
}

.education-item:hover, .course-item:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-dark);
}

.education-item h3, .course-item h3 {
    font-size: 1.3em;
    color: var(--primary-color);
    margin-bottom: 5px;
    display: flex;
    align-items: center;
    gap: 12px;
    flex-wrap: wrap;
    word-break: break-word;
    overflow-wrap: anywhere;
}

.course-item h3 i {
    font-size: 0.9em;
    min-width: 25px;
    text-align: center;
}

.education-item .date, .course-item .details {
    font-size: 0.9em;
}

.badge-new {
    background: linear-gradient(135deg, #ff416c, #ff4b2b);
    color: white;
    padding: 2px 10px;
    border-radius: 12px;
    font-size: 0.65em;
    font-weight: 700;
    text-transform: uppercase;
    box-shadow: 0 2px 8px rgba(255, 65, 108, 0.4);
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 3px;
}

/* --- CONTACTO --- */
.contact-info-grid {
    display: flex;
    justify-content: center;
    gap: 50px;
    flex-wrap: wrap;
    margin-bottom: 40px;
}

.contact-item {
    text-align: center;
    transition: transform 0.3s ease, color 0.3s ease;
}

.contact-item:hover {
    transform: translateY(-5px);
    color: var(--primary-color);
}

.contact-item i {
    color: var(--primary-color);
    margin-bottom: 15px;
    transition: color 0.3s ease;
}

.contact-item:hover i {
    color: var(--accent-color);
}

.contact-item p {
    font-size: 1.1em;
    font-weight: 600;
}

.footer-note {
    font-size: 1.1em;
    font-style: italic;
}

/* --- FOOTER --- */
footer {
    background-color: var(--nav-bg);
    color: #fff;
    text-align: center;
    padding: 25px 0;
    font-size: 0.9em;
    transition: background-color 0.3s ease;
}

/* --- ANIMACIONES Y RESPONSIVE --- */
@keyframes fadeInDown { from { opacity: 0; transform: translateY(-20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes fadeInUp { from { opacity: 0; transform: translateY(40px); } to { opacity: 1; transform: translateY(0); } }
@keyframes zoomIn { from { opacity: 0; transform: scale(0.8); } to { opacity: 1; transform: scale(1); } }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
@keyframes pulse-glow { 0%, 100% { box-shadow: 0 0 8px rgba(0,123,255,0.4); } 50% { box-shadow: 0 0 20px rgba(0,123,255,0.9); } }

.animate-on-scroll { opacity: 0; transform: translateY(50px); transition: opacity 0.8s ease-out, transform 0.8s ease-out; }
.animate-on-scroll.is-visible { opacity: 1; transform: translateY(0); }

/* --- BARRA DE PROGRESO DE LECTURA --- */
#read-progress {
    position: fixed;
    top: 0; left: 0;
    height: 3px;
    width: 0%;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    z-index: 9999;
    transition: width 0.1s linear;
}

/* --- PARTÍCULAS (Canvas hero) --- */
#particles-canvas {
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 100%;
    z-index: 0;
    pointer-events: none;
}

/* --- TYPING CURSOR --- */
.typing-cursor {
    display: inline-block;
    animation: blink 0.8s infinite;
    color: rgba(255,255,255,0.8);
    font-weight: 300;
    margin-left: 2px;
}

/* --- BOTÓN DESCARGAR CV --- */
.cv-btn {
    background: linear-gradient(135deg, #28a745, #20c997);
    color: #fff !important;
    border-color: transparent;
}
.cv-btn:hover {
    background: linear-gradient(135deg, #20c997, #28a745);
    color: #fff !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(40,167,69,0.5);
}

/* --- PROYECTOS GITHUB --- */
.projects-subtitle {
    font-size: 1.1em;
    color: var(--text-color);
    margin-bottom: 40px;
    margin-top: -40px;
}

.subsection-title {
    font-size: 1.8em;
    color: var(--primary-color);
    margin-top: 50px;
    margin-bottom: 25px;
    text-align: center;
    font-family: 'Montserrat', sans-serif;
    font-weight: 700;
}

.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 25px;
    max-width: 1100px;
    margin: 0 auto 40px;
    text-align: left;
}

.project-card {
    background-color: var(--bg-main);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    display: flex;
    flex-direction: column;
    gap: 12px;
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    position: relative;
    overflow: hidden;
}

.project-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0;
    width: 100%; height: 3px;
    background: linear-gradient(to right, var(--primary-color), var(--accent-color));
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.3s ease;
}

.project-card:hover::before { transform: scaleX(1); }

.project-card:hover {
    transform: translateY(-8px);
    box-shadow: var(--shadow-dark);
    border-color: var(--primary-color);
}

.project-card-header { display: flex; align-items: center; gap: 10px; }
.project-card-header i { color: var(--text-color); font-size: 1.3em; }

.project-card h3 {
    font-size: 1.05em;
    color: var(--primary-color);
    margin: 0;
    word-break: break-all;
}

.project-card p { font-size: 0.9em; color: var(--text-color); flex-grow: 1; line-height: 1.6; }

.project-card-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }

.project-lang {
    background-color: var(--bg-light);
    color: var(--primary-color);
    padding: 3px 10px;
    border-radius: 20px;
    font-size: 0.78em;
    font-weight: 600;
    border: 1px solid var(--border-color);
}

.project-stars { font-size: 0.85em; color: var(--text-color); }

.project-card-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--primary-color);
    font-weight: 600;
    font-size: 0.9em;
    margin-top: 5px;
    transition: gap 0.2s ease, color 0.2s ease;
}
.project-card-link:hover { gap: 12px; color: var(--accent-color); }

.projects-loading {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px;
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 15px;
}

.projects-footer { text-align: center; margin-top: 10px; }

.github-all-btn { display: inline-flex; align-items: center; gap: 10px; }

@media (max-width: 992px) {
    .nav-links { display: none; }
    .nav-brand { flex-grow: 1; text-align: left; }
    .hero-section h1 { font-size: 3em; }
    .section-title { font-size: 2.5em; }
    .timeline::after { left: 20px; }
    .timeline-item { width: 100%; padding-left: 50px; padding-right: 10px; }
    .timeline-item.left { padding-right: 10px; }
    .timeline-item::after { left: 13px; }
    .timeline-item.right { left: 0%; padding-left: 50px; }
    .timeline-content { text-align: left; }
    .timeline-content h3 { font-size: 1.1em; }
    .education-grid, .courses-list { grid-template-columns: 1fr; }
}

@media (max-width: 480px) {
    .timeline-item { padding-left: 38px; padding-right: 8px; }
    .timeline-item.left { padding-right: 8px; }
    .timeline::after { left: 14px; }
    .timeline-item::after { left: 7px; width: 20px; height: 20px; }
    .timeline-content { padding: 16px 18px; }
    .timeline-content h3 { font-size: 1em; }
    .section-container { padding: 50px 14px; }
}

@media (max-width: 576px) {
    .hero-section h1 { font-size: 2.2em; }
    .hero-actions { flex-direction: column; align-items: center; }
    .btn { width: 80%; margin: 10px auto; }
    .section-container { padding: 60px 20px; }
    .section-title { font-size: 2em; }
    .personal-details ul { grid-template-columns: 1fr; }
    .projects-grid { grid-template-columns: 1fr; }
}
/* =========================================================
   MEJORAS 2026: navegación móvil, CV, tarjetas y a11y
   ========================================================= */

/* --- Accesibilidad base --- */
.skip-link {
    position: fixed;
    top: 10px;
    left: 10px;
    z-index: 10000;
    padding: 10px 18px;
    border-radius: 8px;
    background: var(--primary-color);
    color: var(--on-primary);
    font-weight: 600;
    transform: translateY(-160%);
    transition: transform 0.2s ease;
}

.skip-link:focus {
    transform: translateY(0);
    color: var(--on-primary);
}

a:focus-visible,
button:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
    border-radius: 4px;
}

@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    *, *::before, *::after {
        animation-duration: 0.001ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.001ms !important;
    }
}

html { scroll-padding-top: 90px; }
section[id] { scroll-margin-top: 90px; }

/* --- Hero: badge, rol y CTA --- */
.hero-content { max-width: 900px; }

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 9px;
    padding: 7px 16px;
    margin-bottom: 22px;
    border-radius: 999px;
    background: rgba(255, 255, 255, 0.12);
    border: 1px solid rgba(255, 255, 255, 0.3);
    backdrop-filter: blur(4px);
    color: #fff;
    font-size: 0.85em;
    font-weight: 500;
    letter-spacing: 0.3px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #51cf66;
    box-shadow: 0 0 0 0 rgba(81, 207, 102, 0.7);
    animation: pulse-glow 2s infinite;
}

.hero-role {
    font-size: 1.05em;
    font-weight: 500;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    opacity: 0.85;
    margin-bottom: 14px;
}

.hero-contact {
    margin-top: 26px;
    font-size: 0.95em;
}

.hero-contact a {
    color: #fff;
    border-bottom: 1px solid rgba(255, 255, 255, 0.45);
    padding-bottom: 2px;
}

.hero-contact a:hover { color: #fff; border-color: #fff; }

.hero-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 14px;
    justify-content: center;
}

.hero-actions .btn { margin: 0; }

/* --- Botón CV (contraste AA) --- */
.cv-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    background: linear-gradient(135deg, #198754, #146c43);
    color: #ffffff !important;
    border-color: transparent;
}

.cv-btn:hover {
    background: linear-gradient(135deg, #20c997, #157347);
    color: #06281c !important;
    transform: translateY(-3px);
    box-shadow: 0 8px 20px rgba(20, 108, 67, 0.45);
}

/* --- Tarjetas de proyecto con imagen --- */
.project-media {
    position: relative;
    margin: -25px -25px 16px;
    aspect-ratio: 16 / 9;
    overflow: hidden;
    background: linear-gradient(135deg, #1b263b 0%, #0b5ed7 100%);
    isolation: isolate;
}

.project-media-bg {
    position: absolute;
    inset: -24px;
    z-index: 0;
    width: calc(100% + 48px);
    height: calc(100% + 48px);
    object-fit: cover;
    filter: blur(22px) brightness(0.5) saturate(1.15);
    transform: scale(1.12);
}

.project-media-main {
    position: absolute;
    inset: 0;
    z-index: 2;
    width: 100%;
    height: 100%;
    object-fit: contain;
    display: block;
}

.project-media--empty { background: linear-gradient(135deg, #1b263b 0%, #0b5ed7 100%); }

.project-media-main.is-missing { display: none; }

.project-media-fallback {
    position: absolute;
    inset: 0;
    z-index: 1;
    display: grid;
    place-items: center;
    color: rgba(255, 255, 255, 0.85);
    font-size: 2.4em;
    opacity: 0.9;
}

/* --- Reconocimiento --- */
.recommendation-card {
    display: flex;
    gap: 22px;
    align-items: flex-start;
    max-width: 800px;
    margin: 0 auto;
    padding: 34px;
    text-align: left;
    border-radius: var(--border-radius);
    background: linear-gradient(135deg, #1b263b 0%, #23395d 100%);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: var(--shadow-dark);
    color: #e9ecef;
}

.recommendation-icon {
    font-size: 2em;
    color: #ffd43b;
    flex-shrink: 0;
    margin-top: 4px;
}

.recommendation-body p {
    font-size: 1.02em;
    line-height: 1.75;
}

.recommendation-author {
    margin-top: 16px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.recommendation-author strong { color: #fff; font-size: 1.02em; }
.recommendation-author span { font-size: 0.88em; color: #adb5bd; }

/* --- Contacto --- */
.contact-card {
    max-width: 620px;
    margin: 0 auto 34px;
    padding: 30px;
    border-radius: var(--border-radius);
    background: var(--bg-main);
    box-shadow: var(--shadow-light);
}

.contact-label {
    text-transform: uppercase;
    letter-spacing: 0.16em;
    font-size: 0.78em;
    font-weight: 600;
    color: var(--text-color);
    margin-bottom: 8px;
}

.contact-email-row {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 10px 14px;
    margin-bottom: 4px;
}

.contact-email {
    display: inline-block;
    font-size: 1.25em;
    font-weight: 600;
    color: var(--primary-color);
    word-break: break-all;
    overflow-wrap: anywhere;
    max-width: 100%;
}

.copy-btn,
.contact-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 9px 16px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-light);
    color: var(--heading-color);
    font-family: 'Poppins', sans-serif;
    font-size: 0.85em;
    font-weight: 500;
    cursor: pointer;
    transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

.copy-btn:hover,
.contact-social-btn:hover {
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.copy-btn.is-copied {
    background: #d1e7dd;
    border-color: #198754;
    color: #0f5132;
}

.contact-socials-title {
    margin-bottom: 18px;
    font-size: 0.9em;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    color: var(--text-color);
}

.contact-socials {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 12px;
}

.contact-socials a,
.contact-socials .contact-social-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 20px;
    border-radius: 999px;
    border: 1px solid var(--border-color);
    background: var(--bg-main);
    color: var(--heading-color);
    font-size: 0.92em;
    font-weight: 500;
    transition: transform 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}

.contact-socials a:hover,
.contact-socials .contact-social-btn:hover {
    transform: translateY(-3px);
    border-color: var(--primary-color);
    color: var(--primary-color);
    box-shadow: var(--shadow-light);
}

.contact-socials i { font-size: 1.15em; }

/* --- Compartir / QR --- */
.share-card {
    display: flex;
    align-items: center;
    gap: 40px;
    max-width: 760px;
    margin: 0 auto;
    padding: 32px;
    text-align: left;
    background: var(--bg-light);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
}

.share-qr {
    flex-shrink: 0;
    padding: 14px;
    background: #fff;
    border-radius: 12px;
    box-shadow: var(--shadow-light);
    line-height: 0;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.share-qr:hover {
    transform: translateY(-3px);
    box-shadow: var(--shadow-dark);
}

.share-qr img {
    display: block;
    width: 200px;
    height: 200px;
}

.share-body h3 {
    font-size: 1.5em;
    color: var(--primary-color);
    margin-bottom: 10px;
}

.share-body p { font-size: 0.98em; }

.share-url {
    margin: 14px 0 18px;
    font-family: 'Montserrat', sans-serif;
    font-weight: 600;
    color: var(--heading-color);
    word-break: break-all;
}

.share-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
}

@media (max-width: 700px) {
    .share-card {
        flex-direction: column;
        text-align: center;
        gap: 24px;
        padding: 24px;
    }

    .share-actions { justify-content: center; }
}

/* --- Footer --- */
.footer-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.footer-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 20px;
    font-size: 0.9em;
}

footer .footer-links a { color: rgba(255, 255, 255, 0.75); }
footer .footer-links a:hover { color: #fff; }

/* --- Navegación responsive con menú hamburguesa --- */
@media (max-width: 1250px) {
    .navbar {
        flex-wrap: wrap;
        padding: 12px 20px;
    }

    .nav-brand { order: 1; flex-grow: 1; font-size: 1.5em; }
    .nav-actions { order: 3; gap: 10px; }
    .nav-toggle { display: flex; order: 4; margin-left: 8px; }

    .nav-links {
        order: 5;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        display: none;
        flex-direction: column;
        align-items: stretch;
        gap: 0;
        padding: 8px 16px 16px;
        background-color: var(--nav-bg);
        border-top: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: var(--shadow-dark);
        max-height: calc(100vh - 72px);
        overflow-y: auto;
    }

    .nav-links.is-open { display: flex; }

    .nav-links a {
        margin: 0;
        padding: 14px 10px;
        font-size: 1em;
        border-bottom: 1px solid rgba(255, 255, 255, 0.07);
    }

    .nav-links a::after { display: none; }
    .nav-links a:last-child { border-bottom: 0; }
}

@media (min-width: 1251px) {
    .navbar { padding: 12px 20px; }
    .nav-brand { font-size: 1.4em; }
    .nav-links a { margin: 0 7px; font-size: 0.8em; white-space: nowrap; }
    .nav-cv-btn { padding: 7px 13px; font-size: 0.8em; }
    .nav-actions { gap: 12px; }
    .skills-grid { gap: 24px; }
    .skill-category { padding: 24px; }
}

@media (max-width: 576px) {
    .navbar { padding: 10px 14px; }
    .nav-brand { font-size: 1.2em; gap: 8px; }
    .nav-brand-text { display: none; }
    .nav-logo { height: 36px; width: auto; }
    .nav-actions { gap: 8px; }
    .nav-toggle { width: 40px; height: 40px; margin-left: 6px; }
    .nav-cv-btn { padding: 0; width: 40px; height: 40px; justify-content: center; }
    .nav-cv-btn span { display: none; }
    .nav-cv-btn i { font-size: 1em; }
    .theme-btn { width: 36px; height: 36px; font-size: 1em; }
    .lang-btn { padding: 6px 10px; font-size: 0.9em; gap: 5px; }
    .hero-role { font-size: 0.85em; letter-spacing: 0.1em; }
    .skills-grid { gap: 20px; }
    .skill-category { padding: 22px 18px; }
    .skill-category h3 { font-size: clamp(1.5rem, 6vw, 2rem); }
    .skill-category ul { gap: 14px 10px; }
    .skill-category li { min-height: 46px; }
    .project-media { margin: -25px -25px 14px; }
    .recommendation-card { flex-direction: column; padding: 26px; gap: 14px; }
    .contact-card { padding: 22px; }
    .contact-email { font-size: 1.05em; }
    .contact-socials a,
    .contact-socials .contact-social-btn { width: 100%; justify-content: center; }
}

/* --- Impresión --- */
@media print {
    .navbar,
    .skip-link,
    #particles-canvas,
    #read-progress,
    .hero-actions {
        display: none !important;
    }

    section { break-inside: avoid; }
}
