/* ============================================================
   Parliament CMS — Accessibility Widget
   Clean minimal design matching the reference screenshot
   ============================================================ */

/* ── Trigger button ──────────────────────────────────────── */

#a11y-trigger {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 11px;
    background: #1a1a2e;
    color: #ffffff;
    border: none;
    border-radius: 12px;
    font-size: 0;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transition: transform 0.15s, box-shadow 0.15s;
}

#a11y-trigger:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

#a11y-trigger:focus-visible {
    outline: 3px solid #6c63ff;
    outline-offset: 3px;
}

#a11y-trigger svg {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
}

/* ── Panel ───────────────────────────────────────────────── */

#a11y-panel {
    position: fixed;
    bottom: 80px;
    right: 24px;
    z-index: 9998;
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    background: #ffffff;
    border-radius: 18px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.14), 0 2px 8px rgba(0,0,0,0.06);
    padding: 20px;
    display: none;
    flex-direction: column;
    gap: 0;
    font-family: inherit;
}

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

/* ── Panel header ────────────────────────────────────────── */

#a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 20px;
}

#a11y-title {
    font-size: 16px;
    font-weight: 700;
    color: #1a1a2e;
    margin: 0;
}

#a11y-close {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: #f3f4f6;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #6b7280;
    transition: background 0.15s;
}

#a11y-close:hover {
    background: #e5e7eb;
    color: #111827;
}

#a11y-close:focus-visible {
    outline: 2px solid #6c63ff;
    outline-offset: 2px;
}

/* ── Sections ────────────────────────────────────────────── */

.a11y-section {
    margin-bottom: 20px;
}

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

.a11y-section-title {
    font-size: 13px;
    font-weight: 700;
    color: #6b7280;
    text-transform: none;
    letter-spacing: 0;
    margin: 0 0 10px;
}

/* ── Control grid ────────────────────────────────────────── */

.a11y-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px;
}

/* ── Control card ────────────────────────────────────────── */

.a11y-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    background: #f3f4f6;
    border: 2px solid transparent;
    border-radius: 12px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    font-family: inherit;
    text-align: left;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    line-height: 1.3;
}

.a11y-card:hover {
    background: #e9eaec;
}

.a11y-card:focus-visible {
    outline: 2px solid #6c63ff;
    outline-offset: 2px;
}

.a11y-card.active {
    background: #eef0ff;
    border-color: #6c63ff;
    color: #4338ca;
}

.a11y-card.active .a11y-card-icon {
    color: #6c63ff;
}

.a11y-card-icon {
    flex-shrink: 0;
    width: 22px;
    height: 22px;
    color: #6b7280;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    justify-content: center;
}

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

/* ── Read aloud special card (full width) ────────────────── */

.a11y-card-wide {
    grid-column: 1 / -1;
}

/* ── Read aloud player ───────────────────────────────────── */

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

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

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

.a11y-reader-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 8px 12px;
    border-radius: 8px;
    font-size: 12px;
    font-weight: 600;
    border: none;
    cursor: pointer;
    font-family: inherit;
    transition: background 0.15s, opacity 0.15s;
}

.a11y-reader-btn-play {
    background: #1a1a2e;
    color: white;
}

.a11y-reader-btn-play:hover { opacity: 0.85; }

.a11y-reader-btn-pause {
    background: #e9eaec;
    color: #374151;
}

.a11y-reader-btn-pause:hover { background: #dde0e4; }

.a11y-reader-btn-stop {
    background: #fee2e2;
    color: #ef4444;
    flex: 0 0 auto;
    padding: 8px 10px;
}

.a11y-reader-btn-stop:hover { background: #fecaca; }

.a11y-reader-btn:focus-visible {
    outline: 2px solid #6c63ff;
    outline-offset: 2px;
}

/* Progress bar */
.a11y-reader-progress {
    height: 3px;
    background: #e5e7eb;
    border-radius: 2px;
    overflow: hidden;
}

.a11y-reader-progress-fill {
    height: 100%;
    width: 0%;
    background: #6c63ff;
    border-radius: 2px;
    transition: width 0.3s;
}

/* Speed */
.a11y-reader-speed {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    color: #6b7280;
}

.a11y-reader-speed input[type="range"] {
    flex: 1;
    height: 3px;
    accent-color: #6c63ff;
}

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

/* ── Reading mask ────────────────────────────────────────── */

#a11y-reading-mask {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    pointer-events: none;
    z-index: 9990;
}

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

.a11y-mask-top,
.a11y-mask-bottom {
    position: fixed;
    left: 0;
    right: 0;
    background: rgba(0,0,0,0.7);
    pointer-events: none;
    transition: top 0.05s, height 0.05s;
}

/* ── Active states (body classes) ───────────────────────── */

/* Bigger text */
body.a11y-bigger-text { font-size: 120% !important; }
body.a11y-bigger-text h1 { font-size: 3rem !important; }
body.a11y-bigger-text h2 { font-size: 2.4rem !important; }
body.a11y-bigger-text h3 { font-size: 1.8rem !important; }
body.a11y-bigger-text p,
body.a11y-bigger-text li,
body.a11y-bigger-text span { font-size: 1.2rem !important; line-height: 1.8 !important; }

/* Line height */
body.a11y-line-height * { line-height: 2 !important; }

/* Text align */
body.a11y-text-align p,
body.a11y-text-align li,
body.a11y-text-align div { text-align: left !important; }

/* Readable font */
body.a11y-readable-font,
body.a11y-readable-font * {
    font-family: 'Arial', 'Helvetica', sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.1em !important;
}

/* Contrast */
body.a11y-contrast {
    filter: contrast(150%) !important;
}

/* Grayscale */
body.a11y-grayscale {
    filter: grayscale(100%) !important;
}

/* Grayscale + contrast combined */
body.a11y-contrast.a11y-grayscale {
    filter: contrast(150%) grayscale(100%) !important;
}

/* Hide images */
body.a11y-hide-images img,
body.a11y-hide-images picture,
body.a11y-hide-images svg:not(.a11y-icon):not([aria-hidden]) {
    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: none !important;
}

/* Highlight links */
body.a11y-highlight-links a {
    background: #fef08a !important;
    color: #1a1a2e !important;
    text-decoration: underline !important;
    padding: 0 2px !important;
    border-radius: 2px !important;
}

/* Outline focus */
body.a11y-outline-focus *:focus,
body.a11y-outline-focus *:focus-visible {
    outline: 3px solid #6c63ff !important;
    outline-offset: 3px !important;
    border-radius: 3px !important;
}

/* ── SR only ────────────────────────────────────────────── */
.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-width: 0;
}

/* ── Announcer ──────────────────────────────────────────── */
#a11y-announcer {
    position: absolute;
    width: 1px; height: 1px;
    overflow: hidden;
    clip: rect(0,0,0,0);
    white-space: nowrap;
}


/* ── Reading highlight ──────────────────────────────────── */
.a11y-reading-highlight {
    background-color: #fef9c3 !important;
    outline: 2px solid #f59e0b !important;
    outline-offset: 3px !important;
    border-radius: 3px !important;
    transition: background-color 0.2s, outline 0.2s;
}
