/* ──────────────────────────────────────────────────────────────────────────
   United Way button elements (core/button block styles)

   These are the core Button block's UW styles — the inline, in-content surface.
   The richer pill component (with the sliding arrow and rolling label) is
   .uw-pill-btn in custom-styles.css, rendered by unitedway_cb_cta() and by the
   unitedway/button block.

   Both surfaces read the SAME tokens, so colour and geometry are defined once:
     --uw-btn-accent      the brand colour (fills a primary; tints a secondary's arrow)
     --uw-btn-on-accent   what sits on top of the accent
     --uw-btn-hover       the accent's hover shade

   A core Button cannot carry the arrow markup, so the circle is drawn with two
   pseudo-elements: ::after is the disc, ::before is the arrow glyph (a mask, so
   it takes its colour from a token rather than a baked-in data-URI stroke).

   From the Figma element library (1830-10425 / 10426 / 10434):
     • UW Primary   — filled pill, inverted arrow circle
     • UW Secondary — outline pill, accent arrow circle
     • UW Tertiary  — sweep-underlined text link, no pill
   ────────────────────────────────────────────────────────────────────────── */

/* Shared pill shape + token defaults for primary + secondary. */
.wp-block-button.is-style-uw-primary .wp-block-button__link,
.wp-block-button.is-style-uw-secondary .wp-block-button__link {
	--uw-btn-accent: var(--wp--preset--color--cobalt-blue);
	--uw-btn-on-accent: var(--wp--preset--color--white);
	--uw-btn-hover: var(--wp--preset--color--deep-navy);
	--uw-btn-arrow: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 18 18'%3E%3Cpath d='M8.293 3.043a1 1 0 0 1 1.414 0l5.25 5.25a1 1 0 0 1 0 1.414l-5.25 5.25a1 1 0 1 1-1.414-1.414L11.836 10H3.75a1 1 0 0 1 0-2h8.086L8.293 4.457a1 1 0 0 1 0-1.414z'/%3E%3C/svg%3E");

	position: relative;
	display: inline-flex;
	align-items: center;
	border-radius: 100px;
	padding: 8px 56px 8px 20px;
	border: 1px solid transparent;
	font-family: var(--wp--preset--font-family--test-national-2-condensed);
	font-weight: 500;
	font-size: 20px;
	line-height: 1;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.2s ease, border-color 0.2s ease, color 0.2s ease;
}

/*
 * The editor's background colour picker is what an author actually reaches for,
 * so map WordPress's has-*-background-color classes onto the accent token. That
 * way picking "Red" recolours the pill AND its arrow circle together, instead of
 * leaving a cobalt arrow on a red pill.
 */
.wp-block-button.is-style-uw-primary .wp-block-button__link.has-red-background-color,
.wp-block-button.is-style-uw-secondary .wp-block-button__link.has-red-background-color {
	--uw-btn-accent: var(--wp--preset--color--red);
	--uw-btn-on-accent: var(--wp--preset--color--white);
	--uw-btn-hover: #c0312a;
}
.wp-block-button.is-style-uw-primary .wp-block-button__link.has-deep-navy-background-color,
.wp-block-button.is-style-uw-secondary .wp-block-button__link.has-deep-navy-background-color {
	--uw-btn-accent: var(--wp--preset--color--deep-navy);
	--uw-btn-on-accent: var(--wp--preset--color--white);
	--uw-btn-hover: var(--wp--preset--color--cobalt-blue);
}
.wp-block-button.is-style-uw-primary .wp-block-button__link.has-icy-blue-background-color,
.wp-block-button.is-style-uw-secondary .wp-block-button__link.has-icy-blue-background-color {
	--uw-btn-accent: var(--wp--preset--color--icy-blue);
	--uw-btn-on-accent: var(--wp--preset--color--deep-navy);
	--uw-btn-hover: var(--wp--preset--color--white);
}

/* The arrow circle (shared geometry — 36px disc, 18px glyph). */
.wp-block-button.is-style-uw-primary .wp-block-button__link::after,
.wp-block-button.is-style-uw-secondary .wp-block-button__link::after {
	content: "";
	position: absolute;
	right: 8px;
	top: 50%;
	transform: translateY(-50%);
	width: 36px;
	height: 36px;
	border-radius: 50%;
}

/* The arrow glyph, masked so it takes its colour from a token. */
.wp-block-button.is-style-uw-primary .wp-block-button__link::before,
.wp-block-button.is-style-uw-secondary .wp-block-button__link::before {
	content: "";
	position: absolute;
	right: 17px;
	top: 50%;
	transform: translateY(-50%);
	z-index: 1;
	width: 18px;
	height: 18px;
	-webkit-mask: var(--uw-btn-arrow) center / 18px 18px no-repeat;
	mask: var(--uw-btn-arrow) center / 18px 18px no-repeat;
}

/* ── Primary: accent fills the pill, arrow circle inverts ── */
.wp-block-button.is-style-uw-primary .wp-block-button__link {
	background-color: var(--uw-btn-accent);
	border-color: var(--uw-btn-accent);
	color: var(--uw-btn-on-accent);
}
.wp-block-button.is-style-uw-primary .wp-block-button__link::after {
	background-color: var(--uw-btn-on-accent);
}
.wp-block-button.is-style-uw-primary .wp-block-button__link::before {
	background-color: var(--uw-btn-accent);
}
.wp-block-button.is-style-uw-primary .wp-block-button__link:hover,
.wp-block-button.is-style-uw-primary .wp-block-button__link:focus-visible {
	background-color: var(--uw-btn-hover);
	border-color: var(--uw-btn-hover);
	color: var(--uw-btn-on-accent);
}

/* ── Secondary: transparent pill, accent moves to the arrow circle ── */
.wp-block-button.is-style-uw-secondary .wp-block-button__link {
	background-color: transparent;
	border-color: color-mix(in srgb, var(--wp--preset--color--deep-navy) 20%, transparent);
	color: var(--wp--preset--color--deep-navy);
}
.wp-block-button.is-style-uw-secondary .wp-block-button__link::after {
	background-color: var(--uw-btn-accent);
}
.wp-block-button.is-style-uw-secondary .wp-block-button__link::before {
	background-color: var(--uw-btn-on-accent);
}
.wp-block-button.is-style-uw-secondary .wp-block-button__link:hover,
.wp-block-button.is-style-uw-secondary .wp-block-button__link:focus-visible {
	background-color: transparent;
	border-color: var(--uw-btn-accent);
	color: var(--wp--preset--color--deep-navy);
}

/*
 * ── Tertiary: sweep-underlined text link ──
 * .uw-btn-tertiary in custom-styles.css owns the face and the animation; the
 * core Button only needs its own chrome (padding, radius, background) stripped
 * so the shared component shows through.
 */
.wp-block-button.is-style-uw-tertiary .wp-block-button__link {
	background: transparent;
	border: 0;
	border-radius: 0;
	padding: 0 0 4px;
}
