/**
 * Accessibility Styles for 20-child Theme
 * WCAG 2.1 AA Compliance Improvements
 */

/* =====================================================
   SKIP LINKS
   ===================================================== */

/**
 * Skip to main content link
 * Visually hidden but accessible via keyboard
 */
.skip-link {
    position: absolute;
    top: -100px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 99999;
    padding: 12px 24px;
    background-color: #015884;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
    font-size: 16px;
    border-radius: 0 0 4px 4px;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    transition: top 0.2s ease-in-out;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid #EB676A;
    outline-offset: 2px;
}

/* =====================================================
   SCREEN READER ONLY (Visually Hidden)
   ===================================================== */

/**
 * Hide content visually but keep it accessible to screen readers
 * Use for providing context to links like "Read more"
 */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.sr-only-focusable:focus,
.sr-only-focusable:active {
    position: static;
    width: auto;
    height: auto;
    overflow: visible;
    clip: auto;
    white-space: normal;
}

/* =====================================================
   FOCUS STATES
   ===================================================== */

/**
 * Visible focus indicator for all interactive elements
 * Uses :focus-visible for modern browsers with :focus fallback
 */

/* Fallback for browsers that don't support :focus-visible */
a:focus,
button:focus,
input:focus,
select:focus,
textarea:focus,
[tabindex]:focus {
    outline: 2px solid #015884;
    outline-offset: 2px;
}

/* Modern browsers: only show focus on keyboard navigation */
a:focus:not(:focus-visible),
button:focus:not(:focus-visible),
input:focus:not(:focus-visible),
select:focus:not(:focus-visible),
textarea:focus:not(:focus-visible),
[tabindex]:focus:not(:focus-visible) {
    outline: none;
}

a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
textarea:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #015884;
    outline-offset: 2px;
}

/* High contrast focus for buttons */
.btn:focus-visible,
.book-now a:focus-visible,
.contact-btn a:focus-visible,
.wpcf7-submit:focus-visible {
    outline: 3px solid #EB676A;
    outline-offset: 3px;
    box-shadow: 0 0 0 5px rgba(235, 103, 106, 0.3);
}

/* Navigation link focus */
.navbar-nav a:focus-visible,
.primary-menu a:focus-visible {
    outline: 2px solid #015884;
    outline-offset: 2px;
    background-color: rgba(1, 88, 132, 0.1);
}

/* Footer link focus */
footer a:focus-visible {
    outline: 2px solid #ffffff;
    outline-offset: 2px;
}

/* =====================================================
   IMPROVED INTERACTIVE ELEMENT STYLES
   ===================================================== */

/**
 * Ensure minimum touch target size (44x44px for WCAG 2.5.5)
 */
.back-iocn span {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 44px;
    min-height: 44px;
}

/**
 * Better button and link states
 */
a,
button {
    cursor: pointer;
}

/* Ensure disabled states are visually distinct */
button:disabled,
input:disabled,
select:disabled,
textarea:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* =====================================================
   REDUCED MOTION SUPPORT
   ===================================================== */

/**
 * Respect user preference for reduced motion
 * WCAG 2.3.3 Animation from Interactions
 */
@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;
    }

    .skip-link {
        transition: none;
    }
}

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

/**
 * Support for Windows High Contrast Mode
 */
@media (prefers-contrast: high) {
    .skip-link:focus {
        outline: 3px solid CanvasText;
        background-color: Canvas;
        color: CanvasText;
    }

    a:focus-visible,
    button:focus-visible {
        outline: 3px solid CanvasText;
    }
}

/* Forced colors mode (Windows High Contrast) */
@media (forced-colors: active) {
    .skip-link {
        border: 2px solid transparent;
    }

    .skip-link:focus {
        border-color: CanvasText;
    }

    a:focus-visible,
    button:focus-visible,
    input:focus-visible,
    select:focus-visible,
    textarea:focus-visible {
        outline: 3px solid CanvasText;
    }
}

/* =====================================================
   ADDITIONAL ACCESSIBILITY IMPROVEMENTS
   ===================================================== */

/**
 * Improve text selection contrast
 */
::selection {
    background-color: #015884;
    color: #ffffff;
}

/**
 * Ensure form labels are visually associated
 */
label {
    cursor: pointer;
}

/**
 * Improve visibility of required field indicators
 */
.required,
.wpcf7-form .required {
    color: #EB676A;
    font-weight: bold;
}

/**
 * Ensure error messages are accessible
 */
.wpcf7-not-valid-tip,
.error,
.wpcf7-response-output.wpcf7-validation-errors {
    color: #dc3232;
    font-weight: 600;
}

/* Success messages */
.wpcf7-response-output.wpcf7-mail-sent-ok {
    color: #46b450;
    font-weight: 600;
}

/* =====================================================
   COLOR CONTRAST FIXES (WCAG AA Compliance)
   ===================================================== */

/**
 * Fix btn-danger contrast issues
 * Original #EB676A with white = 3.44:1 (FAILS AA)
 * New #C7404C with white = 4.54:1 (PASSES AA for normal text)
 * New #B03236 with white = 5.41:1 (PASSES AA for all text)
 */

/* Primary button danger/accent color fixes */
.btn.btn-danger,
.btn-danger {
    background-color: #C7404C !important;
    border-color: #B03236 !important;
    color: #fff !important;
}

.btn.btn-danger:hover,
.btn.btn-danger:focus,
.btn-danger:hover,
.btn-danger:focus {
    background-color: #B03236 !important;
    border-color: #9A2B2F !important;
}

/**
 * Fix #EB676A backgrounds used throughout theme
 * These are book-now buttons, CTA buttons, etc.
 */
.book-now a,
.book-doc-btn a,
.qualification .book-now a,
.book-now .latepoint-book-button,
.btn-book,
input[type="submit"].wpcf7-submit {
    background-color: #C7404C !important;
    color: #fff !important;
}

.book-now a:hover,
.book-now a:focus,
.book-doc-btn a:hover,
.book-doc-btn a:focus,
.qualification .book-now a:hover,
.qualification .book-now a:focus,
input[type="submit"].wpcf7-submit:hover,
input[type="submit"].wpcf7-submit:focus {
    background-color: #B03236 !important;
}

/**
 * Fix coral/salmon text on light backgrounds
 * #EB676A on white = 3.44:1 (FAILS)
 * #C7404C on white = 4.54:1 (PASSES for large text)
 * #A63438 on white = 5.92:1 (PASSES for all text)
 */
.read-more-link,
.readmore,
.readmore_contact,
a.view-btn,
.readmore_me {
    color: #A63438 !important;
}

.read-more-link:hover,
.read-more-link:focus,
.readmore:hover,
.view-btn:hover,
.view-btn:focus {
    color: #8A2C2F !important;
}

/**
 * Navigation and Breadcrumb Contrast Fixes
 * Fixes #EB676A text which fails AA (3.44:1)
 * Using #C7404C (4.54:1) or #B03236 (5.4:1)
 */
.current-menu-item>a,
.navbar-nav .current-menu-item>a,
.current-menu-parent>a,
.current_page_item>a,
.active>a,
.breadcrumbs li[aria-current="page"],
.breadcrumb li[aria-current="page"],
.yoast-breadcrumb span.breadcrumb_last {
    color: #C7404C !important;
}

/**
 * Load More / See All News Buttons
 * Fixes #EB676A background
 */
a.load-btn,
.all-detail a {
    background-color: #C7404C !important;
    color: #fff !important;
}

a.load-btn:hover,
a.load-btn:focus,
.all-detail a:hover,
.all-detail a:focus {
    background-color: #B03236 !important;
}

/**
 * Footer Copyright Contrast
 * Ensuring text is dark enough if on light background
 * WCAG AA requires 4.5:1
 * Original rgba(33, 33, 32, 0.6) = 4.3:1 FAILS
 * Using solid #333333 = 12.6:1 PASSES
 */
.foot-bottom,
.foot-bottom .container,
.foot-bottom p,
.small-text,
footer .copyright,
footer p,
.widget-content p {
    color: #333333 !important;
}

/**
 * Homepage Specific Contrast Fixes
 */
/* View All FAQ Button */
a.view-btn {
    background-color: #C7404C !important;
    color: #ffffff !important;
    padding: 10px 20px;
    display: inline-block;
}

a.view-btn:hover,
a.view-btn:focus {
    background-color: #B03236 !important;
    color: #ffffff !important;
}

/* Request Now / Popup Buttons */
.paoc-popup-btn,
.btn-sec.custom a,
.booknow .paoc-popup-btn {
    background-color: #C7404C !important;
    color: #ffffff !important;
}

.paoc-popup-btn:hover,
.paoc-popup-btn:focus {
    background-color: #B03236 !important;
}

/* Headings and Text Contrast */
h5,
.container>h5 {
    color: #333333 !important;
}

#ouradvantage .container>ul>li figcaption>p,
#ouradvantage p {
    color: #333333 !important;
}

/* Accordion Links */
.panel-title a {
    color: #333333 !important;
}

.panel-title a:hover,
.panel-title a:focus {
    color: #C7404C !important;
}

/**
 * Doctors Page Filter Contrast Fixes
 * Active label has coral background - need high contrast text
 */
.wrapper label.active {
    background-color: #C7404C !important;
}

.wrapper label.active a.galleryinner,
.wrapper label.active .galleryinner {
    color: #ffffff !important;
}

.wrapper label a.galleryinner,
.wrapper label .galleryinner {
    color: #333333 !important;
}

.wrapper label:hover a.galleryinner,
.wrapper label:focus-within a.galleryinner {
    color: #C7404C !important;
}

/* =====================================================
   MANITOBA BLUE CROSS SPECIFIC OVERRIDES
   ===================================================== */

/**
 * Manitoba Blue Cross uses a blue theme (#006D9A) instead of red
 * These overrides must come after the general button fixes above
 * to ensure the blue theme is applied correctly
 */

/* Manitoba header book-now button */
header.manitoba nav ul.nav.navbar-nav .book-now a,
header.manitoba .book-now a {
    background-color: #006D9A !important;
    color: #FFFFFF !important;
}

header.manitoba nav ul.nav.navbar-nav .book-now a:hover,
header.manitoba nav ul.nav.navbar-nav .book-now a:focus,
header.manitoba .book-now a:hover,
header.manitoba .book-now a:focus {
    background-color: #005880 !important;
    color: #FFFFFF !important;
}

/* Manitoba banner book-now button */
.manitoba-banner .book-now,
.manitoba-banner .banner-manitoba-content .book-now {
    background-color: #006D9A !important;
    color: #FFFFFF !important;
}

.manitoba-banner .book-now:hover,
.manitoba-banner .book-now:focus,
.manitoba-banner .banner-manitoba-content .book-now:hover,
.manitoba-banner .banner-manitoba-content .book-now:focus {
    background-color: #005880 !important;
    color: #FFFFFF !important;
}

/* Manitoba popup buttons */
.manitoba-banner .paoc-popup-btn,
body.page-template-template-manitoba-mbc .paoc-popup-btn,
body.page-template-template-Manitoba-Blue .paoc-popup-btn,
body.page-template-template-Manitoba-Blue-2 .paoc-popup-btn {
    background-color: #006D9A !important;
    color: #FFFFFF !important;
}

/* Manitoba submit buttons */
body.page-template-template-manitoba-mbc .sign-up-pre button.submit,
body.page-template-template-Manitoba-Blue .sign-up-pre button.submit,
body.page-template-template-Manitoba-Blue-2 .sign-up-pre button.submit {
    background-color: #006D9A !important;
    color: #FFFFFF !important;
}

/* =====================================================
   LINK DISTINGUISHABILITY FIXES (WCAG 1.4.1)
   ===================================================== */

/**
 * Ensure links are distinguishable not just by color
 * Add underlines to inline text links
 */

/* Light blue section links must have underlines */
.light-blue-sec ul li a,
.light-blue-sec a,
.you-will-enjoy a,
.you-will-enjoy ul li a {
    text-decoration: underline !important;
    color: #006D9A !important;
}

.light-blue-sec ul li a:hover,
.light-blue-sec a:hover,
.you-will-enjoy a:hover,
.you-will-enjoy ul li a:hover {
    text-decoration: underline !important;
    color: #005880 !important;
}

/* General inline links in content areas */
.program-benifit-sec a,
.sign-up-pre .form-inner-new a:not(.book-now):not(.btn):not(button) {
    text-decoration: underline !important;
    color: #006D9A !important;
}
