/**
 * Fullscreen Hero Slider - front-end styles.
 *
 * All selectors are prefixed with `.fhs-` to avoid clashing with theme styles.
 * Visual values (height, colors, sizes) are driven by CSS custom properties
 * that the PHP renderer prints inline, so themes can override them easily.
 */

/* -------------------------------------------------------------------------
 * Root / layout
 * ---------------------------------------------------------------------- */
.fhs-slider {
	position: relative;
	/* Full-bleed: break out of theme content containers (block & classic
	 * themes such as Blocksy/FSE that constrain children to a content width)
	 * so the hero always spans the full viewport width. */
	width: 100vw;
	max-width: 100vw !important;
	margin-left: calc( 50% - 50vw ) !important;
	margin-right: calc( 50% - 50vw ) !important;
	height: auto !important;
	aspect-ratio: var( --fhs-current-aspect-ratio, var( --fhs-aspect-ratio, 16 / 9 ) );
	min-height: 0;
	overflow: hidden;
	background-color: transparent;
	color: #fff;
	isolation: isolate;
	-webkit-tap-highlight-color: transparent;
}

.fhs-slider *,
.fhs-slider *::before,
.fhs-slider *::after {
	box-sizing: border-box;
}

/* Theme container override.
 *
 * Some block/FSE themes apply constrained widths and auto margins to content
 * children. These selectors keep the shortcode output full-bleed.
 */
.entry-content.is-layout-constrained > .fhs-slider,
.entry-content > .fhs-slider,
.wp-block-post-content.is-layout-constrained > .fhs-slider,
.wp-block-post-content > .fhs-slider,
.is-layout-constrained > .fhs-slider,
.fhs-slider.alignfull {
	width: 100vw !important;
	max-width: 100vw !important;
	margin-left: calc( 50% - 50vw ) !important;
	margin-right: calc( 50% - 50vw ) !important;
}


.fhs-track {
	position: relative;
	width: 100%;
	height: 100%;
}

/* -------------------------------------------------------------------------
 * Slides - shared
 * ---------------------------------------------------------------------- */
.fhs-slide {
	position: relative;
	width: 100%;
	height: 100%;
	overflow: hidden;
}

/* Fade effect: stack every slide and cross-fade with opacity. */
.fhs-effect-fade .fhs-track {
	display: block;
}

.fhs-effect-fade .fhs-slide {
	position: absolute;
	inset: 0;
	opacity: 0;
	visibility: hidden;
	transition: opacity var( --fhs-speed, 600ms ) ease, visibility 0s linear var( --fhs-speed, 600ms );
	z-index: 1;
}

.fhs-effect-fade .fhs-slide.is-active {
	opacity: 1;
	visibility: visible;
	transition: opacity var( --fhs-speed, 600ms ) ease;
	z-index: 2;
}

/* Slide effect: lay slides in a flex row and translate the track. */
.fhs-effect-slide .fhs-track {
	display: flex;
	flex-wrap: nowrap;
	height: 100%;
	transition: transform var( --fhs-speed, 600ms ) ease;
	will-change: transform;
}

.fhs-effect-slide .fhs-slide {
	flex: 0 0 100%;
	min-width: 100%;
}

/* Single slide: no motion needed. */
.fhs-single .fhs-track {
	transition: none;
}

/* Disabled animation / reduced motion: kill all transitions. */
.fhs-no-anim .fhs-track,
.fhs-no-anim .fhs-slide {
	transition: none !important;
}

/* -------------------------------------------------------------------------
 * Background image
 * ---------------------------------------------------------------------- */
.fhs-bg {
	position: absolute;
	inset: 0;
	display: block;
	width: 100%;
	height: 100%;
	z-index: 0;
}

.fhs-bg-img {
	width: 100%;
	height: 100%;
	object-fit: contain; /* no crop in adaptive full-width mode */
	object-position: center center; /* overridden inline per slide */
	display: block;
}

/* Keep the actual image full-width without cropping.
 *
 * The slider height is calculated from the active image aspect ratio, so
 * `contain` fills the full width while preserving the complete image.
 */
.fhs-slider .fhs-bg,
.fhs-slider picture.fhs-bg {
	position: absolute !important;
	inset: 0 !important;
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
}

.fhs-slider .fhs-bg-img,
.fhs-slider .fhs-bg img {
	position: absolute !important;
	inset: 0 !important;
	display: block !important;
	width: 100% !important;
	max-width: none !important;
	height: 100% !important;
	max-height: none !important;
	margin: 0 !important;
	object-fit: contain !important;
}

/* -------------------------------------------------------------------------
 * Overlay
 * ---------------------------------------------------------------------- */
.fhs-overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	pointer-events: none;
}

/* -------------------------------------------------------------------------
 * Content
 * ---------------------------------------------------------------------- */
.fhs-content {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	padding: clamp( 1.5rem, 5vw, 6rem );
	color: var( --fhs-text, #fff );
}

.fhs-content-inner {
	width: 100%;
	max-width: 760px;
	display: flex;
	flex-direction: column;
	gap: 1rem;
}

/* Horizontal alignment. */
.fhs-align-left .fhs-content {
	justify-content: flex-start;
	text-align: left;
}

.fhs-align-center .fhs-content {
	justify-content: center;
	text-align: center;
}

.fhs-align-center .fhs-content-inner {
	margin-inline: auto;
	align-items: center;
}

.fhs-align-right .fhs-content {
	justify-content: flex-end;
	text-align: right;
}

.fhs-align-right .fhs-content-inner {
	margin-left: auto;
	align-items: flex-end;
}

/* Vertical alignment. */
.fhs-valign-top .fhs-content {
	align-items: flex-start;
}

.fhs-valign-middle .fhs-content {
	align-items: center;
}

.fhs-valign-bottom .fhs-content {
	align-items: flex-end;
}

/* -------------------------------------------------------------------------
 * Typography
 * ---------------------------------------------------------------------- */
.fhs-subtitle {
	margin: 0;
	font-size: var( --fhs-subtitle-size, 1.125rem );
	font-weight: 500;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	opacity: 0.9;
}

.fhs-title {
	margin: 0;
	font-size: var( --fhs-title-size, clamp( 2.25rem, 6vw, 4.5rem ) );
	line-height: 1.05;
	font-weight: 700;
}

.fhs-description {
	font-size: var( --fhs-desc-size, 1.125rem );
	line-height: 1.6;
}

.fhs-description p {
	margin: 0 0 0.75em;
}

.fhs-description p:last-child {
	margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * Buttons
 * ---------------------------------------------------------------------- */
.fhs-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem 1rem;
	margin-top: 0.5rem;
}

.fhs-align-center .fhs-buttons {
	justify-content: center;
}

.fhs-align-right .fhs-buttons {
	justify-content: flex-end;
}

.fhs-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0.85em 1.9em;
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	border-radius: 4px;
	border: 2px solid transparent;
	cursor: pointer;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.fhs-btn-1 {
	background-color: var( --fhs-btn, #fff );
	color: #111;
	border-color: var( --fhs-btn, #fff );
}

.fhs-btn-1:hover,
.fhs-btn-1:focus-visible {
	background-color: var( --fhs-btn-hover, #e5e5e5 );
	border-color: var( --fhs-btn-hover, #e5e5e5 );
	color: #111;
}

.fhs-btn-2 {
	background-color: transparent;
	color: var( --fhs-text, #fff );
	border-color: currentColor;
}

.fhs-btn-2:hover,
.fhs-btn-2:focus-visible {
	background-color: var( --fhs-btn-hover, rgba( 255, 255, 255, 0.15 ) );
}

/* -------------------------------------------------------------------------
 * Arrows
 * ---------------------------------------------------------------------- */
.fhs-arrow {
	position: absolute;
	top: 50%;
	transform: translateY( -50% );
	z-index: 5;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	height: 48px;
	padding: 0;
	color: #fff;
	background-color: rgba( 0, 0, 0, 0.35 );
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.fhs-arrow:hover,
.fhs-arrow:focus-visible {
	background-color: rgba( 0, 0, 0, 0.6 );
}

.fhs-arrow-prev {
	left: clamp( 0.5rem, 2vw, 1.5rem );
}

.fhs-arrow-next {
	right: clamp( 0.5rem, 2vw, 1.5rem );
}

/* -------------------------------------------------------------------------
 * Dots
 * ---------------------------------------------------------------------- */
.fhs-dots {
	position: absolute;
	left: 0;
	right: 0;
	bottom: clamp( 1rem, 3vh, 2.25rem );
	z-index: 5;
	display: flex;
	justify-content: center;
	gap: 0.65rem;
}

.fhs-dot {
	width: 12px;
	height: 12px;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background-color: transparent;
	cursor: pointer;
	transition: background-color 0.2s ease, transform 0.2s ease;
}

.fhs-dot:hover,
.fhs-dot:focus-visible {
	background-color: rgba( 255, 255, 255, 0.6 );
}

.fhs-dot.is-active {
	background-color: #fff;
	transform: scale( 1.15 );
}

/* -------------------------------------------------------------------------
 * Play / pause
 * ---------------------------------------------------------------------- */
.fhs-playpause {
	position: absolute;
	right: clamp( 0.5rem, 2vw, 1.5rem );
	bottom: clamp( 1rem, 3vh, 2.25rem );
	z-index: 5;
	width: 40px;
	height: 40px;
	padding: 0;
	color: #fff;
	background-color: rgba( 0, 0, 0, 0.35 );
	border: none;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.fhs-playpause:hover,
.fhs-playpause:focus-visible {
	background-color: rgba( 0, 0, 0, 0.6 );
}

.fhs-icon-pause,
.fhs-icon-play {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate( -50%, -50% );
}

/* Pause icon: two bars. */
.fhs-icon-pause {
	width: 12px;
	height: 14px;
	border-left: 4px solid currentColor;
	border-right: 4px solid currentColor;
}

/* Play icon: triangle. */
.fhs-icon-play {
	width: 0;
	height: 0;
	margin-left: 2px;
	border-top: 7px solid transparent;
	border-bottom: 7px solid transparent;
	border-left: 12px solid currentColor;
}

.fhs-playpause.is-playing .fhs-icon-play {
	display: none;
}

.fhs-playpause.is-playing .fhs-icon-pause {
	display: block;
}

.fhs-playpause.is-paused .fhs-icon-pause {
	display: none;
}

.fhs-playpause.is-paused .fhs-icon-play {
	display: block;
}

/* -------------------------------------------------------------------------
 * Focus visibility (accessibility)
 * ---------------------------------------------------------------------- */
.fhs-slider:focus-visible,
.fhs-btn:focus-visible,
.fhs-arrow:focus-visible,
.fhs-dot:focus-visible,
.fhs-playpause:focus-visible {
	outline: 3px solid #4f9dff;
	outline-offset: 2px;
}

/* -------------------------------------------------------------------------
 * Mobile overrides
 * ---------------------------------------------------------------------- */
@media ( max-width: 767px ) {
	.fhs-slider {
		height: auto !important;
		aspect-ratio: var( --fhs-current-aspect-ratio, var( --fhs-mobile-aspect-ratio, var( --fhs-aspect-ratio, 16 / 9 ) ) );
	}

	.fhs-bg-img {
		object-position: var( --fhs-m-object-position, center center );
	}

	.fhs-title {
		font-size: var( --fhs-m-title-size, var( --fhs-title-size, clamp( 2rem, 9vw, 2.75rem ) ) );
	}

	.fhs-description {
		font-size: var( --fhs-m-desc-size, var( --fhs-desc-size, 1rem ) );
	}

	.fhs-btn {
		font-size: var( --fhs-m-btn-size, 0.95rem );
	}

	/* Mobile content alignment overrides. */
	.fhs-m-align-left .fhs-content {
		justify-content: flex-start;
		text-align: left;
	}

	.fhs-m-align-left .fhs-content-inner {
		margin-inline: 0;
		align-items: flex-start;
	}

	.fhs-m-align-center .fhs-content {
		justify-content: center;
		text-align: center;
	}

	.fhs-m-align-center .fhs-content-inner {
		margin-inline: auto;
		align-items: center;
	}

	.fhs-m-align-right .fhs-content {
		justify-content: flex-end;
		text-align: right;
	}

	.fhs-m-align-right .fhs-content-inner {
		margin-left: auto;
		align-items: flex-end;
	}

	/* Mobile button layout. */
	.fhs-mbtn-column .fhs-buttons {
		flex-direction: column;
		align-items: stretch;
	}

	.fhs-mbtn-column .fhs-btn {
		width: 100%;
	}

	.fhs-mbtn-row .fhs-buttons {
		flex-direction: row;
	}

	.fhs-arrow {
		width: 40px;
		height: 40px;
	}
}

/* -------------------------------------------------------------------------
 * Reduced motion - respect the user's OS-level preference unconditionally.
 * ---------------------------------------------------------------------- */
@media ( prefers-reduced-motion: reduce ) {
	.fhs-track,
	.fhs-slide,
	.fhs-btn,
	.fhs-arrow,
	.fhs-dot {
		transition: none !important;
	}
}
