/**
 * Accessibility - WCAG 2.1 AA
 */

/* Skip link - widoczny tylko przy focus */
.tmt-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 1000;
    background: var(--tm-primary-dark);
    color: #fff;
    padding: 12px 24px;
    text-decoration: none;
    font-weight: 600;
    border-radius: 0 0 var(--tm-radius) 0;
}
.tmt-skip-link:focus {
    left: 0;
    outline: 3px solid var(--tm-accent);
    outline-offset: 2px;
    color: #fff;
}

/* Screen reader only */
.screen-reader-text,
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}
.sr-only:focus {
    position: static;
    width: auto;
    height: auto;
    margin: 0;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* Focus rings - WCAG 2.4.7 */
a:focus-visible,
button:focus-visible,
input:focus-visible,
textarea:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid var(--tm-accent);
    outline-offset: 2px;
    border-radius: 2px;
}

main:focus { outline: none; }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* High contrast */
@media (prefers-contrast: more) {
    :root {
        --tm-text-muted: #2d3748;
        --tm-border: #718096;
    }
}

/* Touch targets - min 44x44 */
.tmt-btn,
.tmt-nav a,
button {
    min-height: 44px;
}

/* ================================================================
   WIDGET DOSTĘPNOŚCI — panel
   ================================================================ */

/* Przycisk otwierający */
.tmt-a11y-btn {
    position: fixed;
    bottom: 80px;
    left: 16px;
    z-index: 99990;
    background: #0E5D6E;
    color: #fff;
    border: 0;
    border-radius: 50%;
    width: 46px;
    height: 46px;
    font-size: 18px;
    cursor: pointer;
    box-shadow: 0 3px 10px rgba(14,93,110,.35);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform .15s;
}
.tmt-a11y-btn:hover,
.tmt-a11y-btn:focus { transform: scale(1.1); outline: 3px solid #F2A623; }

/* Panel */
.tmt-a11y-panel {
    position: fixed;
    bottom: 136px;
    left: 16px;
    z-index: 99991;
    background: #fff;
    border: 2px solid #0E5D6E;
    border-radius: 12px;
    box-shadow: 0 8px 24px rgba(0,0,0,.15);
    width: 260px;
    padding: 16px;
    display: none;
}
.tmt-a11y-panel.is-open { display: block; }
.tmt-a11y-panel h3 {
    margin: 0 0 12px;
    font-size: 14px;
    color: #0E5D6E;
    text-transform: uppercase;
    letter-spacing: .5px;
}
.tmt-a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 14px;
}
.tmt-a11y-row label { color: #2d3748; }
.tmt-a11y-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    flex-shrink: 0;
}
.tmt-a11y-toggle input { opacity: 0; width: 0; height: 0; }
.tmt-a11y-toggle span {
    position: absolute;
    inset: 0;
    background: #cbd5e0;
    border-radius: 11px;
    cursor: pointer;
    transition: background .2s;
}
.tmt-a11y-toggle span::after {
    content: '';
    position: absolute;
    left: 2px; top: 2px;
    width: 18px; height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform .2s;
}
.tmt-a11y-toggle input:checked + span { background: #1D9E75; }
.tmt-a11y-toggle input:checked + span::after { transform: translateX(18px); }
.tmt-a11y-toggle input:focus + span { outline: 2px solid #F2A623; }

.tmt-a11y-size-btns { display: flex; gap: 6px; }
.tmt-a11y-size-btn {
    border: 1px solid #cbd5e0;
    background: #fff;
    border-radius: 4px;
    padding: 3px 9px;
    cursor: pointer;
    font-weight: 600;
    color: #4a5568;
    transition: all .1s;
}
.tmt-a11y-size-btn.active,
.tmt-a11y-size-btn:hover { border-color: #0E5D6E; background: #E3F1F4; color: #0E5D6E; }
.tmt-a11y-reset {
    margin-top: 8px;
    width: 100%;
    background: transparent;
    border: 1px solid #cbd5e0;
    border-radius: 6px;
    padding: 7px;
    font-size: 13px;
    color: #718096;
    cursor: pointer;
}
.tmt-a11y-reset:hover { border-color: #A32D2D; color: #A32D2D; }

/* ================================================================
   Tryby dostępności — klasy na <body>
   ================================================================ */

/* Wysoki kontrast — podstawa */
body.tmt-high-contrast {
    background: #000 !important;
    color: #fff !important;
}
body.tmt-high-contrast a { color: #FFD700 !important; text-decoration: underline !important; }

/* Wszystkie elementy z tłem i tekstem — wymuś ciemny schemat */
body.tmt-high-contrast *:not(script):not(style) {
    background-color: transparent !important;
    color: #fff !important;
    border-color: #555 !important;
}

/* Karty i sekcje — nadaj ciemne tło explicite */
body.tmt-high-contrast .tmt-plan,
body.tmt-high-contrast .tmt-card,
body.tmt-high-contrast .tmt-feature,
body.tmt-high-contrast header,
body.tmt-high-contrast nav,
body.tmt-high-contrast footer,
body.tmt-high-contrast section,
body.tmt-high-contrast article,
body.tmt-high-contrast .tmt-hero,
body.tmt-high-contrast .tmt-section,
body.tmt-high-contrast .tmt-section-alt,
body.tmt-high-contrast .tmt-pricing,
body.tmt-high-contrast .tmt-feature-icon,
body.tmt-high-contrast .tmt-a11y-panel,
body.tmt-high-contrast [style*="background"] {
    background: #111 !important;
    color: #fff !important;
    border-color: #555 !important;
}

/* Ptaszki w listach planów */
body.tmt-high-contrast .tmt-plan ul li::before {
    color: #7FD4A0 !important;
}

/* Badge "Najpopularniejszy" */
body.tmt-high-contrast .tmt-plan-badge,
body.tmt-high-contrast .tmt-plan-popular::before {
    background: #FFD700 !important;
    color: #000 !important;
}

/* Przyciski */
body.tmt-high-contrast button,
body.tmt-high-contrast .tmt-btn,
body.tmt-high-contrast a.tmt-btn,
body.tmt-high-contrast [class*="tmt-btn"] {
    background: #FFD700 !important;
    color: #000 !important;
    border: 2px solid #fff !important;
}
body.tmt-high-contrast button:hover,
body.tmt-high-contrast .tmt-btn:hover {
    background: #fff !important;
    color: #000 !important;
}

/* Inputy i formularze */
body.tmt-high-contrast input,
body.tmt-high-contrast select,
body.tmt-high-contrast textarea {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}

/* Obrazki — delikatne dostosowanie */
body.tmt-high-contrast img { filter: contrast(1.2) brightness(0.85); }

/* SVG i ikony — wymień kolor fill */
body.tmt-high-contrast svg path,
body.tmt-high-contrast svg rect,
body.tmt-high-contrast svg circle { fill: #fff; }

/* ---- Wydziel nagłówek od reszty ---- */
body.tmt-high-contrast .tmt-header,
body.tmt-high-contrast .tmt-nav {
    background: #000 !important;
    border-bottom: 2px solid #FFD700 !important;
}

/* Rozmiar tekstu */
body.tmt-text-lg  { font-size: 118% !important; }
body.tmt-text-xl  { font-size: 136% !important; }

/* Podkreślenie linków */
body.tmt-underline-links a { text-decoration: underline !important; }

/* Wyraźny fokus */
body.tmt-focus-visible *:focus {
    outline: 3px solid #F2A623 !important;
    outline-offset: 2px !important;
    border-radius: 2px !important;
}
