/**
 * DRI Foundation — Global Giving Map
 *
 * Colours from the Foundation style guide (25 Aug 2026 swatch table).
 * Type is Arial, which the guide names as the default for web.
 *
 * Layout principle after the 27 Aug review: the map is the page. Everything else
 * collapses beneath it, so the map is visible without scrolling and the page is a
 * screen tall at rest rather than seventeen thousand pixels.
 */

:root {
	--drif-blue: #00467f;
	--drif-green: #00a94f;
	--drif-green-ink: #007a39;
	--drif-blue-light: #456da9;
	--drif-gray: #4c4d4f;
	--drif-gray-light: #a7a9ac;
	--drif-rule: #dcdee0;
	--drif-surface: #ffffff;
	--drif-surface-alt: #f4f5f6;
	--drif-shadow: 0 1px 3px rgba(0, 0, 0, 0.09), 0 6px 18px rgba(0, 0, 0, 0.07);
}

*,
*::before,
*::after {
	box-sizing: border-box;
}

body {
	margin: 0;
	font-family: Arial, Helvetica, sans-serif;
	font-size: 16px;
	line-height: 1.5;
	color: var(--drif-gray);
	background: var(--drif-surface);
	-webkit-text-size-adjust: 100%;
}

.drif-shell {
	max-width: 1360px;
	margin: 0 auto;
	padding: 20px 20px 56px;
}

/* -------------------------------------------------------------- headings */

/*
 * Foundation green on white is 3.1:1 -- fine for large bold text under WCAG AA,
 * not for body copy. Every green heading here is 19px or larger and bold; running
 * text stays in the greys.
 */
.drif-h1 {
	margin: 0 0 4px;
	font-size: 22px;
	line-height: 1.25;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--drif-green);
}

.drif-sub {
	margin: 0 0 16px;
	font-size: 14px;
	color: var(--drif-gray);
}

/* --------------------------------------------------------------- filters */

.drif-controls {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	padding: 12px 14px;
	background: var(--drif-surface-alt);
	border-top: 3px solid var(--drif-blue);
	margin-bottom: 12px;
}

.drif-field {
	display: flex;
	align-items: center;
	gap: 8px;
}

.drif-field > label {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--drif-blue);
	white-space: nowrap;
}

.drif-controls select,
.drif-controls input[type="search"] {
	font: inherit;
	font-size: 14px;
	padding: 7px 10px;
	border: 1px solid var(--drif-gray-light);
	border-radius: 3px;
	background: var(--drif-surface);
	color: var(--drif-gray);
	min-width: 120px;
}

.drif-controls input[type="search"] {
	min-width: 200px;
}

.drif-btn {
	font: inherit;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	padding: 9px 18px;
	border-radius: 3px;
	border: 1px solid transparent;
	cursor: pointer;
	background: var(--drif-green);
	color: #fff;
}

.drif-btn:hover {
	background: var(--drif-green-ink);
}

.drif-btn--quiet {
	background: transparent;
	border-color: var(--drif-gray-light);
	color: var(--drif-gray);
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
}

.drif-btn--quiet:hover {
	background: var(--drif-surface);
	border-color: var(--drif-blue);
	color: var(--drif-blue);
}

.drif-count {
	margin-left: auto;
	font-size: 13px;
	color: var(--drif-gray);
	white-space: nowrap;
}

:where(button, select, input, a, summary, [tabindex]):focus-visible {
	outline: 3px solid var(--drif-blue-light);
	outline-offset: 2px;
}

/* ----------------------------------------------------------------- stage */

.drif-stage {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 330px;
	gap: 14px;
}

.drif-map-wrap {
	position: relative;
	min-width: 0;
}

.drif-map {
	height: 560px;
	background: #0d2b3e;
	border: 1px solid var(--drif-rule);
}

.drif-basemap {
	position: absolute;
	top: 10px;
	left: 10px;
	display: flex;
	gap: 0;
	background: rgba(255, 255, 255, 0.94);
	border-radius: 3px;
	box-shadow: var(--drif-shadow);
	overflow: hidden;
	z-index: 2;
}

.drif-basemap button {
	font: inherit;
	font-size: 12px;
	font-weight: 700;
	padding: 7px 12px;
	border: 0;
	background: transparent;
	color: var(--drif-gray);
	cursor: pointer;
}

.drif-basemap button + button {
	border-left: 1px solid var(--drif-rule);
}

.drif-basemap button[aria-pressed="true"] {
	background: var(--drif-blue);
	color: #fff;
}

.drif-map__note {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	align-items: center;
	text-align: center;
	gap: 6px;
	padding: 28px;
	background: var(--drif-surface-alt);
	color: var(--drif-gray);
}

.drif-map__note p {
	margin: 0;
	max-width: 34em;
}

/* -------------------------------------------------------------- selected */

.drif-selected {
	border: 1px solid var(--drif-rule);
	border-top: 3px solid var(--drif-green);
	background: var(--drif-surface);
	padding: 16px;
	display: flex;
	flex-direction: column;
	max-height: 560px;
	overflow-y: auto;
}

.drif-selected__empty {
	color: var(--drif-gray);
	font-size: 14px;
	margin: auto 0;
	text-align: center;
}

.drif-selected__empty strong {
	display: block;
	color: var(--drif-blue);
	font-size: 15px;
	margin-bottom: 6px;
}

.drif-selected__cause {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--drif-gray);
	margin-bottom: 8px;
}

.drif-selected__name {
	margin: 0 0 4px;
	font-size: 18px;
	line-height: 1.3;
	color: var(--drif-blue);
}

.drif-selected__meta {
	margin: 0 0 10px;
	font-size: 13px;
	color: var(--drif-gray);
}

.drif-selected__desc {
	margin: 0 0 12px;
	font-size: 14px;
}

.drif-selected img {
	width: 100%;
	height: auto;
	display: block;
	margin-bottom: 12px;
}

.drif-link {
	display: inline-block;
	font-weight: 700;
	font-size: 14px;
	color: var(--drif-green-ink);
}

.drif-dot {
	width: 11px;
	height: 11px;
	border-radius: 50%;
	flex: 0 0 auto;
	display: inline-block;
}

/* ---------------------------------------------------------------- legend */

/*
 * The legend is also the cause filter. One control instead of two answers both of
 * the review notes: the five uppercase chips that ate a mobile screen are gone, and
 * the key sits where a reader looks for it -- directly under the map.
 */
.drif-legend {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px 8px;
	margin: 10px 0 0;
	padding: 0;
	border: 0;
}

.drif-legend legend {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	color: var(--drif-blue);
	padding: 0 8px 0 0;
	float: left;
	line-height: 30px;
}

.drif-key {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px 5px 8px;
	border: 1px solid var(--drif-rule);
	border-radius: 999px;
	font-size: 12.5px;
	cursor: pointer;
	background: var(--drif-surface);
	line-height: 1.3;
	user-select: none;
}

.drif-key:hover {
	border-color: var(--drif-key-color);
}

.drif-key input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
}

.drif-key .drif-dot {
	background: var(--drif-key-color);
	opacity: 0.28;
	box-shadow: inset 0 0 0 1px var(--drif-key-color);
}

.drif-key input:checked ~ .drif-dot {
	opacity: 1;
}

.drif-key input:checked ~ .drif-key__text {
	color: #1d1e20;
	font-weight: 700;
}

.drif-key:focus-within {
	outline: 3px solid var(--drif-blue-light);
	outline-offset: 2px;
}

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

.drif-section {
	margin-top: 14px;
	border: 1px solid var(--drif-rule);
	background: var(--drif-surface);
}

.drif-section > summary {
	list-style: none;
	cursor: pointer;
	padding: 14px 16px;
	display: flex;
	align-items: center;
	gap: 10px;
	background: var(--drif-surface-alt);
}

.drif-section > summary::-webkit-details-marker {
	display: none;
}

.drif-section__arrow {
	flex: 0 0 auto;
	width: 0;
	height: 0;
	border-left: 7px solid var(--drif-green);
	border-top: 5px solid transparent;
	border-bottom: 5px solid transparent;
	transition: transform 0.15s ease;
}

@media (prefers-reduced-motion: reduce) {
	.drif-section__arrow {
		transition: none;
	}
}

.drif-section[open] > summary .drif-section__arrow {
	transform: rotate(90deg);
}

.drif-section__title {
	font-size: 19px;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
	color: var(--drif-green);
	line-height: 1.25;
}

.drif-section__count {
	font-size: 13px;
	font-weight: 400;
	text-transform: none;
	letter-spacing: 0;
	color: var(--drif-gray);
	white-space: nowrap;
}

.drif-section__body {
	padding: 18px 16px 22px;
}

.drif-section__intro {
	margin: 0 0 16px;
	font-size: 14px;
	max-width: 68ch;
}

/* ------------------------------------------------------------ tombstones */

.drif-grid {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(252px, 1fr));
	gap: 16px;
}

.drif-tomb {
	border: 1px solid var(--drif-rule);
	padding: 14px 15px 15px;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.drif-tomb__cause {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 10.5px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--drif-gray-light);
}

.drif-tomb__name {
	margin: 0;
	font-size: 15px;
	line-height: 1.3;
	color: var(--drif-blue);
}

.drif-tomb__desc {
	margin: 0;
	font-size: 13.5px;
}

.drif-tomb__grants {
	list-style: none;
	margin: 4px 0 0;
	padding: 0;
	font-size: 13px;
	border-top: 1px solid var(--drif-rule);
}

.drif-tomb__grant {
	padding: 6px 0 0;
	display: flex;
	flex-wrap: wrap;
	gap: 4px 8px;
	align-items: baseline;
}

.drif-tomb__year {
	font-weight: 700;
	color: var(--drif-blue);
	white-space: nowrap;
}

.drif-tomb__area {
	color: var(--drif-gray);
	flex: 1 1 auto;
	min-width: 0;
}

.drif-tomb__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-top: auto;
	padding-top: 10px;
}

.drif-mini {
	font: inherit;
	font-size: 12.5px;
	padding: 5px 11px;
	border: 1px solid var(--drif-rule);
	border-radius: 3px;
	background: transparent;
	color: var(--drif-gray);
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
}

.drif-mini:hover {
	border-color: var(--drif-blue);
	color: var(--drif-blue);
}

.drif-mini--go {
	border-color: var(--drif-green);
	color: var(--drif-green-ink);
	font-weight: 700;
}

/* ------------------------------------------------------------ pagination */

.drif-pager {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 20px;
	flex-wrap: wrap;
}

.drif-pager__status {
	font-size: 13px;
	color: var(--drif-gray);
	margin: 0 8px;
}

.drif-pager button[disabled] {
	opacity: 0.4;
	cursor: default;
}

.drif-empty {
	font-size: 14px;
	color: var(--drif-gray);
}

/* ----------------------------------------------------------------- about */

.drif-about h4 {
	margin: 18px 0 6px;
	font-size: 14px;
	color: var(--drif-blue);
}

.drif-about p,
.drif-about li {
	font-size: 14px;
	max-width: 72ch;
}

.drif-about ul {
	margin: 0;
	padding-left: 20px;
}

/* ------------------------------------------------------------------ a11y */

.screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

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

@media (max-width: 1000px) {
	.drif-stage {
		grid-template-columns: minmax(0, 1fr);
	}

	.drif-selected {
		max-height: none;
	}

	.drif-map {
		height: 440px;
	}
}

@media (max-width: 620px) {
	.drif-shell {
		padding: 16px 14px 44px;
	}

	.drif-h1 {
		font-size: 18px;
	}

	.drif-controls {
		gap: 8px;
		padding: 10px;
	}

	.drif-field,
	.drif-controls input[type="search"],
	.drif-controls select {
		width: 100%;
		min-width: 0;
	}

	.drif-field > label {
		flex: 0 0 auto;
	}

	.drif-field select {
		flex: 1 1 auto;
	}

	.drif-btn {
		width: 100%;
	}

	.drif-count {
		margin-left: 0;
		width: 100%;
	}

	.drif-map {
		height: 380px;
	}

	.drif-legend legend {
		float: none;
		width: 100%;
		line-height: 1.4;
		margin-bottom: 2px;
	}

	.drif-key {
		font-size: 12px;
		padding: 4px 9px 4px 7px;
	}

	.drif-section__title {
		font-size: 16px;
	}

	.drif-grid {
		grid-template-columns: minmax(0, 1fr);
	}
}
