/* K9X Accessibility Styles */

/* CSS Variables for Accessibility */
:root {
    --line-spacing: 100%;
    --letter-spacing: 0em;
}

/* Skip Links */
#skip-links {
    position: absolute;
    top: -100px;
    left: 0;
    z-index: 10000;
}

.skip-link {
    position: absolute;
    background: #000;
    color: #fff;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: bold;
    border-radius: 0 0 4px 0;
    transform: translateY(-100%);
    transition: transform 0.3s;
}

.skip-link:focus {
    transform: translateY(100px);
}

/* Accessibility Toolbar */
#accessibility-toolbar {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 9999;
    font-family: Arial, sans-serif;
}

#accessibility-toggle {
    background: #c1121f;
    color: white;
    border: none;
    padding: 12px 16px;
    border-radius: 25px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
    transition: all 0.3s ease;
    font-size: 14px;
    font-weight: bold;
}

#accessibility-toggle:hover {
    background: #a10e19;
    transform: translateY(-2px);
    box-shadow: 0 6px 16px rgba(0,0,0,0.4);
}

#accessibility-toggle:focus {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

#accessibility-toggle svg {
    width: 20px;
    height: 20px;
}

.accessibility-panel {
    display: none;
    position: absolute;
    top: 60px;
    right: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 8px;
    box-shadow: 0 8px 24px rgba(0,0,0,0.2);
    width: 320px;
    max-height: 500px;
    overflow-y: auto;
}

.accessibility-header {
    background: #f8f9fa;
    padding: 16px;
    border-bottom: 1px solid #dee2e6;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-radius: 8px 8px 0 0;
}

.accessibility-header h3 {
    margin: 0;
    color: #333;
    font-size: 16px;
}

#accessibility-close {
    background: none;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #666;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
}

#accessibility-close:hover {
    background: #e9ecef;
    color: #333;
}

.accessibility-content {
    padding: 16px;
}

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

.accessibility-section h4 {
    margin: 0 0 12px 0;
    color: #333;
    font-size: 14px;
    font-weight: bold;
    border-bottom: 1px solid #eee;
    padding-bottom: 4px;
}

.accessibility-controls {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
}

.accessibility-btn {
    background: #f8f9fa;
    border: 1px solid #dee2e6;
    color: #333;
    padding: 8px 12px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 12px;
    transition: all 0.2s ease;
    flex: 0 0 auto;
}

.accessibility-btn:hover {
    background: #e9ecef;
    border-color: #adb5bd;
}

.accessibility-btn:focus {
    outline: 2px solid #c1121f;
    outline-offset: 1px;
}

.accessibility-btn.active {
    background: #c1121f;
    color: white;
    border-color: #c1121f;
}

.accessibility-btn.toggle {
    min-width: 80px;
}

/* Accessibility Features */

/* High Contrast Mode */
.high-contrast {
    filter: contrast(1.5) !important;
}

.high-contrast * {
    background: #000 !important;
    color: #fff !important;
    border-color: #fff !important;
}

.high-contrast a {
    color: #ffff00 !important;
}

.high-contrast button {
    background: #fff !important;
    color: #000 !important;
}

/* Dark Mode */
.dark-mode {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
}

.dark-mode * {
    background-color: inherit;
    color: inherit;
}

.dark-mode .card, .dark-mode .section {
    background: #2d2d2d !important;
    color: #e0e0e0 !important;
}

.dark-mode button {
    background: #404040 !important;
    color: #e0e0e0 !important;
    border-color: #606060 !important;
}

/* Colorblind Friendly */
.colorblind-friendly .btn-primary {
    background: #0066cc !important;
}

.colorblind-friendly .accent {
    color: #0066cc !important;
}

/* Dyslexia Font */
.dyslexia-font * {
    font-family: 'OpenDyslexic', 'Comic Sans MS', cursive !important;
}

/* Line Spacing */
body * {
    line-height: calc(1.5 * var(--line-spacing)) !important;
}

/* Letter Spacing */
body * {
    letter-spacing: var(--letter-spacing) !important;
}

/* Focus Highlight */
.focus-highlight *:focus {
    outline: 3px solid #c1121f !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 6px rgba(193, 18, 31, 0.3) !important;
}

/* Disable Animations */
.no-animations *,
.no-animations *::before,
.no-animations *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* Reading Guide */
.reading-guide {
    position: fixed;
    left: 0;
    right: 0;
    height: 2px;
    background: #c1121f;
    z-index: 9998;
    pointer-events: none;
    box-shadow: 0 0 8px rgba(193, 18, 31, 0.6);
}

/* Screen Reader Only Content */
.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;
}

/* Enhanced Focus Styles */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus {
    outline: 2px solid #c1121f;
    outline-offset: 2px;
}

/* Better Button Accessibility */
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Mobile Accessibility */
@media (max-width: 768px) {
    #accessibility-toolbar {
        top: 10px;
        right: 10px;
    }

    .accessibility-panel {
        width: 280px;
        max-height: 400px;
    }

    #accessibility-toggle {
        padding: 10px 12px;
        font-size: 12px;
    }

    #accessibility-toggle span {
        display: none;
    }
}

/* Print Styles */
@media print {
    #accessibility-toolbar,
    .accessibility-panel,
    #skip-links {
        display: none !important;
    }
}

/* OpenDyslexic Font Loading */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/opendyslexic@1.0.3/otf/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: normal;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('https://cdn.jsdelivr.net/npm/opendyslexic@1.0.3/otf/OpenDyslexic-Bold.otf') format('opentype');
    font-weight: bold;
    font-style: normal;
    font-display: swap;
}

/* Keyboard Navigation Enhancement */
.js-focus-visible :focus:not(.focus-visible) {
    outline: none;
}

.js-focus-visible .focus-visible {
    outline: 2px solid #c1121f;
    outline-offset: 2px;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}