/**
 * RAV Showcase: Slider, Hover Reveal and Testimonials.
 * Loaded on the site and in the editor. Site-wide sizes and colours come from
 * the theme presets; home-page extras (skyline, outer margins) stay in the
 * site's Additional CSS.
 */

.rav-showcase {
	/* Dots scale smoothly with the screen: 12px across (1px ring, 6px apart)
	   at 360px wide up to 24px (2px ring, 10px apart) at 782px and wider
	   (1.0.18; they used to jump from 24px to 12px at 599px). The size
	   includes the ring (border-box), because browsers draw rings in whole
	   pixels: only the ring steps from 1px to 2px, the dot itself doesn't. */
	--rav-sc-dot: clamp(12px, calc(1.76px + 2.844vw), 24px);
	--rav-sc-dot-border: clamp(1px, calc(0.147px + 0.237vw), 2px);
	--rav-sc-dot-gap: clamp(6px, calc(2.59px + 0.948vw), 10px);
	position: relative;
}

.rav-showcase__img {
	display: block;
	height: 100%;
	object-fit: cover;
	width: 100%;
}

/* --------------------------------------------------------------------------
   Slider and Testimonials: a horizontal track that snaps to one item at a
   time (swipe, drag, arrow keys and the dots move it; see view.js)
   -------------------------------------------------------------------------- */
.rav-showcase__track {
	display: flex;
	overflow-x: auto;
	overscroll-behavior-x: contain;
	scroll-snap-type: x mandatory;
	scrollbar-width: none;
}

.rav-showcase__track::-webkit-scrollbar {
	display: none;
}

.rav-showcase__track.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	user-select: none;
}

/* With view.js running, the items sit on a rail that follows the finger or
   mouse and glides to each slide (the track above is the no-script fallback) */
.rav-showcase__track.is-ready {
	overflow: hidden;
	scroll-snap-type: none;
	touch-action: pan-y;
}

.rav-showcase__rail {
	display: flex;
	flex: 0 0 100%;
	min-width: 0;
	will-change: transform;
}

.rav-showcase__rail > .rav-showcase__item {
	box-sizing: border-box;
	flex: 0 0 100%;
}

.rav-showcase__rail.is-animating {
	transition: transform 0.5s ease;
}

@media (prefers-reduced-motion: reduce) {
	.rav-showcase__rail.is-animating {
		transition: none;
	}
}

.rav-showcase__track:focus-visible {
	outline: 2px solid var(--wp--preset--color--accent-1);
	outline-offset: 4px;
}

.rav-showcase__track > .rav-showcase__item {
	box-sizing: border-box;
	flex: 0 0 100%;
	scroll-snap-align: start;
	scroll-snap-stop: always;
}

.rav-showcase__dots {
	display: flex;
	gap: var(--rav-sc-dot-gap);
}

.rav-showcase__dots:empty {
	display: none;
}

.rav-showcase__dot {
	appearance: none;
	background: transparent;
	border: var(--rav-sc-dot-border) solid currentColor;
	border-radius: 50%;
	box-sizing: border-box;
	cursor: pointer;
	height: var(--rav-sc-dot);
	margin: 0;
	padding: 0;
	transition: background-color 0.2s ease-out;
	width: var(--rav-sc-dot);
}

.rav-showcase__dot:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 3px;
}

/* --------------------------------------------------------------------------
   Slider: photo slides with white text on the left, dots over the photo
   -------------------------------------------------------------------------- */
/* Room under the photo for the dots' row (the home page's green skyline and
   the dots are placed from the bottom of this box) */
.rav-showcase--slider {
	box-sizing: border-box;
	margin-inline: auto;
	max-width: var(--wp--style--global--wide-size);
	padding-block-end: 36px;
}

.rav-showcase--slider .rav-showcase__track {
	border-radius: 35px;
}

.rav-showcase__slide {
	align-items: flex-start;
	display: flex;
	flex-direction: column;
	justify-content: center;
	min-height: clamp(400px, 50vw, 700px);
	overflow: hidden;
	position: relative;
}

.rav-showcase__slide > .rav-showcase__img {
	inset: 0;
	position: absolute;
}

/* Shade over the photo so the white text reads, as the old slider's default
   slide overlay did (black at 50%). Change --rav-showcase-shade to tune it. */
.rav-showcase__slide > .rav-showcase__overlay {
	background: var(--rav-showcase-shade, rgba(0, 0, 0, 0.5));
	inset: 0;
	pointer-events: none;
	position: absolute;
}

.rav-showcase__slide > .rav-showcase__content {
	box-sizing: border-box;
	color: var(--wp--preset--color--base);
	padding: 20px clamp(20px, 5.7%, 70px);
	position: relative;
	width: 100%;
	z-index: 1;
}

.rav-showcase__slide > .rav-showcase__content > * {
	max-width: min(560px, 62%);
}

.rav-showcase__slide .rav-showcase__content h1,
.rav-showcase__slide .rav-showcase__content h2,
.rav-showcase__slide .rav-showcase__content h3 {
	color: inherit;
	margin: 0;
	padding: 0;
	text-transform: uppercase;
}

.rav-showcase__slide .rav-showcase__content p {
	color: inherit;
	margin-top: 0.5em;
}

.rav-showcase--slider .rav-showcase__dots {
	bottom: clamp(44px, 7vw, 90px);
	color: var(--wp--preset--color--base);
	left: clamp(20px, 5.7%, 70px);
	position: absolute;
	z-index: 6;
}

/* Buttons don't inherit the text colour, so the white rings are set here */
.rav-showcase--slider .rav-showcase__dot {
	color: inherit;
}

.rav-showcase--slider .rav-showcase__dot[aria-current="true"],
.rav-showcase--slider .rav-showcase__dot:hover {
	background-color: var(--wp--preset--color--base);
}

@media (max-width: 599px) {
	.rav-showcase--slider {
		padding-block-end: 24px;
	}

	.rav-showcase__slide > .rav-showcase__content > * {
		max-width: 100%;
	}

	.rav-showcase--slider .rav-showcase__dots {
		bottom: 60px;
	}
}

/* --------------------------------------------------------------------------
   Hover Reveal: tall pills side by side; the one under the pointer (or
   focused, or tapped) opens wide and shows its text. Phones: stacked.
   -------------------------------------------------------------------------- */
.rav-showcase__row {
	align-items: stretch;
	display: flex;
	gap: 16px;
}

.rav-showcase__panel {
	border-radius: 80px;
	cursor: pointer;
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	height: 440px;
	justify-content: flex-end;
	min-width: 0;
	outline: none;
	overflow: hidden;
	position: relative;
	transition: flex-grow 0.55s cubic-bezier(0.4, 0, 0.2, 1), border-radius 0.55s ease;
}

.rav-showcase__panel:focus-visible {
	outline: 2px solid var(--wp--preset--color--base);
	outline-offset: -4px;
}

.rav-showcase__panel.is-active {
	border-radius: 24px;
	flex-grow: 6;
}

.rav-showcase__panel > .rav-showcase__img {
	left: var(--rav-sc-img-left, 0px);
	position: absolute;
	top: 0;
	transition: left 0.55s cubic-bezier(0.4, 0, 0.2, 1);
}

.rav-showcase__panel.is-active > .rav-showcase__img {
	left: 0;
}

.rav-showcase__panel > .rav-showcase__overlay {
	background-image: linear-gradient(to bottom, rgba(44, 18, 80, 0) 0%, rgba(44, 18, 80, 0) 30%, rgba(44, 18, 80, 0.8) 100%);
	inset: 0;
	opacity: 0;
	pointer-events: none;
	position: absolute;
	transition: opacity 0.4s ease;
}

.rav-showcase__panel.is-active > .rav-showcase__overlay {
	opacity: 1;
}

.rav-showcase__panel > .rav-showcase__content {
	box-sizing: border-box;
	color: var(--wp--preset--color--base);
	opacity: 0;
	padding: 32px;
	pointer-events: none;
	position: relative;
	transform: translateY(16px);
	transition: opacity 0.15s ease, transform 0.15s ease;
}

.rav-showcase__panel.is-active > .rav-showcase__content {
	opacity: 1;
	pointer-events: auto;
	transform: translateY(0);
	transition: opacity 0.25s ease 0.55s, transform 0.25s ease 0.55s;
}

.rav-showcase__panel .rav-showcase__content h2,
.rav-showcase__panel .rav-showcase__content h3,
.rav-showcase__panel .rav-showcase__content h4 {
	color: var(--wp--preset--color--base);
	margin: 0 0 10px;
}

.rav-showcase__panel .rav-showcase__content p {
	color: rgba(255, 255, 255, 0.9);
	margin: 0 0 14px;
}

@media (max-width: 780px) {
	.rav-showcase__row {
		flex-direction: column;
		gap: 10px;
		height: 540px;
	}

	.rav-showcase__panel,
	.rav-showcase__panel.is-active {
		border-radius: var(--rav-radius-card, 30px);
		height: auto;
		min-height: 60px;
	}

	.rav-showcase__panel > .rav-showcase__img {
		left: 0 !important;
		width: 100% !important;
	}

	.rav-showcase__panel > .rav-showcase__content {
		padding: 24px;
	}

	/* Closed pills: a light shade and just the title, centred */
	.rav-showcase__panel:not(.is-active) {
		justify-content: center;
	}

	.rav-showcase__panel:not(.is-active) > .rav-showcase__overlay {
		background: rgba(0, 0, 0, 0.35);
		opacity: 1;
	}

	.rav-showcase__panel:not(.is-active) > .rav-showcase__content {
		opacity: 1;
		padding-block: 0;
		text-align: center;
		transform: none;
	}

	.rav-showcase__panel:not(.is-active) > .rav-showcase__content > :not(h2) {
		display: none;
	}

	.rav-showcase__panel:not(.is-active) > .rav-showcase__content h2 {
		font-size: var(--wp--preset--font-size--large);
		margin: 0;
		text-shadow: 0 1px 6px rgba(0, 0, 0, 0.6);
	}
}

/* --------------------------------------------------------------------------
   Testimonials: a card with the photo on the left (on top on phones) and the
   quote centred beside it; coral dots underneath
   -------------------------------------------------------------------------- */
.rav-showcase--testimonials {
	margin-inline: auto;
	max-width: var(--wp--style--global--wide-size);
}

.rav-showcase__card {
	background-color: var(--wp--preset--color--base);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--contrast) 40%, transparent);
	border-radius: var(--rav-radius-card, 30px);
	color: var(--wp--preset--color--contrast);
	display: flex;
	position: relative;
}

/* The border is drawn again on top, so the photo never hides it */
.rav-showcase__card::after {
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--contrast) 40%, transparent);
	border-radius: inherit;
	content: "";
	inset: -1px;
	pointer-events: none;
	position: absolute;
	z-index: 3;
}

.rav-showcase__photo {
	flex: 0 0 50%;
	min-height: 340px;
	position: relative;
}

.rav-showcase__photo > .rav-showcase__img {
	border-radius: var(--rav-radius-card, 30px);
	height: calc(100% + 2px);
	left: -1px;
	position: absolute;
	top: -1px;
	width: calc(100% + 1px);
}

.rav-showcase__card.has-no-image .rav-showcase__photo {
	display: none;
}

.rav-showcase__body {
	align-self: center;
	box-sizing: border-box;
	flex: 1 1 0;
	padding: var(--wp--preset--spacing--50) clamp(20px, 7%, 90px);
	text-align: center;
}

.rav-showcase__heading {
	font-size: var(--wp--preset--font-size--x-large);
	line-height: 1.12;
	margin: 0 0 0.28em;
	text-transform: uppercase;
}

/* Two slanted coral bars, as in the mockup */
.rav-showcase__heading::before {
	background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 288 160'%3E%3Cpath fill='%23fa4d53' d='M68 0h70l-38 160H0zM218 0h70l-38 160H150z'/%3E%3C/svg%3E") no-repeat center / contain;
	content: "";
	display: block;
	font-size: 0;
	height: 40px;
	margin: 0 auto;
	width: 72px;
}

.rav-showcase__card .rav-showcase__content > * {
	margin-block: 0;
}

.rav-showcase__card .rav-showcase__content > * + * {
	margin-block-start: 1em;
}

.rav-showcase--testimonials .rav-showcase__dots {
	color: color-mix(in srgb, var(--wp--preset--color--contrast) 55%, transparent);
	justify-content: center;
	margin-block-start: var(--wp--preset--spacing--30);
}

.rav-showcase--testimonials .rav-showcase__dot[aria-current="true"],
.rav-showcase--testimonials .rav-showcase__dot:hover {
	background-color: var(--wp--preset--color--coral);
	border-color: var(--wp--preset--color--coral);
}

@media (max-width: 781px) {
	.rav-showcase__card {
		flex-direction: column;
	}

	.rav-showcase__photo {
		flex: 0 0 auto;
		min-height: 0;
	}

	.rav-showcase__photo > .rav-showcase__img {
		aspect-ratio: 2 / 1;
		border-radius: var(--rav-radius-card, 30px) var(--rav-radius-card, 30px) 0 0;
		height: auto;
		margin: -1px -1px 0;
		position: static;
		width: calc(100% + 2px);
	}

	.rav-showcase__body {
		align-self: stretch;
		display: flex;
		flex: 1 1 auto;
		flex-direction: column;
		justify-content: center;
		padding: var(--wp--preset--spacing--30) clamp(20px, 7%, 90px);
	}

	.rav-showcase__heading::before {
		height: 30px;
		width: 54px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rav-showcase__panel,
	.rav-showcase__panel > .rav-showcase__img,
	.rav-showcase__panel > .rav-showcase__overlay,
	.rav-showcase__panel > .rav-showcase__content {
		transition: none;
	}
}
