/*
 * Ułatwienia dostępu (WCAG) — style panelu i trybów ustawianych na <html data-wcag-*>.
 * Selektory trybów zawsze z prefiksem html[...], bo przyciski panelu mają atrybuty data-set-*.
 */

/* ---------- Narzędzia ---------- */
.sr-only {
  position: absolute !important;
  width: 1px !important;
  height: 1px !important;
  padding: 0 !important;
  margin: -1px !important;
  overflow: hidden !important;
  clip: rect(0, 0, 0, 0) !important;
  clip-path: inset(50%) !important;
  white-space: nowrap !important;
  border: 0 !important;
}

.skip-link {
  position: fixed;
  top: 0.75rem;
  left: 0.75rem;
  z-index: 100000;
  padding: 0.75rem 1.1rem;
  background: var(--ink);
  color: #fff;
  font-weight: 600;
  transform: translateY(-200%);
  transition: transform 0.15s ease;
}

.skip-link:focus {
  transform: none;
}

/* Widoczny fokus z klawiatury (WCAG 2.4.7) */
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 3px;
}

main:focus {
  outline: none;
}

/* ---------- Panel ---------- */
.a8-wcag {
  position: fixed;
  right: 1.25rem;
  bottom: 4.5rem;
  z-index: 70;
  font-family: var(--font-body);
  line-height: 1.4;
}

.a8-wcag-trigger {
  position: relative;
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(20, 24, 28, 0.22);
  transition: background 0.2s ease, transform 0.2s var(--ease);
}

.a8-wcag-trigger:hover,
.a8-wcag.is-open .a8-wcag-trigger {
  background: var(--accent-deep);
}

.a8-wcag-trigger svg {
  width: 1.6rem;
  height: 1.6rem;
}

/* Kropka: jakieś ustawienie jest aktywne */
.a8-wcag.is-active .a8-wcag-trigger::after {
  content: "";
  position: absolute;
  top: 0.1rem;
  right: 0.1rem;
  width: 0.7rem;
  height: 0.7rem;
  border-radius: 50%;
  background: var(--coral);
  border: 2px solid #fff;
}

.a8-wcag-panel {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.75rem);
  width: min(22rem, calc(100vw - 2.5rem));
  max-height: calc(100vh - 8rem);
  max-height: calc(100dvh - 8rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1.1rem 1.1rem 1.25rem;
  background: #fff;
  color: #14181c;
  border: 1px solid rgba(20, 24, 28, 0.15);
  box-shadow: 0 18px 48px rgba(20, 24, 28, 0.25);
}

.a8-wcag-panel[hidden] {
  display: none !important;
}

.a8-wcag-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 0.9rem;
}

.a8-wcag-head h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 1.15rem;
  font-weight: 700;
}

.a8-wcag-close {
  display: grid;
  place-items: center;
  width: 2.25rem;
  height: 2.25rem;
  padding: 0;
  border: 1px solid rgba(20, 24, 28, 0.2);
  background: transparent;
  color: inherit;
  font-size: 1.4rem;
  line-height: 1;
  cursor: pointer;
}

.a8-wcag-close:hover {
  background: #14181c;
  color: #fff;
}

.a8-wcag-group {
  margin: 0 0 1rem;
}

.a8-wcag-label {
  display: block;
  margin-bottom: 0.45rem;
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #4a535c;
}

.a8-wcag-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.4rem;
}

.a8-wcag-grid--2 {
  grid-template-columns: repeat(2, 1fr);
}

.a8-wcag-list {
  display: grid;
  gap: 0.4rem;
}

.a8-wcag button.a8-wcag-opt {
  min-height: 2.6rem;
  padding: 0.5rem 0.6rem;
  border: 1px solid rgba(20, 24, 28, 0.25);
  background: #f3f5f7;
  color: #14181c;
  font: inherit;
  font-size: 0.92rem;
  text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease;
}

.a8-wcag-list button.a8-wcag-opt {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  text-align: left;
}

/* Przełącznik on/off w przyciskach listy */
.a8-wcag-list button.a8-wcag-opt::after {
  content: "";
  flex: 0 0 auto;
  width: 2.1rem;
  height: 1.2rem;
  border-radius: 1rem;
  background:
    radial-gradient(circle at 0.6rem 50%, #fff 0.42rem, transparent 0.45rem),
    #8a949d;
  transition: background 0.15s ease;
}

.a8-wcag-list button.a8-wcag-opt[aria-pressed="true"]::after {
  background:
    radial-gradient(circle at 1.5rem 50%, #14181c 0.42rem, transparent 0.45rem),
    #fff;
}

.a8-wcag button.a8-wcag-opt:hover {
  border-color: #14181c;
  background: #e6eaee;
}

.a8-wcag button.a8-wcag-opt[aria-pressed="true"] {
  background: #14181c;
  border-color: #14181c;
  color: #fff;
}

.a8-wcag button.a8-wcag-reset {
  width: 100%;
  min-height: 2.6rem;
  margin-top: 0.25rem;
  border: 1px solid #14181c;
  background: transparent;
  color: #14181c;
  font: inherit;
  font-weight: 600;
  cursor: pointer;
}

.a8-wcag button.a8-wcag-reset:hover {
  background: #14181c;
  color: #fff;
}

.a8-wcag :focus-visible {
  outline: 3px solid #0578b0;
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .a8-wcag {
    right: 0.75rem;
    bottom: 4rem;
  }
}

/* ---------- Maska do czytania ---------- */
.a8-wcag-mask {
  pointer-events: none;
}

.a8-wcag-mask__top,
.a8-wcag-mask__bottom {
  position: fixed;
  left: 0;
  right: 0;
  z-index: 65;
  background: rgba(0, 0, 0, 0.62);
  pointer-events: none;
}

.a8-wcag-mask__top {
  top: 0;
  height: 0;
}

.a8-wcag-mask__bottom {
  bottom: 0;
  top: 100%;
}

/* ---------- Wielkość tekstu (cały serwis jest w rem) ---------- */
html[data-wcag-font="md"] { font-size: 112.5%; }
html[data-wcag-font="lg"] { font-size: 125%; }
html[data-wcag-font="xl"] { font-size: 150%; }

/* ---------- Podkreślenie linków ---------- */
html[data-wcag-links] a:not(.btn):not(.nav-cta):not(.brand):not(.return-to-top):not(.skip-link) {
  text-decoration: underline !important;
  text-decoration-thickness: 2px !important;
  text-underline-offset: 0.2em;
}

html[data-wcag-links] a.btn,
html[data-wcag-links] a.nav-cta {
  outline: 2px dashed currentColor;
  outline-offset: 3px;
}

/* ---------- Odstępy w tekście (WCAG 1.4.12) ---------- */
html[data-wcag-spacing] body :is(p, li, dd, dt, label, blockquote, td, th, summary, figcaption):not(.a8-wcag *) {
  line-height: 1.8 !important;
  letter-spacing: 0.12em !important;
  word-spacing: 0.16em !important;
}

html[data-wcag-spacing] body p:not(.a8-wcag *) {
  margin-bottom: 2em !important;
}

/* ---------- Zatrzymanie animacji ---------- */
html[data-wcag-motion] {
  scroll-behavior: auto !important;
}

html[data-wcag-motion] *,
html[data-wcag-motion] *::before,
html[data-wcag-motion] *::after {
  animation: none !important;
  transition: none !important;
}

html[data-wcag-motion] .oferta-list li,
html[data-wcag-motion] .hero-media img {
  opacity: 1 !important;
  transform: none !important;
}

/* ---------- Duży kursor ---------- */
html[data-wcag-cursor],
html[data-wcag-cursor] * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M5 3v34l9-8 6 13 6.5-3-6-13H33z' fill='%23000' stroke='%23fff' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 5 3, auto !important;
}

html[data-wcag-cursor] :is(a, button, summary, label, select, [role="button"]),
html[data-wcag-cursor] :is(a, button, summary, label, select, [role="button"]) * {
  cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='44' height='44' viewBox='0 0 44 44'%3E%3Cpath d='M5 3v34l9-8 6 13 6.5-3-6-13H33z' fill='%23079be1' stroke='%23000' stroke-width='2.5' stroke-linejoin='round'/%3E%3C/svg%3E") 5 3, pointer !important;
}

html[data-wcag-cursor] :is(input:not([type="checkbox"]):not([type="radio"]):not([type="submit"]), textarea) {
  cursor: text !important;
}

/* ---------- Skala szarości ---------- */
html[data-wcag-contrast="gray"] body > *:not(.a8-wcag):not(.a8-wcag-mask):not(.skip-link) {
  filter: grayscale(1);
}

/* ---------- Wysoki kontrast: wspólne ---------- */
html[data-wcag-contrast="dark"] .hero-media,
html[data-wcag-contrast="light"] .hero-media {
  display: none !important;
}

/* Logo ma mix-blend-mode: multiply — na czarnym tle znikało */
html[data-wcag-contrast="dark"] body *:where(:not(.a8-wcag, .a8-wcag *)),
html[data-wcag-contrast="light"] body *:where(:not(.a8-wcag, .a8-wcag *)) {
  mix-blend-mode: normal !important;
}

/* Logo (ciemny napis na białym JPG) w trybie ciemnym: odwrócenie jasności z zachowaniem
   odcienia — tło czarne, napis jasny, „8” nadal niebieska. Bez osobnego pliku logo. */
html[data-wcag-contrast="dark"] .brand-img {
  filter: invert(1) hue-rotate(180deg) !important;
}

/* Półprzezroczyste linki menu/stopki obniżały kontrast */
html[data-wcag-contrast="dark"] :is(.nav a, .site-footer a),
html[data-wcag-contrast="light"] :is(.nav a, .site-footer a) {
  opacity: 1 !important;
}

html[data-wcag-contrast="dark"] body *:where(:not(.a8-wcag, .a8-wcag *, .a8-wcag-mask *))::before,
html[data-wcag-contrast="dark"] body *:where(:not(.a8-wcag, .a8-wcag *, .a8-wcag-mask *))::after,
html[data-wcag-contrast="light"] body *:where(:not(.a8-wcag, .a8-wcag *, .a8-wcag-mask *))::before,
html[data-wcag-contrast="light"] body *:where(:not(.a8-wcag, .a8-wcag *, .a8-wcag-mask *))::after {
  background-image: none !important;
  box-shadow: none !important;
}

html[data-wcag-contrast="dark"] :is(.btn, .nav-cta, .nav-toggle, .return-to-top, input, textarea, select, button):not(.a8-wcag *),
html[data-wcag-contrast="light"] :is(.btn, .nav-cta, .nav-toggle, .return-to-top, input, textarea, select, button):not(.a8-wcag *) {
  border: 2px solid currentColor !important;
}

/* ---------- Wysoki kontrast: ciemny (biały/żółty na czarnym) ---------- */
html[data-wcag-contrast="dark"],
html[data-wcag-contrast="dark"] body,
html[data-wcag-contrast="dark"] body *:where(:not(.a8-wcag, .a8-wcag *, .a8-wcag-mask *)) {
  background-color: #000 !important;
  background-image: none !important;
  color: #fff !important;
  border-color: #fff !important;
  text-shadow: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-wcag-contrast="dark"] body a:not(.a8-wcag *),
html[data-wcag-contrast="dark"] body a:not(.a8-wcag *) * {
  color: #ffeb3b !important;
}

html[data-wcag-contrast="dark"] body a:not(.a8-wcag *):hover,
html[data-wcag-contrast="dark"] body a:not(.a8-wcag *):focus-visible,
html[data-wcag-contrast="dark"] body a:not(.a8-wcag *):hover *,
html[data-wcag-contrast="dark"] body a:not(.a8-wcag *):focus-visible * {
  background-color: #ffeb3b !important;
  color: #000 !important;
}

html[data-wcag-contrast="dark"] .nav-toggle span,
html[data-wcag-contrast="dark"] .nav-toggle span::before,
html[data-wcag-contrast="dark"] .nav-toggle span::after {
  background-color: #fff !important;
}

html[data-wcag-contrast="dark"] ::placeholder {
  color: #c8c8c8 !important;
  opacity: 1;
}

html[data-wcag-contrast="dark"] :focus-visible {
  outline-color: #ffeb3b !important;
}

/* ---------- Wysoki kontrast: jasny (czarny na białym) ---------- */
html[data-wcag-contrast="light"],
html[data-wcag-contrast="light"] body,
html[data-wcag-contrast="light"] body *:where(:not(.a8-wcag, .a8-wcag *, .a8-wcag-mask *)) {
  background-color: #fff !important;
  background-image: none !important;
  color: #000 !important;
  border-color: #000 !important;
  text-shadow: none !important;
  box-shadow: none !important;
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

html[data-wcag-contrast="light"] body a:not(.a8-wcag *),
html[data-wcag-contrast="light"] body a:not(.a8-wcag *) * {
  color: #0030a0 !important;
}

html[data-wcag-contrast="light"] body a:not(.a8-wcag *):hover,
html[data-wcag-contrast="light"] body a:not(.a8-wcag *):focus-visible,
html[data-wcag-contrast="light"] body a:not(.a8-wcag *):hover *,
html[data-wcag-contrast="light"] body a:not(.a8-wcag *):focus-visible * {
  background-color: #0030a0 !important;
  color: #fff !important;
}

html[data-wcag-contrast="light"] .nav-toggle span,
html[data-wcag-contrast="light"] .nav-toggle span::before,
html[data-wcag-contrast="light"] .nav-toggle span::after {
  background-color: #000 !important;
}

html[data-wcag-contrast="light"] ::placeholder {
  color: #444 !important;
  opacity: 1;
}

html[data-wcag-contrast="light"] :focus-visible {
  outline-color: #000 !important;
}
