/* Parliament CMS - Accessibility Widget */

#accessibility-widget {
    --a11y-theme-color: #3f7f45;
    --a11y-green: var(--a11y-theme-color);
    --a11y-green-dark: color-mix(in srgb, var(--a11y-theme-color) 78%, #000000);
    --a11y-soft: color-mix(in srgb, var(--a11y-theme-color) 10%, #ffffff);
    --a11y-text: #111827;
    --a11y-muted: #6b7280;
    --a11y-border: #e5e7eb;
    --a11y-focus: #d9b65f;
    --a11y-trigger-bg: var(--a11y-theme-color);
    --a11y-trigger-size: 48px;
    font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
}

#a11y-trigger {
    position: fixed;
    right: 24px;
    bottom: 126px;
    z-index: 2147483646;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0;
    width: var(--a11y-trigger-size);
    height: var(--a11y-trigger-size);
    min-height: var(--a11y-trigger-size);
    padding: 0;
    border: 0;
    border-radius: 999px;
    background: var(--a11y-trigger-bg);
    color: #ffffff;
    box-shadow: 0 10px 28px rgba(2, 6, 23, .16);
    cursor: pointer;
    font-size: 14px;
    font-weight: 800;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    transition: width .18s ease, gap .18s ease, transform .12s ease, filter .12s ease;
}

#a11y-trigger svg {
    flex: 0 0 auto;
    width: calc(var(--a11y-trigger-size) * .46);
    height: calc(var(--a11y-trigger-size) * .46);
}

#a11y-trigger span {
    max-width: 0;
    opacity: 0;
    overflow: hidden;
    transition: max-width .18s ease, opacity .12s ease;
}

#a11y-trigger:hover,
#a11y-trigger:focus-visible {
    width: calc(var(--a11y-trigger-size) + 94px);
    gap: 8px;
}

#a11y-trigger:hover {
    transform: translateY(-1px);
    filter: brightness(1.03);
}

#a11y-trigger:hover span,
#a11y-trigger:focus-visible span {
    max-width: 96px;
    opacity: 1;
}

#a11y-trigger:focus-visible,
#a11y-panel button:focus-visible,
#a11y-panel a:focus-visible {
    outline: 3px solid var(--a11y-focus);
    outline-offset: 3px;
}

#a11y-panel {
    position: fixed;
    right: 24px;
    bottom: 74px;
    z-index: 2147483647;
    display: none;
    flex-direction: column;
    width: min(360px, calc(100vw - 36px));
    max-height: min(650px, calc(100vh - 88px));
    max-height: min(650px, calc(100dvh - 88px));
    overflow: hidden;
    border: 0;
    border-radius: 18px;
    background: #ffffff;
    color: var(--a11y-text);
    box-shadow: 0 18px 55px rgba(2, 6, 23, .22);
    font-size: 14px;
    line-height: 1.4;
}

#a11y-panel.open {
    display: flex;
}

body:has(#a11y-panel.open) #cc-chatbot-root {
    z-index: 2147483646;
}

#a11y-header {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 14px;
    color: #ffffff;
    background: linear-gradient(135deg, var(--a11y-green), var(--a11y-green-dark));
}

#a11y-title {
    margin: 0;
    color: #ffffff;
    font-size: 16px;
    font-weight: 800;
}

.a11y-header-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

.a11y-reset-btn,
#a11y-close {
    border: 1px solid rgba(255,255,255,.24);
    background: rgba(255,255,255,.12);
    color: #ffffff;
    cursor: pointer;
    transition: background .12s ease;
}

.a11y-reset-btn {
    height: 34px;
    padding: 0 10px;
    border-radius: 10px;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

#a11y-close {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.a11y-reset-btn:hover,
#a11y-close:hover {
    background: rgba(255,255,255,.22);
}

.a11y-panel-scroll {
    flex: 1 1 auto;
    min-height: 0;
    overflow: auto;
    padding: 14px;
}

.a11y-section {
    margin: 0 0 16px;
}

.a11y-section:last-child {
    margin-bottom: 0;
}

.a11y-section-title {
    margin: 0 0 10px;
    color: var(--a11y-green);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: .06em;
    text-transform: uppercase;
}

.a11y-inline-ctrl {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 10px;
}

.a11y-inline-ctrl > span {
    color: #374151;
    font-size: 13px;
    font-weight: 700;
}

.a11y-sz-group,
.a11y-align-group {
    display: inline-flex;
    gap: 4px;
}

.a11y-sz-btn,
.a11y-align-btn,
.a11y-card {
    border: 1px solid var(--a11y-border);
    background: #f9fafb;
    color: #374151;
    cursor: pointer;
    font: inherit;
    transition: background .12s ease, border-color .12s ease, color .12s ease;
}

.a11y-sz-btn,
.a11y-align-btn {
    width: 34px;
    height: 34px;
    border-radius: 8px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    font-weight: 800;
}

.a11y-sz-btn:nth-child(1) { font-size: 11px; }
.a11y-sz-btn:nth-child(2) { font-size: 14px; }
.a11y-sz-btn:nth-child(3) { font-size: 17px; }
.a11y-sz-btn:nth-child(4) { font-size: 20px; }

.a11y-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 7px;
}

.a11y-card {
    min-height: 52px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 10px;
    text-align: left;
}

.a11y-card-icon {
    width: 20px;
    height: 20px;
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    color: var(--a11y-muted);
}

.a11y-card-label {
    font-size: 12px;
    font-weight: 700;
    line-height: 1.2;
}

.a11y-sz-btn:hover,
.a11y-align-btn:hover,
.a11y-card:hover {
    background: #ffffff;
    border-color: rgba(41,94,44,.35);
}

.a11y-sz-btn.active,
.a11y-align-btn.active,
.a11y-card.active {
    border-color: rgba(41,94,44,.55);
    background: var(--a11y-soft);
    color: var(--a11y-green);
}

.a11y-card.active .a11y-card-icon {
    color: var(--a11y-green);
}

#a11y-reader-controls {
    display: none;
    flex-direction: column;
    gap: 10px;
    margin-top: 8px;
    padding: 12px;
    border-radius: 10px;
    background: #f4f6f4;
}

#a11y-reader-controls.visible {
    display: flex;
}

.a11y-reader-buttons {
    display: flex;
    gap: 8px;
}

.a11y-reader-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-height: 36px;
    border: 0;
    border-radius: 8px;
    cursor: pointer;
    font: inherit;
    font-size: 12px;
    font-weight: 800;
}

.a11y-reader-btn-play {
    flex: 1;
    background: var(--a11y-green);
    color: #ffffff;
}

.a11y-reader-btn-pause {
    flex: 1;
    background: #ffffff;
    color: var(--a11y-green);
}

.a11y-reader-btn-stop {
    flex: 0 0 42px;
    background: #fee2e2;
    color: #b91c1c;
}

.a11y-reader-progress {
    height: 4px;
    overflow: hidden;
    border-radius: 999px;
    background: #d1d5db;
}

.a11y-reader-progress-fill {
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: var(--a11y-green);
}

.a11y-reader-speed {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--a11y-muted);
    font-size: 12px;
}

.a11y-reader-speed input {
    flex: 1;
    accent-color: var(--a11y-green);
}

.a11y-reader-speed-val {
    min-width: 32px;
    color: #374151;
    font-weight: 800;
    text-align: right;
}

.a11y-panel-footer {
    flex: 0 0 auto;
    padding: 12px 14px;
    border-top: 1px solid var(--a11y-border);
    background: #ffffff;
    text-align: center;
}

.a11y-stmt-link {
    color: var(--a11y-green);
    font-size: 12px;
    font-weight: 800;
    text-decoration: none;
}

.a11y-stmt-link:hover {
    text-decoration: underline;
}

.a11y-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
    border: 0;
}

#a11y-reading-mask {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 2147483644;
    pointer-events: none;
}

#a11y-reading-mask.visible {
    display: block;
}

.a11y-mask-top,
.a11y-mask-bottom {
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(0,0,0,.68);
    pointer-events: none;
}

.a11y-reading-highlight {
    outline: 3px solid var(--a11y-focus) !important;
    outline-offset: 3px !important;
    border-radius: 3px !important;
    background: #fef9c3 !important;
}

body.a11y-text-size-1 #a11y-content-wrap { zoom: 1.15; }
body.a11y-text-size-2 #a11y-content-wrap { zoom: 1.3; }
body.a11y-text-size-3 #a11y-content-wrap { zoom: 1.5; }

body.a11y-line-height #a11y-content-wrap * {
    line-height: 1.9 !important;
}

body.a11y-align-left #a11y-content-wrap p,
body.a11y-align-left #a11y-content-wrap li,
body.a11y-align-left #a11y-content-wrap div,
body.a11y-align-left #a11y-content-wrap td {
    text-align: left !important;
}

body.a11y-align-center #a11y-content-wrap p,
body.a11y-align-center #a11y-content-wrap li,
body.a11y-align-center #a11y-content-wrap div,
body.a11y-align-center #a11y-content-wrap td {
    text-align: center !important;
}

body.a11y-align-right #a11y-content-wrap p,
body.a11y-align-right #a11y-content-wrap li,
body.a11y-align-right #a11y-content-wrap div,
body.a11y-align-right #a11y-content-wrap td {
    text-align: right !important;
}

body.a11y-readable-font #a11y-content-wrap,
body.a11y-readable-font #a11y-content-wrap * {
    font-family: Arial, Helvetica, sans-serif !important;
    letter-spacing: .04em !important;
    word-spacing: .08em !important;
}

body.a11y-contrast #a11y-content-wrap { filter: contrast(150%) !important; }
body.a11y-grayscale #a11y-content-wrap { filter: grayscale(100%) !important; }
body.a11y-contrast.a11y-grayscale #a11y-content-wrap { filter: contrast(150%) grayscale(100%) !important; }

body.a11y-hide-images #a11y-content-wrap img,
body.a11y-hide-images #a11y-content-wrap picture,
body.a11y-hide-images #a11y-content-wrap figure {
    visibility: hidden !important;
}

body.a11y-pause-animations #a11y-content-wrap *,
body.a11y-pause-animations #a11y-content-wrap *::before,
body.a11y-pause-animations #a11y-content-wrap *::after {
    animation-duration: .001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0s !important;
    scroll-behavior: auto !important;
}

body.a11y-highlight-links #a11y-content-wrap a {
    background: #fef08a !important;
    color: #111827 !important;
    text-decoration: underline !important;
    text-decoration-thickness: 2px !important;
    border-radius: 2px !important;
    padding: 0 2px !important;
}

body.a11y-outline-focus #a11y-content-wrap *:focus,
body.a11y-outline-focus #a11y-content-wrap *:focus-visible {
    outline: 3px solid var(--a11y-focus, #d9b65f) !important;
    outline-offset: 3px !important;
}

@media (max-width: 520px) {
    #a11y-trigger {
        right: 14px;
        bottom: 112px;
        width: var(--a11y-trigger-size);
        height: var(--a11y-trigger-size);
        padding: 0;
        font-size: 0;
    }

    #a11y-trigger:hover,
    #a11y-trigger:focus-visible {
        width: var(--a11y-trigger-size);
        gap: 0;
    }

    #a11y-trigger:hover span,
    #a11y-trigger:focus-visible span {
        max-width: 0;
        opacity: 0;
    }

    #a11y-panel {
        right: 24px;
        bottom: 74px;
        width: calc(100vw - 28px);
        max-height: calc(100vh - 88px);
        max-height: calc(100dvh - 88px);
    }
}
@media (max-width: 420px) {
    #a11y-panel {
        right: 14px;
        bottom: 64px;
        max-height: calc(100vh - 78px);
        max-height: calc(100dvh - 78px);
    }
}
/* Keep the two Appearance card grids separated by the same gap as their rows. */
.a11y-grid + .a11y-grid {
    margin-top: 7px;
}

/* Separate expanded reading options from the navigation tiles above them. */
#a11y-reading-options {
    margin-top: 18px;
    padding-top: 16px;
    border-top: 1px solid var(--a11y-border);
}

/* Reading controls remain available before, during, and after playback. */
#accessibility-widget #a11y-reader-controls {
    display: block;
    padding: 12px;
    margin: 12px 0;
    border: 1px solid var(--a11y-border);
    border-radius: 12px;
    background: #fff;
    color: #111827;
}
#accessibility-widget #a11y-reader-controls.is-floating {
    position: fixed;
    left: 16px;
    bottom: 16px;
    z-index: 2147483646;
    width: min(390px, calc(100vw - 32px));
    max-height: calc(100dvh - 32px);
    overflow: auto;
    margin: 0;
    box-shadow: 0 8px 32px #0003;
    box-sizing: border-box;
}
#a11y-reader-status { margin: 0 0 4px; font-weight: 700; }
#a11y-reader-context { margin: 0 0 10px; font-size: 12px; overflow-wrap: anywhere; }
.a11y-reader-sources, #a11y-reader-controls .a11y-reader-buttons { display: flex; flex-wrap: wrap; gap: 6px; }
#accessibility-widget .a11y-reader-sources button,
#accessibility-widget #a11y-reader-controls button,
#accessibility-widget #a11y-voice-preview {
    min-height: 44px;
    padding: 8px 10px;
    border: 1px solid #64748b;
    border-radius: 8px;
    background: #fff;
    color: #1f2937;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}
#accessibility-widget #a11y-reader-play { background: var(--a11y-green-dark); color: #fff; flex: 1; }
#accessibility-widget button:disabled { opacity: .55; cursor: default; }
#accessibility-widget :is(button, input, select, a):focus-visible { outline: 3px solid #2563eb; outline-offset: 3px; }
#accessibility-widget [hidden] { display: none !important; }
.a11y-reader-label { display: block; margin: 12px 0 6px; }
#a11y-reader-voice { width: 100%; min-height: 44px; color: #111827; background: #fff; border: 1px solid #64748b; border-radius: 6px; }
#a11y-voice-preview { margin: 8px 0; }
.a11y-reader-help { font-size: 12px; color: #475569; margin: 8px 0; }
#a11y-reader-controls .a11y-reader-progress { margin-bottom: 10px; }
#a11y-reader-options { margin-top: 8px; }
::highlight(a11y-sentence) { color: #111827; background: #fde047; }
.a11y-reading-highlight { color: #111827 !important; }
@media (prefers-reduced-motion: reduce) {
    #accessibility-widget *, #a11y-content-wrap * { scroll-behavior: auto !important; }
    #accessibility-widget * { transition: none !important; }
}
@media (forced-colors: active) {
    .a11y-reading-highlight { outline-color: Highlight !important; }
    #a11y-reader-controls { border: 2px solid ButtonText !important; }
}
@media (max-width: 520px) {
    #accessibility-widget #a11y-reader-controls.is-floating {
        bottom: calc(122px + var(--a11y-trigger-size));
        max-height: calc(100dvh - 154px - var(--a11y-trigger-size));
    }
}
