﻿/**
 * nc/homes — front-end styles.
 *
 * The grid, cards and filter bar reuse the shared .sd-cgrid / .sd-pcard /
 * .sd-cfilters rules compiled into assets/css/sd.css (src/scss/_community.scss),
 * so this file only adds what is specific to the global grid: the show-more
 * control and the results count.
 */
/* Results count as a standalone tracked label (the fallback when there is no heading to
   fold it into). view.js updates its text as filters narrow the set. */
.sd-homes .sd-cgrid__count {
	margin: 0.5rem 0 0;
	font-size: 0.8rem;
	font-weight: 700;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: #5a6b76;
}

/* When folded into the title ("118 Available Homes") the number inherits the serif
   heading instead of the standalone label look. */
.sd-homes .sd-cgrid__heading .sd-cgrid__count {
	margin: 0;
	font: inherit;
	letter-spacing: inherit;
	text-transform: none;
	color: inherit;
}

/* The dedicated Available Homes listing sits directly beneath the full-bleed communities
   map; give its title room to breathe instead of butting the map edge. */
.sd-homes--listing {
	padding-top: clamp(2rem, 4vw, 3.5rem);
}

.sd-homes__more-wrap {
	display: flex;
	justify-content: center;
	margin-top: 32px;
}

/* A plain text link (navy, bold) with a down-arrow, matching the legacy site's
   "Show more homes" control rather than a solid button. */
.sd-homes__more {
	appearance: none;
	border: 0;
	background: none;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 8px 4px;
	color: #1F242E;
	font: inherit;
	font-weight: 700;
	letter-spacing: 0.02em;
	cursor: pointer;
	transition: color 0.15s ease;
}

.sd-homes__more::after {
	content: "";
	width: 0.8em;
	height: 0.8em;
	background-color: currentColor;
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M19 12l-7 7-7-7'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 5v14M19 12l-7 7-7-7'/%3E%3C/svg%3E") center / contain no-repeat;
	transition: transform 0.15s ease;
}

.sd-homes__more:hover,
.sd-homes__more:focus-visible {
	color: #DCA23B;
	text-decoration: underline;
	text-underline-offset: 4px;
	outline: none;
}

.sd-homes__more:hover::after,
.sd-homes__more:focus-visible::after {
	transform: translateY(2px);
}

.sd-homes__more[hidden] {
	display: none;
}

/* Numbered pagination (data-paginate="numbered") — a centered row of page buttons. */
.sd-homes__pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 6px;
}

.sd-homes__pagination[hidden] {
	display: none;
}

.sd-homes__page {
	appearance: none;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border: 1px solid #cfd6dd;
	border-radius: 0;
	background: #fff;
	color: #1F242E;
	font: inherit;
	font-weight: 600;
	font-size: 15px;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.sd-homes__page:hover:not( :disabled ),
.sd-homes__page:focus-visible:not( :disabled ) {
	border-color: #DCA23B;
	color: #DCA23B;
	outline: none;
}

.sd-homes__page.is-current {
	background: #1F242E;
	border-color: #1F242E;
	color: #fff;
	cursor: default;
}

.sd-homes__page:disabled {
	opacity: 0.45;
	cursor: default;
}

.sd-homes__ellipsis {
	padding: 0 4px;
	color: #6b7780;
}

/* Optional fixed column count (the "Columns" setting sets --sd-cols inline). Falls back
   to the responsive auto-fill grid on narrower screens so it never gets cramped. */
.sd-homes .sd-cgrid__grid[style*="--sd-cols"] {
	grid-template-columns: repeat( var( --sd-cols ), minmax( 0, 1fr ) );
}

@media ( max-width: 900px ) {
	.sd-homes .sd-cgrid__grid[style*="--sd-cols"] {
		grid-template-columns: repeat( auto-fill, minmax( 260px, 1fr ) );
	}
}

/* Breathing room below the grid when it's the LAST block on a page (e.g. Available
   Homes), so it doesn't butt the footer. Scoped to :last-child so it never over-spaces
   the home's Browse Homes section, and uses padding (not margin) because core zeroes the
   last child's margin-block via `:where(.is-layout-constrained) > :last-child`. */
.is-layout-constrained > .sd-cgrid.sd-homes:last-child {
	padding-bottom: clamp( 2.5rem, 5vw, 4rem );
}

/* A filtered/paged-out card must hide regardless of the card's own display rule. */
.sd-homes .sd-pcard[hidden] {
	display: none !important;
}

.sd-homes__empty {
	margin: 24px 0;
	font-size: 16px;
	color: #3a4b56;
}

.sd-homes__empty[hidden] {
	display: none;
}

/* ─────────────────────────────────────────────────────────────────────────────
   Card header layout — two columns:
     left  = Plan Title + Spec Title (beneath)
     right = Price, Payment, View Details button
   Scoped to .sd-homes .sd-pcard--plan so it deterministically overrides the shared
   .sd-pcard--plan rules in assets/css/sd.css.
   ───────────────────────────────────────────────────────────────────────────── */
.sd-homes .sd-pcard--plan .sd-pcard__header {
	align-items: flex-start;
	gap: 12px;
}

.sd-homes .sd-pcard--plan .sd-pcard__titles {
	display: flex;
	flex: 1 1 auto;
	min-width: 0;
	flex-direction: column;
	gap: 3px;
}

/* Spec title sits directly beneath the plan title, in a lighter, smaller style. */
.sd-homes .sd-pcard--plan .sd-pcard__spec {
	font-family: var(--sd-font-display);
	font-size: 0.8125rem;
	font-weight: 500;
	line-height: 1.3;
	color: #737a87;
}

.sd-homes .sd-pcard--plan .sd-pcard__pricing {
	display: flex;
	flex: 0 0 auto;
	flex-direction: column;
	align-items: flex-end;
	gap: 4px;
	text-align: right;
}

/* Reset the single-column negative pull the shared rule used; in the pricing column
   the payment line follows the price normally. */
.sd-homes .sd-pcard--plan .sd-pcard__payment {
	margin: 0;
	font-family: var(--sd-font-display);
	font-size: 0.625rem;
	font-weight: 700;
	line-height: 1.2;
	color: var(--sd-color-orange);
}

/* "View Details" pill — z-index:2 so it clears the full-card .sd-pcard__overlay link. */
.sd-homes .sd-pcard--plan .sd-pcard__viewdetails {
    position: relative;
    z-index: 2;
    display: inline-flex;
    align-items: center;
    margin-top: 2px;
    padding: 0px;
    font-family: var(--sd-font-display);
    font-size: 0.6875rem;
    font-weight: 700;
    color: rgba(115, 122, 135, 1);
    white-space: nowrap;
    background: transparent;
    border-radius: 20px;
    text-decoration: none;
    transition: background-color 0.15s ease, color 0.15s ease;
    text-decoration: underline;
}

.sd-homes .sd-pcard--plan .sd-pcard__viewdetails:hover,
.sd-homes .sd-pcard--plan .sd-pcard__viewdetails:focus-visible {
	background: transparent;
	color: #d46f35;
	outline: none;
}

/* On very narrow cards, stack the two columns so neither title nor price is squeezed. */
@media ( max-width: 360px ) {
	.sd-homes .sd-pcard--plan .sd-pcard__header {
		flex-direction: column;
	}

	.sd-homes .sd-pcard--plan .sd-pcard__pricing {
		align-items: flex-start;
		text-align: left;
	}
}

/* ─────────────────────────────────────────────────────────────────────────────
   Share popup (Copy Link / Facebook / Email) — same design + behaviour as the
   nc/all-plans Share modal, built once and appended to <body> by view.js. The
   `sd-share--card` modifier keeps it fully isolated from the global .sd-share
   (<dialog>) spec/plan popup in assets/css/sd.css.
   ───────────────────────────────────────────────────────────────────────────── */
html.sd-share-lock {
	overflow: hidden;
}

.sd-share--card[hidden] {
	display: none;
}

.sd-share--card {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	width: auto;
	max-width: none;
	max-height: none;
	padding: 16px;
	background: none;
	border-radius: 0;
	box-shadow: none;
	color: #1f242e;
}

.sd-share--card .sd-share__overlay {
	position: absolute;
	inset: 0;
	background: rgba( 31, 36, 46, 0.55 );
}

.sd-share--card .sd-share__dialog {
	position: relative;
	width: 100%;
	max-width: 420px;
	box-sizing: border-box;
	padding: 28px 24px;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 12px 40px rgba( 0, 0, 0, 0.25 );
	font-family: 'Lexend', sans-serif;
	animation: sd-homes-share-in 0.18s ease-out;
}

@keyframes sd-homes-share-in {
	from { transform: translateY( 12px ); opacity: 0; }
	to   { transform: translateY( 0 ); opacity: 1; }
}

.sd-share--card .sd-share__close {
	position: absolute;
	top: 12px;
	right: 14px;
	width: 32px;
	height: 32px;
	padding: 0;
	font-size: 24px;
	line-height: 1;
	color: #737a87;
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.sd-share--card .sd-share__close:hover,
.sd-share--card .sd-share__close:focus-visible {
	background: #f6f4ee;
	color: #1f242e;
	outline: none;
}

.sd-share--card .sd-share__title {
	margin: 0 0 18px;
	font-size: 1.25rem;
	font-weight: 700;
	color: #1f242e;
}

.sd-share--card .sd-share__copy {
	display: flex;
	gap: 8px;
	margin: 0 0 16px;
}

.sd-share--card .sd-share__url {
	flex: 1 1 auto;
	min-width: 0;
	height: 40px;
	padding: 0 12px;
	font-family: 'Lexend', sans-serif;
	font-size: 0.875rem;
	color: #1f242e;
	background: #f6f4ee;
	border: 0.5px solid #c8c8c8;
	border-radius: 20px;
}

.sd-share--card .sd-share__copy-btn {
	flex: 0 0 auto;
	height: 40px;
	padding: 0 18px;
	font-family: 'Lexend', sans-serif;
	font-size: 0.75rem;
	font-weight: 700;
	color: #fff;
	background: #d46f35;
	border: 0;
	border-radius: 20px;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.sd-share--card .sd-share__copy-btn:hover,
.sd-share--card .sd-share__copy-btn:focus-visible {
	background: #be5f29;
	outline: none;
}

.sd-share--card .sd-share__copy-btn.is-copied {
	background: #2e7d4f;
}

.sd-share--card .sd-share__opts {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.sd-share--card .sd-share__opt {
	display: flex;
	align-items: center;
	gap: 10px;
	height: 44px;
	padding: 0 18px;
	font-size: 0.875rem;
	font-weight: 700;
	text-decoration: none;
	color: #1f242e;
	background: #faf8f5;
	border: 0.5px solid #a5a7ab;
	border-radius: 20px;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.sd-share--card .sd-share__opt:hover,
.sd-share--card .sd-share__opt:focus-visible {
	border-color: #1f242e;
	outline: none;
}

.sd-share--card .sd-share__opt svg {
	flex: 0 0 auto;
}

.sd-share--card .sd-share__opt--fb svg {
	color: #1877f2;
}

.sd-share--card .sd-share__opt--fb:hover,
.sd-share--card .sd-share__opt--fb:focus-visible {
	background: #1877f2;
	border-color: #1877f2;
	color: #fff;
}

.sd-share--card .sd-share__opt--fb:hover svg,
.sd-share--card .sd-share__opt--fb:focus-visible svg {
	color: #fff;
}

.sd-share--card .sd-share__opt--email:hover,
.sd-share--card .sd-share__opt--email:focus-visible {
	background: #d46f35;
	border-color: #d46f35;
	color: #fff;
}

@media ( prefers-reduced-motion: reduce ) {
	.sd-share--card .sd-share__dialog {
		animation: none;
	}
}

/* ─────────────────────────────────────────────────────────────────────────────
   Promotion pill badge — the bundled SVG (sd_promotion_badge) + optional visible
   text (sd_promotion_badge_text) shown over the photo, top-left. Grouped with the
   home's own status (snipe) in a single top-left stack so the two never overlap.
   The corner pennant flag (top-right) and community badge (bottom-left) are
   unaffected.
   ───────────────────────────────────────────────────────────────────────────── */
.sd-homes .sd-pcard--plan .sd-pcard__tags {
	position: absolute;
	top: 25px;
	left: -2px;
	z-index: 4;
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	max-width: calc( 100% - 24px );
}

/* Re-flow the status badge from its own absolute corner into the stack above. */
.sd-homes .sd-pcard--plan .sd-pcard__tags .sd-pcard__snipe {
	position: static;
	border-radius: 20px;
}

.sd-homes .sd-pcard--plan .sd-pcard__promo-badge {
	display: inline-flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 5px;
	max-width: 100%;
}

.sd-homes .sd-pcard--plan .sd-pcard__promo-badge-img {
	display: block;
	width: auto;
	height: 30px;
	max-width: 100%;
}

/* Visible label under the pill — only rendered when Badge text is set. */
.sd-homes .sd-pcard--plan .sd-pcard__promo-badge-text {
	padding: 3px 10px;
	font-family: var(--sd-font-display);
	font-size: 0.7rem;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	background: rgba( 31, 36, 46, 0.72 );
	border-radius: 20px;
	white-space: nowrap;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
}
