/**
 * Her size charts.
 *
 * includes/size-chart.php has always printed correct, semantic tables: a
 * caption, a thead with scope="col", a th scope="row" for each size. Nothing
 * ever styled them. On /size-guide/ that meant four tables at the browser's
 * default, each stretched to the full 1770px of the article, so "Women's Tunic"
 * sat centred in the middle of the page with 92 under it somewhere to the left
 * and 98 somewhere to the right, and the four charts read as one long list of
 * numbers that happened to be near each other.
 *
 * The same markup opens in the popup from a product page and from Teams, which
 * is why this is a sheet of its own rather than a few rules in page-copy.css:
 * the chart has three homes and only one of them is a copy page.
 *
 * THE TOKENS ARE THE THEME'S: --bone, --copper, --sage, --font-display and the
 * --text-* / --space-* scales. The theme sets html { font-size: 10px } and the
 * scales were built against that, so every size here is a token or a px value
 * and there is not one bare rem.
 *
 * @package mimi-core
 */

.mc-sizechart__body {
	--mcz-rule: color-mix(in srgb, var(--bone, #F6F3EF) 14%, transparent);
	--mcz-quiet: color-mix(in srgb, var(--bone, #F6F3EF) 64%, transparent);
	color: var(--bone, #F6F3EF);
}

/* -------------------------------------------------------------- a chart ---- */

/*
 * FIXED LAYOUT, BECAUSE AUTO MAKES FOUR DIFFERENT TABLES.
 *
 * Her charts do not all have the same columns: the women's tunic measures bust,
 * waist and hip, the women's pants measure waist, hip and a length, and the
 * men's charts have neither a waist nor a hip. Left to size themselves, each
 * one spaced its own columns to its own contents, so on the size guide the four
 * sat side by side with the Size column at a different width in every one and
 * no two numbers lining up across the page.
 *
 * Fixed layout gives them one rhythm: the same Size column everywhere, and the
 * measurements sharing what is left equally. Asked for by Andrew on 13 Oct
 * 2026: "Tables inconsistent. please make them look the same."
 */
.mc-sizechart__body table {
	width: 100%;
	table-layout: fixed;
	border-collapse: collapse;
	margin-block: 0;
	font-variant-numeric: tabular-nums;
}

/* Four characters at most, and it is the same four on every chart. */
.mc-sizechart__body th:first-child,
.mc-sizechart__body td:first-child { width: 88px; }

/*
 * The chart's name, and it belongs above the table on the left. A <caption>
 * centres itself by default, which on a table stretched across a page puts
 * "Women's Pants" a long way from the first thing it describes.
 */
.mc-sizechart__body caption {
	caption-side: top;
	min-height: 28px;
	text-align: start;
	padding-block-end: 14px;
	font-family: var(--font-display, Georgia, serif);
	font-size: var(--text-m);
	line-height: 1.2;
	color: var(--bone, #F6F3EF);
}

/*
 * THE HEADER ROW IS THE SAME HEIGHT ON EVERY CHART, AND THE LABELS SIT ON THE
 * RULE. "Length (waist to hem)" takes two lines in the women's pants chart and
 * one in the men's, and the two are side by side: left to themselves the right
 * chart's first measurement started 14px above the left chart's. A set height
 * with the text aligned to the bottom of it means the labels share a baseline
 * and every row below them lines up across the page.
 */
.mc-sizechart__body thead th {
	height: 44px;
	padding: 0 16px 10px 0;
	border-block-end: 1px solid var(--copper, #BB8335);
	vertical-align: bottom;
	text-align: start;
	font-family: var(--font-body, sans-serif);
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--copper, #BB8335);
}

.mc-sizechart__body tbody th,
.mc-sizechart__body tbody td {
	height: 42px;
	padding: 0 16px 0 0;
	border-block-end: 1px solid var(--mcz-rule);
	vertical-align: middle;
	text-align: start;
	font-size: var(--text-s);
	line-height: 1.3;
}

/* The size is the row's label and the only thing in it that is not a number. */
.mc-sizechart__body tbody th {
	font-family: var(--font-body, sans-serif);
	font-weight: 600;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	white-space: nowrap;
}

.mc-sizechart__body tbody td { color: var(--mcz-quiet); }

.mc-sizechart__body tbody tr:last-child th,
.mc-sizechart__body tbody tr:last-child td { border-block-end: none; }

/*
 * Reading across a seven-row chart to find one measurement is the whole job,
 * so the row the pointer is on lifts. Rows only: a hover that moves the type
 * would make the chart jump under the hand reading it.
 */
.mc-sizechart__body tbody tr { transition: background-color 0.2s var(--ease, ease); }

.mc-sizechart__body tbody tr:hover {
	background-color: color-mix(in srgb, var(--bone, #F6F3EF) 5%, transparent);
}

/* ---------------------------------------------------------- four charts ---- */

/*
 * The size guide prints every chart she has entered: women's tunic, women's
 * pants, men's tunic, men's pants. They are four short tables of the same
 * shape, and in a column they are a page of scrolling for twenty-eight numbers.
 *
 * auto-fit rather than a fixed two, so the popup on a product page, which is
 * narrower than the page, gets one column without a second media query.
 *
 * 560 RATHER THAN 420, SO THE PAGE NEVER MAKES THREE. The guide used to hold
 * the count by narrowing the whole article to 1180, which is two 420px charts
 * and the gap; on the site's 1440 rail that article is the full width and 420
 * makes a third column, so four charts laid out three and one. The floor is now
 * what decides, and it is the same number in the popup as on the page: 560 is
 * comfortably over a third of 1440 and comfortably under half of it.
 */
.mc-sizechart__body--all {
	display: grid;
	/* min() because a bare 560px minimum is a floor the track keeps even when
	   the container is 295px wide, and the page then scrolls sideways on a
	   phone to show the empty half of a column that does not fit. */
	grid-template-columns: repeat(auto-fit, minmax(min(560px, 100%), 1fr));
	gap: var(--space-2xl) var(--space-3xl);
	align-items: start;
}

/* The provenance line and her notes are about all four, so they span. */
.mc-sizechart__body--all > .mc-sizechart__caption,
.mc-sizechart__body--all > .mc-sizechart__note,
.mc-sizechart__body--all > .mc-sizechart__footnote,
.mc-sizechart__body--all > p { grid-column: 1 / -1; }

/* --------------------------------------------------------------- around ---- */

/* "Garment measurements in centimetres": what the numbers are, which has to be
   read before any of them and is one line long. */
.mc-sizechart__caption {
	margin: 0 0 var(--space-l);
	font-family: var(--font-body, sans-serif);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--copper, #BB8335);
}

/*
 * Her four paragraphs about how the garments are cut, under the charts they
 * qualify.
 *
 * THEY RUN THE WIDTH OF THE CHARTS, IN THE CHARTS' OWN COLUMNS. A 760px cap
 * under a 1180px grid ends halfway across it, which reads as a paragraph that
 * stopped rather than as a note that belongs to the tables above it: Andrew on
 * 14 Oct 2026, "size guide footnotes are halfway through, just extend it so
 * it's the same length as the two-column grid".
 *
 * columns and not a grid, because these are a run of paragraphs rather than
 * cells, and the gap is --space-3xl so the fold between them lands on the same
 * axis as the fold between the two charts.
 */
.mc-sizechart__note,
.mc-sizechart__footnote {
	margin-block: var(--space-xl) 0;
	font-size: var(--text-s);
	line-height: 1.7;
	color: var(--mcz-quiet);
}

@media (min-width: 900px) {
	.mc-sizechart__note,
	.mc-sizechart__footnote {
		columns: 2;
		column-gap: var(--space-3xl);
	}

	.mc-sizechart__note > *,
	.mc-sizechart__footnote > * { break-inside: avoid; }
}

.mc-sizechart__footnote p { margin-block: 0 var(--space-s); }
.mc-sizechart__footnote p:last-child { margin-block-end: 0; }

/* The editor-only state: no rows entered, and a link to the screen that fixes
   it. It is a warning and it should look like one rather than like her copy. */
.mc-sizechart__warn {
	padding: 16px 18px;
	border: 1px solid var(--copper, #BB8335);
	border-radius: 2px;
	font-size: var(--text-xs);
	line-height: 1.6;
}

.mc-sizechart__body--empty p {
	font-size: var(--text-s);
	color: var(--mcz-quiet);
}

/* ----------------------------------------------------------- a narrow one -- */

/*
 * A four-column chart of measurements has nothing to drop and nothing to wrap:
 * every cell is two or three digits and the header is one word. Below the
 * width it needs, it scrolls sideways inside its own box rather than squeezing
 * "Length (waist to hem)" into six characters a line.
 */
@media (max-width: 520px) {
	.mc-sizechart__body table {
		display: block;
		overflow-x: auto;
		white-space: nowrap;
	}
}
