/* ==========================================================
   Latest Articles Carousel
   ========================================================== */

.latest-articles-carousel {
	--article-carousel-gap: 30px;

	position: relative;
	padding: 80px 0;
	overflow: hidden;
}


/* ==========================================================
   Heading area
   ========================================================== */

.latest-articles-carousel__header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 40px;
	margin-bottom: 40px;
}

.latest-articles-carousel__heading-wrap {
	width: 100%;
	max-width: 800px;
}

.latest-articles-carousel__eyebrow {
	margin-bottom: 12px;
	font-size: 16px;
	line-height: 1.4;
}

.latest-articles-carousel__heading {
	margin: 0;
}

.latest-articles-carousel__introduction {
	margin-top: 15px;
}

.latest-articles-carousel__introduction > :last-child {
	margin-bottom: 0;
}

.latest-articles-carousel__archive-link {
	flex: 0 0 auto;
	margin-bottom: 4px;
	color: #f15a24;
	text-decoration: none;
	white-space: nowrap;
	transition:
		color 200ms ease,
		opacity 200ms ease;
}

.latest-articles-carousel__archive-link:hover,
.latest-articles-carousel__archive-link:focus {
	color: #c94112;
	text-decoration: none;
}


/* ==========================================================
   Carousel stage
   ========================================================== */

/*
 * Starts at the left edge of the Bootstrap container and extends
 * to the right edge of the browser.
 */
.latest-articles-carousel__stage {
	position: relative;
	width: calc(50vw + 50%);
	max-width: none;
}


/* ==========================================================
   Carousel viewport
   ========================================================== */

.latest-articles-carousel__viewport {
	position: relative;
	width: 100%;
	overflow-x: auto;
	overflow-y: hidden;
	scroll-behavior: smooth;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
	overscroll-behavior-inline: contain;
	-webkit-overflow-scrolling: touch;
}

.latest-articles-carousel__viewport::-webkit-scrollbar {
	display: none;
}

.latest-articles-carousel__viewport:focus {
	outline: none;
}


/* ==========================================================
   Carousel track
   ========================================================== */

/*
 * The track must remain width: 100%.
 *
 * Its flex children overflow horizontally, creating the carousel.
 * Do not use width: max-content on this element because the
 * percentage-based card widths would then calculate incorrectly.
 */
.latest-articles-carousel__track {
	display: flex;
	flex-flow: row nowrap;
	align-items: stretch;
	gap: var(--article-carousel-gap);
	width: 100%;
	min-width: 100%;
}


/* ==========================================================
   Carousel slides
   ========================================================== */

/*
 * Desktop:
 * Three full cards plus half of the fourth.
 *
 * Card width calculation:
 * (100% - three 30px gaps) / 3.5
 */
.latest-articles-carousel__slide {
	display: flex;
	flex: 0 0 calc(28.5714286% - 25.7142857px);
	width: calc(28.5714286% - 25.7142857px);
	min-width: 0;
	max-width: none;
	scroll-snap-align: start;
}


/* ==========================================================
   Reset archive Bootstrap columns inside each slide
   ========================================================== */

/*
 * bom_render_article_card() returns the Bootstrap column used
 * by the Articles archive. Inside this carousel, that column
 * must occupy the full carousel slide.
 */
.latest-articles-carousel__slide > * {
	display: flex;
	flex: 0 0 100% !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0;
	margin: 0 !important;
	padding-right: 0 !important;
	padding-left: 0 !important;
}

/*
 * Covers the card renderer if it outputs a row before the
 * Bootstrap column.
 */
.latest-articles-carousel__slide > .row {
	display: flex;
	flex: 0 0 100%;
	width: 100%;
	max-width: 100%;
	margin-right: 0 !important;
	margin-left: 0 !important;
}

.latest-articles-carousel__slide > .row > [class*="col-"] {
	display: flex;
	flex: 0 0 100% !important;
	width: 100% !important;
	max-width: 100% !important;
	min-width: 0;
	margin: 0 !important;
	padding-right: 0 !important;
	padding-left: 0 !important;
}

/*
 * Ensure the existing archive card fills its carousel slide.
 */
.latest-articles-carousel__slide > * > *,
.latest-articles-carousel__slide > .row > [class*="col-"] > * {
	width: 100%;
}


/* ==========================================================
   Overlay carousel controls
   ========================================================== */

.latest-articles-carousel__controls {
	position: absolute;
	inset: 0;
	z-index: 20;
	pointer-events: none;
}

.latest-articles-carousel__button {
	position: absolute;
	top: 50%;
	z-index: 2;
	display: block;
	padding: 0;
	margin: 0;
	background: transparent;
	border: 0;
	border-radius: 50%;
	box-shadow: none;
	transform: translateY(-50%);
	appearance: none;
	cursor: pointer;
	pointer-events: auto;
}

.latest-articles-carousel__button--previous {
	left: 20px;
}

.latest-articles-carousel__button--next {
	right: 20px;
}


/* ==========================================================
   Testimonial-style arrow
   ========================================================== */

/*
 * position: static !important prevents global testimonial styles
 * from positioning the span independently of the button.
 */
.latest-articles-carousel__button .testimonial-arrow {
	position: static !important;
	inset: auto !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 50px;
	height: 50px;
	padding: 0;
	margin: 0;
	color: #0b3f75;
	background-color: #fff;
	border: 0;
	border-radius: 50%;
	transform: none;
	transition:
		color 200ms ease,
		background-color 200ms ease,
		transform 200ms ease;
}

.latest-articles-carousel__button .testimonial-arrow i {
	position: static;
	display: block;
	margin: 0;
	font-size: 18px;
	line-height: 1;
	pointer-events: none;
}

.latest-articles-carousel__button:hover .testimonial-arrow,
.latest-articles-carousel__button:focus-visible .testimonial-arrow {
	color: #fff;
	background-color: #f7ab22;
	transform: scale(1.05);
}

.latest-articles-carousel__button:focus {
	outline: none;
}

.latest-articles-carousel__button:focus-visible .testimonial-arrow {
	outline: 3px solid rgba(0, 116, 201, 0.35);
	outline-offset: 3px;
}


/* ==========================================================
   Tablet: two full cards plus half of the third
   ========================================================== */

@media (max-width: 1199.98px) {

	.latest-articles-carousel {
		--article-carousel-gap: 24px;
	}

	.latest-articles-carousel__slide {
		/*
		 * (100% - two 24px gaps) / 2.5
		 */
		flex-basis: calc(40% - 19.2px);
		width: calc(40% - 19.2px);
	}

	.latest-articles-carousel__button--previous {
		left: 15px;
	}

	.latest-articles-carousel__button--next {
		right: 15px;
	}
}


/* ==========================================================
   Mobile: one full card plus part of the second
   ========================================================== */

@media (max-width: 767.98px) {

	.latest-articles-carousel {
		--article-carousel-gap: 20px;

		padding: 60px 0;
	}

	.latest-articles-carousel__header {
		flex-direction: column;
		align-items: flex-start;
		gap: 20px;
		margin-bottom: 30px;
	}

	.latest-articles-carousel__archive-link {
		margin-bottom: 0;
	}

	.latest-articles-carousel__slide {
		/*
		 * Approximately 1.2 visible cards.
		 */
		flex-basis: calc(83.3333333% - 16.6666667px);
		width: calc(83.3333333% - 16.6666667px);
	}

	.latest-articles-carousel__button--previous {
		left: 10px;
	}

	.latest-articles-carousel__button--next {
		right: 10px;
	}

	.latest-articles-carousel__button .testimonial-arrow {
		width: 44px;
		height: 44px;
	}

	.latest-articles-carousel__button .testimonial-arrow i {
		font-size: 16px;
	}
}


/* ==========================================================
   Reduced motion
   ========================================================== */

@media (prefers-reduced-motion: reduce) {

	.latest-articles-carousel__viewport {
		scroll-behavior: auto;
	}

	.latest-articles-carousel__button .testimonial-arrow,
	.latest-articles-carousel__archive-link {
		transition: none;
	}
}