/* RCVDA locator — [rcvda_locator] feed-driven map + filterable list (rcvda-core).
   A generalisation of FPT's food directory: cookieless MapLibre map beside a
   searchable, facet-filtered, client-rendered list. Colours adapt per site via the
   base-theme brand token (with a navy fallback); dark mode via html[data-theme]. */

.rcvda-loc {
	--rl-accent: var(--wp--preset--color--brand-light, #033e8c);
	--rl-ink: var(--wp--preset--color--contrast, #231f20);
	--rl-muted: var(--wp--preset--color--muted, #6b6560);
	--rl-surface: var(--wp--preset--color--surface, #f8f8f6);
	--rl-rule: var(--wp--preset--color--divider, #e4e1dc);
	--rl-field: #fff;
	color: var(--rl-ink);
}
.rcvda-loc *, .rcvda-loc *::before, .rcvda-loc *::after { box-sizing: border-box; }

/* ── Controls ────────────────────────────────────────────────────────────── */
.rcvda-loc__controls { margin: 0 0 1.1rem; }
.rcvda-loc__srch-label { display: block; font-weight: 600; font-size: .82rem; margin: 0 0 .4rem; }
.rcvda-loc__srch-row { display: flex; gap: .5rem; flex-wrap: wrap; align-items: center; }
.rcvda-loc__field { position: relative; display: flex; flex: 1 1 260px; min-width: 0; }
.rcvda-loc__input {
	flex: 1 1 auto; min-width: 0; height: 46px; font: inherit; font-size: 1rem;
	padding: 0 3.6em 0 .9em; border: 1px solid var(--rl-rule); border-radius: 9px;
	background: var(--rl-field); color: var(--rl-ink);
}
.rcvda-loc__input:focus-visible { outline: 3px solid var(--rl-accent); outline-offset: 1px; }
.rcvda-loc__loc {
	position: absolute; top: 1px; right: 1px; bottom: 1px; width: 48px;
	display: inline-flex; align-items: center; justify-content: center;
	padding: 0; border: 0; border-left: 1px solid var(--rl-rule);
	border-radius: 0 8px 8px 0; background: transparent; color: var(--rl-accent); cursor: pointer;
}
.rcvda-loc__loc svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rcvda-loc__loc:hover { background: color-mix(in srgb, var(--rl-accent) 10%, transparent); }
.rcvda-loc__geomsg { margin: .5rem 0 0; font-size: .85rem; color: var(--rl-muted); min-height: 1.2em; }
.rcvda-loc__radius { display: inline-flex; align-items: center; }
.rcvda-loc__radius-select {
	height: 46px; font: inherit; font-size: .95rem; padding: 0 2.4em 0 .8em; border: 1px solid var(--rl-rule);
	border-radius: 9px; background-color: var(--rl-field); color: var(--rl-ink); cursor: pointer;
	-webkit-appearance: none; appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236B6560' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right .8em center; background-size: .75em;
}
.rcvda-loc__radius-select:focus-visible { outline: 3px solid var(--rl-accent); outline-offset: 1px; }

/* Filters flow as a wrapping row: the borough facet takes its own full line first,
   then Access + Cover share the next line. */
.rcvda-loc__filters { display: flex; flex-wrap: wrap; gap: .55rem .9rem; margin-top: .9rem; align-items: flex-start; }
.rcvda-loc__facet { display: flex; flex-wrap: wrap; gap: .4rem; align-items: center; }
/* Borough always on its own line, above Access/Cover — order:-1 so it leads
   regardless of the feed's facet order (a cached feed must not reshuffle it). */
.rcvda-loc__facet--borough { flex: 1 1 100%; order: -1; }
.rcvda-loc__chip {
	display: inline-flex; align-items: center; gap: .4em; font: inherit; font-size: .82rem;
	font-weight: 600; padding: .4em .85em; border: 1.5px solid var(--rl-rule);
	border-radius: 999px; background: var(--rl-field); color: var(--rl-ink); cursor: pointer;
}
.rcvda-loc__chip svg { width: 1em; height: 1em; color: currentColor; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.125em; }
.rcvda-loc__chip:hover { filter: brightness(1.06); }
.rcvda-loc__chip:focus-visible { outline: 3px solid var(--rl-accent); outline-offset: 1px; }
.rcvda-loc__chip.is-active { background: var(--rl-accent); color: #fff; border-color: var(--rl-accent); }

/* ── Body: list + map ────────────────────────────────────────────────────── */
.rcvda-loc__body { display: grid; grid-template-columns: 1fr 1fr; gap: 1.25rem; align-items: start; }
/* Stacked layout: full-width map on top, results below (better where the dataset
   spans a wide area, e.g. the whole Tees Valley). */
.rcvda-loc--stacked .rcvda-loc__body { grid-template-columns: 1fr; }
.rcvda-loc--stacked .rcvda-loc__map-wrap { position: static; order: -1; }
/* Results flow into responsive columns below the full-width map rather than one
   very long column. */
.rcvda-loc--stacked .rcvda-loc__list { max-height: none; overflow: visible; column-width: 300px; column-gap: 1.5rem; }
.rcvda-loc--stacked .rcvda-loc__item { break-inside: avoid; }
.rcvda-loc--stacked.rcvda-loc--onecol .rcvda-loc__list { column-width: auto; column-count: 1; }
.rcvda-loc__list-wrap { min-width: 0; }
.rcvda-loc__count { margin: 0 0 .6rem; font-size: .82rem; color: var(--rl-muted); font-weight: 600; }
.rcvda-loc__list { list-style: none; margin: 0; padding: 0; max-height: 560px; overflow-y: auto; }
.rcvda-loc__item-actions { margin: .45rem 0 0; display: flex; flex-wrap: wrap; gap: .2rem 1.1rem; }
.rcvda-loc__item-row { margin: .25rem 0 0; display: flex; flex-wrap: wrap; align-items: baseline; gap: .1rem .9rem; font-size: .82rem; color: var(--rl-muted); }
.rcvda-loc__item-type { color: var(--rl-muted); }
.rcvda-loc__pop-head { display: flex; align-items: center; gap: .4em; margin-bottom: .3rem; }
.rcvda-loc__pop-glyph { flex: none; width: 1.2em; height: 1.2em; }
.rcvda-loc__pop-glyph svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.9; stroke-linecap: round; stroke-linejoin: round; }
.rcvda-loc__ico { width: 1em; height: 1em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; vertical-align: -.12em; margin-right: .3em; }
.rcvda-loc__pop-dist { font-weight: 600; }
.rcvda-loc__flag { display: inline-block; font-size: .72rem; font-weight: 700; padding: .1em .55em; border-radius: 999px; line-height: 1.5; }
.rcvda-loc__flag--open { background: #007A33; color: #fff; }
.rcvda-loc__flag--warn { background: #E69F00; color: #1a1a1a; }
.rcvda-loc__item-link { font-size: .82rem; font-weight: 600; color: var(--rl-accent); text-decoration: none; }
.rcvda-loc__item-link:hover { text-decoration: underline; }
.rcvda-loc__more { margin-top: 1rem; font: inherit; font-size: .85rem; font-weight: 600; padding: .55em 1.2em; border: 1.5px solid var(--rl-rule); border-radius: 999px; background: var(--rl-field); color: var(--rl-accent); cursor: pointer; }
.rcvda-loc__more:hover { filter: brightness(1.06); }
.rcvda-loc__item { padding: .8rem .2rem .8rem .95rem; border-left: 3px solid var(--rl-rule); border-bottom: 1px solid var(--rl-rule); }
.rcvda-loc__item-head { display: flex; align-items: baseline; gap: .5rem; flex-wrap: wrap; }
.rcvda-loc__item-glyph { display: inline-flex; align-self: center; flex: none; }
.rcvda-loc__item-glyph svg { width: 1.15em; height: 1.15em; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rcvda-loc__item-name { font-weight: 600; font-size: 1rem; text-decoration: none; color: var(--rl-accent); }
.rcvda-loc__item-name:hover { text-decoration: underline; }
.rcvda-loc__item-meta { margin: .35rem 0 0; display: flex; align-items: center; gap: .5rem; flex-wrap: wrap; }
.rcvda-loc__badge { font-size: .72rem; font-weight: 600; padding: .2em .6em; border-radius: 999px; color: var(--rl-ink); background: color-mix(in srgb, var(--rl-muted) 18%, transparent); }
.rcvda-loc__item-line { margin: .2rem 0 0; font-size: .84rem; color: var(--rl-muted); }
.rcvda-loc__item-loc { margin: .25rem 0 0; font-size: .84rem; color: var(--rl-muted); }
.rcvda-loc__dist { font-weight: 600; color: var(--rl-accent); }
.rcvda-loc__empty { padding: 1.2rem .95rem; color: var(--rl-muted); }

.rcvda-loc__map-wrap { position: sticky; top: 1rem; }
.rcvda-loc__map { height: 560px; border: 1px solid var(--rl-rule); border-radius: 12px; overflow: hidden; background: var(--rl-surface); }
.rcvda-loc__map-note { margin: .4rem 0 0; font-size: .72rem; color: var(--rl-muted); }
.rcvda-loc__map-fail { padding: 1.5rem; color: var(--rl-muted); font-size: .9rem; }

/* ── Markers + popup ─────────────────────────────────────────────────────── */
.rcvda-loc__marker {
	width: 30px; height: 30px; border-radius: 50%; border: 2px solid #fff; padding: 0;
	display: flex; align-items: center; justify-content: center; cursor: pointer;
	box-shadow: 0 1px 4px rgba(0,0,0,.35);
}
.rcvda-loc__marker svg { width: 16px; height: 16px; stroke: #fff; fill: none; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.rcvda-loc__you { width: 16px; height: 16px; border-radius: 50%; background: #4079ac; border: 3px solid #fff; box-shadow: 0 0 0 3px rgba(64,121,172,.4); }

.rcvda-loc__pop { font-family: inherit; min-width: 180px; }
.rcvda-loc__pop-name { font-weight: 600; font-size: .95rem; color: var(--rl-accent); text-decoration: none; }
.rcvda-loc__pop-name:hover { text-decoration: underline; }
.rcvda-loc__pop-line { margin: .3rem 0 0; font-size: .82rem; color: var(--rl-ink); }
.rcvda-loc__pop-badges { display: flex; flex-wrap: wrap; gap: .4em; margin: .25rem 0 .1rem; }
.rcvda-loc__pop-dir { display: inline-block; margin-top: .5rem; font-size: .82rem; font-weight: 600; color: var(--rl-accent); }

/* ── Mobile: list on top, map beneath ────────────────────────────────────── */
@media (max-width: 782px) {
	.rcvda-loc__body { grid-template-columns: 1fr; }
	.rcvda-loc__list { max-height: none; }
	.rcvda-loc__map-wrap { position: static; }
	.rcvda-loc__map { height: 360px; }
}

/* ── Dark mode ───────────────────────────────────────────────────────────── */
html[data-theme="dark"] .rcvda-loc { --rl-field: #202a25; --rl-rule: #2e3a44; }
/* --rl-ink / --rl-muted / --rl-accent inherit the theme's dark-aware tokens (contrast / muted / brand-light), so no hardcoded colours here. */
/* Text drawn ON the always-light map (popup, attribution) must stay dark. */
html[data-theme="dark"] .rcvda-loc .maplibregl-popup-content { background: #fff; }
html[data-theme="dark"] .rcvda-loc__pop-line { color: #231f20; }
html[data-theme="dark"] .rcvda-loc .maplibregl-popup-content a.rcvda-loc__pop-name,
html[data-theme="dark"] .rcvda-loc .maplibregl-popup-content a.rcvda-loc__pop-dir { color: #10224b; }
html[data-theme="dark"] .rcvda-loc .maplibregl-ctrl-attrib { background: rgba(255,255,255,.85); }
html[data-theme="dark"] .rcvda-loc .maplibregl-ctrl.maplibregl-ctrl-attrib,
html[data-theme="dark"] .rcvda-loc .maplibregl-ctrl.maplibregl-ctrl-attrib a { color: #231f20; }

/* Borough + Tees Valley-wide filter chips — a 2px outline in the agreed colour; the feed sets --cat per chip (fixed Tees Valley borough colours + TVCA whole-area navy for Tees Valley-wide; DESIGN.md). */
.rcvda-loc__chip[style*="--cat"] { border: 2px solid var(--cat); }
.rcvda-loc__chip[style*="--cat"].is-active { background: var(--cat); border-color: var(--cat); color: #fff; }
.rcvda-loc__chip[data-value="Middlesbrough"].is-active,
.rcvda-loc__chip[data-value="Stockton-on-Tees"].is-active { color: #1a1a1a; }
