/* CSS base con temas Dark/Light y estilo moderno y humano inspirado en UI limpias */
:root {
    /* Light theme */
    --bg: #0b0d10;
    --bg-elev: #12161b;
    --text: #e6eaf2;
    --muted: #9aa3b2;
    --primary: #7c5cff;
    --primary-600: #6b4af3;
    --accent: #19c37d;
    --card: #12161b;
    --border: #1f2530;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    --radius: 14px;
    --radius-sm: 10px;
}

html[data-theme='light'] {
    --bg: #f7f8fb;
    --bg-elev: #ffffff;
    --text: #1b2430;
    --muted: #546178;
    --primary: #5b6cff;
    --primary-600: #4a59ea;
    --accent: #0fb67c;
    --card: #ffffff;
    --border: #e6eaf2;
    --shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

* {
    box-sizing: border-box;
}
html,
body {
    height: 100%;
}
body {
    margin: 0;
    font-family: Inter, system-ui, -apple-system, Segoe UI, Roboto, Ubuntu, Cantarell, Noto Sans, Helvetica Neue, Arial,
        'Apple Color Emoji', 'Segoe UI Emoji';
    color: var(--text);
    background: radial-gradient(1200px 800px at 10% -10%, rgba(124, 92, 255, 0.12), transparent 60%),
        radial-gradient(1000px 600px at 90% 10%, rgba(25, 195, 125, 0.1), transparent 60%), var(--bg);
    line-height: 1.6;
}

.container {
    width: min(1100px, 92%);
    margin-inline: auto;
}

/* Header */
.site-header {
    position: sticky;
    top: 0;
    z-index: 50;
    backdrop-filter: saturate(140%) blur(8px);
    background: color-mix(in oklab, var(--bg), transparent 10%);
    border-bottom: 1px solid var(--border);
}
.header-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 0;
}
.brand {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    box-shadow: var(--shadow);
    font-weight: 700;
    letter-spacing: 0.5px;
    overflow: hidden;
}
.brand img {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}
.brand .brand-fallback {
    width: 100%;
    height: 100%;
    display: none;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: var(--text);
    background: var(--card);
}
.nav {
    display: none;
    gap: 18px;
}
.nav a {
    color: var(--muted);
    text-decoration: none;
    font-weight: 500;
}
.nav a:hover {
    color: var(--text);
}
@media (min-width: 980px) {
    .nav {
        display: flex;
    }
}

/* Controls container */
.controls {
    display: flex;
    align-items: center;
    gap: 12px;
}

/* Language toggle */
.lang-toggle {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 4px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
    position: relative;
}
.lang-toggle .lang-text {
    padding: 4px 8px;
    font-size: 12px;
    font-weight: 600;
    border-radius: 999px;
    transition: all 0.2s ease;
    position: relative;
    z-index: 1;
}
.lang-toggle[data-lang="es"] .lang-text[data-lang="es"],
.lang-toggle[data-lang="en"] .lang-text[data-lang="en"] {
    background: var(--primary);
    color: white;
}
.lang-toggle:hover {
    border-color: color-mix(in oklab, var(--primary), var(--border));
}

/* Theme toggle */
.theme-toggle {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    border-radius: 999px;
    background: var(--card);
    color: var(--text);
    border: 1px solid var(--border);
    padding: 8px 12px;
    cursor: pointer;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}
.theme-toggle .icon {
    font-size: 16px;
}
.theme-toggle:hover {
    border-color: color-mix(in oklab, var(--primary), var(--border));
}

/* Hero */
.hero {
    display: grid;
    grid-template-columns: 1.1fr 0.9fr;
    gap: 28px;
    align-items: center;
    padding: 64px 0 24px;
}
.hero-content .kicker {
    color: var(--accent);
    font-weight: 600;
    letter-spacing: 0.3px;
}
.hero h1 {
    font-size: clamp(32px, 6vw, 56px);
    line-height: 1.05;
    margin: 10px 0 12px;
}
.lead {
    font-size: clamp(16px, 2.2vw, 18.5px);
    color: var(--muted);
    max-width: 62ch;
}
.hero-cta {
    display: flex;
    gap: 12px;
    margin-top: 18px;
}

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    padding: 10px 14px;
    border-radius: 10px;
    border: 1px solid var(--border);
    background: var(--bg-elev);
    color: var(--text);
    text-decoration: none;
    font-weight: 600;
    line-height: 1;
}
.btn .icon-inline {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 1em;
}
.btn .icon-inline svg {
    display: block;
}
.btn.primary {
    background: linear-gradient(180deg, color-mix(in oklab, var(--primary), #fff 4%), var(--primary-600));
    border: none;
}
.btn.primary:hover {
    filter: brightness(1.05);
}
.btn.link {
    background: transparent;
    border: none;
    color: var(--primary);
    padding: 0;
}
.btn.link:hover {
    text-decoration: underline;
}
.icon-inline {
    display: inline-flex;
}

.tech-tags {
    list-style: none;
    padding: 0;
    margin: 18px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.tech-tags li {
    font-size: 12.5px;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--bg-elev), transparent 12%);
}

.hero-visual {
    position: relative;
    height: 320px;
    overflow: hidden;
}
.orb {
    position: absolute;
    border-radius: 999px;
    filter: blur(18px);
    opacity: 0.8;
    transition: opacity 0.6s ease;
}
.orb-a {
    width: 220px;
    height: 220px;
    background: radial-gradient(circle at 30% 30%, #7c5cff, transparent 60%);
    top: 10%;
    left: 10%;
}
.orb-b {
    width: 300px;
    height: 300px;
    background: radial-gradient(circle at 70% 70%, #19c37d, transparent 60%);
    bottom: 0;
    right: 5%;
}

.hero-photo {
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    pointer-events: none;
}
.hero-photo img {
    width: 320px;
    height: 320px;
    object-fit: cover;
    object-position: center;
    border-radius: 16px;
    opacity: 0;
    transform: scale(1.02);
    filter: blur(8px);
    transition: opacity 0.6s ease, filter 0.6s ease, transform 0.6s ease;
    box-shadow: var(--shadow);
}
.hero-photo.visible img {
    opacity: 1;
    filter: blur(0);
    transform: scale(1);
}

/* Spinner inicial */
.hero-photo::before {
    content: '';
    position: absolute;
    inset: 0;
    display: grid;
    place-items: center;
    background: transparent;
}
.hero-photo.loading::before {
    content: '';
}
.hero-photo.loading::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 36px;
    height: 36px;
    margin: -18px 0 0 -18px;
    border-radius: 50%;
    border: 3px solid color-mix(in oklab, var(--muted), transparent 60%);
    border-top-color: var(--primary);
    animation: spin 1s linear infinite;
}
@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* Sections */
.section {
    padding: 44px 0;
}
.section h2 {
    font-size: 26px;
    margin: 0 0 16px;
}
.muted {
    color: var(--muted);
}

/* Cards & grid */
.grid.projects {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 760px) {
    .grid.projects {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1100px) {
    .grid.projects {
        grid-template-columns: repeat(3, 1fr);
    }
}

.card {
    background: var(--card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.card-body {
    padding: 16px;
}
.card-header h3 {
    margin: 0 0 6px;
    font-size: 20px;
}
.card-footer {
    padding: 12px 16px 16px;
    margin-top: auto;
}

.badges {
    list-style: none;
    padding: 0;
    margin: 10px 0 0;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}
.badges li {
    font-size: 12.5px;
    color: var(--muted);
    border: 1px solid var(--border);
    padding: 6px 10px;
    border-radius: 999px;
    background: color-mix(in oklab, var(--bg-elev), transparent 12%);
}

/* Timeline */
.timeline {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
}
.timeline::before {
    content: '';
    position: absolute;
    left: 10px;
    top: 0;
    bottom: 0;
    width: 2px;
    background: var(--border);
}
.tl-item {
    position: relative;
    padding-left: 34px;
    margin: 20px 0;
}
.tl-dot {
    position: absolute;
    left: 2px;
    top: 6px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in oklab, var(--primary), transparent 80%);
}
.tl-content h3 {
    margin: 0;
    font-size: 18px;
}
.tl-content .muted {
    font-size: 14px;
}
.tl-content ul {
    margin: 8px 0 0;
    padding-left: 18px;
}

/* Skills */
.skills-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 16px;
}
@media (min-width: 760px) {
    .skills-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}
@media (min-width: 1100px) {
    .skills-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}
.skills-group h3 {
    margin: 0 0 8px;
    font-size: 16px;
    color: var(--muted);
}

/* Lists */
.list {
    padding-left: 18px;
}
.list li {
    margin: 6px 0;
}

/* Footer */
.site-footer {
    border-top: 1px solid var(--border);
    padding: 24px 0;
    margin-top: 24px;
    background: color-mix(in oklab, var(--bg), transparent 6%);
}
.site-footer p {
    color: var(--muted);
    text-align: center;
    margin: 0;
}

/* Responsive */
@media (max-width: 880px) {
    .hero {
        grid-template-columns: 1fr;
    }
    .hero-visual {
        order: -1;
        height: 200px;
    }
}
