/**
 * Accessibility Utilities
 * 
 * Screen reader only content, focus management, and WCAG compliance utilities
 */

@use '../abstracts' as *;

// Screen reader only content
.presszone-comments-sr-only {
    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;
}

// Focus management
.presszone-comments-focus-trap {
    // Ensure focus stays within modals
    &:focus {
        outline: none;
    }
}

// Enhanced focus indicators
.presszone-comments-btn,
.presszone-comments-action,
.presszone-comments-vote-btn,
.presszone-comments-tool-btn,
.presszone-comments-editable,
.presszone-comments-title-input {
    &:focus {
        outline: 2px solid var(--presszone-comments-primary);
        outline-offset: 2px;
        box-shadow: 0 0 0 2px rgba(31, 113, 221, 0.2);
    }
    
    &:focus:not(:focus-visible) {
        outline: none;
        box-shadow: none;
    }
    
    &:focus-visible {
        outline: 2px solid var(--presszone-comments-primary);
        outline-offset: 2px;
        box-shadow: 0 0 0 2px rgba(31, 113, 221, 0.2);
    }
}

// High contrast mode support
@media (prefers-contrast: high) {
    .presszone-comments-btn,
    .presszone-comments-action,
    .presszone-comments-vote-btn {
        border: 2px solid currentColor;
        
        &:focus {
            outline: 3px solid;
            outline-offset: 2px;
        }
    }
}

// Reduced motion support
@media (prefers-reduced-motion: reduce) {
    .presszone-comments-btn,
    .presszone-comments-action,
    .presszone-comments-vote-btn,
    .presszone-comments-modal,
    .presszone-comments-toast {
        transition: none !important;
        animation: none !important;
    }
}

// Color contrast improvements for inherit theme
.presszone-comments-theme--inherit {
    // Ensure minimum contrast ratios
    .presszone-comments-text-muted {
        opacity: 0.8;
        font-weight: 500; // Slightly bolder for better readability
    }
    
    .presszone-comments-btn--ghost {
        background: rgba(128, 128, 128, 0.1);
        border: 1px solid rgba(128, 128, 128, 0.3);
        
        &:hover {
            background: rgba(128, 128, 128, 0.2);
        }
    }
    
    // Ensure vote buttons have sufficient contrast
    .presszone-comments-vote-btn {
        background: rgba(128, 128, 128, 0.1);
        border: 1px solid rgba(128, 128, 128, 0.2);
        
        &:hover {
            background: rgba(128, 128, 128, 0.15);
        }
        
        &.presszone-comments-active {
            background: var(--presszone-comments-primary);
            color: white;
            border-color: var(--presszone-comments-primary);
        }
    }
}

// Field descriptions and labels
.presszone-comments-field-description {
    font-size: $presszone-comments-font-size-sm;
    margin-top: $presszone-comments-spacing-xs;
    margin-bottom: $presszone-comments-spacing-md;
    
    @include theme-props(('color': 'text-muted'));
}

.presszone-comments-title-label,
.presszone-comments-editor-label {
    display: block;
    font-weight: 600;
    margin-bottom: $presszone-comments-spacing-xs;
    
    @include theme-props(('color': 'text-primary'));
}

// Required field indicator
.presszone-comments-required-indicator {
    color: var(--presszone-comments-error, #dc2626);
    font-weight: 700;
}

// Confirm modal message
.presszone-comments-confirm-message {
    font-size: $presszone-comments-font-size-base;
    line-height: 1.6;
    margin: 0;
    
    @include theme-props(('color': 'text-primary'));
}

// Skip link for keyboard navigation
.presszone-comments-skip-link {
    position: absolute;
    left: -9999px;
    top: 0;
    background: var(--presszone-comments-primary);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    border-radius: 4px;
    z-index: 10000;
    font-size: 14px;
    font-weight: 600;
    
    &:focus {
        left: 6px;
        top: 6px;
        outline: 3px solid var(--presszone-comments-primary);
        outline-offset: 2px;
    }
}
