/* ============================================================
   Mustvee Ligipääsetavus — a11y.css  v1.0
   WCAG 2.1 AA vastavuse tööriistad
   ============================================================ */

/* ── 1. VAHELE MINEMISE LINGID (skip links) — WCAG 2.4.1 ─────────────────
   Peidetud vaikimisi, ilmuvad Tab-klahviga fookuse saamisel.               */

.mva11y-skip {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999999;
    display: flex;
    gap: 4px;
}

.mva11y-skip__link {
    display: inline-block;
    padding: 10px 18px;
    background: #04213E;
    color: #fff !important;
    font-size: 14px;
    font-weight: 700;
    font-family: inherit;
    text-decoration: none !important;
    border-radius: 0 0 6px 0;
    /* Peidetud seni kuni pole fookust */
    position: absolute;
    left: -99999px;
    white-space: nowrap;
}

.mva11y-skip__link:focus {
    position: static;
    left: auto;
    outline: 3px solid #185FA5;
    outline-offset: 3px;
}

/* ── 2. KÄIVITUSENUPP (trigger) ──────────────────────────────────────────── */

.mva11y-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 99997;
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: #04213E;
    color: #fff;
    border: 2px solid rgba(255,255,255,0.15);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    box-shadow: 0 4px 20px rgba(0,0,0,0.35);
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
}

.mva11y-trigger:hover {
    background: #185FA5;
    transform: scale(1.07);
    box-shadow: 0 6px 24px rgba(0,0,0,0.4);
}

.mva11y-trigger:focus-visible {
    outline: 3px solid #185FA5;
    outline-offset: 4px;
}

.mva11y-trigger[aria-expanded="true"] {
    background: #185FA5;
}

.mva11y-trigger.is-left {
    right: auto;
    left: 24px;
}

/* Tooltip */
.mva11y-trigger::after {
    content: attr(title);
    position: absolute;
    bottom: calc(100% + 8px);
    right: 0;
    background: rgba(0,0,0,0.82);
    color: #fff;
    font-size: 12px;
    padding: 5px 10px;
    border-radius: 5px;
    white-space: nowrap;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    font-family: inherit;
}

.mva11y-trigger:hover::after,
.mva11y-trigger:focus::after {
    opacity: 1;
}

.mva11y-trigger.is-left::after {
    right: auto;
    left: 0;
}

/* ── 3. PANEEL ────────────────────────────────────────────────────────────── */

.mva11y-panel {
    position: fixed;
    bottom: 88px;
    right: 24px;
    z-index: 99998;
    width: 296px;
    max-height: calc(100dvh - 120px);
    background: #fff;
    border: 1px solid rgba(26,40,56,0.14);
    border-radius: 12px;
    box-shadow: 0 8px 48px rgba(0,0,0,0.22);
    display: none;
    flex-direction: column;
    overflow: hidden;
    font-size: 14px;
    line-height: 1.4;
    color: #1a2433;
    font-family: inherit;
}

.mva11y-panel.is-open {
    display: flex;
}

.mva11y-panel.is-left {
    right: auto;
    left: 24px;
}

/* Päis */
.mva11y-panel__hd {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 14px 11px;
    background: #04213E;
    color: #fff;
    border-radius: 11px 11px 0 0;
    flex-shrink: 0;
    gap: 8px;
}

.mva11y-panel__title {
    font-size: 14px;
    font-weight: 700;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 8px;
    letter-spacing: 0.01em;
}

.mva11y-panel__close {
    background: transparent;
    border: none;
    color: rgba(255,255,255,0.75);
    cursor: pointer;
    padding: 4px;
    border-radius: 5px;
    display: flex;
    align-items: center;
    flex-shrink: 0;
    transition: color 0.15s;
    line-height: 1;
}

.mva11y-panel__close:hover  { color: #fff; }
.mva11y-panel__close:focus-visible { outline: 2px solid rgba(255,255,255,0.8); }

/* Keha – keritav */
.mva11y-panel__body {
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 14px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #c8cdd5 transparent;
    flex: 1 1 auto;
}

/* Jalus */
.mva11y-panel__ft {
    border-top: 1px solid #eef0f3;
    padding: 10px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

/* ── 4. SEKTSIOONI PÄIS ───────────────────────────────────────────────────── */

.mva11y-sect {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.mva11y-sect__lbl {
    font-size: 10px;
    font-weight: 700;
    letter-spacing: 0.09em;
    text-transform: uppercase;
    color: #6b7a8d;
    margin: 0;
    padding-bottom: 5px;
    border-bottom: 1px solid #eef0f3;
}

/* ── 5. TEKSTI SUURUSE NUPUD ─────────────────────────────────────────────── */

.mva11y-sz {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 5px;
}

.mva11y-sz__btn {
    background: #f0f2f5;
    border: 2px solid transparent;
    border-radius: 7px;
    padding: 9px 4px;
    cursor: pointer;
    font-weight: 700;
    color: #1a2433;
    font-family: inherit;
    transition: background 0.12s, border-color 0.12s;
    text-align: center;
    line-height: 1;
}

.mva11y-sz__btn:hover          { background: #e2e7ed; }
.mva11y-sz__btn.is-on          { background: #e8f0fb; border-color: #185FA5; color: #185FA5; }
.mva11y-sz__btn:focus-visible  { outline: 2px solid #185FA5; outline-offset: 2px; }

.mva11y-sz__btn[data-sz="s"]  { font-size: 11px; }
.mva11y-sz__btn[data-sz="m"]  { font-size: 13px; }
.mva11y-sz__btn[data-sz="l"]  { font-size: 16px; }
.mva11y-sz__btn[data-sz="xl"] { font-size: 19px; }

/* ── 6. KONTRASTSUSE NUPUD ───────────────────────────────────────────────── */

.mva11y-ct {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 6px;
}

.mva11y-ct__btn {
    border: 2px solid transparent;
    border-radius: 7px;
    padding: 10px 8px 8px;
    cursor: pointer;
    font-size: 12px;
    font-weight: 600;
    font-family: inherit;
    transition: border-color 0.15s, box-shadow 0.15s;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
}

.mva11y-ct__btn:focus-visible { outline: 2px solid #185FA5; outline-offset: 2px; }

.mva11y-ct__btn.is-on {
    border-color: #185FA5 !important;
    box-shadow: 0 0 0 3px rgba(24,95,165,0.22);
}

.mva11y-ct__sample {
    font-size: 18px;
    font-weight: 900;
    line-height: 1;
    display: block;
}

/* visuaalne esitus nupul */
.mva11y-ct__btn--normal { background: #fff;    color: #1a2433; border-color: #dee2e6; }
.mva11y-ct__btn--dark   { background: #121212; color: #fff; }
.mva11y-ct__btn--light  { background: #fff;    color: #000; border-color: #000; }
.mva11y-ct__btn--yellow { background: #000;    color: #ff0; }

/* ── 7. LÜLITID (TOGGLES) ────────────────────────────────────────────────── */

.mva11y-tog-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.mva11y-tog {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 10px;
    border-radius: 7px;
    cursor: pointer;
    transition: background 0.12s;
}

.mva11y-tog:hover { background: #f5f7fa; }

.mva11y-tog__btn {
    background: none;
    border: none;
    cursor: pointer;
    text-align: left;
    padding: 0;
    font-size: 13px;
    color: #1a2433;
    font-family: inherit;
    flex: 1;
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 24px;
}

.mva11y-tog__btn:focus-visible { outline: 2px solid #185FA5; outline-offset: 2px; border-radius: 4px; }

.mva11y-tog__ico {
    width: 18px;
    height: 18px;
    flex-shrink: 0;
    color: #6b7a8d;
    display: flex;
    align-items: center;
}

/* Lüliti visuaal */
.mva11y-sw {
    position: relative;
    width: 36px;
    height: 20px;
    flex-shrink: 0;
    pointer-events: none;
}

.mva11y-sw__track {
    position: absolute;
    inset: 0;
    background: #c8cdd5;
    border-radius: 10px;
    transition: background 0.2s;
}

.mva11y-sw__thumb {
    position: absolute;
    top: 2px;
    left: 2px;
    width: 16px;
    height: 16px;
    background: #fff;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0,0,0,0.22);
    transition: transform 0.2s;
}

.mva11y-tog.is-on .mva11y-sw__track { background: #185FA5; }
.mva11y-tog.is-on .mva11y-sw__thumb { transform: translateX(16px); }
.mva11y-tog.is-on .mva11y-tog__ico  { color: #185FA5; }

/* ── 8. JALUSE NUPUD ─────────────────────────────────────────────────────── */

.mva11y-reset {
    background: #f0f2f5;
    border: 1px solid #dee2e6;
    border-radius: 7px;
    padding: 8px 12px;
    font-size: 13px;
    color: #4a5568;
    cursor: pointer;
    width: 100%;
    font-family: inherit;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: background 0.15s;
}

.mva11y-reset:hover        { background: #e2e7ed; }
.mva11y-reset:focus-visible { outline: 2px solid #185FA5; outline-offset: 2px; }

.mva11y-stmt-lnk {
    font-size: 12px;
    text-align: center;
    color: #185FA5;
    text-decoration: none;
    padding: 3px 4px;
    border-radius: 4px;
    transition: text-decoration 0.1s;
}

.mva11y-stmt-lnk:hover        { text-decoration: underline; }
.mva11y-stmt-lnk:focus-visible { outline: 2px solid #185FA5; outline-offset: 2px; }

/* ── 9. LUGEMISJOONE ─────────────────────────────────────────────────────── */

#mva11y-guide {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 32px;
    background: rgba(255, 247, 140, 0.32);
    border-top: 1px solid rgba(200, 175, 0, 0.4);
    border-bottom: 1px solid rgba(200, 175, 0, 0.4);
    pointer-events: none;
    z-index: 99990;
}

/* ── 10. REŽIIMID — TEKSTISUURUS ─────────────────────────────────────────── */

html.a11y-s  { font-size: 14px !important; }
html.a11y-s  body { font-size: 14px !important; }

html.a11y-l  { font-size: 18px !important; }
html.a11y-l  body { font-size: 18px !important; }

html.a11y-xl { font-size: 21px !important; }
html.a11y-xl body { font-size: 21px !important; }

/* Peamised elemendid, mis võivad kasutada absoluutseid px-suurusi */
html.a11y-l p, html.a11y-l li, html.a11y-l td, html.a11y-l label,
html.a11y-l input, html.a11y-l select, html.a11y-l textarea { font-size: 1rem !important; }

html.a11y-xl p, html.a11y-xl li, html.a11y-xl td, html.a11y-xl label,
html.a11y-xl input, html.a11y-xl select, html.a11y-xl textarea { font-size: 1rem !important; }

/* ── 11. REŽIIM — TUME KONTRAST (filter-pööramine) ──────────────────────── */

html.a11y-hc-dark {
    filter: invert(1) hue-rotate(180deg);
    background: #fff;
}

/* Pildid, videod, iframe'id — tagastada algsed värvid */
html.a11y-hc-dark img,
html.a11y-hc-dark video,
html.a11y-hc-dark iframe,
html.a11y-hc-dark canvas,
html.a11y-hc-dark figure img,
html.a11y-hc-dark .wp-block-image img {
    filter: invert(1) hue-rotate(180deg);
}

/* Paneel ja nupp — tagastada algsed värvid */
html.a11y-hc-dark .mva11y-trigger,
html.a11y-hc-dark .mva11y-panel {
    filter: invert(1) hue-rotate(180deg);
}

/* ── 12. REŽIIM — HELE KÕRGE KONTRAST (must/valge) ──────────────────────── */

html.a11y-hc-light {
    background: #fff !important;
}

html.a11y-hc-light body,
html.a11y-hc-light header,
html.a11y-hc-light nav,
html.a11y-hc-light main,
html.a11y-hc-light footer,
html.a11y-hc-light article,
html.a11y-hc-light section,
html.a11y-hc-light aside,
html.a11y-hc-light div,
html.a11y-hc-light span,
html.a11y-hc-light p,
html.a11y-hc-light li,
html.a11y-hc-light td,
html.a11y-hc-light th,
html.a11y-hc-light blockquote,
html.a11y-hc-light form,
html.a11y-hc-light fieldset,
html.a11y-hc-light label,
html.a11y-hc-light input,
html.a11y-hc-light select,
html.a11y-hc-light textarea,
html.a11y-hc-light table,
html.a11y-hc-light caption,
html.a11y-hc-light h1, html.a11y-hc-light h2, html.a11y-hc-light h3,
html.a11y-hc-light h4, html.a11y-hc-light h5, html.a11y-hc-light h6 {
    background-color: #fff !important;
    color: #000 !important;
    border-color: #000 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html.a11y-hc-light a { color: #00008B !important; text-decoration: underline !important; }
html.a11y-hc-light button { background: #fff !important; color: #000 !important; border: 2px solid #000 !important; }

html.a11y-hc-light :focus {
    outline: 3px solid #c00 !important;
    outline-offset: 2px !important;
}

/* Paneel jääb omaette */
html.a11y-hc-light .mva11y-panel__hd           { background: #000 !important; color: #fff !important; }
html.a11y-hc-light .mva11y-panel__close        { color: #fff !important; }
html.a11y-hc-light .mva11y-trigger             { background: #000 !important; color: #fff !important; border-color: #fff !important; }
html.a11y-hc-light .mva11y-panel               { border-color: #000 !important; }
html.a11y-hc-light .mva11y-sz__btn.is-on,
html.a11y-hc-light .mva11y-ct__btn.is-on       { border-color: #00008B !important; box-shadow: none !important; }
html.a11y-hc-light .mva11y-tog.is-on .mva11y-sw__track { background: #000 !important; }
html.a11y-hc-light .mva11y-stmt-lnk            { color: #00008B !important; }

/* ── 13. REŽIIM — KOLLANE MUSTAL ─────────────────────────────────────────── */

html.a11y-hc-yellow {
    background: #000 !important;
}

html.a11y-hc-yellow body,
html.a11y-hc-yellow header, html.a11y-hc-yellow nav, html.a11y-hc-yellow main,
html.a11y-hc-yellow footer, html.a11y-hc-yellow article, html.a11y-hc-yellow section,
html.a11y-hc-yellow aside, html.a11y-hc-yellow div, html.a11y-hc-yellow span,
html.a11y-hc-yellow p, html.a11y-hc-yellow li, html.a11y-hc-yellow td,
html.a11y-hc-yellow th, html.a11y-hc-yellow blockquote, html.a11y-hc-yellow form,
html.a11y-hc-yellow fieldset, html.a11y-hc-yellow label,
html.a11y-hc-yellow input, html.a11y-hc-yellow select, html.a11y-hc-yellow textarea,
html.a11y-hc-yellow table, html.a11y-hc-yellow caption,
html.a11y-hc-yellow h1, html.a11y-hc-yellow h2, html.a11y-hc-yellow h3,
html.a11y-hc-yellow h4, html.a11y-hc-yellow h5, html.a11y-hc-yellow h6 {
    background-color: #000 !important;
    color: #ff0 !important;
    border-color: #ff0 !important;
    text-shadow: none !important;
    box-shadow: none !important;
}

html.a11y-hc-yellow a        { color: #0ff !important; text-decoration: underline !important; }
html.a11y-hc-yellow button   { background: #000 !important; color: #ff0 !important; border: 2px solid #ff0 !important; }

html.a11y-hc-yellow :focus {
    outline: 3px solid #f90 !important;
    outline-offset: 2px !important;
}

/* Paneel kontrastsuses */
html.a11y-hc-yellow .mva11y-trigger     { background: #ff0 !important; color: #000 !important; border-color: #000 !important; }
html.a11y-hc-yellow .mva11y-panel__hd  { background: #ff0 !important; color: #000 !important; }
html.a11y-hc-yellow .mva11y-panel__close { color: #000 !important; }
html.a11y-hc-yellow .mva11y-tog.is-on .mva11y-sw__track { background: #ff0 !important; }
html.a11y-hc-yellow .mva11y-tog.is-on .mva11y-sw__thumb { background: #000 !important; }
html.a11y-hc-yellow .mva11y-stmt-lnk   { color: #0ff !important; }

/* ── 14. HALLISKAALA ─────────────────────────────────────────────────────── */

html.a11y-gray {
    filter: grayscale(100%);
}

/* Dark + grayscale kombinatsioon */
html.a11y-hc-dark.a11y-gray {
    filter: invert(1) hue-rotate(180deg) grayscale(100%);
}

html.a11y-hc-dark.a11y-gray .mva11y-trigger,
html.a11y-hc-dark.a11y-gray .mva11y-panel {
    filter: invert(1) hue-rotate(180deg);
}

/* ── 15. VÄHEM ANIMATSIOONE — WCAG 2.3.3 ────────────────────────────────── */

html.a11y-no-anim *,
html.a11y-no-anim *::before,
html.a11y-no-anim *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    transition-delay: 0ms !important;
    scroll-behavior: auto !important;
}

/* ── 16. LINGID ESILE ────────────────────────────────────────────────────── */

html.a11y-links a:not(.mva11y-skip__link, .mva11y-panel a, .mva11y-trigger,
                       .mva11y-stmt-lnk, .mva11y-reset) {
    background: rgba(255, 230, 0, 0.28) !important;
    text-decoration: underline !important;
    outline: 1px solid rgba(180, 150, 0, 0.5) !important;
    border-radius: 2px !important;
    padding: 0 2px !important;
}

/* ── 17. PEALKIRJAD ESILE ────────────────────────────────────────────────── */

html.a11y-hdgs h1, html.a11y-hdgs h2, html.a11y-hdgs h3,
html.a11y-hdgs h4, html.a11y-hdgs h5, html.a11y-hdgs h6 {
    outline: 2px dashed #185FA5 !important;
    outline-offset: 4px !important;
}

/* ── 18. SUUR TEKSTI VAHE — WCAG 1.4.12 ─────────────────────────────────── */

html.a11y-spacing p,
html.a11y-spacing li,
html.a11y-spacing td,
html.a11y-spacing label,
html.a11y-spacing input,
html.a11y-spacing textarea {
    line-height: 1.9 !important;
    letter-spacing: 0.06em !important;
    word-spacing: 0.14em !important;
}

html.a11y-spacing p { margin-bottom: 1.4em !important; }

/* ── 19. DÜSLEKSIA FONT ──────────────────────────────────────────────────── */

html.a11y-dyslexic,
html.a11y-dyslexic body,
html.a11y-dyslexic p,
html.a11y-dyslexic li,
html.a11y-dyslexic td,
html.a11y-dyslexic label,
html.a11y-dyslexic h1, html.a11y-dyslexic h2, html.a11y-dyslexic h3,
html.a11y-dyslexic h4, html.a11y-dyslexic h5, html.a11y-dyslexic h6 {
    font-family: 'Arial', 'Helvetica Neue', Helvetica, sans-serif !important;
    letter-spacing: 0.07em !important;
    word-spacing: 0.18em !important;
    line-height: 1.75 !important;
}

/* ── 20. FOOKUSE ESILE TÕSTMINE — WCAG 2.4.7 ────────────────────────────── */

html.a11y-focus *:focus,
html.a11y-focus *:focus-visible {
    outline: 3px solid #185FA5 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 6px rgba(24,95,165,0.22) !important;
}

/* ── 21. SUURENDATUD KURSOR ──────────────────────────────────────────────── */

html.a11y-cursor,
html.a11y-cursor * {
    /* Suured kursorid — CSS4 SVG andme-URI */
    cursor: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2248%22%20height%3D%2248%22%20viewBox%3D%220%200%2048%2048%22%3E%3Cpath%20d%3D%22M7%205L43%2027%2029%2030%2023%2046z%22%20fill%3D%22%23000%22%20stroke%3D%22%23fff%22%20stroke-width%3D%223%22%20stroke-linejoin%3D%22round%22%2F%3E%3C%2Fsvg%3E") 7 5, auto !important;
}

/* ── 22. DEKLARATSIOONI LEHEKÜLJE STIILID ───────────────────────────────── */

.mva11y-declaration {
    max-width: 720px;
    line-height: 1.7;
}

.mva11y-declaration h2 {
    font-size: 1.15em;
    margin-top: 1.8em;
    padding-bottom: 5px;
    border-bottom: 2px solid #04213E;
    color: #04213E;
}

.mva11y-declaration address {
    font-style: normal;
    background: #f8f9fb;
    border-left: 3px solid #185FA5;
    padding: 12px 16px;
    margin-top: 8px;
    border-radius: 0 6px 6px 0;
    line-height: 1.8;
}

/* ── 23. MOBIIL ──────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .mva11y-panel {
        right: 8px;
        left: 8px;
        width: auto;
        bottom: 80px;
        max-height: calc(100dvh - 100px);
    }
    .mva11y-panel.is-left {
        right: 8px;
        left: 8px;
    }
    .mva11y-trigger {
        width: 48px;
        height: 48px;
        bottom: 16px;
        right: 16px;
    }
    .mva11y-trigger.is-left {
        right: auto;
        left: 16px;
    }
    .mva11y-trigger::after {
        display: none;
    }
}

/* ── 24. TRÜKK ───────────────────────────────────────────────────────────── */

@media print {
    .mva11y-skip,
    .mva11y-trigger,
    .mva11y-panel,
    #mva11y-guide { display: none !important; }
}

/* ── 25. SÜSTEEMI EELISTUS: prefers-reduced-motion ──────────────────────── */

@media (prefers-reduced-motion: reduce) {
    .mva11y-panel,
    .mva11y-trigger,
    .mva11y-sw__track,
    .mva11y-sw__thumb {
        transition: none !important;
    }
}
