/* Button (docs/widgets/button.md), in the design language (spec §3.7). This is Soft, the default:
   a pill on a pale tint of the accent, with the accent's deep shade for its text. Fonts come from
   the theme. button-outline.css and button-solid.css change only the --hafe-btn-d-* tokens below,
   so a Style control's own property always wins over the design. */
.hafe-btn-wrap {
	display: flex;
	justify-content: var(--hafe-btn-justify, flex-start);
}

.hafe-btn {
	--hafe-btn-d-bg: var(--hafe-tint);
	--hafe-btn-d-ink: var(--hafe-accent-ink);
	--hafe-btn-d-line: transparent;
	--hafe-btn-d-hover-bg: var(--hafe-tint-strong);
	--hafe-btn-d-hover-ink: var(--hafe-accent-ink);
	--hafe-btn-d-hover-line: transparent;
	--hafe-btn-d-radius: var(--hafe-pill);
	--hafe-btn-d-shadow-up: var(--hafe-shadow);
	--hafe-btn-d-pad: 0.75em 1.5em;
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--hafe-btn-gap, 0.5em);
	inline-size: var(--hafe-btn-width, auto);
	max-inline-size: 100%;
	padding: var(--hafe-btn-padding, var(--hafe-btn-d-pad));
	border: var(--hafe-btn-line-width, 1px) solid var(--hafe-btn-line, var(--hafe-btn-d-line));
	border-radius: var(--hafe-btn-radius, var(--hafe-btn-d-radius));
	background: var(--hafe-btn-bg, var(--hafe-btn-d-bg));
	color: var(--hafe-btn-color, var(--hafe-btn-d-ink));
	font-weight: 600;
	line-height: 1.25;
	text-align: center;
	text-decoration: none;
	overflow-wrap: break-word;
	transition: background-color 0.2s, border-color 0.2s, color 0.2s;
}

/* Themes style links; the button keeps its own colours and no underline. */
.hafe-btn-wrap a.hafe-btn,
.hafe-btn-wrap a.hafe-btn:visited {
	color: var(--hafe-btn-color, var(--hafe-btn-d-ink));
	text-decoration: none;
}

.hafe-btn-wrap a.hafe-btn:hover {
	border-color: var(--hafe-btn-hover-line, var(--hafe-btn-line, var(--hafe-btn-d-hover-line)));
	background: var(--hafe-btn-hover-bg, var(--hafe-btn-d-hover-bg));
	color: var(--hafe-btn-hover-color, var(--hafe-btn-color, var(--hafe-btn-d-hover-ink)));
}

.hafe-btn-size-sm .hafe-btn {
	--hafe-btn-d-pad: 0.55em 1.1em;
	font-size: 0.875em;
}

.hafe-btn-size-lg .hafe-btn {
	--hafe-btn-d-pad: 0.9em 1.9em;
	font-size: 1.125em;
}

/* An icon alone sits in a square. */
.hafe-btn.hafe-btn--icon-only {
	--hafe-btn-d-pad: 0.875em;
}

.hafe-btn__body {
	display: flex;
	flex-direction: column;
	gap: 0.15em;
}

.hafe-btn__sub {
	font-size: 0.8em;
	font-weight: 400;
}

.hafe-btn__icon {
	display: inline-flex;
	flex: none;
	color: var(--hafe-btn-icon-color, currentColor);
	font-size: var(--hafe-btn-icon, 1em);
	transition: transform 0.2s ease;
}

.hafe-btn__icon svg {
	inline-size: 1em;
	block-size: 1em;
	fill: currentColor;
}

.hafe-btn--icon-after .hafe-btn__icon {
	order: 2;
}

.hafe-btn__sr {
	position: absolute;
	inline-size: 1px;
	block-size: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* The hover effects move the button, so they're for a mouse, and for visitors happy with motion.
   The keyboard gets the same while it's on the button. As subtle as the cards' (owner, 2026-11-13). */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.hafe-btn-hover-lift a.hafe-btn,
	.hafe-btn-hover-grow a.hafe-btn {
		transition: transform 0.2s ease, box-shadow 0.2s ease, background-color 0.2s, border-color 0.2s, color 0.2s;
	}

	.hafe-btn-hover-lift a.hafe-btn:is(:hover, :focus-visible) {
		box-shadow: var(--hafe-btn-d-shadow-up);
		transform: translateY(-0.1em);
	}

	.hafe-btn-hover-grow a.hafe-btn:is(:hover, :focus-visible) {
		transform: scale(1.015);
	}

	.hafe-btn-hover-icon a.hafe-btn--icon-after:is(:hover, :focus-visible) .hafe-btn__icon {
		transform: translateX(0.2em);
	}

	.hafe-btn-hover-icon a.hafe-btn--icon-before:is(:hover, :focus-visible) .hafe-btn__icon {
		transform: translateX(-0.2em);
	}

	.hafe-btn-hover-icon a.hafe-btn--icon-after:is(:hover, :focus-visible):dir(rtl) .hafe-btn__icon {
		transform: translateX(-0.2em);
	}

	.hafe-btn-hover-icon a.hafe-btn--icon-before:is(:hover, :focus-visible):dir(rtl) .hafe-btn__icon {
		transform: translateX(0.2em);
	}
}

/* High contrast: the system draws the button's frame, so it stays a button. */
@media (forced-colors: active) {
	.hafe-btn {
		border-color: ButtonText;
	}
}

.hafe-empty {
	margin: 0;
	padding: 1em;
	border: 1px dashed currentColor;
	opacity: 0.7;
}

@media (prefers-reduced-motion: reduce) {
	.hafe-btn,
	.hafe-btn__icon {
		transition: none;
	}
}
