:root {
    --paper: #EDF0F3;
    --surface: #F8FAFC;
    --ink: #18212C;
    --muted: #56616F;
    --rule: #C9D0D8;
    --signal: #1F66D1;
    --signal-soft: #DCE7F7;
    --error: #B8402A;
    --sans: "Schibsted Grotesk", system-ui, -apple-system, "Segoe UI", sans-serif;
    --mono: "JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
    color-scheme: light dark;
}

@media (prefers-color-scheme: dark) {
    :root {
        --paper: #141A22;
        --surface: #1A222C;
        --ink: #E6EBF1;
        --muted: #97A3B2;
        --rule: #2D3846;
        --signal: #5E9DFF;
        --signal-soft: #1F3150;
        --error: #F07A62;
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    background: var(--paper);
    color: var(--ink);
    font-family: var(--sans);
    font-size: 1.0625rem;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.page {
    max-width: 70rem;
    margin: 0 auto;
    padding: 5rem 1.5rem 3rem;
}

a {
    color: inherit;
    text-decoration-color: var(--signal);
    text-decoration-thickness: 2px;
    text-underline-offset: 0.2em;
}

a:hover { color: var(--signal); }

:focus-visible {
    outline: 3px solid var(--signal);
    outline-offset: 3px;
    border-radius: 2px;
}

code { font-family: var(--mono); font-size: 0.85em; }

/* Cabecera */

h1 {
    font-size: clamp(3rem, 9vw, 6rem);
    font-weight: 800;
    line-height: 0.92;
    letter-spacing: -0.04em;
    margin: 0 0 1.5rem;
}

.lede {
    font-size: 1.3rem;
    line-height: 1.45;
    color: var(--muted);
    max-width: 36rem;
    margin: 0;
}

/* Recorrido de la visita */

.pipeline { margin: 4rem 0 0; }

.pipeline figcaption {
    max-width: 38rem;
    margin: 0 0 1.25rem;
}

.flow {
    list-style: none;
    margin: 0;
    padding: 0;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 2rem;
}

.node {
    position: relative;
    background: var(--surface);
    border: 1px solid var(--rule);
    border-radius: 10px;
    padding: 1.1rem 1.2rem 1.2rem;
    transition: border-color 0.35s ease;
}

.node:not(:last-child)::after {
    content: "";
    position: absolute;
    top: 2.15rem;
    right: calc(-2rem - 1px);
    width: 2rem;
    height: 2px;
    background: var(--rule);
    transition: background 0.35s ease;
}

.node h3 {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.node .tech {
    color: var(--muted);
    font-size: 0.92rem;
    margin: 0.1rem 0 1rem;
}

.node .status {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    font-family: var(--mono);
    font-size: 0.8rem;
    color: var(--muted);
    margin: 0;
}

.node .status::before {
    content: "";
    flex: none;
    width: 0.55rem;
    height: 0.55rem;
    border-radius: 50%;
    background: var(--rule);
}

.node.is-active { border-color: var(--signal); }
.node.is-active .status::before {
    background: var(--signal);
    animation: pulse 0.9s ease-in-out infinite;
}

.node.is-done { border-color: var(--signal); }
.node.is-done .status { color: var(--ink); }
.node.is-done .status::before { background: var(--signal); }
.node.is-done:not(:last-child)::after { background: var(--signal); }

.node.is-failed .status { color: var(--error); }
.node.is-failed .status::before { background: var(--error); }

@keyframes pulse {
    50% { opacity: 0.25; }
}

/* Secciones */

.section {
    display: grid;
    grid-template-columns: 15rem minmax(0, 1fr);
    gap: 2.5rem;
    padding: 4.5rem 0;
    border-top: 1px solid var(--rule);
}

.hero-wrap { padding-bottom: 4.5rem; }

h2 {
    font-size: 1.6rem;
    font-weight: 700;
    line-height: 1.15;
    letter-spacing: -0.02em;
    margin: 0;
}

.prose p {
    max-width: 38rem;
    margin: 0 0 1rem;
}

.prose p:last-child { margin-bottom: 0; }

/* Estadísticas */

.summary {
    font-size: 1.3rem;
    line-height: 1.4;
    max-width: 36rem;
    margin: 0 0 2rem;
}

.summary strong { font-variant-numeric: tabular-nums; }

.countries {
    list-style: none;
    margin: 0;
    padding: 0;
    max-width: 42rem;
}

.country {
    display: grid;
    grid-template-columns: minmax(9rem, 13rem) minmax(0, 1fr) 3rem;
    gap: 1rem;
    align-items: center;
    padding: 0.6rem 0;
    border-bottom: 1px solid var(--rule);
}

.country-name {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    min-width: 0;
}

.country-name span:last-child {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.bar {
    height: 0.6rem;
    background: var(--signal-soft);
    border-radius: 999px;
    overflow: hidden;
}

.bar span {
    display: block;
    height: 100%;
    background: var(--signal);
    border-radius: inherit;
}

.count {
    text-align: right;
    font-weight: 500;
    font-variant-numeric: tabular-nums;
}

.note {
    color: var(--muted);
    font-size: 0.92rem;
    max-width: 38rem;
    margin: 1.5rem 0 0;
}

/* Experiencia */

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

.job {
    display: grid;
    grid-template-columns: 8.5rem minmax(0, 1fr);
    gap: 1.5rem;
    padding: 1.4rem 0;
    border-bottom: 1px solid var(--rule);
}

.job:first-child { padding-top: 0; }
.job:last-child { border-bottom: 0; padding-bottom: 0; }

.when {
    color: var(--muted);
    font-size: 0.95rem;
    font-variant-numeric: tabular-nums;
    padding-top: 0.15rem;
}

.job h3 {
    font-size: 1.15rem;
    font-weight: 700;
    line-height: 1.3;
    margin: 0;
}

.job .where {
    color: var(--muted);
    margin: 0 0 0.5rem;
}

.job p:last-child {
    max-width: 40rem;
    margin: 0;
}

/* Stack */

.stack {
    display: grid;
    grid-template-columns: 9rem minmax(0, 1fr);
    gap: 0.9rem 1.5rem;
    margin: 0;
    max-width: 44rem;
}

.stack dt { font-weight: 700; }
.stack dd { margin: 0; }

/* Contacto y pie */

.contact-links {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem 2rem;
    font-size: 1.15rem;
    font-weight: 500;
    margin: 0;
    padding: 0;
    list-style: none;
}

footer {
    border-top: 1px solid var(--rule);
    padding-top: 1.5rem;
    color: var(--muted);
    font-size: 0.875rem;
}

footer p { margin: 0 0 0.35rem; }

/* Móvil */

@media (max-width: 780px) {
    .page { padding-top: 3rem; }

    .flow {
        grid-template-columns: 1fr;
        gap: 1.25rem;
    }

    .node:not(:last-child)::after {
        top: auto;
        right: auto;
        bottom: calc(-1.25rem - 1px);
        left: 1.6rem;
        width: 2px;
        height: 1.25rem;
    }

    .section {
        grid-template-columns: 1fr;
        gap: 1.5rem;
        padding: 3.5rem 0;
    }

    .job, .stack {
        grid-template-columns: 1fr;
        gap: 0.25rem;
    }

    .stack dd { margin-bottom: 0.75rem; }

    .country {
        grid-template-columns: minmax(0, 1fr) 3rem;
        row-gap: 0.4rem;
    }

    .country .bar { grid-column: 1 / -1; grid-row: 2; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation: none !important;
        transition: none !important;
    }
}
