/**
 * Upgrades finder.
 *
 * Layout comes from the theme's existing grid (grid / six / six_t / six_m) and card
 * classes (block--card block--card_blog block--card_balance); this only styles the
 * step affordances and the carve-out notes.
 */

/* Weights: the theme declares 400 Book, 500 Med, 600 Demi and 900 Hvy — there is no 700
   face, so font-weight: 700 falls up to Heavy. Use 600 for bold-looking text here. */

.block--upgrades-finder {
	--ceip-finder-rule: rgba(0, 0, 0, 0.12);
	/* The same surface the measure page gives its panels, so the project reads as one thing
	   across both screens. */
	--ceip-finder-panel: rgba(0, 0, 0, 0.04);
	/* What the page itself is painted on. The tint above is translucent, which is right for a
	   panel sitting in the flow; the mobile bar floats its panels over the cards, and over a
	   card a translucent panel is unreadable. Those composite the tint over this. */
	--ceip-finder-surface: #fff;
	--ceip-step-gap: 0.75rem;
	/* Step-number width plus the gap after it, so the hint lines up with the heading text. */
	--ceip-step-indent: calc(1.75rem + var(--ceip-step-gap));
	--ceip-finder-primary: #007ea4;
	/* Deeper than the design's mid-green so white text clears WCAG AA; see the button rule. */
	--ceip-finder-cta: #007847;
	--ceip-finder-step-bg: #1c5d8a;
	--ceip-finder-step-fg: #fff;
	/* Secondary text - categories, notes, the useful life on a card. A solid colour at 8:1
	   on white and 7.3:1 on the panels, where it used to be the body colour faded with
	   opacity: the client found the faded text hard to read, and opacity makes contrast
	   depend on whatever sits behind. */
	--ceip-finder-muted: #4a5254;
}

/* Index hero ----------------------------------------------

   Styles for patterns/upgrades-hero.php, which is page content rather than part of this
   block. They live here because this is where every stylesheet for the feature lives - the
   theme's SCSS is compiled and committed, and nothing in this work has rebuilt it - and
   because the hero and the finder appear on the same page.

   The band, its colour and its white text come from the theme's is-style-blue-background;
   only the introduction below the title is styled here. */

.ceip-hero__lead {
	/* The band is a constrained group, so this is already centred in the content width; this
	   only stops a long line running the full 1200px of a wide screen. The design sets the
	   paragraph at 1159 of a 1440 frame, which is the content width this theme already uses. */
	margin-left: 0;
	margin-right: 0;
}

/* A subtitle under the title, not a second headline. It was the bold left-hand column of a
   two-column intro; the revised design drops it to italic at body size and runs it the full
   width. The instruction that followed it, under a gold rule, has moved to the finder's step 2
   - see .ceip-finder__how.

   It sits close under the title, the way the design has it. What held it a full line away was
   the theme's own `.wp-block-group.is-style-greyscale > * + * { margin-block-start: var(--space) }`
   - 24px, and at (0,2,0) it ties with `.ceip-hero .ceip-hero__lead` and wins on source order,
   because the compiled theme sheet loads after this block's. Hence the element in the selector:
   (0,2,1) settles it on specificity instead of on which file happens to come last.

   --space-tight rather than a number of its own: that block style already tightens particular
   adjacencies this way - h2+h1, h3+p - and the title and its subtitle are another of them. */
.ceip-hero p.ceip-hero__lead {
	margin-top: var(--space-tight, 0.75rem);
	margin-bottom: 0;
	font-size: 1rem;
	font-style: italic;
	font-weight: 400;
	line-height: 1.5;
}

/* Context-setting intro ----------------------------------- */

.ceip-finder__intro {
	max-width: 60ch;
	margin-bottom: 2rem;
}

.ceip-finder__intro p {
	margin: 0 0 0.75rem;
}

.ceip-finder__intro > :last-child {
	margin-bottom: 0;
}

.ceip-finder__lead {
	font-size: 1.0625rem;
}

.ceip-finder__noscript {
	padding: 0.75rem 0.875rem;
	border-left: 4px solid var(--ceip-finder-primary);
	background: rgba(0, 0, 0, 0.04);
}

.ceip-finder__form {
	margin-bottom: 2.5rem;
}

.ceip-finder__step {
	display: flex;
	align-items: center;
	/* The count rides at the end of this row on step 2, and drops below the heading rather
	   than squeezing it where there is no room. */
	flex-wrap: wrap;
	/* This gap and the step-number width are the two halves of --ceip-step-indent, which the
	   hint uses to line up with the heading text. */
	gap: var(--ceip-step-gap);
	margin-bottom: 0.75rem;
}

/* The heading shrinks and wraps its own text rather than wrapping as a whole onto the line
   below, which is what flex-wrap does to it otherwise, leaving the number stranded above it on
   a phone. A zero flex-basis is what fixes it, not min-width: wrapping is decided from each
   item's hypothetical size before any shrinking happens, so with `auto` the heading is measured
   at its full text width and sent to the next line before it is ever given the chance to
   narrow. At zero it always fits, then grows into whatever the number leaves — which also
   carries the count to the far edge of the row, the job margin-left: auto used to do. */
.ceip-finder__step .ceip-finder__heading {
	flex: 1 1 0;
	min-width: 0;
}

/* The number keeps its size while the heading gives way. */
.ceip-finder__step-number {
	flex: none;
}

/* The question on the left, the dropdown using the space to its right. The ratio follows the
   design: a 500px question column against a 670px control column. */
.ceip-finder__ask {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1rem 2rem;
}

@media (min-width: 48em) {
	.ceip-finder__ask {
		grid-template-columns: minmax(0, 5fr) minmax(0, 7fr);
		/* Top-aligned, so the select's top edge meets the heading's. */
		align-items: start;
	}

	/* The program overview runs the full width under the question and the dropdown, rather
	   than in the dropdown's column, which left the space under the question empty. */
	.ceip-finder__ask > .ceip-overview {
		grid-column: 1 / -1;
	}
}

.ceip-finder__step-number {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border-radius: 50%;
	background: var(--ceip-finder-step-bg);
	color: var(--ceip-finder-step-fg);
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1;
}

/* Step 1 and step 2 share this, and both are h2 elements, so they take their colour from the
   theme and cannot drift apart.

   Size and weight deliberately depart from the theme's h2: 24px rather than 28px so "Where is
   your property located?" holds one line on desktop, and 600 rather than 700. The theme ships
   no 700 face (400 Book, 500 Med, 600 Demi, 900 Hvy), so 700 fell up to Heavy — 600 is Demi,
   which is what was asked for. */
.ceip-finder__heading {
	margin: 0;
	font-size: 1.5rem;
	font-weight: 600;
}

/* Step 1's heading wraps a label so the select keeps its association; the label must not
   reintroduce its own type styles. */
.ceip-finder__heading label {
	font: inherit;
	color: inherit;
	cursor: pointer;
}

.ceip-finder__controls {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 0.75rem;
}

/* Also matched on :focus. The theme ships `select, select:focus { padding: ... }`, and
   `select:focus` (0-1-1) outranks a single class (0-1-0) — so without the second selector the
   padding dropped from 12px to 8px on focus and the text jumped sideways. */
.ceip-finder__select,
.ceip-finder__select:focus {
	flex: 1 1 18rem;
	/* Same reason as the measure page: a select will not shrink below its longest option
	   unless told it may, and the longest municipality name is wider than a phone. */
	min-width: 0;
	padding: 0.625rem 0.75rem;
	border: 1px solid var(--ceip-finder-rule);
	border-radius: 4px;
	background-color: #fff;
	/* Form controls do not inherit the page font, so without this the select fell back to
	   Arial while everything around it used the brand face. */
	font-family: inherit;
	color: inherit;
	font-size: 1rem;
	/* Not 1.4: Chrome derives a select's height from font metrics but lays the selected text
	   out with line-height, so a 22.4px line box sat in an 18px content box and `overflow:
	   clip` sheared the descenders — the y in "City of Airdrie". `normal` keeps the line box
	   within the space the control actually reserves. */
	line-height: normal;
}

/* Sits directly beneath the heading, indented past the step number so it aligns with the
   heading text. Full-strength colour and weight: this is the reason someone picks a
   municipality, not an aside. */
.ceip-finder__hint {
	margin: 0;
	padding-left: var(--ceip-step-indent);
	font-size: 1rem;
	font-weight: 600;
}

/* How to use the planner, under the step 2 heading and lined up with its text, as the hint is
   under step 1's. Body weight rather than the hint's bold, as it is two sentences rather than a
   few words, but a step up in size, so it reads as the thing to do next rather than as small
   print above the cards. Held to a readable measure; the cards below run the full width. */
.ceip-finder__how {
	max-width: 46rem;
	margin: 0;
	padding-left: var(--ceip-step-indent);
	font-size: 1.125rem;
	line-height: 1.5;
}

/* The text and the button that acts on it, side by side where there is room - the button at
   the far edge, over the cards it adds - and the button under the text where there is not. */
.ceip-finder__how-row {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.75rem 2rem;
	margin-bottom: 1.75rem;
}

.ceip-finder__how-row .ceip-finder__how {
	flex: 1 1 28rem;
}

/* The cards' add button at a size for a whole list. Every upgrade showing already being in the
   planner is reported in its label and the filled bookmark, and it stays focusable so a screen
   reader can still find and read it - aria-disabled, not disabled. */
.ceip-finder__add-all {
	flex: none;
	padding: 0.625rem 0.875rem;
	font-size: 0.9375rem;
}

.ceip-finder__add-all[aria-disabled="true"] {
	cursor: default;
}

.ceip-finder__add-all[aria-disabled="true"]:hover {
	background: #e0e8ea;
}

/* On a phone the indent costs more than it buys. It exists to line the hint up with the
   heading text, but once the heading wraps to two or three lines there is no single edge left
   to line up with, and the indent only narrows an already narrow column. The count joins it on
   its own full-width line for the same reason. */
@media (max-width: 47.99em) {
	.ceip-finder__hint,
	.ceip-finder__how {
		padding-left: 0;
	}

	.ceip-finder__how-row .ceip-finder__how {
		flex-basis: 100%;
	}

	.ceip-finder__count {
		flex-basis: 100%;
		margin-left: 0;
	}
}

.ceip-finder__results {
	border-top: 1px solid var(--ceip-finder-rule);
	padding-top: 2rem;
}

/* Sits at the end of the step-2 heading row, where it reports on the list the heading names.
   Pushed to the far edge rather than trailing the title, so it does not read as part of the
   municipality's name. Wraps under the heading when the row runs out of width. */
.ceip-finder__count {
	margin: 0 0 0 auto;
	color: var(--ceip-finder-primary);
	font-size: 0.9375rem;
	font-weight: 600;
}

/* Sidebar and listing ------------------------------------

   Follows the design's three 370px columns with 30px gaps: the sidebar takes one, the card
   listing takes two. Single column until there is room for both, so the sidebar stacks above
   the cards on tablets rather than squeezing them. */

.ceip-finder__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.875rem;
}

@media (min-width: 64em) {
	.ceip-finder__layout {
		grid-template-columns: minmax(0, 1fr) minmax(0, 2fr);
		align-items: start;
	}
}

.ceip-finder__sidebar {
	display: flex;
	flex-direction: column;
	gap: 1.25rem;
}

/* Follows the listing while it scrolls. Only where the two-column layout applies — stuck to
   the top of a stacked mobile view it would cover the cards. */
@media (min-width: 64em) {
	.ceip-finder__sidebar {
		position: sticky;
		/* Clears the site's own sticky header. favourites.js measures it and publishes the
		   height, because the header is sticky too and restacks with the viewport - the
		   fallback here is only for the moment before the script runs. */
		top: var(--ceip-sticky-top, 8.25rem);
		align-self: start;
		/* Deliberately not clamped with max-height + overflow-y — see the measure block. It
		   turned the sidebar into its own scroll box, scrollbars and gutter included. */
	}
}

/* Both sidebar panels read as discrete cards, which is what separates the filters from the
   saved-upgrades tool visually. */
.ceip-finder__tools,
.ceip-finder__filters {
	margin: 0;
	padding: 1.25rem;
	border: 1px solid var(--ceip-finder-rule);
	border-radius: 4px;
}

/* Only the project panel is filled. The filters are controls that act on the page, so they sit
   on the page's own surface; the project is a thing you have collected, and the tint sets it
   apart - the same tint it has on the measure pages. */
.ceip-finder__tools {
	background: var(--ceip-finder-panel);
}


/* Compact cards -------------------------------------------

   No margin-bottom here: the theme grid already applies grid-gap: 1.5rem, and adding a
   margin on top of it doubled the row spacing to 3rem.

   .block--card_blog carries no rules of its own anywhere in the theme, so it is used here as
   the hook for the compact treatment. */

.ceip-finder__item .block--card_blog {
	/* .stack (see scss/abstracts/_mixins.scss) spaces children from these custom properties,
	   so tightening them here beats overriding each child's margin. --internal-padding is the
	   theme's card padding, dropped from 1.5rem to match the design's 20px. */
	--internal-padding: 1.25rem;
	--space: 0.5rem;
	--space-tight: 0.375rem;
	--space-tiny: 0.25rem;
}

/* Type scale from the design: an 11px eyebrow, 17px title, 13px excerpt and 12px life, so
   more cards fit on screen beside the sidebar. */
.ceip-finder__item .measure-name {
	font-size: 1.0625rem;
	line-height: 1.25;
}

.ceip-finder__description {
	font-size: 0.9375rem;
	line-height: 1.45;
}

.ceip-finder__category {
	margin: 0;
	/* Tighter than the inherited 1.6, which pulled the two-line categories apart. */
	line-height: 1.25;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: var(--ceip-finder-muted);
}

.ceip-finder__description > :first-child {
	margin-top: 0;
}

.ceip-finder__description > :last-child {
	margin-bottom: 0;
}

.ceip-finder__description ul {
	margin: 0.5rem 0;
	padding-left: 1.25rem;
	list-style: disc;
}

.ceip-finder__description li {
	margin-bottom: 0.25rem;
}

.ceip-finder__eul {
	margin: 0;
	font-size: 0.875rem;
	color: var(--ceip-finder-muted);
}

/* Everything that moves on hover moves at the same 220ms. The theme leaves it at `all 0s`,
   so a button would snap while its neighbour eased. Naming the properties rather than easing
   `all`, which would animate anything the theme adds later.

   .block--card is kept in the list even though nothing on it currently changes on hover, so
   a style variant that does invert still eases rather than snapping. */
.ceip-finder__item .block--card,
.ceip-finder__item .ceip-finder__details,
.ceip-finder__item .ceip-finder__save,
.ceip-finder__item .ceip-icon {
	transition: background-color 220ms ease, color 220ms ease, border-color 220ms ease,
		box-shadow 220ms ease, opacity 220ms ease;
}

@media (prefers-reduced-motion: reduce) {
	.ceip-finder__item .block--card,
	.ceip-finder__item .ceip-finder__details,
	.ceip-finder__item .ceip-finder__save,
	.ceip-finder__item .ceip-icon {
		transition: none;
	}
}

/* Card actions ---------------------------------------------

   Two labelled buttons at the foot of every card, replacing the icon-only corner toggle and
   the bare arrow. "View details" is the filled brand button and the card's primary action;
   "Save to my project" is deliberately quieter, so twenty-four of them do not compete with it.

   Each answers only to itself. The card used to carry the theme's .breakout-button overlay,
   which stretched the details link across the whole card: that made the card clickable, but
   it also meant pointing anywhere lit the details button, and with two actions on the card
   there is no single thing a card-wide target could mean. */

.ceip-finder__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin-top: auto;
	padding-top: var(--internal-padding, 1.5rem);
}

/* Tight padding and a small gap so the pair holds one line in a three-column grid, where the
   card is about 70px narrower than the design's. Below that they wrap, which is the graceful
   end of the same rule rather than a separate layout. */
.ceip-finder__details,
.ceip-finder__save {
	display: inline-flex;
	align-items: center;
	gap: 0.375rem;
	padding: 0.5rem 0.625rem;
	border: 0;
	border-radius: 4px;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	text-align: left;
	text-decoration: none;
	cursor: pointer;
}

/* The glyphs are stacked in one box and swapped by opacity rather than display, so the button
   does not resize by a pixel as its state changes. */
.ceip-finder__icon {
	position: relative;
	display: inline-grid;
	flex: none;
	width: 0.875rem;
	height: 0.875rem;
}

.ceip-finder__icon .ceip-icon {
	grid-area: 1 / 1;
	width: 100%;
	height: 100%;
}

/* The second glyph of each pair is the state the button is not in yet. */
.ceip-finder__icon .ceip-icon--arrow-filled,
.ceip-finder__icon .ceip-icon--bookmark-saved {
	opacity: 0;
}

.ceip-finder__details {
	background: var(--ceip-finder-primary);
	color: #fff;
}

.ceip-finder__details:hover,
.ceip-finder__details:focus-visible {
	background: #006d8e;
}

.ceip-finder__details:hover .ceip-icon--arrow,
.ceip-finder__details:focus-visible .ceip-icon--arrow {
	opacity: 0;
}

.ceip-finder__details:hover .ceip-icon--arrow-filled,
.ceip-finder__details:focus-visible .ceip-icon--arrow-filled {
	opacity: 1;
}

.ceip-finder__save {
	background: #e0e8ea;
	color: var(--wp--preset--color--black, #1b1b1b);
}

.ceip-finder__save:hover,
.ceip-finder__save:focus-visible {
	background: #c2d2d6;
}

/* Saved swaps the outline bookmark for the filled one with a check, and the label with it.
   The brand blue on the glyph is the only colour the button gains: the design keeps this
   change subtle so it does not compete with the solid details button. */
.ceip-finder__save.is-saved .ceip-icon--bookmark {
	opacity: 0;
}

.ceip-finder__save.is-saved .ceip-icon--bookmark-saved {
	opacity: 1;
	color: var(--ceip-finder-primary);
}

/* The theme floods a card with the brand colour on hover, which the design does not do - and
   which would swallow a brand-coloured details button whole. The card keeps the theme's
   deeper shadow; the colour change belongs to whichever button is pointed at. */
.ceip-finder__item .block--card:hover,
.ceip-finder__item .block--card:focus-within {
	background-color: var(--wp--preset--color--white);
	color: var(--wp--preset--color--black);
}

/* Search, category and sort -------------------------------- */

.ceip-finder__filters {
	display: flex;
	flex-direction: column;
	gap: 0.875rem;
}

.ceip-finder__field {
	margin: 0;
}

.ceip-finder__field-label {
	text-transform: uppercase;
	letter-spacing: 0.03em;
}

.ceip-finder__field-label {
	display: block;
	margin-bottom: 0.25rem;
	font-size: 0.875rem;
	font-weight: 600;
}

/* :focus included for the same specificity reason as .ceip-finder__select. */
.ceip-finder__input,
.ceip-finder__input:focus {
	width: 100%;
	/* The theme fixes these at height: 2.5rem, which ignores the padding below and leaves the
	   text floating off-centre in a box that is taller than it needs. Unset lets the content
	   and the padding decide. */
	height: unset;
	margin-bottom: 0;
	padding: 0.125rem 0.625rem;
	border: 1px solid var(--ceip-finder-rule);
	border-radius: 4px;
	background-color: #fff;
	color: inherit;
	font-family: inherit;
	font-size: 0.9375rem;
	/* `normal`, not a ratio: these are selects as well as an input, and Chrome sizes a select
	   from font metrics while laying its text out with line-height. A ratio taller than the
	   reserved space gets clipped, taking the descenders with it. These fitted at this size,
	   but only by luck — see .ceip-finder__select. */
	line-height: normal;
}

/* A focus ring for the dropdowns and the search field. The rules above match :focus only to
   hold their padding, so they gave the focused field its resting border, and the theme takes
   the browser's outline away - a keyboard user could not see which field they were in. The
   same 2px ring as the planner's remove buttons.

   :focus as well as :focus-visible, for specificity: the theme's `select:focus:focus {
   outline: none }` doubles its pseudo-class to reach 0-2-1, which a class and one pseudo-class
   do not beat. */
.ceip-finder__select:focus-visible:focus,
.ceip-finder__input:focus-visible:focus {
	border-color: var(--ceip-finder-primary);
	outline: 2px solid var(--ceip-finder-primary);
	outline-offset: 1px;
}

/* A direct child of the flex column, so `hidden` takes it out of the layout and its gap with
   it. Left-aligned rather than stretched to the panel's width, which is what a column of
   full-width inputs would otherwise do to it. */
.ceip-finder__reset {
	align-self: flex-start;
	padding: 0.5rem 0.75rem;
	border: 1px solid var(--ceip-finder-rule);
	border-radius: 4px;
	background: transparent;
	color: inherit;
	font-family: inherit;
	font-size: 0.875rem;
	cursor: pointer;
}

.ceip-finder__reset:hover,
.ceip-finder__reset:focus-visible {
	background: rgba(0, 0, 0, 0.07);
}

/* Favourites and export controls -------------------------- */

.ceip-finder__tools {
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
}

/* Sentence case, unlike the field labels above it. Those name a control; this is the control,
   and reads as a sentence - uppercase made it look like another section heading. */
.ceip-finder__toggle {
	position: relative;
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
}

.ceip-finder__toggle-input:disabled {
	cursor: not-allowed;
}

.ceip-finder__toggle:has(input:disabled) {
	opacity: 0.6;
}

/* Hidden rather than removed: the input still takes focus, still toggles on Space, and still
   drives :checked below. Sized and positioned over its own box so a pointer lands on the
   control either way, and so browsers put IME and autofill UI in the right place. */
.ceip-finder__toggle-input {
	position: absolute;
	width: 1.375rem;
	height: 1.375rem;
	margin: 0;
	opacity: 0;
}

.ceip-finder__toggle-box {
	display: grid;
	place-items: center;
	flex: none;
	width: 1.375rem;
	height: 1.375rem;
	border: 1px solid var(--ceip-finder-rule);
	border-radius: 3px;
	color: inherit;
}

.ceip-finder__toggle-box .ceip-icon {
	grid-area: 1 / 1;
	width: 0.8125rem;
	height: 0.8125rem;
}

.ceip-finder__toggle-box .ceip-icon--bookmark-saved {
	opacity: 0;
}

/* Checked is the filled square from the design: brand blue, white glyph, bookmark with its
   check. Unchecked keeps the outlined bookmark, so the box still reads as something to tick. */
.ceip-finder__toggle-input:checked + .ceip-finder__toggle-box {
	border-color: var(--ceip-finder-primary);
	background: var(--ceip-finder-primary);
	color: #fff;
}

.ceip-finder__toggle-input:checked + .ceip-finder__toggle-box .ceip-icon--bookmark {
	opacity: 0;
}

.ceip-finder__toggle-input:checked + .ceip-finder__toggle-box .ceip-icon--bookmark-saved {
	opacity: 1;
}

/* The native focus ring goes with the native box, so the drawn one has to carry it. */
.ceip-finder__toggle-input:focus-visible + .ceip-finder__toggle-box {
	outline: 2px solid var(--ceip-finder-primary);
	outline-offset: 2px;
}

.ceip-finder__export {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	margin: 0;
}

/* Filled rather than outlined, so it reads as the panel's call to action.

   The design's lighter green would fail WCAG AA behind white text (about 2.3:1), so this uses
   the theme's darker brand green, which clears it at roughly 5.6:1. */
.ceip-finder__export-button {
	display: inline-flex;
	align-items: center;
	gap: 0.4375rem;
	align-self: flex-start;
	padding: 0.5rem 0.875rem;
	border: 0;
	border-radius: 4px;
	background: var(--ceip-finder-cta);
	color: #fff;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.3;
	text-align: left;
	cursor: pointer;
}

.ceip-finder__export-button::before {
	content: '\2197'; /* north-east arrow, standing in for an external-link glyph */
	font-size: 0.9375rem;
	line-height: 1;
}

/* The requested lighter green. White on #83bc5a is about 2.3:1, well under WCAG AA, so the
   label switches to near-black on hover rather than becoming hard to read. */
.ceip-finder__export-button:hover:not([disabled]),
.ceip-finder__export-button:focus-visible:not([disabled]) {
	background: #83bc5a;
	color: #1b1b1b;
}

.ceip-finder__export-button[disabled] {
	opacity: 0.5;
	cursor: not-allowed;
}

/* Stranded saves --------------------------------------------

   Shown when the chosen municipality does not offer something already in the project. Set
   apart from the panel's own text, because it is about a decision to make rather than a
   description of how the project works, but kept quiet: nothing is wrong and nothing is lost
   either way. */

.ceip-finder__stranded {
	padding: 0.75rem 0.875rem;
	border-left: 3px solid var(--ceip-finder-primary);
	background: rgba(0, 126, 164, 0.06);
}

.ceip-finder__stranded-text {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.45;
}

.ceip-finder__stranded-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.375rem;
	margin: 0.625rem 0 0;
}

.ceip-finder__stranded-remove,
.ceip-finder__stranded-keep {
	padding: 0.375rem 0.625rem;
	border: 1px solid var(--ceip-finder-primary);
	border-radius: 4px;
	font-family: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
}

/* Removing is the action being offered, so it is the filled one - but this is the panel's
   quiet corner, not a call to action competing with the download button below it. */
.ceip-finder__stranded-remove {
	background: var(--ceip-finder-primary);
	color: #fff;
}

.ceip-finder__stranded-remove:hover,
.ceip-finder__stranded-remove:focus-visible {
	background: #006d8e;
}

.ceip-finder__stranded-keep {
	background: transparent;
	color: inherit;
}

.ceip-finder__stranded-keep:hover,
.ceip-finder__stranded-keep:focus-visible {
	background: rgba(0, 126, 164, 0.12);
}

/* My project panel ------------------------------------------

   Reads top to bottom as what the project is, then what is in it, then what to do with it:
   heading, note, the filter, the list, the download. The rules are the section breaks - each
   one sits above the thing it introduces, so nothing needs a box of its own. */

.ceip-finder__tools-heading {
	margin: 0;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.ceip-finder__toggle,
.ceip-finder__project,
.ceip-finder__export {
	padding-top: 0.875rem;
	border-top: 1px solid var(--ceip-finder-rule);
}

/* The download closes the panel rather than opening a section, so it keeps the spacing
   without the rule. */
.ceip-finder__export {
	border-top: 0;
	padding-top: 0.25rem;
}

/* The theme sets headings at this level uppercase and in the brand blue, which would make
   this read as a second panel heading competing with "My project" above it. It is a label on
   the list under it, so it takes the body's colour and its own case. */
.ceip-finder__project-heading {
	margin: 0 0 0.5rem;
	color: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: normal;
	text-transform: none;
}

/* Rows, spacing and the remove buttons are blocks/upgrades/planner.css, shared with the
   upgrade pages; only the type is set here. */
.ceip-finder__project-list {
	font-size: 0.9375rem;
	line-height: 1.5;
}

.ceip-finder__tools-note {
	margin: 0;
	font-size: 0.875rem;
	line-height: 1.45;
	color: var(--ceip-finder-muted);
}

.ceip-finder__empty {
	margin: 0;
	font-style: italic;
	color: var(--ceip-finder-muted);
}

@media (prefers-color-scheme: dark) {
	.block--upgrades-finder {
		--ceip-finder-rule: rgba(255, 255, 255, 0.22);
		--ceip-finder-panel: rgba(255, 255, 255, 0.07);
		--ceip-finder-surface: #1b1b1b;
		--ceip-finder-muted: #b9c1c3;
	}

	.ceip-finder__select {
		background-color: transparent;
		color: inherit;
	}
}

/* Search affordance ---------------------------------------

   A magnifier rather than the arrow in the design: the field filters as you type, so an arrow
   would imply a submit that does not exist. Sits on the left, which also keeps it clear of
   Chrome's native clear button on the right of a type="search" input.

   Declared with a descendant selector, and repeated for :focus, so neither the base rule's
   .ceip-finder__input:focus nor the theme's select:focus can outrank the padding. */
.ceip-finder__field--search .ceip-finder__input,
.ceip-finder__field--search .ceip-finder__input:focus {
	padding-left: 2rem;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='none' stroke='%236f7271' stroke-width='1.7' stroke-linecap='round'%3E%3Ccircle cx='6.8' cy='6.8' r='4.3'/%3E%3Cpath d='M10.2 10.2 L13.6 13.6'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: left 0.625rem center;
	background-size: 13px 13px;
}

/* The sidebar, below the two-column breakpoint ------------

   The bar itself lives in blocks/upgrades/bar.css, shared with the measure pages. What is here
   is only what belongs to this screen: which panels it opens, and where they float to. */

@media (max-width: 63.99em) {
	.ceip-finder__layout {
		/* Not a grid below the breakpoint, where it is a single column anyway. A sticky grid
		   item is constrained to its own grid area, which here is just its own row - so the
		   sidebar could only stick for its own height. As a block the containing block is the
		   layout, which runs the length of the listing, which is how far it needs to stick. */
		display: block;
	}

	.ceip-finder__sidebar {
		position: sticky;
		/* Same measured header height the desktop sidebar uses; favourites.js publishes it and
		   re-measures on resize, because the header restacks and is shorter on a phone. */
		top: var(--ceip-sticky-top, 4.5rem);
		/* Over the cards, and over the card hover states, which lift on their own. */
		z-index: 20;
		/* The grid's gap went with the grid. */
		margin-bottom: 1.875rem;
		/* The flex gap belongs between two panels in a column. Here they are taken out of the
		   flow, so the only thing it would space is nothing. */
		gap: 0;
	}

	/* Both panels hang off the bar rather than sitting under it in the flow. Pushing the cards
	   down instead would move whatever the visitor was reading the moment they opened a panel,
	   and move it back when they closed it. */
	.ceip-finder__filters,
	.ceip-finder__tools {
		display: none;
		position: absolute;
		top: 100%;
		left: 0;
		right: 0;
		margin-top: 0.375rem;
		/* The theme leaves these at content-box, which made max-height mean "442px plus the
		   40px of padding" - the panel overhung the screen by exactly its own padding. */
		box-sizing: border-box;
		/* Taller than the screen below the bar is the one case this cannot show at once - a
		   long project, mostly - so it scrolls inside itself rather than off the bottom. */
		max-height: calc(100vh - var(--ceip-sticky-top, 4.5rem) - 3rem);
		overflow-y: auto;
		background: var(--ceip-finder-surface);
		box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
	}

	/* The tint again, but composited over the surface rather than over the cards showing
	   through: a background-image paints on top of the background-color, so the pair is opaque
	   where `background: <translucent>` alone would not be. */
	.ceip-finder__tools {
		background-image: linear-gradient(var(--ceip-finder-panel), var(--ceip-finder-panel));
	}

	/* Set by favourites.js, not by :has() on the button - a browser without :has() would leave
	   both panels unreachable, and there is no graceful version of that. */
	.ceip-finder__sidebar[data-ceip-open="filters"] .ceip-finder__filters,
	.ceip-finder__sidebar[data-ceip-open="tools"] .ceip-finder__tools {
		display: flex;
	}
}
