/* ===================================================================
   Accessibility - WCAG 2.1 AA Compliance
   =================================================================== */

/* Focus Styles - Visible keyboard navigation */
:focus {
    outline: 2px solid #c09578;
    outline-offset: 2px;
}

:focus:not(:focus-visible) {
    outline: none;
}

:focus-visible {
    outline: 2px solid #c09578;
    outline-offset: 2px;
}

/* Links focus */
a:focus {
    outline: 2px solid #c09578;
    outline-offset: 2px;
}

/* Button focus */
button:focus,
input:focus,
select:focus,
textarea:focus {
    outline: 2px solid #c09578;
    outline-offset: 2px;
}

/* Skip Link */
.skip-link {
    position: absolute;
    top: -50px;
    left: 0;
    background: #222;
    color: #fff;
    padding: 10px 20px;
    z-index: 99999;
    text-decoration: none;
    transition: top 0.3s ease;
}

.skip-link:focus {
    top: 0;
}

/* Screen Reader Only Text */
.sr-only,
.screen-reader-text {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* 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;
    }
}

/* High Contrast Mode Support */
@media (prefers-contrast: more) {
    :root {
        --contrast-border: #000;
    }
    
    a {
        text-decoration: underline;
    }
    
    button,
    input,
    select,
    textarea {
        border: 2px solid #000;
    }
}

/* Touch Target Size - Minimum 44x44px */
.product-card__actions button,
.view-toggle,
.category-filter-btn,
.sf-cart__qty-btn {
    min-width: 44px;
    min-height: 44px;
}

/* Form Labels */
label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
}

.required {
    color: #d32f2f;
}

/* Error States — scoped to avoid overriding page-specific notice styles */
.woocommerce-checkout .woocommerce-error,
.wc-block-components-notice-banner.is-error {
border-left: 4px solid #d32f2f;
background: #ffebee;
}

.woocommerce-checkout .woocommerce-error li {
color: #b71c1c;
}

/* Success States — scoped to checkout context */
.woocommerce-checkout .woocommerce-message,
.wc-block-components-notice-banner.is-success {
border-left: 4px solid #2e7d32;
background: #e8f5e9;
}

/* ARIA Live Regions - For dynamic content */
[aria-live] {
    position: relative;
}

/* Form validation messages */
.woocommerce-form-row .required + .woocommerce-input-wrapper .error-message,
.wc-block-components-form-kit-field--invalid .wc-block-components-form-kit-field__error {
    display: block;
    color: #d32f2f;
    font-size: 13px;
    margin-top: 5px;
}

/* Loading states */
.loading {
    position: relative;
    pointer-events: none;
    opacity: 0.7;
}

.loading::after {
    content: "";
    position: absolute;
    top: 50%;
    left: 50%;
    width: 20px;
    height: 20px;
    margin: -10px 0 0 -10px;
    border: 2px solid #ccc;
    border-top-color: #222;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Color scheme support */
@media (prefers-color-scheme: dark) {
    .site-footer {
        background: #0d0d0d;
    }
}

/* Print styles for accessibility */
@media print {
    .skip-link,
    .mobile-menu-toggle,
    .product-card__actions,
    .footer-social {
        display: none;
    }
    
    a[href]::after {
        content: " (" attr(href) ")";
    }
}