/*
 * Shared frontend action affordance, loaded after theme/module foundations.
 * Only the outline changes: existing fills, text, semantic borders, dimensions,
 * shadows and transitions remain owned by their modules. No layout movement.
 *
 * Native actions and explicit button classes are safe across modules. The
 * remaining selectors name known pill controls; ordinary navigation/text links,
 * card links, noninteractive badges and native WordPress admin are not targets.
 * Future custom actionable links may opt in with data-challenger-action.
 */

@media (hover: hover) and (pointer: fine) {
    body:is(.challenger-theme-dark, .challenger-theme-light, .challenger-theme-auto):not(.wp-admin) :is(
        button, input[type="button"], input[type="submit"], input[type="reset"],
        [role="button"], details > summary,
        a[href]:is(.button, .btn, .challenger-button, .chc-button, .chs-btn, .chs-small-button,
            .wp-element-button, .wp-block-button__link, .wc-block-components-button, .added_to_cart,
            .challenger-header-account, .challenger-header-cart, .challenger-account-back,
            .chs-preferences-back, .chs-allocation-view-pill,
            .clm-pay-button, .clm-register-button, .clm-edit-decks-button, .clm-tab, .clm-game-button,
            .cps-game-button, .cps-hof-game-button,
            .cet-primary, .cet-secondary, .cet-danger, .cet-game-filter, .cet-provider-link, .cet-player-jump-link),
        .chc-game-tabs > a[href], .chc-scope-tabs > a[href], .chc-pagination a[href], .chc-artwork-tabs > a[href],
        label.chc-card-select:has(input[type="checkbox"]:not(:disabled, [disabled], [aria-disabled="true" i])),
        .chs-front-tabs > a[href], .chs-stats-subtabs > a[href], .cet-admin-view-nav > a[href],
        .woocommerce-tabs .tabs > li > a[href],
        a[href][data-challenger-action]
    ):not(:where(#wpadminbar, #wpadminbar *), :disabled, [disabled], [aria-disabled="true" i], .disabled, .is-disabled,
        [inert], [inert] *, [aria-disabled="true" i] *,
        .woocommerce-loop-product__link, .woocommerce-loop-product__image-link,
        .chc-hub-card, .challenger-profile-card, .chs-account-preferences-card):hover {
        outline: 2px solid var(--challenger-action-ring-color, var(--challenger-accent, #d92d2d)) !important;
        outline-offset: 2px !important;
    }
}

/* Keyboard focus is not limited to devices with a mouse (e.g. tablet keyboard). */
body:is(.challenger-theme-dark, .challenger-theme-light, .challenger-theme-auto):not(.wp-admin) :is(
    button, input[type="button"], input[type="submit"], input[type="reset"],
    [role="button"], details > summary,
    a[href]:is(.button, .btn, .challenger-button, .chc-button, .chs-btn, .chs-small-button,
        .wp-element-button, .wp-block-button__link, .wc-block-components-button, .added_to_cart,
        .challenger-header-account, .challenger-header-cart, .challenger-account-back,
        .chs-preferences-back, .chs-allocation-view-pill,
        .clm-pay-button, .clm-register-button, .clm-edit-decks-button, .clm-tab, .clm-game-button,
        .cps-game-button, .cps-hof-game-button,
        .cet-primary, .cet-secondary, .cet-danger, .cet-game-filter, .cet-provider-link, .cet-player-jump-link),
    .chc-game-tabs > a[href], .chc-scope-tabs > a[href], .chc-pagination a[href], .chc-artwork-tabs > a[href],
    label.chc-card-select:has(input[type="checkbox"]:not(:disabled, [disabled], [aria-disabled="true" i])),
    .chs-front-tabs > a[href], .chs-stats-subtabs > a[href], .cet-admin-view-nav > a[href],
    .woocommerce-tabs .tabs > li > a[href],
    a[href][data-challenger-action]
):not(:where(#wpadminbar, #wpadminbar *), :disabled, [disabled], [aria-disabled="true" i], .disabled, .is-disabled,
    [inert], [inert] *, [aria-disabled="true" i] *,
    .woocommerce-loop-product__link, .woocommerce-loop-product__image-link,
    .chc-hub-card, .challenger-profile-card, .chs-account-preferences-card):focus-visible {
    outline: 2px solid var(--challenger-action-ring-color, var(--challenger-accent, #d92d2d)) !important;
    outline-offset: 2px !important;
}

/* League game hover: keep the inactive pill surface instead of adopting the
   selected white/contrast fill. The existing active state remains unchanged. */
@media (hover: hover) and (pointer: fine) {
    body:is(.challenger-theme-dark, .challenger-theme-light, .challenger-theme-auto):not(.wp-admin) .clm-game-switcher > a.clm-game-button[href]:not(.is-active, [aria-disabled="true" i], .disabled, .is-disabled, [inert]):not([inert] *, [aria-disabled="true" i] *):hover {
        background: var(--challenger-surface-alt, #181818) !important;
        color: var(--challenger-on-surface-alt, var(--challenger-text, #fff)) !important;
        -webkit-text-fill-color: var(--challenger-on-surface-alt, var(--challenger-text, #fff)) !important;
        border-color: var(--challenger-accent, var(--challenger-border, #444)) !important;
    }
}

/* Preserve system contrast rather than forcing a custom accent in high contrast. */
@media (forced-colors: active) {
    body:is(.challenger-theme-dark, .challenger-theme-light, .challenger-theme-auto):not(.wp-admin) {
        --challenger-action-ring-color: Highlight;
    }
}
