/* =====================================================
   KVDA Accessibility Panel — accessibility.css
   Drop this file into:  public/assets/css/accessibility.css
   OR import in:         resources/css/app.css
   ===================================================== */

/* ── Custom cursor SVGs ────────────────────────────── */
/* Big cursor */
body.a11y-cursor-big *  { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='32' height='32' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M4 0l16 12.279-6.951 1.17 4.325 8.817-2.354 1.154-4.316-8.8-6.704 5.947z'/%3E%3C/svg%3E") 0 0, auto !important; }
/* Extra-large cursor */
body.a11y-cursor-xl *   { cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='1' d='M4 0l16 12.279-6.951 1.17 4.325 8.817-2.354 1.154-4.316-8.8-6.704 5.947z'/%3E%3C/svg%3E") 0 0, auto !important; }

/* ── Contrast modes ────────────────────────────────── */
body.a11y-contrast-high {
    filter: contrast(1.6) !important;
}
body.a11y-contrast-aaa {
    --bg: #ffffff;
    --fg: #000000;
    background-color: #ffffff !important;
    color: #000000 !important;
}
body.a11y-contrast-aaa * {
    background-color: #ffffff !important;
    color: #000000 !important;
    border-color: #000000 !important;
}
body.a11y-contrast-aaa a { color: #0000cc !important; text-decoration: underline !important; }
body.a11y-contrast-dark {
    filter: invert(1) hue-rotate(180deg) !important;
}
body.a11y-contrast-light {
    filter: brightness(1.2) contrast(0.9) !important;
}

/* ── Color filters ─────────────────────────────────── */
body.a11y-filter-grayscale     { filter: grayscale(1) !important; }
body.a11y-filter-protanopia    { filter: url(#a11y-filter-protanopia) !important; }
body.a11y-filter-deuteranopia  { filter: url(#a11y-filter-deuteranopia) !important; }
body.a11y-filter-tritanopia    { filter: url(#a11y-filter-tritanopia) !important; }
body.a11y-filter-low-saturation  { filter: saturate(0.3) !important; }
body.a11y-filter-high-saturation { filter: saturate(2.5) !important; }

/* ── Text alignment ────────────────────────────────── */
body.a11y-align-left    p, body.a11y-align-left    li { text-align: left    !important; }
body.a11y-align-center  p, body.a11y-align-center  li { text-align: center  !important; }
body.a11y-align-right   p, body.a11y-align-right   li { text-align: right   !important; }
body.a11y-align-justify p, body.a11y-align-justify li { text-align: justify !important; }

/* ── Font families ─────────────────────────────────── */
body.a11y-font-sans-serif * { font-family: Arial, Helvetica, sans-serif !important; }
body.a11y-font-serif      * { font-family: Georgia, 'Times New Roman', serif !important; }
body.a11y-font-dyslexia   * { font-family: 'OpenDyslexic', 'Comic Sans MS', Arial, sans-serif !important; }

/* ── Highlight links ───────────────────────────────── */
body.a11y-highlight-links a {
    background-color: #ffff00 !important;
    color: #000000 !important;
    text-decoration: underline !important;
    outline: 2px solid #ff6600 !important;
    padding: 0 2px !important;
    border-radius: 2px !important;
}
/* ── Highlight headings ────────────────────────────── */
body.a11y-highlight-headings h1,
body.a11y-highlight-headings h2,
body.a11y-highlight-headings h3,
body.a11y-highlight-headings h4,
body.a11y-highlight-headings h5,
body.a11y-highlight-headings h6 {
    background-color: #ffe680 !important;
    color: #000000 !important;
    outline: 2px solid #c8a000 !important;
    padding: 4px 6px !important;
    border-radius: 3px !important;
}
/* ── Highlight focus ───────────────────────────────── */
body.a11y-highlight-focus *:focus {
    outline: 4px solid #ff6b00 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(255,107,0,0.25) !important;
}
/* ── Hide images ───────────────────────────────────── */
body.a11y-hide-images img,
body.a11y-hide-images video,
body.a11y-hide-images picture,
body.a11y-hide-images figure {
    visibility: hidden !important;
}
/* ── Pause animations ──────────────────────────────── */
body.a11y-pause-animations *,
body.a11y-pause-animations *::before,
body.a11y-pause-animations *::after {
    animation-play-state: paused !important;
    transition-duration: 0s !important;
    animation-duration: 0s !important;
}
/* ── Reading mode ──────────────────────────────────── */
body.a11y-reading-mode #content {
    max-width: 720px !important;
    margin: 0 auto !important;
    padding: 2rem 1.5rem !important;
    font-size: 1.1rem !important;
    line-height: 1.8 !important;
    background: #fdfdf8 !important;
}
body.a11y-reading-mode nav,
body.a11y-reading-mode footer,
body.a11y-reading-mode aside,
body.a11y-reading-mode .sidebar,
body.a11y-reading-mode [class*="banner"],
body.a11y-reading-mode [class*="advert"] {
    display: none !important;
}
/* ── Reading guide line ────────────────────────────── */
#a11y-reading-line {
    position: fixed;
    left: 0;
    width: 100%;
    height: 3px;
    background: rgba(0, 115, 0, 0.65);
    box-shadow: 0 0 0 9999px rgba(0,0,0,0);
    pointer-events: none;
    z-index: 99990;
    transition: top 0.08s linear;
}
/* ── Reading mask ──────────────────────────────────── */
#a11y-mask-top,
#a11y-mask-bottom {
    position: fixed;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.65);
    pointer-events: none;
    z-index: 99989;
    transition: top 0.06s linear, height 0.06s linear;
}
/* ── Keyboard nav ──────────────────────────────────── */
body.a11y-keyboard-nav *:focus-visible {
    outline: 3px solid #0066cc !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 5px rgba(0,102,204,0.2) !important;
}
body.a11y-keyboard-nav a:not([tabindex="-1"]),
body.a11y-keyboard-nav button:not([tabindex="-1"]),
body.a11y-keyboard-nav input:not([tabindex="-1"]),
body.a11y-keyboard-nav select:not([tabindex="-1"]) {
    outline-offset: 2px;
}

/* =====================================================
   PANEL UI STYLES
   ===================================================== */

/* ── Floating trigger ──────────────────────────────── */
.a11y-trigger {
    position: fixed;
    left: 50%;
    bottom: 0;
    transform: translateY(-50%);
    background: #115f2c;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    padding: 12px 8px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    cursor: pointer;
    z-index: 99998;
    box-shadow: -2px 2px 8px rgba(0,0,0,0.25);
    transition: background 0.2s, transform 0.2s;
    writing-mode: vertical-rl;
    text-orientation: mixed;
    min-width: 44px;
    min-height: 44px;
}
.a11y-trigger:hover,
.a11y-trigger:focus-visible {
    background: #0d4a22;
    outline: 3px solid #ffffff;
    outline-offset: -3px;
}
.a11y-trigger-label {
    writing-mode: vertical-rl;
    font-size: 11px;
    font-weight: 600;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    margin-top: 4px;
}

/* ── Panel ─────────────────────────────────────────── */
.a11y-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 100vw;
    height: 100vh;
    background: #ffffff;
    box-shadow: -4px 0 24px rgba(0,0,0,0.18);
    z-index: 99999;
    display: flex;
    flex-direction: column;
    font-family: inherit;
    font-size: 14px;
    color: #1a1a1a;
    transform: translateX(100%);
    transition: transform 0.3s cubic-bezier(0.4,0,0.2,1);
    border-left: 3px solid #115f2c;
}
.a11y-panel:not([hidden]) {
    transform: translateX(0);
}
/* override 'hidden' attribute for transition to work */
.a11y-panel[hidden] {
    display: flex !important;
    transform: translateX(100%);
}

/* ── Panel header ──────────────────────────────────── */
.a11y-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    background: #115f2c;
    color: #ffffff;
    flex-shrink: 0;
}
.a11y-panel-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 700;
    margin: 0;
    color: #ffffff;
}
.a11y-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}
.a11y-reset-btn {
    display: flex;
    align-items: center;
    gap: 4px;
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 4px 8px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    min-height: 32px;
}
.a11y-reset-btn:hover { background: rgba(255,255,255,0.25); }
.a11y-close-btn {
    background: rgba(255,255,255,0.15);
    color: #ffffff;
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 4px;
    padding: 4px 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
    min-height: 32px;
    min-width: 32px;
}
.a11y-close-btn:hover { background: rgba(255,255,255,0.3); }

/* ── Panel body ────────────────────────────────────── */
.a11y-panel-body {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0 24px;
}
.a11y-panel-body::-webkit-scrollbar { width: 6px; }
.a11y-panel-body::-webkit-scrollbar-thumb { background: #c8d8c8; border-radius: 3px; }

/* ── Section ───────────────────────────────────────── */
.a11y-section {
    padding: 12px 16px;
    border-bottom: 1px solid #eef2ee;
}
.a11y-section:last-child { border-bottom: none; }
.a11y-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: #115f2c;
    margin: 0 0 10px;
}

/* ── Chip groups ───────────────────────────────────── */
.a11y-chip-group {
    display: flex;
    flex-wrap: nowrap;
    gap: 6px;
}
.a11y-chip-wrap {
    flex-wrap: wrap;
}
.a11y-chip {
    padding: 5px 10px;
    border-radius: 20px;
    border: 1.5px solid #c2d6c2;
    background: #f4f8f4;
    color: #1a1a1a;
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    min-height: 32px;
}
.a11y-chip:hover { border-color: #115f2c; background: #eaf2ea; }
.a11y-chip.a11y-chip-active,
.a11y-chip[aria-pressed="true"] {
    background: #115f2c;
    color: #ffffff;
    border-color: #115f2c;
}

/* ── Icon button group ─────────────────────────────── */
.a11y-icon-group {
    display: flex;
    gap: 6px;
}
.a11y-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* ── Generic btn ───────────────────────────────────── */
.a11y-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: 1.5px solid #c2d6c2;
    background: #f4f8f4;
    color: #1a1a1a;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    transition: all 0.15s;
    min-height: 36px;
    padding: 6px 12px;
}
.a11y-btn:hover { border-color: #115f2c; background: #eaf2ea; }
.a11y-btn.a11y-btn-icon {
    width: 36px;
    height: 36px;
    padding: 0;
    border-radius: 8px;
}
.a11y-btn.a11y-btn-icon.a11y-chip-active {
    background: #115f2c;
    color: #ffffff;
    border-color: #115f2c;
}
.a11y-btn-primary {
    background: #115f2c;
    color: #ffffff;
    border-color: #115f2c;
}
.a11y-btn-primary:hover { background: #0d4a22; }

/* ── Font size controls ────────────────────────────── */
.a11y-font-size-controls {
    justify-content: center;
}
.a11y-value-display {
    font-weight: 700;
    font-size: 13px;
    color: #115f2c;
    min-width: 40px;
    text-align: center;
}

/* ── Sliders ───────────────────────────────────────── */
.a11y-slider-row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    margin-top: 8px;
}
.a11y-slider-row:first-child { margin-top: 0; }
.a11y-slider-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #444;
    font-weight: 500;
}
.a11y-slider {
    width: 100%;
    accent-color: #115f2c;
    cursor: pointer;
    height: 4px;
    border-radius: 2px;
}

/* ── Toggle switches ───────────────────────────────── */
.a11y-toggle-list { display: flex; flex-direction: column; gap: 2px; }
.a11y-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 0;
    font-size: 13px;
    gap: 8px;
    cursor: pointer;
}
.a11y-toggle {
    position: relative;
    width: 40px;
    height: 22px;
    background: #d0d8d0;
    border: none;
    border-radius: 11px;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.2s;
    padding: 0;
    min-height: 22px;
}
.a11y-toggle[aria-checked="true"] { background: #115f2c; }
.a11y-toggle-thumb {
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    background: #ffffff;
    border-radius: 50%;
    transition: transform 0.2s;
    pointer-events: none;
    display: block;
}
.a11y-toggle[aria-checked="true"] .a11y-toggle-thumb { transform: translateX(18px); }

/* ── TTS controls ──────────────────────────────────── */
.a11y-tts-controls { display: flex; flex-direction: column; gap: 10px; }

/* ── Skip link (keyboard nav) ──────────────────────── */
.a11y-skip-link {
    position: absolute;
    top: -100%;
    left: 0;
    background: #115f2c;
    color: #ffffff;
    padding: 10px 16px;
    font-weight: 700;
    z-index: 999999;
    text-decoration: none;
    border-radius: 0 0 6px 0;
}
.a11y-skip-link:focus { top: 0; }

/* ── Backdrop ──────────────────────────────────────── */
.a11y-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.35);
    z-index: 99997;
    cursor: pointer;
}
.a11y-backdrop.a11y-backdrop-visible { display: block; }

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 400px) {
    .a11y-panel { width: 100vw; }
    .a11y-trigger { display: none; }
}