/* Minimal element defaults so any consuming page inherits the brand voice.
   Kept deliberately small — components carry their own styling. */
*, *::before, *::after { box-sizing: border-box; }
body { margin: 0; font-family: var(--font-core); font-size: var(--fs-body); font-weight: var(--fw-light); line-height: var(--lh-normal); color: var(--text-body); background: var(--surface-page); -webkit-font-smoothing: antialiased; text-wrap: pretty; }
h1, h2, h3, h4, h5, h6 { margin: 0; font-family: var(--font-core); color: var(--text-heading); font-weight: var(--fw-extrabold); line-height: var(--lh-snug); }
h1 { font-size: var(--fs-h1); }
h2 { font-size: var(--fs-h2); }
h3 { font-size: var(--fs-h3); }
h4 { font-size: var(--fs-h4); }
p { margin: 0 0 var(--space-4); }
/* Solo en contenedores que ya aportan separacion con `gap`: ahi el margen
   inferior del ultimo <p> se sumaba al gap. En padres display:block los 20px
   forman parte del ritmo vertical actual y NO se tocan (invariante de
   escritorio: la home media 160px menos con la version global). */
[style*="display:flex"] > p:last-child, [style*="display: flex"] > p:last-child,
[style*="display:grid"] > p:last-child, [style*="display: grid"] > p:last-child { margin-bottom: 0; }
a { color: var(--text-link); text-decoration: none; transition: color var(--dur-base) var(--ease-standard); }
a:hover { color: var(--text-link-hover); text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 3px; }
/* --focus-ring es teal-500: invisible sobre los fondos teal (banda CTA F3:211,
   aside de contacto F3:559, cabecera de tabla F3:311-314) y sobre el pie navy.
   Anillo bicolor: funciona sobre cualquier fondo.
   [tabindex] se acota a indices no negativos: [data-table-scroll] e image-slot
   usan tabindex="0" y SI deben recibir anillo; <main id="contenido" tabindex="-1">
   es solo destino del skip-link y pintaria un contorno de 6798px de alto.
   Nota: el halo blanco (box-shadow) NO llega a los nodos que traen box-shadow
   en el atributo style — Button escribe boxShadow inline (_ds_bundle.js:423) y
   gana siempre; ahi el foco queda en el outline negro de 2px. */
a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible,
select:focus-visible, summary:focus-visible, [tabindex]:not([tabindex^="-"]):focus-visible {
  outline: 2px solid var(--gray-900);
  outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--gray-0);
  border-radius: 4px;
}
@media (prefers-contrast: more) {
  a:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible { outline-width: 3px; }
}
img, svg, video, canvas, iframe { max-width: 100%; }
img { height: auto; display: block; }
strong { font-weight: var(--fw-bold); color: var(--text-heading); }
hr { border: 0; border-top: 1px solid var(--border-default); margin: var(--space-8) 0; }
::selection { background: var(--teal-100); color: var(--teal-900); }

/* -- Capa responsive de base --------------------------------------------- */

/* Guarda de desbordamiento horizontal. DEBE ser `clip`, NO `hidden`:
   hidden en html/body convierte el elemento en contenedor de scroll y ROMPE
   el position:sticky de la cabecera (F3:43). Esta es la UNICA guarda del
   proyecto; no repetirla en responsive.css. */
html { overflow-x: clip; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body { overflow-x: clip; }

/* La cabecera es sticky: cualquier ancla o foco recibido tras un salto quedaria
   tapado. Derivado del token para que siga siendo correcto al ser fluido.
   NO se anade scroll-behavior:smooth (chocaria con el scrollTo del router). */
html { scroll-padding-top: calc(var(--header-h-sticky) + var(--space-2)); }

/* El min-width por defecto de un hijo de grid/flex es `auto`: nunca se encoge por
   debajo de su contenido. Es la causa mecanica de casi todos los desbordes, y F3
   declara el display en el atributo style, asi que se puede atacar en origen.
   NO se pone min-height:0 (aplastaria las barras decorativas de 5px). */
[style*="display:grid"] > *, [style*="display: grid"] > *,
[style*="display:flex"] > *, [style*="display: flex"] > * { min-width: 0; }

/* Palabras largas del copy real: Radiologica, Comercializacion, Descontaminantes,
   TECDOC-1646, ISO/IEC.
   hyphens + text-wrap:balance SOLO por debajo de 641px: con <html lang="es">
   (cambio de F3) hyphens:auto deja de ser inerte y partia el H1 del hero en
   escritorio ("Proteccion Ra-/diologica"); y balance sustituye al text-wrap:pretty
   heredado del body, cambiando los cortes de linea de 9 titulares a 1440px. */
h1, h2, h3, h4, h5, h6 {
  overflow-wrap: break-word;
  word-break: normal;
}
@media (max-width: 640px) {
  h1, h2, h3, h4, h5, h6 { hyphens: auto; text-wrap: balance; }
}
p, li, dd, dt, td, th, blockquote, figcaption { overflow-wrap: break-word; }

/* Controles: heredar tipografia y blindar el suelo anti-zoom de iOS para
   cualquier control que no venga del design system. */
input, button, textarea, select { font-family: inherit; font-size: inherit; font-weight: inherit; color: inherit; }
@media (max-width: 640px) {
  input, select, textarea { font-size: max(16px, 1em); }
}

/* Tablas y contenedores de scroll horizontal */
table { border-collapse: collapse; width: 100%; }
[style*="overflow-x:auto"], [style*="overflow-x: auto"] {
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 1ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 1ms !important;
    scroll-behavior: auto !important;
  }
}
