/**
 * WCAG 2.0 AA Accessibility Fixes
 * Fixes color contrast, focus indicators, and other accessibility issues
 *
 * WCAG Requirements:
 * - Normal text: 4.5:1 contrast ratio minimum
 * - Large text (18pt+ or 14pt+ bold): 3:1 contrast ratio minimum
 * - Focus indicators: Must be visible
 */

/* ========================================
   COLOR CONTRAST FIXES
   ======================================== */

/* Fix: Deleted prices were using #999 (contrast ~2.8:1) - now using #595959 (contrast ~7:1) */
.woocommerce ul.products li.product .price del,
.woocommerce div.product .price del {
    color: #595959 !important;
    opacity: 1 !important;
}

/* Fix: Ensure product descriptions meet contrast requirements */
/* #666 on white is ~5.7:1 which passes, but let's use #4d4d4d for better readability */
.product-description,
.woocommerce-product-details__short-description,
.section-subtitle {
    color: #4d4d4d !important;
}

/* Fix: Sorting and result count text - was #666, now #4d4d4d */
.woocommerce-ordering,
.woocommerce-result-count {
    color: #4d4d4d !important;
}

/* Fix: Category links need higher contrast */
.woocommerce .widget_product_categories ul li a {
    color: #4d4d4d !important;
}

.woocommerce .widget_product_categories ul li a:hover {
    color: #6b3a0f !important;
}

/* Fix: Review links contrast */
.woocommerce div.product .woocommerce-review-link {
    color: #4d4d4d !important;
}

/* Fix: Stock status colors - ensure sufficient contrast */
.woocommerce div.product .stock.in-stock {
    color: #1e7e34 !important; /* Darker green for better contrast */
}

.woocommerce div.product .stock.out-of-stock {
    color: #c82333 !important; /* Darker red for better contrast */
}

/* ========================================
   FOCUS INDICATOR IMPROVEMENTS
   ======================================== */

/* Enhanced focus states - visible 2px outline with offset */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #2c2c2c !important;
    outline-offset: 2px !important;
}

/* High contrast focus for interactive elements */
.woocommerce ul.products li.product:focus-within,
.woocommerce ul.products li.product a:focus {
    outline: 2px solid #2c2c2c !important;
    outline-offset: 4px !important;
}

/* Focus styles for buttons */
.woocommerce .button:focus,
.woocommerce button:focus,
.woocommerce input[type="submit"]:focus,
.single_add_to_cart_button:focus {
    outline: 3px solid #2c2c2c !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 4px rgba(44, 44, 44, 0.2) !important;
}

/* Focus styles for variation swatches */
.cfvsw-swatches-option:focus {
    outline: 2px solid #2c2c2c !important;
    outline-offset: 2px !important;
}

/* Focus styles for mini-cart */
.krisette-cart-icon-link:focus,
.krisette-mini-cart-close:focus {
    outline: 2px solid #2c2c2c !important;
    outline-offset: 2px !important;
}

/* Mobile menu focus styles */
.mobile-menu-toggle:focus,
.mobile-navigation a:focus {
    outline: 2px solid #2c2c2c !important;
    outline-offset: 2px !important;
}

/* ========================================
   SKIP LINK IMPROVEMENTS
   ======================================== */

/* Enhanced skip to content link */
.skip-link,
.screen-reader-text.skip-link {
    position: absolute !important;
    left: -9999px !important;
    top: auto !important;
    width: 1px !important;
    height: 1px !important;
    overflow: hidden !important;
    z-index: 999999 !important;
    padding: 12px 24px !important;
    background: #2c2c2c !important;
    color: #ffffff !important;
    text-decoration: none !important;
    font-weight: 600 !important;
    font-size: 14px !important;
    border-radius: 0 0 4px 4px !important;
}

.skip-link:focus,
.screen-reader-text.skip-link:focus {
    left: 50% !important;
    top: 0 !important;
    transform: translateX(-50%) !important;
    width: auto !important;
    height: auto !important;
    overflow: visible !important;
    clip: auto !important;
    clip-path: none !important;
}

/* ========================================
   FORM ACCESSIBILITY
   ======================================== */

/* Ensure form labels are always visible or properly hidden for screen readers */
.woocommerce form .form-row label {
    display: block !important;
    visibility: visible !important;
    font-weight: 500 !important;
    color: #2c2c2c !important;
    margin-bottom: 5px !important;
}

/* Required field indicator with accessible text */
.woocommerce form .form-row .required {
    color: #c82333 !important;
    visibility: visible !important;
}

/* Error messages must be clearly visible */
.woocommerce form .form-row.woocommerce-invalid label {
    color: #c82333 !important;
}

.woocommerce form .form-row.woocommerce-invalid input,
.woocommerce form .form-row.woocommerce-invalid select,
.woocommerce form .form-row.woocommerce-invalid textarea {
    border-color: #c82333 !important;
}

/* Validation messages */
.woocommerce-error,
.woocommerce-message,
.woocommerce-info {
    padding: 15px 20px !important;
    margin-bottom: 20px !important;
}

.woocommerce-error {
    border-left: 4px solid #c82333 !important;
    background-color: #f8d7da !important;
    color: #721c24 !important;
}

.woocommerce-message {
    border-left: 4px solid #1e7e34 !important;
    background-color: #d4edda !important;
    color: #155724 !important;
}

.woocommerce-info {
    border-left: 4px solid #0c5460 !important;
    background-color: #d1ecf1 !important;
    color: #0c5460 !important;
}

/* ========================================
   HEADING HIERARCHY FIX
   ======================================== */

/* Ensure proper visual hierarchy while maintaining semantic structure */
/* Note: The actual heading levels should be fixed in PHP/HTML,
   this CSS ensures visual consistency */

.woocommerce-products-header__title {
    font-size: 2rem !important;
}

.product_title {
    font-size: 1.75rem !important;
}

/* Section headings within product pages */
.woocommerce-tabs .woocommerce-Tabs-panel h2 {
    font-size: 1.25rem !important;
}

/* ========================================
   LINK ACCESSIBILITY
   ======================================== */

/* Ensure links are distinguishable from regular text */
.entry-content a:not(.button):not(.wp-block-button__link),
.woocommerce-product-details__short-description a,
.woocommerce-Tabs-panel a {
    text-decoration: underline !important;
    text-decoration-thickness: 1px !important;
    text-underline-offset: 2px !important;
}

.entry-content a:not(.button):not(.wp-block-button__link):hover,
.woocommerce-product-details__short-description a:hover,
.woocommerce-Tabs-panel a:hover {
    text-decoration-thickness: 2px !important;
}

/* ========================================
   MOTION & ANIMATION ACCESSIBILITY
   ======================================== */

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

    .woocommerce ul.products li.product:hover {
        transform: none !important;
    }

    .woocommerce ul.products li.product:hover img {
        transform: none !important;
    }

    .masonry-image:hover {
        transform: none !important;
    }

    .masonry-image:hover img {
        transform: none !important;
    }
}

/* ========================================
   IMAGE ACCESSIBILITY
   ======================================== */

/* Ensure images don't cause layout shifts */
.woocommerce ul.products li.product img,
.woocommerce-product-gallery__image img {
    aspect-ratio: auto;
}

/* ========================================
   TOUCH TARGET SIZE (WCAG 2.5.5)
   ======================================== */

/* Minimum touch targets */
.woocommerce .button,
.woocommerce button,
.woocommerce input[type="submit"],
.mobile-menu-toggle,
.krisette-mini-cart-close,
.mobile-gallery-arrow,
.lightbox-close,
.lightbox-prev,
.lightbox-next {
    min-width: 12px !important;
    min-height: 12px !important;
}

/* Exception: Gallery dots - small visual size with padding for touch */
.mobile-gallery-dot {
    min-width: 8px !important;
    min-height: 8px !important;
    width: 8px !important;
    height: 8px !important;
    padding: 4px !important;
    background-clip: content-box !important;
    box-sizing: content-box !important;
}

/* Mobile navigation links */
@media (max-width: 768px) {
    .mobile-navigation a,
    .mobile-menu a {
        min-height: 44px !important;
        display: flex !important;
        align-items: center !important;
        padding: 10px 20px !important;
    }
}

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

@media (prefers-contrast: high) {
    .woocommerce ul.products li.product {
        border: 2px solid #2c2c2c !important;
    }

    .woocommerce .button,
    .woocommerce button {
        border: 2px solid currentColor !important;
    }

    a:focus,
    button:focus {
        outline-width: 3px !important;
    }
}
