/**
 * Pattern: Share Component  (patterns/share-component.php)
 *
 * Reusable share button for any single post/CPT (kd_event, blg_story, post).
 * Uses the native Web Share API with a copy-link clipboard fallback.
 *
 * Anatomy:
 *   .kd-share          — outer wrapper (white background, centred section)
 *   .kd-share__inner   — constrained, centred flex row
 *   .kd-share__btn     — icon + label button (outline pill, BLG secondary style)
 *   .kd-share__icon    — share SVG, 20×20, inherits currentColor
 *   .kd-share__label   — "Share" text label
 *   .kd-share__confirm — live region: "Link copied!" confirmation message
 *
 * Design source: Figma 23:1752 node 40:4923 (share-network-fill icon, 32px,
 * positioned at the right edge of the hero). The pattern renders it as a
 * labelled section at the page bottom for accessibility — positioning it
 * absolute in the hero would require !important overrides and break keyboard flow.
 *
 * Auto-enqueued by inc/enqueue.php glob over assets/css/patterns/*.css.
 * One pattern = one CSS partial. Prefix: .kd-share__*.
 */

/* ── Outer section ───────────────────────────────────────────────────── */

.kd-share {
	background: var(--blg-color-base); /* white */
	padding-block: var(--blg-space-lg) var(--blg-space-xl); /* 40px top, 64px bottom */
	padding-inline: var(--blg-gutter);
}

/* ── Inner row — centred, constrained to reading column width ────────── */

.kd-share__inner {
	display: flex;
	align-items: center;
	gap: var(--blg-space-sm); /* 16px button → confirm message */
	max-width: var(--blg-measure-reading); /* reading column */
	/* Not left-flush here: share is a centred call-to-action, not body prose */
}

/* ── Share button — outlined pill ────────────────────────────────────── */

/*
 * Secondary outlined button: 3px purple border, no fill, indigo on hover —
 * the BLG secondary button spec (figma-analysis-2026-06.md §1 Buttons:
 * outline 3px (donor purple)). Pill-shaped, uppercase label.
 */
.kd-share__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem; /* 8px icon → label */
	padding: 0.75rem 1.75rem; /* 12px 28px */
	border: 3px solid var(--blg-color-primary);
	border-radius: var(--blg-radius-pill);
	background-color: transparent;
	color: var(--blg-color-primary);
	font-family: var(--blg-font-heading);
	font-size: 0.9375rem; /* 15px */
	font-weight: 700;
	line-height: 1.2;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	cursor: pointer;
	text-decoration: none;
	transition:
		color var(--blg-transition-fast),
		border-color var(--blg-transition-fast),
		background-color var(--blg-transition-fast);
}

.kd-share__btn:hover,
.kd-share__btn:focus-visible {
	color: var(--blg-color-secondary); /* indigo #252265 */
	border-color: var(--blg-color-secondary);
}

/* Focus ring — WCAG 1.4.11 Non-text Contrast */
.kd-share__btn:focus-visible {
	outline: 2px solid var(--blg-color-primary);
	outline-offset: 3px;
}

/* ── Icon ────────────────────────────────────────────────────────────── */

.kd-share__icon {
	flex-shrink: 0;
	width: 1.25rem; /* 20px */
	height: 1.25rem;
	fill: currentColor;
}

/* ── Label — "Share" ─────────────────────────────────────────────────── */

.kd-share__label {
	/* Plain text inside the button — inherits button font/color */
}

/* ── Confirmation message — "Link copied!" ───────────────────────────── */

.kd-share__confirm {
	display: inline-block;
	font-family: var(--blg-font-body);
	font-size: var(--blg-size-body); /* 16px */
	font-weight: 600;
	color: var(--blg-color-primary);
	min-height: 1.5em; /* prevent layout shift when text appears/disappears */
}

/* ── Responsive ──────────────────────────────────────────────────────── */

@media (max-width: 767.98px) {
	.kd-share {
		padding-block: var(--blg-space-md) var(--blg-space-lg); /* 24px 40px */
	}

	.kd-share__inner {
		flex-wrap: wrap;
	}

	.kd-share__btn {
		width: 100%; /* full-width tap target on mobile */
		justify-content: center;
	}

	.kd-share__confirm {
		text-align: center;
		width: 100%;
	}
}
