/* Cerium Gallery Slider — front end */

.cgsl-grid {
	display: grid;
	grid-template-columns: repeat(var(--cgsl-columns, 2), minmax(0, 1fr));
	gap: var(--cgsl-gap, 40px);
	width: 100%;
	max-width: 100%;
}

.cgsl-grid-single {
	grid-template-columns: minmax(0, 1fr);
}

/* 766px and down: one column. 767px and up: the configured column count. */
@media (max-width: 766px) {
	.cgsl-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}

.cgsl-gallery {
	min-width: 0;
	max-width: 100%;
	/*
	 * Keeps a sticky header from covering the gallery when a URL link
	 * scrolls to it. scroll-margin-top affects scrolling only, never layout.
	 */
	scroll-margin-top: var(--cgsl-scroll-offset, 80px);
}

.cgsl-title {
	margin: 0 0 12px;
	text-align: center;
}

/* Stage: arrow | image | arrow */
.cgsl-stage {
	display: flex;
	align-items: center;
	gap: calc(var(--cgsl-arrow-gap, 16px) * var(--cgsl-arrow-scale, 1));
	position: relative;
	min-width: 0;
}

.cgsl-viewport {
	position: relative;
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	aspect-ratio: var(--cgsl-ratio, 4 / 3);
}

.cgsl-track {
	display: flex;
	width: 100%;
	transition: transform 450ms cubic-bezier(0.25, 0.8, 0.35, 1);
	will-change: transform;
}

.cgsl-slide {
	flex: 0 0 100%;
	width: 100%;
	min-width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
}

/*
 * Natural height is the baseline, so the slider is always visible even if
 * aspect-ratio never applies. The fixed-frame treatment is layered on top.
 */
.cgsl-slide img,
img.cgsl-image {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
	object-fit: var(--cgsl-fit, contain);
	object-position: center;
	margin: 0;
}

@supports (aspect-ratio: 1 / 1) {
	.cgsl-grid:not(.cgsl-ratio-auto) .cgsl-track,
	.cgsl-grid:not(.cgsl-ratio-auto) .cgsl-slide {
		height: 100%;
	}

	.cgsl-grid:not(.cgsl-ratio-auto) .cgsl-slide img,
	.cgsl-grid:not(.cgsl-ratio-auto) img.cgsl-image {
		height: 100%;
	}
}

/* Natural-height mode */
.cgsl-ratio-auto .cgsl-viewport {
	aspect-ratio: auto;
}

.cgsl-ratio-auto .cgsl-slide {
	align-items: flex-start;
}

/* Arrows */
.cgsl-gallery .cgsl-arrow {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: calc(var(--cgsl-arrow-size, 40px) * var(--cgsl-arrow-scale, 1));
	height: calc(var(--cgsl-arrow-size, 40px) * var(--cgsl-arrow-scale, 1));
	color: var(--cgsl-arrow-color, #000);
	background: none !important;
	border: 0 !important;
	border-radius: 0;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	text-decoration: none;
	transition: color 200ms ease, opacity 200ms ease;
}

.cgsl-gallery .cgsl-arrow:hover,
.cgsl-gallery .cgsl-arrow:focus {
	color: var(--cgsl-arrow-hover, #8a8a8a);
	background: none !important;
}

.cgsl-gallery .cgsl-arrow:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 4px;
}

.cgsl-gallery .cgsl-arrow[disabled] {
	opacity: 0.25;
	cursor: default;
	pointer-events: none;
}

.cgsl-arrow-icon {
	display: block;
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.cgsl-prev .cgsl-arrow-icon {
	transform: scaleX(-1);
}

/* Arrows sitting on top of the image */
.cgsl-arrows-inside .cgsl-arrow,
.cgsl-arrows-overlay .cgsl-arrow {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
}

.cgsl-arrows-inside .cgsl-prev,
.cgsl-arrows-overlay .cgsl-prev {
	left: calc(var(--cgsl-arrow-gap, 16px) * var(--cgsl-arrow-scale, 1));
}

.cgsl-arrows-inside .cgsl-next,
.cgsl-arrows-overlay .cgsl-next {
	right: calc(var(--cgsl-arrow-gap, 16px) * var(--cgsl-arrow-scale, 1));
}

.cgsl-arrows-overlay .cgsl-arrow {
	opacity: 0;
}

.cgsl-arrows-overlay:hover .cgsl-arrow,
.cgsl-arrows-overlay .cgsl-arrow:focus-visible {
	opacity: 1;
}

/*
 * Responsive arrow sizing.
 *
 * --cgsl-arrow-scale multiplies the arrow size and its spacing. It is set on
 * .cgsl-gallery rather than .cgsl-grid because the grid carries inline custom
 * properties from the shortcode, and an inline style cannot be overridden from
 * a stylesheet. Redefining the variable one level down inherits cleanly.
 *
 * Tune these three numbers to taste.
 */
@media (max-width: 979px) {
	.cgsl-gallery {
		--cgsl-arrow-scale: 0.7;
	}
}

@media (max-width: 766px) {
	.cgsl-gallery {
		--cgsl-arrow-scale: 0.62;
	}
}

@media (max-width: 480px) {
	.cgsl-gallery {
		--cgsl-arrow-scale: 0.52;
	}
}

/*
 * Two-column tablet band. Arrows placed outside the image cost a fixed
 * amount of width (two arrow widths plus two gaps) whatever the column
 * measures, so in a half-width column they take a large share of it and
 * the photo looks shrunken. Here they move on top of the image instead,
 * so the photo fills the column. Delete this block to keep arrows
 * outside the image at every width.
 */
@media (min-width: 767px) and (max-width: 979px) {
	.cgsl-arrows-outside .cgsl-stage {
		gap: 0;
	}

	.cgsl-arrows-outside .cgsl-arrow {
		position: absolute;
		top: 50%;
		transform: translateY(-50%);
		z-index: 2;
	}

	/* Percentages track the column, so the arrows stay tucked against the photo. */
	.cgsl-arrows-outside .cgsl-prev {
		left: 1.5%;
	}

	.cgsl-arrows-outside .cgsl-next {
		right: 1.5%;
	}
}

/* Dots */
.cgsl-dots {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: calc(var(--cgsl-dot-size, 10px) * 0.8);
	margin-top: 14px;
}

.cgsl-gallery .cgsl-dot {
	width: var(--cgsl-dot-size, 10px);
	height: var(--cgsl-dot-size, 10px);
	border-radius: 50%;
	background: var(--cgsl-dot-color, #d8d8d8) !important;
	border: 0 !important;
	box-shadow: none !important;
	padding: 0 !important;
	margin: 0;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 200ms ease;
}

.cgsl-gallery .cgsl-dot.is-active {
	background: var(--cgsl-dot-active, #111) !important;
}

.cgsl-gallery .cgsl-dot:focus-visible {
	outline: 2px solid var(--cgsl-dot-active, #111);
	outline-offset: 3px;
}

/* Description */
.cgsl-description {
	margin-top: 16px;
	text-align: var(--cgsl-desc-align, center);
	color: var(--cgsl-desc-color, inherit);
	font-size: var(--cgsl-desc-size, 16px);
	line-height: 1.6;
}

.cgsl-description > *:first-child {
	margin-top: 0;
}

.cgsl-description > *:last-child {
	margin-bottom: 0;
}

.cgsl-description p {
	margin: 0 0 1em;
}

.cgsl-description a {
	color: inherit;
	text-decoration: underline;
}

/* Caption */
.cgsl-caption {
	margin-top: 16px;
	text-align: center;
	color: var(--cgsl-caption-color, #1c2b4a);
	font-size: var(--cgsl-caption-size, 17px);
	font-style: var(--cgsl-caption-style, italic);
	line-height: 1.45;
}

/* Zoom trigger */
.cgsl-gallery .cgsl-zoom {
	display: block;
	width: 100%;
	height: auto;
	padding: 0 !important;
	margin: 0;
	border: 0 !important;
	border-radius: 0;
	background: none !important;
	box-shadow: none !important;
	line-height: 0;
	cursor: zoom-in;
	-webkit-appearance: none;
	appearance: none;
}

.cgsl-gallery .cgsl-zoom:focus-visible {
	outline: 2px solid var(--cgsl-arrow-color, #000);
	outline-offset: -2px;
}

@supports (aspect-ratio: 1 / 1) {
	.cgsl-grid:not(.cgsl-ratio-auto) .cgsl-zoom {
		height: 100%;
	}
}

/* Lightbox */
.cgsl-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(0, 0, 0, 0.92);
	opacity: 0;
	transition: opacity 220ms ease;
}

.cgsl-lightbox[hidden] {
	display: none;
}

.cgsl-lightbox.is-open {
	opacity: 1;
}

.cgsl-lb-figure {
	position: relative;
	margin: 0;
	max-width: 100%;
	max-height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 14px;
}

.cgsl-lb-image {
	display: block;
	max-width: 100%;
	max-height: calc(100vh - 140px);
	width: auto;
	height: auto;
	object-fit: contain;
	margin: 0;
	user-select: none;
}

.cgsl-lb-caption {
	color: #fff;
	font-size: 15px;
	line-height: 1.45;
	text-align: center;
	max-width: 70ch;
	margin: 0;
	opacity: 0.85;
}

.cgsl-lightbox button {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 0 !important;
	margin: 0;
	border: 0 !important;
	background: none !important;
	box-shadow: none !important;
	color: #fff;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	opacity: 0.8;
	transition: opacity 180ms ease;
}

.cgsl-lightbox button:hover,
.cgsl-lightbox button:focus-visible {
	opacity: 1;
}

.cgsl-lightbox button:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 4px;
}

.cgsl-lb-prev,
.cgsl-lb-next {
	top: 50%;
	transform: translateY(-50%);
	width: 48px;
	height: 48px;
}

.cgsl-lb-prev {
	left: 20px;
}

.cgsl-lb-next {
	right: 20px;
}

.cgsl-lb-prev svg,
.cgsl-lb-next svg,
.cgsl-lb-close svg {
	width: 100%;
	height: 100%;
	pointer-events: none;
}

.cgsl-lb-prev svg {
	transform: scaleX(-1);
}

.cgsl-lb-close {
	top: 18px;
	right: 20px;
	width: 34px;
	height: 34px;
}

.cgsl-lb-counter {
	position: absolute;
	top: 22px;
	left: 24px;
	color: #fff;
	font-size: 14px;
	letter-spacing: 0.06em;
	opacity: 0.75;
	font-variant-numeric: tabular-nums;
}

.cgsl-lb-loading .cgsl-lb-image {
	opacity: 0.35;
}

body.cgsl-lb-open {
	overflow: hidden;
}

@media (max-width: 700px) {
	.cgsl-lightbox {
		padding: 12px;
	}

	.cgsl-lb-prev,
	.cgsl-lb-next {
		width: 36px;
		height: 36px;
	}

	.cgsl-lb-prev {
		left: 6px;
	}

	.cgsl-lb-next {
		right: 6px;
	}

	.cgsl-lb-image {
		max-height: calc(100vh - 120px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.cgsl-lightbox {
		transition: none;
	}
}

.cgsl-notice {
	padding: 12px 16px;
	margin: 12px 0;
	border-left: 4px solid #d63638;
	background: #fcf0f1;
	color: #3c434a;
	font-size: 14px;
	line-height: 1.5;
	text-align: left;
}

.cgsl-notice ul {
	margin: 6px 0;
	padding-left: 18px;
	list-style: disc;
}

.cgsl-notice li {
	margin: 2px 0;
}

.cgsl-notice em {
	font-size: 12px;
	opacity: 0.7;
}

/* Grabbing feel while dragging */
.cgsl-viewport.is-dragging {
	cursor: grabbing;
}

.cgsl-viewport.is-dragging .cgsl-track {
	transition: none;
}

@media (prefers-reduced-motion: reduce) {
	.cgsl-track {
		transition: none;
	}
}
