/* Accessibility Features */
@font-face {
    font-family: 'OpenDyslexic';
    src: url('fonts/opendyslexic-0/OpenDyslexic-Regular.otf') format('opentype');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('fonts/opendyslexic-0/OpenDyslexic-Bold.otf') format('opentype');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('fonts/opendyslexic-0/OpenDyslexic-Italic.otf') format('opentype');
    font-weight: 400;
    font-style: italic;
    font-display: swap;
}

@font-face {
    font-family: 'OpenDyslexic';
    src: url('fonts/opendyslexic-0/OpenDyslexic-BoldItalic.otf') format('opentype');
    font-weight: 700;
    font-style: italic;
    font-display: swap;
}
html.text-size-125,
body.text-size-125 {
    font-size: 125% !important;
    --text-scale: 1.25;
}

html.text-size-150,
body.text-size-150 {
    font-size: 150% !important;
    --text-scale: 1.5;
}

html.text-size-175,
body.text-size-175 {
    font-size: 175% !important;
    --text-scale: 1.75;
}

html.text-size-200,
body.text-size-200 {
    font-size: 200% !important;
    --text-scale: 2;
}

body[class*="text-size-"] .accessibility-panel {
    font-size: calc(100% / var(--text-scale, 1));
}

body.high-contrast {
    --primary-color: #000000;
    --secondary-color: #000000;
    --text-dark: #000000;
    --text-muted: #000000;
    --bg-light: #ffffff;
    --bg-white: #ffffff;
    --border-light: #000000;
}

body.high-contrast .hero-badge,
body.high-contrast .cta-button.primary {
    background: #000000;
    color: #ffffff;
    border-color: #000000;
}

body.high-contrast .cta-button.secondary {
    background: transparent;
    color: #000000;
    border: 2px solid #000000;
}

body.high-contrast .footer,
body.high-contrast .hero-section {
    background: #ffffff;
}

body.high-contrast .theme-toggle {
    border-color: #000000;
    color: #000000;
}

body.high-contrast .accessibility-reset-btn {
    background: #000000;
    color: #ffffff;
}

body.dark-mode.high-contrast .hero-section {
    background: #ffffff;
}

body.dark-mode.high-contrast .header {
    background: transparent;
}

body.dark-mode.high-contrast .theme-toggle {
    background: #000000;
    border-color: #ffffff;
    color: #ffffff;
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

body.reduce-motion *:hover,
body.reduce-motion *:focus,
body.reduce-motion *:active {
    animation: none !important;
    transition: none !important;
    transform: none !important;
}

body.reduce-motion .loading-logo,
body.reduce-motion .particle,
body.reduce-motion .hero-section::before,
body.reduce-motion .hero-section::after {
    animation: none !important;
    transform: none !important;
}

body.reduce-motion .skip-link {
    display: none !important;
}

body.reduce-motion .accessibility-toggle-button,
body.reduce-motion .accessibility-keyboard-hint {
    left: 0;
    right: 0;
    margin-left: auto;
    margin-right: auto;
    transform: none !important;
    width: fit-content;
}



/* AAA Contrast Mode - WCAG AAA Standards with brand colors */
body.aaa-contrast {
    --primary-color: #5d4a36;
    --secondary-color: #4a3a28;
    --text-dark: #2b1f15;
    --text-muted: #5d4a36;
    --bg-light: #fdfdfb;
    --bg-white: #ffffff;
    --border-light: #8b7355;
    --accent-gold: #9d7d1a;
}

body.aaa-contrast .hero-badge,
body.aaa-contrast .cta-button.primary {
    background: #5d4a36;
    color: #ffffff;
    border-color: #5d4a36;
}

body.aaa-contrast .cta-button.secondary {
    background: transparent;
    color: #2b1f15;
    border: 2px solid #5d4a36;
}

body.aaa-contrast .footer,
body.aaa-contrast .hero-section {
    background: #fdfdfb;
    color: #2b1f15;
}

body.aaa-contrast .theme-toggle {
    border-color: #5d4a36;
    color: #2b1f15;
    background: #ffffff;
}

body.aaa-contrast .accessibility-panel {
    background: #fdfdfb;
    color: #2b1f15;
    border-left: 2px solid #8b7355;
}

body.aaa-contrast .accessibility-toggle {
    background: #d4d0ca;
}

body.aaa-contrast .accessibility-toggle.active {
    background: #5d4a36;
}

body.aaa-contrast .accessibility-reset-btn {
    background: #5d4a36;
    color: #ffffff;
}

body.aaa-contrast .accessibility-reset-btn:hover {
    background: #4a3a28;
}

body.dark-mode.aaa-contrast {
    --primary-color: #d9c4a8;
    --secondary-color: #c9b396;
    --text-dark: #f5f1ed;
    --text-muted: #d9c4a8;
    --bg-light: #1a1410;
    --bg-white: #0f0b08;
}

body.dark-mode.aaa-contrast .hero-section,
body.dark-mode.aaa-contrast .footer {
    background: #1a1410;
    color: #f5f1ed;
}

body.dark-mode.aaa-contrast .cta-button.primary {
    background: #d9c4a8;
    color: #1a1410;
}

body.dark-mode.aaa-contrast .cta-button.secondary {
    background: transparent;
    color: #f5f1ed;
    border: 2px solid #d9c4a8;
}

body.dark-mode.aaa-contrast .theme-toggle {
    background: #1a1410;
    border-color: #d9c4a8;
    color: #f5f1ed;
}

body.dark-mode.aaa-contrast .accessibility-panel {
    background: #1a1410;
    color: #f5f1ed;
    border-left: 2px solid #8b7355;
}

/* Dyslexia-Friendly Font */
body.dyslexia-font {
    font-family: 'OpenDyslexic', 'Segoe UI', sans-serif !important;
}

/* Increased Line Spacing */
body.line-spacing-large {
    line-height: 2 !important;
}

body.line-spacing-large .hero-description {
    line-height: 2.2 !important;
}

/* Increased Letter Spacing */
body.letter-spacing-large {
    letter-spacing: 0.08em !important;
}

/* Plain Language */
body.plain-language {
    line-height: 1.9 !important;
    letter-spacing: 0 !important;
    font-family: 'Segoe UI', Arial, sans-serif !important;
}

body.plain-language .hero-description,
body.plain-language .footer-links a {
    font-size: 1.05em;
}

/* Highlight Links */
body.highlight-links a {
    outline: 3px solid var(--accent-gold);
    outline-offset: 2px;
    background: rgba(212, 175, 55, 0.18);
    border-radius: 4px;
    text-decoration-thickness: 2px;
}

body.highlight-links a:hover,
body.highlight-links a:focus-visible {
    background: rgba(212, 175, 55, 0.28);
}

body.high-contrast.highlight-links a {
    outline: 3px solid #000000;
    background: rgba(0, 0, 0, 0.15);
}

body.high-contrast.highlight-links a:hover,
body.high-contrast.highlight-links a:focus-visible {
    background: rgba(0, 0, 0, 0.25);
}

/* Reading Ruler - Follows cursor position */
body.reading-ruler {
    cursor: crosshair;
}

body.reading-ruler::before {
    content: '';
    position: fixed;
    left: 0;
    width: 100%;
    height: 4px;
    background: var(--accent-gold);
    pointer-events: none;
    z-index: 9999;
    opacity: 0.8;
    box-shadow: 0 0 10px rgba(212, 175, 55, 0.5);
}

body.reading-ruler::after {
    content: '';
    position: fixed;
    left: 0;
    width: 100%;
    height: 60px;
    background: linear-gradient(180deg,
        rgba(212, 175, 55, 0.08) 0%,
        rgba(212, 175, 55, 0.15) 50%,
        rgba(212, 175, 55, 0.08) 100%);
    pointer-events: none;
    z-index: 9998;
    opacity: 0.6;
}

/* Cursor Size */
body.cursor-size-125 {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path d='M6 4 L6 38 L14 30 L20 46 L26 43 L20 28 L32 28 Z' fill='black' stroke='white' stroke-width='2' stroke-linejoin='round'/></svg>") 6 4, auto;
}

body.cursor-size-150 {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'><path d='M8 6 L8 58 L20 46 L28 70 L36 66 L28 42 L46 42 Z' fill='black' stroke='white' stroke-width='3' stroke-linejoin='round'/></svg>") 8 6, auto;
}

body.cursor-size-200 {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'><path d='M10 8 L10 78 L26 62 L36 94 L48 88 L36 56 L62 56 Z' fill='black' stroke='white' stroke-width='4' stroke-linejoin='round'/></svg>") 10 8, auto;
}

body.cursor-size-300 {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128' viewBox='0 0 128 128'><path d='M12 10 L12 104 L34 84 L48 124 L64 116 L48 74 L88 74 Z' fill='black' stroke='white' stroke-width='5' stroke-linejoin='round'/></svg>") 12 10, auto;
}

body.cursor-size-125 a,
body.cursor-size-125 button,
body.cursor-size-125 input,
body.cursor-size-125 select,
body.cursor-size-125 textarea {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='48' height='48' viewBox='0 0 48 48'><path d='M6 4 L6 38 L14 30 L20 46 L26 43 L20 28 L32 28 Z' fill='black' stroke='white' stroke-width='2' stroke-linejoin='round'/></svg>") 6 4, pointer;
}

body.cursor-size-150 a,
body.cursor-size-150 button,
body.cursor-size-150 input,
body.cursor-size-150 select,
body.cursor-size-150 textarea {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='72' height='72' viewBox='0 0 72 72'><path d='M8 6 L8 58 L20 46 L28 70 L36 66 L28 42 L46 42 Z' fill='black' stroke='white' stroke-width='3' stroke-linejoin='round'/></svg>") 8 6, pointer;
}

body.cursor-size-200 a,
body.cursor-size-200 button,
body.cursor-size-200 input,
body.cursor-size-200 select,
body.cursor-size-200 textarea {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='96' height='96' viewBox='0 0 96 96'><path d='M10 8 L10 78 L26 62 L36 94 L48 88 L36 56 L62 56 Z' fill='black' stroke='white' stroke-width='4' stroke-linejoin='round'/></svg>") 10 8, pointer;
}

body.cursor-size-300 a,
body.cursor-size-300 button,
body.cursor-size-300 input,
body.cursor-size-300 select,
body.cursor-size-300 textarea {
    cursor: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='128' height='128' viewBox='0 0 128 128'><path d='M12 10 L12 104 L34 84 L48 124 L64 116 L48 74 L88 74 Z' fill='black' stroke='white' stroke-width='5' stroke-linejoin='round'/></svg>") 12 10, pointer;
}

/* Reset Button Styling */
.accessibility-reset-btn {
    width: 100%;
    padding: 1rem;
    min-height: 44px;
    background: var(--border-light);
    border: none;
    border-radius: 8px;
    color: var(--text-dark);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 0.5rem;
}

.accessibility-reset-btn:hover {
    background: var(--primary-color);
    color: white;
    transform: translateY(-2px);
}

.accessibility-reset-btn:active {
    transform: translateY(0);
}
/* System Accessibility Detection Styles */

/* OS-level reduced motion support */
@media (prefers-reduced-motion: reduce) {
    body:not(.reduce-motion) {
        --reduce-motion-hint: 'OS prefers reduced motion';
    }
}

body.reduce-motion *,
body.reduce-motion *::before,
body.reduce-motion *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
}

/* OS-level high contrast support */
@media (prefers-contrast: high) {
    body.os-high-contrast {
        --primary-color: #000000;
        --secondary-color: #000000;
        --text-dark: #000000;
        --text-muted: #1a1a1a;
        --bg-light: #ffffff;
        --bg-white: #ffffff;
        --border-light: #000000;
    }

    body.os-high-contrast * {
        border-color: currentColor !important;
    }

    body.os-high-contrast button,
    body.os-high-contrast .cta-button {
        border: 2px solid #000000 !important;
    }
}

/* Screen reader optimizations */
body.screen-reader-active .particles {
    display: none !important;
}

body.screen-reader-active .hero-section::before,
body.screen-reader-active .hero-section::after {
    display: none !important;
}

body.screen-reader-active * {
    animation: none !important;
    transition: none !important;
}

body.screen-reader-active .skip-link {
    position: fixed;
    top: 0;
    left: 0;
    padding: 1rem;
    background: var(--primary-color);
    color: white;
    z-index: 100000;
    clip: auto;
    width: auto;
    height: auto;
}

/* Low bandwidth mode */
body.low-bandwidth .particles {
    display: none !important;
}

body.low-bandwidth .hero-section::before,
body.low-bandwidth .hero-section::after {
    display: none !important;
}

body.low-bandwidth * {
    animation: none !important;
}

body.low-bandwidth img {
    content-visibility: auto;
}

body.low-bandwidth .loading-logo {
    animation: none !important;
}

/* Forced colors mode support */
@media (forced-colors: active) {
    body {
        forced-color-adjust: auto;
    }

    button, .cta-button, .accessibility-toggle {
        forced-color-adjust: auto;
        border: 1px solid CanvasText;
    }
}
