/**
 * NLS Property Hub — search filters, buttons, pager, single & shortlist pages.
 * Scoped under .nlsph. RTL-safe logical properties. Consumes tokens.css.
 */

.nlsph.nlsph--search,
.nlsph.nlsph--single,
.nlsph.nlsph--shortlist,
.nlsph.nlsph--grid {
	max-inline-size: var(--nlsph-container);
	margin-inline: auto;
	background: var(--nlsph-bg);
	padding: var(--nlsph-space-5);
	border-radius: var(--nlsph-radius-lg);
}

/* --- Buttons ----------------------------------------------------------- */
.nlsph .nlsph-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: var(--nlsph-space-2);
	padding: var(--nlsph-space-3) var(--nlsph-space-5);
	font: inherit;
	font-weight: 600;
	line-height: 1;
	/* Control boundary (SC 1.4.11) — .nlsph-btn--ghost is transparent, so this
	 * border is the only thing identifying it. Primary buttons override it with
	 * their own brand colour below. See tokens.css. */
	border: 1px solid var(--nlsph-control-border, #8a7a66);
	border-radius: var(--nlsph-radius-sm);
	background: var(--nlsph-surface);
	color: var(--nlsph-text);
	cursor: pointer;
	transition: background var(--nlsph-transition), color var(--nlsph-transition), border-color var(--nlsph-transition);
}

.nlsph .nlsph-btn:hover {
	border-color: var(--nlsph-brand);
}

.nlsph .nlsph-btn--primary {
	background: var(--nlsph-brand);
	color: var(--nlsph-brand-ink);
	border-color: var(--nlsph-brand);
}

.nlsph .nlsph-btn--primary:hover {
	background: var(--nlsph-brand-hover);
	border-color: var(--nlsph-brand-hover);
}

.nlsph .nlsph-btn--ghost {
	background: transparent;
}

.nlsph .nlsph-btn[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

/* --- Filters ----------------------------------------------------------- */
.nlsph .nlsph-filters {
	display: flex;
	flex-direction: column;
	gap: var(--nlsph-space-4);
	padding: var(--nlsph-space-5);
	background: var(--nlsph-surface);
	border: var(--nlsph-border);
	border-radius: var(--nlsph-radius);
	box-shadow: var(--nlsph-shadow-sm);
}

.nlsph .nlsph-filters__row {
	display: flex;
	flex-wrap: wrap;
	gap: var(--nlsph-space-4);
	align-items: flex-end;
}

.nlsph .nlsph-field {
	display: flex;
	flex-direction: column;
	gap: var(--nlsph-space-1);
	min-inline-size: 140px;
}

.nlsph .nlsph-field--grow {
	flex: 1 1 240px;
}

.nlsph .nlsph-field--actions {
	flex-direction: row;
	gap: var(--nlsph-space-2);
	align-items: stretch;
}

.nlsph .nlsph-label {
	font-size: var(--nlsph-fs-sm);
	font-weight: 600;
	color: var(--nlsph-text-muted);
}

.nlsph .nlsph-input,
.nlsph .nlsph-select {
	font: inherit;
	color: var(--nlsph-text);
	background: var(--nlsph-surface);
	padding: var(--nlsph-space-3);
	/* Control boundary, not decoration: SC 1.4.11 needs 3:1 here. See tokens.css. */
	border: 1px solid var(--nlsph-control-border, #8a7a66);
	border-radius: var(--nlsph-radius-sm);
	inline-size: 100%;
	min-block-size: 44px; /* AA touch target */
}

.nlsph .nlsph-input:focus,
.nlsph .nlsph-select:focus {
	border-color: var(--nlsph-brand);
}

/* --- Result bar + pager ------------------------------------------------ */
.nlsph .nlsph-resultbar {
	margin-block: var(--nlsph-space-4) 0;
	font-size: var(--nlsph-fs-sm);
	font-weight: 600;
	color: var(--nlsph-text-muted);
}

.nlsph .nlsph-cards[aria-busy="true"] {
	opacity: 0.5;
	pointer-events: none;
}

.nlsph .nlsph-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: var(--nlsph-space-4);
	margin-block: var(--nlsph-space-5);
	/* A long catalogue wraps onto more rows instead of pushing First/Last off-screen. */
	flex-wrap: wrap;
}

/*
 * Structural reset only — the numbered strip has to behave like a row of controls,
 * not a document list. Without this the UA defaults (list markers, the 40px
 * padding-inline-start, block-level items) stack every number on its own line and
 * shove the neighbouring buttons outside the viewport at phone widths.
 * Visual design of these controls belongs to the theme/site pass.
 */
.nlsph .nlsph-pager__list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: var(--nlsph-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nlsph .nlsph-pager__status {
	font-size: var(--nlsph-fs-sm);
	color: var(--nlsph-text-muted);
	min-inline-size: 6ch;
	text-align: center;
}

/* --- Single property --------------------------------------------------- */
.nlsph .nlsph-single__head {
	display: flex;
	flex-wrap: wrap;
	gap: var(--nlsph-space-4);
	align-items: flex-start;
	justify-content: space-between;
	margin-block-end: var(--nlsph-space-5);
}

.nlsph .nlsph-single__title {
	margin: 0;
	font-family: var(--nlsph-font-serif);
	font-size: var(--nlsph-fs-3xl);
	line-height: var(--nlsph-lh-tight);
	color: var(--nlsph-text);
}

.nlsph .nlsph-single__loc {
	margin: var(--nlsph-space-2) 0 0;
	display: flex;
	align-items: center;
	gap: var(--nlsph-space-1);
	color: var(--nlsph-text-muted);
}

.nlsph .nlsph-single__price {
	margin: 0;
	font-family: var(--nlsph-font-serif);
	font-size: var(--nlsph-fs-2xl);
	font-weight: 700;
	color: var(--nlsph-brand);
	white-space: nowrap;
}

.nlsph .nlsph-gallery__main {
	margin: 0;
	/* Reserve the box: the img carries no width/height, so without this the
	   browser cannot size it before load — layout shift on the page's likely
	   LCP element.
	   inline-size:100% is LOAD-BEARING. With aspect-ratio + max-block-size and
	   an auto width, the ratio drives the WIDTH DOWN to honour the height cap
	   (560 x 4/3 = 747px inside a 1104px column), which visibly shrank the
	   hero. Pinning the width keeps it full-bleed; the cap then limits height
	   only, and space is still reserved before the image loads. */
	inline-size: 100%;
	aspect-ratio: 4 / 3;
	max-block-size: 560px;
	border-radius: var(--nlsph-radius);
	overflow: hidden;
	background: var(--nlsph-surface-2);
}

.nlsph .nlsph-gallery__img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
}

/* One row that scrolls, never a wrapped grid: listings carry anywhere from 19 to
   57 photos, so a wrapping strip ends in a short, left-stranded last row for any
   count that is not an exact multiple of the thumbs-per-row. Scrolling is
   count-independent and hides no photos. */
.nlsph .nlsph-gallery__thumbs {
	display: flex;
	flex-wrap: nowrap;
	overflow-x: auto;
	overscroll-behavior-inline: contain;
	scroll-snap-type: x proximity;
	scrollbar-width: thin;
	gap: var(--nlsph-space-2);
	margin: var(--nlsph-space-3) 0 0;
	padding: 0 0 var(--nlsph-space-2);
	list-style: none;
}

.nlsph .nlsph-gallery__thumb {
	flex: 0 0 auto;
	scroll-snap-align: start;
}

/* No-photo listings still need a sized, deliberate-looking box. */
.nlsph .nlsph-gallery--empty .nlsph-card__img--placeholder {
	display: block;
	inline-size: 100%;
	aspect-ratio: 4 / 3;
	max-block-size: 560px;
	border-radius: var(--nlsph-radius);
}

.nlsph .nlsph-gallery__thumb-btn {
	padding: 0;
	border: 2px solid transparent;
	border-radius: var(--nlsph-radius-sm);
	overflow: hidden;
	cursor: pointer;
	background: none;
	inline-size: 84px;
	block-size: 64px;
}

.nlsph .nlsph-gallery__thumb-btn.is-active {
	border-color: var(--nlsph-brand);
}

.nlsph .nlsph-gallery__thumb-img {
	inline-size: 100%;
	block-size: 100%;
	object-fit: cover;
	display: block;
}

.nlsph .nlsph-single__body {
	display: grid;
	grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
	gap: var(--nlsph-space-6);
	margin-block-start: var(--nlsph-space-5);
}

.nlsph .nlsph-single__h2 {
	font-family: var(--nlsph-font-serif);
	font-size: var(--nlsph-fs-xl);
	margin-block: 0 var(--nlsph-space-3);
}

.nlsph .nlsph-single__desc-text {
	color: var(--nlsph-text);
	line-height: var(--nlsph-lh);
}

.nlsph .nlsph-features {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
	gap: var(--nlsph-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nlsph .nlsph-features__item {
	position: relative;
	padding-inline-start: var(--nlsph-space-5);
	font-size: var(--nlsph-fs-sm);
}

.nlsph .nlsph-features__item::before {
	content: "";
	position: absolute;
	inset-inline-start: 0;
	inset-block-start: 0.35em;
	inline-size: 0.7em;
	block-size: 0.4em;
	border-inline-start: 2px solid var(--nlsph-brand);
	border-block-end: 2px solid var(--nlsph-brand);
	transform: rotate(-45deg);
}

.nlsph .nlsph-spec-table {
	margin: 0;
	background: var(--nlsph-surface);
	border: var(--nlsph-border);
	border-radius: var(--nlsph-radius);
	overflow: hidden;
}

.nlsph .nlsph-spec-table__row {
	display: flex;
	justify-content: space-between;
	gap: var(--nlsph-space-4);
	padding: var(--nlsph-space-3) var(--nlsph-space-4);
	border-block-end: var(--nlsph-border);
}

.nlsph .nlsph-spec-table__row:last-child {
	border-block-end: 0;
}

.nlsph .nlsph-spec-table__key {
	color: var(--nlsph-text-muted);
	margin: 0;
}

.nlsph .nlsph-spec-table__val {
	font-weight: 600;
	margin: 0;
}

/* --- Shortlist public page -------------------------------------------- */
.nlsph .nlsph-shortlist__head {
	text-align: center;
	margin-block-end: var(--nlsph-space-6);
}

.nlsph .nlsph-shortlist__logo {
	max-block-size: 64px;
	inline-size: auto;
	margin-block-end: var(--nlsph-space-3);
}

.nlsph .nlsph-shortlist__title {
	font-family: var(--nlsph-font-serif);
	font-size: var(--nlsph-fs-2xl);
	margin: 0;
}

.nlsph .nlsph-shortlist__notes,
.nlsph .nlsph-shortlist__meta {
	color: var(--nlsph-text-muted);
	margin-block: var(--nlsph-space-2) 0;
}

.nlsph .nlsph-shortlist__note {
	margin: var(--nlsph-space-2) 0 0;
	padding: var(--nlsph-space-3);
	background: var(--nlsph-surface-2);
	border-radius: var(--nlsph-radius-sm);
	font-size: var(--nlsph-fs-sm);
}

.nlsph .nlsph-shortlist__note-label {
	font-weight: 700;
}

.nlsph .nlsph-shortlist__foot {
	margin-block-start: var(--nlsph-space-6);
	padding-block-start: var(--nlsph-space-5);
	border-block-start: var(--nlsph-border);
	display: flex;
	flex-wrap: wrap;
	gap: var(--nlsph-space-3);
	align-items: center;
	justify-content: center;
}

.nlsph .nlsph-shortlist__cta {
	inline-size: 100%;
	text-align: center;
	font-weight: 600;
	margin: 0;
}

/* --- Language switch --------------------------------------------------- */
.nlsph.nlsph-lang {
	display: inline-flex;
	gap: var(--nlsph-space-1);
	padding: var(--nlsph-space-1);
	background: var(--nlsph-surface-2);
	border-radius: 999px;
}

.nlsph .nlsph-lang__opt {
	padding: var(--nlsph-space-1) var(--nlsph-space-3);
	border-radius: 999px;
	font-size: var(--nlsph-fs-sm);
	font-weight: 600;
	text-decoration: none;
	color: var(--nlsph-text-muted);
}

.nlsph .nlsph-lang__opt.is-active {
	background: var(--nlsph-brand);
	color: var(--nlsph-brand-ink);
}

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 720px) {
	.nlsph .nlsph-single__body {
		grid-template-columns: 1fr;
	}

	.nlsph .nlsph-field {
		flex: 1 1 100%;
	}
}

/* --- Smart search ------------------------------------------------------ */
.nlsph .nlsph-smart {
	display: flex;
	flex-direction: column;
	gap: var(--nlsph-space-3);
	margin-block-end: var(--nlsph-space-5);
}

/* Component display rules must not beat the hidden attribute. */
.nlsph .nlsph-smart [hidden] {
	display: none;
}

.nlsph .nlsph-smart__form {
	display: flex;
	flex-direction: column;
	gap: var(--nlsph-space-2);
	margin: 0;
}

.nlsph .nlsph-smart__label {
	font-family: var(--nlsph-font-serif);
	font-size: var(--nlsph-fs-xl);
	line-height: var(--nlsph-lh-tight);
	color: var(--nlsph-text);
}

.nlsph .nlsph-smart__bar {
	display: flex;
	align-items: center;
	gap: var(--nlsph-space-3);
	padding: var(--nlsph-space-2);
	padding-inline-start: var(--nlsph-space-4);
	background: var(--nlsph-surface);
	border: 1px solid var(--nlsph-line);
	border-radius: var(--nlsph-radius);
	box-shadow: var(--nlsph-shadow);
	transition: border-color var(--nlsph-transition), box-shadow var(--nlsph-transition);
}

.nlsph .nlsph-smart__bar:focus-within {
	border-color: var(--nlsph-brand);
	outline: 2px solid var(--nlsph-focus);
	outline-offset: 2px;
}

.nlsph .nlsph-smart__icon {
	flex: 0 0 auto;
	inline-size: 1.35rem;
	block-size: 1.35rem;
	background: var(--nlsph-accent);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='12.5' r='6.5'/%3E%3Cpath d='m20 22-4.5-4.5M19 2v5M16.5 4.5h5'/%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='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='10.5' cy='12.5' r='6.5'/%3E%3Cpath d='m20 22-4.5-4.5M19 2v5M16.5 4.5h5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.nlsph .nlsph-smart__input,
.nlsph .nlsph-smart__input:focus {
	flex: 1 1 auto;
	min-inline-size: 0;
	min-block-size: 44px;
	margin: 0;
	padding: var(--nlsph-space-2) 0;
	font: inherit;
	font-size: var(--nlsph-fs-lg);
	color: var(--nlsph-text);
	background: transparent;
	border: 0;
	box-shadow: none;
	outline: none;
}

.nlsph .nlsph-smart__input::placeholder {
	color: var(--nlsph-text-muted);
	opacity: 1;
}

.nlsph .nlsph-smart__go {
	flex: 0 0 auto;
	min-block-size: 44px;
}

.nlsph .nlsph-smart__spinner {
	display: none;
	inline-size: 1em;
	block-size: 1em;
	border: 2px solid currentColor;
	border-inline-end-color: transparent;
	border-radius: 50%;
	animation: nlsph-smart-spin 0.7s linear infinite;
}

.nlsph .nlsph-smart.is-busy .nlsph-smart__spinner {
	display: inline-block;
}

@keyframes nlsph-smart-spin {
	to {
		transform: rotate(360deg);
	}
}

.nlsph .nlsph-smart__hint {
	margin: 0;
	font-size: var(--nlsph-fs-sm);
	color: var(--nlsph-text-muted);
}

.nlsph .nlsph-smart__out {
	display: flex;
	flex-direction: column;
	gap: var(--nlsph-space-3);
}

.nlsph .nlsph-smart__reply {
	margin: 0;
	color: var(--nlsph-text);
	overflow-wrap: anywhere;
}

.nlsph .nlsph-smart__reply:empty {
	display: none;
}

.nlsph .nlsph-smart__chips,
.nlsph .nlsph-smart__refine-list {
	display: flex;
	flex-wrap: wrap;
	gap: var(--nlsph-space-2);
	margin: 0;
	padding: 0;
	list-style: none;
}

.nlsph .nlsph-chip {
	display: inline-flex;
	align-items: center;
	gap: var(--nlsph-space-1);
	max-inline-size: 100%;
	padding-block: 2px;
	padding-inline: var(--nlsph-space-3) 2px;
	font-size: var(--nlsph-fs-sm);
	font-weight: 600;
	color: var(--nlsph-text);
	background: var(--nlsph-surface-2);
	border: 1px solid var(--nlsph-line);
	border-radius: 999px;
}

.nlsph .nlsph-chip__label {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.nlsph .nlsph-chip__remove {
	display: inline-grid;
	place-items: center;
	flex: 0 0 auto;
	inline-size: 28px;
	block-size: 28px;
	padding: 0;
	font: inherit;
	font-size: 1.15rem;
	line-height: 1;
	color: var(--nlsph-text-muted);
	background: transparent;
	border: 0;
	border-radius: 50%;
	cursor: pointer;
}

.nlsph .nlsph-chip__remove:hover {
	color: var(--nlsph-text);
	background: var(--nlsph-line);
}

.nlsph .nlsph-chip__remove:focus-visible,
.nlsph .nlsph-smart__suggestion:focus-visible {
	outline: 2px solid var(--nlsph-focus);
	outline-offset: 2px;
}

.nlsph .nlsph-smart__refine {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: var(--nlsph-space-2);
}

.nlsph .nlsph-smart__refine-label {
	font-size: var(--nlsph-fs-sm);
	font-weight: 600;
	color: var(--nlsph-text-muted);
}

.nlsph .nlsph-smart__suggestion {
	min-block-size: 32px;
	padding: var(--nlsph-space-1) var(--nlsph-space-3);
	font: inherit;
	font-size: var(--nlsph-fs-sm);
	text-align: start;
	color: var(--nlsph-accent);
	background: transparent;
	border: 1px dashed var(--nlsph-line);
	border-radius: 999px;
	cursor: pointer;
}

.nlsph .nlsph-smart__suggestion:hover {
	border-style: solid;
	border-color: var(--nlsph-accent);
}

/* Hero box ([nlsph_smart_search]) — transparent so it sits on any section. */
.nlsph.nlsph--smart-hero {
	max-inline-size: 42rem;
	background: transparent;
}

.nlsph .nlsph-smart--hero .nlsph-smart__label {
	font-family: var(--nlsph-font-sans);
	font-size: var(--nlsph-fs-sm);
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
}

@media (max-width: 560px) {
	.nlsph .nlsph-smart__bar {
		flex-wrap: wrap;
		gap: var(--nlsph-space-2);
		padding: var(--nlsph-space-2);
	}

	.nlsph .nlsph-smart__icon {
		display: none;
	}

	.nlsph .nlsph-smart__input {
		flex: 1 1 100%;
		padding-inline: var(--nlsph-space-2);
	}

	.nlsph .nlsph-smart__go {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nlsph .nlsph-smart__bar {
		transition: none;
	}

	.nlsph .nlsph-smart__spinner {
		animation-duration: 2s;
	}
}
