/* villas-more/carousel — Task 008B */

/*
 * Mockup V0.2 fidelity pass (2026-08-29). The nav buttons used to be
 * flex siblings of the track, so they took ~6rem of width away from the
 * media on every screen — the approved composition runs the image strip
 * edge to edge with the next image peeking past the container, and
 * shows no chrome at rest. The buttons are overlaid on the track now
 * and fade in on hover/focus, which keeps the affordance for pointer
 * and keyboard users without spending layout width on it.
 */
.vm-carousel {
	position: relative;
}

.vm-carousel__track {
	display: flex;
	gap: 1rem;
	overflow-x: auto;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	padding-bottom: 0.25rem;
	flex: 1 1 auto;
	/* Focus ring only shows for keyboard users, not on click/touch. */
	outline: none;
	/*
	 * Refinement pass (Task 008B review): before any images are added,
	 * the track had zero intrinsic height, so the carousel read as an
	 * empty gap between two floating arrow buttons rather than a
	 * reserved image slot. min-height + the same placeholder wash used
	 * for the Hero background gives it a designed, "photography to
	 * come" presence; once real core/image children exist they sit at
	 * this same 240px height and fully cover the wash, so this is
	 * invisible in the populated state.
	 */
	min-height: 240px;
	border-radius: 2px;
}

/*
 * Unpopulated state. No photography exists for any Property yet, so an
 * empty carousel would otherwise render as a bare gradient slab. These
 * two pseudo-slides reserve the real thing's proportions — one full
 * slide plus a second one clipped by the container, exactly the peek
 * the reference shows — and disappear the moment a core/image child is
 * added.
 */
.vm-carousel__track:not(:has(> .wp-block-image))::before,
.vm-carousel__track:not(:has(> .wp-block-image))::after {
	content: "Photography placeholder";
	flex: 0 0 auto;
	display: flex;
	align-items: flex-end;
	padding: 1rem;
	height: 240px;
	border-radius: 2px;
	font-family: var(--wp--preset--font-family--heading);
	font-size: 0.65rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: color-mix(in srgb, var(--wp--preset--color--base) 75%, transparent);
}

.vm-carousel__track:not(:has(> .wp-block-image))::before {
	width: 62%;
	background: linear-gradient(150deg, var(--vm-color-deep) 0%, var(--vm-color-primary) 100%);
}

.vm-carousel__track:not(:has(> .wp-block-image))::after {
	width: 42%;
	background: linear-gradient(150deg, var(--wp--preset--color--primary-dark) 0%, var(--wp--preset--color--primary) 100%);
}

.vm-carousel__track:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 4px;
}

.vm-carousel__track > .wp-block-image {
	flex: 0 0 auto;
	width: min(320px, 78vw);
	scroll-snap-align: start;
	margin: 0;
}

.vm-carousel__track > .wp-block-image img {
	width: 100%;
	height: 240px;
	object-fit: cover;
	border-radius: 2px;
	display: block;
}

.vm-carousel__nav {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.25rem;
	height: 2.25rem;
	border-radius: 50%;
	border: 1px solid var(--wp--preset--color--border);
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--contrast);
	font-size: 1.2rem;
	line-height: 1;
	cursor: pointer;
	/*
	 * Polish pass (2026-08-29): these were hidden until hover. That
	 * looked tidy on a mouse but it meant the control did not exist at
	 * all for touch devices wide enough to keep the buttons (600px and
	 * up), and a carousel that shows no control at rest does not read as
	 * a carousel. They are present but deliberately quiet now, and firm
	 * up on hover/focus.
	 */
	opacity: 0.65;
	transition: opacity 150ms ease, border-color 150ms ease, color 150ms ease;
}

.vm-carousel__nav--prev {
	left: 0.75rem;
}

.vm-carousel__nav--next {
	right: 0.75rem;
}

.vm-carousel:hover .vm-carousel__nav,
.vm-carousel__nav:focus-visible {
	opacity: 1;
}

.vm-carousel__nav:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 2px;
}

.vm-carousel__nav:hover {
	border-color: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--primary);
}

/* On narrow viewports the nav buttons take real space away from the
   images; touch swipe already covers navigation there, so the buttons
   step aside rather than compress the track further. */
@media (max-width: 600px) {
	.vm-carousel__nav {
		display: none;
	}
}
