/* Font Size Accessibility Enhancements */

/* High contrast mode support */
@media (prefers-contrast: high) {
    .font-size-control-container,
    .floating-font-control-panel {
        border: 2px solid #000;
        background: #fff;
    }
    
    .font-size-slider::-webkit-slider-thumb,
    .font-size-slider::-moz-range-thumb {
        border: 3px solid #000;
        background: #000;
    }
    
    .floating-quick-btn,
    .font-size-quick-btn {
        border: 2px solid #000;
    }
    
    .floating-quick-btn.active,
    .font-size-quick-btn.active {
        background: #000;
        color: #fff;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
    
    .floating-font-control-panel {
        animation: none;
    }
    
    .font-size-control-container:hover,
    .card:hover {
        transform: none;
    }
}

/* Focus indicators for keyboard navigation */
.font-size-slider:focus,
.floating-slider:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

.font-size-quick-btn:focus,
.floating-quick-btn:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.3);
}

.font-size-reset-btn:focus,
.floating-reset-btn:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

.floating-font-control-button:focus {
    outline: 3px solid #3b82f6;
    outline-offset: 2px;
}

/* Screen reader only text */
.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;
}

/* Skip links for keyboard navigation */
.skip-link {
    position: absolute;
    top: -40px;
    left: 6px;
    background: #000;
    color: #fff;
    padding: 8px;
    text-decoration: none;
    z-index: 1000;
    border-radius: 4px;
}

.skip-link:focus {
    top: 6px;
}

/* Font size announcement for screen readers */
.font-size-announcement {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Ensure minimum touch target size for mobile */
@media (max-width: 768px) {
    .font-size-quick-btn,
    .floating-quick-btn {
        min-height: 44px;
        min-width: 44px;
    }
    
    .font-size-slider,
    .floating-slider {
        min-height: 44px;
    }
    
    .floating-font-control-button {
        min-width: 56px;
        min-height: 56px;
    }
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    .font-size-control-container {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .font-size-control-header {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        border-color: #4b5563;
    }
    
    .font-size-control-title {
        color: #f9fafb;
    }
    
    .font-size-quick-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .font-size-quick-btn:hover {
        background: #4b5563;
        border-color: #6b7280;
        color: #f9fafb;
    }
    
    .font-size-quick-btn.active {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        border-color: #3b82f6;
        color: #fff;
    }
    
    .floating-font-control-panel {
        background: #1f2937;
        border-color: #374151;
        color: #f9fafb;
    }
    
    .floating-font-control-header {
        background: linear-gradient(135deg, #374151 0%, #4b5563 100%);
        border-color: #4b5563;
    }
    
    .floating-font-control-header h6 {
        color: #f9fafb;
    }
    
    .floating-quick-btn {
        background: #374151;
        border-color: #4b5563;
        color: #d1d5db;
    }
    
    .floating-quick-btn:hover {
        background: #4b5563;
        border-color: #6b7280;
        color: #f9fafb;
    }
    
    .floating-quick-btn.active {
        background: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
        border-color: #3b82f6;
        color: #fff;
    }
}

/* Print styles */
@media print {
    .floating-font-control,
    .font-size-control-container {
        display: none !important;
    }
    
    * {
        font-size: 12pt !important;
        line-height: 1.4 !important;
    }
    
    h1 { font-size: 18pt !important; }
    h2 { font-size: 16pt !important; }
    h3 { font-size: 14pt !important; }
    h4 { font-size: 13pt !important; }
    h5 { font-size: 12pt !important; }
    h6 { font-size: 11pt !important; }
}

/* Ensure proper scaling for very large font sizes */
@media (min-resolution: 2dppx) {
    .font-size-slider::-webkit-slider-thumb,
    .font-size-slider::-moz-range-thumb {
        width: 24px;
        height: 24px;
    }
    
    .floating-slider::-webkit-slider-thumb,
    .floating-slider::-moz-range-thumb {
        width: 20px;
        height: 20px;
    }
}

/* Support for forced colors mode (Windows High Contrast) */
@media (forced-colors: active) {
    .font-size-control-container,
    .floating-font-control-panel {
        background: Canvas;
        color: CanvasText;
        border: 1px solid ButtonText;
    }
    
    .font-size-quick-btn,
    .floating-quick-btn {
        background: ButtonFace;
        color: ButtonText;
        border: 1px solid ButtonText;
    }
    
    .font-size-quick-btn.active,
    .floating-quick-btn.active {
        background: Highlight;
        color: HighlightText;
    }
    
    .font-size-slider::-webkit-slider-thumb,
    .font-size-slider::-moz-range-thumb {
        background: ButtonText;
        border: 1px solid ButtonText;
    }
}
