/* ============================================================
   ACCESSIBILITY — portal.opus.org.pl
   Klasy aplikowane na <html> przez accessibility.js
   ============================================================ */

/* === HIGH CONTRAST === */
html.a11y-high-contrast,
html.a11y-high-contrast body {
    background: #000 !important;
    color: #fff !important;
}
html.a11y-high-contrast *:not(i):not(svg):not(path):not(circle):not(rect) {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}
html.a11y-high-contrast a,
html.a11y-high-contrast a * {
    color: #ffff00 !important;
    text-decoration: underline !important;
}
html.a11y-high-contrast button,
html.a11y-high-contrast .btn,
html.a11y-high-contrast input,
html.a11y-high-contrast select,
html.a11y-high-contrast textarea {
    background: #000 !important;
    color: #fff !important;
    border: 2px solid #fff !important;
}
html.a11y-high-contrast button:hover,
html.a11y-high-contrast .btn:hover {
    background: #fff !important;
    color: #000 !important;
}
html.a11y-high-contrast img,
html.a11y-high-contrast video {
    filter: grayscale(1) contrast(1.2) !important;
}
html.a11y-high-contrast .hero-section,
html.a11y-high-contrast .section-alt,
html.a11y-high-contrast section {
    background: #000 !important;
}

/* === DARK MODE === */
html.a11y-dark-mode,
html.a11y-dark-mode body {
    background: #1a1a1a !important;
    color: #f3f4f6 !important;
}
html.a11y-dark-mode *:not(i):not(svg):not(path):not(circle):not(rect):not(.a11y-fab):not(.a11y-panel):not(.a11y-panel *) {
    background-color: transparent !important;
    color: #f3f4f6 !important;
    border-color: #4b5563 !important;
}
html.a11y-dark-mode body,
html.a11y-dark-mode section,
html.a11y-dark-mode header,
html.a11y-dark-mode footer,
html.a11y-dark-mode nav,
html.a11y-dark-mode main,
html.a11y-dark-mode aside,
html.a11y-dark-mode .card,
html.a11y-dark-mode .container,
html.a11y-dark-mode .row,
html.a11y-dark-mode [class*="section-"] {
    background-color: #1a1a1a !important;
}
html.a11y-dark-mode section:nth-of-type(even),
html.a11y-dark-mode .section-alt,
html.a11y-dark-mode .card {
    background-color: #262626 !important;
}
html.a11y-dark-mode h1, html.a11y-dark-mode h2, html.a11y-dark-mode h3,
html.a11y-dark-mode h4, html.a11y-dark-mode h5, html.a11y-dark-mode h6,
html.a11y-dark-mode strong, html.a11y-dark-mode b {
    color: #ffffff !important;
}
html.a11y-dark-mode a,
html.a11y-dark-mode a * {
    color: #fbbf24 !important;
}
html.a11y-dark-mode a:hover,
html.a11y-dark-mode a:hover * {
    color: #fde68a !important;
}
html.a11y-dark-mode button:not(.a11y-fab):not(.a11y-toggle):not(.a11y-reset):not([data-a11y]),
html.a11y-dark-mode .btn,
html.a11y-dark-mode input,
html.a11y-dark-mode select,
html.a11y-dark-mode textarea {
    background-color: #374151 !important;
    color: #f3f4f6 !important;
    border: 1px solid #6b7280 !important;
}
html.a11y-dark-mode button:not(.a11y-fab):not(.a11y-toggle):not(.a11y-reset):not([data-a11y]):hover,
html.a11y-dark-mode .btn:hover {
    background-color: #4b5563 !important;
    color: #ffffff !important;
}
html.a11y-dark-mode img:not([src*="logo"]):not([src*=".svg"]) {
    filter: brightness(0.85) !important;
}

/* === BIG CURSOR === */
html.a11y-big-cursor,
html.a11y-big-cursor * {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='%23000' stroke='%23fff' stroke-width='1' d='M5.5 3.5l13 8.5-5.5 1.5 3 6-2 1-3-6-4 4z'/></svg>") 2 2, auto !important;
}
html.a11y-big-cursor a,
html.a11y-big-cursor button,
html.a11y-big-cursor [role="button"] {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'><path fill='%23000' stroke='%23fff' stroke-width='1' d='M12 2a3 3 0 00-3 3v8.5L7 12a2 2 0 00-3 2l5 7h9a3 3 0 003-3V8a3 3 0 00-3-3v-.5a2.5 2.5 0 00-4-1A2.5 2.5 0 0012 2z'/></svg>") 12 4, pointer !important;
}

/* === LINK HIGHLIGHT === */
html.a11y-link-highlight a:not(.btn):not(.nav-link) {
    background-color: #fef3c7 !important;
    color: #1e40af !important;
    padding: 2px 4px !important;
    text-decoration: underline !important;
    font-weight: 600 !important;
}
html.a11y-link-highlight.a11y-high-contrast a:not(.btn):not(.nav-link) {
    background-color: #000 !important;
    color: #ffff00 !important;
    outline: 2px solid #ffff00 !important;
}

/* === LINE HEIGHT === */
html.a11y-line-height,
html.a11y-line-height * {
    line-height: 2 !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* === A11Y PANEL === */
.a11y-fab {
    position: fixed;
    right: 0;
    top: 33vh;
    z-index: 9999;
    background: #FFED00;
    color: #000;
    border: 2px solid #000;
    border-right: none;
    border-radius: 10px 0 0 10px;
    width: 56px;
    height: 56px;
    font-size: 28px;
    box-shadow: -3px 3px 10px rgba(0, 0, 0, 0.18);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s, transform 0.2s;
}
.a11y-fab:hover,
.a11y-fab:focus {
    background: #fff27a;
    outline: none;
    transform: translateX(-2px);
}
.a11y-panel {
    position: fixed;
    right: 0;
    top: calc(33vh + 60px);
    z-index: 9998;
    background: #fff;
    color: #111;
    width: 320px;
    max-width: 92vw;
    border: 2px solid #F0821B;
    border-right: none;
    border-radius: 8px 0 0 8px;
    box-shadow: -4px 4px 16px rgba(0,0,0,0.15);
    padding: 18px;
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    display: none;
}
.a11y-panel[data-open="true"] {
    display: block;
}
.a11y-panel h3 {
    margin: 0 0 12px;
    font-size: 16px;
    color: #111;
    font-weight: 700;
}
.a11y-panel .a11y-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid #f3f4f6;
}
.a11y-panel .a11y-row:last-of-type { border-bottom: none; }
.a11y-panel label {
    font-size: 14px;
    color: #374151;
    flex: 1;
}
.a11y-panel .a11y-toggle {
    background: #e5e7eb;
    border: none;
    border-radius: 999px;
    width: 40px;
    height: 22px;
    position: relative;
    cursor: pointer;
    transition: background 0.2s;
}
.a11y-panel .a11y-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: left 0.2s;
}
.a11y-panel .a11y-toggle[aria-pressed="true"] {
    background: #10b981;
}
.a11y-panel .a11y-toggle[aria-pressed="true"]::after {
    left: 20px;
}
.a11y-panel .a11y-fonts {
    display: flex;
    gap: 6px;
}
.a11y-panel .a11y-fonts button {
    flex: 1;
    padding: 6px 0;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
}
.a11y-panel .a11y-fonts button.active {
    background: #F0821B;
    color: #fff;
    border-color: #F0821B;
}
.a11y-panel .a11y-reset {
    margin-top: 12px;
    width: 100%;
    padding: 10px;
    background: #f3f4f6;
    border: 1px solid #d1d5db;
    border-radius: 4px;
    cursor: pointer;
    font-weight: 600;
    color: #374151;
}
.a11y-panel .a11y-reset:hover {
    background: #e5e7eb;
}

/* Topbar buttons — active state */
.accessibility-tools .font-btn.active,
.accessibility-tools .contrast-btn.active {
    background: #F0821B !important;
    color: #fff !important;
}

@media (max-width: 768px) {
    .a11y-fab { width: 48px; height: 48px; font-size: 22px; top: 40vh; }
    .a11y-panel { top: calc(40vh + 52px); width: 280px; }
}
