/*
 * Homepage pilot: the worked example.
 *
 * Loaded on the front page only, after style.css, from inc/home-pilot.php.
 * Every value below is a token from assets/css/tokens.css - no literal colour,
 * spacing or radius - so the pilot cannot drift away from the visual world the
 * rest of the site already ships.
 *
 * Layout (2026-10-03): the block is ONE SUBJECT and its FOUR EQUIVALENT ANSWERS,
 * so it reads top-down - subject row, then the answers as a band, then the
 * boundary line. It used to be a two-column split (a four-line column beside a
 * ~500px stack of tiles), and the height difference left the whole left column
 * empty with the boundary line floating under it. The band is the shape the
 * condition pages already use for the same four answers, so the homepage sample
 * and the page it links to read as one thing.
 */

/* ------------------------------------------------------- Subject row --- */

.kl-home-example__subject-row {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: var(--kl-space-4) var(--kl-space-5);
	flex-wrap: wrap;
	margin-bottom: var(--kl-space-5);
}

/* The name block may hold a long ICD title; it takes the room it needs and the
   link keeps its own width. */
.kl-home-example__identity {
	min-width: 0;
	max-width: 68ch;
}

.kl-home-example__subject {
	margin: 0;
	color: var(--kl-ink);
	font-size: var(--kl-text-xl);
	font-weight: var(--kl-weight-semibold);
}

/* The ICD-10 anchor line, directly under the name: the same content
   wellcarechina_render_disease_icd_line() prints at the top of the condition
   page, in the demoted second-line treatment the name pair already uses. */
.kl-home-example__icd {
	margin: var(--kl-space-1) 0 0;
	color: var(--kl-slate);
	font-size: var(--kl-text-sm);
}

.kl-home-example__more {
	flex: none;
	margin: 0 0 1px;
}

/* -------------------------------------------------------------- Band --- */

.kl-home-example__facts {
	display: grid;
	grid-template-columns: repeat(4, minmax(0, 1fr));
	gap: var(--kl-space-3);
	margin: 0;
	padding: 0;
	list-style: none;
}

/* The tile is the condition page's own key-figure tile in the page's own
   tokens - same label / value / note order, same accent, same hover lift. */
.kl-home-example__fact-link {
	display: flex;
	flex-direction: column;
	gap: var(--kl-space-2);
	box-sizing: border-box;
	height: 100%;
	min-height: 44px;
	padding: var(--kl-space-4);
	border: 1px solid var(--kl-border);
	border-radius: var(--kl-radius-input);
	background: var(--kl-paper);
	color: var(--kl-ink);
	text-decoration: none;
	transition: border-color var(--kl-dur-fast) var(--kl-ease), transform var(--kl-dur-fast) var(--kl-ease);
}

.kl-home-example__fact-link:hover,
.kl-home-example__fact-link:focus-visible {
	border-color: var(--kl-accent-ring);
	transform: translateY(-2px);
}

.kl-home-example__fact-label {
	color: var(--kl-slate);
	font-size: var(--kl-text-xs);
	font-weight: var(--kl-weight-semibold);
	letter-spacing: var(--kl-tracking-caps);
	text-transform: uppercase;
	/* One label ("Hospitals with a published record") wraps to two lines at
	   four-across, the rest take one; without a reservation its value sits
	   ~20px lower and the four figures stop reading as one row. Two snug
	   lines is the reserve, so the numbers keep a single level. */
	line-height: var(--kl-leading-snug);
	min-height: 2.9em;
}

.kl-home-example__fact-value {
	color: var(--kl-accent-hover);
	font-family: var(--kl-font-mono);
	font-size: var(--kl-text-3xl);
	font-variant-numeric: tabular-nums;
	font-weight: var(--kl-weight-semibold);
	line-height: var(--kl-leading-tight);
}

.kl-home-example__fact-note {
	margin-top: auto;
	color: var(--kl-slate);
	font-size: var(--kl-text-sm);
	line-height: var(--kl-leading-snug);
}

/* The boundary line closes the block, on its own row, at reading width. */
.kl-home-example__note {
	max-width: 68ch;
	margin: var(--kl-space-5) 0 0;
	color: var(--kl-slate);
	font-size: var(--kl-text-sm);
	line-height: var(--kl-leading-snug);
}

/* ---------------------------------------------------- Breakpoints --- */

/* Four answers need room to stay comparable. Two columns keep the value legible
   before the tiles turn into a list. */
@media (max-width: 1023px) {
	.kl-home-example__facts {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

/* Narrow: the subject row stacks, and the link follows the name it belongs to
   instead of sitting alone at the far end of a wrapped row. */
@media (max-width: 640px) {
	.kl-home-example__subject-row {
		display: block;
	}

	.kl-home-example__more {
		margin-top: var(--kl-space-3);
	}
}

@media (max-width: 480px) {
	.kl-home-example__facts {
		grid-template-columns: minmax(0, 1fr);
	}
}
