/**
 * TMT Culture Cards.
 *
 * Everything is namespaced under .tmt-culture-cards. Button resets carry an
 * element selector (`button.tmt-culture-cards__x`) so a theme's global button
 * styling cannot outrank them, while staying below the three-class selectors
 * Elementor generates from the panel - those must keep winning.
 */

.tmt-culture-cards {
	--tmt-cards-overlay-default: #12384b;
	--tmt-cards-overlay-opacity: 0.55;
	--tmt-cards-overlay-opacity-hover: 0.7;
	--tmt-cards-speed: 400ms;
	--tmt-cards-zoom: 1.06;
	--tmt-cards-lift: 6px;

	position: relative;
	display: block;
}

.tmt-culture-cards *,
.tmt-culture-cards *::before,
.tmt-culture-cards *::after {
	box-sizing: border-box;
}

/* Grid -------------------------------------------------------------------- */

.tmt-culture-cards .tmt-culture-cards__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	column-gap: 24px;
	row-gap: 24px;
}

/* Card -------------------------------------------------------------------- */

.tmt-culture-cards .tmt-culture-cards__card {
	position: relative;
	display: flex;
	/* Overridden by the Position control's wrapper class. */
	align-items: flex-start;
	height: 515px;
	min-width: 0;
	margin: 0;
	overflow: hidden;
	border-radius: 4px;
	background-color: #0f2a3a;
}

.tmt-culture-cards .tmt-culture-cards__image {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center center;
	transition: transform var(--tmt-cards-speed) ease;
}

.tmt-culture-cards .tmt-culture-cards__card:hover .tmt-culture-cards__image,
.tmt-culture-cards .tmt-culture-cards__card:focus-within .tmt-culture-cards__image {
	transform: scale(var(--tmt-cards-zoom));
}

/*
 * The per-card colour lands on the card as --tmt-cards-overlay; unset, the
 * global default takes over. Opacity is separate so one control can dim every
 * card without touching the colours.
 */
.tmt-culture-cards .tmt-culture-cards__overlay {
	position: absolute;
	inset: 0;
	background-color: var(--tmt-cards-overlay, var(--tmt-cards-overlay-default));
	opacity: var(--tmt-cards-overlay-opacity);
	transition: opacity var(--tmt-cards-speed) ease;
	pointer-events: none;
}

.tmt-culture-cards .tmt-culture-cards__card:hover .tmt-culture-cards__overlay,
.tmt-culture-cards .tmt-culture-cards__card:focus-within .tmt-culture-cards__overlay {
	opacity: var(--tmt-cards-overlay-opacity-hover);
}

.tmt-culture-cards .tmt-culture-cards__heading {
	position: relative;
	z-index: 2;
	width: 100%;
	margin: 0;
	padding: 24px;
	font-family: inherit;
	font-size: 22px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: normal;
	overflow-wrap: break-word;
	color: #fff;
	transition: transform var(--tmt-cards-speed) ease;
}

.tmt-culture-cards .tmt-culture-cards__card:hover .tmt-culture-cards__heading,
.tmt-culture-cards .tmt-culture-cards__card:focus-within .tmt-culture-cards__heading {
	transform: translateY(calc(var(--tmt-cards-lift) * -1));
}

.tmt-cards-title-bottom .tmt-culture-cards__card {
	align-items: flex-end;
}

.tmt-cards-title-top .tmt-culture-cards__card {
	align-items: flex-start;
}

/* Shared reset for every button this widget owns. */
.tmt-culture-cards button.tmt-culture-cards__plus,
.tmt-culture-cards button.tmt-culture-cards__close,
.tmt-culture-cards button.tmt-culture-cards__playpause,
.tmt-culture-cards button.tmt-culture-cards__gallery-btn,
.tmt-culture-cards button.tmt-culture-cards__nav-btn,
.tmt-culture-cards button.tmt-culture-cards__dot {
	min-width: 0;
	min-height: 0;
	max-width: none;
	margin: 0;
	border: 0;
	box-shadow: none;
	font-family: inherit;
	line-height: 1;
	/* nav buttons re-declare their border below; everything else stays flat. */
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	white-space: normal;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.tmt-culture-cards button.tmt-culture-cards__plus {
	position: absolute;
	right: 20px;
	bottom: 20px;
	z-index: 3;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border-radius: 50%;
	background-color: #fff;
	color: #12384b;
	font-size: 18px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

.tmt-culture-cards .tmt-culture-cards__plus svg,
.tmt-culture-cards .tmt-culture-cards__close svg,
.tmt-culture-cards .tmt-culture-cards__playpause svg,
.tmt-culture-cards .tmt-culture-cards__gallery-btn svg {
	display: block;
	width: 1em;
	height: 1em;
}

.tmt-culture-cards .tmt-culture-cards__plus i,
.tmt-culture-cards .tmt-culture-cards__close i {
	font-size: inherit;
	line-height: 1;
}

.tmt-culture-cards :focus {
	outline: none;
}

.tmt-culture-cards :focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

/* Popup ------------------------------------------------------------------- */

.tmt-culture-cards .tmt-culture-cards__popup[hidden] {
	display: none;
}

.tmt-culture-cards .tmt-culture-cards__popup {
	position: fixed;
	inset: 0;
	z-index: 99990;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.tmt-culture-cards .tmt-culture-cards__backdrop {
	position: absolute;
	inset: 0;
	background-color: rgba(9, 27, 38, 0.75);
}

.tmt-culture-cards .tmt-culture-cards__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 860px;
	max-height: 90vh;
	padding: 110px 56px 56px;
	overflow: hidden;
	border-radius: 6px;
	background-color: #f2f5f8;
}

.tmt-culture-cards button.tmt-culture-cards__close {
	position: absolute;
	top: 56px;
	right: 56px;
	z-index: 4;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 26px;
	height: 26px;
	padding: 0;
	border-radius: 50%;
	background-color: #e8542b;
	color: #fff;
	font-size: 12px;
	transition: background-color 0.2s ease, color 0.2s ease;
}

/*
 * Header row. The heading is moved in here by the script; keeping the two in
 * one flex row means a long heading wraps beside the buttons instead of running
 * underneath them, which is what an absolutely positioned nav would have done.
 */
.tmt-culture-cards .tmt-culture-cards__head {
	flex: 0 0 auto;
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 24px;
	margin-bottom: 4px;
}

.tmt-culture-cards .tmt-culture-cards__head-title {
	min-width: 0;
}

.tmt-culture-cards .tmt-culture-cards__head-title:empty {
	display: none;
}

.tmt-culture-cards .tmt-culture-cards__nav {
	flex: 0 0 auto;
}

/* The only scrolling region, so the dialog itself never overflows the screen. */
.tmt-culture-cards .tmt-culture-cards__body {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.tmt-culture-cards .tmt-culture-cards__body:focus {
	outline: none;
}

.tmt-culture-cards .tmt-culture-cards__popup-heading {
	margin: 0 0 16px;
	padding: 0;
	font-family: inherit;
	font-size: 34px;
	font-weight: 700;
	line-height: 1.2;
	overflow-wrap: break-word;
	color: #12384b;
}

.tmt-culture-cards .tmt-culture-cards__popup-text {
	font-family: inherit;
	font-size: 15px;
	line-height: 1.6;
	color: #3e5a70;
}

.tmt-culture-cards .tmt-culture-cards__popup-text > *:first-child {
	margin-top: 0;
}

.tmt-culture-cards .tmt-culture-cards__popup-text > *:last-child {
	margin-bottom: 0;
}

/* Gallery ----------------------------------------------------------------- */

.tmt-culture-cards .tmt-culture-cards__gallery {
	margin-top: 24px;
}

/*
 * Slides share one grid cell, so the viewport is never taller than one image
 * and swapping slides cannot shift the dialog around them.
 */
.tmt-culture-cards .tmt-culture-cards__viewport {
	display: grid;
	grid-template-areas: "slide";
	height: 400px;
	overflow: hidden;
	border-radius: 4px;
}

.tmt-culture-cards .tmt-culture-cards__slide {
	grid-area: slide;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.35s ease, visibility 0s linear 0.35s;
}

.tmt-culture-cards .tmt-culture-cards__slide.is-current {
	opacity: 1;
	visibility: visible;
	transition-delay: 0s;
}

.tmt-culture-cards .tmt-culture-cards__slide img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

/* Footer: slider controls + card navigation ------------------------------- */

.tmt-culture-cards .tmt-culture-cards__footer {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: flex-start;
	flex-wrap: wrap;
	gap: 16px;
	margin-top: 18px;
}

.tmt-culture-cards .tmt-culture-cards__slider-controls {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.tmt-culture-cards button.tmt-culture-cards__playpause,
.tmt-culture-cards button.tmt-culture-cards__gallery-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 6px;
	background-color: transparent;
	color: #1b7fc4;
	font-size: 14px;
	transition: color 0.2s ease;
}

.tmt-culture-cards .tmt-culture-cards__gallery-nav {
	display: flex;
	align-items: center;
	gap: 4px;
}

.tmt-culture-cards .tmt-culture-cards__playpause .tmt-culture-cards__pp-icon--play {
	display: none;
}

.tmt-culture-cards.is-gallery-paused .tmt-culture-cards__playpause .tmt-culture-cards__pp-icon--play {
	display: inline-flex;
}

.tmt-culture-cards.is-gallery-paused .tmt-culture-cards__playpause .tmt-culture-cards__pp-icon--pause {
	display: none;
}

.tmt-culture-cards .tmt-culture-cards__dots {
	--tmt-cards-dot: #c5d5e2;
	--tmt-cards-dot-progress: #5b8cb0;
	--tmt-cards-dot-size: 7px;
	--tmt-cards-dot-active: 30px;

	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
}

.tmt-culture-cards button.tmt-culture-cards__dot {
	position: relative;
	display: block;
	flex: 0 0 auto;
	width: var(--tmt-cards-dot-size);
	height: var(--tmt-cards-dot-size);
	padding: 0;
	overflow: hidden;
	border-radius: 999px;
	background-color: var(--tmt-cards-dot);
	transition: width 0.25s ease;
}

.tmt-culture-cards .tmt-culture-cards__dot.is-current {
	width: var(--tmt-cards-dot-active);
}

.tmt-culture-cards .tmt-culture-cards__dot-fill {
	position: absolute;
	inset: 0 auto 0 0;
	display: block;
	width: 0;
	border-radius: inherit;
	background-color: var(--tmt-cards-dot-progress);
}

/*
 * The fill is a paused/running animation rather than a re-started one: pressing
 * play has to carry on from where pause left it, not rewind to the first image.
 */
.tmt-culture-cards .tmt-culture-cards__dot.is-current .tmt-culture-cards__dot-fill {
	animation: tmt-cards-progress var(--tmt-cards-progress-duration, 4s) linear forwards;
}

.tmt-culture-cards.is-gallery-paused .tmt-culture-cards__dot.is-current .tmt-culture-cards__dot-fill {
	animation-play-state: paused;
}

@keyframes tmt-cards-progress {
	from {
		width: 0;
	}

	to {
		width: 100%;
	}
}

.tmt-culture-cards .tmt-culture-cards__nav {
	display: flex;
	align-items: center;
	gap: 12px;
}

.tmt-culture-cards button.tmt-culture-cards__nav-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 20px;
	border: 1px solid rgba(18, 56, 75, 0.3);
	border-radius: 40px;
	background-color: transparent;
	color: #12384b;
	font-size: 14px;
	font-weight: 700;
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.tmt-culture-cards .tmt-culture-cards__nav-btn[disabled] {
	opacity: 0.4;
	cursor: default;
}

.tmt-culture-cards .tmt-culture-cards__nav-btn[hidden] {
	display: none;
}

/* Screen-reader only. */
.tmt-culture-cards .tmt-culture-cards__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0 0 0 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* Responsive -------------------------------------------------------------- */

@media (max-width: 1024px) {
	.tmt-culture-cards .tmt-culture-cards__grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	.tmt-culture-cards .tmt-culture-cards__popup-heading {
		font-size: 24px;
	}
}

@media (max-width: 767px) {
	.tmt-culture-cards .tmt-culture-cards__grid {
		grid-template-columns: minmax(0, 1fr);
	}

	.tmt-culture-cards .tmt-culture-cards__popup {
		padding: 10px;
	}

	.tmt-culture-cards .tmt-culture-cards__dialog {
		max-height: 94vh;
		padding: 60px 18px 22px;
	}

	.tmt-culture-cards .tmt-culture-cards__viewport {
		height: 220px;
	}

	.tmt-culture-cards button.tmt-culture-cards__close {
		top: 16px;
		right: 16px;
	}

	.tmt-culture-cards .tmt-culture-cards__popup-heading {
		font-size: 20px;
	}

	/* Stack the two control groups so neither is squeezed off screen. */
	.tmt-culture-cards .tmt-culture-cards__footer {
		justify-content: center;
		gap: 12px;
	}

	.tmt-culture-cards .tmt-culture-cards__head {
		flex-wrap: wrap;
		gap: 12px;
	}

	.tmt-culture-cards .tmt-culture-cards__nav {
		width: 100%;
		justify-content: flex-start;
	}

	.tmt-culture-cards .tmt-culture-cards__nav-btn {
		flex: 1 1 0;
	}
}

@media (prefers-reduced-motion: reduce) {
	.tmt-culture-cards .tmt-culture-cards__image,
	.tmt-culture-cards .tmt-culture-cards__overlay,
	.tmt-culture-cards .tmt-culture-cards__heading,
	.tmt-culture-cards .tmt-culture-cards__slide,
	.tmt-culture-cards .tmt-culture-cards__dot {
		transition-duration: 1ms !important;
	}
}
