/* "בחרו בקרבת מקום" on the homepage (template-parts/home/near.php, assets/js/home-near.js). Design version 3, 27.11.2026.
 * The pins, clusters and popups reuse the look of the results map (results-map.css, the tbg-rmap__map class on the holder). */

.tbg-hnear__stage {
	position: relative;
	height: clamp(660px, 88vh, 790px);
	border: 1px solid var(--c-border);
	border-radius: var(--radius-lg);
	overflow: hidden;
	background: var(--c-map);
}
/* results-map.css gives .tbg-rmap__map a fixed height and a frame; here the map fills the stage instead */
.tbg-hnear__map.tbg-rmap__map { position: absolute; inset: 0; z-index: 0; isolation: isolate; width: auto; height: auto; border: 0; border-radius: 0; }
.tbg-hnear__loading { position: absolute; inset: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 12px; padding-inline-end: 400px; color: var(--c-green-muted); font-size: 15px; z-index: 1; }
.tbg-hnear__loading[hidden] { display: none; }

/* ---------- the floating panel (wide screens) ---------- */
.tbg-hnear__panel {
	position: absolute;
	top: 18px;
	right: 18px;
	bottom: 18px;
	z-index: 3;
	width: 400px;
	box-sizing: border-box;
	padding: 14px 18px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overflow-y: auto;
	overscroll-behavior: contain;
	border-radius: 20px;
	background: #fff;
	box-shadow: var(--shadow-panel);
}
.tbg-hnear__grip, .tbg-hnear__toggle, .tbg-hnear__cards, .tbg-hnear__top { display: none; }
.tbg-hnear__search { order: 1; display: flex; flex-direction: column; gap: 6px; }
.tbg-hnear__actions { order: 2; display: flex; gap: 10px; }
.tbg-hnear__geo { order: 3; margin: -6px 0 0; font-size: 13px; color: var(--c-green-muted); }
.tbg-hnear__geo:empty { display: none; }
.tbg-hnear__regions { order: 4; }
.tbg-hnear__types { order: 5; }
.tbg-hnear__who { order: 6; }
.tbg-hnear__foot { order: 7; margin-top: auto; display: flex; flex-direction: column; gap: 10px; padding-top: 10px; border-top: 1px solid var(--c-border-soft); }
.tbg-hnear__allwrap { order: 8; }
.tbg-hnear__cards { order: 9; }

.tbg-hnear__search label, .tbg-hnear__group legend { font-size: 14px; font-weight: 800; color: var(--c-green-800); padding: 0; margin-bottom: 8px; }
.tbg-hnear__search label { margin: 0; }
.tbg-hnear__search-box { display: flex; align-items: center; gap: 8px; min-height: 46px; padding: 0 14px; border: 1px solid var(--c-border-mid); border-radius: var(--radius-pill); background: #fff; }
.tbg-hnear__search-box:focus-within { border-color: var(--c-green-700); box-shadow: 0 0 0 3px rgba(7, 81, 61, 0.15); }
.tbg-hnear__search-box .tbg-icon { width: 18px; height: 18px; color: var(--c-green-700); }
.tbg-hnear__search-box input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: 15px; color: var(--c-green-800); }
.tbg-hnear__search-box input::placeholder { color: var(--c-green-muted); opacity: 1; }

.tbg-hnear__near { flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 0 16px; border: 2px solid var(--c-green-700); border-radius: var(--radius-pill); background: var(--c-mint); color: var(--c-green-800); font-size: 15px; font-weight: 800; }
.tbg-hnear__near .tbg-icon { width: 20px; height: 20px; }
.tbg-hnear__near[aria-pressed="true"] { background: var(--c-green-700); color: #fff; }
.tbg-hnear__near[aria-busy="true"] { opacity: 0.7; cursor: progress; }

.tbg-hnear__group { margin: 0; padding: 0; border: 0; min-width: 0; }
.tbg-hnear__chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tbg-hnear__chip { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border: 1px solid var(--c-border-mid); border-radius: var(--radius-pill); background: #fff; color: var(--c-green-800); font-size: 14px; font-weight: 700; white-space: nowrap; transition: background var(--dur) var(--ease), border-color var(--dur) var(--ease); }
.tbg-hnear__chip .tbg-icon { width: 18px; height: 18px; }
.tbg-hnear__chip:hover { border-color: var(--c-green-700); background: var(--c-mint); }
.tbg-hnear__chip[aria-pressed="true"] { border-color: var(--c-green-700); background: var(--c-green-700); color: #fff; }
.tbg-hnear__chip[aria-disabled="true"] { opacity: 0.45; cursor: default; }
.tbg-hnear__chip[aria-disabled="true"]:hover { border-color: var(--c-border-mid); background: #fff; }
.tbg-hnear__n { font-size: 12px; font-weight: 700; color: var(--c-green-muted); }
.tbg-hnear__n:empty { display: none; }
.tbg-hnear__chip[aria-pressed="true"] .tbg-hnear__n { color: var(--c-mint-chip); }

.tbg-hnear__seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); border: 1px solid var(--c-border-mid); border-radius: 12px; overflow: hidden; }
.tbg-hnear__seg-btn { min-height: 40px; padding: 0 4px; border: 0; border-inline-start: 1px solid var(--c-border-mid); background: #fff; color: var(--c-green-800); font-size: 13px; font-weight: 700; }
.tbg-hnear__seg-btn:first-child { border-inline-start: 0; }
.tbg-hnear__seg-btn[aria-pressed="true"] { background: var(--c-green-700); color: #fff; }
.tbg-hnear__seg-btn[aria-disabled="true"] { opacity: 0.45; cursor: default; }

.tbg-hnear__sum-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.tbg-hnear__sum { margin: 0; font-size: 16px; color: var(--c-green-800); }
.tbg-hnear__sum strong { font-weight: 800; }
.tbg-hnear__reset { color: var(--c-green-700); font-size: 14px; font-weight: 700; min-height: 40px; }
.tbg-hnear__all { justify-content: center; width: 100%; box-sizing: border-box; }

.tbg-hnear__touch { position: absolute; top: 14px; left: 50%; transform: translateX(-50%); z-index: 2; min-height: 40px; padding: 0 16px; white-space: nowrap; border: 0; border-radius: var(--radius-pill); background: rgba(6, 60, 48, 0.88); color: #fff; font-size: 13px; font-weight: 700; box-shadow: var(--shadow-card); }
.tbg-hnear__touch[hidden] { display: none; }
.tbg-hnear__noscript { margin-top: 12px; }

/* the visitor's own place */
.tbg-hnear-me { box-sizing: border-box; border-radius: 50%; background: #1d4ed8; border: 4px solid #fff; box-shadow: 0 0 0 10px rgba(29, 78, 216, 0.2), 0 2px 6px rgba(0, 0, 0, 0.25); }

/* the loading and error state of the map */
.tbg-hnear__retry { min-height: 40px; }

/* ---------- phone: chips on the map, the rest is a bottom sheet ---------- */
@media (max-width: 767px) {
	.tbg-hnear .tbg-container { padding-inline: 0; }
	.tbg-hnear .tbg-section__head { padding-inline: var(--gutter); }
	.tbg-hnear__stage { height: clamp(560px, calc(100svh - 96px), 760px); border-radius: 0; border-inline: 0; }
	.tbg-hnear__loading { padding: 0 0 260px; }
	.tbg-hnear__top { display: block; position: absolute; top: 0; right: 0; left: 0; z-index: 2; padding: 12px 0 18px; background: linear-gradient(rgba(255, 255, 255, 0.95) 60%, rgba(255, 255, 255, 0)); }
	.tbg-hnear__top .tbg-hnear__types legend { position: absolute; width: 1px; height: 1px; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; }
	.tbg-hnear__top .tbg-hnear__chips { flex-wrap: nowrap; overflow-x: auto; padding: 0 16px 2px; scrollbar-width: none; }
	.tbg-hnear__top .tbg-hnear__chips::-webkit-scrollbar { display: none; }
	.tbg-hnear__top .tbg-hnear__chip { min-height: 44px; flex: none; box-shadow: 0 2px 6px rgba(13, 46, 36, 0.12); border-color: var(--c-border); }
	.tbg-hnear__touch { top: 76px; }

	.tbg-hnear__panel { top: auto; right: 0; left: 0; bottom: 0; width: auto; max-height: 82%; padding: 2px 16px 16px; gap: 12px; border-radius: 24px 24px 0 0; box-shadow: 0 -6px 24px rgba(13, 46, 36, 0.18); }
	.tbg-hnear__panel:not(.is-open) [data-more] { display: none; }
	.tbg-hnear__grip { display: flex; order: 0; align-self: center; align-items: center; justify-content: center; width: 72px; min-height: 28px; border: 0; background: none; padding: 0; }
	.tbg-hnear__grip::before { content: ""; width: 44px; height: 5px; border-radius: 3px; background: var(--c-border-mid); }
	.tbg-hnear__foot { order: 1; margin-top: 0; padding-top: 0; border-top: 0; }
	.tbg-hnear__allwrap { order: 7; display: none; }
	.tbg-hnear__panel.is-open .tbg-hnear__allwrap { display: block; }
	.tbg-hnear__actions { order: 2; }
	.tbg-hnear__near, .tbg-hnear__toggle { min-height: 48px; }
	.tbg-hnear__toggle { display: inline-flex; flex: 1; align-items: center; justify-content: center; gap: 6px; padding: 0 16px; border: 1px solid var(--c-border-mid); border-radius: var(--radius-pill); background: #fff; color: var(--c-green-800); font-size: 15px; font-weight: 700; }
	.tbg-hnear__geo { order: 3; }
	.tbg-hnear__search { order: 4; }
	.tbg-hnear__regions { order: 5; }
	.tbg-hnear__who { order: 6; }
	.tbg-hnear__seg-btn { min-height: 44px; }
	.tbg-hnear__chip { min-height: 44px; }
	.tbg-hnear__cards { order: 8; display: flex; gap: 10px; margin: 0 -16px; padding: 2px 16px 4px; overflow-x: auto; scrollbar-width: none; }
	.tbg-hnear__cards::-webkit-scrollbar { display: none; }
	.tbg-hnear__cards:empty { display: none; }
	.tbg-hnear__card { flex: none; width: 250px; }
	.tbg-hnear__card a { display: flex; gap: 10px; align-items: center; padding: 8px; border: 1px solid var(--c-border); border-radius: var(--radius-card); background: #fff; color: var(--c-green-800); }
	.tbg-hnear__card img, .tbg-hnear__card-ph { width: 84px; height: 64px; flex: none; border-radius: 12px; object-fit: cover; background: var(--c-mint); }
	.tbg-hnear__card-text { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
	.tbg-hnear__card-title { font-size: 14px; font-weight: 800; line-height: 1.25; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
	.tbg-hnear__card-meta { font-size: 12px; color: var(--c-green-muted); }
}
