/* Colours come from the theme (--primary red, --secondary charcoal); fallbacks are the same values. */
.li-loc {
	--li-accent: var(--primary, #ec1e24);
	--li-dark: var(--secondary, #404041);
	--li-border: #e2e2e2;
	--li-bg: #f5f5f5;
	--li-text: var(--secondary, #404041);
	--li-max: 1320px; /* width of the centred content (toggle, list cards) */
	color: var(--li-text);
	background: #fff;

	/* Full width of the screen. The script refines this to the exact pixels; this is the fallback. */
	position: relative;
	box-sizing: border-box;
	width: 100vw;
	max-width: none;
	margin-left: calc(50% - 50vw);
	margin-right: 0;
	clear: both;

	/* Space above and below the whole section */
	padding: 80px 0;
}

/* The full-width trick can add a sideways scrollbar on some browsers; this stops it. */
body:has(.li-loc) { overflow-x: clip; }

.li-loc *, .li-loc *::before, .li-loc *::after { box-sizing: border-box; }
.li-loc [hidden] { display: none !important; }

/* Toggle bar: its own row above the map, with space underneath */
.li-loc__bar { padding: 0 24px 40px; }
.li-loc__toggle { display: flex; justify-content: center; gap: 12px; }
.li-loc__tab {
	appearance: none; cursor: pointer; background: #fff; color: #777; font: inherit; font-weight: 600;
	border: 2px solid #c9c9c9; border-radius: 10px; padding: 12px 26px; min-width: 150px;
}
.li-loc__tab:hover { border-color: var(--li-accent); color: var(--li-accent); }
.li-loc__tab.is-active { border-color: var(--li-accent); color: var(--li-accent); }
.li-loc__tab:focus-visible, .li-loc__item:focus-visible, .li-loc__search:focus-visible { outline: 3px solid var(--li-accent); outline-offset: 2px; }

/* Map: edge to edge, with the floating panel lined up to the content width */
.li-loc__map-wrap { position: relative; }
.li-loc__map { height: 680px; width: 100%; z-index: 0; background: #eceeef; }

/* Greyscale base map so the pins stand out. Only the tiles are filtered, never pins or popups. */
.li-loc__map .leaflet-tile-pane { filter: grayscale(1) contrast(.95) brightness(1.05) !important; }
.li-loc__map .leaflet-control-attribution { font-size: 11px; }
.li-loc__map .leaflet-bar a { color: var(--li-dark); }

.li-loc__panel {
	position: absolute; z-index: 500; top: 24px; left: max(24px, calc((100% - var(--li-max)) / 2));
	width: 380px; max-width: calc(100% - 48px);
	max-height: calc(100% - 48px); display: flex; flex-direction: column;
	background: #fff; border-radius: 14px; box-shadow: 0 6px 24px rgba(0,0,0,.18); padding: 18px 20px;
}
.li-loc__panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 8px; }
.li-loc__panel-head strong { font-size: 1.3rem; }
.li-loc__search { flex: 1; min-width: 0; max-width: 170px; padding: 10px 12px; border: 1px solid var(--li-border); border-radius: 8px; background: var(--li-bg); font: inherit; }
.li-loc__panel-list { list-style: none; margin: 0; padding: 0 6px 0 0; overflow-y: auto; }
.li-loc__item { padding: 14px 0; border-bottom: 1px solid var(--li-border); cursor: pointer; }
.li-loc__item:last-child { border-bottom: 0; }

/* Shared item bits */
.li-loc__name { margin: 0 0 6px; font-size: 1.05rem; font-weight: 700; }
.li-loc__addr { margin: 0 0 12px; font-size: .95rem; line-height: 1.45; }
.li-loc__row { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.li-loc__phone, .li-loc__book { color: var(--li-accent); font-weight: 700; text-decoration: none; }
.li-loc__phone:hover, .li-loc__book:hover { text-decoration: underline; }
.li-loc__badge { display: inline-block; vertical-align: middle; margin-left: 6px; padding: 2px 8px; font-size: .7rem; font-weight: 700; color: #fff; background: var(--li-accent); border-radius: 20px; }
.li-loc__empty { padding: 14px 0; color: #777; }

/* List view: centred to the content width */
.li-loc__grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 22px; max-width: var(--li-max); margin: 0 auto; padding: 0 24px; }
.li-loc__card { background: var(--li-bg); border: 1px solid var(--li-border); border-radius: 14px; padding: 20px 22px; display: flex; flex-direction: column; justify-content: space-between; }
.li-loc__card.is-featured { border-color: var(--li-accent); }
.li-loc__card .li-loc__addr { flex: 1; }

/* Pins. The built-in CSS pin is the fallback; the image takes over once it has loaded. */
.li-loc__pin { background: none; border: 0; }
.li-loc__pin span {
	display: block; width: 26px; height: 26px; margin: 0 auto; background: var(--li-accent);
	border-radius: 50% 50% 50% 0; transform: rotate(-45deg); box-shadow: 0 2px 5px rgba(0,0,0,.35); position: relative;
}
.li-loc__pin span::after { content: ""; position: absolute; width: 10px; height: 10px; background: #fff; border-radius: 50%; top: 8px; left: 8px; }
.li-loc__pin.is-featured span { width: 32px; height: 32px; background: var(--li-dark); }
.li-loc__pin.is-featured span::after { top: 11px; left: 11px; }

.li-loc__pin .li-loc__pin-img {
	display: none; position: absolute; left: 50%; bottom: 0; transform: translateX(-50%);
	width: auto; height: 36px; max-width: none; max-height: none; margin: 0; padding: 0; border: 0; box-shadow: none;
	filter: drop-shadow(0 2px 3px rgba(0,0,0,.3));
}
.li-loc__pin.is-featured .li-loc__pin-img { height: 46px; }
.li-loc__pin.has-img span { display: none; }
.li-loc__pin.has-img .li-loc__pin-img { display: block; }

.li-loc__popup { min-width: 220px; }

/* Tablet / mobile */
@media (max-width: 980px) {
	.li-loc__grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 680px) {
	.li-loc { padding: 48px 0; }
	.li-loc__bar { padding-bottom: 28px; }
	.li-loc__grid { grid-template-columns: 1fr; }
	.li-loc__tab { min-width: 0; flex: 1; padding: 12px 10px; }
	.li-loc__map { height: 420px; }
	/* Panel moves below the map so it never covers it on phones. */
	.li-loc__panel { position: static; width: auto; max-width: none; max-height: 360px; margin: 14px 16px 0; box-shadow: none; border: 1px solid var(--li-border); }
}
