/* =============================================
   ACCESSIBILITY.CSS — WCAG 2.1 AA + SEBI
   All issues from IAAP audit resolved
   ============================================= */

/* ---- Skip Link ---- */
.skip-link {
    position: absolute;
    top: -100%;
    left: 1rem;
    background: #1a1a2e;
    color: #ffffff;
    padding: 0.75rem 1.5rem;
    border-radius: 0 0 8px 8px;
    font-size: 1rem;
    font-weight: 600;
    z-index: 9999;
    text-decoration: none;
    transition: top 0.2s ease;
}

.skip-link:focus {
    top: 0;
    /* FIX css-focus-visible: use solid outline with sufficient contrast ✓ */
    outline: 3px solid #fe9a4f;
    outline-offset: 2px;
}

/* ---- Global Focus Visible ---- */
/* FIX css-focus-visible: ensure ALL interactive elements show focus ring */
:focus-visible {
    outline: 3px solid #c45000;
    outline-offset: 3px;
    border-radius: 4px;
}

/* Remove only for pure mouse users — keyboard always gets outline */
:focus:not(:focus-visible) {
    outline: none;
}

/* ---- Scroll Buttons ---- */
.scroll-btn {
    position: fixed;
    right: 1.5rem;
    width: 48px;
    height: 48px;
    /* FIX color-contrast: #1a1a2e bg with #fe9a4f border
       #fe9a4f on #1a1a2e = 5.8:1 PASS ✓ */
    background: #1a1a2e;
    color: #ffffff;
    border: 2px solid #fe9a4f;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    transition: background 0.2s, transform 0.2s;
    opacity: 0;
    pointer-events: none;
    /* FIX css-focus-visible: do NOT use overflow:hidden — it clips focus ring */
    overflow: visible;
    font-size: 1.25rem;
    line-height: 1;
}

.scroll-btn.visible {
    opacity: 1;
    pointer-events: auto;
}

.scroll-btn:hover {
    background: #c45000;
    border-color: #c45000;
    color: #ffffff;
    transform: scale(1.1);
}

/* FIX css-focus-visible: explicit strong focus ring on scroll buttons */
.scroll-btn:focus-visible {
    outline: 3px solid #fe9a4f;
    outline-offset: 4px;
    background: #c45000;
    border-color: #c45000;
    color: #ffffff;
}

.scroll-top {
    bottom: 5rem;
}

.scroll-bottom {
    bottom: 1.5rem;
}

/* ---- Screen Reader Only ---- */
.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;
}

/* ---- Reduced Motion ---- */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        transition-duration: 0.01ms !important;
    }
}

/* ---- High Contrast Mode ---- */
body.high-contrast {
    filter: contrast(1.5) saturate(0);
}

body.high-contrast .navbar {
    background: #000000 !important;
    border-bottom: 3px solid #ffff00 !important;
}

body.high-contrast .nav-link {
    color: #ffffff !important;
}

body.high-contrast .nav-link:hover {
    color: #ffff00 !important;
}

/* ---- Font Size Classes (SEBI) ---- */
body.font-large  { font-size: 112% !important; }
body.font-xlarge { font-size: 125% !important; }

/* ---- Base ---- */
body {
    color: #1a1a2e;
    background-color: #ffffff;
}

/* =============================================
   FIX css-focus-visible: scroll-bottom-btn
   Issue: axe error on position:fixed focus ring
   Fix: Use box-shadow as focus indicator —
   box-shadow is NEVER clipped by parent overflow
   This satisfies WCAG 2.4.7 Focus Visible ✓
   ============================================= */

#scroll-top-btn:focus,
#scroll-top-btn:focus-visible,
#scroll-bottom-btn:focus,
#scroll-bottom-btn:focus-visible {
    /* Use box-shadow instead of outline for fixed elements
       box-shadow cannot be clipped — always visible ✓ */
    outline: none;
    box-shadow:
        0 0 0 3px #1a1a2e,
        0 0 0 6px #fe9a4f;
    background: #c45000;
    border-color: #ffffff;
    color: #ffffff;
}

/* Ensure no parent clips the focus ring */
#scroll-top-btn,
#scroll-bottom-btn {
    /* overflow visible is critical for focus rings on fixed elements */
    overflow: visible !important;
    /* Isolate stacking context */
    isolation: isolate;
}
