/* ==========================================================================
 * Section Builder — front-end styles (see inc/section-builder.php).
 * Uses the theme.json presets so sections match the rest of the site:
 * Raptor Orange accent, Big Shoulders headings, Saira Condensed labels.
 * ========================================================================== */

.acfsb-sections.alignfull {
	width: auto;
	max-width: none;
}

.acfsb-section {
	--acfsb-container: var(--wp--style--global--wide-size, 1280px);
	--acfsb-gutter: var(--wp--preset--spacing--70, 40px);
	--acfsb-gap: var(--wp--preset--spacing--50, 40px);
	--acfsb-pad-y: var(--wp--preset--spacing--80, 95px);
	--acfsb-accent: var(--wp--preset--color--accent-1, #ff6600);
	--acfsb-heading: var(--wp--preset--color--contrast, #fff);
	--acfsb-body: var(--wp--preset--color--accent-5, #d1d5da);
	--acfsb-muted: var(--wp--preset--color--accent-4, #9ea4ae);
	--acfsb-card: var(--wp--preset--color--accent-3, #0f1114);
	--acfsb-card-hover: var(--wp--preset--color--accent-2, #15171b);
	--acfsb-border: var(--wp--preset--color--accent-6, #25282e);
	--acfsb-base: var(--wp--preset--color--base, #090a0c);

	position: relative;
	isolation: isolate;
	margin: 0;
	padding-block: var(--acfsb-pad-y);
	color: var(--acfsb-body);
	background-repeat: no-repeat;
	background-size: cover;
	background-position: center;
}

/* Background image: URLs come from inline custom properties (render.php).
 * Phones get the smaller file; .acfsb-bg-lazy holds it back until the
 * section nears the viewport (assets/js/sections-effects.js). */
.acfsb-section.has-bg-image { background-image: var(--acfsb-bg); }
@media (max-width: 767px) {
	.acfsb-section.has-bg-image { background-image: var(--acfsb-bg-sm, var(--acfsb-bg)); }
}
.acfsb-section.has-bg-image.acfsb-bg-lazy { background-image: none; }

.acfsb-section *,
.acfsb-section *::before,
.acfsb-section *::after {
	box-sizing: border-box;
}

.acfsb-section__overlay {
	position: absolute;
	inset: 0;
	z-index: 0;
	pointer-events: none;
}

.acfsb-container {
	position: relative;
	z-index: 1;
	max-width: calc(var(--acfsb-container) + var(--acfsb-gutter) * 2);
	margin-inline: auto;
	padding-inline: var(--acfsb-gutter);
}

/* 12-column grid --------------------------------------------------------- */
.acfsb-grid {
	display: grid;
	grid-template-columns: repeat(12, minmax(0, 1fr));
	gap: var(--acfsb-gap);
	align-items: start;
}

.acfsb-block { grid-column: span 12; min-width: 0; margin: 0; }
.acfsb-span-1  { grid-column: span 1; }
.acfsb-span-2  { grid-column: span 2; }
.acfsb-span-3  { grid-column: span 3; }
.acfsb-span-4  { grid-column: span 4; }
.acfsb-span-5  { grid-column: span 5; }
.acfsb-span-6  { grid-column: span 6; }
.acfsb-span-7  { grid-column: span 7; }
.acfsb-span-8  { grid-column: span 8; }
.acfsb-span-9  { grid-column: span 9; }
.acfsb-span-10 { grid-column: span 10; }
.acfsb-span-11 { grid-column: span 11; }
.acfsb-span-12 { grid-column: span 12; }

/* Tablet (up to 1024px): Span 2, 3 and 4 blocks show 2 per row. */
@media (max-width: 1024px) {
	.acfsb-span-1, .acfsb-span-2, .acfsb-span-3,
	.acfsb-span-4, .acfsb-span-5 { grid-column: span 6; }
	.acfsb-span-7, .acfsb-span-8, .acfsb-span-9,
	.acfsb-span-10, .acfsb-span-11 { grid-column: span 12; }
}

/* Mobile: everything full width. */
@media (max-width: 767px) {
	/* Every block is full width here, so drop the column gap (11 × 40px gaps overflow narrow screens). */
	.acfsb-grid { column-gap: 0; }
	.acfsb-grid > .acfsb-block { grid-column: span 12; }
}

/* Alignment --------------------------------------------------------------- */
.acfsb-align-left   { text-align: left; }
.acfsb-align-center { text-align: center; }
.acfsb-align-right  { text-align: right; }

/* Eyebrow — same look as the theme's "Eyebrow" block style ----------------- */
.acfsb-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: 14px;
	margin: 0 0 var(--wp--preset--spacing--40, 24px);
	font-family: var(--wp--preset--font-family--saira-condensed);
	font-size: var(--wp--preset--font-size--small, 16px);
	font-weight: 700;
	letter-spacing: 0.22em;
	line-height: 1;
	text-transform: uppercase;
	color: var(--acfsb-accent);
}

.acfsb-eyebrow::before {
	content: "";
	flex: 0 0 auto;
	width: 36px;
	height: 6px;
	background: currentColor;
	transform: skewX(-30deg);
}

/* Centred eyebrow gets a matching dash on the right: —— THE CREW —— */
.acfsb-align-center .acfsb-eyebrow::after {
	content: "";
	flex: 0 0 auto;
	width: 36px;
	height: 6px;
	background: currentColor;
	transform: skewX(-30deg);
}

.acfsb-subtitle {
	margin: var(--wp--preset--spacing--40, 24px) 0 0;
	font-size: var(--wp--preset--font-size--medium, 19px);
	line-height: 1.65;
	color: var(--acfsb-muted);
}

.acfsb-section.has-overlay .acfsb-subtitle { color: var(--acfsb-body); }

/* Heading ----------------------------------------------------------------- */
.acfsb-heading__title { margin: 0; color: var(--acfsb-heading); }
.acfsb-heading__title a { color: inherit; text-decoration: none; }
.acfsb-heading__title a:hover { color: var(--acfsb-accent); text-decoration: none; }
.acfsb-block--heading.acfsb-align-center .acfsb-subtitle { margin-inline: auto; max-width: 48rem; }
.acfsb-block--heading.acfsb-align-right  .acfsb-subtitle { margin-left: auto; max-width: 48rem; }

/* Text -------------------------------------------------------------------- */
.acfsb-text > :first-child { margin-top: 0; }
.acfsb-text > :last-child { margin-bottom: 0; }
.acfsb-text img { max-width: 100%; height: auto; }
/* Centred text keeps a readable line length. */
.acfsb-block--text.acfsb-align-center .acfsb-text { max-width: 48rem; margin-inline: auto; }

/* Image ------------------------------------------------------------------- */
.acfsb-image__img {
	display: block;
	width: 100%;
	height: auto;
}
.acfsb-image__link { display: block; }

/* Buttons (base look comes from theme.json via .wp-element-button) ---------- */
.acfsb-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: var(--wp--preset--spacing--30, 16px);
}
.acfsb-align-center .acfsb-buttons { justify-content: center; }
.acfsb-align-right  .acfsb-buttons { justify-content: flex-end; }

.acfsb-btn {
	display: inline-flex;
	align-items: center;
	text-decoration: none;
	transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.acfsb-btn:hover { text-decoration: none; }

/* Default: solid orange with arrow, like the theme's primary button. */
.acfsb-btn--default::after {
	content: "\2192";
	content: "\2192" / ""; /* Decorative: not read out by screen readers. */
	display: inline-block;
	margin-left: 16px;
	transition: transform 0.15s ease;
}
.acfsb-btn--default:hover::after { transform: translateX(4px); }

/* Alternative: outline, like the theme's Outline button. */
.acfsb-btn.acfsb-btn--alternative {
	border: 2px solid var(--acfsb-accent);
	background: transparent;
	color: var(--acfsb-heading);
	padding: 15px 32px 15px 34px;
}
.acfsb-btn.acfsb-btn--alternative:hover,
.acfsb-btn.acfsb-btn--alternative:focus-visible {
	background: var(--acfsb-accent);
	color: var(--acfsb-base);
}

/* Grid ---------------------------------------------------------------------- */
.acfsb-cards {
	display: grid;
	grid-template-columns: repeat(var(--acfsb-cols, 3), minmax(0, 1fr));
	gap: var(--wp--preset--spacing--40, 24px);
}

@media (max-width: 1024px) {
	.acfsb-cards { grid-template-columns: repeat(min(var(--acfsb-cols, 3), 2), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.acfsb-cards { grid-template-columns: 1fr; }
}

/* Image Box type — same look as the theme's "Sponsor card". */
.acfsb-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border: 1px solid var(--acfsb-border);
	background: var(--acfsb-card);
	transition: background-color 0.15s ease, border-color 0.15s ease;
}
.acfsb-card:hover { background: var(--acfsb-card-hover); }

.acfsb-card__media { aspect-ratio: 16 / 10; overflow: hidden; }
.acfsb-card__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.acfsb-card:hover .acfsb-card__img { transform: scale(1.04); }

.acfsb-card__body {
	display: flex;
	flex: 1;
	flex-direction: column;
	padding: var(--wp--preset--spacing--50, 40px) var(--wp--preset--spacing--40, 24px);
}
.acfsb-card__body .acfsb-eyebrow { margin-bottom: var(--wp--preset--spacing--30, 16px); }

.acfsb-section .acfsb-card__title {
	margin: 0;
	font-size: clamp(28px, 2.6vw, 40px);
	line-height: 0.95;
	color: var(--acfsb-heading);
}
.acfsb-card__title a { color: inherit; text-decoration: none; }
.acfsb-card__title a:hover { color: var(--acfsb-accent); text-decoration: none; }

.acfsb-card__desc {
	margin: var(--wp--preset--spacing--30, 16px) 0 0;
	color: var(--acfsb-muted);
}
.acfsb-card__footer { margin-top: auto; padding-top: var(--wp--preset--spacing--50, 40px); }

/* Stats type — eyebrow + title with an orange rule, no card box. */
.acfsb-cards--stats .acfsb-card {
	border: 0;
	border-top: 3px solid var(--acfsb-accent);
	background: transparent;
}
.acfsb-cards--stats .acfsb-card:hover { background: transparent; }
.acfsb-cards--stats .acfsb-card__body { padding: var(--wp--preset--spacing--40, 24px) 0 0; }

/* Logo Sponsors ------------------------------------------------------------ */
.acfsb-logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--wp--preset--spacing--50, 40px) var(--wp--preset--spacing--60, 64px);
	margin: 0;
	padding: 0;
	list-style: none;
}
.acfsb-logos__item { margin: 0; }
.acfsb-logos__item a { display: block; }
.acfsb-logos__img {
	display: block;
	width: auto;
	height: auto;
	max-width: 180px;
	max-height: 80px;
	object-fit: contain;
	filter: grayscale(1);
	opacity: 0.6;
	transition: filter 0.2s ease, opacity 0.2s ease;
}
.acfsb-logos__item:hover .acfsb-logos__img,
.acfsb-logos__item a:focus-visible .acfsb-logos__img {
	filter: none;
	opacity: 1;
}

/* Gallery ----------------------------------------------------------------- */
.acfsb-gallery {
	display: grid;
	grid-template-columns: repeat(var(--acfsb-cols, 4), minmax(0, 1fr));
	gap: var(--wp--preset--spacing--20, 6px);
}
@media (max-width: 1024px) {
	.acfsb-gallery { grid-template-columns: repeat(min(var(--acfsb-cols, 4), 3), minmax(0, 1fr)); }
}
@media (max-width: 600px) {
	.acfsb-gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

.acfsb-gallery__item {
	position: relative;
	display: block;
	aspect-ratio: 1;
	overflow: hidden;
	cursor: zoom-in;
}
.acfsb-gallery__item::after {
	content: "";
	position: absolute;
	inset: 0;
	box-shadow: inset 0 0 0 0 var(--acfsb-accent);
	transition: box-shadow 0.15s ease;
}
.acfsb-gallery__item:hover::after,
.acfsb-gallery__item:focus-visible::after { box-shadow: inset 0 0 0 3px var(--acfsb-accent); }
.acfsb-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}
.acfsb-gallery__item:hover .acfsb-gallery__img { transform: scale(1.05); }

/* Lightbox ---------------------------------------------------------------- */
.acfsb-lb {
	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 4rem 4.5rem;
	background: rgba(9, 10, 12, 0.95);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s, visibility 0.25s;
}
/* Visible instantly on open (so the Close button can take focus), fades out on close. */
.acfsb-lb.is-open { opacity: 1; visibility: visible; transition: opacity 0.25s, visibility 0s; }
.acfsb-lb[hidden] { display: none; }

.acfsb-lb__figure {
	margin: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	max-width: 100%;
	max-height: 100%;
}
.acfsb-lb__img {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 10rem);
	object-fit: contain;
}
.acfsb-lb__caption {
	margin-top: 0.875rem;
	color: var(--wp--preset--color--accent-4, #9ea4ae);
	font-size: 15px;
	text-align: center;
}
.acfsb-lb__counter {
	position: absolute;
	top: 1.5rem;
	left: 1.5rem;
	font-family: var(--wp--preset--font-family--saira-condensed);
	font-weight: 700;
	letter-spacing: 0.22em;
	color: var(--wp--preset--color--accent-1, #ff6600);
}

.acfsb-lb__btn {
	position: absolute;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 3rem;
	height: 3rem;
	padding: 0;
	border: 2px solid var(--wp--preset--color--accent-6, #25282e);
	border-radius: 0;
	background: var(--wp--preset--color--accent-3, #0f1114);
	color: #fff;
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.acfsb-lb__btn:hover,
.acfsb-lb__btn:focus-visible {
	background: var(--wp--preset--color--accent-1, #ff6600);
	border-color: var(--wp--preset--color--accent-1, #ff6600);
	color: var(--wp--preset--color--base, #090a0c);
	outline: none;
}
.acfsb-lb__close { top: 1rem; right: 1rem; }
.acfsb-lb__prev  { left: 1rem; top: 50%; transform: translateY(-50%); }
.acfsb-lb__next  { right: 1rem; top: 50%; transform: translateY(-50%); }
.acfsb-lb.is-single .acfsb-lb__prev,
.acfsb-lb.is-single .acfsb-lb__next,
.acfsb-lb.is-single .acfsb-lb__counter { display: none; }

@media (max-width: 600px) {
	.acfsb-lb { padding: 3.5rem 0.75rem; }
	.acfsb-lb__prev, .acfsb-lb__next { top: auto; bottom: 1rem; transform: none; }
}

body.acfsb-lb-open { overflow: hidden; }

/* Links inside running text are underlined, not just coloured (WCAG 1.4.1). */
.acfsb-text p a,
.acfsb-text li a,
.acfsb-subtitle a {
	text-decoration: underline;
	text-underline-offset: 0.18em;
}

/* Keyboard focus ----------------------------------------------------------- */
.acfsb-section a:focus-visible,
.acfsb-section button:focus-visible {
	outline: 2px solid var(--acfsb-accent);
	outline-offset: 3px;
}
/* Inside clipped boxes (cards, gallery) draw the ring inside the edge. */
.acfsb-card__media a:focus-visible,
.acfsb-gallery__item:focus-visible {
	outline-offset: -3px;
}
.acfsb-lb__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-1, #ff6600);
	outline-offset: 2px;
}

/* Scroll fade-in (assets/js/sections-effects.js) ----------------------------
 * Uses the separate `translate` property so blocks keep their own transforms. */
.acfsb-reveal {
	opacity: 0;
	translate: 0 32px;
	transition:
		opacity 0.7s cubic-bezier(0.2, 0.65, 0.3, 1),
		translate 0.7s cubic-bezier(0.2, 0.65, 0.3, 1);
	transition-delay: var(--acfsb-reveal-delay, 0ms);
}
.acfsb-reveal.is-revealed {
	opacity: 1;
	translate: none;
}

/* Reduced motion: no fade-in, zooms or slides. */
@media (prefers-reduced-motion: reduce) {
	.acfsb-reveal {
		opacity: 1;
		translate: none;
		transition: none;
	}
	.acfsb-section *,
	.acfsb-lb {
		transition-duration: 0.01ms !important;
	}
	.acfsb-card:hover .acfsb-card__img,
	.acfsb-gallery__item:hover .acfsb-gallery__img,
	.acfsb-btn--default:hover::after {
		transform: none;
	}
}

@media print {
	.acfsb-reveal { opacity: 1; translate: none; }
}
