/* Reset y estilos base de elementos. Capas: reset → base. */

@layer reset {
  *, *::before, *::after { box-sizing: border-box; }
  * { margin: 0; }
  html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
  body { min-height: 100dvh; line-height: var(--lh-body); }
  img, svg, video, canvas { display: block; max-width: 100%; }
  input, select, textarea, button { font: inherit; color: inherit; }
  button { background: none; border: 0; cursor: pointer; }
  [hidden] { display: none !important; }
  summary { cursor: pointer; }
}

@layer base {
  html {
    background: var(--bg);
    color: var(--ink);
  }

  body {
    background: var(--bg);
    color: var(--ink);
    font-family: var(--font);
    font-size: var(--fs-md);
    font-weight: var(--fw-regular);
    font-feature-settings: "cv11", "ss01";
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
  }

  h1, h2, h3, h4 {
    color: var(--ink-strong);
    line-height: var(--lh-tight);
    font-weight: var(--fw-semibold);
    text-wrap: balance;
  }
  h1 { font-size: var(--fs-2xl); letter-spacing: -0.01em; }
  h2 { font-size: var(--fs-lg); }
  h3 { font-size: var(--fs-md); }

  p { text-wrap: pretty; }
  strong { font-weight: var(--fw-semibold); color: var(--ink-strong); }
  small, .small { font-size: var(--fs-xs); }
  .muted { color: var(--muted); }

  a {
    color: var(--brand-ink);
    text-decoration: underline;
    text-decoration-color: color-mix(in srgb, currentColor 40%, transparent);
    text-underline-offset: 3px;
  }
  a:hover { text-decoration-color: currentColor; }

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

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

  /* Números en tablas y KPI: dígitos tabulares para alinear columnas */
  .num, td, th, .valor, .tabla-num, .celda-pct {
    font-variant-numeric: tabular-nums;
  }

  .sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
    border: 0;
  }

  .skip-link {
    position: absolute;
    left: var(--s-4);
    top: var(--s-2);
    z-index: 100;
    padding: var(--s-2) var(--s-4);
    background: var(--surface);
    color: var(--ink-strong);
    border: 1px solid var(--line);
    border-radius: var(--r-md);
    transform: translateY(-200%);
  }
  .skip-link:focus { transform: none; }

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