/* WCAG ------------------------------------------------------------------------------------------------------------- */
/* Kontener menu po prawej, przyklejony do ekranu */
.wcag-menu-z-prawej{
    position: fixed;
    top: 80px;
    right: 20px;
    z-index: 1000;
}

/* pionowa kolumna przycisków */
.wcag-menu-z-prawej ul{
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

/* przycisk/ikona */
.wcag-menu-z-prawej a{
    position: relative;                 /* KLUCZ: kotwica dla dymka */
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 3px;
    background: #113f73;
    color: #fff;
    font-size: 22px;
    text-decoration: none;
    transition: transform .25s ease, background .25s ease;
}

.wcag-menu-z-prawej a:hover{
    background: #fc0008;
    transform: translateX(-4px);        /* lekkie przesunięcie ikony/przycisku w lewo */
}

/* --- DYMek: desktop (po lewej stronie przycisku) --- */
.wcag-menu-z-prawej a::after{
    content: attr(data-dymek);
    position: absolute;
    right: 100%;                         /* doklej do lewej strony kotwicy */
    top: 50%;
    transform: translate(-10px, -50%);   /* odsunięcie i centrowanie w pionie */
    background: rgba(0,0,0,.88);
    color: #fff;
    font-size: 14px;
    padding: 6px 10px;
    border-radius: 4px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity .18s ease, transform .18s ease;
    box-shadow: 0 4px 12px rgba(0,0,0,.2);
    z-index: 1;                          /* nad przyciskiem */
}

/* mała strzałka przy dymku */
.wcag-menu-z-prawej a::before{
    content: "";
    position: absolute;
    right: 100%;
    top: 50%;
    transform: translate(0, -50%);
    border: 6px solid transparent;
    border-right-color: rgba(0,0,0,.88); /* trójkąt w stronę przycisku */
    opacity: 0;
    transition: opacity .18s ease;
}

/* pokaż dymek na hover i focus */
.wcag-menu-z-prawej a:hover::after,
.wcag-menu-z-prawej a:focus-visible::after{
    opacity: 1;
    transform: translate(-14px, -50%);   /* delikatne wysunięcie */
}
.wcag-menu-z-prawej a:hover::before,
.wcag-menu-z-prawej a:focus-visible::before{
    opacity: 1;
}

/* --- WARIANT MOBILNY: pasek na dole, dymek NAD przyciskiem --- */
@media (max-width: 768px){
    .wcag-menu-z-prawej{
        top: auto;
        right: 0;
        bottom: 0;
        left: 0;
        background: #ffffff;
        padding: 8px 0;
        box-shadow: 0 -6px 20px rgba(0,0,0,.08);
    }

    .wcag-menu-z-prawej ul{
        flex-direction: row;
        justify-content: center;
        gap: 14px;
    }

    .wcag-menu-z-prawej a{
        width: 50px;
        height: 50px;
    }

    .wcag-menu-z-prawej a:hover{
        transform: translateY(-4px);       /* na mobile animacja do góry */
    }

    /* dymek nad przyciskiem, wycentrowany */
    .wcag-menu-z-prawej a::after{
        right: auto;
        left: 50%;
        top: auto;
        bottom: 100%;
        transform: translate(-50%, -10px);
    }

    .wcag-menu-z-prawej a::before{
        right: auto;
        left: 50%;
        top: auto;
        bottom: 100%;
        transform: translate(-50%, 0);
        border: 6px solid transparent;
        border-top-color: rgba(0,0,0,.88); /* strzałka w dół */
    }

    .wcag-menu-z-prawej a:hover::after,
    .wcag-menu-z-prawej a:focus-visible::after{
        transform: translate(-50%, -14px);
    }
}

/* Preferencja: redukcja ruchu */
@media (prefers-reduced-motion: reduce){
    .wcag-menu-z-prawej a,
    .wcag-menu-z-prawej a::after{
        transition: none;
    }
}

/* ---- WYSZUKIWARKA -------------------------------------------------------------------------------------------------*/
/* Ekranowe okno wyszukiwarki (domyślnie schowane nad ekranem) */
#searchOverlay{
    position: fixed;
    inset: 0;                       /* top/right/bottom/left: 0 */
    background: rgba(10, 23, 55, 0.92);
    backdrop-filter: blur(2px);
    z-index: 2000;

    display: grid;
    place-items: center;

    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: transform .35s ease, opacity .35s ease;
}

/* stan otwarty */
#searchOverlay.is-open{
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
}

/* pudełko wyszukiwarki w centrum */
#searchOverlay .search-box{
    width: min(800px, 92vw);
    display: grid;
    grid-template-columns: 1fr auto;
    gap: 12px;
    padding: 22px;
    background: #fff;
    border-radius: 16px;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}

#searchOverlay .search-box input{
    width: 100%;
    font-size: 18px;
    padding: 14px 16px;
    border: 2px solid #e6e8ef;
    border-radius: 12px;
    outline: none;
    transition: border-color .2s ease, box-shadow .2s ease;
}
#searchOverlay .search-box input:focus{
    border-color: var(--color_niebieski);
    box-shadow: 0 0 0 4px rgba(13,110,253,.15);
}

/* przycisk szukania */
#searchOverlay .btn-search{
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 14px 18px;
    font-weight: 700;
    font-size: 16px;
    color: darkblue;
    background: var(--color_niebieski);
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease, box-shadow .2s ease;
}
#searchOverlay .btn-search:hover{
    background: var(--color_niebieski);
    transform: translateY(-1px);
    box-shadow: 0 10px 22px rgba(13,110,253,.25);
}

/* przycisk zamykania (prawy górny róg) */
#searchOverlay .search-close{
    position: absolute;
    top: 20px;
    right: 20px;
    width: 44px;
    height: 44px;
    display: grid;
    place-items: center;
    background: rgba(255,255,255,.12);
    color: #fff;
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}
#searchOverlay .search-close:hover{
    background: rgba(255,255,255,.2);
    transform: scale(1.05);
}

/* ukryta etykieta dla dostępności */
.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;
}

/* mobile */
@media (max-width: 600px){
    #searchOverlay .search-box{
        grid-template-columns: 1fr;
    }
    #searchOverlay .btn-search{
        justify-content: center;
    }
}

/* ---- WCAG panel opcji ----------------------------------------------------------------------------------------------*/
/* Overlay (domyślnie schowany nad ekranem) */
/* OVERLAY – pełnoekranowy, klikalny tylko gdy otwarty */
#wcagPanelOverlay{
    position: fixed !important;
    inset: 0 !important;
    z-index: 2200 !important;
    background: rgba(10,23,55,.55) !important;
    backdrop-filter: blur(2px);
    display: none;                 /* domyślnie ukryty */
    opacity: 0;
    pointer-events: none;
    transition: opacity .25s ease;
}
#wcagPanelOverlay.is-open{
    display: block !important;     /* pokaż */
    opacity: 1;
    pointer-events: auto;
}

/* PANEL – zawsze idealnie na środku ekranu */
#wcagPanelOverlay .wcag-panel{
    position: fixed !important;
    top: 50% !important;
    left: 50% !important;
    transform: translate(-50%, -50%) !important;

    margin: 0 !important;
    float: none !important;        /* gdyby coś go „ściągało” */
    width: min(720px, 95vw) !important;
    max-height: 90dvh !important;
    overflow: auto !important;
    border-radius: 12px;
    background: #0f1520;           /* dostosuj do motywu */
    color: #e9edf3;
    z-index: 2201;                 /* nad tłem overlayu */
}


/* Panel w centrum */
.wcag-panel{
    position: relative;
    width: min(920px, 94vw);
    background: var(--kolor-jasny-border);
    border-radius: 16px;
    padding: 22px;
    box-shadow: 0 24px 60px rgba(0,0,0,.35);
}
.wcag-panel h2{
    margin: 0 0 14px;
    font-size: 22px;
}

/* Grid kafelków */
.wcag-grid{
    display: grid;
    grid-template-columns: repeat(3, minmax(0,1fr));
    gap: 14px;
}
@media (max-width: 720px){
    .wcag-grid{ grid-template-columns: repeat(2, minmax(0,1fr)); }
}

/* Kafelek */
.wcag-tile{
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;

    width: 100%;
    padding: 18px 12px;
    background: #eeeeee;
    color: #0d2140;
    border: 0;
    border-radius: 14px;
    cursor: pointer;

    box-shadow: 0 6px 18px rgba(0,0,0,.06);
    transition: transform .18s ease, box-shadow .18s ease, background .18s ease;
}
.wcag-tile:hover{
    transform: translateY(-3px);
    box-shadow: 0 10px 24px rgba(0,0,0,.12);
    background: #fc0008;
    color: #ffffff !important;
}
.wcag-ico{
    width: 42px; height: 42px;
    display: grid; place-items: center;
    color: #0d6efd;
}
.wcag-ico svg{ width: 100%; height: 100%; display: block; }
.wcag-label{ font-weight: 700; text-align: center; }

/* Zamknij (X) */
.wcag-close{
    position: absolute;
    top: 14px; right: 14px;
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: transparent;
    color: #334;
    border: 0;
    border-radius: 10px;
    cursor: pointer;
    transition: background .2s ease, transform .2s ease;
}
.wcag-close:hover{
    background: rgba(0,0,0,.06);
    transform: scale(1.05);
}

/* dostępność */
@media (prefers-reduced-motion: reduce){
    #wcagPanelOverlay, .wcag-tile{ transition: none; }
}
.wcag-tile.active {
    border: 4px solid var(--color_niebieski);
    background: #eaf1ff;
}
#wcagPanelTitle{
    color: var(--standard-text-color);
}

/* -- okno wcag, zmiana opcji ---------------------------------------------------------------------------------------- */
#wcagPanelOverlay { display: none; }
#wcagPanelOverlay.is-open { display: block; }
body.wcag-panel-open { overflow: hidden; } /* opcjonalnie: blokada scrolla tła */

/* Aktywna opcja w panelu */
.wcag-tile.is-active {
    outline: 3px solid #2b6fff;
    outline-offset: 2px;
    border-radius: 10px; /* opcjonalnie, ładniej */
    background: #ccc;
}

/* 1. Kontrast -> robi JS przez podmianę href arkusza; tu tylko nic */

/* 2. Skala szarości (cała strona) */
html.wcag-grayscale {
    filter: grayscale(100%) !important;
}

/* 3. Maska czytania – overlay */
#wcagReadingMask {
    position: fixed;
    inset: 0;
    z-index: 2147483640;         /* nad wszystkim, ale pointer-events: none */
    pointer-events: none;
    display: none;               /* pokazywana, gdy włączona */
    /* regulacja wysokości okna czytania */
    --maskHeight: 160px;         /* możesz zmienić np. na 220px */
    --maskY: 50vh;               /* JS aktualizuje bieżącą pozycję kursora */
    background:
            linear-gradient(
                    to bottom,
                    rgba(0,0,0,.6) 0,
                    rgba(0,0,0,.6) calc(var(--maskY) - var(--maskHeight)/2),
                    rgba(0,0,0,0)  calc(var(--maskY) - var(--maskHeight)/2),
                    rgba(0,0,0,0)  calc(var(--maskY) + var(--maskHeight)/2),
                    rgba(0,0,0,.6) calc(var(--maskY) + var(--maskHeight)/2),
                    rgba(0,0,0,.6) 100%
            );
}

/* 4. Podświetl linki – wyraźnie */
.wcag-highlight-links a {
    text-decoration: underline !important;
    outline: 2px solid #ffbf00 !important;
    outline-offset: 2px !important;
    background: #fff4bf !important;
    box-shadow: 0 0 0 2px #fff4bf inset !important;
}

/* 5. Ukryj obrazy (IMG + tła CSS) */
.wcag-hide-images img { visibility: hidden !important; } /* zamiast display:none – nie psuje layoutu */
.wcag-hide-images * ,
.wcag-hide-images *::before,
.wcag-hide-images *::after {
    background-image: none !important;
}

/* 6. Wyłącz animacje / przejścia / smooth scroll */
html.wcag-disable-animations,
html.wcag-disable-animations * ,
html.wcag-disable-animations *::before,
html.wcag-disable-animations *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}
/* Celujemy tylko w linki oznaczone atrybutem */
html a[data-wcag-hl]{
    position: relative;
    z-index: 0;
    /* podwójna opaska dookoła (nie tnie jej overflow jak outline) */
    box-shadow:
            0 0 0 3px #ffffff !important, /* wewnętrzny biały ring */
0 0 0 6px #0066ff !important;  /* zewnętrzny niebieski ring */
    text-decoration: underline !important;
    /* invert + wzmocnienie kontrastu, żeby „odbić” od tła menu */
    filter: invert(1) hue-rotate(180deg) contrast(1.35) saturate(1.2) !important;
    /* zachowanie czytelności na złożonych tłach */
    -webkit-text-stroke: 0.6px #000; /* gdzie wspierane */
}

/* wszystkie dzieci linku dziedziczą „odwrócone” kolory – nie pozwól, by motyw je nadpisał */
html a[data-wcag-hl] *,
html a[data-wcag-hl] *::before,
html a[data-wcag-hl] *::after{
    color: inherit !important;
    text-decoration: inherit !important;
    box-shadow: none !important;
}


/* ---- sterownie klawiaturą */
/* Pasek nawigacji klawiaturowej – domyślnie ukryty */
.klawiatura-wcag{
    position: fixed;
    top: 0;
    left: 50%;
    transform: translate(-50%, -120%);
    z-index: 3000;
    display: none;                     /* ukryty, JS pokaże .is-visible */

    background: rgba(15, 21, 32, .95);
    color: #fff;
    padding: 10px 14px;
    border: 2px solid #2a3440;
    border-radius: 12px;
    box-shadow: 0 6px 24px rgba(0,0,0,.35);

    transition: transform .25s ease;
}
.klawiatura-wcag.is-visible{
    display: block;
    transform: translate(-50%, 8px);
}

/* Lista pozioma */
.klawiatura-wcag ul{
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}
.klawiatura-wcag li{ margin: 0; padding: 0; }

/* Linki wyglądające jak „pigułki” */
.klawiatura-wcag a{
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    border-radius: 9999px;
    text-decoration: none;
    color: #f2f5f7;
    background: #1b2430;
    border: 2px solid transparent;
    line-height: 1.2;
    white-space: nowrap;
}
.klawiatura-wcag a:hover{
    background: #243142;
}
.klawiatura-wcag a:focus,
.klawiatura-wcag a:focus-visible{
    outline: none;
    border-color: #00ff6a;
    box-shadow: 0 0 0 3px rgba(0,255,106,.25);
}

/* Ikony */
.klawiatura-wcag .wcag-ikona{
    width: 18px;
    height: 18px;
    display: inline-block;
}

/* Preferencje ruchu: mniej animacji */
@media (prefers-reduced-motion: reduce){
    .klawiatura-wcag{ transition: none; }
}