/* ============================================
   Accessibility Widget — Custom Build
   ============================================ */

/* --- Floating Button — Desktop: pill on right edge at ~40% from top
                          Mobile: circle in bottom-right corner --- */
#xc-a11y-btn {
    position: fixed;
    right: 0;
    top: 40%;
    transform: translateY(-50%);
    z-index: 99999;
    background: rgba(111, 168, 78, 0.70);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
    color: #fff;
    border: 1.5px solid rgba(255, 255, 255, 0.22);
    border-radius: 30px 0 0 30px;
    height: auto;
    width: auto;
    padding: 12px 16px 12px 14px;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 5px;
    box-shadow: -2px 4px 20px rgba(111, 168, 78, 0.30);
    transition: background 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
    font-family: "Noto Sans", sans-serif;
    line-height: 1;
}

#xc-a11y-btn:hover {
    background: rgba(111, 168, 78, 0.88);
    transform: translateY(-50%) scale(1.03);
    box-shadow: -3px 6px 24px rgba(111, 168, 78, 0.45);
}

#xc-a11y-btn svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

#xc-a11y-btn span {
    display: block;
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

/* Mobile: circle button in bottom-right corner, no text */
@media (max-width: 768px) {
    #xc-a11y-btn {
        right: 16px;
        top: auto;
        bottom: 20px;
        transform: none;
        border-radius: 50%;
        width: 50px;
        height: 50px;
        padding: 0;
        flex-direction: row;
        gap: 0;
        box-shadow: 0 4px 16px rgba(111, 168, 78, 0.40);
    }

    #xc-a11y-btn svg {
        width: 24px;
        height: 24px;
    }

    #xc-a11y-btn span {
        display: none;
    }
    
    #xc-a11y-btn:hover {
        transform: scale(1.08);
    }
}

/* --- Panel — Desktop: opens to left of right-edge button
               Mobile: opens above bottom-right circle button --- */
#xc-a11y-panel {
    position: fixed;
    right: 80px;
    top: 40%;
    transform: translateY(-50%);
    z-index: 99998;
    background: #fff;
    width: 320px;
    max-height: 80vh;
    overflow-y: auto;
    border-radius: 12px;
    box-shadow: 0 8px 40px rgba(0,0,0,0.18);
    font-family: "Noto Sans", sans-serif;
    display: none;
    opacity: 0;
    transition: opacity 0.2s ease;
}

@media (max-width: 768px) {
    #xc-a11y-panel {
        right: 15px;
        top: auto;
        bottom: 80px;
        transform: none;
        width: calc(100vw - 30px);
        max-width: 320px;
        max-height: 65vh;
    }

    /* Condense panel header */
    .xc-a11y-header {
        padding: 12px 16px 10px;
    }
    .xc-a11y-header h2 {
        font-size: 15px;
    }
    .xc-a11y-close {
        width: 26px;
        height: 26px;
        font-size: 15px;
    }

    /* Condense section heading */
    .xc-a11y-section {
        padding: 10px 16px;
    }
    .xc-a11y-section h3 {
        font-size: 11px;
        margin: 0 0 8px;
    }

    /* Condense mode rows */
    .xc-a11y-mode-row {
        padding: 8px 0;
        gap: 8px;
    }
    .xc-a11y-mode-info strong {
        font-size: 13px;
    }
    .xc-a11y-mode-info p {
        font-size: 11px;
        line-height: 1.3;
    }

    /* Active row — tighter */
    .xc-a11y-modes li.xc-mode-active .xc-a11y-mode-row {
        margin: 0 -16px;
        padding: 8px 16px;
    }

    /* Expanded description — smaller */
    .xc-a11y-mode-expanded {
        font-size: 11px;
        line-height: 1.4;
        padding: 5px 0 2px;
        margin-top: 5px;
    }

    /* Toggle switch — slightly smaller */
    .xc-a11y-toggle {
        width: 38px;
        height: 20px;
    }
    .xc-a11y-toggle::after {
        width: 14px;
        height: 14px;
    }
    .xc-a11y-toggle[aria-checked="true"]::after {
        transform: translateX(18px);
    }

    /* Footer buttons — tighter */
    .xc-a11y-footer {
        padding: 10px 16px;
        gap: 8px;
    }
    .xc-a11y-footer button {
        padding: 8px;
        font-size: 12px;
    }
}

#xc-a11y-panel.xc-a11y-open {
    display: block;
    opacity: 1;
}

/* --- Panel Header --- */
.xc-a11y-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 20px 16px;
    border-bottom: 1px solid #e8e8e8;
}

.xc-a11y-header h2 {
    font-size: 18px;
    font-weight: 700;
    color: #0c2259;
    margin: 0;
    font-family: "M PLUS Rounded 1c", "Noto Sans", sans-serif;
}

.xc-a11y-close {
    background: none;
    border: 1px solid #ddd;
    border-radius: 6px;
    width: 30px;
    height: 30px;
    cursor: pointer;
    font-size: 18px;
    line-height: 1;
    color: #555;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.2s;
}

.xc-a11y-close:hover {
    background: #f0f0f0;
}

/* --- Section --- */
.xc-a11y-section {
    padding: 16px 20px;
    border-bottom: 1px solid #f0f0f0;
}

.xc-a11y-section h3 {
    font-size: 13px;
    font-weight: 700;
    color: #0c2259;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0 0 14px;
    font-family: "M PLUS Rounded 1c", "Noto Sans", sans-serif;
}

/* --- Mode Items --- */
.xc-a11y-modes {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 0;
}

.xc-a11y-mode-row {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.2s;
}

.xc-a11y-modes li:last-child .xc-a11y-mode-row {
    border-bottom: none;
}

/* Active row — light blue highlight like competitor */
.xc-a11y-modes li.xc-mode-active .xc-a11y-mode-row {
    background: #e8f0fe;
    margin: 0 -20px;
    padding: 12px 20px;
    border-radius: 4px;
}

.xc-a11y-mode-info strong {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #1a1a1a;
    margin-bottom: 2px;
}

.xc-a11y-mode-info p {
    font-size: 12px;
    color: #777;
    margin: 0;
    line-height: 1.4;
}

/* Expanded description shown when mode is active */
.xc-a11y-mode-expanded {
    display: none;
    font-size: 12px;
    color: #444;
    line-height: 1.6;
    padding: 8px 0 4px;
    border-top: 1px solid #d0daf5;
    margin-top: 8px;
}

.xc-a11y-modes li.xc-mode-active .xc-a11y-mode-expanded {
    display: block;
}

/* --- Toggle Switch --- */
.xc-a11y-toggle {
    position: relative;
    flex-shrink: 0;
    width: 44px;
    height: 24px;
    background: #ccc;
    border-radius: 24px;
    border: none;
    cursor: pointer;
    transition: background 0.25s ease;
    outline: none;
}

.xc-a11y-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s ease;
    box-shadow: 0 1px 4px rgba(0,0,0,0.2);
}

.xc-a11y-toggle[aria-checked="true"] {
    background: #3a7bd5;
}

.xc-a11y-toggle[aria-checked="true"]::after {
    transform: translateX(20px);
}

.xc-a11y-toggle:focus-visible {
    outline: 2px solid #3a7bd5;
    outline-offset: 2px;
}

/* --- Reset/Hide row --- */
.xc-a11y-footer {
    padding: 14px 20px;
    display: flex;
    gap: 10px;
}

.xc-a11y-footer button {
    flex: 1;
    padding: 10px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s;
    font-family: "Noto Sans", sans-serif;
}

.xc-a11y-reset {
    background: #fff;
    border: 2px solid #0c2259;
    color: #0c2259;
}

.xc-a11y-reset:hover {
    background: #f0f4ff;
}

.xc-a11y-statement {
    background: #0c2259;
    border: 2px solid #0c2259;
    color: #fff;
}

.xc-a11y-statement:hover {
    background: #163a91;
}

/* ============================================
   Accessibility Mode CSS Effects
   ============================================ */

/* Epilepsy Safe — dampen colours, remove animations and blinking */
/* Filter is applied to each direct child of body EXCEPT the widget.
   This avoids the browser bug where filter on body breaks position:fixed. */
html.a11y-epilepsy body > *:not(#xc-a11y-widget) {
    filter: saturate(0.45) brightness(0.9) !important;
}

html.a11y-epilepsy *,
html.a11y-epilepsy *::before,
html.a11y-epilepsy *::after {
    animation: none !important;
    transition: none !important;
}

/* Carve-out: in epilepsy mode the carousel is reinitialised via JS without
   animateIn/animateOut, so all items stay fully visible at all times. */
html.a11y-epilepsy .owl-item {
    opacity: 1 !important;
    visibility: visible !important;
}

/* Pause any autoplaying video/gif */
html.a11y-epilepsy video,
html.a11y-epilepsy iframe {
    animation-play-state: paused !important;
}

/* Visually Impaired — larger text */
html.a11y-visually-impaired body {
    font-size: 115% !important;
}
html.a11y-visually-impaired h1,
html.a11y-visually-impaired h2,
html.a11y-visually-impaired h3,
html.a11y-visually-impaired h4,
html.a11y-visually-impaired h5,
html.a11y-visually-impaired h6,
html.a11y-visually-impaired .xc-hero-one__title,
html.a11y-visually-impaired .xc-heading__title,
html.a11y-visually-impaired .xc-hero-one__subtitle,
html.a11y-visually-impaired .xc-heading__subtitle {
    font-size: 110% !important;
    line-height: 1.3 !important;
}
html.a11y-visually-impaired p,
html.a11y-visually-impaired li,
html.a11y-visually-impaired a,
html.a11y-visually-impaired span {
    font-size: 115% !important;
    line-height: 1.6 !important;
}

/* Ensure specific custom classes scale up relative to their base size */
html.a11y-visually-impaired .xc-hero-one__title {
    font-size: calc(4.5rem * 1.05) !important;
    max-width: 100% !important;
    line-height: 1.2 !important;
}
html.a11y-visually-impaired .xc-hero-one__content {
    padding-right: 40px !important;
    padding-left: 40px !important;
}
html.a11y-visually-impaired .xc-heading__title { font-size: calc(3rem * 1.05) !important; }
html.a11y-visually-impaired .xc-hero-one__subtitle { font-size: calc(1.1rem * 1.15) !important; }
html.a11y-visually-impaired .xc-heading__subtitle { font-size: calc(1rem * 1.15) !important; }
html.a11y-visually-impaired .xc-about-two__testi-info p { font-size: calc(1.34rem * 1.15) !important; }
html.a11y-visually-impaired .xc-feature-two__title { font-size: calc(1.55rem * 1.15) !important; }
html.a11y-visually-impaired .xc-service-two__title { font-size: calc(1.6rem * 1.15) !important; }
html.a11y-visually-impaired .xc-event-one__title { font-size: calc(1.6rem * 1.15) !important; }
html.a11y-visually-impaired .xc-contact-page__headline h2 { font-size: calc(3rem * 1.05) !important; }
html.a11y-visually-impaired .xc-footer-one__widget-title { font-size: calc(1.5rem * 1.15) !important; }

/* Fix Contact Page Columns & Email Wrapping */
html.a11y-visually-impaired .xc-contact-page__cta {
    display: flex !important;
    flex-direction: column !important;
    gap: 20px !important;
}
html.a11y-visually-impaired .xc-contact-page__cta li {
    width: 100% !important;
    max-width: 100% !important;
}
html.a11y-visually-impaired .xc-contact-page__cta__info,
html.a11y-visually-impaired .xc-contact-page__cta__info a {
    word-break: break-word !important;
    overflow-wrap: break-word !important;
    white-space: normal !important;
}

/* Cognitive Disability — dyslexia-friendly font, link highlights, spacing, focus */
@import url('https://fonts.googleapis.com/css2?family=Lexend:wght@400;600&display=swap');

html.a11y-cognitive body,
html.a11y-cognitive p,
html.a11y-cognitive li,
html.a11y-cognitive span {
    font-family: 'Lexend', 'Arial', sans-serif !important;
    letter-spacing: 0.05em !important;
    word-spacing: 0.15em !important;
    line-height: 2 !important;
}

html.a11y-cognitive h1,
html.a11y-cognitive h2,
html.a11y-cognitive h3,
html.a11y-cognitive h4,
html.a11y-cognitive h5,
html.a11y-cognitive h6 {
    font-family: 'Lexend', 'Arial', sans-serif !important;
    letter-spacing: 0.04em !important;
    line-height: 1.6 !important;
}

html.a11y-cognitive a {
    text-decoration: underline !important;
    text-underline-offset: 3px !important;
    font-weight: 600 !important;
}

html.a11y-cognitive p {
    max-width: 70ch !important;
    margin-bottom: 1.5em !important;
}

html.a11y-cognitive *:focus {
    outline: 3px solid #3a7bd5 !important;
    outline-offset: 3px !important;
}

html.a11y-cognitive img,
html.a11y-cognitive video,
html.a11y-cognitive .xc-main-slider-one__carousel {
    filter: none !important;
}

/* ADHD Friendly — reading focus mask */
/* Two overlay divs (#xc-adhd-top and #xc-adhd-bottom) are injected by JS.
   They darken everything above and below the cursor, leaving a 100px
   bright band centred on the cursor. */
#xc-adhd-top,
#xc-adhd-bottom {
    position: fixed;
    left: 0;
    width: 100%;
    background: rgba(0, 0, 0, 0.45);
    pointer-events: none;
    z-index: 999996;
    transition: height 0.04s linear, top 0.04s linear;
}
#xc-adhd-top  { top: 0; }
#xc-adhd-bottom { bottom: 0; }

/* Blindness Mode — enhanced focus indicators and skip nav */
html.a11y-blindness *:focus {
    outline: 4px solid #ff0 !important;
    outline-offset: 3px !important;
    background: #000 !important;
    color: #ff0 !important;
}

/* High Contrast */
html.a11y-contrast {
    filter: contrast(1.5) !important;
}

/* Grayscale */
html.a11y-grayscale {
    filter: grayscale(100%) !important;
}
