/**
 * Bridge Child Theme - Accessibility Styles
 * 
 * This stylesheet contains accessibility enhancements for WCAG 2.1 AA compliance
 * 
 * @package Bridge_Child
 * @version 1.0.0
 */

/* ===========================
   SKIP LINK STYLES
   WCAG: 2.4.1 Bypass Blocks (Level A)
   =========================== */

.skip-link {
    position: absolute;
    left: -9999px;
    top: -9999px;
    z-index: 999999;
    display: block;
    font-size: 14px;
    font-weight: bold;
    text-decoration: none;
    background: #f1f1f1;
    color: #21759b;
    padding: 15px 23px 14px;
}

.skip-link:focus {
    left: 6px;
    top: 7px;
    clip: auto;
    clip-path: none;
    height: auto;
    width: auto;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    z-index: 100000;
    border-radius: 3px;
}

/* ===========================
   SCREEN READER ONLY TEXT
   WCAG: 1.3.1 Info and Relationships (Level A)
   =========================== */

.screen-reader-text {
    border: 0;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    height: 1px;
    margin: -1px;
    overflow: hidden;
    padding: 0;
    position: absolute;
    width: 1px;
    word-wrap: normal !important;
    word-break: normal;
}

.screen-reader-text:focus {
    background-color: #f1f1f1;
    border-radius: 3px;
    box-shadow: 0 0 2px 2px rgba(0, 0, 0, 0.6);
    clip: auto !important;
    clip-path: none;
    color: #21759b;
    display: block;
    font-size: 0.875rem;
    font-weight: 700;
    height: auto;
    left: 5px;
    line-height: normal;
    padding: 15px 23px 14px;
    text-decoration: none;
    top: 5px;
    width: auto;
    z-index: 100000;
}

/* ===========================
   ENHANCED FOCUS INDICATORS
   WCAG: 2.4.7 Focus Visible (Level AA)
   =========================== */

/* General focus styles for all interactive elements */
a:focus,
button:focus,
input:focus,
textarea:focus,
select:focus,
summary:focus,
[tabindex]:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

/* Support for :focus-visible (modern browsers only) */
/* This allows mouse users to not see outline, but keyboard users do */
:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

/* Menu and navigation focus styles */
.main_menu a:focus,
.mobile_menu a:focus,
nav a:focus {
    outline: 2px solid #0073aa;
    outline-offset: 2px;
    position: relative;
    z-index: 1;
}

/* Dropdown menu focus */
.main_menu .sub-menu a:focus,
.main_menu .second .inner ul li a:focus {
    outline: 2px solid #0073aa;
    outline-offset: -2px; /* Inset for dropdown menus */
}

/* Button focus styles */
.qbutton:focus,
input[type="submit"]:focus,
input[type="button"]:focus,
button:focus,
.button:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 3px rgba(0, 115, 170, 0.5);
}

/* Search form focus */
.qode_search_form input[type="text"]:focus,
.qode_search_form input[type="search"]:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
    border-color: #0073aa;
}

/* Form element focus */
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="date"]:focus,
textarea:focus,
select:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
    border-color: #0073aa;
}

/* ===========================
   IMPROVED LINK VISIBILITY
   WCAG: 1.4.1 Use of Color (Level A)
   =========================== */

/* Ensure links are distinguishable from surrounding text */
.content a:not(.qbutton):not(.blog_holder_grid_title) {
    text-decoration: underline;
}

.content a:not(.qbutton):not(.blog_holder_grid_title):hover,
.content a:not(.qbutton):not(.blog_holder_grid_title):focus {
    text-decoration: none;
}

/* ===========================
   TEXT ZOOM IMPROVEMENTS
   WCAG: 1.4.4 Resize Text (Level AA)
   =========================== */

/* Ensure text can scale without breaking layout */
body {
    overflow-x: hidden; /* Prevent horizontal scroll on zoom */
}

/* Ensure containers can grow with text */
.container,
.container_inner {
    max-width: 100%;
}

/* ===========================
   KEYBOARD NAVIGATION HELPERS
   WCAG: 2.1.1 Keyboard (Level A)
   =========================== */

/* Make sure all interactive elements are keyboard accessible */
[tabindex="-1"]:focus {
    outline: 0;
}

/* Visible focus for dropdown toggles */
.has-children > a:focus::after,
.menu-item-has-children > a:focus::after {
    opacity: 1;
}

/* ===========================
   LANDMARK REGION STYLING
   (Optional visual enhancements)
   =========================== */

/* These styles help visually distinguish landmark regions */
/* Remove or customize as needed for your design */

main[role="main"] {
    /* Ensure main content is clearly defined */
    position: relative;
}

aside[role="complementary"] {
    /* Sidebar distinction */
}

nav[role="navigation"] {
    /* Navigation area */
}

header[role="banner"] {
    /* Header area */
}

footer[role="contentinfo"] {
    /* Footer area */
}

/* ===========================
   MOBILE MENU ACCESSIBILITY
   WCAG: 2.4.3 Focus Order (Level A)
   =========================== */

/* Ensure mobile menu is accessible */
.mobile_menu_button:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

/* Mobile menu visibility */
.mobile_menu[aria-hidden="true"] {
    display: none;
}

.mobile_menu[aria-hidden="false"] {
    display: block;
}

/* ===========================
   FORM VALIDATION STYLING
   WCAG: 3.3.1 Error Identification (Level A)
   =========================== */

/* Error state for form fields */
input.error,
textarea.error,
select.error {
    border-color: #d63638 !important;
    border-width: 2px !important;
}

/* Error messages */
.error-message,
.wpcf7-not-valid-tip {
    color: #d63638;
    font-weight: 600;
    margin-top: 0.5em;
}

/* Success state */
input.success,
textarea.success,
select.success {
    border-color: #00a32a !important;
}

/* ===========================
   HIGH CONTRAST MODE SUPPORT
   =========================== */

/* Ensure elements are visible in Windows High Contrast Mode */
@media (prefers-contrast: high) {
    a:focus,
    button:focus,
    input:focus,
    textarea:focus,
    select:focus {
        outline: 3px solid !important;
        outline-offset: 2px !important;
    }
}

/* ===========================
   REDUCED MOTION SUPPORT
   WCAG: 2.3.3 Animation from Interactions (Level AAA)
   =========================== */

/* Respect user's motion preferences */
@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;
    }
}

/* ===========================
   PRINT STYLES
   =========================== */

/* Ensure content is accessible when printed */
@media print {
    .skip-link {
        display: none;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
    }
    
    /* Hide decorative images */
    img[alt=""] {
        display: none;
    }
}

/* ===========================
   RESPONSIVE IMPROVEMENTS
   WCAG: 1.4.10 Reflow (Level AA)
   =========================== */

/* Ensure content reflows properly at 400% zoom */
@media screen and (max-width: 1280px) {
    /* Allow content to stack vertically */
    .sidebar {
        width: 100% !important;
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
}

/* ===========================
   UTILITY CLASSES
   =========================== */

/* Visually hidden but accessible to screen readers */
.visually-hidden {
    position: absolute !important;
    clip: rect(1px, 1px, 1px, 1px);
    clip-path: inset(50%);
    width: 1px;
    height: 1px;
    overflow: hidden;
    white-space: nowrap;
}

/* Focusable when navigated to via keyboard */
.visually-hidden:focus {
    clip: auto;
    clip-path: none;
    width: auto;
    height: auto;
    overflow: visible;
    white-space: normal;
}

/* ===========================
   WOOCOMMERCE ACCESSIBILITY
   =========================== */

/* Ensure WooCommerce elements are accessible */
.woocommerce a.button:focus,
.woocommerce button.button:focus,
.woocommerce input.button:focus {
    outline: 2px solid #0073aa !important;
    outline-offset: 2px !important;
}

.woocommerce-error,
.woocommerce-info,
.woocommerce-message {
    border-left-width: 4px;
}

/* Product images */
.woocommerce img {
    height: auto; /* Ensure images scale properly */
}

/* ===========================
   DARK MODE SUPPORT (Optional)
   =========================== */

/* Respect system dark mode preference */
@media (prefers-color-scheme: dark) {
    .skip-link,
    .screen-reader-text:focus {
        background-color: #1e1e1e;
        color: #58a6ff;
    }
}
