/* Postcode Coverage Map
   Button rules are wrapped in :where() so they carry zero specificity — your
   theme's .button--main / .button--reverse styles always win. Everything here
   is a fallback for when nothing else claims the element. */

/* The outer wrapper is the query container — an element can't query its own
   width, so the two-column grid lives one level in. */
.phc-coverage-wrap {
	container-type: inline-size;
}

.phc-coverage {
	/* Oxygen global colours, with hex fallbacks if the names differ.
	   Check yours under Oxygen → Manage → Colors. */
	--phc-green: var(--green, #19a79c);
	--phc-purple: var(--purple, #23306b);
	--phc-pale-purple: var(--pale-purple, #efedf7);

	/* Small text on a light background needs 4.5:1 to pass WCAG AA, which the
	   raw green doesn't quite reach. Used for the role line only. */
	--phc-green-text: color-mix(in srgb, var(--phc-green) 75%, #000);

	--phc-radius: 4px;
	--phc-gap: 0px;         /* space between the results column and the map */
	--phc-inset: 1.75rem;   /* card body padding — also the breathing room on top */
	--phc-border: #e2e6e6;
	--phc-muted: #5c6b6b;

	display: grid;
	grid-template-columns: minmax(17rem, 1fr) 4fr;
	gap: var(--phc-gap);
	align-items: stretch;
}

/* The left-hand column: search, status, then results underneath.
   The search block is inset on three sides; the results run full-bleed so the
   profile image spans the whole column, with the card's own padding providing
   the matching indent beneath it. */
.phc-coverage__panel {
	display: grid;
	gap: 1rem;
	align-content: start;
	box-sizing: border-box;
	min-width: 0;
	position: relative;
	z-index: 1;
}

.phc-search,
.phc-status {
	padding-right: var(--phc-inset);
	padding-left: var(--phc-inset);
}

.phc-search {
	padding-top: var(--phc-inset);
}

/* Full-bleed: no radius to fight the column edge. */
.phc-results .phc-card,
.phc-results .phc-miss {
	border-radius: 0;
}

/* ---------- Search ----------
   The label carries your theme's class and gets no styling from here. */

.phc-search__row {
	display: grid;
	gap: 0.5rem;
	margin-top: 0.4rem;
}

.phc-search__input {
	min-width: 0;
	padding: 0.75rem 0.9rem;
	border: 1px solid var(--phc-border);
	border-radius: var(--phc-radius);
	font-size: 1rem;
	text-transform: uppercase;
}

.phc-search__input::placeholder {
	text-transform: none;
	color: var(--phc-muted);
}

.phc-search__input:focus-visible,
.phc-btn:focus-visible,
.phc-search__button:focus-visible {
	outline: 2px solid var(--phc-green-text);
	outline-offset: 2px;
}

:where(.phc-search__button) {
	padding: 0.75rem 1.25rem;
	border: 0;
	border-radius: var(--phc-radius);
	background: var(--phc-green);
	color: #fff;
	font-size: 1rem;
	font-weight: 600;
	cursor: pointer;
}

/* ---------- Status line ----------
   Plain text, no panel. The tinted background belongs to the result cards and
   the out-of-area box; repeating it above the map made the page busy. */

.phc-status:empty {
	display: none;
}

.phc-status {
	margin: 0;
	font-weight: 600;
}

.phc-status--hit {
	color: var(--phc-green-text);
}

.phc-status--miss,
.phc-status--error {
	color: var(--phc-purple);
}

/* ---------- Map ---------- */

.phc-map {
	width: 100%;
	height: 100%;
	min-height: var(--phc-map-min, 520px);
	overflow: hidden;
	background: #eef1f1;
	z-index: 0; /* keeps Leaflet panes below sticky Oxygen headers */
}

.phc-map path {
	transition: fill-opacity 0.15s ease;
	cursor: pointer;
}

.leaflet-tooltip.phc-tooltip {
	font-weight: 700;
	border: 0;
	border-radius: var(--phc-radius);
	background: var(--phc-purple);
	color: #fff;
	box-shadow: none;
}

.leaflet-tooltip.phc-tooltip::before {
	border-top-color: var(--phc-purple);
}

/* ---------- Result cards ---------- */

.phc-cards {
	display: grid;
	gap: 1.5rem;
	grid-template-columns: 1fr;
}

.phc-card {
	display: flex;
	flex-direction: column;
	overflow: hidden;
	border-radius: var(--phc-radius);
	background: var(--phc-pale-purple);
	container-type: inline-size;
}

.phc-card__img {
	display: block;
	width: 100%;
	aspect-ratio: 3 / 2;
	object-fit: cover;
	object-position: center top;
}

.phc-card__body {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	gap: 1.25rem;
	padding: var(--phc-inset);
}

.phc-card__text {
	flex: 1 1 auto;
}

/* The name is an h5, deliberately unstyled here so it inherits the site's own
   heading styles. Only the margin is set. */
.phc-card__name {
	margin: 0 0 0.25rem;
}

.phc-card__role {
	margin: 0 0 0.6rem;
	color: var(--phc-green-text);
	font-size: 80%;
	font-weight: 600;
}

.phc-card__desc {
	margin: 0;
	font-size: 80%;
	line-height: 1.6;
}

.phc-card__actions {
	display: grid;
	gap: 0.6rem;
	margin: 0;
}

/* ---------- Buttons ----------
   Zero specificity, so .button--main / .button--reverse from the theme win. */

:where(.phc-btn) {
	display: block;
	padding: 0.6rem 1.05rem;
	border-radius: var(--phc-radius);
	font-size: 0.9rem;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	line-height: 1.2;
	border: 2px solid var(--phc-green);
	background: var(--phc-green);
	color: #fff;
}

:where(.phc-btn.button--reverse) {
	background: transparent;
	color: var(--phc-purple);
	border-color: var(--phc-purple);
}

.phc-btn:hover {
	filter: brightness(0.94);
}

/* Two class levels, so this beats a plain .button--main { white-space: nowrap }
   without needing !important. */
.phc-coverage .phc-search__button,
.phc-coverage .phc-btn {
	white-space: normal;
	overflow-wrap: break-word;
}

/* ---------- Out of area ---------- */

.phc-miss {
	padding: var(--phc-inset);
	border-radius: var(--phc-radius);
	background: var(--phc-pale-purple);
}

.phc-miss p {
	margin: 0 0 1rem;
	line-height: 1.6;
}

.phc-miss p:last-child {
	margin-bottom: 0;
}

.phc-miss .phc-btn {
	display: inline-block;
	width: auto;
}

/* Below roughly a tablet, the 1:4 split stops being readable — stack instead,
   with the search first so it's the first thing on a phone. */
@container (max-width: 54rem) {
	.phc-coverage {
		grid-template-columns: 1fr;
	}

	/* Stacked: no column to match, so grow with the viewport instead. */
	.phc-map {
		height: auto;
		min-height: max(320px, 50vh);
	}

	.phc-cards {
		grid-template-columns: repeat(auto-fill, minmax(17rem, 1fr));
	}
}
