/**
 * Components
 *
 * Styles that theme.json cannot express cleanly:
 * section labels, cards, ghost buttons, image ratios, icons, containers.
 * Consume design tokens only. No arbitrary hex values.
 */

/* Layout helpers — prefer core constrained/wide layouts first. */
.bnf-container {
	width: min(100%, var(--wp--custom--layout--container));
	margin-inline: auto;
}

.bnf-container-wide {
	width: min(100%, var(--wp--custom--layout--wide));
	margin-inline: auto;
}

.bnf-container-narrow {
	width: min(100%, var(--wp--custom--layout--narrow));
	margin-inline: auto;
}

/* Section label: small uppercase title with a short green rule. */
.bnf-section-label,
.wp-block-paragraph.is-style-bnf-section-label {
	display: flex;
	align-items: center;
	gap: var(--wp--preset--spacing--md);
	margin: 0;
	color: var(--wp--preset--color--bnf-navy);
	font-size: var(--wp--preset--font-size--meta);
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-transform: uppercase;
}

.bnf-section-label::before,
.wp-block-paragraph.is-style-bnf-section-label::before {
	content: "";
	width: 1.75rem;
	height: 2px;
	flex-shrink: 0;
	background: var(--wp--preset--color--bnf-forest);
}

/* Cards */
.wp-block-group.is-style-bnf-card,
.bnf-card {
	overflow: hidden;
	background: var(--wp--preset--color--bnf-surface);
	border: 1px solid var(--wp--preset--color--bnf-border);
	border-radius: var(--wp--custom--radius--card);
	box-shadow: var(--wp--preset--shadow--none);
}

.wp-block-group.is-style-bnf-card img,
.bnf-card img {
	display: block;
	width: 100%;
	height: auto;
	object-fit: cover;
	border-radius: 0;
}

/* Ghost / text button */
.wp-block-button.is-style-bnf-ghost .wp-block-button__link {
	padding-inline: 0;
	background: transparent;
	color: var(--wp--preset--color--bnf-forest);
	box-shadow: none;
}

.wp-block-button.is-style-bnf-ghost .wp-block-button__link:hover,
.wp-block-button.is-style-bnf-ghost .wp-block-button__link:focus {
	background: transparent;
	color: var(--wp--preset--color--bnf-forest-dark);
}

/* -------------------------------------------------------------------------
   CTA system
   .bnf-cta     Editorial text CTA: label + outlined arrow circle + hairline.
                Markup: <a class="bnf-cta">Label<span class="bnf-cta__icon" aria-hidden="true"></span></a>
   .bnf-button  Primary action. Modifiers: --secondary (outline), --inverse (on dark bands).
                Core button blocks and a.wp-element-button inside <main> share it;
                the header Donate button lives outside <main> and keeps chrome.css.
   Both draw the arrow from assets/icons/arrow.svg as a currentColor mask.
   ------------------------------------------------------------------------- */

:root {
	--bnf-cta-duration: 220ms;
	--bnf-cta-ease: var(--wp--custom--motion--easing, cubic-bezier(0.22, 1, 0.36, 1));
	--bnf-cta-arrow: url("../icons/arrow.svg");
}

/* Editorial CTA */
.bnf-cta {
	--bnf-cta-icon-size: 2rem;
	--bnf-cta-gap: 0.75rem;
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: var(--bnf-cta-gap);
	max-width: 100%;
	padding-block: 0.3rem 0.45rem;
	color: var(--wp--preset--color--bnf-forest-dark);
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.35;
	letter-spacing: 0.005em;
	text-decoration: none;
	transition: color var(--bnf-cta-duration) var(--bnf-cta-ease);
}

/* Hairline sits under the label only, clear of the circle. */
.bnf-cta::after {
	content: "";
	position: absolute;
	left: 0;
	right: calc(var(--bnf-cta-icon-size) + var(--bnf-cta-gap));
	bottom: 0;
	height: 1px;
	background: color-mix(in srgb, var(--wp--preset--color--bnf-forest) 38%, transparent);
	transform-origin: left center;
	transition:
		background-color var(--bnf-cta-duration) var(--bnf-cta-ease),
		transform var(--bnf-cta-duration) var(--bnf-cta-ease);
}

.bnf-cta__icon {
	position: relative;
	display: inline-flex;
	flex: none;
	align-items: center;
	justify-content: center;
	box-sizing: border-box;
	width: var(--bnf-cta-icon-size);
	height: var(--bnf-cta-icon-size);
	/* Keeps the line box at text height so the circle does not push surrounding layout. */
	margin-block: -0.3rem;
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--bnf-forest) 55%, transparent);
	border-radius: 50%;
	background-color: transparent;
	color: var(--wp--preset--color--bnf-forest);
	transition:
		background-color var(--bnf-cta-duration) var(--bnf-cta-ease),
		border-color var(--bnf-cta-duration) var(--bnf-cta-ease);
}

.bnf-cta__icon::before {
	content: "";
	width: 0.9375rem;
	height: 0.9375rem;
	background: currentColor;
	-webkit-mask: var(--bnf-cta-arrow) center / contain no-repeat;
	mask: var(--bnf-cta-arrow) center / contain no-repeat;
	transition: transform var(--bnf-cta-duration) var(--bnf-cta-ease);
}

.bnf-cta:hover,
.bnf-cta:focus-visible {
	color: color-mix(in srgb, var(--wp--preset--color--bnf-forest-dark) 55%, var(--wp--preset--color--bnf-navy));
}

.bnf-cta:hover::after,
.bnf-cta:focus-visible::after {
	background-color: var(--wp--preset--color--bnf-forest);
}

.bnf-cta:hover .bnf-cta__icon,
.bnf-cta:focus-visible .bnf-cta__icon {
	border-color: var(--wp--preset--color--bnf-forest);
	background-color: color-mix(in srgb, var(--wp--preset--color--bnf-mint) 85%, transparent);
}

.bnf-cta:focus-visible {
	outline: 2px solid var(--wp--preset--color--bnf-forest-dark);
	outline-offset: 4px;
	border-radius: 4px;
}

/* Primary / secondary buttons */
.bnf-button,
main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link,
main a.wp-element-button:not(.wp-block-button__link) {
	box-sizing: border-box;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.625rem;
	min-height: 3rem;
	margin: 0;
	padding: 0.75rem 1.375rem 0.75rem 1.5rem;
	border: 1px solid var(--bnf-button-border, var(--wp--preset--color--bnf-forest));
	border-radius: 0.625rem;
	background: var(--bnf-button-bg, var(--wp--preset--color--bnf-forest));
	box-shadow: none;
	color: var(--bnf-button-color, var(--wp--preset--color--bnf-surface));
	font-family: inherit;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.25;
	letter-spacing: 0.005em;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color var(--bnf-cta-duration) var(--bnf-cta-ease),
		border-color var(--bnf-cta-duration) var(--bnf-cta-ease),
		color var(--bnf-cta-duration) var(--bnf-cta-ease),
		box-shadow var(--bnf-cta-duration) var(--bnf-cta-ease),
		transform var(--bnf-cta-duration) var(--bnf-cta-ease);
}

.bnf-button::after,
main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link::after,
main a.wp-element-button:not(.wp-block-button__link)::after {
	content: "";
	flex: none;
	width: 1.125rem;
	height: 1.125rem;
	background: currentColor;
	-webkit-mask: var(--bnf-cta-arrow) center / contain no-repeat;
	mask: var(--bnf-cta-arrow) center / contain no-repeat;
	transition: transform var(--bnf-cta-duration) var(--bnf-cta-ease);
}

.bnf-button:hover,
.bnf-button:focus-visible,
main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:hover,
main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:focus-visible,
main a.wp-element-button:not(.wp-block-button__link):hover,
main a.wp-element-button:not(.wp-block-button__link):focus-visible {
	border-color: var(--bnf-button-border-hover, var(--wp--preset--color--bnf-forest-dark));
	background: var(--bnf-button-bg-hover, var(--wp--preset--color--bnf-forest-dark));
	box-shadow: var(--bnf-button-shadow-hover, 0 8px 18px -12px color-mix(in srgb, var(--wp--preset--color--bnf-navy) 55%, transparent));
	color: var(--bnf-button-color-hover, var(--wp--preset--color--bnf-surface));
}

.bnf-button:focus-visible,
main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:focus-visible,
main a.wp-element-button:not(.wp-block-button__link):focus-visible {
	outline: 2px solid var(--bnf-button-focus, var(--wp--preset--color--bnf-navy));
	outline-offset: 3px;
}

.bnf-button--secondary,
main .wp-block-button.is-style-outline > .wp-block-button__link,
main a.wp-element-button.is-style-outline {
	--bnf-button-bg: transparent;
	--bnf-button-border: color-mix(in srgb, var(--wp--preset--color--bnf-forest) 60%, transparent);
	--bnf-button-color: var(--wp--preset--color--bnf-forest-dark);
	--bnf-button-bg-hover: color-mix(in srgb, var(--wp--preset--color--bnf-mint) 80%, transparent);
	--bnf-button-border-hover: var(--wp--preset--color--bnf-forest);
	--bnf-button-color-hover: var(--wp--preset--color--bnf-forest-dark);
	--bnf-button-shadow-hover: none;
	--bnf-button-lift: 0px;
}

.bnf-button--inverse {
	--bnf-button-bg: var(--wp--preset--color--bnf-surface);
	--bnf-button-border: var(--wp--preset--color--bnf-surface);
	--bnf-button-color: var(--wp--preset--color--bnf-forest-dark);
	--bnf-button-bg-hover: var(--wp--preset--color--bnf-mint);
	--bnf-button-border-hover: var(--wp--preset--color--bnf-mint);
	--bnf-button-color-hover: var(--wp--preset--color--bnf-forest-dark);
	--bnf-button-shadow-hover: 0 10px 20px -14px color-mix(in srgb, var(--wp--preset--color--bnf-navy) 70%, transparent);
	--bnf-button-focus: var(--wp--preset--color--bnf-surface);
}

.bnf-button--secondary.bnf-button--inverse {
	--bnf-button-bg: transparent;
	--bnf-button-border: color-mix(in srgb, var(--wp--preset--color--bnf-surface) 55%, transparent);
	--bnf-button-color: var(--wp--preset--color--bnf-surface);
	--bnf-button-bg-hover: color-mix(in srgb, var(--wp--preset--color--bnf-surface) 10%, transparent);
	--bnf-button-border-hover: var(--wp--preset--color--bnf-surface);
	--bnf-button-color-hover: var(--wp--preset--color--bnf-surface);
	--bnf-button-shadow-hover: none;
}

.bnf-button:disabled,
.bnf-button[aria-disabled="true"] {
	border-color: var(--bnf-button-border, var(--wp--preset--color--bnf-forest));
	background: var(--bnf-button-bg, var(--wp--preset--color--bnf-forest));
	box-shadow: none;
	color: var(--bnf-button-color, var(--wp--preset--color--bnf-surface));
	cursor: not-allowed;
	opacity: 0.7;
	transform: none;
}

.bnf-button:disabled::after,
.bnf-button[aria-disabled="true"]::after {
	display: none;
}

/* Movement is pointer-only and opt-out for reduced motion; colour feedback above stays. */
@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.bnf-cta:hover::after {
		transform: scaleX(1.05);
	}

	.bnf-cta:hover .bnf-cta__icon::before {
		transform: translateX(4px);
	}

	.bnf-button:not(:disabled, [aria-disabled="true"]):hover,
	main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:hover,
	main a.wp-element-button:not(.wp-block-button__link):hover {
		transform: translateY(calc(-1 * var(--bnf-button-lift, 2px)));
	}

	.bnf-button:not(:disabled, [aria-disabled="true"]):hover::after,
	main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:hover::after,
	main a.wp-element-button:not(.wp-block-button__link):hover::after {
		transform: translateX(3px);
	}

	.bnf-button:not(:disabled, [aria-disabled="true"]):active,
	main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:active,
	main a.wp-element-button:not(.wp-block-button__link):active {
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: no-preference) {
	.bnf-cta:focus-visible .bnf-cta__icon::before {
		transform: translateX(4px);
	}

	.bnf-button:focus-visible::after,
	main .wp-block-button:not(.is-style-bnf-ghost) > .wp-block-button__link:focus-visible::after,
	main a.wp-element-button:not(.wp-block-button__link):focus-visible::after {
		transform: translateX(3px);
	}
}

/* Image ratios */
.bnf-ratio-hero,
.bnf-ratio-16-9,
.bnf-ratio-1-1 {
	overflow: hidden;
}

.bnf-ratio-hero img,
.bnf-ratio-16-9 img,
.bnf-ratio-1-1 img,
.bnf-media-cover {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
}

.bnf-ratio-hero {
	aspect-ratio: 21 / 9;
}

.bnf-ratio-16-9 {
	aspect-ratio: 16 / 9;
}

.bnf-ratio-1-1 {
	aspect-ratio: 1 / 1;
}

/* Icons */
.bnf-icon {
	display: inline-block;
	width: 1.25em;
	height: 1.25em;
	flex-shrink: 0;
	vertical-align: -0.15em;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.75;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.bnf-icon-circle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	color: var(--wp--preset--color--bnf-green);
	background: var(--wp--preset--color--bnf-mint);
	border-radius: 50%;
}

.bnf-icon-circle .bnf-icon {
	width: 1.35rem;
	height: 1.35rem;
}

/* Section vertical rhythm helpers for later templates. */
.bnf-section {
	padding-block: var(--wp--custom--section--large);
}

.bnf-section--small {
	padding-block: var(--wp--custom--section--small);
}

.bnf-section--medium {
	padding-block: var(--wp--custom--section--medium);
}

.bnf-section--xl {
	padding-block: var(--wp--custom--section--xl);
}

/* -------------------------------------------------------------------------
   Default WordPress Page — premium editorial content surface
   Applied via templates/page.html (.bnf-page / .bnf-page-surface).
   Does not affect front-page, custom page templates, or CPT templates.
   ------------------------------------------------------------------------- */

.bnf-page {
	background: var(--wp--preset--color--bnf-surface-soft);
	padding-block: var(--wp--preset--spacing--2-xl) var(--wp--preset--spacing--3-xl);
}

.bnf-page-surface {
	box-sizing: border-box;
	width: min(100% - 2.5rem, 1240px);
	max-width: 1240px;
	margin-inline: auto;
	padding: 3.75rem 4.25rem; /* ~60px / 68px */
	background: var(--wp--preset--color--bnf-surface);
	border: 1px solid var(--wp--preset--color--bnf-border);
	border-radius: 1rem; /* 16px */
	box-shadow:
		0 1px 2px color-mix(in srgb, var(--wp--preset--color--bnf-navy) 4%, transparent),
		0 12px 32px color-mix(in srgb, var(--wp--preset--color--bnf-navy) 6%, transparent);
	--wp--style--block-gap: 1.5rem;
}

.bnf-page-surface__title {
	margin: 0 0 var(--wp--preset--spacing--xl);
	color: var(--wp--preset--color--bnf-navy);
	font-size: var(--wp--preset--font-size--heading-1);
	font-weight: 700;
	line-height: 1.12;
	letter-spacing: -0.02em;
}

/* The surface already supplies gutters, so root padding-aware alignment padding is not needed here. */
.bnf-page-surface .bnf-page-surface__content {
	padding-inline: 0;
}

/* Phone measures are too narrow to justify without large word gaps. */
@media (min-width: 600px) {
	.bnf-page-surface__content > p:not([class*="has-text-align-"]) {
		text-align: justify;
		-webkit-hyphens: auto;
		hyphens: auto;
	}
}

.bnf-page-surface__content > *:first-child {
	margin-block-start: 0;
}

.bnf-page-surface__content > *:last-child {
	margin-block-end: 0;
}

.bnf-page-surface__content .alignwide,
.bnf-page-surface__content .wp-block-image.alignwide,
.bnf-page-surface__content .wp-block-gallery,
.bnf-page-surface__content .wp-block-table,
.bnf-page-surface__content .wp-block-columns {
	max-width: 100%;
}

.bnf-page-surface__content .alignfull {
	width: 100% !important;
	max-width: 100% !important;
	margin-left: 0 !important;
	margin-right: 0 !important;
}

.bnf-page-surface__content img {
	height: auto;
	max-width: 100%;
}

@media (max-width: 1024px) {
	.bnf-page-surface {
		padding: 2.5rem; /* 40px */
	}
}

@media (max-width: 767px) {
	.bnf-page {
		padding-block: var(--wp--preset--spacing--xl) var(--wp--preset--spacing--2-xl);
	}

	.bnf-page-surface {
		width: min(100% - 2rem, 1240px); /* ~16px outer */
		padding: 1.375rem 1.5rem; /* ~22–24px */
		border-radius: 0.75rem; /* 12px */
		box-shadow:
			0 1px 2px color-mix(in srgb, var(--wp--preset--color--bnf-navy) 4%, transparent),
			0 6px 16px color-mix(in srgb, var(--wp--preset--color--bnf-navy) 5%, transparent);
	}
}

