/* =========================================================
   THEME.CSS - Identidad visual
   Capa sobre styles.css. Dirección: "instrumento de campo".
   El portafolio de un topógrafo debería parecerse a sus
   herramientas -estación total, libreta de campo, carta
   náutica- y no a una revista. De ahí la retícula visible,
   las coordenadas monoespaciadas y un único acento cian
   tomado de las pantallas de instrumental GNSS.
   ========================================================= */

/* ---------------------------------------------------------
   1. TOKENS
   Se redefinen las variables originales de styles.css para
   que el CSS antiguo herede la paleta nueva sin editarlo.
   --------------------------------------------------------- */
:root {
    /* Base: verdes oliva desaturados. Una sola familia de
       neutros, todos tintados en verde cálido (nunca mezclar
       con grises fríos). */
    --ink-900: #1c2118;
    --ink-800: #2b3327;
    --ink-700: #3a4434;
    --ink-600: #4c5745;
    --ink-400: #74806a;
    --ink-300: #9aa390;
    --ink-200: #c2c8b9;
    --ink-100: #dcdfd3;
    --paper:   #f0efe6;
    --paper-2: #e7e5d9;

    /* Acento único: terracota apagada. Saturación ~45%,
       bien por debajo del 80% que satura. */
    --signal:       #b4664a;
    --signal-bright:#c87a5c;
    --signal-deep:  #8f4d35;

    /* Compatibilidad con los nombres que usa styles.css */
    --topo-dark:   var(--ink-800);
    --topo-cream:  var(--paper);
    --topo-sand:   var(--ink-100);
    --topo-green:  var(--ink-700);
    --topo-blue:   #4a5f52;
    --topo-brown:  var(--ink-400);
    --accent-coral:  var(--signal);
    --accent-gold:   var(--signal-bright);
    --accent-orange: var(--signal);

    /* Superficies */
    --surface:        #faf9f3;
    --surface-2:      #e9e7db;
    --surface-sunken: #e3e1d4;
    --ink:            var(--ink-800);
    --ink-soft:       #56604c;
    --hairline:       rgba(43, 51, 39, .15);
    --grid-line:      rgba(43, 51, 39, .045);

    /* Sombras tintadas en oliva, nunca negro puro: el negro
       sobre una base cálida se ve sucio. */
    --shadow-sm: 0 1px 2px rgba(43, 51, 39, .07),
                 0 1px 3px rgba(43, 51, 39, .05);
    --shadow-md: 0 2px 4px rgba(43, 51, 39, .06),
                 0 10px 22px rgba(43, 51, 39, .09);
    --shadow-lg: 0 4px 8px rgba(43, 51, 39, .07),
                 0 24px 56px rgba(43, 51, 39, .16);
    --shadow-signal: 0 10px 30px rgba(180, 102, 74, .24);

    /* Radios variados por jerarquía, no uniformes. */
    --r-xs: 3px;
    --r-sm: 6px;
    --r-md: 10px;
    --r-lg: 16px;

    /* Curvas fuertes: las nativas del navegador son flojas.
       Nunca ease-in en UI (arranca lento = se siente lento). */
    --ease-out:    cubic-bezier(.23, 1, .32, 1);
    --ease-in-out: cubic-bezier(.77, 0, .175, 1);
    --ease: var(--ease-out);

    --t-press: 140ms;
    --t-fast:  180ms;
    --t-base:  240ms;
    --t-enter: 420ms;

    --nav-h: 64px;
    --shell: 1320px;

    /* Escala z, en vez de valores arbitrarios como 9999 */
    --z-grid: 0;
    --z-nav: 100;
    --z-menu: 110;
    --z-lightbox: 200;
}

:root[data-theme="dark"] {
    /* Oliva muy profundo, nunca negro puro: conserva la
       calidez de la paleta clara. */
    --paper:          #191d15;
    --paper-2:        #1f2419;
    --surface:        #242a1e;
    --surface-2:      #2e3527;
    --surface-sunken: #131710;
    --ink:            #e8e9dd;
    --ink-soft:       #adb5a2;
    --hairline:       rgba(232, 233, 221, .15);
    --grid-line:      rgba(232, 233, 221, .04);

    /* La terracota se aclara para mantener contraste AA
       sobre el fondo oscuro. */
    --signal:       #d08462;
    --signal-bright:#e09a78;
    --signal-deep:  #d08462;

    --topo-cream: var(--paper);
    --topo-dark:  #11150e;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, .5);
    --shadow-md: 0 10px 26px rgba(0, 0, 0, .55);
    --shadow-lg: 0 26px 60px rgba(0, 0, 0, .65);

    color-scheme: dark;
}

/* ---------------------------------------------------------
   2. BASE
   --------------------------------------------------------- */

/* styles.css aplica cursor:pointer !important a * - el sitio
   entero parecía clicable. Se restablece por rol. */
* { cursor: auto !important; }
a, button, summary, label, [role="button"], [onclick],
.gallery-item, .filter-btn, .project-locations-list li,
.lightbox-close, .lightbox-prev, .lightbox-next,
.nav-toggle, .theme-toggle {
    cursor: pointer !important;
}
input[type="text"], input[type="url"], input[type="email"], textarea {
    cursor: text !important;
}

/* El globo es arrastrable. La regla universal de arriba lleva
   !important, así que el style inline del JS no puede ganarle:
   el estado viaja en un data-attribute y el CSS resuelve el
   cursor con la misma prioridad. */
#globe-container canvas { cursor: grab !important; }
#globe-container canvas[data-dragging="true"] { cursor: grabbing !important; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--nav-h) + 20px);
    -webkit-text-size-adjust: 100%;
}

body {
    overflow-x: clip;   /* red de seguridad contra desbordes */
    background: var(--paper);
    color: var(--ink);
    /* Newsreader: serif humanista para lectura. Aporta la
       calidez que una grotesca pura no da, sin caer en el
       serif-display decorativo. */
    font-family: 'Newsreader', Georgia, 'Times New Roman', serif;
    font-size: 1.02rem;
    font-weight: 400;
    -webkit-font-smoothing: antialiased;
    transition: background var(--t-base) var(--ease-out),
                color var(--t-base) var(--ease-out);
}

/* Retícula de fondo: papel milimetrado de libreta de campo.
   Es la textura del oficio, no un adorno abstracto. */
body::before {
    content: '';
    position: fixed;
    inset: 0;
    z-index: var(--z-grid);
    pointer-events: none;
    background-image:
        linear-gradient(var(--grid-line) 1px, transparent 1px),
        linear-gradient(90deg, var(--grid-line) 1px, transparent 1px);
    background-size: 64px 64px;
}

/* Los fondos animados originales compiten con la retícula. */
.topo-bg, .urban-grid { display: none !important; }

:focus-visible {
    outline: 2px solid var(--signal);
    outline-offset: 3px;
    border-radius: var(--r-xs);
    transition: none; /* un foco que se desliza se pierde al tabular */
}

.skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 999;
    background: var(--signal);
    color: #1c2118;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .78rem;
    font-weight: 600;
    letter-spacing: .04em;
    padding: .85rem 1.3rem;
    text-decoration: none;
}
.skip-link:focus { left: 0; }

.scroll-progress {
    position: fixed;
    top: 0; left: 0;
    height: 2px;
    width: 0%;
    z-index: 150;
    background: var(--signal);
    pointer-events: none;
}

/* ---------------------------------------------------------
   3. TIPOGRAFÍA
   Bricolage Grotesque para display, Newsreader (serif
   humanista) para lectura e IBM Plex Mono para datos.
   El serif va en el párrafo, no en los titulares: así aporta
   calidez sin el gesto decorativo del serif-display.
   --------------------------------------------------------- */

/* Display: Bricolage Grotesque. Sans con carácter (ancho
   óptico variable), evita el "brief creativo = serif" y deja
   el serif donde rinde: el párrafo. */
h1, h2, h3, h4,
.hero-title, .hero-name, .section-title,
.contact-title, .timeline-title, .skill-title,
.profile-info h2, .gallery-overlay h3 {
    font-family: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
    font-weight: 700;
    letter-spacing: -0.025em; /* tracking negativo en display */
    line-height: 1.04;
    text-wrap: balance;
}

p { text-wrap: pretty; }

/* Datos, coordenadas y etiquetas: monoespaciada con tracking
   positivo. Las cifras alineadas usan tabular-nums. */
.coord-item, .coord-label, .coord-value,
.section-number, .gallery-tag, .timeline-year,
.skill-tag, .filter-btn, .footer-coords,
.location-badge, .profile-coords-badge,
.project-locations-list .location-type,
.logo, .hero-tag {
    font-family: 'IBM Plex Mono', ui-monospace, 'SF Mono', Menlo, monospace;
    font-variant-numeric: tabular-nums;
    letter-spacing: .08em;
}

/* Encabezado de sección: solo el título sobre una línea de
   retícula. Los números de sección ("01 / INDEX") se retiraron:
   enumeran en vez de nombrar, y su posición en la página ya
   dice al lector dónde está. */
.section-header {
    display: block;
    margin-bottom: clamp(2.5rem, 5vw, 4rem);
    padding-bottom: 1.1rem;
    border-bottom: 1px solid var(--hairline);
}

.section-number {
    font-size: .7rem;
    font-weight: 600;
    color: var(--signal);
    letter-spacing: .14em;
}

.section-title {
    font-size: clamp(1.9rem, 4.6vw, 3.4rem);
    color: var(--ink);
    margin: 0;
}

/* La línea decorativa sobra: el borde inferior ya separa. */
.section-line { display: none; }

section {
    position: relative;
    z-index: 1;
    /* Padding inferior mayor que el superior: corrección
       óptica, el ojo percibe simétrico lo que no lo es. */
    padding: clamp(3.5rem, 7vw, 6rem) clamp(1.25rem, 5vw, 3rem)
             clamp(4.5rem, 9vw, 7.5rem);
    max-width: var(--shell);
    margin-inline: auto;
}

/* ---------------------------------------------------------
   4. NAVEGACIÓN
   --------------------------------------------------------- */
nav {
    height: var(--nav-h);
    padding: 0 clamp(1rem, 4vw, 3rem);
    z-index: var(--z-nav);
    background: color-mix(in srgb, var(--paper) 88%, transparent);
    backdrop-filter: saturate(160%) blur(14px);
    -webkit-backdrop-filter: saturate(160%) blur(14px);
    border-bottom: 1px solid transparent;
    transition: border-color var(--t-base) var(--ease-out),
                background var(--t-base) var(--ease-out);
}
nav.is-scrolled { border-bottom-color: var(--hairline); }

.logo {
    font-size: .8rem;
    font-weight: 700;
    color: var(--ink);
    letter-spacing: .14em;
}

.logo-icon {
    width: 26px;
    height: 26px;
    border: 1.5px solid var(--signal);
    border-radius: 0;           /* cuadrado: marca de estación */
    color: var(--signal);
    font-size: .6rem;
    animation: none;            /* el pulso permanente distrae */
}

.nav-links { gap: 1.5rem; align-items: center; }

.nav-links a {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .74rem;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--ink-soft);
    text-transform: lowercase;  /* en vez de MAYÚSCULAS en todo */
    padding: .45rem 0;
    transition: color var(--t-fast) var(--ease-out);
}
.nav-links a:hover { color: var(--ink); }

.nav-links a::after {
    height: 1.5px;
    width: 100%;
    background: var(--signal);
    transform: scaleX(0);
    transform-origin: right;
    transition: transform var(--t-base) var(--ease-out);
}

/* Sólo en dispositivos con puntero fino: en táctil el hover
   se dispara al tocar y deja el estado pegado. */
@media (hover: hover) and (pointer: fine) {
    .nav-links a:hover::after {
        transform: scaleX(1);
        transform-origin: left;
    }
}

.nav-links a.is-active {
    color: var(--ink);
    font-weight: 700;
}
.nav-links a.is-active::after {
    transform: scaleX(1);
    transform-origin: left;
}

.nav-actions { display: flex; align-items: center; gap: .55rem; }

.theme-toggle {
    width: 34px;
    height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    background: transparent;
    color: var(--ink-soft);
    font-size: .95rem;
    transition: background var(--t-fast) var(--ease-out),
                color var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out),
                transform var(--t-press) var(--ease-out);
}
.theme-toggle:hover { color: var(--ink); border-color: var(--ink-300); }
.theme-toggle:active { transform: scale(.94); } /* feedback de presión */

.nav-toggle {
    display: none;
    width: 38px;
    height: 34px;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    color: var(--ink);
    font-size: 1rem;
    transition: transform var(--t-press) var(--ease-out),
                border-color var(--t-fast) var(--ease-out);
}
.nav-toggle:active { transform: scale(.94); }

@media (max-width: 900px) {
    .nav-toggle { display: inline-flex; }

    .nav-links {
        position: fixed;
        top: var(--nav-h);
        left: 0;
        right: 0;
        z-index: var(--z-menu);
        display: flex;
        flex-direction: column;
        gap: 0;
        padding: .4rem 0 1rem;
        background: var(--paper);
        border-bottom: 1px solid var(--hairline);
        box-shadow: var(--shadow-lg);
        /* Nunca desde scale(0)/desplazamiento total: entra
           desde una posición ya visible. */
        transform: translateY(-8px);
        opacity: 0;
        visibility: hidden;
        transition: transform var(--t-base) var(--ease-out),
                    opacity var(--t-fast) var(--ease-out),
                    visibility var(--t-base);
        max-height: calc(100dvh - var(--nav-h));
        overflow-y: auto;
    }
    .nav-links.open {
        position: fixed;
        padding: .4rem 0 1rem;
        gap: 0;
        background: var(--paper);
        transform: translateY(0);
        opacity: 1;
        visibility: visible;
        transition: transform var(--t-enter) var(--ease-out),
                    opacity var(--t-base) var(--ease-out),
                    visibility 0s;
    }
    .nav-links li { width: 100%; }
    .nav-links a {
        display: block;
        padding: .9rem clamp(1.25rem, 5vw, 3rem);
        font-size: .92rem;
        border-bottom: 1px solid var(--hairline);
    }
    .nav-links a.is-active {
        background: var(--surface-2);
        box-shadow: inset 2px 0 0 var(--signal);
    }
    /* Entrada escalonada: 30ms entre elementos. */
    .nav-links.open li {
        animation: navItem var(--t-base) var(--ease-out) backwards;
    }
    .nav-links.open li:nth-child(1) { animation-delay: 30ms; }
    .nav-links.open li:nth-child(2) { animation-delay: 60ms; }
    .nav-links.open li:nth-child(3) { animation-delay: 90ms; }
    .nav-links.open li:nth-child(4) { animation-delay: 120ms; }
    .nav-links.open li:nth-child(5) { animation-delay: 150ms; }
    .nav-links.open li:nth-child(6) { animation-delay: 180ms; }
    .nav-links.open li:nth-child(7) { animation-delay: 210ms; }
}

@keyframes navItem {
    from { opacity: 0; transform: translateY(-5px); }
    to   { opacity: 1; transform: none; }
}

/* ---------------------------------------------------------
   5. HERO
   Asimétrico: el texto ocupa 7 de 12 columnas y el globo
   las 5 restantes. Nada centrado.
   --------------------------------------------------------- */
.hero-globe {
    min-height: auto;            /* no 100vh: empuja todo fuera */
    padding: calc(var(--nav-h) + clamp(2.5rem, 6vw, 5rem))
             clamp(1.25rem, 5vw, 3rem) clamp(3rem, 7vw, 5.5rem);
    max-width: var(--shell);
    margin-inline: auto;
    background: transparent;     /* el degradado oscuro cortaba la página */
    overflow: visible;
}
.hero-globe::before, .hero-globe::after { display: none; }

.hero-globe-content {
    display: grid;
    /* El titular ahora va en 3 líneas y pide menos ancho, así
       que la columna del globo crece de 5fr a 6fr. */
    grid-template-columns: minmax(0, 6fr) minmax(0, 6fr);
    gap: clamp(1.5rem, 4vw, 3.5rem);
    align-items: center;
    max-width: none;
    padding: 0;
}

/* min-width:0 es necesario en hijos de grid: sin él, el
   contenido (un título largo) impone su ancho mínimo y
   desborda el viewport en móvil. */
.hero-text {
    color: var(--ink);
    display: flex;
    flex-direction: column;
    min-width: 0;
}
.hero-globe-content > * { min-width: 0; }

.hero-tag {
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    font-size: .66rem;
    font-weight: 600;
    letter-spacing: .16em;
    color: var(--signal-deep);
    margin-bottom: 1.5rem;
    order: 2;
}
.hero-tag::before {
    content: '';
    width: 22px;
    height: 1.5px;
    background: var(--signal);
}

/* El nombre es el dato de cabecera, no el titular. */
.hero-name {
    order: 1;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .76rem;
    font-weight: 500;
    letter-spacing: .1em;
    color: var(--ink-400);
    margin-bottom: .9rem;
}

.location-badge {
    order: 3;
    align-self: flex-start;
    display: inline-flex;
    align-items: center;
    gap: .6rem;
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    font-size: .66rem;
    font-weight: 500;
    padding: .5rem .85rem;
    margin-bottom: 1.5rem;
}
.location-badge .pulse {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--signal);
    animation: none;   /* el latido constante compite con la lectura */
}

.hero-title {
    order: 4;
    overflow-wrap: break-word;
    font-size: clamp(2.4rem, 7vw, 5.2rem);
    font-weight: 700;
    line-height: .98;
    letter-spacing: -0.045em;
    color: var(--ink);
    margin-bottom: 1.6rem;
}

/* Un solo acento, sin degradado multicolor. */
.hero-title .accent {
    color: var(--signal-deep);
    font-style: normal;
}

.hero-subtitle {
    order: 5;
    font-size: clamp(.95rem, 1.4vw, 1.05rem);
    line-height: 1.65;
    color: var(--ink-soft);
    max-width: 52ch;         /* ~65 caracteres */
    margin-bottom: 1.8rem;
    opacity: 1;
}

/* Coordenadas como lectura de instrumento: una fila con
   separadores, no tres tarjetas iguales. */
.coords {
    order: 6;
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    overflow: hidden;
    width: fit-content;
    max-width: 100%;
    margin-bottom: 0;
}
.coord-item {
    display: flex;
    align-items: baseline;
    gap: .5rem;
    padding: .6rem .95rem;
    border-right: 1px solid var(--hairline);
    background: var(--surface);
}
.coord-item:last-child { border-right: 0; }
.coord-label {
    font-size: .58rem;
    font-weight: 600;
    color: var(--ink-300);
}
.coord-value {
    font-size: .78rem;
    font-weight: 600;
    color: var(--ink);
}

.hero-actions {
    order: 7;
    display: flex;
    gap: .7rem;
    flex-wrap: wrap;
    margin-top: 1.8rem;
    opacity: 1;
    animation: none;
}

/* Botones: uno sólido, uno de contorno discreto. */
.btn {
    display: inline-flex;
    align-items: center;
    gap: .5rem;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .76rem;
    font-weight: 600;
    letter-spacing: .05em;
    text-decoration: none;
    padding: .8rem 1.4rem;
    border-radius: var(--r-sm);
    border: 1px solid transparent;
    transition: background var(--t-fast) var(--ease-out),
                color var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out),
                box-shadow var(--t-fast) var(--ease-out),
                transform var(--t-press) var(--ease-out);
}
.btn-primary {
    background: var(--signal-deep);
    color: #fff;
    box-shadow: none;
}

/* En modo oscuro la terracota se aclara para separarse del
   fondo, y entonces el texto blanco encima baja a 2.9:1.
   Se invierte la relación: texto oscuro sobre el acento
   claro, que recupera el contraste AA. */
:root[data-theme="dark"] .btn-primary {
    background: var(--signal-bright);
    color: #1c2118;
}
.btn-ghost {
    background: transparent;
    color: var(--ink);
    border-color: var(--hairline);
    backdrop-filter: none;
}

@media (hover: hover) and (pointer: fine) {
    .btn-primary:hover {
        background: var(--signal);
        box-shadow: var(--shadow-signal);
        transform: none;
    }
    .btn-ghost:hover {
        border-color: var(--ink-300);
        background: transparent;
        transform: none;
    }
}
/* scale(0.97) al presionar: la interfaz responde al tacto. */
.btn:active { transform: scale(.97); }

#globe-container {
    /* Cuadrado: una esfera en un contenedor apaisado se
       recorta arriba y abajo. styles.css fija height:500px,
       que gana al aspect-ratio; se libera con height:auto. */
    width: 100%;
    height: auto;
    aspect-ratio: 1;
    min-height: 0;
    max-height: 620px;
    position: relative;
}

/* styles.css baja la altura en pantallas chicas con la misma
   propiedad; aquí se mantiene el cuadrado en todos los anchos. */
@media (max-width: 1024px) {
    #globe-container { height: auto; }
}
@media (max-width: 768px) {
    #globe-container { height: auto; }
}

.globe-label {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .58rem;
    letter-spacing: .1em;
    color: var(--ink-300);
}

.scroll-cue { display: none; } /* con el hero corto, sobra */

@media (max-width: 900px) {
    .hero-globe-content { grid-template-columns: 1fr; }
    #globe-container { order: -1; min-height: 260px; }
}

/* ---------------------------------------------------------
   6. PERFIL
   --------------------------------------------------------- */
.profile-section {
    position: relative;
    max-width: var(--shell);
    margin-inline: auto;
    padding: clamp(3rem, 6vw, 5rem) clamp(1.25rem, 5vw, 3rem);
    background: transparent;
}

/* La foto de fondo a pantalla completa creaba un bloque
   oscuro a mitad de una página clara. Se retira. */
.profile-bg-image, .profile-bg-overlay { display: none !important; }

.profile-content {
    display: grid;
    grid-template-columns: minmax(0, 4fr) minmax(0, 7fr);
    gap: clamp(1.8rem, 4vw, 3.5rem);
    align-items: start;
    max-width: none;
    padding: 0;
}

.profile-image-container { position: relative; }

.profile-image {
    width: 100%;
    height: auto;
    border-radius: var(--r-md);
    display: block;
    filter: none;
    border: 0;
}
.profile-frame { display: none; }

.profile-coords-badge {
    position: absolute;
    left: .7rem;
    bottom: .7rem;
    background: var(--ink-900);
    color: var(--ink-100);
    font-size: .58rem;
    font-weight: 500;
    padding: .34rem .6rem;
    border-radius: var(--r-xs);
}

.profile-info h2 {
    font-size: clamp(1.5rem, 3vw, 2.2rem);
    color: var(--ink);
    margin-bottom: 1.1rem;
}
.profile-info p {
    color: var(--ink-soft);
    font-size: .96rem;
    line-height: 1.72;
    max-width: 62ch;
    margin-bottom: 1rem;
}
.profile-info strong { color: var(--ink); font-weight: 600; }

/* Cifras: dato grande + etiqueta, sobre una línea común. */
.profile-stats {
    display: flex;
    flex-wrap: wrap;
    gap: 0;
    margin-top: 1.6rem;
    border-top: 1px solid var(--hairline);
}
.profile-stat {
    padding: 1rem 1.6rem 1rem 0;
    margin-right: 1.6rem;
    border-right: 1px solid var(--hairline);
    background: transparent;
    border-radius: 0;
}
.profile-stat:last-child { border-right: 0; margin-right: 0; }
.profile-stat:hover { transform: none; }
.profile-stat-number {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-variant-numeric: tabular-nums;
    font-size: 1.6rem;
    font-weight: 700;
    color: var(--ink);
    line-height: 1;
}
.profile-stat-label {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .58rem;
    font-weight: 500;
    letter-spacing: .1em;
    color: var(--ink-300);
    margin-top: .35rem;
}

@media (max-width: 800px) {
    .profile-content { grid-template-columns: 1fr; }
    .profile-image-container { max-width: 280px; }
}

/* ---------------------------------------------------------
   7. HABILIDADES
   Rejilla continua: las tarjetas comparten líneas en vez de
   flotar como tres bloques iguales con borde y sombra.
   --------------------------------------------------------- */
.skills { background: transparent; }

.skills-container {
    display: grid;
    /* 3 columnas fijas: hay 6 tarjetas, así llenan exactamente
       dos filas. Con auto-fit quedaban 4 columnas y la última
       fila dejaba dos huecos grises. */
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 1px;                       /* la rejilla es la separación */
    background: var(--hairline);
    border: 1px solid var(--hairline);
    border-radius: var(--r-lg);
    overflow: hidden;
    max-width: none;
}

.skill-card {
    background: var(--surface);
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 1.9rem 1.6rem;
    overflow: hidden;
    transition: background var(--t-fast) var(--ease-out);
}
.skill-card::before { display: none; }
.skill-card:hover { transform: none; box-shadow: none; }

@media (max-width: 960px) {
    .skills-container { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 620px) {
    .skills-container { grid-template-columns: 1fr; }
}

@media (hover: hover) and (pointer: fine) {
    .skill-card:hover { background: var(--surface-2); }
}

.skill-icon {
    font-size: 1.05rem;
    width: 34px;
    height: 34px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--hairline);
    border-radius: var(--r-xs);
    background: transparent;
    margin-bottom: 1.1rem;
    filter: grayscale(1) contrast(.85);
    opacity: .7;
    transition: filter var(--t-base) var(--ease-out),
                opacity var(--t-base) var(--ease-out);
}
.skill-card:hover .skill-icon { filter: none; opacity: 1; }

.skill-title {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .6rem;
}
.skill-desc {
    font-size: .87rem;
    line-height: 1.62;
    color: var(--ink-soft);
    margin-bottom: 1.1rem;
}

.skill-tags { display: flex; flex-wrap: wrap; gap: .32rem; }

.skill-tag {
    font-size: .58rem;
    font-weight: 500;
    letter-spacing: .07em;
    padding: .26rem .55rem;
    border-radius: var(--r-xs);
    border: 1px solid var(--hairline);
    background: transparent;
    color: var(--ink-400);
    transition: color var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .skill-tag:hover { color: var(--signal-deep); border-color: var(--signal); }
}

/* ---------------------------------------------------------
   8. GALERÍA
   --------------------------------------------------------- */
.photo-gallery {
    background: transparent;
    color: var(--ink);
}

.gallery-intro, .webdev-intro {
    max-width: 58ch;
    margin: 0 0 clamp(2rem, 4vw, 3rem);  /* alineado a la izquierda */
    text-align: left;
    color: var(--ink-soft);
    font-size: .95rem;
    line-height: 1.7;
    opacity: 1;
}

.gallery-grid { gap: 2px; grid-auto-rows: clamp(140px, 14vw, 200px); }

.gallery-item {
    position: relative;
    overflow: hidden;
    border-radius: var(--r-sm);
    box-shadow: none;
    background: var(--surface-2);
    transition: none;
}
.gallery-item:hover { transform: none; box-shadow: none; }

.gallery-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    transition: transform 520ms var(--ease-out);
}

/* El velo sube desde abajo; el texto no tapa la foto. */
.gallery-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    gap: .3rem;
    padding: 1rem;
    background: linear-gradient(to top,
        rgba(9, 13, 17, .92) 0%,
        rgba(9, 13, 17, .66) 34%,
        rgba(9, 13, 17, .08) 72%,
        transparent 100%);
    opacity: 0;
    transition: opacity var(--t-base) var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
    .gallery-item:hover img { transform: scale(1.05); }
    .gallery-item:hover .gallery-overlay { opacity: 1; }
}
.gallery-item:focus-within .gallery-overlay { opacity: 1; }
.gallery-item:focus-visible img { transform: scale(1.05); }
@media (hover: none) { .gallery-overlay { opacity: 1; } }

.gallery-overlay h3 {
    font-size: .95rem;
    font-weight: 700;
    color: #fff;
    letter-spacing: -0.015em;
}
.gallery-overlay p {
    font-size: .74rem;
    line-height: 1.45;
    color: rgba(255,255,255,.76);
}

/* Etiqueta cuadrada, no píldora. */
.gallery-tag {
    align-self: flex-start;
    font-size: .54rem;
    font-weight: 600;
    letter-spacing: .1em;
    padding: .22rem .45rem;
    border-radius: var(--r-xs);
    background: var(--signal);
    color: #1c2118;
}

@media (max-width: 900px) {
    .gallery-grid { grid-template-columns: repeat(2, 1fr); }
    .gallery-grid > .gallery-item {
        grid-column: auto !important;
        grid-row: auto !important;
    }
}
@media (max-width: 560px) {
    .gallery-grid { grid-template-columns: 1fr; }
}

/* ---------------------------------------------------------
   9. DESARROLLO WEB
   --------------------------------------------------------- */
.webdev-section {
    background: transparent;
    color: var(--ink);
}
.webdev-section .section-title { color: var(--ink); }
.webdev-section .webdev-intro { color: var(--ink-soft); }
.webdev-section .webdev-intro strong { color: var(--ink); font-weight: 600; }

.webdev-filter {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .35rem;
    margin-bottom: 2rem;
}

.filter-btn {
    background: transparent;
    border: 1px solid var(--hairline);
    border-radius: var(--r-sm);
    color: var(--ink-soft);
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .06em;
    padding: .5rem 1rem;
    transition: background var(--t-fast) var(--ease-out),
                color var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out),
                transform var(--t-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .filter-btn:hover { color: var(--ink); border-color: var(--ink-300); }
}
.filter-btn:active { transform: scale(.97); }
.filter-btn.active {
    background: var(--ink-800);
    border-color: var(--ink-800);
    color: var(--paper);
    box-shadow: none;
}
:root[data-theme="dark"] .filter-btn.active {
    background: var(--signal);
    border-color: var(--signal);
    color: #1c2118;
}

/* ---------------------------------------------------------
   10. EXPERIENCIA
   Lista cronológica a un lado: el zigzag central obliga a
   leer en zigzag y se rompe en móvil.
   --------------------------------------------------------- */
.experience { background: transparent; }

.timeline { max-width: none; position: relative; }
.timeline::before {
    left: 0;
    width: 1px;
    background: var(--hairline);
    transform: none;
}

.timeline-item,
.timeline-item:nth-child(even) {
    display: block;
    padding: 0 0 0 clamp(1.5rem, 4vw, 2.5rem);
    margin-bottom: 0;
    justify-content: flex-start;
}

.timeline-content {
    max-width: 68ch;
    background: transparent;
    border: 0;
    border-bottom: 1px solid var(--hairline);
    border-radius: 0;
    box-shadow: none;
    padding: 1.6rem 0;
    transition: none;
}
.timeline-content:hover { transform: none; box-shadow: none; }

.timeline-item:last-child .timeline-content { border-bottom: 0; }

.timeline-item:nth-child(odd) .timeline-dot,
.timeline-item:nth-child(even) .timeline-dot {
    left: -4px;
    right: auto;
    top: 2.35rem;
    width: 7px;
    height: 7px;
    background: var(--signal);
    border: 0;
    border-radius: 50%;
    box-shadow: 0 0 0 3px var(--paper);
}

.timeline-year {
    display: inline-block;
    font-size: .62rem;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--signal-deep);
    background: transparent;
    padding: 0;
    margin-bottom: .45rem;
}
.timeline-title {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: .3rem;
}
.timeline-company {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .72rem;
    font-weight: 500;
    color: var(--ink-400);
    margin-bottom: .7rem;
}
.timeline-desc {
    font-size: .89rem;
    line-height: 1.68;
    color: var(--ink-soft);
    opacity: 1;
    max-width: 64ch;
}

/* ---------------------------------------------------------
   11. MAPA
   --------------------------------------------------------- */
.map-section { background: transparent; }
.map-section .section-title { color: var(--ink); }
.map-info h3 {
    font-size: 1.1rem;
    color: var(--ink);
    margin-bottom: .7rem;
}
.map-info p {
    color: var(--ink-soft);
    font-size: .92rem;
    line-height: 1.7;
    max-width: 50ch;
}

#bolivia-map {
    border-radius: var(--r-md);
    overflow: hidden;
    border: 1px solid var(--hairline);
    box-shadow: none;
    background: var(--surface-2);
}

/* Los tiles de OSM son claros y encajan con la página; en
   modo oscuro se invierten para no deslumbrar. */
:root[data-theme="dark"] #bolivia-map .leaflet-tile-pane {
    filter: invert(1) hue-rotate(180deg) brightness(.9) contrast(.92) saturate(.5);
}
#bolivia-map .leaflet-marker-pane,
#bolivia-map .leaflet-popup-pane,
#bolivia-map .leaflet-overlay-pane { filter: none; }

#bolivia-map .leaflet-control-attribution {
    background: color-mix(in srgb, var(--surface) 88%, transparent);
    color: var(--ink-400);
    font-size: .62rem;
}
#bolivia-map .leaflet-control-attribution a { color: var(--signal-deep); }

.project-locations-list li {
    border-radius: var(--r-xs);
    border-bottom: 1px solid var(--hairline);
    color: var(--ink);
    transition: background var(--t-fast) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .project-locations-list li:hover { background: var(--surface-2); transform: none; }
}
.project-locations-list .location-name { color: var(--ink); }
.project-locations-list .location-type {
    font-size: .58rem;
    letter-spacing: .1em;
    color: var(--signal-deep);
}

/* ---------------------------------------------------------
   12. CONTACTO
   --------------------------------------------------------- */
.contact {
    background: var(--ink-800);
    color: var(--ink-100);
    text-align: left;
    max-width: none;
    padding: clamp(4rem, 8vw, 6.5rem) clamp(1.25rem, 5vw, 3rem);
}
.contact > * { max-width: var(--shell); margin-inline: auto; }

.contact-title {
    font-size: clamp(1.9rem, 5vw, 3.4rem);
    color: #fff;
    margin-bottom: 1rem;
}
.contact-subtitle {
    color: var(--ink-200);
    font-size: .98rem;
    line-height: 1.7;
    max-width: 54ch;
    margin: 0 auto 2.5rem 0;
    opacity: 1;
}

.contact-links {
    display: flex;
    flex-wrap: wrap;
    justify-content: flex-start;
    gap: .5rem;
}

.contact-link {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .74rem;
    font-weight: 500;
    letter-spacing: .04em;
    color: var(--ink-100);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--r-sm);
    padding: .72rem 1.1rem;
    background: transparent;
    backdrop-filter: none;
    transition: background var(--t-fast) var(--ease-out),
                color var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out),
                transform var(--t-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .contact-link:hover {
        background: var(--signal);
        border-color: var(--signal);
        color: #1c2118;
        transform: none;
        box-shadow: none;
    }
}
.contact-link:active { transform: scale(.97); }

/* ---------------------------------------------------------
   13. PIE
   --------------------------------------------------------- */
footer {
    background: var(--ink-900);
    color: var(--ink-400);
    text-align: left;
    padding: 2rem clamp(1.25rem, 5vw, 3rem);
    border-top: 1px solid rgba(255,255,255,.07);
}
footer > * { max-width: var(--shell); margin-inline: auto; }
.footer-coords {
    font-size: .64rem;
    letter-spacing: .1em;
    color: var(--signal-deep);
    margin-bottom: .4rem;
}
.footer-copy { font-size: .76rem; color: var(--ink-400); }

/* ---------------------------------------------------------
   14. ENTRADA POR SCROLL
   Desplazamiento corto; un recorrido largo delata la
   animación y retrasa la lectura.
   --------------------------------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(10px);
    transition: opacity var(--t-enter) var(--ease-out),
                transform var(--t-enter) var(--ease-out);
}
.reveal.active { opacity: 1; transform: none; }

/* Escalonado de 40ms: por encima de ~150ms total se percibe
   como espera, no como ritmo. */
.gallery-item.reveal:nth-child(3n+2) { transition-delay: 40ms; }
.gallery-item.reveal:nth-child(3n+3) { transition-delay: 80ms; }
.skill-card.reveal:nth-child(3n+2)   { transition-delay: 40ms; }
.skill-card.reveal:nth-child(3n+3)   { transition-delay: 80ms; }

/* ---------------------------------------------------------
   15. LIGHTBOX
   --------------------------------------------------------- */
.lightbox {
    z-index: var(--z-lightbox);
    background: rgba(9, 13, 17, .95);
    backdrop-filter: blur(6px);
    transition: opacity var(--t-base) var(--ease-out),
                visibility var(--t-base);
}
.lightbox-img {
    border: 0;
    border-radius: var(--r-sm);
    /* Nunca desde scale(0): nada aparece de la nada. */
    transform: scale(.97);
    opacity: .6;
    transition: transform var(--t-enter) var(--ease-out),
                opacity var(--t-base) var(--ease-out);
}
.lightbox.active .lightbox-img { transform: scale(1); opacity: 1; }

.lightbox-close, .lightbox-prev, .lightbox-next {
    background: rgba(255,255,255,.08);
    border: 1px solid rgba(255,255,255,.16);
    border-radius: var(--r-sm);
    color: #fff;
    transition: background var(--t-fast) var(--ease-out),
                transform var(--t-press) var(--ease-out);
}
@media (hover: hover) and (pointer: fine) {
    .lightbox-close:hover, .lightbox-prev:hover, .lightbox-next:hover {
        background: var(--signal);
        border-color: var(--signal);
        color: #1c2118;
        transform: none;
    }
}
.lightbox-close:active, .lightbox-prev:active, .lightbox-next:active {
    transform: scale(.94);
}
.lightbox-caption {
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .72rem;
    color: rgba(255,255,255,.72);
}

/* ---------------------------------------------------------
   16. MOVIMIENTO REDUCIDO
   Menos movimiento, no ausencia de respuesta: se conservan
   opacidad y color, que no producen sensación de traslado.
   --------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    html { scroll-behavior: auto; }
    .reveal { opacity: 1 !important; transform: none !important; transition: none !important; }
    .gallery-item:hover img,
    .btn:active, .filter-btn:active, .contact-link:active,
    .theme-toggle:active, .nav-toggle:active,
    .lightbox-img { transform: none !important; }
    .nav-links.open li { animation: none !important; }
    .gallery-overlay, .lightbox { transition-duration: 100ms !important; }
}

/* ---------------------------------------------------------
   17. IMPRESIÓN
   --------------------------------------------------------- */
@media print {
    nav, .scroll-progress, .theme-toggle, .nav-toggle,
    .lightbox, #globe-container, .hero-actions { display: none !important; }
    body { background: #fff; color: #000; }
    body::before { display: none; }
    .reveal { opacity: 1 !important; transform: none !important; }
    section { padding: 1.2rem 0; page-break-inside: avoid; }
}

/* ---------------------------------------------------------
   18. TARJETAS DE PROYECTO
   El HTML trae estilos embebidos con degradados morado/azul,
   Playfair y puntos que laten: la "estética IA" que rompe
   esta identidad. Se reconducen al mismo sistema, sin tocar
   el marcado. Un solo acento, superficies planas, sin pulsos.
   --------------------------------------------------------- */

.electoral-featured,
.electoral-featured.ef-cyan {
    background: var(--surface) !important;
    border: 1px solid var(--hairline) !important;
    border-radius: var(--r-lg) !important;
    box-shadow: none !important;
    min-height: 0;
    transition: background var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out) !important;
}
/* Los velos radiales de color y las partículas sobran. */
.electoral-featured::before,
.electoral-featured.ef-cyan::before,
.ef-particles { display: none !important; }

@media (hover: hover) and (pointer: fine) {
    .electoral-featured:hover,
    .electoral-featured.ef-cyan:hover {
        transform: none !important;
        background: var(--surface-2) !important;
        border-color: var(--ink-300) !important;
        box-shadow: none !important;
    }
}

.ef-content { padding: 1.5rem; gap: 1.1rem; }

.ef-title {
    font-family: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif !important;
    font-size: 1.15rem !important;
    font-weight: 700;
    letter-spacing: -0.025em;
    color: var(--ink) !important;
}

.ef-desc {
    font-size: .86rem;
    line-height: 1.6;
    color: var(--ink-soft) !important;
    max-width: 64ch;
}

/* Insignia cuadrada y sin punto parpadeante: un indicador que
   late permanentemente compite con la lectura. */
.ef-badge {
    font-family: 'IBM Plex Mono', ui-monospace, monospace !important;
    font-size: .55rem !important;
    font-weight: 600;
    letter-spacing: .1em;
    color: var(--signal-deep) !important;
    background: transparent !important;
    border: 1px solid var(--hairline) !important;
    border-radius: var(--r-xs) !important;
    padding: .24rem .5rem !important;
}
.ef-badge::before { display: none !important; }

.ef-icon-wrap,
.ef-cyan .ef-icon-wrap {
    background: var(--surface-2) !important;
    border: 1px solid var(--hairline) !important;
    border-radius: var(--r-sm) !important;
    animation: none !important;   /* sin pulso permanente */
    box-shadow: none !important;
}

.ef-arrow,
.ef-cyan .ef-arrow {
    background: transparent !important;
    border: 1px solid var(--hairline) !important;
    border-radius: var(--r-sm) !important;
    color: var(--ink-soft);
    transition: background var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out) !important;
}
.ef-arrow svg { stroke: var(--ink-soft) !important; }

@media (hover: hover) and (pointer: fine) {
    .electoral-featured:hover .ef-arrow {
        background: var(--signal) !important;
        border-color: var(--signal) !important;
        transform: none !important;
    }
    .electoral-featured:hover .ef-arrow svg { stroke: #1c2118 !important; }
}

/* --- Tarjetas normales de proyecto --- */
.webdev-card {
    background: var(--surface);
    border: 1px solid var(--hairline);
    border-radius: var(--r-md);
    box-shadow: none;
    overflow: hidden;
    transition: background var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out);
}
.webdev-card::before { display: none; }

@media (hover: hover) and (pointer: fine) {
    .webdev-card:hover {
        transform: none;
        background: var(--surface-2);
        border-color: var(--ink-300);
        box-shadow: none;
    }
}

.webdev-card-header {
    background: var(--surface-2);
    border-bottom: 1px solid var(--hairline);
}

.webdev-card-body h3 {
    font-family: 'Bricolage Grotesque', 'Helvetica Neue', Arial, sans-serif;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--ink);
}
.webdev-card-body p {
    font-size: .85rem;
    line-height: 1.6;
    color: var(--ink-soft);
}

/* ---------------------------------------------------------
   19. TOOLTIP DEL GLOBO
   Aparece junto al puntero al señalar un continente. Sin
   retardo de entrada: el usuario ya está apuntando, esperar
   se sentiría lento. Sale con la misma rapidez.
   --------------------------------------------------------- */
#globe-container { position: relative; }

.globe-tooltip {
    position: absolute;
    z-index: 5;
    pointer-events: none;            /* nunca roba el hover */
    transform: translate(14px, -50%) scale(.97);
    opacity: 0;
    white-space: nowrap;
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .68rem;
    font-weight: 500;
    letter-spacing: .08em;
    /* Valores fijos, no tokens: el tooltip siempre va sobre el
       globo oscuro, en los dos temas. Con var(--paper) el texto
       se volvía casi negro en modo oscuro y no se leía. */
    color: #f4f3ec;
    background: rgba(20, 24, 17, .95);
    border: 1px solid rgba(244, 243, 236, .22);
    border-radius: var(--r-xs);
    padding: .32rem .6rem;
    backdrop-filter: blur(4px);
    transition: opacity var(--t-fast) var(--ease-out),
                transform var(--t-fast) var(--ease-out);
}

.globe-tooltip[data-visible="true"] {
    opacity: 1;
    transform: translate(14px, -50%) scale(1);
}

@media (prefers-reduced-motion: reduce) {
    .globe-tooltip { transition-duration: 60ms; }
}

/* ---------------------------------------------------------
   20. LEYENDA DE CONTINENTES
   Va junto al globo. Al señalar una fila se resalta el
   continente, y al señalar el globo se marca la fila: los dos
   sentidos comparten el mismo estado.
   --------------------------------------------------------- */
.globe-wrap {
    display: grid;
    /* El globo manda: conserva su tamaño y la leyenda ocupa lo
       que necesita. Con 1fr la leyenda lo estrangulaba. */
    grid-template-columns: minmax(320px, 1fr) max-content;
    align-items: center;
    gap: clamp(.6rem, 1.5vw, 1.2rem);
}

/* El canvas nunca debe exceder su columna. */
#globe-container canvas { max-width: 100%; display: block; }

.globe-legend {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.legend-btn {
    display: flex;
    align-items: center;
    gap: .55rem;
    width: 100%;
    padding: .42rem .6rem;
    background: transparent;
    border: 1px solid transparent;
    border-radius: var(--r-xs);
    font-family: 'IBM Plex Mono', ui-monospace, monospace;
    font-size: .64rem;
    font-weight: 500;
    letter-spacing: .06em;
    color: var(--ink-400);
    text-align: left;
    white-space: nowrap;
    transition: color var(--t-fast) var(--ease-out),
                background var(--t-fast) var(--ease-out),
                border-color var(--t-fast) var(--ease-out),
                transform var(--t-base) var(--ease-out);
}

/* El punto de color es el vínculo con el globo. */
.legend-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 2px;
    opacity: .55;
    transition: opacity var(--t-fast) var(--ease-out),
                transform var(--t-base) var(--ease-out);
}

/* Fila activa: crece igual que el continente en el globo,
   para que el vínculo entre ambos se lea sin explicación. */
.legend-btn.is-active {
    color: var(--ink);
    background: var(--surface-2);
    border-color: var(--hairline);
    transform: translateX(3px);
}
.legend-btn.is-active .legend-dot {
    opacity: 1;
    transform: scale(1.3);
}

.legend-btn:active { transform: translateX(3px) scale(.98); }

@media (hover: hover) and (pointer: fine) {
    .legend-btn:hover { color: var(--ink); }
}

/* En pantallas estrechas la leyenda pasa debajo del globo y
   se reparte en filas, en vez de comprimir el globo. */
@media (max-width: 1100px) {
    .globe-wrap { grid-template-columns: 1fr; }
    .globe-legend {
        flex-direction: row;
        flex-wrap: wrap;
        justify-content: center;
        gap: .25rem;
    }
    .legend-btn { width: auto; }
    .legend-btn.is-active { transform: none; }
    .legend-btn:active { transform: scale(.98); }
}

@media (prefers-reduced-motion: reduce) {
    .legend-btn, .legend-dot { transition-duration: 80ms; }
    .legend-btn.is-active { transform: none; }
}
