/* ===================================================================
   14. Hero slider

   Slides come from the Hero Slides post type via [fbh_hero_slider].
   The carousel only engages once the script sets .fbh-slider--ready, so
   with JavaScript unavailable every slide renders as a readable stacked
   block instead of an empty hero.
   =================================================================== */

.fbh-slider { position: relative; }

/* One height for every slide.
   Previously the container was resized to whichever slide was showing, so the
   whole page jumped on each transition. The track now holds a single fixed
   height and every slide is stacked absolutely inside it, which makes the
   height constant AND allows a true crossfade rather than a hard cut.
   The clamp keeps it from growing tall on a short viewport. */
.fbh-slider-track {
	position: relative;
	transition: none;
}

/* Kept deliberately tight: the brief was a hero that does not dominate the
   first screen. Track height plus this padding is the whole hero. */
.fbh-hero-inner { padding-top: clamp(1rem, 2.5vw, 1.5rem); padding-bottom: clamp(.75rem, 2vw, 1.25rem); }
@media (max-width: 781px) {
	.fbh-hero-inner { padding-top: .75rem; padding-bottom: .75rem; }
}

.fbh-slider:not(.fbh-slider--ready) .fbh-slide {
	display: grid;
	gap: 1rem;
	margin-bottom: 1.5rem;
}

.fbh-slider--ready .fbh-slider-track {
	height: clamp(360px, 46vh, 480px);
}

.fbh-slider--ready .fbh-slide {
	position: absolute;
	inset: 0;
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	align-items: center;
	gap: clamp(1rem, 3vw, 2rem);
	opacity: 0;
	visibility: hidden;
	/* The outgoing slide eases back and dims; the incoming one settles in from
	   a touch larger and slightly lower. Slow enough to read as a dissolve,
	   which is what makes it feel smooth rather than snappy. */
	transform: scale(1.015) translateY(6px);
	transition:
		opacity .75s cubic-bezier(.4, 0, .2, 1),
		transform .9s cubic-bezier(.2, .7, .3, 1),
		visibility .75s;
	will-change: opacity, transform;
}

.fbh-slider--ready .fbh-slide.is-active {
	opacity: 1;
	visibility: visible;
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.fbh-slider--ready .fbh-slide,
	.fbh-slider--ready .fbh-slide.is-active { transition: none; transform: none; }
}

/* The photograph fills the fixed box rather than dictating the height. */
.fbh-slide-media { position: relative; height: 100%; min-height: 0; }

.fbh-slide-media img {
	display: block;
	width: 100%;
	height: 100%;
	aspect-ratio: auto;
	object-fit: cover;
	object-position: center 32%;
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--wp--preset--shadow--lift);
	background: var(--wp--preset--color--surface-alt);
}

.fbh-slide-body { display: grid; gap: .75rem; align-content: center; min-height: 0; }
/* The eyebrow is a grid item, so it stretches to the full column unless it is
   told to hug its own text. */
.fbh-slide-body .fbh-eyebrow { justify-self: start; width: fit-content; max-width: 100%; }
.fbh-slide-title { margin: 0; text-wrap: balance; }
.fbh-slide-body .fbh-lede {
	margin: 0;
	font-size: clamp(1.02rem, .95rem + .45vw, 1.22rem);
	line-height: 1.6;
	color: var(--wp--preset--color--ink-soft);
	max-width: 34rem;
}
.fbh-slide-cta { margin: .25rem 0 0; }

@media (min-width: 782px) {
	.fbh-slider--ready .fbh-slide {
		grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
	}
	/* Alternate which side the photo sits on so stepping through does not
	   read as a stutter. */
	.fbh-slider--ready .fbh-slide:nth-child(even) .fbh-slide-media { order: 2; }
	.fbh-slide-title { font-size: clamp(1.9rem, 1.1rem + 2.4vw, 2.7rem); line-height: 1.12; }
	.fbh-slide-body .fbh-lede { font-size: 1.05rem; }
}

@media (max-width: 781px) {
	/* Phones overlay the copy ON the photograph rather than stacking it below.
	   Stacking was measured at 596px of text inside a 460px box on a 320px
	   screen: the body overflowed the hero and the call to action landed 130px
	   past its end. A full-bleed image with a scrim and the text set over the
	   bottom of it fits any height, keeps the section short, and is the
	   conventional shape for a phone hero. */
	.fbh-slider--ready .fbh-slider-track { height: clamp(340px, 52vh, 420px); }

	.fbh-slider--ready .fbh-slide {
		grid-template-columns: minmax(0, 1fr);
		align-content: end;
		gap: 0;
	}

	.fbh-slide-media {
		position: absolute;
		inset: 0;
		height: 100%;
		border-radius: var(--wp--custom--radius--lg);
		overflow: hidden;
	}

	.fbh-slide-media img {
		height: 100%;
		width: 100%;
		aspect-ratio: auto;
		object-fit: cover;
		object-position: center 28%;
		border-radius: 0;
		box-shadow: none;
	}

	/* Scrim, so white text stays legible over any photograph. */
	.fbh-slide-media::after {
		content: "";
		position: absolute;
		inset: 0;
		/* Weighted to the lower half, where the copy sits. The first version let
		   the supporting line land on light fur with no contrast at all. */
		background: linear-gradient(
			180deg,
			rgba(28, 25, 23, .08) 0%,
			rgba(28, 25, 23, .30) 34%,
			rgba(28, 25, 23, .62) 58%,
			rgba(28, 25, 23, .88) 100%
		);
	}

	.fbh-slide-body {
		position: relative;
		z-index: 2;
		padding: 1.15rem 1.15rem 1.25rem;
		color: #fff;
		gap: .5rem;
	}
	.fbh-slide-title {
		color: #fff;
		/* Sized to fit the box: at 320px this is 4 lines, which leaves room for
		   the eyebrow, two lines of supporting text and the button. */
		font-size: clamp(1.28rem, 1.08rem + 1.5vw, 1.58rem);
		line-height: 1.14;
		text-shadow: 0 1px 12px rgba(28, 25, 23, .35);
		text-wrap: normal;
	}
	/* Three pieces of text over a photograph is one too many, and the
	   supporting line was illegible wherever it fell on light fur, no matter
	   how hard the scrim was pushed. It is dropped on phones: the eyebrow,
	   headline and button are the message. The same sentence is readable in
	   full on desktop, and its content appears again in the page itself. */
	.fbh-slide-body .fbh-lede { display: none; }
	.fbh-slide-body .fbh-eyebrow { font-size: .68rem; padding: .3rem .65rem; margin: 0; }
	.fbh-slide-body { gap: .4rem; padding: 1rem 1rem 1.1rem; }
	.fbh-slide-body .fbh-eyebrow { background: rgba(255, 255, 255, .18); color: #fff; -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
	.fbh-slide-cta { margin: .35rem 0 0; }
}

/* ---- Controls ---- */

.fbh-slider-controls {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1rem;
	margin-top: clamp(1.25rem, 3vw, 1.75rem);
}

.fbh-slider-arrow {
	display: grid;
	place-items: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	border: 1px solid var(--wp--preset--color--border);
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	transition: background .15s ease, border-color .15s ease;
}
.fbh-slider-arrow:hover { background: var(--wp--preset--color--surface-alt); border-color: var(--wp--preset--color--primary); }
.fbh-slider-arrow svg {
	width: 1.25rem;
	height: 1.25rem;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.fbh-slider-dots { display: flex; align-items: center; gap: .5rem; }

.fbh-slider-dot {
	width: .6rem;
	height: .6rem;
	padding: 0;
	border: 0;
	border-radius: var(--wp--custom--radius--pill);
	background: var(--wp--preset--color--border);
	cursor: pointer;
	transition: background .15s ease, width .2s ease;
}
.fbh-slider-dot.is-active {
	background: var(--wp--preset--color--primary);
	width: 1.5rem;
}

/* Touch targets: the visible dot stays small, the tappable area does not. */
@media (pointer: coarse) {
	.fbh-slider-dot { position: relative; }
	.fbh-slider-dot::after {
		content: "";
		position: absolute;
		inset: -12px;
	}
}

.fbh-slider-arrow:focus-visible,
.fbh-slider-dot:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary-dark);
	outline-offset: 2px;
}

/* ---- Phones ---- */

@media (max-width: 699px) {
	.fbh-slider--ready .fbh-slide.is-active { gap: 1rem; }
	.fbh-slide-media img { aspect-ratio: 3 / 2; }
	.fbh-slide-body { gap: .6rem; }
	.fbh-slider-controls { gap: .75rem; margin-top: 1.15rem; }
	.fbh-slider-arrow { width: 2.5rem; height: 2.5rem; }
}
