/* ==========================================================================
   Abitmedia — Reset y bases
   ========================================================================== */

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

* { margin: 0; }

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
  scroll-behavior: smooth;
  /* Compensa el header fijo cuando se navega a un ancla */
  scroll-padding-top: calc(var(--header-h, 72px) + var(--space-5));
  -moz-tab-size: 4;
  tab-size: 4;
}

/* El layout principal ocupa como mínimo el alto real de la ventana,
   pero nunca recorta el contenido: crece con él. */
body {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  margin: 0;
  font-family: var(--font-sans);
  font-size: var(--text-base);
  line-height: var(--leading-normal);
  color: var(--color-text);
  background-color: var(--color-background);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
  /* Nunca debe existir desplazamiento horizontal */
  overflow-x: hidden;
}

main { flex: 1 0 auto; }

/* --- Tipografía ----------------------------------------------------------- */
h1, h2, h3, h4, h5, h6 {
  font-weight: 700;
  line-height: var(--leading-tight);
  letter-spacing: var(--tracking-tight);
  color: var(--color-text-strong);
  text-wrap: balance;
}
h1, h2 {
  /* Regla tipográfica global solicitada para los títulos principales. */
  font-weight: 400 !important;
}
h1 {
  font-size: var(--text-4xl);
  /* Mismo ajuste que en h2: a .9 la tilde de la segunda línea llegaba a tocar
     los trazos descendentes de la primera («tecnológicas», «años»). */
  line-height: 1.04 !important;
}
h2 {
  font-size: var(--text-3xl);
  /* 1.08 apretaba las dos líneas de los títulos largos hasta rozar las
     mayúsculas de la línea siguiente. 1.22 las separa sin que el título deje
     de leerse como un bloque compacto. */
  line-height: 1.22 !important;
}
h3 {
  font-size: var(--text-xl);
  font-weight: 400;
}
h4 { font-size: var(--text-lg); }

p { text-wrap: pretty; }

p, li, dd, figcaption { overflow-wrap: break-word; }

/* Correos y URL son un único token sin espacios: sin esto desbordan su caja
   en pantallas estrechas. 'anywhere' sólo actúa cuando hace falta. */
a[href^="mailto:"], a[href^="tel:"] { overflow-wrap: anywhere; }

a {
  color: var(--brand);
  text-decoration-thickness: 1px;
  text-underline-offset: .18em;
}
a:hover { color: var(--brand-strong); }

strong, b { font-weight: 700; color: var(--color-text-strong); }

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

ul, ol { padding-inline-start: 1.25em; }

code, kbd, pre, samp { font-family: var(--font-mono); font-size: .92em; }

/* --- Medios --------------------------------------------------------------- */
img, svg, video, canvas, iframe {
  display: block;
  max-width: 100%;
}
img, video {
  height: auto;
}
svg { flex: none; }

/* --- Formularios ---------------------------------------------------------- */
button, input, select, textarea {
  font: inherit;
  color: inherit;
}
button { background: none; border: 0; cursor: pointer; }
button:disabled { cursor: not-allowed; }

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

/* Foco visible y consistente en todo el sitio */
:where(a, button, input, select, textarea, summary, [tabindex]):focus-visible {
  outline: 3px solid var(--color-ring);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}

/* Área táctil mínima para controles de interfaz */
:where(button, a).touch-target {
  min-width: 44px;
  min-height: 44px;
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* Enlace de salto al contenido */
.skip-link {
  position: absolute;
  top: 0;
  left: var(--space-4);
  z-index: var(--z-skip);
  transform: translateY(-120%);
  padding: var(--space-3) var(--space-5);
  background: var(--color-cta);
  color: var(--color-cta-text);
  font-weight: 700;
  border-radius: 0 0 var(--radius) var(--radius);
  box-shadow: var(--shadow-md);
  transition: transform var(--duration) var(--ease);
}
.skip-link:focus-visible { transform: translateY(0); }

[hidden] { display: none !important; }

/* --- Reducción de movimiento --------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
}

/* --- Impresión ------------------------------------------------------------ */
@media print {
  .site-header, .site-footer, .search-modal, .to-top { display: none !important; }
  body { background: #fff; color: #000; }
}
