/* ==========================================================================
   base.css — Reset, tipografía base y primitivas de layout
   ========================================================================== */

*,
*::before,
*::after {
    box-sizing: border-box;
}

* {
    margin: 0;
}

html {
    scroll-behavior: smooth;
    /* Evita que el nav fijo tape el título de la sección al navegar por anclas */
    scroll-padding-top: calc(var(--nav-h) + var(--sp-5));
    -webkit-text-size-adjust: 100%;
}

/*
 * El color base va en <html>, no en <body>, para que las dos capas decorativas
 * de abajo (pseudoelementos de body con z-index negativo) queden por encima
 * del color y por debajo del contenido.
 */
html {
    background-color: var(--bg);
}

body {
    position: relative;
    font-family: var(--font-sans);
    font-size: var(--fs-base);
    line-height: 1.65;
    color: var(--text);
    background-color: transparent;
    -webkit-font-smoothing: antialiased;
    text-rendering: optimizeLegibility;
    transition: color var(--t);
}

/* --- Fondo, capa 1: manchas de color que dan profundidad ------------------ */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -2;
    pointer-events: none;
    background:
        radial-gradient(58vw 58vh at 80% 4%, var(--glow-1), transparent 62%),
        radial-gradient(52vw 52vh at 8% 38%, var(--glow-2), transparent 64%),
        radial-gradient(54vw 54vh at 70% 88%, var(--glow-3), transparent 62%);
    animation: drift 26s ease-in-out infinite alternate;
}

/* Desplazamiento lento, casi imperceptible, para que el fondo no sea estático */
@keyframes drift {
    from { transform: translate3d(0, 0, 0) scale(1); }
    to   { transform: translate3d(-2.5%, 2%, 0) scale(1.08); }
}

/* --- Fondo, capa 2: retícula de puntos ------------------------------------ */
body::after {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background-image: radial-gradient(circle, var(--dot) 1px, transparent 1px);
    background-size: 26px 26px;
    /* Se desvanece hacia abajo para no competir con el contenido */
    -webkit-mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 95%);
            mask-image: linear-gradient(to bottom, #000 0%, #000 55%, transparent 95%);
}

img,
svg,
video {
    display: block;
    max-width: 100%;
    height: auto;
}

input,
button,
textarea,
select {
    font: inherit;
    color: inherit;
}

h1, h2, h3, h4 {
    line-height: 1.2;
    font-weight: 700;
    letter-spacing: -0.02em;
    text-wrap: balance;
}

p {
    text-wrap: pretty;
}

a {
    color: var(--brand-600);
    text-decoration: none;
    transition: color var(--t-fast);
}

a:hover {
    color: var(--brand-500);
}

ul {
    list-style: none;
    padding: 0;
}

/* --- Foco visible y accesible -------------------------------------------- */
:focus-visible {
    outline: 2px solid var(--brand-500);
    outline-offset: 3px;
    border-radius: var(--radius-sm);
}

/* --- Utilidades ----------------------------------------------------------- */
.container {
    width: 100%;
    max-width: var(--container);
    margin-inline: auto;
    padding-inline: var(--sp-5);
}

/* Visible solo para lectores de pantalla */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Salto directo al contenido — primer tabulador de la página */
.skip-link {
    position: absolute;
    top: -100px;
    left: var(--sp-4);
    z-index: 2000;
    padding: var(--sp-3) var(--sp-5);
    background: var(--brand-600);
    color: #fff;
    border-radius: var(--radius);
    font-weight: 600;
    transition: top var(--t-fast);
}

.skip-link:focus {
    top: var(--sp-4);
    color: #fff;
}

/* --- Secciones ------------------------------------------------------------ */
.section {
    padding-block: var(--sp-9);
    scroll-margin-top: var(--nav-h);
}

/*
 * Semitransparente a propósito: tiñe la sección para diferenciarla, pero deja
 * ver el patrón del fondo en lugar de taparlo con un bloque opaco.
 */
.section--alt {
    background-color: color-mix(in srgb, var(--bg-alt) 78%, transparent);
    border-block: 1px solid var(--border);
}

.section__eyebrow {
    display: inline-block;
    font-family: var(--font-mono);
    font-size: var(--fs-sm);
    font-weight: 600;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--brand-600);
    margin-bottom: var(--sp-2);
}

.section__title {
    font-size: var(--fs-3xl);
    margin-bottom: var(--sp-3);
}

.section__lead {
    font-size: var(--fs-lg);
    color: var(--text-muted);
    max-width: 62ch;
    margin-bottom: var(--sp-7);
}

/* --- Animación de entrada al hacer scroll --------------------------------- */
.reveal {
    opacity: 0;
    transform: translateY(22px);
    transition: opacity 620ms var(--ease), transform 620ms var(--ease);
}

.reveal.is-visible {
    opacity: 1;
    transform: none;
}

/* Respeta a quien pide menos movimiento por accesibilidad o mareo */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto;
    }

    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .reveal {
        opacity: 1;
        transform: none;
    }
}
