/* =============================================================================
 * 05 — accessibility.css for Roka Akor
 *
 * Drop into the child theme at /assets/accessibility.css
 * Enqueued by 04-functions-snippet.php
 *
 * Provides:
 *   - Skip-link styling (WCAG 2.4.1)
 *   - Visible focus indicators on every interactive element (WCAG 2.4.7)
 *   - .visually-hidden utility (screen-reader-only content)
 *   - Reduced-motion respect (WCAG 2.3.3, prefers-reduced-motion)
 *   - Form label and error styling
 *   - Touch target minimum 44x44 (WCAG 2.5.5 AAA, 2.5.8 AA in 2.2)
 *   - Print compliance (focus indicators visible when printing)
 * ============================================================================= */

/* -----------------------------------------------------------------------------
 * SKIP LINK
 * Hidden until focused, then prominently displayed at top-left.
 * -------------------------------------------------------------------------- */
.skip-link {
    position: absolute !important;
    top: -100px;
    left: 16px;
    z-index: 100000;
    background: #000;
    color: #fff;
    padding: 12px 24px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    text-decoration: none;
    border: 2px solid #fff;
    border-radius: 4px;
    transition: top 0.15s ease-in;
}
.skip-link:focus {
    top: 16px;
    outline: 3px solid #C2A45C;
    outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
 * VISUALLY HIDDEN UTILITY
 * Hides content visually but keeps it available to screen readers.
 * -------------------------------------------------------------------------- */
.visually-hidden,
.screen-reader-text {
    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;
}
.visually-hidden:focus,
.screen-reader-text:focus {
    position: static !important;
    width: auto !important;
    height: auto !important;
    margin: 0 !important;
    overflow: visible !important;
    clip: auto !important;
    white-space: normal !important;
}

/* -----------------------------------------------------------------------------
 * UNIVERSAL FOCUS INDICATORS
 * Replaces the often-stripped browser defaults with high-contrast outlines
 * that meet WCAG 2.4.7 (Focus Visible) and 2.4.11 (Focus Not Obscured) at
 * minimum 3:1 contrast.
 * -------------------------------------------------------------------------- */

/* Remove default focus ring only when keyboard focus is replaced with our own */
*:focus {
    outline: 2px solid #C2A45C;
    outline-offset: 2px;
}

/* Higher-quality outline for browsers that support :focus-visible */
*:focus-visible {
    outline: 3px solid #C2A45C;
    outline-offset: 3px;
    border-radius: 2px;
}

/* Suppress focus ring when focus came from a click (not keyboard) */
*:focus:not(:focus-visible) {
    outline: none;
}

/* Buttons / links with their own background — make focus extra visible */
a:focus-visible,
button:focus-visible,
[role="button"]:focus-visible {
    outline: 3px solid #C2A45C;
    outline-offset: 3px;
    box-shadow: 0 0 0 6px rgba(194, 164, 92, 0.25);
}

/* Form fields focus state */
input:focus,
input:focus-visible,
select:focus,
select:focus-visible,
textarea:focus,
textarea:focus-visible {
    outline: 3px solid #C2A45C;
    outline-offset: 1px;
    border-color: #8E7236 !important;
}

/* Skip link target — ensure main content takes focus when skipped to */
#main-content:focus {
    outline: none;
}

/* -----------------------------------------------------------------------------
 * MINIMUM TOUCH TARGETS
 * WCAG 2.5.5 (AAA) — 44x44 CSS pixels minimum.
 * WCAG 2.5.8 (AA in 2.2) — 24x24 minimum.
 * Apply 44x44 across the board for safety + better mobile UX.
 * -------------------------------------------------------------------------- */
button,
[role="button"],
.tel-link,
.sms-link,
input[type="submit"],
input[type="button"],
input[type="reset"],
.menu-item__toggle,
.menu-item__link {
    min-height: 44px;
    min-width: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Allow inline links in body content to remain compact */
.entry-content a,
p a,
li a {
    min-height: 0;
    min-width: 0;
    display: inline;
}

/* -----------------------------------------------------------------------------
 * NAVIGATION DISCLOSURE PATTERN
 * Styles the new <button> + <ul hidden> pattern from the nav walker.
 * Animation handled by 06-accessibility.js.
 * -------------------------------------------------------------------------- */
.menu-item__toggle {
    background: none;
    border: 0;
    color: inherit;
    font: inherit;
    cursor: pointer;
    padding: 12px 16px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    min-height: 44px;
}
.menu-item__toggle:hover,
.menu-item__toggle[aria-expanded="true"] {
    text-decoration: underline;
    text-underline-offset: 4px;
}
.menu-item__caret {
    display: inline-block;
    transition: transform 0.2s ease;
    font-size: 12px;
}
.menu-item__toggle[aria-expanded="true"] .menu-item__caret {
    transform: rotate(180deg);
}
.sub-menu[hidden] {
    display: none !important;
}
.sub-menu {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}
.sub-menu li a {
    display: block;
    padding: 10px 16px;
    text-decoration: none;
    min-height: 44px;
    line-height: 1.4;
}
.sub-menu li a:hover,
.sub-menu li a:focus {
    background: rgba(194, 164, 92, 0.15);
}

/* -----------------------------------------------------------------------------
 * MOBILE NAV TOGGLE
 * -------------------------------------------------------------------------- */
.site-nav__toggle {
    background: none;
    border: 0;
    padding: 12px;
    cursor: pointer;
    color: inherit;
    min-height: 44px;
    min-width: 44px;
}
.site-nav__toggle-icon {
    display: inline-block;
    width: 24px;
    height: 18px;
    position: relative;
}
.site-nav__toggle-icon span {
    position: absolute;
    left: 0;
    width: 100%;
    height: 2px;
    background: currentColor;
    transition: transform 0.2s ease, opacity 0.2s ease;
}
.site-nav__toggle-icon span:nth-child(1) { top: 0; }
.site-nav__toggle-icon span:nth-child(2) { top: 8px; }
.site-nav__toggle-icon span:nth-child(3) { top: 16px; }
.site-nav__toggle[aria-expanded="true"] .site-nav__toggle-icon span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}
.site-nav__toggle[aria-expanded="true"] .site-nav__toggle-icon span:nth-child(2) {
    opacity: 0;
}
.site-nav__toggle[aria-expanded="true"] .site-nav__toggle-icon span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* -----------------------------------------------------------------------------
 * HERO VIDEO PAUSE BUTTON
 * Always visible, high contrast against any video background.
 * -------------------------------------------------------------------------- */
.hero-pause-btn {
    position: absolute;
    bottom: 24px;
    right: 24px;
    z-index: 10;
    background: rgba(0, 0, 0, 0.75);
    color: #fff;
    border: 2px solid #fff;
    border-radius: 50%;
    width: 48px;
    height: 48px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 16px;
    backdrop-filter: blur(4px);
    transition: background 0.2s ease;
}
.hero-pause-btn:hover {
    background: rgba(0, 0, 0, 0.9);
}
.hero-pause-btn:focus-visible {
    outline: 3px solid #C2A45C;
    outline-offset: 3px;
}

/* -----------------------------------------------------------------------------
 * FORM STYLING
 * -------------------------------------------------------------------------- */
.gform_wrapper label,
.form-label {
    display: block;
    font-weight: 600;
    margin-bottom: 6px;
    color: #1A1A1A;
}
.gform_wrapper .gfield_required {
    color: #B33A3A;
    font-weight: 700;
    margin-left: 4px;
}
.gform_wrapper input,
.gform_wrapper select,
.gform_wrapper textarea,
.form-input {
    width: 100%;
    min-height: 44px;
    padding: 10px 12px;
    border: 2px solid #6B6B6B;  /* 4.5:1 contrast on white */
    border-radius: 4px;
    font-size: 16px;            /* prevents iOS zoom on focus */
    background: #fff;
    color: #1A1A1A;
}
.gform_wrapper input:focus,
.gform_wrapper select:focus,
.gform_wrapper textarea:focus {
    border-color: #8E7236;
    outline: 3px solid #C2A45C;
    outline-offset: 1px;
}

/* Error states — color + icon + text (NOT color alone, WCAG 1.4.1) */
.gform_wrapper .gfield_error input,
.gform_wrapper .gfield_error select,
.gform_wrapper .gfield_error textarea,
.form-input.has-error {
    border-color: #B33A3A;
    border-width: 3px;
    background: #FDF6F6;
}
.gform_wrapper .validation_message,
.gform_wrapper .gfield_validation_message,
.form-error-text {
    color: #7E2222;             /* darker red — 7:1 on white */
    font-weight: 600;
    margin-top: 6px;
    padding: 8px 12px;
    background: #FDF6F6;
    border-left: 4px solid #B33A3A;
    display: flex;
    align-items: center;
    gap: 8px;
}
.gform_wrapper .validation_message::before,
.form-error-text::before {
    content: "⚠";
    font-size: 18px;
    flex-shrink: 0;
}
.gform_wrapper .validation_error[role="alert"],
.gform_confirmation_message[role="status"] {
    padding: 16px 20px;
    border-radius: 4px;
    margin: 16px 0;
    font-weight: 600;
}
.gform_wrapper .validation_error[role="alert"] {
    background: #FDF6F6;
    border: 2px solid #B33A3A;
    color: #7E2222;
}
.gform_confirmation_message[role="status"] {
    background: #F4F9F8;
    border: 2px solid #2E7D6F;
    color: #1F5A4F;
}

/* -----------------------------------------------------------------------------
 * SUBMIT BUTTONS — high contrast, accessible
 * -------------------------------------------------------------------------- */
.gform_wrapper button[type="submit"],
.gform_wrapper input[type="submit"],
.btn-primary {
    background: #1A1A1A;
    color: #fff;
    border: 2px solid #1A1A1A;
    padding: 14px 32px;
    font-size: 16px;
    font-weight: 600;
    border-radius: 4px;
    cursor: pointer;
    min-height: 48px;
    transition: background 0.15s ease;
}
.gform_wrapper button[type="submit"]:hover,
.gform_wrapper input[type="submit"]:hover,
.btn-primary:hover {
    background: #C2A45C;
    color: #1A1A1A;
}
.gform_wrapper button[type="submit"]:focus-visible,
.gform_wrapper input[type="submit"]:focus-visible,
.btn-primary:focus-visible {
    outline: 3px solid #C2A45C;
    outline-offset: 3px;
}

/* -----------------------------------------------------------------------------
 * FOOTER SOCIAL ICONS
 * Replaces the broken icon-font with proper SVG styling.
 * -------------------------------------------------------------------------- */
.site-footer__social .social-group {
    margin-bottom: 16px;
}
.site-footer__social .social-group__title {
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 8px;
}
.site-footer__social .social-group__list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-wrap: wrap;
    gap: 4px 12px;
}
.site-footer__social .social-group__list a {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 4px;
    color: inherit;
    text-decoration: none;
    min-height: 44px;
}
.site-footer__social .social-group__list a:hover .social-link__label,
.site-footer__social .social-group__list a:focus .social-link__label {
    text-decoration: underline;
    text-underline-offset: 3px;
}
.social-icon {
    flex-shrink: 0;
}

/* -----------------------------------------------------------------------------
 * BACK TO TOP BUTTON
 * -------------------------------------------------------------------------- */
.site-footer__back-top {
    position: fixed;
    bottom: 24px;
    right: 24px;
    z-index: 50;
    background: #1A1A1A;
    color: #fff;
    border: 2px solid #C2A45C;
    border-radius: 28px;
    padding: 12px 18px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    font-weight: 600;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
    min-height: 44px;
    transition: background 0.15s ease;
}
.site-footer__back-top[hidden] {
    display: none;
}
.site-footer__back-top:hover {
    background: #C2A45C;
    color: #1A1A1A;
}
.site-footer__back-top:focus-visible {
    outline: 3px solid #fff;
    outline-offset: 2px;
}

/* -----------------------------------------------------------------------------
 * REDUCED MOTION RESPECT
 * WCAG 2.3.3 (Animation from Interactions) AAA, but applied here as
 * defensive AA practice. Honors user system 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;
    }

    /* Pause autoplay video — JS also handles this */
    video[autoplay] {
        animation-play-state: paused !important;
    }
}

/* -----------------------------------------------------------------------------
 * PRINT STYLES — ensure focus indicators print
 * -------------------------------------------------------------------------- */
@media print {
    .skip-link,
    .site-footer__back-top,
    .hero-pause-btn,
    .site-nav__toggle {
        display: none !important;
    }
    *:focus {
        outline: 1px solid #000 !important;
    }
}

/* -----------------------------------------------------------------------------
 * LIVECHAT WIDGET ENHANCEMENT
 * Until LiveChat is replaced or upgraded, this provides a fallback
 * accessible label for the launcher iframe wrapper.
 * -------------------------------------------------------------------------- */
.lc-widget__container,
#chat-widget-container {
    /* Ensure focus visible if LiveChat strips it */
}
.lc-widget__container:focus-within,
#chat-widget-container:focus-within {
    outline: 3px solid #C2A45C;
    outline-offset: 4px;
}

/* -----------------------------------------------------------------------------
 * "Disabled link" fallback for the_content filter from snippet 04
 * -------------------------------------------------------------------------- */
.a11y-disabled-link {
    color: inherit;
    text-decoration: none;
    cursor: default;
}

/* -----------------------------------------------------------------------------
 * HIGH CONTRAST MODE / FORCED COLORS
 * Windows High Contrast Mode and similar — preserve focus indicators.
 * -------------------------------------------------------------------------- */
@media (forced-colors: active) {
    *:focus,
    *:focus-visible {
        outline: 3px solid CanvasText !important;
        outline-offset: 3px;
    }
    .skip-link {
        border: 2px solid CanvasText;
    }
}
