/* ==========================================================================
   UB SLIDER - FRONTEND STYLES
   ========================================================================== */

/* Custom property for header height - can be overridden in theme */
:root {
	--ub-slider-header-height: 180px;
	--ub-slider-header-height-tablet: 200px;
	--ub-slider-header-height-desktop: 140px;
	--ub-slider-header-height-mobile: 160px;
}

.ub-slider {
	position: relative;
	width: 100%;
	overflow: hidden;
	z-index: 1;
}

/* Hero Mode - Full bleed behind menu */
.ub-slider--hero {
	position: relative;
	/* Pull up to top of screen behind header - use larger value to accommodate multi-line menus */
	margin-top: calc(-1 * (var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height)));
	padding-top: 0;
	/* Break out of container to full width */
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
	/* Ensure slider stays below header */
	z-index: 1;
}

.ub-slider--hero .ub-slide {
	/* Content padding to account for header - matches margin-top */
	padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height));
}

/* Full width when aligned */
.ub-slider.alignfull {
	width: 100vw;
	max-width: 100vw;
	margin-left: calc(50% - 50vw);
	margin-right: calc(50% - 50vw);
}

.ub-slider.alignwide {
	width: 100%;
	max-width: 75rem;
}

/* ==========================================================================
   SLIDER VIEWPORT & TRACK
   ========================================================================== */

.ub-slider__viewport {
	position: relative;
	width: 100%;
	overflow: hidden;
}

.ub-slider__track {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	width: 100%;
	will-change: transform;
}

/* Slide transition - default is slide */
.ub-slider--desktop-slide .ub-slider__track,
.ub-slider--mobile-slide .ub-slider__track {
	-webkit-transition: -webkit-transform 0.5s ease-in-out;
	transition: -webkit-transform 0.5s ease-in-out;
	transition: transform 0.5s ease-in-out;
	transition: transform 0.5s ease-in-out, -webkit-transform 0.5s ease-in-out;
}

/* ==========================================================================
   FADE TRANSITION
   ========================================================================== */

/* Desktop fade */
@media (min-width: 781px) {
	.ub-slider--desktop-fade .ub-slider__track {
		display: block;
		position: relative;
	}

	.ub-slider--desktop-fade .ub-slide {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		opacity: 0;
		visibility: hidden;
		-webkit-transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
		transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
		z-index: 1;
	}

	.ub-slider--desktop-fade .ub-slide:first-child {
		position: relative;
	}

	.ub-slider--desktop-fade .ub-slide--active {
		opacity: 1;
		visibility: visible;
		z-index: 2;
	}

	.ub-slider--desktop-fade .ub-slide--exiting {
		opacity: 0;
		visibility: visible;
		z-index: 1;
	}
}

/* Mobile fade */
@media (max-width: 780px) {
	.ub-slider--mobile-fade .ub-slider__track {
		display: block;
		position: relative;
	}

	.ub-slider--mobile-fade .ub-slide {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		opacity: 0;
		visibility: hidden;
		-webkit-transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
		transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
		z-index: 1;
	}

	.ub-slider--mobile-fade .ub-slide:first-child {
		position: relative;
	}

	.ub-slider--mobile-fade .ub-slide--active {
		opacity: 1;
		visibility: visible;
		z-index: 2;
	}

	.ub-slider--mobile-fade .ub-slide--exiting {
		opacity: 0;
		visibility: visible;
		z-index: 1;
	}
}

/* ==========================================================================
   NAVIGATION - DESKTOP (arrows on either side of dots)
   ========================================================================== */

.ub-slider__navigation {
	position: absolute;
	bottom: 1.5rem;
	right: 1.5rem;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	gap: 0.5rem;
	z-index: 10;
	background-color: rgba(255, 255, 255, 0.95);
	padding: 0.5rem 1rem;
	border-radius: 2rem;
	-webkit-box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
	        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* Arrow buttons */
.ub-slider__arrow {
	width: 2.5rem;
	height: 2.5rem;
	display: -webkit-inline-box;
	display: -ms-inline-flexbox;
	display: inline-flex;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	background: transparent;
	border: 2px solid #002e5a;
	border-radius: 50%;
	cursor: pointer;
	padding: 0;
	color: #002e5a;
	-webkit-transition: all 0.2s ease;
	transition: all 0.2s ease;
}

.ub-slider__arrow:hover {
	background-color: #002e5a;
	color: #ffffff;
}

.ub-slider__arrow svg {
	width: 1.25rem;
	height: 1.25rem;
}

/* Dots */
.ub-slider__dots.carousel-dots {
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	gap: 0.5rem;
	padding: 0 0.5rem;
}

.ub-slider__dots .carousel-dot {
	width: 0.625rem;
	height: 0.625rem;
	border-radius: 50%;
	background-color: #002e5a;
	border: none;
	cursor: pointer;
	padding: 0;
	-webkit-transition: background-color 0.3s ease, -webkit-transform 0.2s ease;
	transition: background-color 0.3s ease, -webkit-transform 0.2s ease;
	transition: background-color 0.3s ease, transform 0.2s ease;
	transition: background-color 0.3s ease, transform 0.2s ease, -webkit-transform 0.2s ease;
}

.ub-slider__dots .carousel-dot:hover {
	-webkit-transform: scale(1.2);
	        transform: scale(1.2);
}

.ub-slider__dots .carousel-dot.active {
	background-color: #F980B1;
}

/* ==========================================================================
   RESPONSIVE - MOBILE
   ========================================================================== */

@media (max-width: 780px) {
	/* Hero mode adjustments for mobile - smaller header */
	.ub-slider--hero {
		margin-top: calc(-1 * (var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height-mobile)));
	}

	.ub-slider--hero .ub-slide {
		padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height-mobile));
	}

	/* Navigation below slider on mobile */
	.ub-slider__navigation {
		position: relative;
		bottom: auto;
		right: auto;
		-webkit-box-pack: center;
		    -ms-flex-pack: center;
		        justify-content: center;
		margin: 0 auto;
		padding: 1rem 1.5rem;
		border-radius: 2rem;
		background-color: rgba(255, 255, 255, 0.95);
		width: -webkit-fit-content;
		width: -moz-fit-content;
		width: fit-content;
		margin-top: -2rem;
		z-index: 10;
	}

	/* Hero mode - navigation outside the slider area */
	.ub-slider--hero .ub-slider__navigation {
		position: relative;
		bottom: auto;
		right: auto;
		margin-top: 1rem;
		background-color: transparent;
		-webkit-box-shadow: none;
		        box-shadow: none;
	}

	.ub-slider--hero .ub-slider__arrow {
		border-color: #3b3c43;
		color: #3b3c43;
	}

	.ub-slider--hero .ub-slider__arrow:hover {
		background-color: #3b3c43;
		color: #ffffff;
	}

	.ub-slider--hero .ub-slider__dots .carousel-dot {
		background-color: #3b3c43;
	}

	.ub-slider--hero .ub-slider__dots .carousel-dot.active {
		background-color: #F980B1;
	}

	.ub-slider__arrow {
		width: 2.25rem;
		height: 2.25rem;
	}

	.ub-slider__arrow svg {
		width: 1rem;
		height: 1rem;
	}

	.ub-slider__dots .carousel-dot {
		width: 0.5rem;
		height: 0.5rem;
	}
}

/* Tablet - menu may wrap to 2 lines */
@media (min-width: 781px) and (max-width: 1100px) {
	.ub-slider--hero {
		margin-top: calc(-1 * (var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height-tablet)));
	}

	.ub-slider--hero .ub-slide {
		padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height-tablet));
	}
}

/* Large desktop - single line menu */
@media (min-width: 1101px) {
	.ub-slider--hero {
		margin-top: calc(-1 * (var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height-desktop)));
	}

	.ub-slider--hero .ub-slide {
		padding-top: calc(var(--wp-admin--admin-bar--height, 0px) + var(--ub-slider-header-height-desktop));
	}
}

/* ==========================================================================
   ACCESSIBILITY
   ========================================================================== */

.ub-slider__arrow:focus,
.ub-slider__dots .carousel-dot:focus {
	outline: 2px solid #002e5a;
	outline-offset: 2px;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.ub-slider__track,
	.ub-slide,
	.ub-slider__arrow,
	.ub-slider__dots .carousel-dot {
		-webkit-transition: none !important;
		transition: none !important;
	}
}

/* ==========================================================================
   SLIDE STYLES
   ========================================================================== */

.ub-slide {
	position: relative;
	-webkit-box-flex: 0;
	    -ms-flex: 0 0 100%;
	        flex: 0 0 100%;
	width: 100%;
	display: -webkit-box;
	display: -ms-flexbox;
	display: flex;
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
	overflow: hidden;
}

/* Background layer */
.ub-slide__background {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1;
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

/* Video background */
.ub-slide__video {
	position: absolute;
	top: 50%;
	left: 50%;
	min-width: 100%;
	min-height: 100%;
	width: auto;
	height: auto;
	-webkit-transform: translate(-50%, -50%);
	        transform: translate(-50%, -50%);
	-o-object-fit: cover;
	   object-fit: cover;
}

/* Overlay layer */
.ub-slide__overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 2;
	pointer-events: none;
}

/* Content layer */
.ub-slide__content {
	position: relative;
	z-index: 3;
	width: 100%;
	max-width: 75rem;
	margin: 0 auto;
	padding: 2rem;
}

.ub-slide__content-inner {
	max-width: 52.5rem;
}

/* Content alignment - horizontal */
.ub-slide--align-left .ub-slide__content-inner {
	margin-left: 0;
	margin-right: auto;
	text-align: left;
}

.ub-slide--align-center .ub-slide__content-inner {
	margin-left: auto;
	margin-right: auto;
	text-align: center;
}

.ub-slide--align-right .ub-slide__content-inner {
	margin-left: auto;
	margin-right: 0;
	text-align: right;
}

/* Content alignment - vertical */
.ub-slide--valign-top {
	-webkit-box-align: start;
	    -ms-flex-align: start;
	        align-items: flex-start;
}

.ub-slide--valign-center {
	-webkit-box-align: center;
	    -ms-flex-align: center;
	        align-items: center;
}

.ub-slide--valign-bottom {
	-webkit-box-align: end;
	    -ms-flex-align: end;
	        align-items: flex-end;
}

/* Default slide text colors (can be overridden by block settings) */
.ub-slide h1,
.ub-slide h2,
.ub-slide h3,
.ub-slide h4,
.ub-slide h5,
.ub-slide h6 {
	color: #ffffff;
}

.ub-slide p {
	color: #ffffff;
}

/* Ensure buttons align properly based on slide alignment */
.ub-slide--align-left .wp-block-buttons {
	-webkit-box-pack: start;
	    -ms-flex-pack: start;
	        justify-content: flex-start;
}

.ub-slide--align-center .wp-block-buttons {
	-webkit-box-pack: center;
	    -ms-flex-pack: center;
	        justify-content: center;
}

.ub-slide--align-right .wp-block-buttons {
	-webkit-box-pack: end;
	    -ms-flex-pack: end;
	        justify-content: flex-end;
}

/* ==========================================================================
   SLIDE RESPONSIVE
   ========================================================================== */

@media (max-width: 780px) {
	.ub-slide__content {
		padding: 1.5rem;
	}

	.ub-slide__content-inner {
		max-width: 100%;
	}

	/* Force center alignment on mobile for better UX */
	.ub-slide--align-left .ub-slide__content-inner,
	.ub-slide--align-right .ub-slide__content-inner {
		margin-left: auto;
		margin-right: auto;
		text-align: center;
	}

	.ub-slide--align-left .wp-block-buttons,
	.ub-slide--align-right .wp-block-buttons {
		-webkit-box-pack: center;
		    -ms-flex-pack: center;
		        justify-content: center;
	}
}
