/* ============================================================
   Eastpresso Accessibility Widget
   IS 5568 | WCAG 2.0 AA | RTL
   ============================================================ */

/* ── Skip to content (WCAG 2.4.1) ── */
.epa11y-skip-link {
    position: fixed;
    top: -120px;
    right: 0;
    background: #000;
    color: #fff !important;
    padding: 14px 22px;
    font-size: 16px;
    font-weight: 700;
    z-index: 999999;
    text-decoration: none !important;
    border-radius: 0 0 0 8px;
    transition: top 0.2s ease;
    direction: rtl;
}
.epa11y-skip-link:focus {
    top: 0;
    outline: 4px solid #ff0 !important;
    outline-offset: 0 !important;
}

/* ── Toggle Button: round, blue, ISA icon ── */
#epa11y-toggle {
    position: fixed;
    bottom: 80px;           /* above WhatsApp (usually at ~20px) */
    left: 20px;
    z-index: 99998;
    background: #1565C0;    /* standard accessibility blue */
    color: #fff;
    border: 3px solid #fff;
    border-radius: 50%;
    width: 54px;
    height: 54px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 3px 12px rgba(0, 0, 0, 0.35);
    padding: 0;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    outline: none;
}
#epa11y-toggle.epa11y-pos-bottom-right {
    left: auto;
    right: 20px;
}
#epa11y-toggle:hover {
    background: #0d47a1;
    transform: scale(1.08);
    box-shadow: 0 5px 20px rgba(21, 101, 192, 0.5);
}
#epa11y-toggle:focus-visible {
    outline: 4px solid #ff0 !important;
    outline-offset: 3px !important;
}
/* Visually hidden label for screen readers */
.epa11y-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;
}

/* ── Panel ── */
#epa11y-panel {
    position: fixed;
    bottom: 144px;          /* above toggle button */
    left: 20px;
    width: 300px;
    max-height: calc(100vh - 180px);
    overflow-y: auto;
    z-index: 99999;
    background: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.20);
    direction: rtl;
    border: 1px solid rgba(0,0,0,0.09);
    font-family: inherit;
}
#epa11y-panel.epa11y-pos-bottom-right {
    left: auto;
    right: 20px;
}
#epa11y-panel[hidden] { display: none; }

/* ── Panel header ── */
.epa11y-panel-header {
    background: #1565C0;
    color: #fff;
    padding: 14px 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-radius: 14px 14px 0 0;
    position: sticky;
    top: 0;
    z-index: 1;
}
.epa11y-panel-title {
    margin: 0 !important;
    font-size: 15px !important;
    font-weight: 700 !important;
    color: #fff !important;
    padding: 0 !important;
    background: none !important;
    border: none !important;
    line-height: 1.3 !important;
}
#epa11y-close {
    background: rgba(255,255,255,0.15);
    border: none;
    color: #fff;
    font-size: 17px;
    cursor: pointer;
    padding: 4px 9px;
    border-radius: 6px;
    line-height: 1;
    transition: background 0.15s;
}
#epa11y-close:hover, #epa11y-close:focus {
    background: rgba(255,255,255,0.35);
    outline: 2px solid #ff0 !important;
}

/* ── Panel body ── */
.epa11y-panel-body { padding: 12px 14px; }

.epa11y-group { margin-bottom: 12px; }
.epa11y-group-title {
    font-size: 10px !important;
    font-weight: 800 !important;
    color: #999 !important;
    text-transform: uppercase !important;
    letter-spacing: 1px !important;
    margin: 0 0 8px !important;
    padding: 0 0 5px !important;
    border-bottom: 1px solid #eee !important;
    background: none !important;
}

/* ── Button grid ── */
.epa11y-row {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    align-items: center;
}

.epa11y-btn {
    flex: 1;
    min-width: 72px;
    background: #f5f5f5;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 9px 6px 7px;
    cursor: pointer;
    font-size: 11px;
    font-family: inherit;
    font-weight: 700;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    color: #333;
    text-align: center;
    line-height: 1.3;
    transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.epa11y-btn:hover { background: #e8e8e8; border-color: #1565C0; color: #1565C0; }
.epa11y-btn:focus { outline: 3px solid #1565C0 !important; outline-offset: 2px !important; }
.epa11y-btn.active,
.epa11y-btn[aria-pressed="true"] {
    background: #1565C0;
    border-color: #1565C0;
    color: #fff;
}
.epa11y-icon { font-size: 16px; font-weight: 800; line-height: 1; }

/* Font size display */
.epa11y-font-display {
    background: #f0f0f0;
    border: 1px solid #ddd;
    border-radius: 7px;
    padding: 8px 10px;
    font-size: 12px;
    font-weight: 700;
    text-align: center;
    min-width: 48px;
    color: #555;
}

/* Reset button */
.epa11y-reset-btn {
    width: 100%;
    background: transparent;
    border: 2px solid #ddd;
    border-radius: 8px;
    padding: 9px 12px;
    cursor: pointer;
    font-size: 12px;
    font-family: inherit;
    font-weight: 700;
    color: #666;
    transition: border-color 0.12s, color 0.12s;
    margin-top: 4px;
}
.epa11y-reset-btn:hover { border-color: #1565C0; color: #1565C0; }
.epa11y-reset-btn:focus { outline: 3px solid #1565C0 !important; outline-offset: 2px !important; }

/* Panel footer */
.epa11y-panel-footer {
    padding: 10px 16px;
    border-top: 1px solid #eee;
    text-align: center;
    background: #fff;
    border-radius: 0 0 14px 14px;
    position: sticky;
    bottom: 0;
}
.epa11y-statement-link {
    color: #1565C0 !important;
    font-size: 12px;
    font-weight: 600;
    text-decoration: none !important;
}
.epa11y-statement-link:hover { text-decoration: underline !important; }
.epa11y-statement-link:focus { outline: 2px solid #1565C0 !important; border-radius: 2px; }

/* ============================================================
   FEATURE BODY-CLASS MODIFIERS
   Applied to <body> by JS
   ============================================================ */

/* ── Font size: on <html> so em/rem cascade ── */
html.epa11y-font--2 { font-size: 80% !important; }
html.epa11y-font--1 { font-size: 90% !important; }
html.epa11y-font-1  { font-size: 112% !important; }
html.epa11y-font-2  { font-size: 124% !important; }
html.epa11y-font-3  { font-size: 136% !important; }
html.epa11y-font-4  { font-size: 148% !important; }
html.epa11y-font-5  { font-size: 160% !important; }

/* ── High Contrast ── */
body.epa11y-high-contrast,
body.epa11y-high-contrast div,
body.epa11y-high-contrast section,
body.epa11y-high-contrast article,
body.epa11y-high-contrast main,
body.epa11y-high-contrast header,
body.epa11y-high-contrast footer,
body.epa11y-high-contrast aside,
body.epa11y-high-contrast nav {
    background-color: #000 !important;
    background-image: none !important;
}
body.epa11y-high-contrast p,
body.epa11y-high-contrast span,
body.epa11y-high-contrast li,
body.epa11y-high-contrast td,
body.epa11y-high-contrast th,
body.epa11y-high-contrast label,
body.epa11y-high-contrast h1,
body.epa11y-high-contrast h2,
body.epa11y-high-contrast h3,
body.epa11y-high-contrast h4,
body.epa11y-high-contrast h5,
body.epa11y-high-contrast h6 {
    color: #fff !important;
    background-color: #000 !important;
}
body.epa11y-high-contrast a { color: #ff0 !important; }
body.epa11y-high-contrast button,
body.epa11y-high-contrast .button,
body.epa11y-high-contrast input,
body.epa11y-high-contrast select,
body.epa11y-high-contrast textarea {
    background-color: #111 !important;
    color: #fff !important;
    border-color: #fff !important;
}
/* Keep widget visible in high contrast */
body.epa11y-high-contrast #epa11y-toggle { background: #1565C0 !important; color: #fff !important; }
body.epa11y-high-contrast #epa11y-panel,
body.epa11y-high-contrast #epa11y-panel * { background-color: #111 !important; color: #fff !important; }
body.epa11y-high-contrast #epa11y-panel .epa11y-panel-header,
body.epa11y-high-contrast #epa11y-panel .epa11y-panel-header * { background-color: #1565C0 !important; }
body.epa11y-high-contrast #epa11y-panel .epa11y-btn { border-color: #666 !important; }
body.epa11y-high-contrast #epa11y-panel .epa11y-btn.active { background: #1565C0 !important; border-color: #1565C0 !important; }

/* ── Negative Contrast (invert) ── */
body.epa11y-negative-contrast { filter: invert(100%) hue-rotate(180deg) !important; }
body.epa11y-negative-contrast img,
body.epa11y-negative-contrast video,
body.epa11y-negative-contrast iframe { filter: invert(100%) hue-rotate(180deg) !important; }
/* Keep widget un-inverted */
body.epa11y-negative-contrast #epa11y-toggle,
body.epa11y-negative-contrast #epa11y-panel { filter: invert(100%) hue-rotate(180deg) !important; }

/* ── Grayscale ── */
body.epa11y-grayscale { filter: grayscale(100%) !important; }
/* Keep widget in color */
body.epa11y-grayscale #epa11y-toggle,
body.epa11y-grayscale #epa11y-panel { filter: none !important; }

/* ── Readable font ── */
body.epa11y-readable-font,
body.epa11y-readable-font * {
    font-family: Arial, "Helvetica Neue", Helvetica, sans-serif !important;
    letter-spacing: 0.06em !important;
    word-spacing: 0.1em !important;
    line-height: 1.85 !important;
}

/* ── Highlight links ── */
body.epa11y-highlight-links a:not(#epa11y-toggle):not(.epa11y-skip-link):not(.epa11y-statement-link) {
    background: #ff0 !important;
    color: #000 !important;
    text-decoration: underline !important;
    padding: 1px 3px !important;
    border-radius: 2px !important;
    outline: 1px solid #000 !important;
}

/* ── Highlight headings ── */
body.epa11y-highlight-headings h1,
body.epa11y-highlight-headings h2,
body.epa11y-highlight-headings h3,
body.epa11y-highlight-headings h4,
body.epa11y-highlight-headings h5,
body.epa11y-highlight-headings h6 {
    background: #1565C0 !important;
    color: #fff !important;
    padding: 4px 10px !important;
    border-radius: 4px !important;
}

/* ── Stop animations ── */
body.epa11y-stop-animations *,
body.epa11y-stop-animations *::before,
body.epa11y-stop-animations *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
}

/* ── Large cursor ── */
body.epa11y-large-cursor,
body.epa11y-large-cursor * {
    cursor: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 32 32'%3E%3Cpath fill='%23000000' stroke='%23ffffff' stroke-width='2' d='M5 2 L5 26 L10 21 L14 30 L18 28 L14 19 L20 19 Z'/%3E%3C/svg%3E") 4 2, auto !important;
}

/* ── Keyboard nav – enhanced focus ring ── */
body.epa11y-keyboard-nav a:focus,
body.epa11y-keyboard-nav button:focus,
body.epa11y-keyboard-nav input:focus,
body.epa11y-keyboard-nav select:focus,
body.epa11y-keyboard-nav textarea:focus,
body.epa11y-keyboard-nav [tabindex]:focus {
    outline: 4px solid #1565C0 !important;
    outline-offset: 3px !important;
    box-shadow: 0 0 0 7px rgba(21,101,192,0.22) !important;
}

/* ── Accessibility Statement page ── */
.epa11y-statement {
    max-width: 780px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.8;
    color: #222;
}
.epa11y-statement h1 { font-size: 2rem; margin-bottom: 1rem; color: #1565C0; }
.epa11y-statement h2 {
    font-size: 1.25rem;
    margin: 1.8rem 0 0.6rem;
    color: #0d47a1;
    border-bottom: 2px solid #dce8fb;
    padding-bottom: 4px;
}
.epa11y-statement ul { padding-right: 1.4rem; margin-bottom: 1rem; }
.epa11y-statement li { margin-bottom: 6px; }
.epa11y-statement a  { color: #1565C0; }
.epa11y-statement hr { border: none; border-top: 1px solid #ddd; margin: 2rem 0; }

/* ── Responsive ── */
@media (max-width: 480px) {
    #epa11y-panel {
        width: calc(100vw - 24px);
        left: 12px;
        bottom: 136px;
    }
    #epa11y-panel.epa11y-pos-bottom-right {
        left: 12px;
        right: 12px;
    }
    #epa11y-toggle {
        bottom: 72px;
        left: 12px;
        width: 48px;
        height: 48px;
    }
    #epa11y-toggle.epa11y-pos-bottom-right {
        left: auto;
        right: 12px;
    }
}
