/**
 * @file
 * Accessibilitat del tema taula3 (WCAG 2.2 AA). Vegeu docs/ACCESSIBILITAT.md.
 *
 * Fitxer de CSS escrit a mà (no surt dels .scss, que ja no estan sincronitzats
 * amb css/taula3.css). Es carrega l'últim de global-styling. Cap regla canvia
 * l'aspecte per a qui navega amb ratolí: només afecten el focus del teclat
 * (:focus-visible), el desplaçament, la preferència de menys moviment, el
 * botó de pausa dels carrusels automàtics i l'àrea clicable de les fletxes.
 */

/* --- Focus visible i coherent amb la marca (WCAG 2.4.7; 2.4.13 AAA) -------
 * Contorn blau de la marca (#0b72b5, 5,1:1 sobre blanc) separat de l'element
 * per un anell blanc: es veu sobre fons blancs, grisos (#606060), blaus i
 * verds. Els camps de text conserven el focus de Bootstrap (també amb ratolí).
 */
html body a:focus-visible,
html body button:focus-visible,
html body summary:focus-visible,
html body [role="button"]:focus-visible,
html body [tabindex]:not([tabindex="-1"]):focus-visible,
html body input[type="checkbox"]:focus-visible,
html body input[type="radio"]:focus-visible,
html body input[type="submit"]:focus-visible,
html body input[type="button"]:focus-visible {
  outline: 3px solid #0b72b5 !important;
  outline-offset: 2px !important;
  box-shadow: 0 0 0 2px #fff !important;
}

/* Àrees clicables (blocs que contenen l'enllaç real, vegeu js/a11y.js). */
[data-taula3-href] {
  cursor: pointer;
}

/* --- Enllaç de salt al contingut (WCAG 2.4.1) ------------------------------
 * Amagat fins que rep el focus; aleshores es mostra per sobre de la capçalera
 * fixa (abans podia quedar-hi a sota).
 */
.skip-link.visually-hidden.focusable:focus,
.skip-link.visually-hidden.focusable:active {
  position: fixed !important;
  z-index: 10000;
  top: 8px;
  left: 8px;
  width: auto;
  height: auto;
  clip: auto;
  overflow: visible;
  padding: 10px 16px;
  background: #fff;
  color: #0b72b5;
  font-weight: 700;
  text-decoration: underline;
}

/* --- Element amb el focus no tapat (WCAG 2.4.11) ---------------------------
 * Capçalera fixa i bàner de galetes: js/a11y.js en calcula l'alçada.
 */
html {
  scroll-padding-top: var(--taula3-scroll-top, 0);
  scroll-padding-bottom: var(--taula3-scroll-bottom, 0);
}

/* --- Pausa dels carrusels automàtics (WCAG 2.2.2) -------------------------- */
.taula3-carousel-pause {
  position: absolute;
  z-index: 20;
  bottom: 12px;
  left: 12px;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  line-height: 1;
  opacity: 0.75;
  cursor: pointer;
}
.taula3-carousel-pause:hover,
.taula3-carousel-pause:focus-visible {
  opacity: 1;
}
/* Icona de pausa: dues barres. */
.taula3-carousel-pause::before,
.taula3-carousel-pause::after {
  position: absolute;
  top: 10px;
  width: 4px;
  height: 12px;
  background: #fff;
  content: "";
}
.taula3-carousel-pause::before {
  left: 11px;
}
.taula3-carousel-pause::after {
  left: 17px;
}
/* Icona de represa: triangle. */
.taula3-carousel-pause.is-paused::before {
  top: 9px;
  left: 12px;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 7px 0 7px 11px;
  border-color: transparent transparent transparent #fff;
  background: transparent;
}
.taula3-carousel-pause.is-paused::after {
  display: none;
}

/* --- Fletxes dels carrusels Slick (WCAG 2.5.8) -----------------------------
 * El mòdul Slick fa el botó rodó de 42 px, però el tema hi pinta una icona de
 * 80 px (50 px a "a fons") que en sobresurt per sota: bona part de la fletxa
 * visible quedava fora de l'àrea clicable. El botó passa a tenir la mida de
 * la icona i la centra.
 */
body .slick__arrow .slick-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 88px;
  border-radius: 0;
  line-height: 1;
}
body .slick__arrow .slick-arrow::before {
  line-height: 1;
}
body .view-slider-a-fons .slick__arrow .slick-arrow {
  height: 60px;
}

/* --- Menys moviment (WCAG 2.3.3 AAA, preferència del sistema) -------------- */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}
