/**
 * Casa Terra Gallery (Figma "Photo gallery"): one column, 24px apart: "← All villas", the
 * photo's heading, the photo (1200 × 760 / 770 × 560 / 350 × 440), Previous and Next, the other
 * photos as thumbnails (a scroll row on phones), the counter and the button.
 */

.ct-gallery__inner {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 24px;
}

.ct .ct-gallery__back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	min-height: 44px;
	color: var(--ct-heading);
	text-decoration: none;
}

.ct .ct-gallery__back:hover {
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ct-gallery__stage {
	width: 100%;
	aspect-ratio: 1200 / 760;
	overflow: hidden;
	background: var(--ct-c-line);
}

.ct .ct-gallery__img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
}

.ct .ct-gallery__img--phone {
	display: none;
}

.ct-gallery__controls {
	display: flex;
	gap: 16px;
}

.ct-gallery__controls .ct-btn {
	min-width: 180px;
}

.ct-gallery .ct-gallery__thumbs {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 24px;
	width: 100%;
	overflow: visible;
}

.ct-gallery__thumb {
	display: block;
	aspect-ratio: 384 / 256;
	overflow: hidden;
	border-radius: var(--ct-radius);
	background: var(--ct-c-line);
}

.ct .ct-gallery__thumb img {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.ct-gallery__thumb:hover img {
	transform: scale(1.02);
}

.ct-gallery__counter {
	color: var(--ct-muted);
}

.ct-gallery .ct-gallery__cta {
	min-width: 240px;
}

@media (prefers-reduced-motion: reduce) {
	.ct-gallery__thumb:hover img {
		transform: none;
	}
}

@media (max-width: 1024px) {
	.ct-gallery__stage {
		aspect-ratio: 770 / 560;
	}

	.ct-gallery .ct-gallery__thumbs {
		gap: 16px;
	}

	/* Figma keeps the 56px heading on tablets. */
	.ct-gallery .ct-gallery__title {
		font-size: 56px;
		line-height: 64px;
	}
}

@media (max-width: 767px) {
	.ct-gallery__stage {
		aspect-ratio: 350 / 440;
	}

	.ct .ct-gallery__img--phone {
		display: block;
	}

	.ct .ct-gallery__img--wide {
		display: none;
	}

	.ct-gallery .ct-gallery__title {
		font-size: var(--ct-fs-h1);
		line-height: var(--ct-lh-h1);
	}

	.ct-gallery__controls {
		width: 100%;
	}

	.ct-gallery__controls .ct-btn {
		flex: 1;
		min-width: 0;
	}

	/* Thumbnails 200 wide in a scroll row. */
	.ct-gallery .ct-gallery__thumbs {
		display: flex;
		gap: 12px;
		overflow-x: auto;
	}

	.ct-gallery__thumbs > li {
		width: 200px;
	}

	.ct-gallery .ct-gallery__cta {
		width: 100%;
	}
}
