/**
 * The upgrade planner's list and links, shared by the finder and the upgrade pages.
 *
 * Registered as its own style handle and listed in both blocks' block.json, as ceip-bar and
 * ceip-overview are. The panels around these stay in each block's own stylesheet; this file
 * owns the entries' remove buttons and the two links under the download, which are the same
 * on both screens. See blocks/upgrades/planner-links.php and ceipPlannerRemove() in
 * favourites.js.
 */

.ceip-planner-list {
	/* The body text's darkness rather than a mid-grey: the client heard the cross was too faint
	   to find. */
	--ceip-planner-remove: #2f3638;
	--ceip-planner-remove-bg: rgba(0, 0, 0, 0.07);
	--ceip-planner-remove-hover: #8a1c1c;
	--ceip-planner-remove-hover-bg: rgba(138, 28, 28, 0.08);
	--ceip-planner-focus: #007ea4;

	margin: 0;
	padding: 0;
	/* No bullets: each entry is a row with a control at its far end, and a marker at the
	   start as well is one more thing on a short line. */
	list-style: none;
}

/* The name takes the row and wraps inside it; the button keeps its size at the end. Top
   aligned, so a name that wraps to two lines keeps the button beside its first. */
.ceip-planner-list__item {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 0.5rem;
	margin: 0;
	padding: 0.1875rem 0;
}

.ceip-planner-list__item > :first-child {
	min-width: 0;
	padding-top: 0.0625rem;
}

/* Always visible rather than revealed on hover: hover is not there on a touch screen or for
   a keyboard, and a control that appears only under the pointer cannot be found by either.
   Dark and on a faint disc, so it reads as a button at a glance; red only when pointed at, so
   a list of six does not read as six warnings.

   24px square, the minimum target size WCAG 2.2 asks for. Every property a theme might give a
   bare button is set, since none of it is wanted. */
.ceip-planner-remove {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--ceip-planner-remove-bg);
	box-shadow: none;
	color: var(--ceip-planner-remove);
	font: inherit;
	line-height: 1;
	cursor: pointer;
}

/* The set's x-lg is a hairline at this size. A stroke in the fill's colour thickens each arm
   evenly, to about 1.7px here, without a second glyph to keep in step with the first. */
.ceip-planner-remove svg {
	width: 0.75rem;
	height: 0.75rem;
	overflow: visible;
}

.ceip-planner-remove svg path {
	stroke: currentColor;
	stroke-width: 1.25;
	stroke-linejoin: round;
}

.ceip-planner-remove:hover,
.ceip-planner-remove:focus-visible {
	background: var(--ceip-planner-remove-hover-bg);
	color: var(--ceip-planner-remove-hover);
}

.ceip-planner-remove:focus-visible {
	outline: 2px solid var(--ceip-planner-focus);
	outline-offset: 1px;
}

/* "Remove all", under the list, from the client's fourth round: a plan filled with "Add all"
   should not take two dozen crosses to undo. Shown only once the list holds two or more - with
   one, its own cross does the same - which the list says by itself through :has(), so neither
   block has to keep the two in step. A browser without :has() leaves it out, and the crosses
   still work. A plain text button, the quietest thing in the panel, and view.js asks before it
   empties anything. */
.ceip-planner-remove-all-row {
	display: none;
	margin: 0.375rem 0 0;
	text-align: right;
}

.ceip-planner-list:has(> .ceip-planner-list__item:not([hidden]) ~ .ceip-planner-list__item:not([hidden])) + .ceip-planner-remove-all-row {
	display: block;
}

.ceip-planner-remove-all {
	margin: 0;
	padding: 0.125rem 0;
	border: 0;
	background: none;
	box-shadow: none;
	color: var(--ceip-planner-remove, #2f3638);
	font: inherit;
	font-size: 0.875rem;
	text-decoration: underline;
	text-underline-offset: 0.15em;
	cursor: pointer;
}

.ceip-planner-remove-all:hover {
	color: #8a1c1c;
}

.ceip-planner-remove-all:focus-visible {
	outline: 2px solid #007ea4;
	outline-offset: 2px;
}

/* The two links under the download and their heading: set apart by a rule, as the panel's
   other sections are, because they are about what comes after the plan rather than the plan
   itself. */
.ceip-planner-related {
	margin: 0.875rem 0 0;
	padding: 0.875rem 0 0;
	border-top: 1px solid rgba(0, 0, 0, 0.12);
}

/* Set like the finder's "Upgrades in your planner": the theme gives headings at these levels
   capitals and the brand blue, which would make this a second panel heading. */
.ceip-planner-related__heading {
	margin: 0 0 0.5rem;
	color: inherit;
	font-size: 0.875rem;
	font-weight: 600;
	letter-spacing: normal;
	line-height: 1.3;
	text-transform: none;
}

.ceip-planner-links {
	margin: 0;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
	line-height: 1.4;
}

.ceip-planner-links li {
	margin: 0 0 0.5rem;
}

.ceip-planner-links li:last-child {
	margin-bottom: 0;
}

@media (prefers-color-scheme: dark) {
	.ceip-planner-list {
		--ceip-planner-remove: #dfe4e5;
		--ceip-planner-remove-bg: rgba(255, 255, 255, 0.1);
		--ceip-planner-remove-hover: #f08c8c;
		--ceip-planner-remove-hover-bg: rgba(240, 140, 140, 0.12);
		--ceip-planner-focus: #7fc0ea;
	}

	.ceip-planner-related {
		border-top-color: rgba(255, 255, 255, 0.22);
	}

	.ceip-planner-remove-all {
		color: #dfe4e5;
	}

	.ceip-planner-remove-all:hover {
		color: #f08c8c;
	}

	.ceip-planner-remove-all:focus-visible {
		outline-color: #7fc0ea;
	}
}
