/* =========================================================================
   SG Sermon Carousel
   Card look follows the sermon archive rows; every colour and size is a
   custom property so the Elementor style controls can change it.
   ========================================================================= */

.sgsr-carousel {
	--sgsr-per-view: 3;
	--sgsr-gap: 20px;
	--sgsr-offset: 80px;

	--sgsr-navy: #264c59;
	--sgsr-card-bg: transparent;
	--sgsr-border: #d4dae2;
	--sgsr-border-w: 2px;
	--sgsr-radius: 0px;
	--sgsr-media-gap: 0px;

	--sgsr-date-w: 110px;
	--sgsr-month-bg: var(--sgsr-navy);
	--sgsr-month-color: #fff;
	--sgsr-day-color: var(--sgsr-navy);

	--sgsr-title-color: #031920;
	--sgsr-title-hover: #f04b4b;
	--sgsr-meta-color: #031920;
	--sgsr-link-hover: #f04b4b;
	--sgsr-muted: #5b6f76;

	--sgsr-bar-w: 54px;
	--sgsr-bar-bg: #f04b4b;
	--sgsr-bar-bg-hover: #d93a3a;
	--sgsr-bar-icon: #fff;

	--sgsr-ratio: 16 / 9;
	--sgsr-video-radius: 0px;
	--sgsr-play-size: 64px;
	--sgsr-play-bg: rgba(240, 75, 75, .92);
	--sgsr-play-bg-hover: #f04b4b;
	--sgsr-play-icon: #fff;
	--sgsr-overlay: rgba(3, 25, 32, .15);

	--sgsr-arrow-size: 48px;
	--sgsr-arrow-color: #0c2340;
	--sgsr-arrow-color-hover: #f04b4b;
	--sgsr-arrow-bg: transparent;
	--sgsr-arrow-bg-hover: transparent;
	--sgsr-arrow-pad: 0px;
	--sgsr-arrow-radius: 0px;

	--sgsr-pagination-gap: 24px;
	--sgsr-dot-size: 10px;
	--sgsr-dot-color: #c5d0d6;
	--sgsr-dot-active: #0c2340;

	--sgsr-display-font: "brandon-grotesque", "Raleway", "Helvetica Neue", Helvetica, Arial, sans-serif;

	position: relative;
	padding-bottom: 70px;
	box-sizing: border-box;
	font-family: "Lato", sans-serif;
}

.sgsr-carousel *,
.sgsr-carousel *::before,
.sgsr-carousel *::after {
	box-sizing: border-box;
}

.sgsr-carousel__viewport {
	position: relative;
}

/* ---------- Swiper core (self-contained, so it works without Elementor's swiper.css) ---------- */
.sgsr-carousel .sgsr-swiper {
	position: relative;
	overflow: hidden;
	margin: 0;
	padding: 0;
	z-index: 1;
	list-style: none;
}

.sgsr-carousel .swiper-wrapper {
	position: relative;
	display: flex;
	width: 100%;
	height: auto;
	z-index: 1;
	box-sizing: content-box;
	transition-property: transform;
}

.sgsr-carousel .swiper-slide {
	position: relative;
	flex-shrink: 0;
	width: 100%;
	height: auto;
	transition-property: transform;
}

.sgsr-carousel.sgsr-natural .swiper-wrapper {
	align-items: flex-start;
}

/* Before the script runs (or if it never does): same layout, swipeable. */
.sgsr-carousel:not(.sgsr-ready) .swiper-wrapper {
	gap: var(--sgsr-gap);
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}
.sgsr-carousel:not(.sgsr-ready) .swiper-wrapper::-webkit-scrollbar {
	display: none;
}
.sgsr-carousel:not(.sgsr-ready) .swiper-slide {
	width: calc((100% - (var(--sgsr-per-view) - 1) * var(--sgsr-gap)) / var(--sgsr-per-view));
	scroll-snap-align: start;
}

/* Offset sides: let slides run past the container edges. */
.sgsr-carousel.sgsr-offset-both .sgsr-swiper {
	margin-left: calc(-1 * var(--sgsr-offset));
	margin-right: calc(-1 * var(--sgsr-offset));
}
.sgsr-carousel.sgsr-offset-left .sgsr-swiper {
	margin-left: calc(-1 * var(--sgsr-offset));
}
.sgsr-carousel.sgsr-offset-right .sgsr-swiper {
	margin-right: calc(-1 * var(--sgsr-offset));
}

/* ---------- Card ---------- */
.sgsr-card {
	container: sgsr-card / inline-size;
	display: flex;
	flex-direction: column;
	gap: var(--sgsr-media-gap);
	height: 100%;
	margin: 0;
	border-radius: var(--sgsr-radius);
	overflow: hidden;
	color: var(--sgsr-meta-color);
	font-size: 16px;
	line-height: 1.6;
	text-align: left;
}

.sgsr-card p {
	margin: 0;
	padding: 0;
}

/* Media (video / image) */
.sgsr-card__media {
	position: relative;
	display: block;
	width: 100%;
	aspect-ratio: var(--sgsr-ratio);
	overflow: hidden;
	border-radius: var(--sgsr-video-radius);
	background: #0c2340 linear-gradient(146deg, #0c2340 0%, #3c7d92 100%);
	flex: none;
}

@supports not (aspect-ratio: 1) {
	.sgsr-card__media { height: 0; padding-top: 56.25%; }
}

.sgsr-card__media img,
.sgsr-card__media iframe,
.sgsr-card__media video {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	border: 0;
	border-radius: 0;
	object-fit: cover;
	display: block;
}

.sgsr-card__media video {
	object-fit: contain;
	background: #000;
}

.sgsr-video__play {
	position: absolute;
	inset: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 100%;
	margin: 0;
	padding: 0;
	border: 0 !important;
	border-radius: 0 !important;
	background: var(--sgsr-overlay) !important;
	box-shadow: none !important;
	cursor: pointer;
	transition: background-color .2s ease;
}

.sgsr-video__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--sgsr-play-size);
	height: var(--sgsr-play-size);
	border-radius: 50%;
	background: var(--sgsr-play-bg);
	color: var(--sgsr-play-icon);
	box-shadow: 0 6px 18px rgba(0, 0, 0, .25);
	transition: transform .2s ease, background-color .2s ease;
}

.sgsr-video__icon svg {
	width: 46%;
	height: 46%;
	margin-left: 6%;
}

.sgsr-video__play:hover .sgsr-video__icon,
.sgsr-video__play:focus-visible .sgsr-video__icon {
	background: var(--sgsr-play-bg-hover);
	transform: scale(1.08);
}

.sgsr-video__play:focus-visible {
	outline: 3px solid var(--sgsr-play-bg-hover) !important;
	outline-offset: -3px;
}

/* Details row: date | info | play bar */
.sgsr-card__body {
	position: relative;
	display: grid;
	grid-template-columns: calc(var(--sgsr-date-w) + var(--sgsr-date-gap, 15px)) minmax(0, 1fr) var(--sgsr-bar-w);
	flex: 1 1 auto;
	min-height: 108px;
}

.sgsr-card--no-date .sgsr-card__body {
	grid-template-columns: minmax(0, 1fr) var(--sgsr-bar-w);
}
.sgsr-card--no-bar .sgsr-card__body {
	grid-template-columns: calc(var(--sgsr-date-w) + var(--sgsr-date-gap, 15px)) minmax(0, 1fr);
}
.sgsr-card--no-date.sgsr-card--no-bar .sgsr-card__body {
	grid-template-columns: minmax(0, 1fr);
}

/* Date block (the gap sits on the date so the play bar stays attached to the info box) */
.sgsr-card__date {
	margin-right: var(--sgsr-date-gap, 15px);
	display: flex;
	flex-direction: column;
	text-align: center;
	font-family: var(--sgsr-display-font);
	font-size: 24px;
	line-height: 36px;
	font-style: normal;
}

.sgsr-card__month {
	display: block;
	white-space: nowrap;
	padding: 5px 0;
	background: var(--sgsr-month-bg);
	color: var(--sgsr-month-color);
	text-transform: uppercase;
}

.sgsr-card__day {
	display: flex;
	flex: 1;
	align-items: center;
	justify-content: center;
	padding: 12px 0;
	color: var(--sgsr-day-color);
	border: var(--sgsr-border-w) solid var(--sgsr-border);
	border-top: 0;
}

/* Info box (outlined on three sides, the play bar closes it on the right) */
.sgsr-card__info {
	display: flex;
	flex-direction: column;
	justify-content: center;
	gap: 2px;
	min-width: 0;
	padding: 15px 20px;
	background: var(--sgsr-card-bg);
	border: var(--sgsr-border-w) solid var(--sgsr-border);
	border-right: 0;
}

.sgsr-card--no-bar .sgsr-card__info {
	border-right: var(--sgsr-border-w) solid var(--sgsr-border);
}

.sgsr-card .sgsr-card__title {
	margin: 0 0 2px;
	padding: 0;
	font-family: "Raleway", sans-serif;
	font-size: 24px;
	font-weight: 400;
	line-height: 1.25;
	letter-spacing: normal;
	text-transform: none;
	color: var(--sgsr-title-color);
	overflow-wrap: anywhere;
}

.sgsr-card .sgsr-card__title a {
	color: inherit !important;
	text-decoration: none !important;
	transition: color .2s ease;
}

/* Whole details row is one link target. */
.sgsr-card__link::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

.sgsr-card__body:hover .sgsr-card__title {
	color: var(--sgsr-title-hover);
}

.sgsr-card__body:has(.sgsr-card__link:focus-visible) {
	outline: 2px solid var(--sgsr-bar-bg);
	outline-offset: 3px;
}
.sgsr-card__link:focus-visible {
	outline: none;
}

.sgsr-card__title--hidden {
	font-size: 0 !important;
	line-height: 0 !important;
	margin: 0 !important;
}

.sgsr-card__meta {
	font-size: 15px;
	line-height: 1.5;
	color: var(--sgsr-meta-color);
}

.sgsr-card__sep {
	margin: 0 .4em;
}

.sgsr-card__excerpt {
	margin-top: 4px !important;
	font-size: 14px;
	line-height: 1.5;
	color: var(--sgsr-muted);
}

.sgsr-card__series {
	margin-top: 2px !important;
	font-size: 12px;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--sgsr-muted);
}

/* Secondary links stay clickable above the row link. */
.sgsr-card__meta a,
.sgsr-card__series a {
	position: relative;
	z-index: 2;
	color: inherit !important;
	text-decoration: none !important;
	transition: color .2s ease;
}
.sgsr-card__meta a:hover,
.sgsr-card__series a:hover,
.sgsr-card__meta a:focus-visible,
.sgsr-card__series a:focus-visible {
	color: var(--sgsr-link-hover) !important;
}

/* Red play bar */
.sgsr-card__bar {
	display: flex;
	align-items: center;
	justify-content: center;
	background: var(--sgsr-bar-bg);
	color: var(--sgsr-bar-icon);
	transition: background-color .2s ease;
}
.sgsr-card__bar svg {
	width: 24px;
	height: 24px;
}
.sgsr-card__body:hover .sgsr-card__bar {
	background: var(--sgsr-bar-bg-hover);
}

/* Narrow cards (phones, or many slides per view): tighter layout.
   Sized by the card itself, not the screen, so it adapts in any column. */
@container sgsr-card (max-width: 460px) {
	.sgsr-card__body {
		grid-template-columns: calc(68px + var(--sgsr-date-gap, 10px)) minmax(0, 1fr) 40px;
		min-height: 92px;
	}
	.sgsr-card--no-date .sgsr-card__body { grid-template-columns: minmax(0, 1fr) 40px; }
	.sgsr-card--no-bar .sgsr-card__body { grid-template-columns: calc(68px + var(--sgsr-date-gap, 10px)) minmax(0, 1fr); }
	.sgsr-card--no-date.sgsr-card--no-bar .sgsr-card__body { grid-template-columns: minmax(0, 1fr); }
	.sgsr-card__date { margin-right: var(--sgsr-date-gap, 10px); font-size: 18px; line-height: 26px; }
	.sgsr-card__day { padding: 8px 0; }
	.sgsr-card__month { font-size: 15px; letter-spacing: -.01em; }
	.sgsr-card__info { padding: 12px 14px; }
	.sgsr-card .sgsr-card__title { font-size: 20px; }
	.sgsr-card__meta { font-size: 14px; }
	.sgsr-card__excerpt { font-size: 13px; }
	.sgsr-card__bar svg { width: 20px; height: 20px; }
	.sgsr-video__icon { width: calc(var(--sgsr-play-size) * .8); height: calc(var(--sgsr-play-size) * .8); }
}

/* ---------- Arrows ---------- */
.sgsr-arrow {
	position: absolute;
	z-index: 5;
	display: flex;
	align-items: center;
	justify-content: center;
	width: auto;
	height: auto;
	min-width: 0;
	margin: 0;
	padding: var(--sgsr-arrow-pad) !important;
	border: 0 !important;
	border-radius: var(--sgsr-arrow-radius) !important;
	background: var(--sgsr-arrow-bg) !important;
	color: var(--sgsr-arrow-color) !important;
	font-size: var(--sgsr-arrow-size);
	line-height: 1;
	box-shadow: none !important;
	cursor: pointer;
	transition: color .2s ease, background-color .2s ease, opacity .2s ease;
}

.sgsr-arrow:hover,
.sgsr-arrow:focus-visible {
	color: var(--sgsr-arrow-color-hover) !important;
	background: var(--sgsr-arrow-bg-hover) !important;
}

.sgsr-arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.sgsr-arrow svg,
.sgsr-arrow i {
	display: block;
	width: var(--sgsr-arrow-size);
	height: var(--sgsr-arrow-size);
	font-size: var(--sgsr-arrow-size);
	line-height: 1;
	fill: currentColor;
	color: inherit;
}

.sgsr-arrow i::before {
	display: block;
	line-height: 1;
}

.sgsr-arrow--prev {
	left: var(--sgsr-prev-left, var(--sgsr-prev-h, 0px));
	right: var(--sgsr-prev-right, auto);
	top: var(--sgsr-prev-top, auto);
	bottom: var(--sgsr-prev-bottom, var(--sgsr-prev-v, -70px));
	transform: translate(var(--sgsr-prev-tx, 0%), var(--sgsr-prev-ty, 0%));
}

.sgsr-arrow--next {
	left: var(--sgsr-next-left, auto);
	right: var(--sgsr-next-right, var(--sgsr-next-h, 0px));
	top: var(--sgsr-next-top, auto);
	bottom: var(--sgsr-next-bottom, var(--sgsr-next-v, -70px));
	transform: translate(var(--sgsr-next-tx, 0%), var(--sgsr-next-ty, 0%));
}

.sgsr-arrow.swiper-button-disabled {
	opacity: .35;
	cursor: default;
}

.sgsr-arrow.swiper-button-lock,
.sgsr-carousel:not(.sgsr-ready) .sgsr-arrow {
	display: none;
}

/* ---------- Pagination ---------- */
.sgsr-pagination {
	position: relative;
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin-top: var(--sgsr-pagination-gap);
	line-height: 1;
}

.sgsr-pagination.swiper-pagination-lock {
	display: none;
}

.sgsr-pagination .swiper-pagination-bullet {
	display: block;
	width: var(--sgsr-dot-size);
	height: var(--sgsr-dot-size);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--sgsr-dot-color);
	opacity: 1;
	cursor: pointer;
	transition: background-color .2s ease, transform .2s ease;
}

.sgsr-pagination .swiper-pagination-bullet-active {
	background: var(--sgsr-dot-active);
	transform: scale(1.2);
}

.sgsr-pagination.swiper-pagination-fraction {
	color: var(--sgsr-dot-active);
	font-size: 15px;
	gap: 4px;
}

.sgsr-pagination.swiper-pagination-progressbar {
	display: block;
	height: 4px;
	background: var(--sgsr-dot-color);
	overflow: hidden;
}

.sgsr-pagination .swiper-pagination-progressbar-fill {
	position: absolute;
	inset: 0;
	background: var(--sgsr-dot-active);
	transform-origin: left top;
	transform: scale(0);
}

/* ---------- Helpers ---------- */
.sgsr-sr {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	margin: -1px !important;
	padding: 0 !important;
	overflow: hidden !important;
	clip: rect(0 0 0 0) !important;
	white-space: nowrap !important;
	border: 0 !important;
}

.sgsr-empty {
	padding: 24px;
	border: 2px dashed #d4dae2;
	text-align: center;
	color: #5b6f76;
}

@media (prefers-reduced-motion: reduce) {
	.sgsr-carousel *,
	.sgsr-carousel *::before,
	.sgsr-carousel *::after {
		transition-duration: .01ms !important;
	}
}
