/*
 * Grafo · estilos propios sobre Bootstrap 5.3.
 * Objetivo WCAG 2.2 AA: foco visible, contraste y reflujo a 320 px.
 */

:root {
  --grafo-foco: #0b4f9c;
  --grafo-foco-claro: #ffffff;
  --grafo-encabezado: #12324f;
  /* Enlaces con contraste ≥ 4.5:1 también sobre el fondo gris claro (1.4.3). */
  --bs-link-color: #0a4fa8;
  --bs-link-color-rgb: 10, 79, 168;
  --bs-link-hover-color: #073b7e;
  --bs-link-hover-color-rgb: 7, 59, 126;
}

/* Dentro de avisos, los enlaces usan el color de texto del aviso. */
.alert a {
  color: var(--bs-alert-link-color, inherit);
  font-weight: 600;
}

.breadcrumb-item.active {
  color: #495057;
}

/* Foco visible y consistente para teclado (2.4.7, 2.4.11). */
:focus-visible {
  outline: 3px solid var(--grafo-foco) !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 5px var(--grafo-foco-claro) !important;
}

.navbar :focus-visible,
.grafo-encabezado :focus-visible {
  outline-color: #ffd54f !important;
  box-shadow: none !important;
}

/* Enlace para saltar al contenido. */
.grafo-saltar {
  position: absolute;
  left: 0.5rem;
  top: -4rem;
  z-index: 2000;
  padding: 0.75rem 1rem;
  background: #ffffff;
  color: #0a2540;
  border: 2px solid var(--grafo-foco);
  border-radius: 0.25rem;
  font-weight: 600;
}

.grafo-saltar:focus {
  top: 0.5rem;
}

.grafo-encabezado {
  background-color: var(--grafo-encabezado);
}

/* Los enlaces del contenido se distinguen sin depender solo del color (1.4.1). */
main a:not(.btn):not(.list-group-item):not(.nav-link) {
  text-decoration: underline;
  text-underline-offset: 0.15em;
}

/* Objetivos táctiles mínimos de 24 × 24 px (2.5.8). */
.btn,
.form-check-input,
.form-select,
.form-control {
  min-height: 2.25rem;
}

.form-check-input {
  min-height: 1.25rem;
  min-width: 1.25rem;
}

/* Mensajes de error con texto e ícono textual, no solo color. */
.grafo-error {
  color: #a4161a;
  font-weight: 600;
}

.grafo-error::before {
  content: "Error: ";
}

.is-invalid {
  border-width: 2px;
}

.grafo-resumen-errores:focus {
  outline: 3px solid #a4161a;
  outline-offset: 2px;
}

/* Dentro de una tarjeta (contenedor flex), la tabla se desplaza en su
   envoltura y no ensancha la página (reflujo a 320 px, 1.4.10). */
.card .table-responsive {
  min-width: 0;
  max-width: 100%;
}

/* Las etiquetas .visually-hidden (position: absolute) dentro de una tabla
   desplazable quedan contenidas y no ensanchan la página. */
.table-responsive {
  position: relative;
}

.grafo-tarjeta-programa {
  border-left: 0.35rem solid var(--grafo-encabezado);
}

.grafo-estado {
  font-size: 0.875rem;
}

/* Respeta la preferencia de reducción de movimiento. */
@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
}

/* Contraste reforzado cuando el sistema lo solicita. */
@media (prefers-contrast: more) {
  .text-body-secondary {
    color: #212529 !important;
  }

  .border {
    border-color: #212529 !important;
  }
}
