/* ========== Variables: modo oscuro (default) ========== */
:root,
[data-theme="dark"] {
    --bg-deep: #0b0d11;
    --bg-elevated: rgba(21, 24, 30, 0.7);
    --primary: #e3a857;
    --primary-dim: rgba(227, 168, 87, 0.32);
    --secondary: #6f93b3;
    --secondary-dim: rgba(111, 147, 179, 0.4);
    --text-primary: #f2ede3;
    --text-secondary: #a8a196;
    --font-display: "Space Grotesk", system-ui, sans-serif;
    --font-body: "Inter", system-ui, sans-serif;
    --glow-strong: 0 0 24px rgba(227, 168, 87, 0.4), 0 0 48px rgba(111, 147, 179, 0.2);
    --glow-border: 0 0 12px rgba(227, 168, 87, 0.32);
    --glass-bg: rgba(255, 255, 255, 0.035);
    --glass-border: rgba(227, 168, 87, 0.32);
    --nav-bg: rgba(11, 13, 17, 0.85);
}

/* ========== Modo día (premium claro) ========== */
[data-theme="light"] {
    --bg-deep: #f6f3ee;
    --bg-elevated: #ffffff;
    --primary: #b5762b;
    --primary-dim: rgba(181, 118, 43, 0.28);
    --secondary: #3f6a86;
    --secondary-dim: rgba(63, 106, 134, 0.28);
    --text-primary: #221d15;
    --text-secondary: #5c554a;
    --glow-strong: 0 12px 32px rgba(34, 29, 21, 0.1), 0 2px 8px rgba(34, 29, 21, 0.06);
    --glow-border: 0 4px 16px rgba(34, 29, 21, 0.08);
    --glass-bg: #ffffff;
    --glass-border: rgba(34, 29, 21, 0.1);
    --nav-bg: rgba(246, 243, 238, 0.92);
}

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

html {
    scroll-padding-top: 5.5rem;
    scroll-behavior: smooth;
}

body {
    font-family: var(--font-body);
    background: var(--bg-deep);
    color: var(--text-primary);
    line-height: 1.65;
    overflow-x: hidden;
    transition: background 0.5s ease, color 0.35s ease;
}

[data-theme="light"] body {
    background-color: var(--bg-deep);
    background-image:
        radial-gradient(circle at 15% 8%, rgba(181, 118, 43, 0.08), transparent 45%),
        radial-gradient(circle at 85% 92%, rgba(63, 106, 134, 0.08), transparent 45%);
    background-attachment: fixed;
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* ========== Partículas (canvas) ========== */
.particles-canvas {
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    z-index: 0;
    pointer-events: none;
}

[data-theme="light"] .particles-canvas {
    opacity: 0;
    visibility: hidden;
}

/* ========== Toggle tema ========== */
.lang-toggle {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    right: calc(max(1.4rem, env(safe-area-inset-right)) + 62px);
    z-index: 1100;
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    border: 1.5px solid var(--text-secondary);
    border-radius: 999px;
    background: var(--bg-elevated);
    backdrop-filter: blur(8px);
    cursor: pointer;
    font-family: 'Space Grotesk', sans-serif;
    font-size: 0.72rem;
    font-weight: 600;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
    transition: border-color 0.25s, background 0.25s, color 0.25s, transform 0.2s;
}
.lang-toggle:hover {
    border-color: var(--text-primary);
    color: var(--text-primary);
    transform: scale(1.04);
}
.lang-sep { opacity: 0.3; }
.lang-opt { transition: color 0.25s; }
.lang-opt--active { color: var(--text-primary); font-weight: 700; }

.theme-toggle {
    position: fixed;
    top: max(1rem, env(safe-area-inset-top));
    right: max(1.4rem, env(safe-area-inset-right));
    z-index: 1100;
    width: 52px;
    height: 28px;
    border: none;
    border-radius: 999px;
    cursor: pointer;
    padding: 0;
    background: transparent;
    transition: transform 0.25s ease;
}

.theme-toggle:hover {
    transform: scale(1.06);
}

.theme-toggle:active {
    transform: scale(0.96);
}

.theme-toggle__track {
    position: absolute;
    inset: 0;
    border-radius: 999px;
    background: linear-gradient(135deg, rgba(227, 168, 87, 0.25), rgba(111, 147, 179, 0.3));
    border: 1px solid var(--primary);
    box-shadow: var(--glow-border);
    transition: background 0.45s ease, border-color 0.45s ease;
}

[data-theme="light"] .theme-toggle__track {
    background: linear-gradient(135deg, rgba(181, 118, 43, 0.22), rgba(63, 106, 134, 0.22));
}

.theme-toggle__thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--primary);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform 0.45s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.35s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

[data-theme="light"] .theme-toggle__thumb {
    transform: translateX(24px);
}

.theme-toggle__icon {
    font-size: 10px;
    color: #0a0a0f;
    position: absolute;
    transition: opacity 0.25s ease, transform 0.45s ease;
}

.theme-toggle__icon--dark {
    opacity: 1;
}

.theme-toggle__icon--light {
    opacity: 0;
}

[data-theme="light"] .theme-toggle__icon--dark {
    opacity: 0;
    transform: rotate(90deg);
}

[data-theme="light"] .theme-toggle__icon--light {
    opacity: 1;
    transform: rotate(0);
}

/* ========== Layout ========== */
.container {
    position: relative;
    z-index: 1;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    padding-left: max(20px, env(safe-area-inset-left));
    padding-right: max(20px, env(safe-area-inset-right));
}

/* Indicador oculto en desktop */
.section-indicator { display: none; }

/* ========== Navbar ========== */
.navbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    padding: 14px 0;
    padding-top: max(14px, env(safe-area-inset-top));
    background: var(--nav-bg);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--primary-dim);
    transition: background 0.4s ease, border-color 0.4s ease;
}

[data-theme="light"] .navbar {
    box-shadow: 0 1px 0 rgba(34, 29, 21, 0.06);
}

/* Hamburguesa — oculto en desktop */
.nav-hamburger {
    display: none;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
    margin-left: auto;
    margin-right: 16px;
    z-index: 1001;
}

.nav-hamburger span {
    display: block;
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    border-radius: 2px;
    transition: transform 0.3s, opacity 0.3s;
}

/* Animación X al abrir */
.nav-hamburger.is-open span:nth-child(1) { transform: translateY(7px) rotate(45deg); }
.nav-hamburger.is-open span:nth-child(2) { opacity: 0; }
.nav-hamburger.is-open span:nth-child(3) { transform: translateY(-7px) rotate(-45deg); }

.nav-links {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    gap: 8px 20px;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 16px;
    /* Reserva el espacio del selector de idioma + toggle de tema (fijos, arriba a la derecha)
       para que el último link de nav nunca quede tapado detrás de ellos. */
    padding-right: calc(16px + 190px + env(safe-area-inset-right, 0px));
}

@media (max-width: 768px) {
    .navbar {
        display: flex;
        align-items: center;
        padding: 12px 0;
    }

    .nav-hamburger {
        display: flex;
        margin-left: 16px;
        margin-right: auto;
    }

    /* Backdrop oscuro detrás del drawer */
    .nav-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0,0,0,0.5);
        z-index: 999;
    }
    .nav-backdrop.is-open { display: block; }

    /* Drawer lateral desde la izquierda */
    .nav-links {
        position: fixed;
        top: 0;
        left: 0;
        width: 72%;
        max-width: 260px;
        height: 100vh;
        background: var(--bg-deep);
        flex-direction: column;
        align-items: flex-start;
        justify-content: center;
        gap: 6px;
        z-index: 1000;
        padding: 5rem 1.5rem 2rem;
        transform: translateX(-100%);
        transition: transform 0.3s ease;
        overflow-y: auto;
    }

    [data-theme="light"] .nav-links {
        background: var(--bg-elevated);
        box-shadow: 4px 0 20px rgba(34, 29, 21, 0.12);
    }

    .nav-links.is-open {
        transform: translateX(0);
        display: flex;
    }

    .nav-links .nav-link {
        font-size: 0.82rem;
        padding: 9px 16px;
        width: 100%;
        text-align: left;
        color: var(--text-primary);
        border-radius: 6px;
        border: none;
        background: transparent;
    }

    .nav-links .nav-link:hover,
    .nav-links .nav-link.active {
        background: var(--primary-dim);
        color: var(--primary);
    }

    /* Título de sección sticky en mobile */
    .section-indicator {
        display: block;
        position: fixed;
        bottom: 16px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.7);
        color: var(--primary);
        font-size: 0.6rem;
        font-weight: 700;
        padding: 5px 14px;
        border-radius: 999px;
        z-index: 998;
        letter-spacing: 1px;
        text-transform: uppercase;
        backdrop-filter: blur(8px);
        pointer-events: none;
        transition: opacity 0.3s;
    }

    [data-theme="light"] .section-indicator {
        background: rgba(255,255,255,0.85);
        box-shadow: 0 2px 12px rgba(34, 29, 21, 0.12);
    }
}

.nav-link {
    font-family: var(--font-display);
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-decoration: none;
    padding: 10px 18px;
    border-radius: 999px;
    border: 1px solid transparent;
    transition: color 0.25s ease, background 0.25s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.nav-link:hover,
.nav-link.active {
    color: var(--text-primary);
    background: var(--primary-dim);
    border-color: var(--primary);
}

[data-theme="dark"] .nav-link:hover,
[data-theme="dark"] .nav-link.active {
    text-shadow: 0 0 12px var(--primary-dim);
}

/* ========== Hero ========== */
.hero {
    position: relative;
    z-index: 1;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    text-align: center;
    padding: 6rem 0 4rem;
    padding-top: max(6rem, calc(env(safe-area-inset-top) + 5rem));
}

.hero__inner {
    width: 100%;
}

.profile-image {
    width: 168px;
    height: 168px;
    margin: 0 auto 1.75rem;
    border-radius: 50%;
    border: 3px solid var(--primary);
    box-shadow: var(--glow-strong);
    overflow: hidden;
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

.profile-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.profile-image:hover {
    transform: scale(1.04);
}

.availability-badge {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 6px 14px;
    margin-bottom: 1.1rem;
    border-radius: 999px;
    background: var(--glass-bg);
    border: 1px solid var(--glass-border);
    font-family: var(--font-display);
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: var(--text-primary);
}

.availability-badge__dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: #4ade80;
    box-shadow: 0 0 8px #4ade80;
    animation: availability-pulse 2s ease-in-out infinite;
}

@keyframes availability-pulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.55; transform: scale(0.85); }
}

.hero-heading {
    font-family: var(--font-display);
    font-size: clamp(2rem, 6vw, 3.25rem);
    font-weight: 700;
    line-height: 1.15;
    margin-bottom: 0.75rem;
    min-height: 1.2em;
    color: var(--text-primary);
}

[data-theme="dark"] .hero-heading {
    text-shadow: var(--glow-strong);
}

.typewriter-text {
    color: var(--primary);
}

[data-theme="dark"] .typewriter-text {
    text-shadow: 0 0 20px var(--primary-dim), 0 0 40px var(--secondary-dim);
}

.typewriter-caret {
    display: inline-block;
    width: 3px;
    height: 1em;
    margin-left: 4px;
    background: var(--primary);
    vertical-align: text-bottom;
    animation: caret-blink 0.9s step-end infinite;
}

.typewriter-caret.is-done {
    opacity: 0;
    animation: none;
}

@keyframes caret-blink {
    50% {
        opacity: 0;
    }
}

.hero .subtitle {
    font-size: clamp(1rem, 2.5vw, 1.35rem);
    color: var(--text-secondary);
    margin-bottom: 1.75rem;
    font-weight: 500;
}

[data-theme="light"] .hero .subtitle {
    font-weight: 700;
    color: var(--text-primary);
}

.contact-info {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: center;
    gap: 0.75rem 1.25rem;
    margin: 1.5rem 0;
}

.contact-info a {
    color: var(--secondary);
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: color 0.2s ease, text-shadow 0.2s ease;
    word-break: break-word;
    max-width: 100%;
}

[data-theme="light"] .contact-info a {
    font-weight: 700;
}

.contact-info a:hover {
    color: var(--primary);
}

[data-theme="dark"] .contact-info a:hover {
    text-shadow: 0 0 12px var(--primary-dim);
}

.social-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.75rem;
    margin-top: 1.5rem;
}

.social-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 12px 22px;
    font-family: var(--font-body);
    font-weight: 600;
    font-size: 0.9rem;
    color: var(--text-primary);
    text-decoration: none;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    box-shadow: var(--glow-border);
    transition: transform 0.25s ease, box-shadow 0.25s ease, background 0.25s ease;
}

.social-btn:hover {
    transform: translateY(-3px);
    box-shadow: 0 0 20px var(--primary-dim);
    border-color: var(--primary);
}

.social-btn i {
    font-size: 1.1rem;
}

.scroll-indicator {
    position: absolute;
    bottom: max(24px, env(safe-area-inset-bottom));
    left: 50%;
    transform: translateX(-50%);
    color: var(--primary);
    font-size: 1.25rem;
    opacity: 0.85;
    animation: float-y 2.5s ease-in-out infinite;
    filter: drop-shadow(0 0 8px var(--primary));
}

@keyframes float-y {

    0%,
    100% {
        transform: translateX(-50%) translateY(0);
    }

    50% {
        transform: translateX(-50%) translateY(-8px);
    }
}

/* ========== Secciones genéricas ========== */
section {
    position: relative;
    z-index: 1;
    padding: 5rem 0;
}

.section-title {
    font-family: var(--font-display);
    font-size: clamp(1.5rem, 4vw, 2.35rem);
    font-weight: 700;
    text-align: center;
    margin-bottom: 2.5rem;
    color: var(--text-primary);
}

[data-theme="dark"] .section-title {
    text-shadow: 0 0 20px var(--primary-dim);
}

.section-title::after {
    content: "";
    display: block;
    width: 72px;
    height: 3px;
    margin: 14px auto 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 2px;
}

[data-theme="dark"] .section-title::after {
    box-shadow: 0 0 12px var(--primary-dim);
}

/* ========== Scroll: estados iniciales ========== */
.section-scroll {
    opacity: 0;
    transition: opacity 0.85s ease, transform 0.85s cubic-bezier(0.22, 1, 0.36, 1);
}

.section-scroll.section-in-view {
    opacity: 1;
}

.section--fade {
    transform: translateY(28px);
}

.section--fade.section-in-view {
    transform: translateY(0);
}

.section--slide-left {
    transform: translateX(-48px);
}

.section--slide-left.section-in-view {
    transform: translateX(0);
}

.section--slide-right {
    transform: translateX(48px);
}

.section--slide-right.section-in-view {
    transform: translateX(0);
}

.section--rise .project-card {
    opacity: 0;
    transform: translateY(56px);
    transition: opacity 0.75s ease, transform 0.75s cubic-bezier(0.22, 1, 0.36, 1);
}

.section--rise.section-in-view .project-card {
    opacity: 1;
    transform: translateY(0);
}

.section--rise.section-in-view .project-card:nth-child(1) {
    transition-delay: 0.05s;
}

.section--rise.section-in-view .project-card:nth-child(2) {
    transition-delay: 0.12s;
}

.section--rise.section-in-view .project-card:nth-child(3) {
    transition-delay: 0.19s;
}

.section--rise.section-in-view .project-card:nth-child(4) {
    transition-delay: 0.26s;
}

.section--rise.section-in-view .project-card:nth-child(5) {
    transition-delay: 0.33s;
}

.section--rise.section-in-view .project-card:nth-child(6) {
    transition-delay: 0.4s;
}

.section--zoom .skill-category {
    opacity: 0;
    transform: scale(0.88);
    transition: opacity 0.65s ease, transform 0.65s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.section--zoom.section-in-view .skill-category {
    opacity: 1;
    transform: scale(1);
}

.section--zoom.section-in-view .skill-category:nth-child(1) {
    transition-delay: 0.04s;
}

.section--zoom.section-in-view .skill-category:nth-child(2) {
    transition-delay: 0.1s;
}

.section--zoom.section-in-view .skill-category:nth-child(3) {
    transition-delay: 0.16s;
}

.section--zoom.section-in-view .skill-category:nth-child(4) {
    transition-delay: 0.22s;
}

.section--zoom.section-in-view .skill-category:nth-child(5) {
    transition-delay: 0.28s;
}

.section--zoom.section-in-view .skill-category:nth-child(6) {
    transition-delay: 0.34s;
}

.section--zoom.section-in-view .skill-category:nth-child(7) {
    transition-delay: 0.4s;
}

.section--zoom.section-in-view .skill-category:nth-child(8) {
    transition-delay: 0.46s;
}

/* Educación: reveal fade */
.timeline--edu {
    perspective: none;
}

.timeline--edu .timeline-flip-inner {
    transform-style: flat;
    transform-origin: center top;
    transform: translateY(22px);
    opacity: 0;
    transition: transform 0.8s ease, opacity 0.6s ease;
}

.section--reveal-edu.section-in-view .timeline-flip-inner {
    transform: translateY(0);
    opacity: 1;
}

.section--reveal-edu .timeline-item:nth-child(1) .timeline-flip-inner {
    transition-delay: 0.05s;
}

.section--reveal-edu .timeline-item:nth-child(2) .timeline-flip-inner {
    transition-delay: 0.14s;
}

.section--reveal-edu .timeline-item:nth-child(3) .timeline-flip-inner {
    transition-delay: 0.23s;
}

.section--reveal-edu .timeline-item:nth-child(4) .timeline-flip-inner {
    transition-delay: 0.32s;
}

/* ========== Glass & cards ========== */
.glass-card {
    background: var(--glass-bg);
    backdrop-filter: blur(14px);
    -webkit-backdrop-filter: blur(14px);
    border: 1px solid var(--glass-border);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06);
    transition: box-shadow 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}

[data-theme="light"] .glass-card {
    box-shadow: 0 8px 28px rgba(34, 29, 21, 0.08), inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

[data-theme="dark"] .glass-card:hover {
    box-shadow: 0 0 24px var(--primary-dim), 0 12px 40px var(--secondary-dim);
    border-color: var(--primary);
}

[data-theme="light"] .glass-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 16px 36px rgba(34, 29, 21, 0.12);
    border-color: var(--primary);
}

/* Disable hover effects on game shell */
.glass-card.no-hover:hover,
.game-shell:hover {
    transform: none !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.35), inset 0 1px 0 rgba(255, 255, 255, 0.06) !important;
}

[data-theme="light"] .glass-card.no-hover:hover,
[data-theme="light"] .game-shell:hover {
    box-shadow: 0 8px 28px rgba(34, 29, 21, 0.08) !important;
}

.about-content {
    max-width: 820px;
    margin: 0 auto;
    padding: 2rem;
    text-align: left;
    font-size: 1.05rem;
    color: var(--text-secondary);
}

.about-content p+p {
    margin-top: 1.1rem;
}

.about-content b {
    color: var(--primary);
    font-weight: 600;
}

/* ========== Proyectos ========== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.75rem;
}

.project-card {
    border-radius: 18px;
    overflow: hidden;
    background: var(--glass-bg);
    backdrop-filter: blur(12px);
    border: 1px solid var(--primary-dim);
    box-shadow: 0 0 20px var(--primary-dim), inset 0 0 0 1px var(--glass-border);
    transition: transform 0.35s ease, box-shadow 0.35s ease;
}

[data-theme="light"] .project-card {
    background: var(--bg-elevated);
    box-shadow: 0 10px 28px rgba(34, 29, 21, 0.1);
}

.project-card:hover {
    transform: translateY(-8px);
}

[data-theme="dark"] .project-card:hover {
    box-shadow: 0 0 28px var(--primary-dim), 0 16px 48px var(--secondary-dim);
}

[data-theme="light"] .project-card:hover {
    box-shadow: 0 18px 40px rgba(34, 29, 21, 0.16);
}

.project-image {
    height: 180px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 3rem;
    background: linear-gradient(135deg, var(--primary-dim), var(--secondary-dim));
    color: var(--primary);
}

.project-content {
    padding: 1.5rem 1.35rem;
}

.project-title {
    font-family: var(--font-display);
    font-size: 1.2rem;
    margin-bottom: 0.75rem;
    color: var(--text-primary);
}

.project-description {
    color: var(--text-secondary);
    font-size: 0.95rem;
    margin-bottom: 1rem;
}

.project-stat {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: 1rem;
}

.project-stat i {
    color: #f5c451;
}

.tech-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.45rem;
    margin-bottom: 1rem;
}

.tech-tag {
    font-size: 0.78rem;
    font-weight: 600;
    padding: 6px 12px;
    border-radius: 999px;
    background: var(--primary-dim);
    color: var(--primary);
    border: 1px solid var(--primary-dim);
}

.project-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.65rem;
}

.project-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--secondary);
    text-decoration: none;
    padding: 8px 14px;
    border-radius: 999px;
    border: 1px solid var(--secondary);
    transition: background 0.2s ease, color 0.2s ease, transform 0.2s ease;
}

.project-link:hover {
    background: var(--secondary-dim);
    color: var(--primary);
    transform: translateY(-2px);
}

/* ========== Skills ========== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
    gap: 1.25rem;
}

.skill-category {
    padding: 1.5rem;
    text-align: center;
}

.skill-category h3 {
    font-family: var(--font-display);
    font-size: 1.1rem;
    margin-bottom: 1rem;
    color: var(--primary);
}

.skill-list {
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    gap: 0.45rem;
}

.skill-item {
    font-size: 0.86rem;
    font-weight: 500;
    padding: 8px 14px;
    border-radius: 999px;
    background: var(--secondary-dim);
    border: 1px solid var(--secondary-dim);
    color: var(--text-secondary);
    transition: transform 0.2s ease, border-color 0.2s ease;
}

.skill-item:hover {
    border-color: var(--primary);
    color: var(--primary);
    transform: scale(1.05);
}

/* ========== Timeline ========== */
.timeline {
    position: relative;
    max-width: 820px;
    margin: 2rem auto;
}

.timeline::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: linear-gradient(180deg, var(--primary), var(--secondary));
    transform: translateX(-50%);
}

[data-theme="dark"] .timeline::before {
    box-shadow: 0 0 10px var(--primary-dim);
}

.timeline-item {
    position: relative;
    width: 50%;
    margin: 1.75rem 0;
}

.timeline-left {
    left: 0;
    padding-right: 2rem;
    text-align: right;
}

.timeline-right {
    left: 50%;
    padding-left: 2rem;
    text-align: left;
}

.timeline-left::before,
.timeline-right::before {
    content: "";
    position: absolute;
    top: 22px;
    width: 14px;
    height: 14px;
    background: var(--primary);
    border-radius: 50%;
    border: 3px solid var(--bg-deep);
    box-shadow: 0 0 10px var(--primary);
    z-index: 2;
}

.timeline-left::before {
    right: -7px;
}

.timeline-right::before {
    left: -7px;
}

.timeline-content {
    padding: 1.35rem;
    text-align: inherit;
}

.timeline-title {
    font-family: var(--font-display);
    font-size: 1.1rem;
    color: var(--primary);
    margin-bottom: 0.4rem;
}

.timeline-period {
    font-size: 0.88rem;
    color: var(--secondary);
    margin-bottom: 0.65rem;
    font-weight: 600;
}

.timeline-description {
    font-size: 0.92rem;
    color: var(--text-secondary);
}

/* ========== Educación: Metas 2026 ========== */
.education-metas {
    margin-top: 1.5rem;
    padding: 1.25rem 1.35rem;
}

.metas-title {
    font-family: var(--font-display);
    font-size: 1.15rem;
    color: var(--primary);
    margin-bottom: 0.75rem;
}

.metas-list {
    list-style: none;
    padding-left: 0;
    display: grid;
    gap: 0.65rem;
}

.metas-list li {
    color: var(--text-secondary);
    font-size: 0.95rem;
    line-height: 1.35;
}

/* Animación acorde al bloque de Educación */
.section--reveal-edu .education-metas {
    opacity: 0;
    transform: translateY(18px);
    transition: opacity 0.75s ease, transform 0.75s ease;
}

.section--reveal-edu.section-in-view .education-metas {
    opacity: 1;
    transform: translateY(0);
}


/* ========== Botón CV ========== */
.hero-cta {
    margin-top: 1.8rem;
}

.cv-download-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 0.9rem 2.2rem;
    background: var(--primary);
    color: #17130b;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 700;
    text-decoration: none;
    box-shadow: 0 4px 20px var(--primary-dim);
    transition: transform 0.2s, box-shadow 0.2s, filter 0.2s;
    animation: cv-pulse 2.5s ease-in-out infinite;
}

.cv-download-btn:hover {
    filter: brightness(1.08);
    transform: translateY(-2px);
    box-shadow: 0 6px 28px var(--primary-dim);
    animation: none;
}

.cv-download-btn i {
    font-size: 1.1rem;
}

@keyframes cv-pulse {
    0%, 100% { box-shadow: 0 4px 20px var(--primary-dim); }
    50%       { box-shadow: 0 4px 32px var(--primary-dim); }
}

/* ========== Subtítulo de sección ========== */
.section-subtitle {
    text-align: center;
    color: var(--text-secondary);
    font-size: 1rem;
    margin-top: -1rem;
    margin-bottom: 2.5rem;
    max-width: 580px;
    margin-left: auto;
    margin-right: auto;
}

/* ========== Contacto ========== */
.contact-grid {
    display: grid;
    grid-template-columns: 1fr 1.6fr;
    gap: 2rem;
    align-items: start;
}

.contact-info-block {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.contact-info-block h3 {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.contact-item {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 0.9rem;
    color: var(--text-secondary);
}

.contact-item i {
    width: 18px;
    color: var(--primary);
    flex-shrink: 0;
}

.contact-item a {
    color: var(--text-secondary);
    text-decoration: none;
    transition: color 0.2s;
}

.contact-item a:hover {
    color: var(--primary);
}

.contact-form {
    padding: 2rem 1.5rem;
    display: flex;
    flex-direction: column;
    gap: 1.2rem;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-group label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
}

.form-group input,
.form-group textarea {
    padding: 0.65rem 1rem;
    background: rgba(255,255,255,0.05);
    border: 1.5px solid rgba(255,255,255,0.12);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.9rem;
    font-family: inherit;
    transition: border-color 0.2s;
    resize: vertical;
}

.form-group input:focus,
.form-group textarea:focus {
    outline: none;
    border-color: var(--primary);
}

[data-theme="light"] .form-group input,
[data-theme="light"] .form-group textarea {
    background: rgba(0,0,0,0.04);
    border-color: rgba(0,0,0,0.15);
}

.form-submit {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 0.8rem 1.8rem;
    background: var(--primary);
    color: #17130b;
    border: none;
    border-radius: 6px;
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
    transition: opacity 0.2s;
    font-family: inherit;
}

.form-submit:hover {
    opacity: 0.85;
}

.form-msg {
    padding: 0.75rem 1rem;
    border-radius: 6px;
    font-size: 0.88rem;
    font-weight: 600;
    text-align: center;
    animation: fadeInUp 0.3s ease;
}

.form-msg--success {
    background: rgba(0, 200, 100, 0.15);
    border: 1.5px solid #00c864;
    color: #00c864;
}

.form-msg--error {
    background: rgba(255, 60, 60, 0.12);
    border: 1.5px solid #ff3c3c;
    color: #ff3c3c;
}

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

@media (max-width: 768px) {
    .contact-grid {
        grid-template-columns: 1fr;
    }
}

/* ========== Footer ========== */
footer {
    position: relative;
    z-index: 1;
    padding: 1.25rem 0;
    border-top: 1px solid var(--primary-dim);
    background: rgba(0, 0, 0, 0.35);
}

[data-theme="light"] footer {
    background: rgba(255, 255, 255, 0.85);
}

.footer-inner {
    display: flex;
    align-items: center;
    justify-content: center;
    flex-wrap: wrap;
    gap: 0.5rem;
    position: relative;
}

.footer-left {
    text-align: center;
}

.visit-counter {
    position: absolute;
    right: 0;
    border-radius: 4px;
    opacity: 0.85;
}

footer p {
    color: var(--text-secondary);
    font-size: 0.95rem;
}

footer p+p {
    margin-top: 0.5rem;
}

[data-theme="light"] footer p {
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== prefers-reduced-motion ========== */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    .section-scroll {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .section--rise .project-card,
    .section--zoom .skill-category,
    .timeline--edu .timeline-flip-inner {
        opacity: 1 !important;
        transform: none !important;
        transition: none !important;
    }

    .scroll-indicator,
    .typewriter-caret,
    .profile-image,
    .availability-badge__dot {
        animation: none !important;
    }

    .theme-toggle__thumb {
        transition: none;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
    }
}

/* ========== Responsive ========== */
@media (max-width: 1024px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 768px) {
    html {
        scroll-padding-top: 7rem;
    }

    .theme-toggle {
        top: max(0.65rem, env(safe-area-inset-top));
        right: max(0.65rem, env(safe-area-inset-right));
    }

    section {
        padding: 3.5rem 0;
    }

    .nav-link {
        font-size: 0.72rem;
        padding: 8px 12px;
    }

    .timeline::before {
        left: 18px;
    }

    .timeline-item,
    .timeline-left,
    .timeline-right {
        width: 100% !important;
        left: 0 !important;
        padding-left: 2.25rem !important;
        padding-right: 0 !important;
        margin-left: 36px !important;
        text-align: left !important;
    }

    .timeline-left::before,
    .timeline-right::before {
        left: -8px !important;
        right: auto !important;
    }

    .section--slide-left,
    .section--slide-right {
        transform: translateY(24px);
    }

    .section--slide-left.section-in-view,
    .section--slide-right.section-in-view {
        transform: translateY(0);
    }

    /* Flip 3D pesado en móvil: reveal vertical */
    .timeline--edu {
        perspective: none;
    }

    .timeline--edu .timeline-flip-inner {
        transform: translateY(36px);
        opacity: 0;
    }

    .section--reveal-edu.section-in-view .timeline-flip-inner {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (max-width: 380px) {
    .nav-links {
        gap: 6px 8px;
    }

    .nav-link {
        padding: 6px 8px;
        font-size: 0.65rem;
    }
}
