/* -------------------------------------------------------------------------
   Toolbar dostępności — tryby WCAG
   ------------------------------------------------------------------------- */

/* === Powiększanie tekstu (cykl 100 / 115 / 130%) === */
:root[data-a11y-fontsize="1"] {
  --fs-body: calc(var(--wp--preset--font-size--body, 16px) * 1.15);
  --fs-heading: calc(var(--wp--preset--font-size--heading, 25.7px) * 1.15);
  --fs-h1: calc(var(--wp--preset--font-size--h1, 48px) * 1.15);
  --fs-caption: calc(var(--wp--preset--font-size--caption, 10.7px) * 1.15);
  --fs-caption-2: calc(var(--wp--preset--font-size--caption-2, 12px) * 1.15);
  --fs-display: calc(clamp(2rem, 4.5vw, 3rem) * 1.15);
  --a11y-scale: 1.15;
}
:root[data-a11y-fontsize="2"] {
  --fs-body: calc(var(--wp--preset--font-size--body, 16px) * 1.3);
  --fs-heading: calc(var(--wp--preset--font-size--heading, 25.7px) * 1.3);
  --fs-h1: calc(var(--wp--preset--font-size--h1, 48px) * 1.3);
  --fs-caption: calc(var(--wp--preset--font-size--caption, 10.7px) * 1.3);
  --fs-caption-2: calc(var(--wp--preset--font-size--caption-2, 12px) * 1.3);
  --fs-display: calc(clamp(2rem, 4.5vw, 3rem) * 1.3);
  --a11y-scale: 1.3;
}
/* Skalowanie pilli i meta (które mają sztywne px) */
:root[data-a11y-fontsize="1"] .label,
:root[data-a11y-fontsize="2"] .label,
:root[data-a11y-fontsize="1"] .topic-chip,
:root[data-a11y-fontsize="2"] .topic-chip {
  font-size: calc(14px * var(--a11y-scale)) !important;
  line-height: calc(14px * var(--a11y-scale)) !important;
}

:root[data-a11y-fontsize="1"] .card-list__meta,
:root[data-a11y-fontsize="2"] .card-list__meta,
:root[data-a11y-fontsize="1"] .card-grid__meta,
:root[data-a11y-fontsize="2"] .card-grid__meta,
:root[data-a11y-fontsize="1"] .card-list__date,
:root[data-a11y-fontsize="2"] .card-list__date {
  font-size: calc(12px * var(--a11y-scale)) !important;
}

/* === Odstępy w tekście (WCAG 1.4.12) === */
html.a11y-spacing .site-content__main,
html.a11y-spacing .site-content__main *,
html.a11y-spacing .site-footer,
html.a11y-spacing .site-footer *,
html.a11y-spacing .site-sidebar__tagline {
  line-height: 1.6 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}
html.a11y-spacing .site-content__main p,
html.a11y-spacing .single-post__content p,
html.a11y-spacing .section-label__body p,
html.a11y-spacing .timeline-row__body p,
html.a11y-spacing .site-footer p {
  margin-bottom: 2em !important;
}

/* === Wysoki kontrast === */
html.a11y-contrast,
html.a11y-contrast body,
html.a11y-contrast .site-wrapper,
html.a11y-contrast .site-content,
html.a11y-contrast .site-content__main,
html.a11y-contrast .site-sidebar,
html.a11y-contrast .site-footer,
/* Belka grantowa w kontraście — czarne tło + logo dla ciemnego tła */
html.a11y-contrast .site-content__grants {
  background: #000 !important;
}
.site-content__grants-img--contrast {
  display: none;
}
html.a11y-contrast .site-content__grants-img--color {
  display: none;
}
html.a11y-contrast .site-content__grants-img--contrast {
  display: block;
}

/* Cały tekst biały */
html.a11y-contrast h1,
html.a11y-contrast h2,
html.a11y-contrast h3,
html.a11y-contrast h4,
html.a11y-contrast p,
html.a11y-contrast span,
html.a11y-contrast li,
html.a11y-contrast a,
html.a11y-contrast strong,
html.a11y-contrast .site-footer * {
  color: #fff !important;
}

/* Linki w treści — żółte */
html.a11y-contrast .site-content__main a,
html.a11y-contrast .single-post__content a {
  color: #ffff00 !important;
  text-decoration: underline !important;
}

/* Menu w kontraście — klikalne żółte */
html.a11y-contrast .site-sidebar__menu a {
  color: #ffff00 !important;
}

/* Aktywna strona (current) — biała */
html.a11y-contrast .site-sidebar__menu .current-menu-item > a,
html.a11y-contrast .site-sidebar__menu .current_page_item > a,
html.a11y-contrast .site-sidebar__menu .current-menu-ancestor > a,
html.a11y-contrast .site-sidebar__menu .current-page-ancestor > a,
html.a11y-contrast .site-sidebar__menu .current-menu-item > .menu-item-wrap > a,
html.a11y-contrast
  .site-sidebar__menu
  .current_page_item
  > .menu-item-wrap
  > a {
  color: #fff !important;
}

/* Znak + (rozwijanie submenu) — biały */
html.a11y-contrast .site-sidebar__menu .menu-item-has-children > a::after,
html.a11y-contrast
  .site-sidebar__menu
  .menu-item-has-children-toggle
  > a::after {
  color: #fff !important;
}

/* Hover menu w kontraście — żeby nie znikało (domyślnie hover=czarny) */
html.a11y-contrast .site-sidebar__menu a:hover,
html.a11y-contrast .site-sidebar__menu a:focus-visible {
  color: #fff !important;
}

/* Pille/chipy klikalne — żółte tło, czarny tekst (wraz z linkiem w środku) */
html.a11y-contrast .label,
html.a11y-contrast .label:link,
html.a11y-contrast .label:visited,
html.a11y-contrast .topic-chip,
html.a11y-contrast .topic-chip:link,
html.a11y-contrast .topic-chip:visited,
html.a11y-contrast .card-grid__labels .label,
html.a11y-contrast .home-category__label {
  background-color: #ffff00 !important;
  color: #000 !important;
  border-color: #ffff00 !important;
  text-decoration: none !important;
}
/* Chipy tematów w kontraście — nieaktywne tylko obramowanie */
html.a11y-contrast .topic-chip,
html.a11y-contrast .topic-chip:link,
html.a11y-contrast .topic-chip:visited {
  background-color: transparent !important;
  color: #ffff00 !important;
  border: 1px solid #ffff00 !important;
}

/* Aktywny chip — pełne żółte tło, czarny tekst */
html.a11y-contrast .topic-chip.is-active,
html.a11y-contrast .topic-chip.is-active:link,
html.a11y-contrast .topic-chip.is-active:visited {
  background-color: #ffff00 !important;
  color: #000 !important;
  border-color: #ffff00 !important;
}

/* Hover/focus chipa — wypełnienie */
html.a11y-contrast .topic-chip:hover,
html.a11y-contrast .topic-chip:focus-visible {
  background-color: #ffff00 !important;
  color: #000 !important;
}

/* Labelki statyczne (section-label, section-pill) — biały tekst, czarne tło, biały border */
html.a11y-contrast .section-label__pill,
html.a11y-contrast .section-pill {
  background-color: #000 !important;
  color: #fff !important;
  border: 1px solid #fff !important;
}

/* Grants bar zostaje na białym — logotypy UE muszą być na białym tle (wymóg) */
html.a11y-contrast .site-content__grants {
  background: #000 !important;
}

/* Ikona toolbara aktywna w kontraście */
html.a11y-contrast .a11y-btn {
  border-color: #fff !important;
  color: #fff !important;
}
html.a11y-contrast .a11y-btn[aria-pressed="true"] {
  background: #ffff00 !important;
  border-color: #ffff00 !important;
  color: #000 !important;
}

/* === Podświetlanie linków (WCAG 1.4.1) === */
html.a11y-links a {
  text-decoration: underline !important;
  text-underline-offset: 3px !important;
  outline: 2px solid currentColor !important;
  outline-offset: 2px;
}
/* === Stan aktywny przycisku toolbara === */
.a11y-btn[aria-pressed="true"] {
  background-color: var(--color-white);
  color: var(--color-primary);
}
/* Znak + / X w menu — żółty */
html.a11y-contrast .site-sidebar__menu .menu-plus,
html.a11y-contrast .site-sidebar__nav .icon-plus,
html.a11y-contrast .menu-toggle-sub__icon {
  color: #ffff00 !important;
}

/* Formularz CF7 — to co było cobalt → żółte */
html.a11y-contrast .wpcf7 input[type="text"],
html.a11y-contrast .wpcf7 input[type="email"],
html.a11y-contrast .wpcf7 textarea {
  background: #000 !important;
  color: #fff !important;
  border-bottom-color: #ffff00 !important;
}
html.a11y-contrast .wpcf7 input::placeholder,
html.a11y-contrast .wpcf7 textarea::placeholder {
  color: #ccc !important;
}
html.a11y-contrast .wpcf7 .cf7-submit input[type="submit"] {
  background: #ffff00 !important;
  color: #000 !important;
}
html.a11y-contrast .cf7-field--consent a,
html.a11y-contrast .wpcf7 a {
  color: #ffff00 !important;
}
html.a11y-contrast .wpcf7 input[type="checkbox"] {
  accent-color: #ffff00 !important;
}

/* Aktywna ikona toolbara — żółte tło, czarny znak */
html.a11y-contrast .a11y-btn[aria-pressed="true"],
html.a11y-contrast .a11y-btn[aria-pressed="true"] span {
  background: #ffff00 !important;
  color: #000 !important;
}

/* Hover/focus ikony toolbara w kontraście — białe tło, czarny znak */
html.a11y-contrast .a11y-btn:hover,
html.a11y-contrast .a11y-btn:focus-visible {
  background: #fff !important;
  border-color: #fff !important;
  color: #000 !important;
}
html.a11y-contrast .a11y-btn:hover span,
html.a11y-contrast .a11y-btn:focus-visible span {
  color: #000 !important;
}
