/* =========================================================
   Dostępność: skip link, fokus, ruch, widżet ustawień
   ========================================================= */

.skip-link {
  position: absolute; left: 1rem; top: -100px; z-index: 1000;
  padding: 0.75rem 1.25rem; border-radius: 6px;
  background: var(--paper-100); color: var(--ink-800);
  font-family: var(--font-sans); font-weight: 500; text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.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;
}

:focus-visible {
  outline: 2px solid var(--accent-soft);
  outline-offset: 3px;
  border-radius: 2px;
}
.btn:focus-visible, .nav-cta:focus-visible { outline-offset: 4px; }

/* Ograniczenie ruchu: ustawienie systemowe lub przełącznik w widżecie */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; transition-delay: 0s !important; }
  .reveal, .reveal-stagger > * { opacity: 1 !important; transform: none !important; }
}
html.a11y-motion { scroll-behavior: auto; }
html.a11y-motion *, html.a11y-motion *::before, html.a11y-motion *::after { animation: none !important; transition: none !important; }
html.a11y-motion .reveal, html.a11y-motion .reveal-stagger > * { opacity: 1 !important; transform: none !important; }
html.a11y-motion .grain { display: none; }

/* Rozmiar tekstu */
html.a11y-text-1 { font-size: 112.5%; }
html.a11y-text-2 { font-size: 125%; }
html.a11y-text-3 { font-size: 140%; }

/* Podkreślenie linków */
html.a11y-links main a:not(.btn),
html.a11y-links footer a { text-decoration: underline !important; text-underline-offset: 3px; }

/* Odstępy w tekście (WCAG 1.4.12) */
html.a11y-spacing body { line-height: 1.8 !important; letter-spacing: 0.04em !important; word-spacing: 0.12em !important; }
html.a11y-spacing p, html.a11y-spacing li { line-height: 1.8 !important; margin-bottom: 0.9em; }

/* Prosta czcionka */
html.a11y-font, html.a11y-font body { --font-sans: Verdana, Arial, sans-serif; --font-serif: Verdana, Arial, sans-serif; --font-mono: Verdana, Arial, sans-serif; }

/* Wysoki kontrast */
html.a11y-contrast {
  --ink-900: #000; --ink-800: #000; --ink-700: #000; --ink-600: #000; --ink-500: #000;
  --ink-400: #fff; --ink-300: #fff; --ink-200: #fff; --ink-100: #fff;
  --paper-100: #fff; --paper-200: #fff; --paper-300: #fff;
  --accent: #FFE14D; --accent-soft: #FFE14D; --accent-deep: #FFE14D;
  --accent-glow: transparent; --accent-faint: transparent;
  --signal-cyan: #FFE14D; --signal-amber: #FFE14D; --signal-rose: #FFE14D; --signal-green: #FFE14D;
}
html.a11y-contrast body { background: #000 !important; color: #fff !important; }
html.a11y-contrast .grain { display: none; }
html.a11y-contrast main a:not(.btn), html.a11y-contrast footer a { color: #FFE14D !important; }
html.a11y-contrast .btn-primary { background: #fff !important; color: #000 !important; }
html.a11y-contrast .btn-primary * { color: #000 !important; }
html.a11y-contrast :focus-visible { outline: 3px solid #FFE14D; }
html.a11y-contrast [class*="card"], html.a11y-contrast .nav.is-scrolled { border-color: #fff !important; background: #000 !important; }

/* ---------- Widżet ---------- */
.a11y-toggle {
  position: fixed; left: 1rem; bottom: 1rem; z-index: 900;
  width: 48px; height: 48px; border-radius: 50%;
  display: grid; place-items: center; cursor: pointer;
  background: var(--accent-deep); color: #fff; border: 2px solid #fff;
  box-shadow: 0 8px 24px rgba(0,0,0,0.45);
}
html.a11y-contrast .a11y-toggle { background: #FFE14D; color: #000; border-color: #000; }
.a11y-toggle svg { width: 26px; height: 26px; }

.a11y-panel {
  position: fixed; left: 1rem; bottom: 4.5rem; z-index: 901;
  width: min(330px, calc(100vw - 2rem)); max-height: calc(100vh - 6rem); overflow: auto;
  padding: 1.25rem; border-radius: 10px;
  background: #0E1525; color: #F2EFE8; border: 1px solid #3B4866;
  box-shadow: 0 20px 60px rgba(0,0,0,0.6);
  font-family: var(--font-sans); font-size: 0.95rem; line-height: 1.4;
}
html.a11y-contrast .a11y-panel { background: #000; border-color: #fff; color: #fff; }
.a11y-panel[hidden] { display: none; }
.a11y-panel h2 { font-size: 1.05rem; font-weight: 500; margin: 0 0 1rem; color: inherit; font-family: inherit; letter-spacing: 0; line-height: 1.3; }
.a11y-row { display: flex; align-items: center; justify-content: space-between; gap: 0.75rem; margin-bottom: 0.9rem; }
.a11y-size { display: flex; gap: 0.35rem; }
.a11y-panel button.a11y-opt, .a11y-size button {
  font: inherit; cursor: pointer; color: inherit;
  background: transparent; border: 1px solid #6B7891; border-radius: 6px;
}
.a11y-size button { min-width: 44px; min-height: 40px; padding: 0 0.5rem; }
.a11y-panel button.a11y-opt {
  display: flex; width: 100%; align-items: center; justify-content: space-between;
  min-height: 44px; padding: 0.55rem 0.8rem; margin-bottom: 0.5rem; text-align: left;
}
.a11y-panel button.a11y-opt::after {
  content: 'wył.'; font-size: 0.78rem; opacity: 0.85; margin-left: 0.75rem;
}
.a11y-panel button.a11y-opt[aria-pressed="true"] { background: #F2EFE8; color: #0A0D14; border-color: #F2EFE8; }
.a11y-panel button.a11y-opt[aria-pressed="true"]::after { content: 'wł.'; }
html.a11y-contrast .a11y-panel button.a11y-opt[aria-pressed="true"] { background: #FFE14D; color: #000; border-color: #FFE14D; }
.a11y-foot { text-align: left; flex-wrap: wrap; display: flex; justify-content: space-between; align-items: center; gap: 0.75rem; margin-top: 0.75rem; font-size: 0.85rem; }
.a11y-foot a { color: inherit; text-decoration: underline; }
.a11y-reset { font: inherit; cursor: pointer; color: inherit; background: none; border: 0; text-decoration: underline; padding: 0.5rem 0; }

@media print { .a11y-toggle, .a11y-panel, .skip-link { display: none !important; } }
