/*
 * Long-form article layout (/blog/control-twin, /blog/tier-board).
 *
 * Loaded ONLY on article pages, after site.css. Everything is scoped under .art-* so it
 * cannot collide with the shared cascade — site.css styles bare h1/h2/p/table, and a
 * long-form page needs a different measure, scale and rhythm from a marketing section.
 *
 * Colours are the site's own tokens. Deliberately NO webfont: BaseLayout already rejects
 * third-party analytics on a site whose pitch is measurement honesty, and Google Fonts
 * carries the same third-party-request trade. The editorial character here comes from
 * structure — field labels, a 68ch measure, hairline rules, the type scale — not the face.
 */

.art {
	--art-measure: 68ch;
	--art-wide: 980px;
	--art-rule: rgba(224, 224, 224, 0.14);
	--art-rule-strong: rgba(224, 224, 224, 0.26);
	--art-surface: var(--bg-card);
	--art-display: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
	--art-mono: ui-monospace, "SF Mono", "Fira Code", Menlo, Consolas, monospace;

	/* Chart mark colours. Redeclared here rather than inherited because site.css scopes
	   --ci-* to .leaderboard-ci, so an article gets empty strings and paints black marks
	   with no stroke at all — silently. Values MUST match that block; both are validated
	   against this dark surface, and the neon --accent-teal is NOT a substitute (it fails
	   the lightness band as a mark colour, per the note on .leaderboard-ci). */
	--ci-up: #0d9488;
	--ci-down: #e94560;

	padding: 0 0 5rem;
}

.art-wrap {
	max-width: var(--art-measure);
	margin: 0 auto;
	padding: 0 1.4rem;
}

.art-wide {
	max-width: var(--art-wide);
	margin: 0 auto;
	padding: 0 1.4rem;
}

/* ---------- masthead ---------- */

.art-masthead {
	border-bottom: 1px solid var(--art-rule);
	margin-bottom: 2.4rem;
}

.art-masthead .art-wide {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1.4rem;
	align-items: baseline;
	padding-top: 1.6rem;
	padding-bottom: 1rem;
}

.art-eyebrow {
	font-family: var(--art-mono);
	font-size: 0.72rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent-teal);
}

.art-dateline {
	font-family: var(--art-mono);
	font-size: 0.72rem;
	letter-spacing: 0.06em;
	color: var(--text-muted);
	margin-left: auto;
}

/* ---------- type ---------- */

.art h1.art-title {
	font-family: var(--art-display);
	font-weight: 400;
	font-size: clamp(2.2rem, 6vw, 3.6rem);
	line-height: 1.06;
	letter-spacing: -0.015em;
	color: var(--text-bright);
	margin: 0.2rem 0 1.1rem;
	text-wrap: balance;
	text-transform: none;
}

.art h2.art-h2 {
	font-family: var(--art-display);
	font-weight: 400;
	font-size: clamp(1.6rem, 3.4vw, 2.05rem);
	line-height: 1.16;
	letter-spacing: -0.008em;
	color: var(--text-bright);
	margin: 0.1rem 0 0.9rem;
	text-wrap: balance;
	text-transform: none;
}

.art h3.art-h3 {
	font-size: 1rem;
	font-weight: 600;
	color: var(--text-bright);
	margin: 2rem 0 0.5rem;
	text-transform: none;
	letter-spacing: 0;
}

.art p {
	font-size: 1.03rem;
	line-height: 1.66;
	color: var(--text-primary);
	margin: 0 0 1.1rem;
}

.art .art-standfirst {
	font-size: 1.14rem;
	line-height: 1.56;
	color: var(--text-muted);
	margin-bottom: 2rem;
}

.art .art-standfirst b {
	color: var(--text-bright);
	font-weight: 600;
}

.art-num {
	font-family: var(--art-mono);
	font-variant-numeric: tabular-nums;
	font-feature-settings: "tnum";
}

.art em.art-pull {
	font-family: var(--art-display);
	font-style: italic;
}

/* field label — names the section's ROLE in the argument, not its order */
.art-field {
	margin: 3.4rem 0 1.3rem;
	border-top: 1px solid var(--art-rule-strong);
	padding-top: 0.7rem;
}

.art-field .art-tag {
	display: block;
	font-family: var(--art-mono);
	font-size: 0.7rem;
	letter-spacing: 0.18em;
	text-transform: uppercase;
	color: var(--accent-teal);
	margin-bottom: 0.85rem;
}

/* ---------- figures ---------- */

.art-fig {
	margin: 2rem 0 2.4rem;
	background: var(--art-surface);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 1.3rem 1.3rem 1rem;
}

.art-fig-head {
	font-family: var(--art-mono);
	font-size: 0.71rem;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin-bottom: 0.25rem;
}

.art-fig-title {
	font-weight: 600;
	font-size: 0.98rem;
	line-height: 1.35;
	color: var(--text-bright);
	margin-bottom: 1rem;
}

.art-fig figcaption {
	font-size: 0.83rem;
	line-height: 1.5;
	color: var(--text-muted);
	margin-top: 0.9rem;
	padding-top: 0.8rem;
	border-top: 1px solid var(--art-rule);
}

.art-scroll {
	overflow-x: auto;
}

.art svg {
	display: block;
	width: 100%;
	height: auto;
	max-width: 100%;
}

.art svg text {
	font-family: var(--art-mono);
}

.art-panels {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1.6rem;
}

@media (max-width: 660px) {
	.art-panels {
		grid-template-columns: 1fr;
	}
}

.art-panel-label {
	font-family: var(--art-mono);
	font-size: 0.7rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin-bottom: 0.3rem;
}

.art-panel-sub {
	font-size: 0.83rem;
	color: var(--text-primary);
	margin-bottom: 0.5rem;
}

/* ---------- callouts ---------- */

.art-recipe {
	background: var(--art-surface);
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 1.2rem 1.35rem;
	margin: 2rem 0;
}

.art-recipe .art-tag {
	display: block;
	font-family: var(--art-mono);
	font-size: 0.7rem;
	letter-spacing: 0.16em;
	text-transform: uppercase;
	color: var(--accent-teal);
	margin-bottom: 0.7rem;
}

.art-recipe ol {
	margin: 0;
	padding-left: 1.15rem;
}

.art-recipe li {
	font-size: 0.95rem;
	line-height: 1.55;
	color: var(--text-primary);
	margin-bottom: 0.5rem;
}

.art-recipe li:last-child {
	margin-bottom: 0;
}

.art-warn {
	border-left: 3px solid var(--accent-red);
	background: var(--art-surface);
	padding: 0.95rem 1.2rem;
	margin: 1.8rem 0;
	border-radius: 0 4px 4px 0;
}

.art-warn p {
	font-size: 0.95rem;
	line-height: 1.58;
	margin: 0;
}

.art-warn p + p {
	margin-top: 0.7rem;
}

.art-warn b,
.art-warn strong {
	color: var(--text-bright);
}

/* ---------- tables ---------- */

.art-table-wrap {
	overflow-x: auto;
	margin: 1.6rem 0 2rem;
}

.art-table {
	border-collapse: collapse;
	width: 100%;
	font-size: 0.87rem;
	background: none;
}

.art-table caption {
	caption-side: top;
	text-align: left;
	font-family: var(--art-mono);
	font-size: 0.71rem;
	letter-spacing: 0.13em;
	text-transform: uppercase;
	color: var(--text-muted);
	padding-bottom: 0.6rem;
}

.art-table th,
.art-table td {
	padding: 0.42rem 0.7rem;
	text-align: right;
	white-space: nowrap;
	border-bottom: 1px solid var(--art-rule);
}

.art-table th:first-child,
.art-table td:first-child {
	text-align: left;
	padding-left: 0;
}

.art-table th:last-child,
.art-table td:last-child {
	padding-right: 0;
}

.art-table thead th {
	font-family: var(--art-mono);
	font-size: 0.7rem;
	font-weight: 500;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: var(--text-muted);
	border-bottom: 1px solid var(--art-rule-strong);
}

/* Values wear TEXT tokens, never a series colour — direction is carried by the sign.
   Colour stays on the chart marks, where it is the encoding. */
.art-table tbody td {
	font-family: var(--art-mono);
	font-variant-numeric: tabular-nums;
	color: var(--text-primary);
}

.art-table tbody td:first-child {
	font-family: inherit;
	color: var(--text-bright);
}

.art-table td.art-prose {
	text-align: left;
	white-space: normal;
	font-family: inherit;
	color: var(--text-primary);
}

.art-flag {
	font-family: var(--art-mono);
	font-size: 0.68rem;
	color: var(--text-muted);
}

/* ---------- code (tutorial pages) ----------
   Same surface as site.css's .code-block, at the article's measure and type scale. Inline
   code is scoped to .art because site.css styles no bare `code` at all. */

.art-code {
	background: #0d1117;
	border: 1px solid var(--border);
	border-radius: 4px;
	padding: 1rem 1.2rem;
	margin: 1.1rem 0 1.7rem;
	overflow-x: auto;
	font-family: var(--art-mono);
	font-size: 0.8rem;
	line-height: 1.55;
	color: var(--text-primary);
	tab-size: 2;
}

.art-code code {
	font-family: inherit;
	font-size: inherit;
	background: none;
	padding: 0;
}

.art-code-label {
	font-family: var(--art-mono);
	font-size: 0.68rem;
	letter-spacing: 0.12em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin: 1.4rem 0 -0.7rem;
}

.art p code,
.art li code,
.art td code {
	font-family: var(--art-mono);
	font-size: 0.88em;
	background: rgba(224, 224, 224, 0.08);
	padding: 0.05em 0.35em;
	border-radius: 3px;
	color: var(--text-bright);
}

/* A long path or field name in running text has no break opportunity; without this it
   pushes the page wider than a phone (measured: 13px over at 390px). Not applied inside
   tables, which scroll in their own wrapper and would otherwise split tokens mid-word. */
.art p code,
.art li code {
	overflow-wrap: anywhere;
}

/* ---------- tooltip ---------- */

#art-tip {
	position: fixed;
	z-index: 60;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.1s;
	background: var(--bg-elevated);
	border: 1px solid var(--border);
	color: var(--text-primary);
	font-family: var(--art-mono);
	font-size: 0.72rem;
	line-height: 1.45;
	padding: 0.45rem 0.6rem;
	border-radius: 4px;
	max-width: 240px;
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.45);
}

#art-tip b {
	color: var(--text-bright);
}

@media (prefers-reduced-motion: reduce) {
	#art-tip {
		transition: none;
	}
}

/* ---------- endnote ---------- */

.art-end {
	margin-top: 3.2rem;
	border-top: 1px solid var(--art-rule-strong);
	padding-top: 1.2rem;
	font-size: 0.85rem;
	line-height: 1.62;
	color: var(--text-muted);
}

/* Links in running text. Only .art-end a was styled before, so every link inside a
   paragraph fell back to the browser default (measured: rgb(0, 0, 238) on the navy ground —
   far below the 4.5:1 contrast floor, on this note and the tier-board note alike). */
.art a {
	color: var(--accent-teal);
	text-decoration-thickness: 1px;
	text-underline-offset: 0.15em;
}

.art-end a {
	color: var(--accent-teal);
}

.art-kicker {
	font-family: var(--art-mono);
	font-size: 0.72rem;
	letter-spacing: 0.1em;
	text-transform: uppercase;
	color: var(--text-muted);
	margin-bottom: 0.5rem;
}
