/**
 * Promen Image Text Block Widget Accessibility Styles
 * WCAG 2.2 compliant focus indicators, high contrast support, and reduced motion
 */


/* Focus Indicators - WCAG 2.2 Compliant */

.promen-image-text-block__button:focus,
.promen-image-text-block__button.focused {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #ffffff, 0 0 0 4px #005fcc;
}


/* Ensure focus is visible even with custom styles */

.promen-image-text-block__button:focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 1px #ffffff, 0 0 0 4px #005fcc !important;
}


/* Skip Links */

.promen-skip-link {
    position: absolute;
    left: -10000px;
    top: auto;
    width: 1px;
    height: 1px;
    overflow: hidden;
    background: #000;
    color: #fff;
    padding: 0.5rem 1rem;
    text-decoration: none;
    border-radius: 0.25rem;
    font-weight: 600;
    z-index: 9999;
}

.promen-skip-link:focus {
    position: static;
    left: auto;
    top: auto;
    width: auto;
    height: auto;
    overflow: visible;
}


/* High Contrast Mode Support */

@media (prefers-contrast: high) {
    .promen-image-text-block.high-contrast {
        border: 2px solid;
    }
    .promen-image-text-block.high-contrast .promen-image-text-block__button,
    .promen-image-text-block.high-contrast .promen-image-text-block__tab {
        border: 2px solid;
        background: ButtonFace;
        color: ButtonText;
    }
    .promen-image-text-block.high-contrast .promen-image-text-block__button:hover,
    .promen-image-text-block.high-contrast .promen-image-text-block__tab:hover {
        background: Highlight;
        color: HighlightText;
    }
    .promen-image-text-block.high-contrast .promen-image-text-block__button:focus,
    .promen-image-text-block.high-contrast .promen-image-text-block__tab:focus {
        outline: 3px solid Highlight;
        outline-offset: 2px;
    }
    .promen-image-text-block.high-contrast .promen-image-text-block__tab.active {
        background: Highlight;
        color: HighlightText;
        border-color: HighlightText;
    }
}


/* Reduced Motion Support */

@media (prefers-reduced-motion: reduce) {
    .promen-image-text-block.reduced-motion *,
    .promen-image-text-block.reduced-motion *::before,
    .promen-image-text-block.reduced-motion *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
    .promen-image-text-block.reduced-motion .promen-image-text-block__button:hover {
        transform: none;
    }
    .promen-image-text-block.reduced-motion .promen-image-text-block__button-icon {
        transform: none;
    }
    .promen-image-text-block.reduced-motion .promen-image-text-block__image {
        transition: none;
    }
}


/* Ensure minimum touch target size (44px) */

.promen-image-text-block__button,
.promen-image-text-block__tab {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}


/* Improve button text contrast */

.promen-image-text-block__button-text {
    position: relative;
    z-index: 1;
}


/* Ensure proper color contrast for text */

.promen-image-text-block__title,
.promen-image-text-block__description,
.promen-image-text-block__tab-title {
    color: inherit;
}


/* Focus management for tab navigation */

.promen-image-text-block__tab[tabindex="-1"] {
    outline: none;
}

.promen-image-text-block__tab[tabindex="0"]:focus {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
}


/* Ensure proper tab panel visibility for screen readers */

.promen-image-text-block__tab-content[aria-hidden="true"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.promen-image-text-block__tab-content[aria-hidden="false"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


/* Ensure proper image visibility for screen readers */

.promen-tab-image[aria-hidden="true"] {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
}

.promen-tab-image[aria-hidden="false"] {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
}


/* ARIA live region styling */

.promen-aria-live {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}


/* Ensure images are accessible */

.promen-image-text-block img {
    max-width: 100%;
    height: auto;
}

.promen-image-text-block img[alt=""] {
    /* Decorative images should have empty alt */
    border: 1px dashed #ccc;
}


/* Improve semantic structure visibility */

.promen-image-text-block section {
    display: block;
}

.promen-image-text-block article {
    display: block;
}

.promen-image-text-block header {
    display: block;
}

.promen-image-text-block footer {
    display: block;
}

.promen-image-text-block nav {
    display: block;
}

.promen-image-text-block figure {
    display: block;
    margin: 0;
}


/* Ensure proper heading hierarchy */

.promen-image-text-block h1,
.promen-image-text-block h2,
.promen-image-text-block h3,
.promen-image-text-block h4,
.promen-image-text-block h5,
.promen-image-text-block h6 {
    margin: 0 0 0.5rem 0;
    font-weight: 700;
}


/* Improve link accessibility */

.promen-image-text-block a {
    text-decoration: underline;
}

.promen-image-text-block a:hover,
.promen-image-text-block a:focus {
    text-decoration: none;
}


/* Ensure sufficient spacing for touch targets */

.promen-image-text-block__tabs-buttons {
    gap: 0.5rem;
}

.promen-image-text-block__tab {
    margin: 0.25rem;
}


/* Improve tab panel transitions for screen readers */

.promen-image-text-block__tab-content {
    transition: opacity 0.2s ease;
}

.promen-image-text-block__tab-content[aria-hidden="true"] {
    opacity: 0;
    pointer-events: none;
}

.promen-image-text-block__tab-content[aria-hidden="false"] {
    opacity: 1;
    pointer-events: auto;
}


/* Ensure proper contrast for active states */

.promen-image-text-block__tab.active {
    position: relative;
    /* Remove the ::after pseudo-element and use proper focus styling instead */
}


/* Enhanced focus state for tabs */

.promen-image-text-block__tab:focus,
.promen-image-text-block__tab.focused {
    outline: 3px solid #005fcc;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #ffffff, 0 0 0 4px #005fcc, 0 4px 8px rgba(0, 95, 204, 0.3);
    border: 2px solid #005fcc;
    transform: translateY(-1px);
    transition: all 0.2s ease;
}

.promen-image-text-block__tab:focus-visible,
.promen-image-text-block__tab.focused:focus-visible {
    outline: 3px solid #005fcc !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 1px #ffffff, 0 0 0 4px #005fcc, 0 4px 8px rgba(0, 95, 204, 0.3) !important;
    border: 2px solid #005fcc !important;
    transform: translateY(-1px) !important;
    transition: all 0.2s ease !important;
}


/* Ensure focus state works with active tabs */

.promen-image-text-block__tab.active:focus,
.promen-image-text-block__tab.active.focused {
    outline: 3px solid #ffffff;
    outline-offset: 2px;
    box-shadow: 0 0 0 1px #005fcc, 0 0 0 4px #ffffff, 0 4px 8px rgba(255, 255, 255, 0.3);
    border: 2px solid #ffffff;
}


/* Improve button states for accessibility */

.promen-image-text-block__button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

.promen-image-text-block__button:not(:disabled):hover {
    transform: translateY(-1px);
}

.promen-image-text-block__button:not(:disabled):active {
    transform: translateY(0);
}


/* Ensure proper text scaling */

@media (min-resolution: 192dpi) {
    .promen-image-text-block {
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
    }
}


/* Support for forced colors mode */

@media (forced-colors: active) {
    .promen-image-text-block__button,
    .promen-image-text-block__tab {
        border: 1px solid ButtonText;
        background: ButtonFace;
        color: ButtonText;
    }
    .promen-image-text-block__button:hover,
    .promen-image-text-block__tab:hover {
        background: Highlight;
        color: HighlightText;
    }
    .promen-image-text-block__tab.active {
        background: Highlight;
        color: HighlightText;
    }
    .promen-image-text-block__button:focus,
    .promen-image-text-block__tab:focus {
        outline: 2px solid Highlight;
        outline-offset: 2px;
    }
}


/* Ensure proper spacing for screen readers */

.promen-image-text-block__content {
    line-height: 1.6;
}

.promen-image-text-block__description {
    margin-bottom: 1rem;
}


/* Improve mobile accessibility */

@media (max-width: 767px) {
    .promen-image-text-block__button,
    .promen-image-text-block__tab {
        min-height: 48px;
        min-width: 48px;
        font-size: 1rem;
    }
    .promen-image-text-block__tabs-buttons {
        gap: 0.75rem;
    }
}


/* Ensure proper focus order */

.promen-image-text-block__tab[tabindex="0"] {
    z-index: 1;
}

.promen-image-text-block__tab[tabindex="-1"] {
    z-index: 0;
}


/* Improve error states */

.promen-image-text-block__error {
    color: #d32f2f;
    border: 1px solid #d32f2f;
    background: #ffebee;
    padding: 0.5rem;
    border-radius: 0.25rem;
    margin: 0.5rem 0;
}


/* Ensure proper loading states */

.promen-image-text-block__loading {
    position: relative;
}

.promen-image-text-block__loading::after {
    content: 'Loading...';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: rgba(0, 0, 0, 0.8);
    color: white;
    padding: 0.5rem 1rem;
    border-radius: 0.25rem;
    font-size: 0.875rem;
}