/**
 * OptConnect button — the two things `theme.json` cannot express (PR 3.3).
 *
 * `theme.json` owns the button itself: `styles.elements.button` sets the
 * `accent-2` fill, the white label, Nunito 700, the `contrast` hover fill, and a
 * `:focus` / `:focus-visible` double ring. That was PR 3.2's open item — it closed
 * "the theme still has no button of its own" before a fourth family grew its own
 * copy of `.oc-cta__button`.
 *
 * Two notes worth keeping, because both were expected to need CSS and did not:
 *
 *   1. **`:hover`, `:focus` and `:focus-visible` all belong in `theme.json`.**
 *      Core's element-pseudo allowlist covers `:hover`, `:focus`, `:focus-visible`,
 *      `:active`, `:link`, `:any-link` and `:visited` for `button`
 *      (`WP_Theme_JSON::VALID_ELEMENT_PSEUDO_SELECTORS`), and `outline-*` plus
 *      `box-shadow` all emit from there — verified against the generated
 *      stylesheet, not assumed. Keeping them there matters for a second reason:
 *      the parent declares its own `:hover` (an 85%-alpha `color-mix` of
 *      **`contrast`**, hardcoded rather than derived from the button's own fill)
 *      and its own `:focus` (an `accent-4` outline — OC orange, 2.09:1 on the blue
 *      band). `theme.json` deep-merges key by key, so those only go away if the
 *      child names the same keys. A CSS override would not have removed them, it
 *      would have raced them: `:root :where(.wp-element-button):hover` is (0,2,0)
 *      and so is `.wp-element-button:hover`, and a tie is decided by load order.
 *
 *   2. **PR 3.2's `!important` trap does not apply any more.** It only fires when
 *      a `core/button` block sets `backgroundColor` / `textColor` attributes, which
 *      serialise to `has-…-background-color` classes that WordPress emits with
 *      `!important`, beating TT5's zero-specificity `:where()` hover. Buttons whose
 *      colour comes from `theme.json` carry no such class, so a plain class like
 *      `.oc-button--inverse` below wins cleanly. **No pattern should set colour
 *      attributes on a `core/button`** — that is what re-opens the trap.
 *
 * Loaded site-wide (not per pattern family) and registered with
 * `add_editor_style()`, so the editor draws the same button the front end does.
 */

/* --------------------------------------------------------------------------
 * Motion
 * The fill change between the base and `:hover` states comes from `theme.json`;
 * only its timing lives here, because `theme.json` has no `transition` property.
 * ---------------------------------------------------------------------- */
.wp-element-button,
.wp-block-button__link {
	transition: background-color 0.2s ease-in-out;
}

@media (prefers-reduced-motion: reduce) {
	.wp-element-button,
	.wp-block-button__link {
		transition: none;
	}
}

/* --------------------------------------------------------------------------
 * `.oc-button--inverse` — the on-band variant
 *
 * A white fill with `accent-2` text (5.77:1), for a button sitting on one of the
 * blue bands, where the default `accent-2` fill would have no edge against its
 * surroundings. Add it to the `core/button` block's `className`, alongside
 * whatever family class the pattern uses — it is deliberately family-neutral, so
 * the CTA bands (PR 3.2), the title hero (PR 3.3) and anything later share one
 * rule rather than one each.
 *
 * The class lands on the wrapping `div`, so the colours are declared on the `a`
 * inside it.
 *
 * If a brand fill is ever wanted instead, its label has to be `contrast`
 * (#1d2c38), not white: white on OC green (#7cb242) is 2.53:1 and on OC orange
 * (#f47920) 2.76:1, both failing AA outright, while `contrast` gives 5.65:1 and
 * 5.17:1. Measured in PR 3.2.
 * ---------------------------------------------------------------------- */
.oc-button--inverse .wp-block-button__link {
	background-color: var(--wp--preset--color--base, #ffffff);
	color: var(--wp--preset--color--accent-2, #006ba4);
}

.oc-button--inverse .wp-block-button__link:hover,
.oc-button--inverse .wp-block-button__link:focus-visible {
	background-color: var(--wp--preset--color--accent-5, #eff2f8);
	color: var(--wp--preset--color--accent-2, #006ba4);
}
