/* ============================================================================
   THE BLOG: archive and article.

   Built on the portfolio's own tokens, so the two read as one site: the tinted
   near-black ground, Archivo for voice and IBM Plex Mono for anything factual,
   signal blue for what is live and amber only for resolution.

   Every class here is prefixed bl-. The bug that made this work necessary was a
   bare `.post` rule colliding with the class WordPress puts on every archive
   article, so nothing in this file uses a name WordPress or Elementor could
   also be using.

   Small text uses --text-2 rather than --muted. --muted measures 4.06:1 against
   the canvas, which fails AA below 24px, and every label here is 11 to 13px.
   ========================================================================== */

.bl {
	--bl-gap: clamp(28px, 4vw, 56px);
	padding: calc(72px + clamp(40px, 7vw, 96px)) var(--gut) clamp(80px, 10vw, 140px);
	max-width: var(--maxw);
	margin-inline: auto;
}

/* ---- the head block ---- */

.bl__head { max-width: 72ch; margin-bottom: clamp(36px, 5vw, 64px); }

.bl__kick {
	margin: 0 0 14px;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: .16em;
	text-transform: uppercase;
	color: var(--accent);
}

.bl__h1 {
	margin: 0;
	font-family: var(--display);
	font-weight: 700;
	font-size: clamp(38px, 6vw, 78px);
	line-height: 1.02;
	letter-spacing: -.02em;
	color: var(--text);
	text-wrap: balance;
}

.bl__lede {
	margin: 18px 0 0;
	max-width: 62ch;
	font-size: clamp(15px, 1.15vw, 18px);
	line-height: 1.65;
	color: var(--text-2);
}

/* ---- the category row ---- */

.bl__cats {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 clamp(32px, 4vw, 52px);
	padding: 0;
	list-style: none;
}

.bl__cat {
	display: inline-block;
	padding: 7px 13px;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: .04em;
	color: var(--text-2);
	text-decoration: none;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 999px;
	transition: color .18s var(--ease-soft), border-color .18s var(--ease-soft);
}

.bl__cat:hover,
.bl__cat:focus-visible { color: var(--text); border-color: var(--accent-mute); }

.bl__cat.is-on {
	color: var(--accent);
	border-color: var(--accent);
	background: var(--accent-mute);
}

.bl__cat i { font-style: normal; color: var(--text-2); }

/* ---- the lead article: the only one given the full width ---- */

.bl__lead {
	display: grid;
	grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr);
	gap: var(--bl-gap);
	align-items: center;
	margin: 0 0 clamp(44px, 6vw, 76px);
	padding: 0 0 clamp(44px, 6vw, 76px);
	border-bottom: 1px solid var(--line);
}

.bl__leadfig {
	position: relative;
	margin: 0;
	aspect-ratio: 16 / 10;
	overflow: hidden;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 14px;
}

.bl__leadfig img,
.bl-card__img img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform .6s var(--ease);
}

.bl__lead:hover .bl__leadfig img,
.bl-card:hover .bl-card__img img { transform: scale(1.03); }

.bl__leadt {
	margin: 14px 0 0;
	font-family: var(--display);
	font-weight: 700;
	font-size: clamp(26px, 3.2vw, 42px);
	line-height: 1.12;
	letter-spacing: -.015em;
	text-wrap: balance;
}

.bl__leadt a { color: var(--text); text-decoration: none; }
.bl__leadt a:hover { color: var(--accent-hi); }

.bl__leadx {
	margin: 14px 0 0;
	font-size: 16px;
	line-height: 1.68;
	color: var(--text-2);
}

/* ---- the grid ---- */

.bl__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
	gap: var(--bl-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.bl-card {
	display: flex;
	flex-direction: column;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 14px;
	overflow: hidden;
	transition: border-color .2s var(--ease-soft), transform .3s var(--ease);
}

.bl-card:hover { border-color: var(--accent-mute); transform: translateY(-3px); }

.bl-card__img {
	aspect-ratio: 16 / 9;
	overflow: hidden;
	background: var(--panel-2);
	border-bottom: 1px solid var(--line);
}

/* no featured image: a drawn placeholder rather than a broken frame */
.bl-card__img--ph {
	background:
		radial-gradient(120% 90% at 30% 0%, rgba(var(--accent-rgb),.14), transparent 60%),
		var(--panel-2);
}

.bl-card__b { display: flex; flex-direction: column; gap: 10px; padding: 20px 22px 24px; flex: 1; }

.bl-card__t {
	margin: 0;
	font-family: var(--display);
	font-weight: 650;
	font-size: 19px;
	line-height: 1.28;
	letter-spacing: -.01em;
	text-wrap: balance;
}

.bl-card__t a { color: var(--text); text-decoration: none; }
.bl-card__t a:hover { color: var(--accent-hi); }

.bl-card__x { margin: 0; font-size: 14.5px; line-height: 1.62; color: var(--text-2); }

.bl-card__more {
	margin-top: auto;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: .04em;
	color: var(--accent);
	text-decoration: none;
}

.bl-card__more:hover { color: var(--accent-hi); }
.bl-card__more span { transition: margin-left .2s var(--ease-soft); }
.bl-card__more:hover span { margin-left: 5px; }

/* ---- shared meta line ---- */

.bl-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	font-family: var(--mono);
	font-size: 11.5px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--text-2);
}

.bl-meta a { color: var(--accent); text-decoration: none; }
.bl-meta a:hover { color: var(--accent-hi); }
.bl-meta__sep { width: 14px; height: 1px; background: var(--line); }

/* ---- pagination ---- */

.bl__pager {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: center;
	margin: clamp(48px, 6vw, 80px) 0 0;
	padding-top: clamp(28px, 4vw, 44px);
	border-top: 1px solid var(--line);
	font-family: var(--mono);
	font-size: 13px;
}

.bl__pager .page-numbers {
	min-width: 40px;
	padding: 9px 13px;
	text-align: center;
	color: var(--text-2);
	text-decoration: none;
	border: 1px solid var(--line);
	border-radius: 9px;
	transition: color .18s var(--ease-soft), border-color .18s var(--ease-soft);
}

.bl__pager .page-numbers:hover { color: var(--text); border-color: var(--accent-mute); }

.bl__pager .page-numbers.current {
	color: var(--canvas);
	background: var(--accent);
	border-color: var(--accent);
}

.bl__pager .page-numbers.dots { border-color: transparent; }

/* ---- nothing found ---- */

.bl__empty {
	padding: 48px 0;
	font-size: 17px;
	line-height: 1.7;
	color: var(--text-2);
}

/* ============================================================================
   THE ARTICLE
   ========================================================================== */

.bl-art {
	/* The article uses the site's own container -- the same max-width and the
	   same gutter as .nav__in, .sec and .foot__in -- so the eyebrow, the title,
	   the lead image, the running text and the footer all begin and end on the
	   header's edges at every width. */
	--bl-col: var(--maxw);
	padding-top: calc(72px + clamp(32px, 5vw, 64px));
}

.bl-art__head {
	max-width: var(--bl-col);
	margin: 0 auto clamp(30px, 4vw, 46px);
	padding-inline: var(--gut);
}


.bl-art__eyebrow {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0 0 16px;
	font-family: var(--mono);
	font-size: 12px;
	letter-spacing: .14em;
	text-transform: uppercase;
}

.bl-art__eyebrow a { color: var(--accent); text-decoration: none; }
.bl-art__eyebrow a:hover { color: var(--accent-hi); }

.bl-art__h1 {
	margin: 0;
	font-family: var(--display);
	font-weight: 700;
	font-size: clamp(30px, 3.6vw, 50px);
	line-height: 1.08;
	letter-spacing: -.02em;
	color: var(--text);
	text-wrap: balance;
}

.bl-art__meta { margin-top: 20px; }

/* The lead image shares the article's column, so the figure, the title and the
   running text meet on the same left and right edge at every width. */
.bl-art__fig {
	max-width: var(--bl-col);
	margin: 0 auto clamp(34px, 5vw, 56px);
	padding-inline: var(--gut);
}

/* The lead image is capped, and sits on the column's left edge rather than being
   centred, so it keeps the same left spine as the title and the running text. */
.bl-art__fig img {
	width: 100%;
	max-width: 600px;
	height: auto;
	display: block;
	border: 1px solid var(--line);
	border-radius: 16px;
}

.bl-art__fig figcaption {
	margin-top: 10px;
	max-width: 600px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--text-2);
}

/* ---- the body: one measure, everything inside it ---- */

.bl-body {
	max-width: var(--bl-col);
	margin-inline: auto;
	padding-inline: var(--gut);
	font-size: clamp(16px, 1.15vw, 17.5px);
	line-height: 1.78;
	/* A step softer than --text. At this length a full-strength white glares,
	   and this still measures 13:1 against the ground. */
	color: var(--c-article-fg);
}

/* An in-page link would otherwise drop its target under the fixed header. */
.bl-body :is(h2, h3, h4),
.bl-body [id] { scroll-margin-top: 96px; }

.bl-body > * + * { margin-top: 1.35em; }

.bl-body h2,
.bl-body h3,
.bl-body h4 {
	font-family: var(--display);
	font-weight: 700;
	line-height: 1.18;
	letter-spacing: -.015em;
	color: var(--text);
	text-wrap: balance;
}

.bl-body h2 { margin-top: 2.1em; font-size: clamp(23px, 2.4vw, 31px); }
.bl-body h3 { margin-top: 1.9em; font-size: clamp(19px, 1.8vw, 23px); }
.bl-body h4 { margin-top: 1.7em; font-size: 18px; }

/* a hairline under h2 marks the sections without shouting */
.bl-body h2::after {
	content: "";
	display: block;
	width: 46px;
	height: 2px;
	margin-top: .5em;
	background: var(--accent);
	border-radius: 2px;
}

.bl-body a {
	color: var(--accent-hi);
	text-decoration: underline;
	text-decoration-color: var(--accent-mute);
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.bl-body a:hover { text-decoration-color: var(--accent); }

.bl-body strong { color: var(--text); font-weight: 650; }

.bl-body ul,
.bl-body ol { padding-left: 1.4em; }
.bl-body li + li { margin-top: .5em; }
.bl-body li::marker { color: var(--accent); }

.bl-body blockquote {
	margin-inline: 0;
	padding: 4px 0 4px 22px;
	border-left: 2px solid var(--accent);
	font-size: 1.06em;
	color: var(--text);
}

.bl-body blockquote p { margin: 0; }
.bl-body blockquote cite {
	display: block;
	margin-top: .7em;
	font-family: var(--mono);
	font-size: 12px;
	font-style: normal;
	color: var(--text-2);
}

.bl-body code {
	padding: .15em .4em;
	font-family: var(--mono);
	font-size: .88em;
	color: var(--tok-str);
	background: var(--deep);
	border: 1px solid var(--line);
	border-radius: 5px;
}

.bl-body pre {
	padding: 18px 20px;
	overflow-x: auto;                /* long lines scroll here, not the page */
	background: var(--deep);
	border: 1px solid var(--line);
	border-radius: 12px;
}

.bl-body pre code {
	padding: 0;
	font-size: 13.5px;
	line-height: 1.7;
	color: var(--tok-att);
	background: none;
	border: 0;
}

.bl-body img,
.bl-body video,
.bl-body iframe {
	max-width: 100%;
	height: auto;
	display: block;
	border-radius: 12px;
}

.bl-body figure { margin-inline: 0; }
.bl-body figcaption {
	margin-top: 10px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--text-2);
}

.bl-body hr { border: 0; border-top: 1px solid var(--line); margin-block: 2.4em; }

/* tables get their own scroller for the same reason pre does */
.bl-body .bl-scroll { overflow-x: auto; }
.bl-body table { width: 100%; border-collapse: collapse; font-size: 15px; }
.bl-body th,
.bl-body td { padding: 10px 12px; text-align: left; border-bottom: 1px solid var(--line); }
.bl-body th { font-family: var(--mono); font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--text-2); }
.bl-body td { font-variant-numeric: tabular-nums; }

/* ---- article footer ---- */

.bl-art__foot {
	max-width: var(--bl-col);
	margin: clamp(48px, 6vw, 76px) auto 0;
	padding: clamp(26px, 3vw, 36px) var(--gut) 0;
	border-top: 1px solid var(--line);
}

.bl-tags { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 26px; padding: 0; list-style: none; }

.bl-tags a {
	display: inline-block;
	padding: 6px 12px;
	font-family: var(--mono);
	font-size: 12px;
	color: var(--text-2);
	text-decoration: none;
	border: 1px solid var(--line);
	border-radius: 999px;
}

.bl-tags a:hover { color: var(--text); border-color: var(--accent-mute); }

/* ---- prev / next ---- */

.bl-near {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 16px;
	max-width: var(--bl-col);
	margin: clamp(44px, 5vw, 72px) auto 0;
	padding-inline: var(--gut);
}

.bl-near__a {
	display: block;
	padding: 20px 22px;
	text-decoration: none;
	background: var(--panel);
	border: 1px solid var(--line);
	border-radius: 14px;
	transition: border-color .2s var(--ease-soft), transform .3s var(--ease);
}

.bl-near__a:hover { border-color: var(--accent-mute); transform: translateY(-2px); }

.bl-near__k {
	display: block;
	margin-bottom: 8px;
	font-family: var(--mono);
	font-size: 11.5px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--accent);
}

.bl-near__t {
	display: block;
	font-family: var(--display);
	font-weight: 650;
	font-size: 16.5px;
	line-height: 1.32;
	color: var(--text);
}

.bl-near__a--next { text-align: right; }

/* ---- responsive ---- */

@media (max-width: 900px) {
	.bl__lead { grid-template-columns: 1fr; gap: 22px; align-items: start; }
	.bl__leadfig { aspect-ratio: 16 / 9; }
	.bl-near__a--next { text-align: left; }
}

@media (prefers-reduced-motion: reduce) {
	.bl__leadfig img,
	.bl-card__img img,
	.bl-card,
	.bl-near__a { transition: none; }
	.bl__lead:hover .bl__leadfig img,
	.bl-card:hover .bl-card__img img { transform: none; }
	.bl-card:hover,
	.bl-near__a:hover { transform: none; }
}

/* ---- the header over a reading page ----
   The translucent, blurred header is a hero device: it reads as glass over a
   dark cinematic scene. Over running text it reads as mush, so on these views
   it is opaque. Same colour, no guesswork about what is behind it. */
.hariri--reading .nav.is-stuck {
	background: var(--c-reading-nav);
	backdrop-filter: none;
}

/* The header trades --gut for a tighter gutter below 560px, so the article
   matches it rather than sitting inside a wider margin than the brand. */
@media (max-width: 560px) {
	.bl-art__head,
	.bl-art__fig,
	.bl-body,
	.bl-art__foot,
	.bl-near { padding-inline: clamp(14px, 4vw, 20px); }
}
