/**
 * Frontend styles: cover link.
 *
 * Plain CSS (copied verbatim to build/extensions/cover-link/view.css via
 * CopyWebpackPlugin), enqueued only when a linked cover renders.
 *
 * Layering: includes/cover-link.php inserts .ch-cover-link right before the
 * inner container. With the overlay span no longer adjacent to the inner
 * container, core's own :has() rule stacks background media at z-index 0
 * and the overlay + inner container at 1. The link takes z-index 1 too and
 * sits between them in the DOM, so it paints above the background and
 * overlay and below the inner container. cover-images slideshow arrows/dots
 * (z-index 2) stay above it.
 *
 * The inner container lets clicks fall through to the link except on
 * interactive descendants, so text and empty space navigate while inner
 * links, buttons and form controls keep their own targets.
 */

.wp-block-cover > .ch-cover-link {
	position: absolute;
	inset: 0;
	z-index: 1;
}

.wp-block-cover:has(> .ch-cover-link) > .wp-block-cover__inner-container {
	z-index: 1;
	pointer-events: none;
}

.wp-block-cover:has(> .ch-cover-link) > .wp-block-cover__inner-container :is(a, button, input, select, textarea, label, summary, video, audio, iframe, [tabindex], [role="button"], [contenteditable]) {
	pointer-events: auto;
}

/* Visually hidden accessible name. */
.ch-cover-link__label {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* The focus ring goes on the whole cover, not the inset link. */
.wp-block-cover > .ch-cover-link:focus-visible {
	outline: none;
}

.wp-block-cover:has(> .ch-cover-link:focus-visible) {
	outline: var(--ch-cover-link-focus-width, 2px) solid var(--ch-cover-link-focus-color, CanvasText);
	outline-offset: var(--ch-cover-link-focus-offset, 2px);
}
