/** * Accessibility Styles * * Enhanced accessibility styles including visible focus states, * screen reader utilities, and minimum touch targets. * * @package Apus_Theme * @since 1.0.0 */ /* ========================================================================== Focus Styles - Highly Visible ========================================================================== */ /** * Enhanced focus styles for better keyboard navigation * Using double outline for better visibility across different backgrounds */ *:focus { outline: 3px solid #0066cc; outline-offset: 2px; } /* Remove default browser focus outline (we're replacing it with better one) */ *:focus:not(:focus-visible) { outline: none; } /* Modern browsers that support :focus-visible */ *:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2); } /* Links */ a:focus, a:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2); text-decoration: underline; } /* Buttons */ button:focus, button:focus-visible, .button:focus, .button:focus-visible, input[type="submit"]:focus, input[type="submit"]:focus-visible, input[type="button"]:focus, input[type="button"]:focus-visible, input[type="reset"]:focus, input[type="reset"]:focus-visible { outline: 3px solid #0066cc; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2); } /* Form inputs */ input[type="text"]:focus, input[type="email"]:focus, input[type="url"]:focus, input[type="password"]:focus, input[type="search"]:focus, input[type="number"]:focus, input[type="tel"]:focus, input[type="range"]:focus, input[type="date"]:focus, input[type="month"]:focus, input[type="week"]:focus, input[type="time"]:focus, input[type="datetime"]:focus, input[type="datetime-local"]:focus, input[type="color"]:focus, textarea:focus, select:focus { outline: 3px solid #0066cc; outline-offset: 0; border-color: #0066cc; box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2); } /* Checkboxes and radio buttons */ input[type="checkbox"]:focus, input[type="radio"]:focus { outline: 3px solid #0066cc; outline-offset: 2px; box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.2); } /* Navigation menu items */ .main-navigation a:focus, .primary-menu a:focus, nav a:focus { outline: 3px solid #0066cc; outline-offset: 2px; background-color: rgba(0, 102, 204, 0.1); } /* Menu toggle button */ .menu-toggle:focus, .mobile-menu-toggle:focus { outline: 3px solid #0066cc; outline-offset: 2px; box-shadow: 0 0 0 4px rgba(0, 102, 204, 0.2); } /* ========================================================================== Screen Reader Text Utilities ========================================================================== */ /** * Hide elements visually but keep them accessible to screen readers */ .screen-reader-text, .sr-only, .visually-hidden { position: absolute !important; width: 1px !important; height: 1px !important; padding: 0 !important; margin: -1px !important; overflow: hidden !important; clip: rect(0, 0, 0, 0) !important; white-space: nowrap !important; border: 0 !important; clip-path: inset(50%) !important; } /** * Make screen reader text visible on focus * Important for skip links and keyboard navigation */ .screen-reader-text:focus, .sr-only:focus, .visually-hidden:focus { position: fixed !important; top: 5px !important; left: 5px !important; width: auto !important; height: auto !important; padding: 15px 23px 14px !important; margin: 0 !important; background-color: #000 !important; color: #fff !important; font-size: 14px !important; font-weight: bold !important; line-height: normal !important; text-decoration: none !important; z-index: 100000 !important; clip: auto !important; clip-path: none !important; outline: 3px solid #0066cc !important; outline-offset: 2px !important; border-radius: 3px !important; } /** * Skip to content link */ .skip-link { position: absolute; top: -40px; left: 0; background-color: #000; color: #fff; padding: 10px 20px; text-decoration: none; z-index: 100000; font-weight: bold; border-radius: 0 0 3px 0; transition: top 0.2s ease-in-out; } .skip-link:focus { top: 0; outline: 3px solid #0066cc; outline-offset: 2px; } /* ========================================================================== Touch Targets - Minimum 44x44px ========================================================================== */ /** * Ensure all interactive elements meet WCAG 2.1 Level AAA * minimum touch target size of 44x44 pixels */ /* Buttons */ button, .button, input[type="submit"], input[type="button"], input[type="reset"], .wp-block-button__link { min-height: 44px; min-width: 44px; padding: 10px 20px; display: inline-flex; align-items: center; justify-content: center; } /* Links in navigation */ .main-navigation a, .primary-menu a, .footer-navigation a, nav a { min-height: 44px; display: inline-flex; align-items: center; padding: 10px 15px; } /* Menu toggle buttons */ .menu-toggle, .mobile-menu-toggle { min-width: 44px; min-height: 44px; padding: 10px; } /* Pagination links */ .page-numbers, .pagination a, .posts-navigation a { min-width: 44px; min-height: 44px; display: inline-flex; align-items: center; justify-content: center; padding: 10px 15px; } /* Form inputs */ input[type="text"], input[type="email"], input[type="url"], input[type="password"], input[type="search"], input[type="number"], input[type="tel"], textarea, select { min-height: 44px; padding: 10px 15px; } /* Checkboxes and radio buttons */ input[type="checkbox"], input[type="radio"] { min-width: 24px; min-height: 24px; margin: 10px; /* Add margin to reach 44px effective touch target */ } /* Links with small text need larger padding */ .tags-list a, .category-badge { min-height: 44px; padding: 12px 16px; display: inline-flex; align-items: center; } /* ========================================================================== High Contrast Mode Support ========================================================================== */ /** * Ensure elements remain visible in Windows High Contrast Mode */ @media (prefers-contrast: high) { button, a, .button { border: 2px solid currentColor; } *:focus, *:focus-visible { outline: 3px solid; outline-offset: 3px; } } /* ========================================================================== Reduced Motion Support ========================================================================== */ /** * Respect user's preference for reduced motion * Remove animations for users who prefer 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; } } /* ========================================================================== Color Contrast Enhancements ========================================================================== */ /** * Ensure text has sufficient color contrast * WCAG AA requires 4.5:1 for normal text, 3:1 for large text */ /* Enhanced link contrast */ a { color: #0056b3; text-decoration: underline; } a:hover { color: #003d82; text-decoration: underline; } /* Error messages - high contrast red */ .error, .error-message, .form-error { color: #c81e1e; background-color: #fef0f0; border: 2px solid #c81e1e; padding: 10px 15px; border-radius: 4px; } /* Success messages - high contrast green */ .success, .success-message, .form-success { color: #1e7e34; background-color: #e8f5e9; border: 2px solid #1e7e34; padding: 10px 15px; border-radius: 4px; } /* Warning messages - high contrast yellow/orange */ .warning, .warning-message, .form-warning { color: #856404; background-color: #fff3cd; border: 2px solid #856404; padding: 10px 15px; border-radius: 4px; } /* ========================================================================== ARIA Live Regions ========================================================================== */ /** * Ensure live regions are properly announced */ [aria-live] { position: relative; } [aria-live="assertive"] { font-weight: bold; } /* ========================================================================== Focus Management for Modals and Dialogs ========================================================================== */ /** * Trap focus within modals */ .modal[aria-modal="true"], .dialog[aria-modal="true"] { position: fixed; top: 0; left: 0; width: 100%; height: 100%; z-index: 999999; } /* Modal backdrop */ .modal-backdrop { position: fixed; top: 0; left: 0; width: 100%; height: 100%; background-color: rgba(0, 0, 0, 0.75); z-index: 999998; } /* ========================================================================== Text Spacing and Readability ========================================================================== */ /** * Support for user text spacing preferences * WCAG 2.1 Level AA Success Criterion 1.4.12 */ p, li, dd, dt { line-height: 1.6; letter-spacing: 0.02em; } h1, h2, h3, h4, h5, h6 { line-height: 1.3; letter-spacing: 0.01em; } /* Allow text to be resized up to 200% without loss of content or functionality */ html { font-size: 100%; } /* ========================================================================== Table Accessibility ========================================================================== */ /** * Ensure tables are accessible */ table { border-collapse: collapse; width: 100%; } th { text-align: left; font-weight: bold; background-color: #f8f9fa; border: 1px solid #dee2e6; padding: 12px; } td { border: 1px solid #dee2e6; padding: 12px; } /* Add scope visually for screen readers */ caption { font-weight: bold; text-align: left; padding: 10px 0; caption-side: top; } /* ========================================================================== Print Accessibility ========================================================================== */ @media print { /* Ensure focus styles don't print */ *:focus { outline: none !important; box-shadow: none !important; } /* Show link URLs in print */ a[href]:after { content: " (" attr(href) ")"; } /* Don't show URLs for fragment links or javascript */ a[href^="#"]:after, a[href^="javascript:"]:after { content: ""; } }