:root {
    --dark: #0c0f1a;
    --dark-surface: #12162b;
    --accent: #3b82f6;
    --accent-hover: #2563eb;
    --text-hero: #e2e8f0;
    --text-muted-hero: #8b95ab;
    --surface: #ffffff;
    --surface-alt: #f7f8fa;
    --line: #e5e7eb;
    --text-dark: #111827;
    --text-body: #4b5563;
    --text-subtle: #9ca3af;
    --mono: "JetBrains Mono", monospace;
}

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

html { scroll-behavior: smooth; }

body {
    font-family: "Syne", sans-serif;
    font-optical-sizing: auto;
    font-size: 17px;
    color: var(--text-body);
    background: var(--surface-alt);
    line-height: 1.75;
}

/* ═══ LANG SWITCHER ═══ */
.lang-switcher {
    position: fixed;
    top: 1rem;
    right: 1rem;
    z-index: 1000;
    display: flex;
    gap: 0;
    border-radius: 6px;
    overflow: hidden;
    border: 1px solid rgba(255,255,255,0.15);
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    backdrop-filter: blur(12px);
    background: rgba(12, 15, 26, 0.7);
}

.lang-switcher a {
    padding: 0.45rem 0.85rem;
    color: var(--text-muted-hero);
    text-decoration: none;
    transition: all 0.2s;
}

.lang-switcher a[aria-current="page"] {
    background: var(--accent);
    color: #fff;
}

.lang-switcher a:not([aria-current="page"]):hover {
    color: #fff;
}

/* ═══ HERO ═══ */
.perfil {
    background: var(--dark);
    color: var(--text-hero);
    position: relative;
    overflow: hidden;
}

.perfil::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -15%;
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(59,130,246,0.08) 0%, transparent 65%);
    pointer-events: none;
}

.perfil .container { position: relative; z-index: 1; }

.profile-img {
    width: 260px;
    height: 260px;
    object-fit: cover;
    border-radius: 50%;
    border: 3px solid rgba(59, 130, 246, 0.2);
    box-shadow: 0 0 80px rgba(59, 130, 246, 0.08);
}

.hero-name {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1.1;
    color: #fff;
}

.hero-slogan {
    font-family: var(--mono);
    font-size: 0.82rem;
    color: var(--accent);
    letter-spacing: 0.01em;
    line-height: 1.65;
    margin-top: 0.9rem;
    padding-left: 1rem;
    border-left: 2px solid var(--accent);
}

.hero-bio {
    font-size: 0.95rem;
    color: var(--text-muted-hero);
    line-height: 1.7;
    margin-top: 1rem;
}

.hero-buttons { margin-top: 1.5rem; }

.hero-buttons .btn {
    font-weight: 600;
    font-size: 0.88rem;
    padding: 0.65rem 1.6rem;
    border-radius: 8px;
    transition: all 0.25s ease;
}

.btn-accent { background: var(--accent); color: #fff; border: none; }
.btn-accent:hover { background: var(--accent-hover); color: #fff; transform: translateY(-1px); box-shadow: 0 6px 20px rgba(59,130,246,0.25); }

.btn-ghost { border: 1px solid rgba(255,255,255,0.15); color: var(--text-muted-hero); background: transparent; }
.btn-ghost:hover { border-color: var(--accent); color: #fff; }

/* ═══ KEY POINTS ═══ */
.key-points {
    background: var(--dark-surface);
    border-top: 1px solid rgba(255,255,255,0.04);
    padding: 2rem 0;
}

.kp-item { text-align: center; padding: 1.2rem 0.75rem; }
.kp-icon { font-size: 1.5rem; color: var(--accent); margin-bottom: 0.5rem; }
.kp-number { font-family: var(--mono); font-size: 1.8rem; font-weight: 700; color: #fff; line-height: 1; }
.kp-label { font-size: 0.72rem; color: var(--text-muted-hero); margin-top: 0.25rem; text-transform: uppercase; letter-spacing: 0.1em; }

.kp-disclaimer {
    font-size: 0.8rem;
    color: var(--text-muted-hero);
    line-height: 1.45;
    max-width: 300px;
    margin: 0 auto;
    text-align: center;
}

.kp-disclaimer strong { color: #e2e8f0; }

/* ═══ CONTENT ═══ */
.contenido {
    background: var(--surface);
    max-width: 820px;
    margin: 0 auto;
    padding: 3rem 2.5rem 3.5rem;
}

.contenido section { scroll-margin-top: 1.5rem; }

.contenido h2 {
    font-weight: 800;
    font-size: 1.4rem;
    color: var(--text-dark);
    margin-top: 2.5rem;
    margin-bottom: 0.8rem;
    padding-bottom: 0.4rem;
    border-bottom: 2px solid var(--accent);
    display: inline-block;
}

.contenido p { margin-bottom: 0.9rem; }
.contenido ul, .contenido ol { padding-left: 1.15rem; margin-bottom: 1rem; }
.contenido li { margin-bottom: 0.5rem; }
.contenido li strong, .contenido p strong { color: var(--text-dark); }

.callout {
    background: #f0f6ff;
    border-left: 3px solid var(--accent);
    padding: 1rem 1.25rem;
    border-radius: 0 8px 8px 0;
    margin: 1.2rem 0;
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-dark);
}

.stat { font-family: var(--mono); font-weight: 700; color: var(--accent); }

.skills-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.3rem 2rem;
    font-size: 0.92rem;
    margin: 0.75rem 0 1rem;
}

.skills-grid span::before { content: '→ '; color: var(--accent); font-weight: 700; }
.skills-label { margin: 1.1rem 0 0.1rem; }
.skills-label + .skills-grid { margin-top: 0.2rem; }

.academic-item {
    display: flex;
    align-items: baseline;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
}

.badge-status {
    font-family: var(--mono);
    font-size: 0.65rem;
    padding: 0.15rem 0.5rem;
    border-radius: 4px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    white-space: nowrap;
}

.badge-area { background: #f0f6ff; color: var(--accent-hover); min-width: 9.5rem; text-align: center; flex-shrink: 0; }
.academic-inst { display: block; font-size: 0.88rem; line-height: 1.5; }
.academic-inst a { color: inherit; text-decoration-color: var(--accent); text-underline-offset: 2px; }

.contenido section::after { content: ''; display: table; clear: both; }

/* ═══ EN POCAS PALABRAS ═══ */
.mono-label {
    font-family: var(--mono);
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--accent-hover);
    margin-bottom: 0.6rem;
}

.ficha {
    border: 1px solid var(--line);
    border-radius: 8px;
    padding: 1.1rem 1.25rem 0.6rem;
    margin-bottom: 1.5rem;
    font-size: 0.88rem;
    line-height: 1.55;
}

.ficha dl {
    display: grid;
    grid-template-columns: 8.5rem 1fr;
    gap: 0.35rem 1rem;
    margin-bottom: 0.5rem;
}

.ficha dt { font-family: var(--mono); font-size: 0.7rem; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-subtle); padding-top: 0.15rem; }
.ficha dd { margin: 0; color: var(--text-dark); }

/* ═══ ÍNDICE ═══ */
.indice {
    border-top: 1px solid var(--line);
    border-bottom: 1px solid var(--line);
    padding: 1rem 0 0.4rem;
    margin-bottom: 2.5rem;
}

.indice ol {
    list-style: none;
    padding: 0;
    margin: 0;
    columns: 2;
    column-gap: 2rem;
    counter-reset: cap;
    font-size: 0.9rem;
}

.indice li { counter-increment: cap; margin-bottom: 0.35rem; break-inside: avoid; }
.indice li::before { content: counter(cap, decimal-leading-zero); font-family: var(--mono); font-size: 0.7rem; color: var(--accent); margin-right: 0.6rem; }
.indice a { color: var(--text-dark); text-decoration: none; }
.indice a:hover { color: var(--accent-hover); }

.to-index {
    position: fixed;
    right: 1rem;
    bottom: 1rem;
    z-index: 900;
    font-family: var(--mono);
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    text-decoration: none;
    color: #fff;
    background: rgba(12, 15, 26, 0.85);
    backdrop-filter: blur(12px);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 6px;
    padding: 0.45rem 0.85rem;
    opacity: 0;
    pointer-events: none;
    transform: translateY(6px);
    transition: opacity 0.2s, transform 0.2s;
}

.to-index.visible { opacity: 1; pointer-events: auto; transform: none; }
.to-index:hover { color: #fff; background: var(--accent); }

/* ═══ LO QUE ESTOY CONSTRUYENDO ═══ */
.arbol { margin: 1rem 0 0.5rem; }

.arbol-raiz {
    border-left: 3px solid var(--accent);
    padding: 0.2rem 0 0.2rem 1rem;
    margin-bottom: 1.2rem;
}

.arbol-raiz p { margin-bottom: 0.2rem; font-size: 0.92rem; }

.rama {
    margin-left: 0.6rem;
    padding-left: 1.2rem;
    border-left: 1px solid var(--line);
    margin-bottom: 1.2rem;
}

.rama ul { list-style: none; padding: 0; margin: 0; }

.rama li {
    position: relative;
    margin-bottom: 0.85rem;
    line-height: 1.5;
}

.rama li::before {
    content: '';
    position: absolute;
    left: -1.2rem;
    top: 0.75rem;
    width: 0.8rem;
    border-top: 1px solid var(--line);
}

.nodo-nombre { font-weight: 700; color: var(--text-dark); text-decoration: none; }
a.nodo-nombre:hover { color: var(--accent-hover); }
.nodo-meta { font-family: var(--mono); font-size: 0.65rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--accent-hover); background: #f0f6ff; border-radius: 4px; padding: 0.05rem 0.4rem; margin-left: 0.4rem; white-space: nowrap; }
.nodo-desc { display: block; font-size: 0.9rem; }
.dominio { font-family: var(--mono); font-size: 0.72rem; color: var(--text-subtle); }
.arbol-nota { font-size: 0.88rem; margin-left: 0.6rem; }
.arbol-nota a { color: var(--accent-hover); text-underline-offset: 2px; }

/* ═══ FOOTER ═══ */
.copyright-bar { background: var(--dark); text-align: center; padding: 1rem 0; font-size: 0.82rem; color: var(--text-subtle); }
.copyright-bar a { color: var(--text-subtle); text-decoration: none; transition: color 0.2s; }
.copyright-bar a:hover { color: var(--accent); }
.footer-meta { display: block; font-family: var(--mono); font-size: 0.7rem; margin-top: 0.3rem; color: #6b7280; }

/* ═══ RESPONSIVE ═══ */
@media (max-width: 767.98px) {
    .hero-name { font-size: 1.7rem; text-align: center; }
    .hero-slogan { text-align: center; border-left: none; padding-left: 0; border-bottom: 2px solid var(--accent); padding-bottom: 0.6rem; }
    .hero-bio { text-align: center; }
    .hero-buttons { justify-content: center !important; }
    .profile-img { width: 180px; height: 180px; }
    .contenido { padding: 2rem 1.25rem; }
    .skills-grid { grid-template-columns: 1fr; }
    .kp-number { font-size: 1.4rem; }
    .academic-item { flex-direction: column; align-items: flex-start; gap: 0.2rem; margin-bottom: 0.9rem; }
    .badge-area { min-width: 0; }
    .ficha dl { grid-template-columns: 1fr; gap: 0 0; }
    .ficha dd { margin-bottom: 0.5rem; }
    .indice ol { columns: 1; }
    .rama { margin-left: 0.2rem; padding-left: 1rem; }
    .rama li::before { left: -1rem; width: 0.6rem; }
}

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

/* ═══ PRINT ═══ */
@media print {
    @page { margin: 1.5cm; size: A4; }
    * { -webkit-print-color-adjust: exact; print-color-adjust: exact; }
    body { font-size: 10.5pt; color: #000; background: #fff !important; line-height: 1.45; }
    .perfil { background: #fff !important; color: #000 !important; padding: 0 !important; }
    .perfil .container, .perfil .row { padding-top: 0 !important; padding-bottom: 0 !important; }
    .perfil .row { --bs-gutter-y: 0.3cm; }
    .key-points .row > div { flex: 0 0 25%; max-width: 25%; }
    .key-points .row > div:last-child { flex: 0 0 100%; max-width: 100%; }
    .kp-item { padding: 0.2cm 0; }
    .perfil::before { display: none; }
    .profile-img { width: 100px; height: 100px; border: 2px solid #555; box-shadow: none; }
    .hero-name { color: #000 !important; font-size: 18pt; }
    .hero-slogan { color: #333 !important; border-left-color: #333 !important; font-size: 8pt; }
    .hero-bio { color: #444 !important; font-size: 9pt; }
    .hero-buttons { display: none !important; }
    .lang-switcher, .indice, .to-index { display: none !important; }
    .key-points { background: #fff !important; border-top: 1px solid #ccc; border-bottom: 1px solid #ccc; padding: 0.5cm 0; }
    .kp-number { color: #000 !important; font-size: 14pt; }
    .kp-label, .kp-disclaimer { color: #555 !important; }
    .kp-disclaimer strong { color: #000 !important; }
    .kp-icon { color: #333 !important; }
    .contenido { box-shadow: none; padding: 0.5cm 0; max-width: 100%; }
    .contenido h2 { border-bottom-color: #333; font-size: 12pt; margin-top: 0.6cm; page-break-after: avoid; }
    .ficha { border-color: #999; page-break-inside: avoid; margin-bottom: 0.4cm; }
    .ficha dt, .mono-label { color: #333 !important; }
    .callout { background: #f0f0f0 !important; border-left-color: #333; }
    .stat { color: #000 !important; }
    .badge-area, .nodo-meta { background: #e0e0e0 !important; color: #000 !important; }
    .arbol-raiz { border-left-color: #333; }
    .rama li, .academic-item { page-break-inside: avoid; }
    .dominio { color: #333 !important; }
    .copyright-bar { background: #fff !important; color: #555 !important; border-top: 1px solid #ccc; margin-top: 0.5cm; }
    .copyright-bar a { color: #555 !important; }
    a { color: #000 !important; text-decoration: none !important; }
    h2, h3 { page-break-after: avoid; }
    p, li { orphans: 3; widows: 3; }
}
