/*
 * Zonkey base theme - accessibility layer (WCAG 2.2 AA)
 *
 * Plain CSS, loaded after the child theme's compiled theme.css. Child themes
 * compile their own copy of the base SCSS, so fixes made there only reach a
 * site when its child is rebuilt; rules here reach every site with the base
 * update. Everything in this file must work with any council's colours.
 */

/*
 * 1. Keyboard focus on coloured backgrounds.
 * The theme's focus ring is a single brand colour, which can disappear
 * against a coloured region (footer, top bar, breadcrumb bar, mobile menu,
 * banners, alerts, coloured blocks) - and a late duplicate of the button
 * styles overrides the regions' own focus colours for buttons and inputs.
 * A dark ring inside a white one always contrasts on one side or the other,
 * whatever the background. On ordinary page backgrounds the brand ring is
 * left as it is.
 */
:is(
    .z-footers,
    .z-header__top,
    .z-breadcrumbs,
    .z-mobile-nav__container,
    .z-banner,
    .z-card--alert-full-width,
    .has-background,
    .wp-block-cover,
    [style*="background-color"],
    [style*="background-image"]
) :focus-visible {
    outline: 2px solid #fff !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 2px #111 !important;
}

/*
 * 2. Windows High Contrast (forced colours) drops box-shadows, and the theme
 * sets outline: none, so without this focus would be invisible there.
 */
@media (forced-colors: active) {
    :focus-visible {
        outline: 2px solid CanvasText !important;
        outline-offset: 2px !important;
    }
}

/*
 * 3. Placeholder text was the body colour at 50% (2.9-3.5:1, below the 4.5:1
 * minimum). Take each field's own text colour at 75% instead - about 10:1
 * for the black-on-white fields every council uses.
 */
::placeholder {
    color: inherit !important;
    opacity: .75 !important;
}
