/*
 * Keyboard focus on the storefront: one branded ring as the baseline, so a new element has a focus state without
 * anyone having to think of it. Frontend only (inc/setup/assets.php): tokens.css and the component files also reach
 * the block editor, TinyMCE fields and wp-admin, where WordPress brings its own focus styles. Zero specificity, so
 * every element's own focus style wins. The rules for overriding it: docs/block-design-system.md, «Fokus»; rules for
 * a single element live in its component file.
 */
:where(:focus-visible) {
	outline: var(--ll-focus-w) solid var(--ll-focus-color);
	outline-offset: var(--ll-focus-offset);
	border-radius: var(--ll-r-focus);
}

/* One ring: Blocksy draws its own, thinner and closer, on links, buttons, checkboxes and radios. They take the ring's
   width and distance; html raises the selector just above Blocksy's, so any rule with a class still
   wins. --outline-offset is Blocksy's own variable, so its per-element distances (drawer close button) stay. */
:root {
	--outline-offset: var(--ll-focus-offset);
}
html :is(a, button, input:is([type="checkbox"], [type="radio"])):focus-visible {
	outline-width: var(--ll-focus-w);
}

/* Dark areas: a light ring (WCAG 1.4.11, at least 3:1 against the background). The header is transparent over the
   home hero until it turns sticky (header.css). A new dark area joins this list. */
:root :is(
	#footer,
	#header [data-transparent-row="yes"]:not([data-sticky*="yes"] *),
	.ll-hero,
	.ll-bhero,
	.ll-team,
	.ll-crew__m,
	.ll-trust-band,
	.ll-cta-band,
	.ll-cway,
	.ll-acalc,
	.is-style-ll-dark,
	.has-brand-background-color,
	.has-emphasis-background-color,
	.has-text-1-background-color
) {
	--ll-focus-color: var(--ll-white);
}
:root :is(
	#footer,
	#header [data-transparent-row="yes"]:not([data-sticky*="yes"] *),
	.ll-hero,
	.ll-bhero,
	.ll-team,
	.ll-crew__m,
	.ll-trust-band,
	.ll-cta-band,
	.ll-cway,
	.ll-acalc,
	.is-style-ll-dark,
	.has-brand-background-color,
	.has-emphasis-background-color,
	.has-text-1-background-color
) :focus-visible {
	outline-color: var(--ll-focus-color);
}

/* Links in running text: the ring directly around the word with small corners, so it stays clear of the words beside
   it. */
:is(p, li, dd, td, label, small, figcaption) > a:not([class]):focus-visible {
	outline-offset: 0;
	border-radius: calc(var(--ll-r-focus) / 2);
}

/* The skip link appears at the top edge of the window, which cut the ring: drawn inside the box. */
.skip-link.screen-reader-text:focus-visible {
	outline-offset: calc(-1 * (var(--ll-focus-w) + var(--ll-focus-offset)));
}
