/**
 * Where We Work map — filter tabs and tooltips.
 *
 * The tab markup comes from Interactive Geo Maps
 * (ProActions.php renders ul.igm-live-filter > li[data-map-id]); this only
 * restyles it. Colors are the site's brand tokens: green #67c0ae,
 * custom "Orange" #ff6b3a, medium gray #e0e0e0.
 */

.map_wrapper ul.igm-live-filter {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
	justify-content: center;
}

.map_wrapper ul.igm-live-filter li {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	margin: 0;
	padding: 10px 20px;
	border: 2px solid #e0e0e0;
	border-radius: 999px;
	background: #fff;
	color: #3f454c;
	font-size: 1.05rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

/* Color swatch on each tab, so the tab and the map agree. The per-tab color is
   injected by includes/swatches.php, keyed on the map ID. */
.map_wrapper ul.igm-live-filter li::before {
	content: "";
	width: 12px;
	height: 12px;
	border-radius: 3px;
	background: #c6cace;
	flex: 0 0 auto;
}

.map_wrapper ul.igm-live-filter li:hover {
	border-color: #c6cace;
	background: #f6f8fa;
}

.map_wrapper ul.igm-live-filter li.igm-live-filter-active {
	border-color: #355969;
	background: #355969;
	color: #fff;
}

.map_wrapper ul.igm-live-filter li.igm-live-filter-active::before {
	box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.65);
}

@media (max-width: 600px) {
	.map_wrapper ul.igm-live-filter li {
		padding: 8px 14px;
		font-size: 0.95rem;
	}
}

/* Tooltip contents — carried over from the original map. */
.clb-county-header {
	margin: 0 0 4px;
	font-size: 1.6rem;
	line-height: 1.25;
}

.clb-county-header ~ .clb-county-header {
	margin-top: 12px;
}

.clb-tt-school {
	font-size: 1.3rem;
	line-height: 1.5;
	opacity: 0.85;
}

/* ---------------------------------------------------------------------------
   District directory
   ---------------------------------------------------------------------------
   Replaces the old card grid. The previous version set
   `color: var(--medium-gray, #999)` on past-work districts — but this site
   defines --medium-gray as #eee, so the fallback never applied and roughly a
   third of the content rendered at 1.17:1 against white. Every color below is
   checked against WCAG AA (4.5:1 for body text, 3:1 for large text).

   Palette is the site's own brand: blue #355969, teal #67c0ae, ink #2a3139.
   --------------------------------------------------------------------------- */

.clb-dm-directory {
	--clb-dm-ink: #2a3139;        /* 12.6:1 on white */
	--clb-dm-muted: #4d545e;      /*  7.6:1 on white, 6.7:1 on the tinted panels */
	--clb-dm-blue: #355969;       /*  7.6:1 on white */
	--clb-dm-teal: #67c0ae;
	--clb-dm-rule: #e3e6ea;

	color: var(--clb-dm-ink);
}

.clb-dm-title {
	margin: 0 0 8px;
}

/* --- search ------------------------------------------------------------- */

.clb-dm-search {
	margin: 0 0 44px;
	max-width: 52rem;
}

.clb-dm-search-label {
	display: block;
	margin-bottom: 7px;
	font-size: 1.6rem;
	font-weight: 600;
	color: var(--clb-dm-ink);
}

.clb-dm-directory .clb-dm-search-input {
	width: 100%;
	/* The theme gives inputs a bottom margin. Left in, the search block's box
	   ends ~17px below the visible field and the chips no longer line up. */
	margin: 0;
	padding: 14px 18px;
	border: 2px solid var(--clb-dm-rule);
	border-radius: 6px;
	background: #fff;
	color: var(--clb-dm-ink);
	font-size: 1.8rem;
	line-height: 1.4;
}

.clb-dm-search-input:focus {
	outline: 3px solid rgba(53, 89, 105, 0.35);
	outline-offset: 2px;
	border-color: var(--clb-dm-blue);
}

.clb-dm-search-input::placeholder {
	color: var(--clb-dm-muted);
	opacity: 1;
}

.clb-dm-directory p.clb-dm-count {
	margin: 0;
	font-size: 1.5rem;
	color: var(--clb-dm-muted);
}

/* --- sections ----------------------------------------------------------- */

.clb-dm-section {
	margin: 0 0 48px;
}

.clb-dm-section-title {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px 20px;
	margin: 0 0 22px;
	padding-bottom: 10px;
	border-bottom: 2px solid var(--clb-dm-rule);
	color: var(--clb-dm-blue);
	font-size: 2.4rem;
	line-height: 1.2;
}

.clb-dm-section-count {
	flex: 0 0 auto;
	color: var(--clb-dm-muted);
	font-size: 1.5rem;
	font-weight: 400;
	letter-spacing: 0.02em;
}

/* --- district entries --------------------------------------------------- */

/* Multi-column, not grid. Entry heights are wildly ragged — CORE Fellows has 19
   of 29 districts with no school list at all — and a 2-track grid leaves a tall
   empty cell beside every short entry. Columns pack the flow instead. */
.clb-dm-grid {
	columns: 2;
	column-gap: 48px;
}

.clb-dm-district {
	break-inside: avoid;
	page-break-inside: avoid;      /* Safari still wants the old name. */
	display: inline-block;          /* Stops entries splitting across columns. */
	width: 100%;
	margin: 0 0 18px;
}

.clb-dm-district-name {
	margin: 0;
	font-size: 1.9rem;
	line-height: 1.3;
	color: var(--clb-dm-ink);
}

.clb-dm-district-name a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.clb-dm-district-name a:hover,
.clb-dm-district-name a:focus {
	color: var(--clb-dm-blue);
}

/* Status carried as words, never colour alone — the old version relied on a
   grey fill and a decorative star, which gave screen readers nothing. */
.clb-dm-status {
	display: inline-block;
	margin-left: 8px;
	padding: 2px 8px;
	border: 1px solid var(--clb-dm-rule);
	border-radius: 3px;
	color: var(--clb-dm-muted);
	font-size: 1.1rem;
	font-weight: 400;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	vertical-align: 2px;
	white-space: nowrap;
}

.clb-dm-directory p.clb-dm-county {
	margin: 3px 0 0;
	color: var(--clb-dm-muted);
	font-size: 1.5rem;
}

/* A hairline ties the schools to their district. Without it, a one-line entry
   and a five-school entry read as the same kind of thing separated by holes.

   Qualified with the element: the theme's `.entry-content ul` (0,2,0) beats a
   bare class and was adding 32px below every school list — so entries WITH
   schools sat 32px further from the next district than entries without, which
   is what made the rhythm look arbitrary. */
.clb-dm-directory ul.clb-dm-schools {
	margin: 6px 0 0;
	padding: 0 0 0 12px;
	border-left: 2px solid var(--clb-dm-rule);
	list-style: none;
}

.clb-dm-directory li.clb-dm-school {
	/* The theme sets list-style on the li, not the ul, so clearing it on
	   .clb-dm-schools alone left a second bullet beside our own marker. */
	list-style: none;
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 2px;
	color: var(--clb-dm-muted);
	font-size: 1.7rem;
	line-height: 1.5;
}

/* A filled star for active work, a hollow ring for past — shape as well as
   colour, so the distinction survives colourblindness and greyscale print. */
.clb-dm-marker {
	flex: 0 0 auto;
	width: 14px;
	height: 14px;
	margin-top: 0.36em;
	fill: currentColor;
	color: #767e8a;
}

.clb-dm-marker.is-active {
	width: 17px;
	height: 17px;
	margin-top: 0.28em;
	color: #4a9d88;
}

.clb-dm-directory li.clb-dm-school.is-active {
	color: var(--clb-dm-ink);
	font-weight: 500;
}

.clb-dm-school a {
	color: inherit;
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.clb-dm-school a:hover,
.clb-dm-school a:focus {
	color: var(--clb-dm-blue);
}

/* --- empty states ------------------------------------------------------- */

.clb-dm-directory p.clb-dm-section-empty,
.clb-dm-directory p.clb-dm-no-results {
	margin: 0;
	color: var(--clb-dm-muted);
	font-size: 1.6rem;
}

.clb-dm-directory p.clb-dm-no-results {
	padding: 24px 0;
}

[hidden] {
	display: none !important;
}

/* --- responsive --------------------------------------------------------- */

@media (max-width: 860px) {
	.clb-dm-grid {
		columns: 1;
	}

	.clb-dm-section-title {
		font-size: 2rem;
	}
}

/* ---------------------------------------------------------------------------
   Controls: search + program chips
   --------------------------------------------------------------------------- */

.clb-dm-controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: flex-start;
	gap: 16px 28px;
	margin: 0;
}

.clb-dm-search {
	/* Wide enough that the placeholder clears the Clear button's 96px of right
	   padding. Five chips need ~670px, so at most widths this wraps them onto
	   their own row — which is fine: both blocks then start at the same left
	   edge instead of one being squeezed. */
	flex: 1 1 34rem;
	max-width: 44rem;
	margin: 0;
}

.clb-dm-search-field {
	position: relative;
}

.clb-dm-search-field .clb-dm-search-input {
	padding-right: 96px;
}

/* A faint grey circle read as decoration. This is a real button: brand blue,
   white glyph, its own word. */
.clb-dm-clear {
	position: absolute;
	top: 50%;
	right: 7px;
	transform: translateY(-50%);
	display: inline-flex;
	align-items: center;
	gap: 5px;
	height: 36px;
	padding: 0 15px 0 12px;
	border: 0;
	border-radius: 999px;
	background: var(--clb-dm-blue);
	color: #fff;
	font-size: 1.45rem;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.clb-dm-clear-x {
	font-size: 1.8rem;
	line-height: 1;
	margin-top: -2px;
}

.clb-dm-clear:hover,
.clb-dm-clear:focus {
	background: #24404c;
}

.clb-dm-clear:focus-visible {
	outline: 3px solid rgba(53, 89, 105, 0.35);
	outline-offset: 2px;
}

/* Second affordance, next to the result count — this one also drops the chip
   filter, so there is always one obvious way back to the full list. */
.clb-dm-status-row {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 14px;
	margin: 12px 0 30px;
}

.clb-dm-reset {
	padding: 0;
	border: 0;
	background: none;
	color: var(--clb-dm-blue);
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.4;
	text-decoration: underline;
	text-decoration-thickness: 2px;
	text-underline-offset: 3px;
	cursor: pointer;
}

.clb-dm-reset:hover,
.clb-dm-reset:focus {
	color: #24404c;
}

.clb-dm-filters {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	padding: 0;
}

.clb-dm-chip {
	padding: 8px 16px;
	border: 2px solid var(--clb-dm-rule);
	border-radius: 999px;
	background: #fff;
	color: var(--clb-dm-muted);
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: border-color 0.15s ease, color 0.15s ease, background-color 0.15s ease;
}

.clb-dm-chip:hover {
	border-color: var(--clb-accent, var(--clb-dm-blue));
	color: var(--clb-accent-text, var(--clb-dm-ink));
}

.clb-dm-chip.is-selected {
	border-color: var(--clb-accent, var(--clb-dm-blue));
	background: var(--clb-accent, var(--clb-dm-blue));
	color: #fff;
}

/* ---------------------------------------------------------------------------
   Section accent + the CORE Fellows panel
   ---------------------------------------------------------------------------
   Program sections carry their own colour, taken from the program term — the
   same value that paints that layer on the map — so the page reads as one
   system and a new program brings its palette with it.
   --------------------------------------------------------------------------- */

.clb-dm-section-title {
	color: var(--clb-accent-text, var(--clb-dm-blue));
	border-bottom-color: var(--clb-accent-edge, var(--clb-dm-rule));
}

/* The panel treatment, applied to every named program. Each ground is that
   program's own colour, so the sections read as siblings rather than a box
   around one of them. Derived groupings (Other Active Work, Past Work) stay on
   white — the tint means "this is a program". */
.clb-dm-section.has-panel {
	padding: 26px 36px 28px;
	border-radius: 14px;
	background: var(--clb-accent-tint, #f6f8fa);
}

.clb-dm-section.has-panel .clb-dm-section-title {
	margin-top: 0;
	border-bottom-color: var(--clb-accent-edge);
}

.clb-dm-section.has-panel .clb-dm-schools {
	border-left-color: var(--clb-accent-edge);
}

/* ---------------------------------------------------------------------------
   Districts with no school list
   ---------------------------------------------------------------------------
   These were pills for a while. It packed beautifully and read as a different
   category — a row of tags sitting under a program, rather than more districts
   in it. Same object, same treatment: one alphabetical flow, identical name
   styling, just a tighter gap where there is no list to separate.
   --------------------------------------------------------------------------- */

.clb-dm-district.has-no-schools {
	margin-bottom: 18px;
}

@media (max-width: 860px) {
	.clb-dm-section.has-panel {
		padding: 26px 20px 22px;
	}

	.clb-dm-controls {
		flex-direction: column;
		align-items: stretch;
		gap: 16px;
	}

	/* flex-basis follows the main axis: once this stacks, `flex: 1 1 26rem`
	   becomes a 26rem *height* and opens a huge gap above the chips. */
	.clb-dm-search {
		flex: 0 0 auto;
		max-width: none;
	}

	.clb-dm-chip {
		font-size: 1.3rem;
		padding: 7px 13px;
	}
}
