/*
 * UL IDX — the IDX Broker plugin's output in Unlock Luxury's look.
 *
 * 1. Listing cards  [impress_property_showcase] (Home's Featured Listings, the six communities)
 * 2. Search bar     [idx-omnibar] / [idx-omnibar-extra] (only in the IDX wrapper page)
 * 3. IDX pages      #IDX-main inside the wrapper page (templates/single-idx-wrapper.php)
 * 4. Stand-in note  (sandbox only, administrators only)
 *
 * Live (measured at 1440, notes/live-1440.md): 3 across in the 1164 column, 360-wide cards about 42 apart,
 * a 360 × 246 photo; a navy box (112 wide) of Beds / Baths / SqFt / Acres in white 12/700 over the
 * photo's bottom right, reaching down into a light gray foot; in the foot the price in Gelasio 22 navy
 * and the address in caps navy. Live built that with jQuery (child-scripts.js moved the box into the
 * photo and ran matchHeight on every card): here it is CSS only, on the plugin's own markup. The
 * plugin's own showcase and omnibar CSS is dropped where this file loads (ul-idx.php).
 *
 * The parent's CSS sits in cascade layers and this file does not, so these rules win without extra
 * weight. Colors come from the palette (Color 1 navy #314a61: white on it 9.2; the gray foot is
 * #f4f4f4: navy on it 8.36).
 */

:root {
	--ul-idx-navy: var(--color-brand-1, #314a61);
	--ul-idx-navy-hover: var(--color-brand-1-hover, #24384a);
	--ul-idx-foot: #f4f4f4;              /* live's card foot */
	--ul-idx-line: rgb(128 128 128 / 0.25);
	--ul-idx-card-bg: var(--ul-idx-foot);
	--ul-idx-box: 7rem;                  /* the facts box: live's 112 */
	--ul-idx-link: var(--wp--custom--link, var(--ul-idx-navy));
	--ul-idx-link-hover: var(--wp--custom--link-hover, var(--ul-idx-link));
}


/* ==========================================================================
   1. Listing cards
   ========================================================================== */

/* The grid (ul-idx.php merges the plugin's rows into one): 1 across on phones, 2 on tablets, 3 on desktop as live. */
.impress-property-showcase {
	--ul-idx-cols: 1;
	display: grid;
	grid-template-columns: repeat(var(--ul-idx-cols), minmax(0, 1fr));
	gap: 2rem 2.625rem;
	width: 100%;
	max-width: none;
	margin: 0 0 var(--tg-content-gap, 1.5rem);
	padding: 0;
	text-align: start;
}

/* The plugin's clearfix would become two empty grid cells, should its CSS ever load. */
.impress-property-showcase.impress-row::before,
.impress-property-showcase.impress-row::after {
	content: none;
	display: none;
}

@media (width >= 40rem) {
	.impress-property-showcase { --ul-idx-cols: 2; }
}

@media (width >= 64rem) {
	.impress-property-showcase { --ul-idx-cols: 3; }

	/* num_per_row 4, 2 or 1 prints other column classes: honor them. */
	.impress-property-showcase:has(> .large-3) { --ul-idx-cols: 4; }
	.impress-property-showcase:has(> .large-6) { --ul-idx-cols: 2; }
	.impress-property-showcase:has(> .large-12) { --ul-idx-cols: 1; }
}

/*
 * A card: the photo link (photo, then the gray foot with the price and address), and the facts box
 * placed over the photo's bottom right. The card is a size container, so the box's top follows the
 * photo's height (a 3:2 photo is 2/3 of the card's width tall) at every width.
 */
.impress-showcase-property {
	position: relative;
	display: flex;
	flex-direction: column;
	min-width: 0;
	margin: 0;
	padding: 0;
	container-type: inline-size;
	font-size: var(--text-sm, 0.875rem);
	line-height: 1.4;
	text-align: start;
}

/* Belt and braces: the column widths and gutters, should the plugin's CSS load after all. */
.impress-property-showcase > .impress-showcase-property.columns {
	float: none;
	width: auto;
	padding-inline: 0;
}

.impress-showcase-property .impress-showcase-photo {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	margin: 0;
	padding: 0;
	overflow: hidden;
	background: var(--ul-idx-foot);
	color: var(--ul-idx-navy);
	text-decoration: none;
}

/* Live's 360 × 246 photo: about 3:2. */
.impress-showcase-property .impress-showcase-photo img {
	display: block;
	width: 100%;
	max-width: none;
	height: auto;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	margin: 0;
	border: 0;
	transition: transform 400ms ease, filter 400ms ease;
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
	.impress-showcase-property .impress-showcase-photo:hover img { transform: scale(1.03); }
}

.impress-showcase-property .impress-showcase-photo:focus-visible {
	outline: 2px solid var(--ul-idx-navy);
	outline-offset: 3px;
}

/* The price: Gelasio 22, navy. Room at the right for the facts box. */
.impress-showcase-property .impress-price {
	display: block;
	padding: 1rem calc(var(--ul-idx-box) + 1rem) 0.375rem 1rem;
	color: var(--ul-idx-navy);
	font-family: var(--font-secondary, Gelasio, serif);
	font-size: 1.375rem;
	font-weight: 400;
	line-height: 1.2;
}

/* Live hides the status (Active, Pending); so does the plugin's own CSS. */
.impress-showcase-property .impress-status { display: none; }

/* The address: caps, bold, navy, the city on its own line (live's two caps lines). */
.impress-showcase-property .impress-address {
	min-height: 3.5rem;          /* two lines, so the foot clears the box */
	margin: 0;
	padding: 0 calc(var(--ul-idx-box) + 1rem) 1.25rem 1rem;
	color: var(--ul-idx-navy);
	font-size: 0.8125rem;
	font-weight: 700;
	letter-spacing: 0.083em;     /* live's 1.33 at 16 */
	line-height: 1.45;
	text-transform: uppercase;
}

.impress-showcase-property .impress-street { display: block; }

.impress-showcase-property .impress-showcase-photo:is(:hover, :focus-visible) .impress-street {
	text-decoration: underline;
	text-underline-offset: 0.2em;
}

/* The facts box: navy, white, over the photo's bottom right, 2rem up from the photo's foot (live). */
.impress-showcase-property .impress-beds-baths-sqft {
	position: absolute;
	top: calc(100cqi * 2 / 3 - 2rem);
	right: 0;
	display: flex;
	flex-direction: column;
	gap: 0.125rem;
	box-sizing: border-box;
	width: var(--ul-idx-box);
	margin: 0;
	padding: 0.875rem 1rem 1rem;
	background: var(--ul-idx-navy);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 700;
	line-height: 1.2;
	pointer-events: none;        /* the photo link under it stays clickable */
}

.impress-showcase-property .impress-beds-baths-sqft > span {
	display: block;
	white-space: nowrap;
}

.impress-showcase-property .ul-idx-num { font-weight: 700; }
.impress-showcase-property .ul-idx-unit { font-weight: 700; }

/* The MLS courtesy line: required by the MLS rules, so it stays visible, small and gray under the card. */
.impress-showcase-property .disclaimer { margin-top: 0.5rem; }

.impress-showcase-property .disclaimer p {
	margin: 0;
	color: #5c5c5c;
	font-size: 0.75rem;
	line-height: 1.4;
}

.impress-showcase-property .disclaimer img {
	display: inline-block;
	max-height: 1.5rem;
	width: auto;
	vertical-align: middle;
}


/* ==========================================================================
   2. Search bar (omnibar)
   ========================================================================== */

/* A white panel. Phones: location, then Price Max · Beds · Baths in one row, then the button. Desktop: all in one row. */
.idx-omnibar-form {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	gap: 0.75rem;
	width: 100%;
	max-width: 60rem;
	margin-inline: auto;
	padding: 1rem;
	border-radius: var(--tg-card-radius, var(--tg-form-radius, 6px));
	background: #fff;
	box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.12);
	color: var(--color-ink, #353535);
	text-align: start;
}

/* The location field, or the awesomplete box the plugin's script wraps it in. */
.idx-omnibar-form > :is(.idx-omnibar-input, .awesomplete) {
	flex: 1 1 100%;
	min-width: 0;
}

.idx-omnibar-form > .idx-omnibar-extra {
	flex: 1 1 0;
	min-width: 0;
}

.idx-omnibar-form > button {
	flex: 1 1 100%;
}

/* The plain omnibar: field and button side by side at every width; its hidden extras stay hidden (inline display: none). */
.idx-omnibar-original-form > :is(.idx-omnibar-input, .awesomplete) { flex: 1 1 12rem; }
.idx-omnibar-original-form > button { flex: 0 0 auto; }

@media (width >= 48rem) {
	.idx-omnibar-extra-form { padding: 1.25rem; }
	.idx-omnibar-extra-form > :is(.idx-omnibar-input, .awesomplete) { flex: 1 1 16rem; }
	.idx-omnibar-extra-form > .idx-omnibar-extra { flex: 0 1 8.5rem; }
	.idx-omnibar-extra-form > button { flex: 0 0 auto; }
}

/* The location field's label is for screen readers only (the plugin's own rule, which no longer loads). */
.idx-omnibar-form .screen-reader-text,
.idx-omnibar-form .visually-hidden {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}

/* Labels: the theme's form label tokens (Theme Options → Forms). */
.idx-omnibar-form label {
	display: block;
	margin: 0 0 0.35rem;
	color: var(--tg-form-label-fg, inherit);
	font-size: var(--tg-form-label-size, 0.875rem);
	font-weight: var(--tg-form-label-weight, 600);
	line-height: 1.2;
}

/* Fields: the theme's form field tokens, the same height as the button. */
.idx-omnibar-form input {
	box-sizing: border-box;
	display: block;
	width: 100%;
	min-height: 2.75rem;
	margin: 0;
	padding: var(--tg-form-field-pad, 0.625rem) var(--tg-form-field-pad-x, 0.5rem);
	border: 1px solid var(--tg-form-field-border, rgb(128 128 128 / 0.35));
	border-radius: var(--tg-form-radius, 6px);
	background: var(--tg-form-field-bg, rgb(128 128 128 / 0.06));
	color: var(--tg-form-field-fg, inherit);
	font-family: var(--tg-form-font, inherit);
	font-size: var(--tg-form-field-size, 1rem);
	line-height: 1.4;
	text-overflow: ellipsis;
	transition: border-color 150ms ease, box-shadow 150ms ease;
}

/* iOS zooms the page on a field under 16px; the theme's own rule, here too. */
@media (pointer: coarse) {
	.idx-omnibar-form input { font-size: max(1rem, var(--tg-form-field-size, 1rem)); }
}

.idx-omnibar-form input::placeholder {
	color: var(--tg-form-placeholder, currentColor);
	opacity: var(--tg-form-placeholder-opacity, 0.55);
}

.idx-omnibar-form input:focus {
	outline: none;
	border-color: var(--tg-form-field-focus, var(--color-brand-1));
	box-shadow: 0 0 0 1px var(--tg-form-field-focus, var(--color-brand-1));
}

/* Search: the theme's button tokens (Typography → Button), filled in the site navy. */
.idx-omnibar-form button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	margin: 0;
	padding: var(--tg-btn-pad, 0.625rem 1.5rem);
	border: 0;
	border-radius: var(--tg-btn-radius, 0.375rem);
	background: var(--ul-idx-navy);
	color: #fff;
	font-family: var(--tg-btn-font, var(--font-primary, inherit));
	font-size: var(--tg-btn-size, var(--text-base, 1rem));
	font-weight: var(--tg-btn-weight, 600);
	line-height: var(--tg-btn-leading, 1.2);
	letter-spacing: var(--tg-btn-tracking, normal);
	text-transform: var(--tg-btn-transform, none);
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 150ms ease;
}

.idx-omnibar-form button:is(:hover, :focus-visible) { background: var(--ul-idx-navy-hover); }

.idx-omnibar-form button:focus-visible {
	outline: 2px solid var(--ul-idx-navy);
	outline-offset: 2px;
}

.idx-omnibar-form button .fa-search::before { font-style: normal; }

/* The suggestions list under the location field (awesomplete). */
.idx-omnibar-form div.awesomplete {
	position: relative;
	display: block;
}

.idx-omnibar-form div.awesomplete > ul {
	position: absolute;
	top: 100%;
	left: 0;
	z-index: 1000;
	box-sizing: border-box;
	min-width: 100%;
	max-height: 18rem;
	margin: 0.25rem 0 0;
	padding: 0.25rem 0;
	overflow-y: auto;
	list-style: none;
	border: 1px solid var(--ul-idx-line);
	border-radius: var(--tg-form-radius, 6px);
	background: #fff;
	box-shadow: 0 0.5rem 1.5rem rgb(0 0 0 / 0.15);
	text-align: start;
}

.idx-omnibar-form div.awesomplete > ul:empty,
.idx-omnibar-form div.awesomplete > ul[hidden] { display: none; }

.idx-omnibar-form div.awesomplete > ul > li {
	padding: 0.4rem 0.75rem;
	color: var(--color-ink, #353535);
	cursor: pointer;
}

.idx-omnibar-form div.awesomplete > ul > li:is(:hover, [aria-selected='true']) { background: var(--ul-idx-card-bg); }

.idx-omnibar-form div.awesomplete mark {
	padding: 0;
	background: none;
	color: inherit;
	font-weight: 700;
}


/* ==========================================================================
   3. IDX pages (#IDX-main in the wrapper page)
   As on GM (gm-idx): the
   site font and leading, link colors, the results' panels, addresses and
   top links, and the buttons. IDX's own layout stays IDX's.
   ========================================================================== */

.ul-idx-content {
	min-height: 50vh;   /* the page holds its shape while IDX fills it */
}

#ul-idx-content #IDX-main {
	font-family: var(--font-primary, inherit) !important;   /* IDX's hosted stylesheet sets its own with !important */
	line-height: 1.6;
	color: var(--color-ink, inherit);
}

#ul-idx-content #IDX-main :is(h1, h2, h3, h4, #IDX-resultsSeparatorTextActive) {
	font-family: var(--font-secondary, inherit);
	font-weight: var(--tg-heading-weight, 700);
	line-height: var(--tg-heading-leading, 1.2);
	color: var(--tg-site-heading, inherit);
}

#ul-idx-content #IDX-main a {
	color: var(--ul-idx-link);
}

#ul-idx-content #IDX-main a:hover {
	color: var(--ul-idx-link-hover);
}

/* Results: the address link bold and larger, on a rule. */
#ul-idx-content #IDX-main .IDX-resultsAddress a.IDX-resultsAddressLink {
	display: block;
	margin: 0 0 0.75rem;
	padding: 0 0 0.375rem;
	border-bottom: 1px solid var(--ul-idx-line);
	font-size: var(--text-xl, 1.25rem);
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
}

/* The links over the results (Modify search, Save, Map…) in the navy, as live. */
#ul-idx-content #IDX-main #IDX-resultsTopLinks a {
	color: var(--ul-idx-navy);
	font-weight: 700;
	text-decoration: none;
}

#ul-idx-content #IDX-main #IDX-resultsTopLinks a:hover { text-decoration: underline; }

/* Light gray panels with a hairline: result cells, the details page's hot links and core fields. */
#ul-idx-content #IDX-main :is(.IDX-resultCellContainer .IDX-cellInnerWrapper, #IDX-hotLinks, #IDX-contentFields-core) {
	border: 1px solid var(--ul-idx-line);
	border-radius: var(--tg-card-radius, 0);
	background-color: var(--ul-idx-card-bg);
}

#ul-idx-content #IDX-main #IDX-resultMap {
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}

/* Fields: the theme's form field tokens. */
#ul-idx-content #IDX-main :is(input:not([type='checkbox'], [type='radio'], [type='submit'], [type='button'], [type='image']), select, textarea) {
	max-width: 100%;
	padding: var(--tg-form-field-pad, 0.5rem) var(--tg-form-field-pad-x, 0.5rem);
	border: 1px solid var(--tg-form-field-border, rgb(128 128 128 / 0.35));
	border-radius: var(--tg-form-radius, 6px);
	background: var(--tg-form-field-bg, #fff);
	color: var(--tg-form-field-fg, inherit);
	font-family: inherit;
	font-size: var(--tg-form-field-size, 1rem);
}

#ul-idx-content #IDX-main :is(input, select, textarea):focus {
	outline: none;
	border-color: var(--tg-form-field-focus, var(--color-brand-1));
}

/* Buttons: the theme's button tokens in the navy. */
#ul-idx-content #IDX-main :is(button, .IDX-btn, .IDX-formBtn, input[type='submit'], input[type='button']) {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: 2.75rem;
	padding: var(--tg-btn-pad, 0.625rem 1.5rem);
	border: 0;
	border-radius: var(--tg-btn-radius, 0.375rem);
	background: var(--ul-idx-navy);
	background-image: none;
	color: #fff;
	font-family: var(--tg-btn-font, var(--font-primary, inherit));
	font-size: var(--tg-btn-size, var(--text-base, 1rem));
	font-weight: var(--tg-btn-weight, 600);
	line-height: var(--tg-btn-leading, 1.2);
	letter-spacing: var(--tg-btn-tracking, normal);
	text-transform: var(--tg-btn-transform, none);
	text-decoration: none;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color 150ms ease;
}

#ul-idx-content #IDX-main :is(button, .IDX-btn, .IDX-formBtn, input[type='submit'], input[type='button']):is(:hover, :focus-visible) {
	background: var(--ul-idx-navy-hover);
	color: #fff;
}


/* ==========================================================================
   4. Stand-in (sandbox only)
   ========================================================================== */

.ul-idx-standin__note {
	display: inline-block;
	margin: 0 0 0.75rem;
	padding: 0.2rem 0.6rem;
	border: 1px dashed currentColor;
	border-radius: 999px;
	background: rgb(255 255 255 / 0.85);
	color: #6b3a00;
	font-size: var(--text-xs, 0.75rem);
	font-weight: 600;
	line-height: 1.3;
}
