/**
 * PIDI index hub and index pages.
 *
 * Authority: `06-design-tokens.css`, `10-acceptance-criteria.md` §P1, §P11.
 *
 * The design problem here is unusual: twelve of thirteen pages have no number
 * on them. The temptation is to style the empty state as a deficiency — grey,
 * small, apologetic — and that would be wrong. A definition with a stated
 * release gate is the product until the gate passes, so the empty state is set
 * at reading weight and the "not yet published" marker is a plain word rather
 * than a dash or a muted placeholder.
 */

.pem-idx__lead {
	font-size: var(--step-1, 1.125rem);
	line-height: 1.5;
	max-width: var(--measure, 62ch);
	margin: 0 0 2rem;
}

.pem-idx__panel { margin: 0 0 2.5rem; }
.pem-idx__panel h2 { margin: 0 0 .75rem; }

.pem-idx__scroll { overflow-x: auto; }

.pem-idx__table {
	width: 100%;
	border-collapse: collapse;
	font-size: var(--step--1);
}

.pem-idx__table th,
.pem-idx__table td {
	text-align: left;
	vertical-align: top;
	padding: .55rem .75rem .55rem 0;
	border-bottom: 1px solid var(--rule, #e4e4e4);
}

.pem-idx__table thead th {
	font-size: var(--step--2, .8rem);
	text-transform: uppercase;
	letter-spacing: .04em;
	color: var(--ink-2);
	border-bottom-width: 2px;
}

.pem-idx__period {
	font-size: var(--step--2, .8rem);
	color: var(--ink-2);
}

/*
 * What the directory figure is: its market, a cohort's denominator, and
 * whether it is modelled, a proxy, a scenario or a cohort. On its own line,
 * so a split or modelled figure is never read bare (page.php
 * latest_qualifier()).
 */
.pem-idx__table .pem-idx__unit {
	margin: 0;
	font-size: var(--step--2, .8rem);
	color: var(--ink-2);
}

.pem-idx__qual {
	display: block;
	font-size: var(--step--2, .8rem);
	color: var(--ink-2);
}

/*
 * Not a dash and not grey-on-grey. "Not yet published" is a statement the site
 * stands behind, and a reader must not mistake it for a rendering fault or for
 * a number that failed to load.
 */
.pem-idx__none {
	font-style: italic;
	color: var(--ink-1, inherit);
}

/* ------------------------------------------------------- one index page -- */

.pem-idx__value { margin: 0 0 2rem; }

.pem-idx__figure {
	margin: 0;
	font-size: var(--step-5, 3rem);
	line-height: 1.05;
	font-variant-numeric: tabular-nums;
}

.pem-idx__movement {
	display: grid;
	grid-template-columns: minmax(9rem, auto) 1fr;
	gap: .3rem 1.25rem;
	margin: 1rem 0 0;
	max-width: 32rem;
	font-size: var(--step--1);
}

.pem-idx__movement dt { color: var(--ink-2); }
.pem-idx__movement dd { margin: 0; font-variant-numeric: tabular-nums; }

.pem-idx__evidence {
	margin: 1rem 0 0;
	font-size: var(--step--1);
	color: var(--ink-2);
}

/*
 * The empty state and the retirement notice share a treatment: bordered, at
 * reading size, in the body ink. Both are content, not absence.
 */
.pem-idx__empty,
.pem-idx__retired-notice {
	margin: 0 0 2rem;
	padding: 1rem 1.15rem;
	border-left: 4px solid var(--rule-strong, #b8b8b8);
	background: var(--tint, #f6f6f4);
	max-width: var(--measure, 62ch);
}

.pem-idx__empty .pem-idx__none,
.pem-idx__retired-notice .pem-idx__none {
	display: block;
	margin: 0 0 .5rem;
	font-style: normal;
	font-weight: 700;
	font-size: var(--step-1, 1.125rem);
}

.pem-idx__empty p:last-child,
.pem-idx__retired-notice p:last-child { margin-bottom: 0; }

.pem-idx__retired-notice dl,
.pem-idx__definition {
	display: grid;
	grid-template-columns: minmax(10rem, auto) 1fr;
	gap: .4rem 1.25rem;
	margin: 1rem 0;
}

.pem-idx__definition { max-width: var(--measure-wide, 78ch); }
.pem-idx__retired-notice dt,
.pem-idx__definition dt { font-weight: 600; color: var(--ink-2); }
.pem-idx__retired-notice dd,
.pem-idx__definition dd { margin: 0; }

/*
 * DO-NOT 15: the coverage caveat is adjacent and readable, never a footnote.
 * On an index page it is usually the most important paragraph, and it is the
 * one a hurried reader skips if it is set small.
 */
.pem-idx__caveat {
	margin: 2rem 0 0;
	padding: 1rem 1.15rem;
	border-left: 4px solid var(--warn, #a2621c);
	background: var(--warn-bg, #fdf6ec);
	max-width: var(--measure, 62ch);
}

.pem-idx__caveat h3 { margin: 0 0 .5rem; font-size: var(--step-0, 1rem); }
.pem-idx__caveat p { margin: 0; line-height: 1.55; }

.pem-idx__retired { margin: 3rem 0 0; }
.pem-idx__retired ul { margin: .75rem 0 0; padding-left: 1.1rem; }
.pem-idx__retired li { margin: 0 0 .4rem; font-size: var(--step--1); }

/* ------------------------------- multi-market figures, side by side ------ */

/*
 * A multi-market index shows its markets TOGETHER.
 *
 * Stacked, PIDI-E's three geographies ran past the fold with two thirds of the
 * viewport empty beside them, so a reader had to scroll to learn the index even
 * covered more than one market — and comparing two of them meant scrolling back
 * and forth past everything in between. Seeing the markets at once is the whole
 * reason the index is split by market.
 *
 * `auto-fit` with a sensible floor rather than a fixed column count: the
 * figures decide how many fit, and one market on a narrow screen gets the full
 * width instead of a third of it.
 */
.pem-idx__values {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr));
	gap: 1.5rem 2rem;
	margin: 0 0 2rem;
	align-items: start;
}

/*
 * Two markets take two columns even where three would fit, so the pair reads
 * as a pair. Without this, a 3-column track leaves the second figure floating
 * against an empty third.
 */
.pem-idx__values[data-count="2"] {
	grid-template-columns: repeat(auto-fit, minmax(15rem, 22rem));
}

.pem-idx__values .pem-idx__value {
	margin: 0;
	padding: 1.1rem 1.25rem 1.25rem;
	border: 1px solid var(--rule-hair, rgba(255, 255, 255, .12));
	border-radius: 3px;
	/* The market label is the thing a reader scans for; give it the top edge. */
	border-top: 2px solid var(--accent, currentColor);
}

/* Inside a card the hero figure is large but not page-hero large. */
.pem-idx__values .pem-idx__figure {
	font-size: var(--step-4, 2.25rem);
}

/*
 * The movement table stops being a two-column grid inside a card — at card
 * width the label column squeezed the number onto a second line.
 */
.pem-idx__values .pem-idx__movement {
	grid-template-columns: 1fr auto;
	gap: .25rem .75rem;
	max-width: none;
}

.pem-idx__geo {
	margin: 0 0 .35rem;
	font-size: var(--step--1, .875rem);
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-2, inherit);
}

.pem-idx__comparator,
.pem-idx__unit,
.pem-idx__period {
	margin: .35rem 0 0;
	font-size: var(--step--1, .875rem);
	color: var(--ink-2, inherit);
}

.pem-idx__comparator { color: var(--ink-1, inherit); }

.pem-idx__provisional,
.pem-idx__modelled {
	display: inline-block;
	margin: .5rem .4rem 0 0;
	padding: .12rem .5rem;
	border: 1px solid var(--rule-hair, rgba(255, 255, 255, .18));
	border-radius: 2px;
	font-size: var(--step--2, .75rem);
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--ink-2, inherit);
}

/* The alternative comparators, at equal prominence but not equal size. */
.pem-idx__alongside {
	margin: 1rem 0 0;
	padding: .85rem 0 0;
	border-top: 1px solid var(--rule-hair, rgba(255, 255, 255, .12));
}

.pem-idx__alongside-lead {
	margin: 0 0 .5rem;
	font-size: var(--step--1, .875rem);
	color: var(--ink-2, inherit);
}

.pem-idx__alongside ul {
	margin: 0;
	padding: 0;
	list-style: none;
	display: grid;
	gap: .35rem;
}

.pem-idx__alt-figure {
	font-variant-numeric: tabular-nums;
	font-weight: 600;
}

.pem-idx__alt-label { color: var(--ink-2, inherit); }

/*
 * An observed-cohort figure. Visually distinct from a market series on
 * purpose: the reader must not take a named list of projects for a market.
 */
.pem-idx__value--cohort {
	border-left: 3px solid var(--accent, currentColor);
	padding-left: 1rem;
}

.pem-idx__cohort-market {
	margin: 0 0 .25rem;
	font-size: var(--step--2, .75rem);
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ink-2, inherit);
}

.pem-idx__cohort-label {
	margin: .35rem 0 0;
	font-size: var(--step--1, .9rem);
	font-weight: 600;
}

.pem-idx__cohort-milestone,
.pem-idx__cohort-suppressed,
.pem-idx__cohort-note {
	margin: .5rem 0 0;
	font-size: var(--step--2, .8rem);
	line-height: 1.5;
	color: var(--ink-2, inherit);
	max-width: 46rem;
}

.pem-idx__cohort-note {
	font-style: italic;
}

/*
 * A reference scenario set. Deliberately unlike a market series: bars rather
 * than a line, because three stated assumptions are not a distribution and an
 * axis would imply a sampling nobody did.
 */
.pem-idx__value--scenario { border-left: 3px solid var(--accent, currentColor); padding-left: 1rem; }
.pem-idx__scenario-release { margin: 0 0 .25rem; font-size: var(--step--2, .75rem); letter-spacing: .08em; text-transform: uppercase; color: var(--ink-2, inherit); }
.pem-idx__scenario-geo-note { margin: .5rem 0 0; font-size: var(--step--2, .8rem); line-height: 1.5; font-style: italic; color: var(--ink-2, inherit); max-width: 46rem; }
.pem-idx__scenarios { list-style: none; margin: 1.25rem 0 0; padding: 0; display: grid; gap: .9rem; max-width: 46rem; }
.pem-idx__scenario { display: grid; grid-template-columns: 1fr auto; gap: .15rem .75rem; align-items: baseline; }
.pem-idx__scenario-label { font-size: var(--step--1, .9rem); font-weight: 600; }
.pem-idx__scenario-value { font-variant-numeric: tabular-nums; font-size: var(--step-1, 1.2rem); }
.pem-idx__scenario-bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--rule-hair, rgba(255,255,255,.25)); min-width: 2px; }
.pem-idx__scenario.is-headline .pem-idx__scenario-bar { background: var(--accent, currentColor); }
.pem-idx__scenario.is-headline .pem-idx__scenario-value { font-weight: 700; }
.pem-idx__scenario-assumptions { grid-column: 1 / -1; font-size: var(--step--2, .72rem); line-height: 1.45; color: var(--ink-2, inherit); }
.pem-idx__scenario-limits { margin: 1.25rem 0 0; padding-left: 1.1rem; max-width: 46rem; font-size: var(--step--2, .8rem); line-height: 1.55; color: var(--ink-2, inherit); }
.pem-idx__scenario-limits li { margin-bottom: .35rem; }
