/* ==========================================================================
   Vectorial — Reset y base
   ========================================================================== */

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

* { margin: 0; }

html {
    scroll-behavior: smooth;
    scroll-padding-top: calc(var(--alto-cabecera) + 1.5rem);
    -webkit-text-size-adjust: 100%;
}

body {
    min-height: 100vh;
    font-family: var(--f-texto);
    font-size: var(--t-base);
    line-height: 1.65;
    color: var(--tinta);
    /* El cromo del shader va detrás; este color es el respaldo. */
    background-color: var(--papel);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    overflow-x: hidden;
    text-rendering: optimizeLegibility;
}

body.menu-abierto { overflow: hidden; }

/* Lienzo del shader: fijo detrás de todo el documento. */
.fondo-metal {
    position: fixed;
    inset: 0;
    z-index: var(--z-fondo);
    pointer-events: none;
    /* Respaldo sin WebGL: una esfera de metal dibujada con degradados, con su
       brillo especular. No es el shader, pero ocupa su lugar sin parecer una
       mancha difusa. */
    --radio-orbe: min(34vh, 34vw);
    background:
        radial-gradient(circle calc(var(--radio-orbe) * 0.4) at 43% 33%,
            rgba(255, 255, 255, 0.9) 0%, rgba(255, 255, 255, 0.15) 55%, transparent 75%),
        radial-gradient(circle var(--radio-orbe) at 50% 47%,
            #f0f0f3 0%, #c6c6ce 26%, #83838f 48%, #45454f 68%, #1b1b21 88%, transparent 100%),
        var(--papel);
}

.fondo-metal canvas {
    display: block;
    width: 100%;
    height: 100%;
    opacity: 0;
    transition: opacity 1200ms var(--ease-fluido);
}

.fondo-metal.is-listo canvas { opacity: 1; }

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

img { height: auto; }

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

button { background: none; border: none; cursor: pointer; }

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

a {
    color: inherit;
    text-decoration: none;
    transition: color var(--d-rapida) var(--ease-fluido);
}

h1, h2, h3, h4 {
    font-family: var(--f-display);
    font-weight: 700;
    line-height: 1.08;
    letter-spacing: -0.03em;
    text-wrap: balance;
}

p { text-wrap: pretty; }

::selection {
    background: var(--tinta);
    color: var(--papel-claro);
}

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

/* Scrollbar --------------------------------------------------------------- */

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
    background: var(--tinta-20);
    border-radius: var(--r-full);
    border: 2px solid transparent;
    background-clip: content-box;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--tinta-55); }

/* Accesibilidad ----------------------------------------------------------- */

.solo-lectores {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
}

.salto-contenido {
    position: fixed;
    top: -100px;
    left: 1rem;
    z-index: 300;
    padding: 0.75rem 1.25rem;
    background: var(--tinta);
    color: var(--papel-claro);
    border-radius: var(--r-sm);
    font-weight: 600;
    transition: top var(--d-rapida) var(--ease-fluido);
}

.salto-contenido:focus { top: 1rem; }

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

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