/* ============================================
   Accessibility Widget — IS 5568 / WCAG 2.0 AA
   ============================================ */

/* Floating trigger button */
.a11y-trigger {
    position: fixed;
    bottom: 120px;
    right: 0;
    width: 42px;
    height: 41px;
    border-radius: 20.5px 0 0 20.5px;
    background: transparent;
    border: none;
    cursor: pointer;
    z-index: 998;
    padding: 0;
    overflow: hidden;
    box-shadow: 0 2px 14px rgba(0,0,0,0.25);
    transition: transform 0.2s ease, opacity 0.5s ease;
    opacity: 0;
    pointer-events: none;
}
.a11y-trigger.visible {
    opacity: 1;
    pointer-events: auto;
}
.a11y-trigger img {
    width: 42px;
    height: 41px;
    display: block;
    position: absolute;
    top: 0;
    left: 0;
}
.a11y-trigger-idle {
    opacity: 1;
    transition: opacity 0.2s ease;
}
.a11y-trigger-hover {
    opacity: 0;
    transition: opacity 0.2s ease;
}
/* Hover effects only on non-touch devices */
@media (hover: hover) {
    .a11y-trigger:hover {
        transform: scale(1.05);
    }
    .a11y-trigger:hover .a11y-trigger-idle {
        opacity: 0;
    }
    .a11y-trigger:hover .a11y-trigger-hover {
        opacity: 1;
    }
}

/* Panel overlay */
.a11y-panel-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,0.4);
    z-index: 999;
    opacity: 0;
    transition: opacity 0.25s ease;
}
.a11y-panel-overlay.active {
    display: block;
    opacity: 1;
}

/* Panel */
.a11y-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 320px;
    max-width: 90vw;
    height: 100vh;
    background: #fff;
    z-index: 1000;
    box-shadow: -4px 0 24px rgba(0,0,0,0.15);
    /* Clip instead of transform: panel stays pinned at right:0 with no
       off-canvas extent, so iOS pinch-zoom cannot pan into invisible space. */
    clip-path: inset(0 0 0 100%);
    visibility: hidden;
    pointer-events: none;
    transition: clip-path 0.3s ease, visibility 0s linear 0.3s;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}
.a11y-panel.open {
    clip-path: inset(0 0 0 0);
    visibility: visible;
    pointer-events: auto;
    transition: clip-path 0.3s ease, visibility 0s linear 0s;
}

/* Panel header */
.a11y-panel-header {
    display: flex;
    flex-direction: column;
    padding: 20px 24px 20px;
    border-bottom: 1px solid #eee;
    position: sticky;
    top: 0;
    background: #fff;
    z-index: 2;
}
.a11y-panel-close-row {
    display: flex;
    justify-content: flex-end;
    margin-bottom: 16px;
}
.a11y-panel-title {
    font-family: 'Montserrat', sans-serif;
    font-size: 22px;
    font-weight: 600;
    color: #143927;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin: 0;
    display: flex;
    align-items: center;
    gap: 12px;
}
.a11y-panel-title svg {
    width: 35px;
    height: 35px;
    flex-shrink: 0;
}
.a11y-panel-close {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.3s ease;
    flex-shrink: 0;
}
.a11y-panel-close:hover {
    opacity: 0.5;
}
.a11y-panel-close svg {
    width: 24px;
    height: 24px;
    pointer-events: none;
}

/* Panel body */
.a11y-panel-body {
    padding: 20px 24px;
    color: #333;
}

/* Feature items */
.a11y-feature {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid #eee;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.15s ease;
    user-select: none;
    -webkit-user-select: none;
}
.a11y-feature:hover {
    border-color: #143927;
    background: #f8fbf9;
}
.a11y-feature.active {
    border-color: #143927;
    background: #f0f6f3;
}

.a11y-feature-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.a11y-feature-icon {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    background: #f5f5f5;
    color: #143927;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0;
    transition: background 0.15s, color 0.15s;
}
.a11y-feature.active .a11y-feature-icon {
    background: #143927;
    color: #fff;
}
.a11y-feature.active .a11y-icon-svg img,
.a11y-feature.active .a11y-icon-hide-images img {
    filter: brightness(0) invert(1);
}
.a11y-feature-label {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #333;
}

/* Toggle indicator */
.a11y-toggle {
    width: 40px;
    height: 22px;
    border-radius: 11px;
    background: #ddd;
    position: relative;
    flex-shrink: 0;
    transition: background 0.2s ease;
}
.a11y-toggle::after {
    content: '';
    position: absolute;
    top: 2px;
    left: 2px;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #fff;
    transition: transform 0.2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}
.a11y-feature.active .a11y-toggle {
    background: #143927;
}
.a11y-feature.active .a11y-toggle::after {
    transform: translateX(18px);
    background: #D6E226;
}

/* Text size controls (special layout) */
.a11y-text-size {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    margin-bottom: 8px;
    border: 1px solid #eee;
    border-radius: 8px;
}
.a11y-text-size-left {
    display: flex;
    align-items: center;
    gap: 12px;
}
.a11y-text-size-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}
.a11y-text-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
    padding: 0;
}
.a11y-text-btn:hover {
    border-color: #143927;
    background: #f0f6f3;
    color: #143927;
}
.a11y-text-btn:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}
.a11y-text-value {
    font-family: 'Montserrat', sans-serif;
    font-size: 16px;
    font-weight: 500;
    color: #143927;
    min-width: 40px;
    text-align: center;
}

/* Reset button */
.a11y-reset {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 14px;
    margin-top: 20px;
    border: 2px solid #143927;
    border-radius: 8px;
    background: #143927;
    color: #fcf5ea;
    font-family: 'Montserrat', sans-serif;
    font-size: 20px;
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    cursor: pointer;
    transition: all 0.2s ease;
}
.a11y-reset:hover {
    background: #fff;
    color: #143927;
}
.a11y-reset-icon-default,
.a11y-reset-icon-hover {
    display: flex;
    align-items: center;
}
.a11y-reset-icon-hover {
    display: none;
}
.a11y-reset:hover .a11y-reset-icon-default {
    display: none;
}
.a11y-reset:hover .a11y-reset-icon-hover {
    display: flex;
}
.a11y-reset svg {
    width: 18px;
    height: 21px;
}

/* Accessibility statement link */
.a11y-statement {
    display: block;
    text-align: center;
    margin-top: 16px;
    padding: 10px;
    font-family: 'Montserrat', sans-serif;
    font-size: 11px;
    color: #999;
    text-decoration: underline;
    transition: color 0.15s;
}
.a11y-statement:hover {
    color: #143927;
}

/* ============================================
   Accessibility Modes — Applied to <body>
   ============================================ */

/* Grayscale — use overlay to avoid breaking position:fixed */
body.a11y-grayscale::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    backdrop-filter: grayscale(1);
    -webkit-backdrop-filter: grayscale(1);
    z-index: 997;
    pointer-events: none;
}

/* High contrast */
body.a11y-high-contrast {
    background: #000 !important;
    color: #fff !important;
}
body.a11y-high-contrast * {
    color: #fff !important;
    border-color: #fff !important;
}
body.a11y-high-contrast a {
    color: #ffff00 !important;
}
body.a11y-high-contrast img {
    filter: contrast(1.2);
}
body.a11y-high-contrast .site-header,
body.a11y-high-contrast .site-footer {
    background: #000 !important;
}
body.a11y-high-contrast .a11y-panel {
    background: #111 !important;
}
body.a11y-high-contrast .a11y-panel-header {
    background: #111 !important;
    border-color: #333 !important;
}
body.a11y-high-contrast .a11y-feature {
    border-color: #444 !important;
    background: transparent !important;
}
body.a11y-high-contrast .a11y-feature.active {
    background: #222 !important;
}
body.a11y-high-contrast .a11y-feature-icon {
    background: #333 !important;
}

/* Underline links & buttons — all clickable elements */
body.a11y-underline-links a,
body.a11y-underline-links button {
    text-decoration: underline !important;
}
/* Exclude: logos, icons, nav hamburger, accessibility widget itself */
body.a11y-underline-links a.header_logo,
body.a11y-underline-links .a11y-trigger,
body.a11y-underline-links .a11y-panel-close,
body.a11y-underline-links .a11y-panel button,
body.a11y-underline-links .hamburger-btn,
body.a11y-underline-links .footer-social a,
body.a11y-underline-links .exhibition-nav-arrow,
body.a11y-underline-links .ew-nav-arrow,
body.a11y-underline-links .artwork-arrow-pair button,
body.a11y-underline-links .cookie-banner button {
    text-decoration: none !important;
}

/* Readable font */
body.a11y-readable-font,
body.a11y-readable-font * {
    font-family: Arial, Helvetica, sans-serif !important;
}

/* Hide images — content only, preserve UI icons */
body.a11y-hide-images img {
    visibility: hidden !important;
}
body.a11y-hide-images video {
    visibility: hidden !important;
}
/* Exclude: UI elements, icons, header, footer, homepage slideshow */
body.a11y-hide-images .a11y-panel img,
body.a11y-hide-images .a11y-trigger img,
body.a11y-hide-images .a11y-trigger-idle,
body.a11y-hide-images .a11y-trigger-hover,
body.a11y-hide-images .header img,
body.a11y-hide-images .header svg,
body.a11y-hide-images .site-footer img,
body.a11y-hide-images .footer-logo img,
body.a11y-hide-images .footer-social img,
body.a11y-hide-images .page-title img,
body.a11y-hide-images .title-icon,
body.a11y-hide-images .exhibition-nav-arrow svg,
body.a11y-hide-images .ew-nav-arrow svg,
body.a11y-hide-images .artwork-arrow-pair svg,
body.a11y-hide-images .cookie-banner img,
body.a11y-hide-images .music-player img,
body.a11y-hide-images .logo-signature svg {
    visibility: visible !important;
}

/* ============================================
   Mobile adjustments
   ============================================ */
@media (max-width: 767px) {
    .a11y-trigger {
        bottom: 110px;
        right: 0;
        width: 42px;
        height: 41px;
    }
    .a11y-trigger img {
        width: 42px;
        height: 41px;
    }
    .a11y-panel {
        width: 100%;
        max-width: 100vw;
        right: 0;
    }
}

/* Move trigger up when cookie banner is visible */
body.cookie-banner-visible .a11y-trigger {
    bottom: 154px;
}
@media (max-width: 767px) {
    body.cookie-banner-visible .a11y-trigger {
        bottom: 164px;
    }
}
