/* MGH Gallery widget – horizontal scroll row of image + caption sets */
/* Title: H3 desktop / Mobile H4. Caption: Paragraph Small / Mobile Paragraph Small 2. Image: 323×200 desktop, 300×186 mobile. */
/* Spacing: 20px title→row, 20px between items, 5px image→caption. Width constraints match image-text component. */

.mgh-gallery {
	padding: 60px 0 0 20px;
	max-width: 884px;
	margin-left: auto;
	margin-right: auto;
}

.mgh-gallery__title {
	margin: 0 0 20px 0;
	line-height: 1.2;
}

/* Stack track + scroll hint in one grid cell so the hint overlays the row (avoids broken layout if position:absolute is overridden). */
.mgh-gallery__viewport {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	grid-template-rows: auto;
	position: relative;
}

.mgh-gallery__track {
	grid-column: 1;
	grid-row: 1;
	min-width: 0;
	width: 100%;
	z-index: 1;
	display: flex;
	flex-direction: row;
	gap: 20px;
	overflow-x: auto;
	overflow-y: hidden;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	-ms-overflow-style: none;
	cursor: grab;
}

.mgh-gallery__track::-webkit-scrollbar {
	display: none;
}

.mgh-gallery__track.is-dragging {
	cursor: grabbing;
	user-select: none;
}

/* Right-edge affordance when the row overflows (shown via JS: .mgh-gallery--overflow, hidden at end: .mgh-gallery--scrolled-end). */
.mgh-gallery__scroll-hint {
	grid-column: 1;
	grid-row: 1;
	z-index: 2;
	display: flex;
	align-items: flex-start;
	justify-content: flex-end;
	min-width: 0;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.2s ease;
}

/* Match .mgh-gallery__image-wrap height so the chevron centers on the image strip only, not captions. */
.mgh-gallery__scroll-hint-band {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	width: auto;
	height: 186px;
	box-sizing: border-box;
	padding-right: 0.25rem;
	padding-left: 0.5rem;
}

.mgh-gallery__scroll-hint-icon {
	display: flex;
	color: #2c3a60;
}

.mgh-gallery__scroll-hint-icon svg {
	display: block;
	width: 56px;
	height: 56px;
}

.mgh-gallery__viewport.mgh-gallery--overflow:not(.mgh-gallery--scrolled-end) .mgh-gallery__scroll-hint {
	opacity: 1;
}

@media (prefers-reduced-motion: reduce) {
	.mgh-gallery__scroll-hint {
		transition: none;
	}
}

.mgh-gallery__item {
	display: flex;
	flex-direction: column;
	gap: 5px;
	flex-shrink: 0;
}

.mgh-gallery__link {
	display: block;
	text-decoration: none;
	color: inherit;
	cursor: pointer;
}

.mgh-gallery__link:focus {
	outline: none;
}

.mgh-gallery__link:focus-visible {
	outline: 2px solid rgba(44, 58, 96, 0.5);
	outline-offset: 2px;
}

.mgh-gallery__image-wrap {
	width: 300px;
	height: 186px;
	border-radius: 8px;
	overflow: hidden;
	flex-shrink: 0;
	display: flex;
	align-items: center;
	justify-content: center;
}

.mgh-gallery__img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
	vertical-align: middle;
	transition: transform 300ms ease-out;
	transform: scale(1);
	pointer-events: none;
	user-select: none;
	-webkit-user-drag: none;
}

/* Prevent theme/Elementor defaults from forcing height:auto on img tags. */
.mgh-gallery__image-wrap .mgh-gallery__img {
	width: 100% !important;
	height: 100% !important;
	max-width: none;
}

.mgh-gallery__link:hover .mgh-gallery__img,
.mgh-gallery__link:focus-visible .mgh-gallery__img {
	transform: scale(1.1);
}

.mgh-gallery__placeholder {
	width: 300px;
	height: 186px;
	background: #eee;
	border-radius: 8px;
	flex-shrink: 0;
}

.mgh-gallery__caption {
	margin: 0;
	line-height: 1.4;
	width: 300px;
}

/* Desktop: image 323×200, padding 100px 50px 0 50px (match image-text) */
@media (min-width: 1280px) {
	.mgh-gallery {
		max-width: 100%;
		padding: 100px 0 0 50px;
	}

	.mgh-gallery__image-wrap,
	.mgh-gallery__placeholder {
		width: 323px;
		height: 200px;
	}

	.mgh-gallery__caption {
		width: 323px;
	}

	.mgh-gallery__scroll-hint-band {
		height: 200px;
	}
}
