/*
 * Icon link (cis/arrow-link, shown to editors as "Icon link"). Loaded with the block, front end and editor canvas.
 *
 * Moved here from the two Etch styles of the arrow link (.bw-card__item-link and .bw-card-minimal__item-link), flattened and
 * wrapped in :where() so the whole file has ZERO specificity. The block registers the same Etch styles (see bw_render_arrow_link()),
 * so Etch prints its own copy on the page in its own order, together with the page classes that tweak it. This file is the fallback
 * for where Etch's copy is not there (the editor canvas) and it can never override Etch's copy or a page class.
 * The icon itself (size, round box, colours from --icon-*) is styled by the site's icon CSS through the data-icon attributes.
 */

:where(.bw-card__item-link) {
	--icon-color: var(--white);
	--icon-color-hover: var(--white);
	--focus-color: var(--base-semi-dark);
	flex-shrink: 0;
}

/* Only an actual link animates on hover. */
:where(.bw-card__item-link:is(a):hover [data-icon]) {
	transform: rotateZ(30deg);
}

:where(.bw-card-minimal__item-link) {
	--icon-background: var(--secondary);
	--icon-background-hover: var(--secondary-hover);
}

@container card (max-width: 450px) {
	:where(.bw-card-minimal__item-link [data-icon-size='l']) {
		--icon-size: var(--icon-size-m);
	}
}

/* ---- Icon link options (2026-11-21) -----------------------------------------------------------------
 * `--light`: white circle, red icon (the Step 2 cards of the Join pages). `--icon`: another SVG than the arrow, which does not rotate on
 * hover (the 30 degree turn only suits the arrow). Two classes, so they win over the single-class Etch style of .bw-card__item-link
 * whatever the print order. */
.bw-card__item-link.bw-card__item-link--light {
	--icon-color: var(--primary);
	--icon-color-hover: var(--primary);
	--icon-background: var(--white);
	--icon-background-hover: var(--primary-ultra-light);
}

.bw-card__item-link.bw-card__item-link--icon:is(a):hover [data-icon] {
	transform: none;
}

/* ---- Editor canvas only ---------------------------------------------------------------------------
 * The editor adds its own margins and a content width to every block; the link sits in a flex row, so those are removed. */
.bw-card__item-link.wp-block {
	margin-block: 0;
	max-inline-size: none;
}
