:root {
    --bg-primary: #0f172a; /* Slate 900 */
    --bg-secondary: #1e293b; /* Slate 800 */
    --text-primary: #f1f5f9; /* Slate 100 */
    --text-secondary: #94a3b8; /* Slate 400 */
    --accent-primary: #38bdf8; /* Sky 400 */
    --accent-secondary: #0ea5e9; /* Sky 500 */
    --accent-gradient: linear-gradient(135deg, #38bdf8 0%, #3b82f6 100%);
    --border-color: #334155; /* Slate 700 */
    --card-bg: rgba(30, 41, 59, 0.5);
    --nav-bg: rgba(15, 23, 42, 0.8);
    --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
    --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
    --glass-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
    --transition: all 0.3s ease;
    --border-radius: 12px;
}

:root[data-theme="light"] {
    --bg-primary: #f8fafc;
    --bg-secondary: #e2e8f0;
    --text-primary: #020617;
    --text-secondary: #475569;
    --accent-primary: #0284c7;
    --accent-secondary: #0ea5e9;
    --border-color: #cbd5e1;
    --card-bg: rgba(255, 255, 255, 0.9);
    --nav-bg: rgba(255, 255, 255, 0.95);
    --glass-shadow: 0 10px 25px 0 rgba(148, 163, 184, 0.45);
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background-color: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    display: flex;
    flex-direction: column;
    min-height: 100vh;
    background-image: 
        radial-gradient(circle at 10% 20%, rgba(56, 189, 248, 0.1) 0%, transparent 20%),
        radial-gradient(circle at 90% 80%, rgba(59, 130, 246, 0.1) 0%, transparent 20%);
    background-attachment: fixed;
}

/* Header & Nav */
header {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--nav-bg);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-bottom: 1px solid var(--border-color);
    padding: 1rem 2rem;
}

nav {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text-primary);
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.5px;
}

.nav-links {
    display: flex;
    gap: 2rem;
    list-style: none;
}

.nav-links a {
    text-decoration: none;
    color: var(--text-secondary);
    font-weight: 500;
    transition: var(--transition);
    position: relative;
    padding: 0.5rem 0;
}

.nav-links a:hover,
.nav-links a.active {
    color: var(--accent-primary);
}

.nav-links a.active::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 2px;
    background: var(--accent-gradient);
    border-radius: 2px;
}

.menu-toggle {
    display: none;
    font-size: 1.5rem;
    cursor: pointer;
}

/* Buttons */
.lang-btn {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    border: 1px solid var(--border-color);
    border-radius: 20px;
    color: var(--text-secondary);
    transition: var(--transition);
    background: transparent;
}

.lang-switcher {
    position: relative;
    display: inline-block;
}

.lang-switcher img {
    width: 20px;
    height: 14px;
    object-fit: cover;
    border-radius: 2px;
}

.lang-toggle {
    cursor: pointer;
}

.lang-menu {
    position: absolute;
    right: 0;
    margin-top: 0.5rem;
    background: var(--nav-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 0.5rem 0;
    display: none;
    min-width: 140px;
    box-shadow: var(--glass-shadow);
    z-index: 1200;
}

.lang-menu a {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    text-decoration: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.lang-menu a:hover {
    background: rgba(148, 163, 184, 0.1);
    color: var(--accent-primary);
}

.lang-menu.open {
    display: block;
}

.lang-btn:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.theme-btn {
    background: transparent;
    border: none;
    font-size: 1.2rem;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.theme-btn:hover {
    background: rgba(128, 128, 128, 0.1);
    transform: rotate(15deg);
}

/* Main Content */
main {
    flex: 1;
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 2rem;
}

.section-title {
    font-size: 2.5rem;
    margin-bottom: 2rem;
    text-align: center;
    position: relative;
    display: inline-block;
    left: 50%;
    transform: translateX(-50%);
}

.section-title::after {
    content: '';
    display: block;
    width: 60%;
    height: 4px;
    background: var(--accent-gradient);
    margin: 0.5rem auto 0;
    border-radius: 2px;
}

/* Hero Section */
.hero {
    text-align: center;
    padding: 4rem 1rem;
    max-width: 800px;
    margin: 0 auto;
}

.hero.image-bg {
    position: relative;
    overflow: hidden;
    min-height: 100vh;
    width: 100%;
    max-width: none;
    margin: 0;
    border-radius: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.hero.image-bg::before {
    content: '';
    position: absolute;
    inset: 0;
    background-image: url("https://pbs.twimg.com/media/DuC2PqtXQAE8Qw6.jpg");
    background-size: cover;
    background-position: center;
    opacity: 0.22;
    filter: grayscale(40%);
    pointer-events: none;
}

.hero.image-bg > * {
    position: relative;
    z-index: 1;
}

@media (max-width: 768px) {
    .hero.image-bg {
        min-height: 80vh;
    }
}

.home {
    overflow-y: hidden;
}
.home footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
}
.home .hero.image-bg {
    min-height: calc(100vh - 96px);
}

.about-grid {
    display: grid;
    grid-template-columns: 180px 1fr;
    gap: 1.5rem;
    align-items: center;
}
.about-avatar {
    width: 180px;
    height: 180px;
    border-radius: var(--border-radius);
    object-fit: cover;
    border: 1px solid var(--border-color);
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
}

.info-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.info-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem;
    background: rgba(255, 255, 255, 0.03);
    border-radius: 12px;
    border: 1px solid var(--border-color);
}

.info-icon {
    font-size: 1.5rem;
}

.info-text strong {
    display: block;
    font-size: 0.9rem;
    color: var(--accent-primary);
    text-transform: uppercase;
    letter-spacing: 1px;
}

.info-text span {
    font-size: 1.1rem;
    color: var(--text-primary);
}

@media (max-width: 768px) {
    .about-grid {
        grid-template-columns: 1fr;
        text-align: center;
    }
    .about-avatar {
        margin: 0 auto;
    }
}
.hero h1 {
    font-size: 3.5rem;
    margin-bottom: 1rem;
    line-height: 1.2;
    background: var(--accent-gradient);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

.subtitle {
    font-size: 1.5rem;
    color: var(--text-secondary);
    margin-bottom: 2rem;
}

.hero-content {
    margin-bottom: 2.5rem;
    font-size: 1.1rem;
    color: var(--text-secondary);
}

.btn {
    display: inline-block;
    padding: 0.8rem 2rem;
    background: var(--accent-gradient);
    color: white;
    text-decoration: none;
    border-radius: 50px;
    font-weight: 600;
    transition: var(--transition);
    box-shadow: 0 4px 15px rgba(56, 189, 248, 0.3);
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 25px rgba(56, 189, 248, 0.5);
}

/* Cards & Containers */
.card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    backdrop-filter: blur(5px);
    margin-bottom: 2rem;
}

/* Timeline (Experiencia y Estudios) */
.timeline {
    position: relative;
    padding-left: 2rem;
    border-left: 2px solid var(--border-color);
}

.timeline-item {
    margin-bottom: 3rem;
    position: relative;
}

.timeline-item::before {
    content: '';
    position: absolute;
    left: -2.6rem;
    top: 0.5rem;
    width: 1rem;
    height: 1rem;
    background: var(--bg-primary);
    border: 2px solid var(--accent-primary);
    border-radius: 50%;
}

.timeline-item.current::before {
    background: var(--accent-primary);
    box-shadow: 0 0 10px var(--accent-primary);
}

.timeline-date {
    font-size: 0.9rem;
    color: var(--accent-primary);
    margin-bottom: 0.5rem;
    font-weight: 600;
}

.timeline-content h4 {
    font-size: 1.3rem;
    margin-bottom: 0.5rem;
    color: var(--text-primary);
}

.institution {
    font-size: 1.1rem;
    color: var(--text-secondary);
    margin-bottom: 1rem;
}

/* Skills Section */
.skills-category {
    margin-bottom: 3rem;
}

.skills-category h3 {
    margin-bottom: 1.5rem;
    color: var(--accent-primary);
    border-bottom: 1px solid var(--border-color);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.skills-list {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 2rem;
}

.skills-list li {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 1.5rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    transition: var(--transition);
}

.skills-list li:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.skill-icon {
    width: 64px;
    height: 64px;
    margin-bottom: 1rem;
    object-fit: contain;
}

.skills-list span {
    font-weight: 500;
    color: var(--text-primary);
}

/* Footer */
footer {
    text-align: center;
    padding: 2rem;
    background: var(--nav-bg);
    border-top: 1px solid var(--border-color);
    margin-top: auto;
    color: var(--text-secondary);
}

/* Responsive */
@media (max-width: 768px) {
    header {
        padding: 1rem;
    }

    nav {
        flex-wrap: wrap;
    }

    .logo {
        font-size: 1.2rem;
    }

    .nav-links {
        display: none;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        background: var(--bg-primary);
        border-bottom: 1px solid var(--border-color);
        padding: 1.5rem;
        flex-direction: column;
        gap: 1.5rem;
        text-align: center;
        box-shadow: var(--shadow-lg);
    }

    .nav-links.active {
        display: flex;
    }

    .menu-toggle {
        display: block;
        order: 2;
    }

    .lang-switcher {
        order: 1;
        margin-right: 1rem;
    }

    main {
        padding: 1rem;
    }

    .section-title {
        font-size: 1.8rem;
        width: 100%;
    }

    /* Home Responsive */
    .home {
        overflow-y: auto; /* Permitir scroll en móviles */
    }

    .home footer {
        position: static; /* Quitar footer fijo */
    }

    .hero h1 {
        font-size: 2.2rem;
    }

    .subtitle {
        font-size: 1.2rem;
    }

    .hero.image-bg {
        min-height: auto;
        padding: 4rem 1rem;
    }

    /* Grids Responsive */
    .info-grid {
        grid-template-columns: 1fr;
        gap: 1rem;
    }

    .projects-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }

    .skills-list {
        grid-template-columns: repeat(auto-fill, minmax(120px, 1fr));
        gap: 1rem;
    }

    .contact-grid {
        grid-template-columns: 1fr;
    }

    .project-card, .card, .contact-card {
        padding: 1.5rem;
    }

    .project-img {
        height: 180px;
    }
}

@media (max-width: 480px) {
    .hero h1 {
        font-size: 1.8rem;
    }

    .btn {
        width: 100%;
        text-align: center;
    }
}

/* Contact Page Redesign */
.contact-hero {
    text-align: center;
    padding: 3rem 1rem;
    animation: fadeIn 0.8s ease-out;
}

.contact-hero .section-title {
    left: auto;
    transform: none;
}

.contact-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 2rem;
    max-width: 1100px;
    margin: 0 auto;
    padding: 0 1rem;
}

.contact-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2.5rem 2rem;
    text-align: center;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    backdrop-filter: blur(10px);
    display: flex;
    flex-direction: column;
    align-items: center;
    height: 100%;
}

.contact-card:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-lg);
    border-color: var(--accent-primary);
}

.contact-card .icon-box {
    width: 80px;
    height: 80px;
    background: rgba(56, 189, 248, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 1.5rem;
    transition: var(--transition);
}

.contact-card:hover .icon-box {
    background: var(--accent-gradient);
    transform: scale(1.1);
}

.contact-card:hover .icon-box svg {
    stroke: white;
}

.contact-card h3 {
    margin-bottom: 0.5rem;
    font-size: 1.5rem;
}

.contact-card p {
    color: var(--text-secondary);
    margin-bottom: 2rem;
    flex-grow: 1;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

/* Projects Section */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 2rem;
}

@media (max-width: 768px) {
    .projects-grid {
        grid-template-columns: 1fr;
    }
}

.project-card {
    background: var(--card-bg);
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    transition: var(--transition);
    backdrop-filter: blur(5px);
}

.project-card:hover {
    transform: translateY(-5px);
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-md);
}

.project-card h3 {
    margin-bottom: 1rem;
    color: var(--accent-primary);
    font-size: 1.5rem;
}

.project-card p {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
    flex-grow: 1;
}

.project-img {
    width: 100%;
    height: 200px;
    object-fit: cover;
    border-radius: var(--border-radius);
    margin-bottom: 1.5rem;
    border: 1px solid var(--border-color);
}

.project-img.contain {
    object-fit: contain;
    background: rgba(255, 255, 255, 0.05);
}

.card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    margin-bottom: 1.5rem;
}

.tag {
    background: rgba(56, 189, 248, 0.1);
    color: var(--accent-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* Experience & Education Images */
.institution-img {
    max-width: 100%;
    height: auto;
    max-height: 150px;
    border-radius: var(--border-radius);
    margin: 1rem 0;
    display: block;
    border: 1px solid var(--border-color);
}
