/**
 * Featured Properties — hover tiles (9:16 portrait).
 *
 * Same lift-and-reveal hover as the Featured Locations cards (card rises,
 * photo insets with a 3px frame and greys out), in a 9:16 portrait shape. Heading:
 * thin word in Poiret One, bold word in Montserrat (fonts.css, loaded by KI
 * Core). Brand colour: set --ki-color-accent in your theme.
 */

.ki-fp--tiles {
	position: relative;
	padding: 0 max(6.875vw, 24px) 90px;
	overflow: hidden;
	-webkit-font-smoothing: antialiased;
	-moz-osx-font-smoothing: grayscale;
	text-rendering: optimizeLegibility;
}

/* ---------- Heading row ---------- */

.ki-fp-tiles__intro {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	max-width: 1320px;
	margin: 0 auto 50px;
	padding-top: 16px;
}

.ki-fp-tiles__eyebrow {
	position: relative;
	display: inline-block;
	margin-bottom: 18px;
	font: 500 13.5px/1 "Roboto", Arial, Helvetica, sans-serif;
	letter-spacing: 0.28em;
	text-transform: uppercase;
	color: #171717;
}

/* Accent hairline + tick that run left from the end of the eyebrow text. */
.ki-fp-tiles__eyebrow::after {
	content: "";
	position: absolute;
	bottom: -11px;
	right: 0;
	width: 100vw;
	height: 1px;
	background: var(--ki-color-accent, #24bef5);
	opacity: 0.45;
}

.ki-fp-tiles__eyebrow::before {
	content: "";
	position: absolute;
	bottom: -12px;
	right: 0;
	width: 52px;
	height: 3px;
	background: var(--ki-color-accent, #24bef5);
	z-index: 1;
}

.ki-fp-tiles__title {
	margin: 0;
	font-family: "Montserrat", Arial, Helvetica, sans-serif;
	font-weight: 700;
	font-size: clamp(2rem, 4.4vw, 3.75rem);
	line-height: 1.05;
	letter-spacing: 0;
	text-transform: uppercase;
	color: #171717;
}

.ki-fp-tiles__title > span {
	font-family: "Poiret One", "Montserrat", Arial, sans-serif;
	font-weight: 400;
}

.ki-fp-tiles__view-all {
	display: inline-flex;
	align-items: center;
	white-space: nowrap;
	padding: 16px 40px;
	border: 1px solid #171717;
	border-radius: 10px;
	font-family: var(--global-body-font-family, "Roboto", sans-serif);
	font-weight: 500;
	font-size: 14px;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	text-decoration: none;
	color: #171717;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.ki-fp-tiles__view-all:hover,
.ki-fp-tiles__view-all:focus-visible {
	background-color: #171717;
	color: #ffffff;
}

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

.ki-fp-tiles__grid {
	display: grid;
	grid-template-columns: repeat(var(--ki-fp-cols, 3), 1fr);
	gap: 24px;
	max-width: 1320px;
	margin: 0 auto;
}

@media (max-width: 900px) {
	.ki-fp-tiles__grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}
}

@media (max-width: 600px) {
	/* Portrait tiles stay two-up on phones (one-up would be a full screen tall). */
	.ki-fp-tiles__grid {
		gap: 12px;
	}
}

/* ---------- Card (9:16 portrait) ---------- */

.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card {
	position: relative;
	display: block;
	aspect-ratio: 9 / 16;
	border-radius: 30px;
	overflow: hidden;
	/* Shows only for a property with no photo (bottom = accent, top = white). */
	background: linear-gradient(0deg, var(--ki-color-accent, #24bef5) 0%, #ffffff 100%);
	box-shadow: 0 0 0 0 rgba(0, 0, 0, 0);
	transform: translateY(0);
	text-decoration: none;
	/* One atomic layer: avoids sub-pixel drift while the card animates. */
	will-change: transform;
}

/* Hover transition only after the entrance reveal has finished, so it
   doesn't cut the reveal's own (longer) transform transition short. */
.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card:not([data-ki-reveal]),
.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card.is-revealed {
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1), box-shadow 0.45s ease;
}

/* Never set all four inset sides on the <img> (an over-constrained box):
   top/left/width/height fully describe it, so it shrinks symmetrically. */
/* Two classes: beats page-builder img { height: auto } rules. */
.ki-fp--tiles .ki-fp-tiles__image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: inherit;
	transition: top 0.45s cubic-bezier(0.22, 1, 0.36, 1), left 0.45s cubic-bezier(0.22, 1, 0.36, 1),
		width 0.45s cubic-bezier(0.22, 1, 0.36, 1), height 0.45s cubic-bezier(0.22, 1, 0.36, 1),
		filter 0.45s ease;
}

/* Legibility gradient behind the text; insets in step with the image. */
.ki-fp-tiles__overlay {
	position: absolute;
	inset: 0;
	border-radius: inherit;
	background: linear-gradient(180deg, transparent 38%, rgba(0, 0, 0, 0.72) 100%);
	pointer-events: none;
	transition: inset 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ki-fp-tiles__info {
	position: absolute;
	right: 26px;
	bottom: 22px;
	left: 26px;
	z-index: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	color: #ffffff;
}

.ki-fp-tiles__price {
	font-family: "Montserrat", Arial, Helvetica, sans-serif;
	font-weight: 700;
	font-size: 22px;
	line-height: 1.2;
}

.ki-fp-tiles__name {
	font: 500 14px/1.3 "Roboto", Arial, Helvetica, sans-serif;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.ki-fp-tiles__loc {
	font: 400 12px/1.3 "Roboto", Arial, Helvetica, sans-serif;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.85;
}

.ki-fp-tiles__facts {
	font: 400 12px/1.3 "Roboto", Arial, Helvetica, sans-serif;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	opacity: 0.85;
}

.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card:hover,
.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card:focus-visible {
	transform: translateY(-18px);
	box-shadow: 0 22px 44px rgba(0, 0, 0, 0.5), 0 6px 16px rgba(0, 0, 0, 0.35);
}

.ki-fp-tiles__card:hover .ki-fp-tiles__image,
.ki-fp-tiles__card:focus-visible .ki-fp-tiles__image {
	top: 3px;
	left: 3px;
	width: calc(100% - 6px);
	height: calc(100% - 6px);
	filter: grayscale(1);
}

.ki-fp-tiles__card:hover .ki-fp-tiles__overlay,
.ki-fp-tiles__card:focus-visible .ki-fp-tiles__overlay {
	inset: 3px;
}

@media (prefers-reduced-motion: reduce) {
	.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card,
	.ki-fp-tiles__image,
	.ki-fp-tiles__overlay {
		transition: none;
	}
}

@media (max-width: 600px) {
	.ki-fp--tiles {
		padding-left: max(5.15625vw, 18px);
		padding-right: max(5.15625vw, 18px);
	}

	.ki-fp--tiles .ki-fp-tiles__card {
		border-radius: 20px;
	}

	.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card:hover,
	.ki-fp--tiles .ki-fp-tiles__grid .ki-fp-tiles__card:focus-visible {
		transform: translateY(-10px);
	}

	.ki-fp-tiles__info {
		right: 12px;
		bottom: 12px;
		left: 12px;
	}

	.ki-fp-tiles__price {
		font-size: 16px;
	}

	.ki-fp-tiles__name {
		font-size: 11px;
		letter-spacing: 0.04em;
	}

	.ki-fp-tiles__facts {
		font-size: 10px;
		letter-spacing: 0.04em;
	}
}

/* ---------- Carousel layout ([ki_featured_properties layout="carousel"]) ----------
   Proportions follow the Joyce Rey reference: 3 cards in view, 363:576 portrait, 40px gap, card
   lifts 2x the grid's 18px, beds/baths/area appear on hover, 58px round arrows centred on the cards. */

.ki-fp--carousel {
	padding-top: 90px;
	background: #ffffff;
}

/* Optional faint photo behind the section (bg_url), fading to white at top and bottom. */
.ki-fp-tiles__bg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
	pointer-events: none;
}

.ki-fp-tiles__bg img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0.11;
	filter: grayscale(1);
}

.ki-fp-tiles__bg::after {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(180deg, #ffffff 0%, rgba(255, 255, 255, 0) 22%, rgba(255, 255, 255, 0) 78%, #ffffff 100%);
}

.ki-fp--carousel .ki-fp-tiles__intro,
.ki-fp--carousel .ki-fp-tiles__grid {
	position: relative;
	z-index: 1;
	max-width: 1180px;
}

.ki-fp--tiles .ki-fp-tiles__grid--carousel {
	display: block;
}

/* Room around the track so a lifted card and its shadow are not clipped (lift is 36px). */
.ki-fp-tiles__slider .splide__track {
	padding: 60px 26px;
}

.ki-fp-tiles__slider .splide__slide {
	display: block;
}

/* Joyce proportions. */
.ki-fp--carousel .ki-fp-tiles__grid .ki-fp-tiles__card {
	aspect-ratio: 363 / 576;
}

/* Lift: 2x the grid layout's 18px. The rest of the hover (3px ring, grayscale) is the shared tile design. */
.ki-fp--carousel .ki-fp-tiles__grid .ki-fp-tiles__card:hover,
.ki-fp--carousel .ki-fp-tiles__grid .ki-fp-tiles__card:focus-visible {
	transform: translateY(-36px);
}

/* Beds · baths · area slide in on hover (address and price are always visible). */
.ki-fp--carousel .ki-fp-tiles__facts {
	margin-top: 6px;
	opacity: 0;
	transform: translateY(14px);
	transition: opacity 0.45s ease, transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}

.ki-fp--carousel .ki-fp-tiles__card:hover .ki-fp-tiles__facts,
.ki-fp--carousel .ki-fp-tiles__card:focus-visible .ki-fp-tiles__facts {
	opacity: 0.9;
	transform: translateY(0);
}

.ki-fp-tiles__image {
	-webkit-user-drag: none;
	user-select: none;
}

/* Arrows: 58px white circles, soft shadow, centred on the cards, filled on hover.
   They sit OUTSIDE the cards: 108px of side padding = 58px arrow + 50px clear space. On phones they move below. */
.ki-fp-tiles__slider {
	position: relative;
	padding: 0 108px;
}

.ki-fp--carousel {
	padding-right: 24px;
	padding-left: 24px;
}

.ki-fp--carousel .ki-fp-tiles__grid {
	max-width: 1320px;
}

.ki-fp-tiles__slider .splide__arrows {
	pointer-events: none;
}

.ki-fp-tiles__slider .ki-fp-tiles__arrow {
	position: absolute;
	top: 50%;
	z-index: 3;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 58px;
	height: 58px;
	padding: 0;
	border: 1px solid #ffffff;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 1.883px 26.934px 29.44px 2.56px rgba(0, 0, 0, 0.14);
	color: #171717;
	cursor: pointer;
	pointer-events: auto;
	transform: translateY(-50%);
	transition: color 0.3s linear, background-color 0.3s linear, border-color 0.3s linear;
}

.ki-fp-tiles__slider .splide__arrow--prev {
	left: 0;
}

.ki-fp-tiles__slider .splide__arrow--next {
	right: 0;
}

.ki-fp-tiles__slider .splide__arrow--prev svg {
	transform: scaleX(-1);
}

.ki-fp-tiles__slider .ki-fp-tiles__arrow:hover,
.ki-fp-tiles__slider .ki-fp-tiles__arrow:focus-visible {
	border-color: var(--ki-color-accent-deep, #146131);
	background: var(--ki-color-accent-deep, #146131);
	color: #ffffff;
}

@media (hover: none) {
	/* No hover on touch: show the facts line and skip the lift. */
	.ki-fp--carousel .ki-fp-tiles__facts {
		opacity: 0.9;
		transform: none;
	}
}

@media (max-width: 1024px) {
	.ki-fp-tiles__slider .splide__track {
		padding: 50px 18px;
	}
}

@media (max-width: 600px) {
	.ki-fp--carousel {
		padding-top: 64px;
	}

	.ki-fp--carousel .ki-fp-tiles__grid .ki-fp-tiles__card:hover,
	.ki-fp--carousel .ki-fp-tiles__grid .ki-fp-tiles__card:focus-visible {
		transform: translateY(-10px);
	}
}

@media (prefers-reduced-motion: reduce) {
	.ki-fp-tiles__slider .ki-fp-tiles__arrow,
	.ki-fp--carousel .ki-fp-tiles__facts {
		transition: none;
	}
}

/* Phones: arrows move below the carousel, centred, instead of sitting beside the cards. */
@media (max-width: 767px) {
	.ki-fp-tiles__slider {
		padding: 0;
	}

	.ki-fp-tiles__slider .splide__arrows {
		display: flex;
		justify-content: center;
		gap: 18px;
		margin-top: 4px;
	}

	.ki-fp-tiles__slider .ki-fp-tiles__arrow {
		position: static;
		width: 52px;
		height: 52px;
		transform: none;
	}

	.ki-fp-tiles__slider .splide__arrow--prev,
	.ki-fp-tiles__slider .splide__arrow--next {
		left: auto;
		right: auto;
	}
}
/* Carousel on phones: "view all" button moves below the arrows (a second copy, shown only here). */
.ki-fp--carousel .ki-fp-tiles__view-all-wrap--mobile {
	display: none;
}

@media (max-width: 767px) {
	.ki-fp--carousel .ki-fp-tiles__intro .ki-fp-tiles__view-all {
		display: none;
	}

	.ki-fp--carousel .ki-fp-tiles__view-all-wrap--mobile {
		display: block;
		margin-top: 28px;
		text-align: center;
	}

	.ki-fp--carousel .ki-fp-tiles__view-all-wrap--mobile .ki-fp-tiles__view-all {
		display: inline-block;
	}
}
