/*
 * ks-a11y baseline. Site-specific fixes (contrast, layout) live in
 * profiles/<site>.css, never here.
 */

/* Skip link: hidden until focused (WCAG 2.4.1) */
.ks-a11y-skip {
    position: absolute;
    top: -200px;
    left: 16px;
    z-index: 2147483647;
    padding: 12px 20px;
    background: #111;
    color: #fff !important;
    font: 600 16px/1.2 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    text-decoration: underline;
    border-radius: 0 0 8px 8px;
}
.ks-a11y-skip:focus {
    top: 0;
}
[data-ks-main]:focus {
    outline: none;
}

/* Visible keyboard focus everywhere (WCAG 2.4.7 / 2.4.13). The white inner
   ring keeps it visible on dark and on brand-colored backgrounds alike. */
/* html body :is() outranks site rules like `.faq-q:focus { outline: none !important }` */
html body :is(a, button, input, select, textarea, summary, iframe, video, audio, [tabindex], [role="button"], [role="link"], [role="tab"], [role="menuitem"], [contenteditable="true"]):focus-visible {
    outline: 3px solid var(--ks-a11y-focus, #1a56db) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #fff !important;
}

/* Focused items never hide under a sticky header (WCAG 2.4.11) */
html {
    scroll-padding-top: var(--ks-a11y-header-offset, 0px);
}

/* Screen-reader-only text */
.ks-a11y-sr {
    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;
}

/* Dropdowns opened by keyboard (ks-a11y.js adds the class on focus) */
.ks-a11y-open .ks-a11y-panel {
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
}
/* Escape dismisses a hover/focus dropdown (WCAG 1.4.13) */
.ks-a11y-dismissed .ks-a11y-panel {
    opacity: 0 !important;
    visibility: hidden !important;
    pointer-events: none !important;
}

/* Pause / play control on moving content (WCAG 2.2.2) */
.ks-a11y-pause {
    position: absolute;
    z-index: 20;
    left: 12px;   /* opposite corner from the widget (bottom right by default) */
    bottom: 12px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    min-width: 44px;
    height: 44px;
    padding: 0 12px;
    border: 2px solid #fff;
    border-radius: 999px;
    background: rgba(17, 17, 17, 0.78);
    color: #fff;
    font: 600 14px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
    cursor: pointer;
}
.ks-a11y-pause:hover {
    background: rgba(17, 17, 17, 0.92);
}
.ks-a11y-pause svg {
    width: 14px;
    height: 14px;
    fill: currentColor;
}
.ks-a11y-paused,
.ks-a11y-paused *,
.ks-a11y-paused *::before,
.ks-a11y-paused *::after,
html.a11y-feature-stop-animations .ks-a11y-motion,
html.a11y-feature-stop-animations .ks-a11y-motion *,
html.a11y-feature-stop-animations .ks-a11y-motion *::before,
html.a11y-feature-stop-animations .ks-a11y-motion *::after {
    animation-play-state: paused !important;
}

/* Respect the device's reduced-motion setting (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    html {
        scroll-behavior: auto !important;
    }
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Statement page */
.ks-a11y-statement {
    max-width: 760px;
    margin: 0 auto;
    padding: 2rem 1.25rem 3rem;
    line-height: 1.7;
}
.ks-a11y-statement h2 {
    margin: 2rem 0 0.75rem;
}
.ks-a11y-statement ul {
    padding-left: 1.25rem;
}
.ks-a11y-statement li {
    margin-bottom: 0.5rem;
}

html.ks-a11y-widget-left .ks-a11y-pause:not(.ks-a11y-pause--inline) {
    left: auto;
    right: 12px;
}

/* Small pause control placed beside cycling text */
.ks-a11y-pause--inline {
    position: static;
    min-width: 24px;
    width: 24px;
    height: 24px;
    padding: 0;
    margin-left: 6px;
    border-width: 1px;
    vertical-align: middle;
}
.ks-a11y-pause--inline svg {
    width: 10px;
    height: 10px;
}

/* Links inside running text are underlined, so they are not told apart by
   color alone (WCAG 1.4.1). Buttons styled as links are left alone. */
html.ks-a11y-colors p a:not([class*="btn"]):not([class*="button"]):not(:has(img)) {
    text-decoration: underline !important;
    text-underline-offset: 0.15em;
}

/* Shared KS "request API access" form (ks-api-waitlist mu-plugin, all trading
   sites): white on orange #d28f33 was 2.7:1 */
html.ks-a11y-colors .ksapi button[type="submit"] {
    background-color: #8a5414 !important;
    color: #fff !important;
}

/* Placeholder text is still text (1.4.3): a grey that reads at 4.8:1 on white */
html.ks-a11y-colors ::placeholder {
    color: #6b7280 !important;
    opacity: 1 !important;
}
