/**
 * The program overview, shared by the finder and the upgrade pages.
 *
 * See blocks/upgrades/program-overview.php. Registered as its own style handle and listed in
 * both blocks' block.json, as ceip-bar is: where it sits on each screen belongs to that
 * screen's stylesheet, and this file owns only what it looks like.
 */

/* Weights: the theme ships 400 Book, 500 Med, 600 Demi and 900 Hvy, with no 700 face, so
   600 is the bold here, as in the blocks' own stylesheets. */

.ceip-overview {
	/* The figures below lay out by the panel's own width - see .ceip-overview__list. */
	container-type: inline-size;
	--ceip-overview-rule: rgba(0, 0, 0, 0.12);
	--ceip-overview-panel: rgba(0, 0, 0, 0.04);
	--ceip-overview-edge: #007ea4;
	/* Text on the two status tints, each above 7:1. */
	--ceip-overview-open: #005a35;
	--ceip-overview-open-bg: #e3f1e9;
	--ceip-overview-waiting: #704300;
	--ceip-overview-waiting-bg: #fdf0d9;

	padding: 0.875rem 1.25rem;
	border: 1px solid var(--ceip-overview-rule);
	border-left: 4px solid var(--ceip-overview-edge);
	border-radius: 4px;
	background: var(--ceip-overview-panel);
}

/* The theme's heading sizes are for page sections; this is a panel's title, one step above
   the body text, whichever element it is. */
.ceip-overview__heading {
	margin: 0 0 0.125rem;
	/* The body colour: as an h2 on the upgrade page it took the theme's blue, which on this
	   panel's grey is 4.3:1. */
	color: inherit;
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.3;
}

.ceip-overview__lead {
	margin: 0 0 0.625rem;
	font-size: 1rem;
}

/* The mark that the link opens in a new tab: inside the link, so it underlines and colours
   with it, and small enough to sit on the line like a character. */
.ceip-overview__lead .ceip-icon--external {
	width: 0.75em;
	height: 0.75em;
	margin-left: 0.25em;
	vertical-align: -0.05em;
}

/* Four figures: one row of four where the panel has the room, two by two where it does not -
   never three and one, which left the deposit alone on a second row. auto-fit could only
   choose three at the widths in between, and those widths depend on the window and on
   whether the panel spans the finder or sits in an upgrade page's column, so the panel's own
   width decides rather than the window's. The deposit label is the long one and wraps inside
   its column rather than widening it. */
.ceip-overview__list {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0.625rem 1.5rem;
	margin: 0;
}

/* The status takes half as much room again as the other three in one row: it is the one value
   that runs to several words, and in an upgrade page's column "Next intake: Jan. 26, 2027" took
   three lines at an equal share, against two here. */
@container (min-width: 34rem) {
	.ceip-overview__list {
		grid-template-columns: minmax(0, 1.5fr) repeat(3, minmax(0, 1fr));
	}
}

/* A column whose label takes up the slack, so the values sit on one line across the row even
   where one label wraps and the others do not - the grid already gives the items in a row the
   same height. */
.ceip-overview__item {
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ceip-overview__item dt {
	flex: 1 0 auto;
	margin: 0 0 0.125rem;
	font-size: 0.9375rem;
	font-weight: 600;
	line-height: 1.3;
}

.ceip-overview__item dd {
	margin: 0;
	font-size: 1.125rem;
	line-height: 1.35;
}

/* A pill, so the status reads as a state rather than as another figure beside the rate.
   Balanced where it wraps: "Next intake: Jan. 26, 2027" is wider than its column with four
   across, and unbalanced it left the year alone on the second line. */
.ceip-overview__status {
	display: inline-block;
	padding: 0 0.625rem;
	border-radius: 999px;
	font-weight: 600;
	text-wrap: balance;
}

.ceip-overview__status--open {
	background: var(--ceip-overview-open-bg);
	color: var(--ceip-overview-open);
}

.ceip-overview__status--waiting {
	background: var(--ceip-overview-waiting-bg);
	color: var(--ceip-overview-waiting);
}

@media (prefers-color-scheme: dark) {
	.ceip-overview {
		--ceip-overview-rule: rgba(255, 255, 255, 0.22);
		--ceip-overview-panel: rgba(255, 255, 255, 0.07);
		--ceip-overview-edge: #7fc0ea;
		--ceip-overview-open: #9fdcb8;
		--ceip-overview-open-bg: rgba(159, 220, 184, 0.14);
		--ceip-overview-waiting: #f0b866;
		--ceip-overview-waiting-bg: rgba(240, 184, 102, 0.14);
	}
}
