/**
 * Spaces Gallery widget: base styles.
 *
 * Colours, fonts, sizes and spacing are set by the widget controls in Elementor.
 * The values here are fallbacks matching the default design, written with two
 * classes so they beat theme and Elementor defaults such as `.elementor img`.
 */

.dsm-spaces .dsm-spaces__header {
	margin-bottom: 68px;
	text-align: center;
}

.dsm-spaces .dsm-spaces__title,
.dsm-spaces .dsm-spaces__subtitle {
	margin: 0;
	padding: 0;
}

.dsm-spaces .dsm-spaces__title:not(:last-child) {
	margin-bottom: 8px;
}

.dsm-spaces .dsm-spaces__grid {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 16px;
}

.dsm-spaces .dsm-spaces__item {
	position: relative;
	margin: 0;
	overflow: hidden;
	border-radius: 4px;
	isolation: isolate; /* Keeps rounded corners clipped during the hover zoom in Safari. */
	transition: box-shadow 0.4s ease;
}

.dsm-spaces .dsm-spaces__link {
	display: block;
}

.dsm-spaces .dsm-spaces__img {
	display: block;
	width: 100%;
	max-width: none;
	height: 260px;
	margin: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	object-fit: cover;
	object-position: center;
	transition: transform 0.4s ease, opacity 0.4s ease, filter 0.4s ease;
}

/* Hover overlay: dark layer with a "View Project" label and a short line above it. */
.dsm-spaces .dsm-spaces__overlay {
	position: absolute;
	inset: 0;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background-color: rgba(29, 29, 29, 0.48);
	color: #fff;
	text-align: center;
	opacity: 0;
	transition: opacity 0.4s ease;
}

.dsm-spaces .dsm-spaces__label {
	position: relative;
	display: block;
	font-size: 11px;
	font-weight: 500;
	line-height: 1.5;
	letter-spacing: 1.8px;
	text-transform: uppercase;
	transform: translateY(8px);
	transition: transform 0.4s ease;
}

/* Positioned above the label, so the text itself stays centred on the photo. */
.dsm-spaces .dsm-spaces__label--line::before {
	content: "";
	position: absolute;
	right: 0;
	bottom: 100%;
	left: 0;
	width: 32px;
	height: 1px;
	margin: 0 auto 12px;
	background-color: rgba(255, 255, 255, 0.7);
	transform: scaleX(0);
	transition: transform 0.4s ease;
}

.dsm-spaces .dsm-spaces__item:hover .dsm-spaces__overlay,
.dsm-spaces .dsm-spaces__item:focus-within .dsm-spaces__overlay {
	opacity: 1;
}

.dsm-spaces .dsm-spaces__item:hover .dsm-spaces__label,
.dsm-spaces .dsm-spaces__item:focus-within .dsm-spaces__label,
.dsm-spaces .dsm-spaces__item:hover .dsm-spaces__label--line::before,
.dsm-spaces .dsm-spaces__item:focus-within .dsm-spaces__label--line::before {
	transform: none;
}

/* Keyboard focus: white ring inside the photo, plus a ring in the text colour around it. */
.dsm-spaces .dsm-spaces__link:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -4px;
}

.dsm-spaces .dsm-spaces__item:has(.dsm-spaces__link:focus-visible) {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.dsm-spaces .dsm-spaces__item,
	.dsm-spaces .dsm-spaces__img,
	.dsm-spaces .dsm-spaces__overlay,
	.dsm-spaces .dsm-spaces__label,
	.dsm-spaces .dsm-spaces__label--line::before {
		transition: none;
	}

	.dsm-spaces .dsm-spaces__label,
	.dsm-spaces .dsm-spaces__label--line::before {
		transform: none;
	}
}
