/*
 * MDT Prevención · F1 · Fundamentos: tipografía, enlaces, foco, selección, barras de desplazamiento y piezas sueltas
 * (small, code, hr…). DESIGN.md §3 y §5. Solo variables de tokens.css.
 * Carga justo después de tokens.css y por encima de Limitless: a igual especificidad gana por orden.
 * No toca la rejilla de Bootstrap ni ninguna pieza con clase (eso es de cada familia).
 */

/* ---------- Página ---------- */
html {
    -webkit-text-size-adjust: 100%;
    text-size-adjust: 100%;
    scrollbar-color: var(--mdt-subtle) transparent; /* se hereda: barras discretas en toda la página */
}

* {
    scrollbar-width: thin;
}

body {
    font-family: var(--mdt-font);
    font-size: var(--mdt-fs-body);
    font-weight: 400;
    line-height: var(--mdt-lh-body);
    color: var(--mdt-ink);
    background-color: var(--mdt-surface);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* ---------- Títulos: jerarquía por peso + tamaño + interlineado, tracking según tamaño (§3) ---------- */
h1, .h1, h2, .h2, h3, .h3, h4, .h4, h5, .h5, h6, .h6 {
    font-family: var(--mdt-font);
    font-weight: 700;
    line-height: var(--mdt-lh-title);
    letter-spacing: var(--mdt-track-title);
    color: inherit;
}

h1, .h1 {
    font-size: var(--mdt-fs-page);
    font-weight: 900;
    line-height: var(--mdt-lh-tight);
    letter-spacing: var(--mdt-track-page);
}

h2, .h2 {
    font-size: var(--mdt-fs-page);
    line-height: var(--mdt-lh-tight);
    letter-spacing: var(--mdt-track-page);
}

h3, .h3, h4, .h4, h5, .h5 {
    font-size: var(--mdt-fs-title);
}

h6, .h6 {
    font-size: var(--mdt-fs-body);
    letter-spacing: 0;
}

b, strong {
    font-weight: 700;
}

/* ---------- Enlaces: teja; subrayados solo dentro de un texto corrido (el color no basta, WCAG 1.4.1) ---------- */
a {
    color: var(--mdt-brand);
    text-decoration: none;
    transition: color var(--mdt-dur-hover) var(--mdt-ease);
}

a:hover {
    color: var(--mdt-brand-hover);
    text-decoration: none;
}

a:active {
    color: var(--mdt-brand-press);
}

p a:not([class]),
.form-text a:not([class]) {
    text-decoration: underline;
    text-decoration-thickness: from-font;
    text-underline-offset: .15em;
}

/* ---------- Foco: anillo teja visible en todo lo que se maneja con teclado; nada al pulsar con el ratón ---------- */
:focus-visible,
a:focus-visible,
button:focus-visible,
summary:focus-visible,
[role="button"]:focus-visible,
[tabindex]:focus-visible,
input[type="checkbox"]:focus-visible,
input[type="radio"]:focus-visible {
    outline: 2px solid var(--mdt-brand);
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: 0;
}

/* ---------- Selección de texto ---------- */
::selection {
    background-color: var(--mdt-brand-soft-strong);
    color: var(--mdt-ink);
}

/* ---------- Piezas sueltas ---------- */
small, .small {
    font-size: var(--mdt-fs-small);
    font-weight: 400;
}

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

code {
    padding: 0 var(--mdt-s-1);
    font-size: var(--mdt-fs-small);
    color: var(--mdt-ink);
    background-color: var(--mdt-fill);
    border-radius: var(--mdt-r-sm);
    word-break: break-word;
}

kbd {
    padding: 0 var(--mdt-s-1);
    font-size: var(--mdt-fs-label);
    color: var(--mdt-ink);
    background-color: var(--mdt-card);
    border: 1px solid var(--mdt-line-strong);
    border-radius: var(--mdt-r-sm);
    box-shadow: none;
}

pre {
    padding: var(--mdt-s-3) var(--mdt-s-4);
    font-size: var(--mdt-fs-small);
    color: var(--mdt-ink);
    background-color: var(--mdt-fill);
    border-radius: var(--mdt-r-pop);
}

pre code {
    padding: 0;
    font-size: inherit;
    background-color: transparent;
}

mark, .mark {
    padding: 0 var(--mdt-s-1);
    color: inherit;
    background-color: var(--mdt-warn-bg);
    border-radius: var(--mdt-r-sm);
}

hr {
    margin: var(--mdt-s-6) 0;
    border: 0;
    border-top: 1px solid var(--mdt-line);
}

@media (prefers-reduced-motion: reduce) {
    a {
        transition: none;
    }
}
