/**
 * T2 — the public factor table.
 *
 * `07-templates.md`: no literal colours, tokens only; a data table scrolls in
 * its own container so the page body never scrolls sideways.
 */

.pem-ft {
	margin: 0 0 2rem;
	max-width: var(--wide, 76rem);
}

/*
 * Both unit systems are in the document; this shows one. Written as two rules
 * rather than a single `[hidden]` toggle so that a page with no JavaScript —
 * where no `data-unit-system` has been applied yet — still shows exactly one
 * of them rather than both.
 */
.pem-ft[data-unit-system="metric"] [data-u="imperial"],
.pem-ft[data-unit-system="imperial"] [data-u="metric"],
.pem-ft:not([data-unit-system]) [data-u="imperial"] {
	display: none;
}

.pem-ft__controls { margin-bottom: .75rem; }

/* The persistent statement of what is on screen and what is published. It is
   deliberately not styled down — a reader taking a number off a toggled table
   needs this without hovering or scrolling. */
.pem-ft__system {
	margin: 0 0 1rem;
	padding: .6rem .8rem;
	border-left: 3px solid var(--accent, #0b4f6c);
	background: var(--ground-2, #f4f6f8);
	font-size: var(--step--1, .875rem);
	line-height: 1.5;
	max-width: var(--measure, 34rem);
}

.pem-ft__scroll {
	overflow-x: auto;
	/* A scrollable region must be reachable by keyboard, or the columns past
	   the fold are unreadable without a mouse. */
	scrollbar-gutter: stable;
}

.pem-ft__scroll:focus-visible { outline: 3px solid var(--accent, #0b4f6c); outline-offset: 2px; }

.pem-ft__table {
	border-collapse: collapse;
	width: 100%;
	min-width: 54rem;
	font-size: var(--step--1, .875rem);
	font-variant-numeric: tabular-nums;
}

.pem-ft__table :is(th, td) {
	text-align: right;
	padding: .55rem .6rem;
	border-bottom: 1px solid var(--rule, #d4d8dd);
	vertical-align: top;
}

.pem-ft__table thead th {
	text-align: right;
	font-size: var(--step--2, .78rem);
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--ink-2, #4a5058);
	border-bottom: 2px solid var(--ink, #16191d);
	white-space: nowrap;
}

.pem-ft__table :is(thead th, tbody th):first-child { text-align: left; }
.pem-ft__table tbody th { font-weight: 400; max-width: 22rem; }

/* The parameter's key as it appears in the JSON, so the column and the file
   are obviously the same thing. */
.pem-ft__key {
	display: block;
	font-family: var(--font-mono, ui-monospace, Consolas, monospace);
	text-transform: none;
	letter-spacing: 0;
	font-weight: 400;
	opacity: .8;
}

.pem-ft__name { font-weight: 600; display: block; }
.pem-ft__unit,
.pem-ft__variant { display: block; color: var(--ink-2, #4a5058); font-size: var(--step--2, .78rem); }
.pem-ft__variant { font-family: var(--font-mono, ui-monospace, Consolas, monospace); }

.pem-ft__basis,
.pem-ft__note {
	display: block;
	color: var(--ink-2, #4a5058);
	font-size: var(--step--2, .78rem);
	line-height: 1.45;
	margin-top: .25rem;
	white-space: normal;
}

/* A row with no published values. The reason is the content of the row, not a
   footnote to it — DO-NOT item 15. */
.pem-ft__row--blocked { color: var(--ink-2, #4a5058); }
.pem-ft__reason {
	display: block;
	color: var(--stop, #8c2f18);
	font-size: var(--step--2, .78rem);
	line-height: 1.45;
	margin-top: .25rem;
	white-space: normal;
}

.pem-ft__none { color: var(--ink-2, #4a5058); font-style: italic; }
.pem-ft__row--continued th { border-top: 0; }

.pem-ft__cite {
	margin-top: 1.5rem;
	padding: 1rem 1.1rem;
	border: 1px solid var(--rule, #d4d8dd);
	border-radius: 4px;
	max-width: var(--measure, 34rem);
}

.pem-ft__cite h3 { margin: 0 0 .5rem; font-size: var(--step-0, 1rem); }
.pem-ft__citation { font-style: italic; }
.pem-ft__cite p { margin: 0 0 .6rem; font-size: var(--step--1, .875rem); line-height: 1.55; }
.pem-ft__cite p:last-child { margin-bottom: 0; }

@media print {
	/* The control is an input and cannot be operated on paper; the printed
	   table keeps whichever system was on screen, and the system line says
	   which that was. */
	.pem-ft__controls { display: none; }
	.pem-ft__scroll { overflow: visible; }
	.pem-ft__table { min-width: 0; font-size: 9pt; }
	.pem-ft__cite { break-inside: avoid; }
}

/* -------------------------------------------------------------------------
 * T1 — the Cost Index hub.
 * ---------------------------------------------------------------------- */

.pem-hub__lede {
	font-size: var(--step-1, 1.125rem);
	line-height: 1.55;
	max-width: var(--measure, 34rem);
	margin: 0 0 1.25rem;
}

.pem-hub__meta {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(11rem, 1fr));
	gap: .75rem 1.5rem;
	margin: 0 0 2rem;
	padding: .9rem 0;
	border-top: 1px solid var(--rule, #d4d8dd);
	border-bottom: 1px solid var(--rule, #d4d8dd);
}

.pem-hub__meta dt {
	font-size: var(--step--2, .78rem);
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--ink-2, #4a5058);
}

.pem-hub__meta dd { margin: .15rem 0 0; font-weight: 600; font-variant-numeric: tabular-nums; }

.pem-hub__groups {
	list-style: none;
	margin: 0 0 2.5rem;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr));
	gap: 1rem;
}

.pem-hub__group {
	border: 1px solid var(--rule, #d4d8dd);
	border-radius: 4px;
	padding: 1rem 1.1rem;
	display: flex;
	flex-direction: column;
	gap: .5rem;
}

.pem-hub__group h3 { margin: 0; font-size: var(--step-0, 1rem); }
.pem-hub__count { margin: 0; font-variant-numeric: tabular-nums; }
.pem-hub__links { margin: auto 0 0; font-size: var(--step--1, .875rem); }

/* What is NOT published, and why. On the hub as well as the group page: a
   reader deciding whether the index covers their equipment should not have to
   open four pages to find out that it does not. */
.pem-hub__blocked {
	margin: 0;
	padding-left: 1.1rem;
	font-size: var(--step--1, .875rem);
	color: var(--stop, #8c2f18);
}

.pem-hub__blocked li { margin: 0 0 .2rem; }
