/*
 * Cll EAA WCAG - accessibility widget (self-hosted, no CDN).
 * The launcher + panel must themselves be fully accessible.
 */

:root {
    --cll-eaa-font-scale: 1;
    --cll-eaa-letter-spacing: normal;
    --cll-eaa-line-height: normal;
    --cll-eaa-zoom: 1;
}

/* ---- effects applied to <html> ---- */
html.cll-eaa-fontscale body,
html.cll-eaa-fontscale body * {
    font-size: calc(1em * var(--cll-eaa-font-scale)) !important;
    line-height: var(--cll-eaa-line-height) !important;
}
html.cll-eaa-spacing body,
html.cll-eaa-spacing body * {
    letter-spacing: var(--cll-eaa-letter-spacing) !important;
    word-spacing: calc(var(--cll-eaa-letter-spacing, 0) * 2) !important;
}
html.cll-eaa-dyslexia body,
html.cll-eaa-dyslexia body * {
    font-family: "Comic Sans MS", "Trebuchet MS", "Verdana", "Tahoma", sans-serif !important;
    letter-spacing: 0.05em !important;
}
html.cll-eaa-contrast body {
    background: #000 !important;
    color: #fff !important;
}
html.cll-eaa-contrast body * {
    background-color: transparent !important;
    color: #fff !important;
    border-color: #fff !important;
}
html.cll-eaa-contrast body a,
html.cll-eaa-contrast body a * {
    color: #ffff00 !important;
}
html.cll-eaa-invert {
    filter: invert(1) hue-rotate(180deg) !important;
}
html.cll-eaa-invert img,
html.cll-eaa-invert video,
html.cll-eaa-invert picture {
    filter: invert(1) hue-rotate(180deg) !important;
}
html.cll-eaa-grayscale {
    filter: grayscale(1) !important;
}
html.cll-eaa-invert.cll-eaa-grayscale {
    filter: invert(1) hue-rotate(180deg) grayscale(1) !important;
}
html.cll-eaa-links body a {
    text-decoration: underline !important;
    outline: 2px solid #ffbf00 !important;
    outline-offset: 1px;
}
html.cll-eaa-headings body h1,
html.cll-eaa-headings body h2,
html.cll-eaa-headings body h3,
html.cll-eaa-headings body h4,
html.cll-eaa-headings body h5,
html.cll-eaa-headings body h6 {
    outline: 2px dashed #008080 !important;
    outline-offset: 2px;
    background: rgba(0, 128, 128, 0.08) !important;
}
html.cll-eaa-bigcursor,
html.cll-eaa-bigcursor body,
html.cll-eaa-bigcursor body * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'%3E%3Cpath fill='%23000' stroke='%23fff' stroke-width='2' d='M6 2l30 18-13 2 8 16-6 3-8-16-11 8z'/%3E%3C/svg%3E"), auto !important;
}
html.cll-eaa-noanim *,
html.cll-eaa-noanim *::before,
html.cll-eaa-noanim *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
}
@media (prefers-reduced-motion: reduce) {
    html *,
    html *::before,
    html *::after {
        animation-duration: 0.001ms !important;
        transition-duration: 0.001ms !important;
    }
}
html.cll-eaa-zoom body {
    zoom: var(--cll-eaa-zoom);
}

/* ---- reading guide ---- */
.cll-eaa-readguide {
    position: fixed;
    left: 0;
    width: 100%;
    height: 2.5em;
    background: rgba(0, 0, 0, 0.55);
    border-top: 2px solid #ffbf00;
    border-bottom: 2px solid #ffbf00;
    pointer-events: none;
    z-index: 2147483646;
    display: none;
}
html.cll-eaa-readguide-on .cll-eaa-readguide {
    display: block;
}

/* ---- skip link ---- */
.cll-eaa-skip {
    position: absolute;
    left: -9999px;
    top: 0;
    z-index: 2147483647;
    background: #1d4ed8;
    color: #fff;
    padding: 10px 16px;
    border-radius: 0 0 6px 0;
    font-weight: 700;
    text-decoration: none;
}
.cll-eaa-skip:focus {
    left: 0;
}

/* ---- robust focus visibility ---- */
html.cll-eaa-focus a:focus,
html.cll-eaa-focus button:focus,
html.cll-eaa-focus input:focus,
html.cll-eaa-focus select:focus,
html.cll-eaa-focus textarea:focus,
html.cll-eaa-focus [tabindex]:focus {
    outline: 3px solid #1d4ed8 !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #fff !important;
}

/* ---- launcher button ---- */
.cll-eaa-launcher {
    position: fixed;
    z-index: 2147483640;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid #fff;
    background: var(--cll-eaa-launcher-color, #1d4ed8);
    color: #fff;
    cursor: pointer;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    line-height: 1;
}
.cll-eaa-launcher:hover { filter: brightness(1.08); }
.cll-eaa-launcher:focus { outline: 3px solid #ffbf00; outline-offset: 2px; }
.cll-eaa-launcher svg { width: 30px; height: 30px; fill: currentColor; }
.cll-eaa-pos-bottom-right { right: 18px; bottom: 18px; }
.cll-eaa-pos-bottom-left { left: 18px; bottom: 18px; }
.cll-eaa-pos-top-right { right: 18px; top: 18px; }
.cll-eaa-pos-top-left { left: 18px; top: 18px; }
.cll-eaa-pos-middle-right { right: 18px; top: 50%; transform: translateY(-50%); }
.cll-eaa-pos-middle-left { left: 18px; top: 50%; transform: translateY(-50%); }

/* ---- panel ---- */
.cll-eaa-panel {
    position: fixed;
    z-index: 2147483641;
    width: 320px;
    max-width: calc(100vw - 24px);
    max-height: calc(100vh - 24px);
    overflow-y: auto;
    background: #fff;
    color: #1a1a1a;
    border: 1px solid #d0d0d0;
    border-radius: 10px;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.35);
    font-family: -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
    font-size: 14px;
    line-height: 1.4;
    display: none;
}
.cll-eaa-panel[aria-hidden="false"] { display: block; }
.cll-eaa-panel-rel-bottom-right { right: 18px; bottom: 84px; }
.cll-eaa-panel-rel-bottom-left { left: 18px; bottom: 84px; }
.cll-eaa-panel-rel-top-right { right: 18px; top: 84px; }
.cll-eaa-panel-rel-top-left { left: 18px; top: 84px; }
.cll-eaa-panel-rel-middle-right { right: 84px; top: 50%; transform: translateY(-50%); }
.cll-eaa-panel-rel-middle-left { left: 84px; top: 50%; transform: translateY(-50%); }

.cll-eaa-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 14px;
    background: var(--cll-eaa-launcher-color, #1d4ed8);
    color: #fff;
    border-radius: 10px 10px 0 0;
}
.cll-eaa-head h2 { margin: 0; font-size: 16px; color: #fff; }
.cll-eaa-close {
    background: transparent;
    border: 1px solid #fff;
    color: #fff;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
}
.cll-eaa-close:focus { outline: 3px solid #ffbf00; outline-offset: 2px; }

.cll-eaa-tools {
    list-style: none;
    margin: 0;
    padding: 10px;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}
.cll-eaa-tools li { margin: 0; }
.cll-eaa-tool {
    width: 100%;
    min-height: 64px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    text-align: center;
    background: #f4f6fb;
    border: 2px solid #d6deee;
    border-radius: 8px;
    color: #1a1a1a;
    cursor: pointer;
    padding: 8px 6px;
    font-size: 12.5px;
    font-weight: 600;
}
.cll-eaa-tool:hover { background: #e8eefc; }
.cll-eaa-tool:focus { outline: 3px solid #1d4ed8; outline-offset: 2px; }
.cll-eaa-tool[aria-pressed="true"] {
    background: #1d4ed8;
    border-color: #1d4ed8;
    color: #fff;
}
.cll-eaa-tool .cll-eaa-ico { font-size: 20px; line-height: 1; }
.cll-eaa-tool .cll-eaa-state { font-size: 11px; opacity: 0.85; }

.cll-eaa-step {
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 1 / -1;
    background: #f4f6fb;
    border: 2px solid #d6deee;
    border-radius: 8px;
    padding: 8px 10px;
    font-weight: 600;
}
.cll-eaa-step .cll-eaa-step-label { display: flex; flex-direction: column; }
.cll-eaa-step-btns { display: flex; gap: 6px; }
.cll-eaa-step-btns button {
    width: 36px;
    height: 36px;
    border-radius: 6px;
    border: 2px solid #1d4ed8;
    background: #fff;
    color: #1d4ed8;
    font-size: 18px;
    font-weight: 700;
    cursor: pointer;
}
.cll-eaa-step-btns button:focus { outline: 3px solid #ffbf00; outline-offset: 2px; }

.cll-eaa-foot {
    display: flex;
    gap: 8px;
    padding: 10px;
    border-top: 1px solid #e3e3e3;
}
.cll-eaa-foot a,
.cll-eaa-foot button {
    flex: 1;
    text-align: center;
    padding: 9px 8px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: 2px solid #1d4ed8;
}
.cll-eaa-reset { background: #fff; color: #1d4ed8; }
.cll-eaa-statement-link { background: #1d4ed8; color: #fff; border-color: #1d4ed8; }
.cll-eaa-foot a:focus,
.cll-eaa-foot button:focus { outline: 3px solid #ffbf00; outline-offset: 2px; }

.cll-eaa-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;
}
