/* =========================================================
   RESET & BASE
   ========================================================= */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--dark);
    line-height: 1.6;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
img { max-width: 100%; display: block; height: auto; }
ul { list-style: none; }

/* =========================================================
   LAYOUT
   ========================================================= */
.container {
    width: 100%;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 24px;
}
section { padding: 96px 0; position: relative; }
.section-header { text-align: center; margin-bottom: 64px; }
.section-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: rgba(79, 70, 229, 0.1);
    color: var(--indigo);
    font-size: 13px; font-weight: 600;
    padding: 8px 16px; border-radius: 100px;
    margin-bottom: 18px;
    letter-spacing: 0.3px;
}
.section-title {
    font-size: clamp(26px, 4.5vw, 44px);
    font-weight: 800;
    line-height: 1.15;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}
.section-title .gradient {
    background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.section-subtitle {
    font-size: 16px;
    color: var(--gray);
    max-width: 680px;
    margin: 0 auto;
}

/* =========================================================
   HERO
   ========================================================= */
.hero {
    padding: 80px 0 90px;
    background:
        radial-gradient(circle at 10% 20%, rgba(99, 102, 241, 0.12), transparent 45%),
        radial-gradient(circle at 90% 80%, rgba(79, 70, 229, 0.10), transparent 45%),
        var(--bg);
    overflow: hidden;
}
.hero-grid {
    display: grid;
    grid-template-columns: 1.15fr 0.85fr;
    gap: 60px;
    align-items: center;
}
.hero-content { max-width: 640px; }
.hero-badge {
    display: inline-flex; align-items: center; gap: 8px;
    background: var(--white);
    border: 1px solid var(--gray-light);
    padding: 8px 16px; border-radius: 100px;
    font-size: 13px; font-weight: 500;
    color: var(--dark-2);
    margin-bottom: 10px;
    box-shadow: var(--shadow);
}
.hero-badge .dot {
    width: 8px; height: 8px; border-radius: 50%;
    background: var(--green);
    box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18);
    animation: pulse 2s infinite;
}
@keyframes pulse {
    0%, 100% { box-shadow: 0 0 0 4px rgba(16, 185, 129, 0.18); }
    50% { box-shadow: 0 0 0 8px rgba(16, 185, 129, 0.05); }
}
.hero h1 {
    font-size: clamp(30px, 5.5vw, 56px);
    font-weight: 900;
    line-height: 1.08;
    letter-spacing: -0.03em;
    margin-bottom: 22px;
}
.hero h1 .gradient {
    background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
    -webkit-background-clip: text;
    background-clip: text;
    -webkit-text-fill-color: transparent;
}
.hero-description {
    font-size: 16.5px;
    color: var(--gray);
    margin-bottom: 32px;
    max-width: 560px;
}
.hero-actions {
    display: flex; gap: 12px; flex-wrap: wrap;
    margin-bottom: 40px;
}
.btn {
    display: inline-flex; align-items: center; gap: 10px;
    padding: 14px 26px; border-radius: 100px;
    font-size: 14px; font-weight: 600;
    transition: all 0.25s ease;
    cursor: pointer; border: none;
    font-family: inherit;
    white-space: nowrap;
}
.btn-primary {
    background: var(--indigo); color: #fff;
    box-shadow: 0 8px 24px rgba(79, 70, 229, 0.28);
}
.btn-primary:hover {
    background: var(--indigo-dark);
    transform: translateY(-2px);
    box-shadow: 0 12px 28px rgba(79, 70, 229, 0.35);
}
.btn-outline {
    background: var(--white); color: var(--dark);
    border: 1.5px solid var(--gray-light);
}
.btn-outline:hover {
    border-color: var(--indigo);
    color: var(--indigo);
    transform: translateY(-2px);
}
.hero-contact {
    display: flex; flex-wrap: wrap; gap: 20px;
    font-size: 13px; color: var(--gray);
}
.hero-contact a,
.hero-contact span {
    display: inline-flex; align-items: center; gap: 7px;
    transition: color 0.2s ease;
}
.hero-contact a:hover { color: var(--indigo); }
.hero-contact i { color: var(--indigo); }

/* Card visual */
.hero-visual { position: relative; }
.hero-card {
    background: var(--white);
    border-radius: 22px;
    padding: 30px;
    box-shadow: var(--shadow-lg);
    border: 1px solid var(--gray-light);
    position: relative;
    overflow: hidden;
}
.hero-card::before {
    content: '';
    position: absolute; top: 0; left: 0; right: 0; height: 5px;
    background: linear-gradient(90deg, var(--indigo), var(--indigo-light), #a78bfa);
}
.hero-avatar-photo {
    width: 170px; height: 200px;
    border-radius: 10%;
    margin: 0 auto 10px;
    overflow: hidden;
    border: 4px solid #fff;
    box-shadow: 0 10px 30px rgba(79, 70, 229, 0.25);
    background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
}
.hero-avatar-photo img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
}
.hero-card h3 {
    text-align: center;
    font-size: 20px; font-weight: 700;
    margin-bottom: 4px;
}
.hero-card .role {
    text-align: center;
    font-size: 13px; color: var(--indigo); font-weight: 600;
    margin-bottom: 20px;
}
.hero-card-divider {
    height: 1px; background: var(--gray-light);
    margin: 18px 0;
}
.hero-card-info {
    display: flex; flex-direction: column; gap: 12px;
    font-size: 13.5px;
}
.hero-card-info div {
    display: flex; align-items: center; gap: 10px;
    color: var(--dark-2);
}
.hero-card-info i {
    width: 20px; text-align: center;
    color: var(--indigo); font-size: 14px;
}

/* =========================================================
   SOBRE MÍ
   ========================================================= */
.about-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 60px;
    align-items: start;
}
.about-text p {
    font-size: 16px;
    color: var(--dark-2);
    margin-bottom: 18px;
}
.about-text strong { color: var(--dark); font-weight: 700; }
.about-highlights {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 14px;
}
.about-highlight {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: var(--radius);
    padding: 18px;
    transition: all 0.25s ease;
}
.about-highlight:hover {
    border-color: var(--indigo-light);
    transform: translateY(-3px);
    box-shadow: var(--shadow);
}
.about-highlight i {
    color: var(--indigo);
    font-size: 20px;
    margin-bottom: 10px;
}
.about-highlight h4 {
    font-size: 14px; font-weight: 700;
    margin-bottom: 4px;
}
.about-highlight p {
    font-size: 12.5px; color: var(--gray);
    margin: 0;
}

/* =========================================================
   STACK / SKILLS
   ========================================================= */
.skills-category {
    background: var(--white);
    border: 1px solid var(--gray-light);
    border-radius: 20px;
    padding: 30px;
    margin-bottom: 20px;
    transition: all 0.3s ease;
}
.skills-category:hover {
    box-shadow: var(--shadow);
    transform: translateY(-3px);
}
.skills-category-header {
    display: flex; align-items: center; gap: 14px;
    margin-bottom: 20px;
}
.skills-category-header .icon-box {
    flex-shrink: 0;
    width: 46px; height: 46px; border-radius: 12px;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
    display: flex; align-items: center; justify-content: center;
    color: #fff; font-size: 18px;
    box-shadow: 0 6px 18px rgba(79, 70, 229, 0.25);
}
.skills-category-header h3 {
    font-size: 17px; font-weight: 700;
}
.skills-category-header span {
    display: block; font-size: 12.5px; color: var(--gray); font-weight: 500;
}
.skills-tags {
    display: flex; flex-wrap: wrap; gap: 8px;
}
.skill-tag {
    background: #eef2ff;
    color: var(--indigo-dark);
    font-size: 12.5px; font-weight: 600;
    padding: 7px 14px;
    border-radius: 100px;
    border: 1px solid #e0e7ff;
    transition: all 0.2s ease;
}
.skill-tag:hover {
    background: var(--indigo);
    color: #fff;
    border-color: var(--indigo);
    transform: translateY(-1px);
}

/* =========================================================
   NIVELES (TABLA)
   ========================================================= */
.levels-table {
    background: var(--white);
    border-radius: 20px;
    border: 1px solid var(--gray-light);
    overflow: hidden;
    box-shadow: var(--shadow);
}
.levels-table table {
    width: 100%; border-collapse: collapse;
}
.levels-table th,
.levels-table td {
    padding: 16px 22px;
    text-align: left;
    font-size: 14px;
    border-bottom: 1px solid var(--gray-light);
}
.levels-table th {
    background: #f1f5f9;
    font-weight: 700;
    font-size: 12.5px;
    text-transform: uppercase;
    letter-spacing: 0.6px;
    color: var(--gray);
}
.levels-table tr:last-child td { border-bottom: none; }
.levels-table tr:hover td { background: #fafbff; }
.level-pill {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 12.5px; font-weight: 600;
    padding: 5px 12px; border-radius: 100px;
    white-space: nowrap;
}
.level-green { background: #ecfdf5; color: #047857; }
.level-yellow { background: #fffbeb; color: #b45309; }
.level-red { background: #fef2f2; color: #b91c1c; }
.level-pill .dot {
    width: 7px; height: 7px; border-radius: 50%;
}
.level-green .dot { background: var(--green); }
.level-yellow .dot { background: var(--yellow); }
.level-red .dot { background: var(--red); }

/* =========================================================
   PROYECTOS
   ========================================================= */
.projects-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(320px, 1fr));
    gap: 26px;
}
.project-card {
    background: var(--white);
    border-radius: 20px;
    border: 1px solid var(--gray-light);
    overflow: hidden;
    transition: all 0.35s ease;
    display: flex; flex-direction: column;
}
.project-card:hover {
    transform: translateY(-6px);
    box-shadow: var(--shadow-lg);
    border-color: var(--indigo-light);
}
.project-thumb {
    height: 200px;
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--indigo), var(--indigo-light));
}
.project-thumb img {
    width: 100%; height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 0.5s ease;
}
.project-card:hover .project-thumb img {
    transform: scale(1.06);
}
.project-thumb.alt {
    background: linear-gradient(135deg, #0ea5e9, #6366f1);
}
.project-thumb.alt-2 {
    background: linear-gradient(135deg, #8b5cf6, #6366f1);
}
.project-body {
    padding: 26px;
    display: flex; flex-direction: column;
    flex: 1;
}
.project-tag {
    display: inline-block;
    background: #eef2ff;
    color: var(--indigo);
    font-size: 11.5px; font-weight: 700;
    padding: 5px 12px; border-radius: 100px;
    margin-bottom: 12px;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    width: fit-content;
}
.project-card h3 {
    font-size: 19px; font-weight: 700;
    margin-bottom: 10px;
    letter-spacing: -0.01em;
}
.project-card p {
    font-size: 14px; color: var(--gray);
    margin-bottom: 18px;
    flex: 1;
}
.project-tech {
    display: flex; flex-wrap: wrap; gap: 6px;
    margin-bottom: 18px;
}
.project-tech span {
    font-size: 11.5px;
    background: #f1f5f9;
    color: var(--dark-2);
    padding: 4px 10px;
    border-radius: 6px;
    font-weight: 500;
}
.project-link {
    display: inline-flex; align-items: center; gap: 8px;
    font-size: 13.5px; font-weight: 600;
    color: var(--indigo);
    transition: gap 0.25s ease;
}
.project-link:hover { gap: 12px; }

/* =========================================================
   EXPERIENCIA / TIMELINE
   ========================================================= */
.timeline {
    position: relative;
    max-width: 820px;
    margin: 0 auto;
    padding-left: 40px;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 12px; top: 8px; bottom: 8px;
    width: 2px;
    background: linear-gradient(180deg, var(--indigo), var(--indigo-light), transparent);
}
.timeline-item {
    position: relative;
    padding-bottom: 42px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-item::before {
    content: '';
    position: absolute;
    left: -34px; top: 6px;
    width: 14px; height: 14px;
    border-radius: 50%;
    background: var(--white);
    border: 3px solid var(--indigo);
    box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.12);
}
.timeline-date {
    font-size: 12.5px; font-weight: 700;
    color: var(--indigo);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}
.timeline-item h3 {
    font-size: 18px; font-weight: 700;
    margin-bottom: 6px;
}
.timeline-item .place {
    font-size: 13.5px; color: var(--gray);
    margin-bottom: 10px;
    font-weight: 500;
}
.timeline-item p {
    font-size: 14px; color: var(--dark-2);
}

/* =========================================================
   CTA FINAL
   ========================================================= */
.cta-section {
    background: linear-gradient(135deg, #1e1b4b, #312e81, #4338ca);
    color: #fff;
    border-radius: 28px;
    padding: 64px 48px;
    text-align: center;
    position: relative;
    overflow: hidden;
    margin: 0 auto;
    max-width: 1180px;
}
.cta-section::before {
    content: '';
    position: absolute;
    top: -50%; left: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(129, 140, 248, 0.35), transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}
.cta-section::after {
    content: '';
    position: absolute;
    bottom: -60%; right: -10%;
    width: 500px; height: 500px;
    background: radial-gradient(circle, rgba(99, 102, 241, 0.35), transparent 60%);
    border-radius: 50%;
    pointer-events: none;
}
.cta-inner { position: relative; z-index: 2; }
.cta-section h2 {
    font-size: clamp(24px, 4vw, 38px);
    font-weight: 800;
    margin-bottom: 16px;
    letter-spacing: -0.02em;
}
.cta-section p {
    font-size: 16px;
    color: #c7d2fe;
    max-width: 620px;
    margin: 0 auto 32px;
}
.cta-actions {
    display: flex; gap: 12px; justify-content: center; flex-wrap: wrap;
}
.btn-light {
    background: #fff; color: var(--indigo-dark);
    font-weight: 700;
}
.btn-light:hover {
    background: #eef2ff;
    transform: translateY(-2px);
}
.btn-ghost {
    background: rgba(255,255,255,0.1);
    color: #fff;
    border: 1.5px solid rgba(255,255,255,0.25);
}
.btn-ghost:hover {
    background: rgba(255,255,255,0.18);
    transform: translateY(-2px);
}

/* =========================================================
   RESPONSIVE — TABLET (≤ 900px)
   ========================================================= */
@media (max-width: 900px) {
    section { padding: 72px 0; }
    .section-header { margin-bottom: 48px; }

    .hero { padding: 130px 0 70px; }
    .hero-grid {
        grid-template-columns: 1fr;
        gap: 44px;
    }
    .hero-content { max-width: 100%; }
    .hero-visual { max-width: 460px; margin: 0 auto; width: 100%; }

    .about-grid {
        grid-template-columns: 1fr;
        gap: 40px;
    }

    .projects-grid {
        grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    }

    .cta-section { padding: 52px 32px; }
    .footer-grid {
        grid-template-columns: 1fr 1fr;
        gap: 32px;
    }
    .footer-grid > div:first-child {
        grid-column: 1 / -1;
    }
}

/* =========================================================
   RESPONSIVE — MÓVIL (≤ 640px)
   ========================================================= */
@media (max-width: 640px) {
    .container { padding: 0 18px; }
    section { padding: 60px 0; }
    .section-header { margin-bottom: 36px; }
    .section-badge {
        font-size: 12px;
        padding: 6px 14px;
    }

    .hero { padding: 110px 0 56px; }
    .hero-grid { gap: 34px; }
    .hero h1 {
        font-size: clamp(28px, 8vw, 38px);
        margin-bottom: 18px;
    }
    .hero-description { font-size: 15px; margin-bottom: 24px; }
    .hero-actions {
        flex-direction: column;
        align-items: stretch;
        gap: 10px;
        margin-bottom: 28px;
    }
    .hero-actions .btn { justify-content: center; width: 100%; }
    .hero-contact {
        gap: 12px;
        font-size: 12.5px;
    }
    .hero-contact a,
    .hero-contact span {
        width: 100%;
        word-break: break-word;
    }

    .hero-card { padding: 24px 20px; }
    .hero-avatar-photo { width: 100px; height: 100px; }
    .hero-card h3 { font-size: 18px; }
    .hero-card-info { font-size: 13px; }

    .about-highlights {
        grid-template-columns: 1fr;
    }

    .skills-category { padding: 22px 18px; }
    .skills-category-header h3 { font-size: 16px; }
    .skill-tag {
        font-size: 12px;
        padding: 6px 12px;
    }

    .levels-table th,
    .levels-table td {
        padding: 12px 14px;
        font-size: 13px;
    }
    .levels-table th { font-size: 11.5px; }
    .level-pill { font-size: 11.5px; padding: 4px 10px; }

    .project-thumb { height: 170px; }
    .project-body { padding: 22px 20px; }
    .project-card h3 { font-size: 17px; }

    .timeline {
        padding-left: 30px;
    }
    .timeline::before { left: 8px; }
    .timeline-item::before {
        left: -30px;
        width: 12px; height: 12px;
        border-width: 2.5px;
    }
    .timeline-item h3 { font-size: 16px; }
    .timeline-item p { font-size: 13.5px; }

    .cta-section {
        padding: 44px 22px;
        border-radius: 20px;
    }
    .cta-section h2 { font-size: 22px; }
    .cta-section p { font-size: 14.5px; }
    .cta-actions { flex-direction: column; align-items: stretch; }
    .cta-actions .btn { justify-content: center; width: 100%; }

    .footer { padding: 48px 0 24px; margin-top: 60px; }
    .footer-grid {
        grid-template-columns: 1fr;
        gap: 28px;
        margin-bottom: 28px;
    }
    .footer-grid > div:first-child { grid-column: auto; }
    .footer-bottom { font-size: 12px; }
}

/* =========================================================
   RESPONSIVE — MÓVIL PEQUEÑO (≤ 380px)
   ========================================================= */
@media (max-width: 380px) {
    .container { padding: 0 14px; }
    .hero { padding: 100px 0 48px; }
    .hero h1 { font-size: 26px; }
    .btn { padding: 12px 20px; font-size: 13px; }
    .project-tech span { font-size: 11px; padding: 3px 8px; }
}