/* Trip Bagalil lodging results: the map of the places in the list (point 23 of the lodging review).
 * Loaded only on the lodging results. The map library's own stylesheet (assets/vendor/leaflet) loads together with the map.
 * State: .is-open / .is-closed on .tbg-rmap, set before the first paint by the inline script in archive-experience.php
 * (open on a wide screen, closed on a phone, the visitor's own choice first). Neither class: no JavaScript, so no map. */

.tbg-rmap { margin: 0 0 18px; }
.tbg-rmap__bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; }
.tbg-rmap__btn { display: inline-flex; align-items: center; gap: 6px; }
.tbg-rmap__btn[hidden] { display: none; } /* without JavaScript there is no map, so no button */
.tbg-rmap__btn .tbg-icon { width: 17px; height: 17px; color: var(--c-green-700); }
.tbg-rmap__btn[aria-busy="true"] { cursor: progress; opacity: .75; }
/* On a phone the map waits behind the button, so there the closed button is the loud one: full width, brand green. */
@media (max-width: 767px) {
	.tbg-rmap__bar { flex-direction: column; align-items: stretch; }
	.tbg-rmap__btn { width: 100%; min-height: 48px; }
	.tbg-rmap.is-closed .tbg-rmap__btn { background: var(--c-green-700); border-color: var(--c-green-700); color: #fff; font-size: 15px; }
	.tbg-rmap.is-closed .tbg-rmap__btn .tbg-icon { color: #fff; }
}
.tbg-rmap__msg { margin: 0; font-size: 13px; font-weight: 600; color: var(--c-green-800); }
.tbg-rmap__msg:empty { display: none; }

.tbg-rmap__panel { display: none; margin-top: 12px; }
.tbg-rmap.is-open .tbg-rmap__panel { display: block; }
/* Until the map is drawn the holder keeps its place, with a quiet line instead of an empty box. */
.tbg-rmap__map:empty::before { content: "טוענים את המפה…"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; direction: rtl; font-size: 14px; font-weight: 600; color: var(--c-green-muted); }
/* isolation: the library stacks its layers up to z-index 1000, and they must stay under the site's sticky header and panels. */
.tbg-rmap__map { position: relative; z-index: 0; isolation: isolate; direction: ltr; width: 100%; height: min(62vh, 440px); border: 1px solid var(--c-border-mid); border-radius: var(--radius-card); background: var(--c-map); overflow: hidden; }
@media (min-width: 768px) { .tbg-rmap__map { height: min(68vh, 560px); } }
.tbg-rmap__note { margin: 8px 0 0; font-size: 13px; color: var(--c-green-muted); }

/* Pins: a round brand-green dot; a number when several places share one point. */
.tbg-rmap__map .tbg-rmap-pin { box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 3px solid #fff; border-radius: 50%; background: var(--c-green-700); color: #fff; font: 700 12px/1 var(--font, sans-serif); box-shadow: 0 1px 5px rgba(13, 46, 36, .45); cursor: pointer; }
.tbg-rmap-pin:hover, .tbg-rmap-pin.is-open { background: var(--c-orange); }
.tbg-rmap-pin:focus-visible { outline: 3px solid var(--c-orange); outline-offset: 2px; }

/* Popup: the card of the place, right to left. */
.tbg-rmap__map .leaflet-popup-content-wrapper { padding: 0; border-radius: 14px; overflow: hidden; box-shadow: var(--shadow-panel); }
.tbg-rmap__map .leaflet-popup-content { width: 230px !important; margin: 0; font: inherit; line-height: 1.35; }
.tbg-rmap__map .leaflet-container, .tbg-rmap__map.leaflet-container { font-family: inherit; }
/* The close button sits on the left, away from the right-aligned Hebrew title. */
.tbg-rmap__map.leaflet-container a.leaflet-popup-close-button { top: 6px; left: 6px; right: auto; width: 28px; height: 28px; border-radius: 50%; background: rgba(255, 255, 255, .94); color: var(--c-green-800); font: 700 20px/28px sans-serif; text-align: center; }
.tbg-rmap-pop { direction: rtl; text-align: right; max-height: 300px; overflow-y: auto; }
.tbg-rmap-pop__count { margin: 0; padding: 12px 14px 4px 40px; font-size: 13px; font-weight: 700; color: var(--c-green-muted); }
.tbg-rmap__map.leaflet-container a.tbg-rmap-pop__item { display: block; color: var(--c-green-800); text-decoration: none; }
.tbg-rmap-pop:not(.tbg-rmap-pop--many) .tbg-rmap-pop__item:not(:has(img)) .tbg-rmap-pop__text { padding-left: 40px; }
.tbg-rmap { scroll-margin-top: 96px; } /* the sticky header */
.tbg-rmap-pop__item + .tbg-rmap-pop__item { border-top: 1px solid var(--c-border-soft); }
.tbg-rmap-pop__img { display: block; width: 100%; height: 118px; object-fit: cover; background: var(--c-mint); }
.tbg-rmap-pop__text { display: block; padding: 10px 14px 12px; }
.tbg-rmap-pop--many .tbg-rmap-pop__img { display: none; }
.tbg-rmap-pop__title { display: block; font-size: 15px; font-weight: 700; }
.tbg-rmap-pop__meta { display: block; margin-top: 2px; font-size: 13px; color: var(--c-green-muted); }
.tbg-rmap-pop__go { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 700; color: var(--c-green-700); text-decoration: underline; text-underline-offset: 2px; }
.tbg-rmap-pop__item:hover .tbg-rmap-pop__title, .tbg-rmap-pop__item:focus-visible .tbg-rmap-pop__title { text-decoration: underline; }
.tbg-rmap__map .leaflet-control-attribution { font-size: 11px; }

/* Keyboard: one step over the pins to the list (the map can hold a couple of hundred of them). */
.tbg-rmap__skip { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.tbg-rmap__skip:focus { position: static; display: inline-block; width: auto; height: auto; margin: 0 0 8px; padding: 6px 14px; overflow: visible; clip: auto; border-radius: var(--radius-pill); background: var(--c-green-700); color: #fff; font-weight: 700; font-size: 14px; }
.tbg-rmap__note:focus { outline: none; }
/* The link fills the popup, whose edges clip an outline drawn outside it: the ring is drawn inside. */
.tbg-rmap__map .tbg-rmap-pop__item:focus-visible { outline-offset: -4px; }
/* A wider touch and click area around the small dot. */
.tbg-rmap__map .tbg-rmap-pin::after { content: ""; position: absolute; inset: -8px; border-radius: 50%; }

/* Close pins gathered into one circle with their number (Leaflet.markercluster). Lighter than a single pin, so one place
 * and a group of places never look alike. */
.tbg-rmap__map .tbg-rmap-cluster { box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 3px solid #fff; border-radius: 50%; background: var(--c-mint-chip); color: var(--c-green-900); font: 800 13px/1 var(--font, sans-serif); box-shadow: 0 1px 6px rgba(13, 46, 36, .5), 0 0 0 4px rgba(7, 81, 61, .22); cursor: pointer; }
.tbg-rmap__map .tbg-rmap-cluster:hover { background: var(--c-yellow); }
.tbg-rmap__map .tbg-rmap-cluster:focus-visible { outline: 3px solid var(--c-orange); outline-offset: 2px; }
