/* ===========================================================================
   Travisa ERP · Base

   Reset conservador, tipografía base y comportamiento de los elementos
   nativos. Todo sale de tokens.css: aquí no hay un solo valor literal.
   =========================================================================== */

@layer base {

    /* ── Reset ─────────────────────────────────────────────────────────── */

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

    * {
        margin: 0;
    }

    html {
        -webkit-text-size-adjust: 100%;
        tab-size: 4;
    }

    body {
        min-height: 100vh;
        background-color: var(--color-bg);
        color: var(--color-text);
        font-family: var(--font-sans);
        font-size: var(--text-base);
        font-weight: var(--weight-regular);
        line-height: var(--leading-normal);
        -webkit-font-smoothing: antialiased;
        text-rendering: optimizeLegibility;
    }

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

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

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

    p,
    h1,
    h2,
    h3,
    h4,
    h5,
    h6 {
        overflow-wrap: break-word;
    }

    ul,
    ol {
        padding: 0;
    }

    /* El sprite de iconos no se dibuja: solo se referencia con <use>. */
    .icon-sprite {
        display: none;
    }

    /* ── Tipografía ────────────────────────────────────────────────────── */
    /* Tamaños contenidos: esto es una herramienta de captura y consulta,
       no un sitio editorial. */

    h1,
    h2,
    h3,
    h4 {
        color: var(--color-text-strong);
        font-weight: var(--weight-semibold);
        line-height: var(--leading-tight);
    }

    h1 {
        font-size: var(--text-xl);
    }

    h2 {
        font-size: var(--text-lg);
    }

    h3 {
        font-size: var(--text-md);
    }

    h4 {
        font-size: var(--text-base);
    }

    small {
        font-size: var(--text-xs);
    }

    strong,
    b {
        font-weight: var(--weight-semibold);
    }

    /* ── Enlaces ───────────────────────────────────────────────────────── */

    a {
        color: var(--color-accent-text);
        text-decoration: none;
    }

    a:hover {
        text-decoration: underline;
    }

    /* ── Código e identificadores ──────────────────────────────────────── */

    code,
    kbd,
    samp,
    pre {
        font-family: var(--font-mono);
        font-size: var(--text-sm);
    }

    pre {
        overflow-x: auto;
    }

    /* ── Separador nativo ──────────────────────────────────────────────── */

    hr {
        height: var(--border-width);
        border: 0;
        background-color: var(--color-border);
    }

    /* ── Selección ─────────────────────────────────────────────────────── */

    ::selection {
        background-color: var(--color-accent-subtle);
        color: var(--color-text-strong);
    }

    /* ── Foco ──────────────────────────────────────────────────────────────
       Visible y consistente en todo lo que se pueda enfocar. El sistema se
       opera con teclado. Nunca `outline: none` sin reemplazo. */

    :focus-visible {
        outline: var(--focus-width) solid var(--color-focus);
        outline-offset: var(--focus-offset);
        border-radius: var(--radius-sm);
    }

    /* El navegador dibuja el foco solo cuando corresponde; esto evita el
       anillo al hacer clic con el ratón, sin perderlo con teclado. */
    :focus:not(:focus-visible) {
        outline: none;
    }

    /* ── Movimiento reducido ───────────────────────────────────────────────
       Respeta la preferencia del sistema: sin animaciones ni desplazamiento
       suave. */

    @media (prefers-reduced-motion: reduce) {

        *,
        *::before,
        *::after {
            animation-duration: 0.01ms;
            animation-iteration-count: 1;
            transition-duration: 0.01ms;
            scroll-behavior: auto;
        }
    }
}
