/* Accessibility Button and Menu Styles */
:root {
    --acc-btn-bg: #2b5db8;
    /* Blue standard accessibility color */
    --acc-btn-hover: #1e4287;
    --acc-menu-bg: #ffffff;
    --acc-menu-text: #333333;
    --acc-border: #e0e0e0;
    --acc-primary: #003366;
    /* Matching project primary */
}

/* Floating Button */
#accessibility-btn {
    position: fixed;
    right: 0;
    top: 50%;
    /* Adjusted to match menu top */
    transform: translateY(-50%);
    width: 60px;
    /* Slightly larger for the detailed icon */
    height: 60px;
    background-color: var(--acc-btn-bg);
    color: white;
    border: none;
    border-radius: 4px 0 0 4px;
    box-shadow: -2px 2px 5px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: right 0.3s ease-in-out, background-color 0.3s;
}

#accessibility-btn.active {
    right: 300px;
    /* Moves with the menu width */
}

#accessibility-btn:hover {
    background-color: var(--acc-btn-hover);
}

#accessibility-btn svg {
    width: 40px;
    height: 40px;
    fill: currentColor;
}

/* Accessibility Menu */
#accessibility-menu {
    position: fixed;
    right: -300px;
    /* Hidden off-screen */
    top: 120px;
    width: 300px;
    background-color: var(--acc-menu-bg);
    border: 1px solid var(--acc-border);
    border-right: none;
    box-shadow: -4px 4px 12px rgba(0, 0, 0, 0.1);
    z-index: 9998;
    transition: right 0.3s ease-in-out;
    border-radius: 4px 0 0 4px;
    display: block;
    /* Always potentially visible, controlled by position */
}

#accessibility-menu.active {
    right: 0;
}

.acc-header {
    background-color: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid var(--acc-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.acc-header h3 {
    margin: 0;
    font-size: 18px;
    font-weight: 700;
    color: var(--acc-primary);
}

.acc-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    cursor: pointer;
    color: #666;
}

.acc-options {
    padding: 10px 0;
    max-height: 70vh;
    overflow-y: auto;
}

.acc-option {
    display: flex;
    align-items: center;
    padding: 12px 20px;
    width: 100%;
    background: none;
    border: none;
    text-align: left;
    cursor: pointer;
    color: var(--acc-menu-text);
    font-size: 15px;
    transition: background-color 0.2s;
    border-bottom: 1px solid #f0f0f0;
}

.acc-option:last-child {
    border-bottom: none;
}

.acc-option:hover {
    background-color: #f5f7fa;
}

.acc-option.active {
    background-color: #e6f0ff;
    color: var(--acc-primary);
    font-weight: 500;
}

.acc-icon {
    width: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

/* Accessibility Modes */

/* Grayscale */
html.acc-grayscale {
    filter: grayscale(100%);
}

/* High Contrast */
html.acc-high-contrast {
    filter: contrast(125%);
}

html.acc-high-contrast body {
    background-color: #000 !important;
    color: #fff !important;
}

html.acc-high-contrast * {
    background-color: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
    box-shadow: none !important;
}

html.acc-high-contrast img {
    filter: grayscale(100%) contrast(120%);
}

html.acc-high-contrast #accessibility-menu,
html.acc-high-contrast #accessibility-btn {
    border: 2px solid #fff !important;
}

/* Negative Contrast */
html.acc-negative-contrast {
    filter: invert(100%);
}

html.acc-negative-contrast img,
html.acc-negative-contrast video {
    filter: invert(100%);
    /* Revert media */
}

/* Light Background */
html.acc-light-bg body {
    background-color: #ffffff !important;
    color: #000000 !important;
}

/* Underline Links */
body.acc-underline-links a {
    text-decoration: underline !important;
}

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

/* Text Sizing Utility */
/* We will handle text sizing via JS specific transform or font-size on root */