/* ===== Reset & Variables ===== */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --bg-primary: #0a0e1a;
    --bg-secondary: #111827;
    --bg-tertiary: #1a2234;
    --text-primary: #e5e9f0;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --accent: #38bdf8;
    --accent-hover: #0ea5e9;
    --accent-glow: rgba(56, 189, 248, 0.15);
    --border: #1e293b;
    --font-main: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Courier New', monospace;
}

html { scroll-behavior: smooth; }

body {
    font-family: var(--font-main);
    background: var(--bg-primary);
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
ul { list-style: none; }
img { max-width: 100%; }

/* ===== Navbar ===== */
.navbar {
    position: fixed;
    top: 0;
    width: 100%;
    background: rgba(10, 14, 26, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid var(--border);
    z-index: 1000;
    transition: all 0.3s ease;
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 1rem 2rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.logo {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--accent);
    letter-spacing: -0.5px;
}
.logo span { color: var(--text-primary); }

.nav-menu {
    display: flex;
    gap: 2rem;
    align-items: center;
}

.nav-menu a {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: color 0.2s;
    position: relative;
}

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

.nav-menu a::after {
    content: '';
    position: absolute;
    bottom: -4px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--accent);
    transition: width 0.3s;
}
.nav-menu a:hover::after { width: 100%; }

.btn-contacto {
    padding: 0.5rem 1.2rem;
    border: 1px solid var(--accent);
    border-radius: 6px;
    color: var(--accent) !important;
    transition: all 0.2s;
}
.btn-contacto:hover {
    background: var(--accent-glow);
    transform: translateY(-1px);
}
.btn-contacto::after { display: none; }

.menu-toggle {
    display: none;
    flex-direction: column;
    gap: 5px;
    cursor: pointer;
}
.menu-toggle span {
    width: 24px;
    height: 2px;
    background: var(--text-primary);
    transition: all 0.3s;
}

/* ===== Hero ===== */
.hero {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 4rem;
    padding: 8rem 2rem 4rem;
    max-width: 1200px;
    margin: 0 auto;
    position: relative;
}

.hero::before {
    content: '';
    position: absolute;
    top: 20%;
    left: -10%;
    width: 500px;
    height: 500px;
    background: radial-gradient(circle, var(--accent-glow) 0%, transparent 70%);
    filter: blur(80px);
    z-index: -1;
}

.hero-content { flex: 1; max-width: 600px; }

.hero-greeting {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1rem;
    margin-bottom: 1rem;
}

.hero-name {
    font-size: clamp(2rem, 5vw, 3.5rem);
    font-weight: 800;
    line-height: 1.1;
    margin-bottom: 0.5rem;
    letter-spacing: -1px;
}
.hero-name span { color: var(--accent); }

.hero-role {
    font-size: clamp(1.2rem, 3vw, 1.8rem);
    color: var(--text-secondary);
    font-weight: 400;
    margin-bottom: 1.5rem;
}

.hero-description {
    color: var(--text-secondary);
    font-size: 1rem;
    margin-bottom: 2rem;
    max-width: 540px;
}

.hero-buttons {
    display: flex;
    gap: 1rem;
    margin-bottom: 2rem;
    flex-wrap: wrap;
}

.btn {
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.95rem;
    transition: all 0.2s;
    cursor: pointer;
    display: inline-block;
}

.btn-primary {
    background: var(--accent);
    color: var(--bg-primary);
}
.btn-primary:hover {
    background: var(--accent-hover);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px var(--accent-glow);
}

.btn-secondary {
    border: 1px solid var(--border);
    color: var(--text-primary);
}
.btn-secondary:hover {
    border-color: var(--accent);
    color: var(--accent);
    transform: translateY(-2px);
}

.hero-socials {
    display: flex;
    gap: 1rem;
}
.hero-socials a {
    width: 42px;
    height: 42px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 50%;
    color: var(--text-secondary);
    transition: all 0.2s;
}
.hero-socials a:hover {
    color: var(--accent);
    border-color: var(--accent);
    transform: translateY(-3px);
}

/* ===== Code Card ===== */
.hero-visual { flex: 1; max-width: 480px; }

.code-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
    transform: perspective(1000px) rotateY(-5deg) rotateX(2deg);
    transition: transform 0.3s;
}
.code-card:hover {
    transform: perspective(1000px) rotateY(0deg) rotateX(0deg);
}

.code-header {
    background: var(--bg-tertiary);
    padding: 0.75rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.dot {
    width: 12px;
    height: 12px;
    border-radius: 50%;
}
.dot.red { background: #ff5f56; }
.dot.yellow { background: #ffbd2e; }
.dot.green { background: #27c93f; }

.code-title {
    margin-left: auto;
    font-family: var(--font-mono);
    font-size: 0.8rem;
    color: var(--text-muted);
}

.code-body {
    padding: 1.5rem;
    font-family: var(--font-mono);
    font-size: 0.85rem;
    line-height: 1.7;
    overflow-x: auto;
    color: var(--text-primary);
}

.code-body .kw { color: #c792ea; }
.code-body .cls { color: #ffcb6b; }
.code-body .fn { color: #82aaff; }
.code-body .self { color: #f78c6c; }
.code-body .str { color: #c3e88d; }

/* ===== Sections ===== */
.section {
    padding: 6rem 2rem;
}
.section-alt {
    background: var(--bg-secondary);
}

.container {
    max-width: 1100px;
    margin: 0 auto;
}

.section-title {
    font-size: clamp(1.5rem, 3vw, 2rem);
    font-weight: 700;
    margin-bottom: 3rem;
    display: flex;
    align-items: center;
    gap: 1rem;
}
.section-title span {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 1rem;
    font-weight: 500;
}
.section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
    margin-left: 1rem;
}

/* ===== About ===== */
.about-content { max-width: 800px; }
.about-text p {
    color: var(--text-secondary);
    margin-bottom: 1.2rem;
    font-size: 1.05rem;
}
.about-text strong { color: var(--accent); font-weight: 600; }

.about-info {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
    gap: 1rem;
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid var(--border);
}
.info-item {
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}
.info-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}
.info-value {
    color: var(--text-primary);
    font-weight: 500;
}

/* ===== Timeline ===== */
.timeline {
    position: relative;
    padding-left: 2rem;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}

.timeline-item {
    position: relative;
    padding-bottom: 3rem;
}
.timeline-item:last-child { padding-bottom: 0; }

.timeline-dot {
    position: absolute;
    left: -2rem;
    top: 0.5rem;
    width: 14px;
    height: 14px;
    border-radius: 50%;
    background: var(--accent);
    border: 3px solid var(--bg-secondary);
    transform: translateX(-6px);
    box-shadow: 0 0 0 4px var(--accent-glow);
}

.timeline-content {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
    transition: transform 0.2s, border-color 0.2s;
}
.timeline-content:hover {
    transform: translateX(4px);
    border-color: var(--accent);
}

.timeline-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 1rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}
.timeline-header h3 {
    font-size: 1.1rem;
    color: var(--text-primary);
    margin-bottom: 0.3rem;
}
.timeline-role {
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-style: italic;
}
.timeline-date {
    color: var(--accent);
    font-family: var(--font-mono);
    font-size: 0.85rem;
    white-space: nowrap;
    padding: 0.2rem 0.6rem;
    background: var(--accent-glow);
    border-radius: 4px;
}

.timeline-content ul {
    list-style: none;
    padding-left: 0;
}
.timeline-content li {
    color: var(--text-secondary);
    font-size: 0.95rem;
    padding-left: 1.5rem;
    position: relative;
    margin-bottom: 0.5rem;
}
.timeline-content li::before {
    content: '▸';
    position: absolute;
    left: 0;
    color: var(--accent);
}
.timeline-content strong { color: var(--text-primary); }

/* ===== Projects ===== */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 1.5rem;
}

.project-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 1.8rem;
    transition: all 0.3s;
    position: relative;
    overflow: hidden;
}
.project-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(90deg, var(--accent), transparent);
    transform: scaleX(0);
    transform-origin: left;
    transition: transform 0.4s;
}
.project-card:hover {
    transform: translateY(-6px);
    border-color: var(--accent);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
}
.project-card:hover::before { transform: scaleX(1); }

.project-icon {
    font-size: 2rem;
    margin-bottom: 1rem;
}
.project-card h3 {
    font-size: 1.15rem;
    margin-bottom: 0.6rem;
    color: var(--text-primary);
}
.project-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

.project-tags, .skill-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
}
.project-tags span, .skill-tags span {
    font-size: 0.75rem;
    font-family: var(--font-mono);
    padding: 0.25rem 0.6rem;
    background: var(--accent-glow);
    color: var(--accent);
    border-radius: 4px;
    border: 1px solid rgba(56, 189, 248, 0.2);
}

/* ===== Skills ===== */
.skills-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 1.5rem;
}
.skill-category {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.5rem;
}
.skill-category h3 {
    color: var(--accent);
    font-size: 1rem;
    margin-bottom: 1rem;
    font-family: var(--font-mono);
}

/* ===== Education ===== */
.education-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
    gap: 1.5rem;
}
.education-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-left: 3px solid var(--accent);
    border-radius: 8px;
    padding: 1.5rem;
}
.education-card h3 {
    font-size: 1.1rem;
    margin-bottom: 0.5rem;
}
.education-card p {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

/* ===== Contact ===== */
.contact-intro {
    color: var(--text-secondary);
    font-size: 1.05rem;
    max-width: 600px;
    margin-bottom: 2rem;
}

.contact-links {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 1rem;
}

.contact-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 1.2rem;
    transition: all 0.2s;
}
.contact-card:hover {
    border-color: var(--accent);
    transform: translateY(-3px);
}
.contact-card svg {
    color: var(--accent);
    flex-shrink: 0;
}
.contact-card div {
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.contact-label {
    font-size: 0.75rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 1px;
}
.contact-value {
    color: var(--text-primary);
    font-size: 0.9rem;
    word-break: break-all;
}

/* ===== Footer ===== */
.footer {
    text-align: center;
    padding: 2rem;
    color: var(--text-muted);
    font-size: 0.85rem;
    border-top: 1px solid var(--border);
}

/* ===== Responsive ===== */
@media (max-width: 900px) {
    .hero {
        flex-direction: column;
        text-align: center;
        padding-top: 6rem;
    }
    .hero-buttons, .hero-socials { justify-content: center; }
    .hero-visual { width: 100%; max-width: 400px; }
    .code-card { transform: none; }
    .code-card:hover { transform: none; }
}

@media (max-width: 768px) {
    .nav-menu {
        position: fixed;
        top: 0;
        right: -100%;
        width: 80%;
        max-width: 300px;
        height: 100vh;
        background: var(--bg-secondary);
        flex-direction: column;
        justify-content: center;
        gap: 2rem;
        transition: right 0.3s;
        border-left: 1px solid var(--border);
    }
    .nav-menu.active { right: 0; }
    .menu-toggle { display: flex; }
    .menu-toggle.active span:nth-child(1) { transform: rotate(45deg) translate(5px, 5px); }
    .menu-toggle.active span:nth-child(2) { opacity: 0; }
    .menu-toggle.active span:nth-child(3) { transform: rotate(-45deg) translate(5px, -5px); }

    .section { padding: 4rem 1.5rem; }
    .timeline { padding-left: 1.5rem; }
    .timeline-dot { left: -1.5rem; }
    .timeline-header { flex-direction: column; }
}
