/* ==========================================================================
   Story Lab — loads only on single posts (news stories), on every host.
   Pairs with functions/story-lab.php. Tracking: #1201 / #1206 / #1208.

   Shipping (2026-10-10, #1190): production gets the lab DEFAULTS only —
   st-head-center, st-crumb-trail, st-hang-peek (+ st-swap), st-side-meta,
   st-intro-lede, st-rel-cards. The other variant rules and section 8 (the
   switcher window) stay here but are inert off a demo host: their body
   classes / markup are never emitted there.

   Sections
     1. Tokens and scaffolding
     2. Title block          body.st-head-*
     3. Breadcrumbs          body.st-crumb-*
     4. Story into the band  body.st-hang-*   (+ body.st-swap)
     5. The rail             body.st-side-*
     6. Intro paragraph      body.st-intro-*
     7. Related stories      body.st-rel-*
     8. The switcher window

   Every rule is scoped to body.st-on, which only ever lands on
   is_singular('post') — nothing here can reach a section page, an archive
   or any other single.
   ========================================================================== */

/* ── 1. Tokens and scaffolding ──────────────────────────────────────── */

body.st-on {
	/* The band is #1b1b1b on news, and brand red on it measures 3.3:1 —
	   under the 4.5 floor. So the accent is structural (rules, chips,
	   edges) on dark and only becomes red type on white. The light tint is
	   the red lifted until it clears AA on the band. */
	--st-accent:      var(--c-red-500, #dc0009);
	--st-accent-lift: #ff9a92;
	--st-on-dark:     #ffffff;
	--st-on-dark-mut: #b9c0c7;
	--st-ink:         var(--c-neutral-900, #1b1b1b);
	--st-ink-mut:     var(--c-neutral-600, #5c636d);
	--st-line:        var(--c-neutral-300, #e3e6ea);
	--st-paper:       #ffffff;
	--st-radius:      8px;
	--st-jut:         44px;
}
/* The tints above were measured on the old #1b1b1b band. On the navy
   plan-grid band (reskin-navy, #2d5577 -> #4a7aa6) they drop to 3.3:1
   (kicker) and 3.6:1 (date line) under the centred title, and on phones the
   centred text reaches the band's brightest end, where even white is only
   4.54:1 (audit 2026-10-11). So both go white; the kicker stays set apart
   by its tracked small caps, the date line by size. */
body.st-on.reskin-navy {
	--st-accent-lift: #ffffff;
	--st-on-dark-mut: #ffffff;
}

body.st-on .st-sr {
	position: absolute;
	width: 1px; height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* The rebuilt trail replaces the theme's, but the original stays in the
   DOM carrying its schema attributes. */
body.st-on #breadcrumbs.st-crumb-src { display: none !important; }

/* single.php always prints the .wp-caption wrapper, image or no image, and
   most news posts have no featured image — so the story's paper opens with
   ~30px of empty div before the first word. It is not :empty (it holds
   whitespace), so the lab tags it in JS. Measured: it was eating half of
   the ?sthang=tab jut. */
body.st-on .wp-caption.st-empty { display: none; }

/* ── 2. Title block ─────────────────────────────────────────────────── */

/* Shared by every non-off head treatment: the date stops being a red
   calendar chip hanging in the left gutter and becomes a line of type.
   That chip is the single biggest reason the shipped story header reads
   as "a section page with a date stuck on it". */
body.st-on:not(.st-head-off) #page_head .post_meta {
	padding-left: 0;
}
body.st-on:not(.st-head-off) #page_head .post_meta .post_date {
	float: none;
	width: auto;
	margin: 0;
	padding: 0;
	background: none;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px;
	font: 400 13px/1.5 var(--font-body, 'Lexend', sans-serif);
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--st-on-dark-mut);
}
body.st-on:not(.st-head-off) #page_head .post_meta .post_date:after { display: none; }
body.st-on:not(.st-head-off) #page_head .post_meta .post_date .month,
body.st-on:not(.st-head-off) #page_head .post_meta .post_date .date,
body.st-on:not(.st-head-off) #page_head .post_meta .post_date .year {
	display: inline;
	margin: 0;
	font: inherit;
	letter-spacing: inherit;
}
/* Date and reading time each lead with a small outline icon (calendar,
   clock) instead of a dot between them. The icons are masks, so they take
   the line's colour; decorative only, the text still says what it is. */
body.st-on:not(.st-head-off) #page_head .post_meta .post_date::before,
body.st-on:not(.st-head-off) #page_head .post_meta .post_date .st-read::before {
	content: '';
	flex: 0 0 auto;
	align-self: center;
	width: 14px;
	height: 14px;
	background: currentColor;
	-webkit-mask: var(--st-icon) center / contain no-repeat;
	mask: var(--st-icon) center / contain no-repeat;
}
body.st-on:not(.st-head-off) #page_head .post_meta .post_date::before {
	--st-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cpath d='M16 2v4M8 2v4M3 10h18'/%3E%3C/svg%3E");
}
body.st-on:not(.st-head-off) #page_head .post_meta .post_date .st-read {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	margin-left: 12px;
}
body.st-on:not(.st-head-off) #page_head .post_meta .post_date .st-read::before {
	--st-icon: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 7v5l3 2'/%3E%3C/svg%3E");
}

/* The category becomes a kicker above the headline. */
body.st-on:not(.st-head-off) #page_head .post_meta .post-categories {
	font: 500 var(--fs-100)/1.4 var(--font-body, 'Lexend', sans-serif);
	letter-spacing: .16em;
	text-transform: uppercase;
}
body.st-on:not(.st-head-off) #page_head .post_meta .post-categories li { margin: 0 12px 0 0; }
body.st-on:not(.st-head-off) #page_head .post_meta .post-categories li a {
	color: var(--st-accent-lift);
	text-decoration: none;
}
body.st-on:not(.st-head-off) #page_head .post_meta .post-categories li a:hover { color: #fff; }

/* Stacking order — kicker, headline, deck, date line. The theme's source
   order is date, categories, h1, so this is a reorder, not a rewrite. */
body.st-on:not(.st-head-off) #page_head .post_meta {
	display: flex;
	flex-direction: column;
	gap: 14px;
}
body.st-on:not(.st-head-off) #page_head .post_meta > .st-crumb      { order: 0; }
body.st-on:not(.st-head-off) #page_head .post_meta > .post-categories { order: 1; }
body.st-on:not(.st-head-off) #page_head .post_meta > h1             { order: 2; margin: 0; }

body.st-on:not(.st-head-off) #page_head .post_meta > .post_date     { order: 4; }

/* Centered — the lab default. The band itself is full-bleed (the shipped
   float, #1201), so the centering has to be re-imposed on the block: a
   measure, and auto margins on the h1 whose own max-width would otherwise
   pin it left. */
body.st-on.st-head-center #page_head .post_meta {
	align-items: center;
	text-align: center;
	max-width: 1040px;
	margin: 0 auto;
}
body.st-on.st-head-center #page_head h1 {
	margin-left: auto;
	margin-right: auto;
	font-size: clamp(32px, 3.6vw, 52px);
	line-height: 1.14;
	max-width: 20ch;
}

/* ── 3. Breadcrumbs ─────────────────────────────────────────────────── */

body.st-on .st-crumb {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font: 400 13px/1.5 var(--font-body, 'Lexend', sans-serif);
}
body.st-on .st-crumb-link {
	color: var(--st-on-dark-mut);
	text-decoration: none;
	border-bottom: 1px solid transparent;
}
body.st-on .st-crumb-link:hover {
	color: #fff;
	border-bottom-color: rgba(255, 255, 255, .5);
}
body.st-on .st-crumb-sep { color: rgba(255, 255, 255, .35); }

/* Trail (default) — centered, below the headline block, quiet. Sits in the
   band's own bottom padding, above whatever the story hangs into. */
body.st-on.st-crumb-trail #page_head > .container > .st-crumb {
	justify-content: center;
	margin: 26px auto 0;
	font-size: var(--fs-100);
	letter-spacing: .03em;
}

/* Tab — the docked tab the section pages use, but centered and carrying
   the whole trail, so it is recognisably the same furniture doing a
   different job. */

@media (max-width: 640px) {
	body.st-on .st-crumb { font-size: var(--fs-100); gap: 6px; }
}

/* ── 4. Story into the band ─────────────────────────────────────────── */

/* The swap. On section pages the rail juts into the band (?sbhang=peek);
   on a story the page itself does, and the rail sits where it lands.
   Kalman, 2026-09-01: "the story could look like it is overlapping into
   the title area, a sort of swap of how the sidebar is on other pages".

   Desktop only — under 992px the columns stack and an overlap on a
   stacked layout is just a broken gap.

   The unwind of the rail hang has to out-specify sidebar-lab's own rule,
   which it does on class count (st-on + st-swap + :not) and on source
   order (this sheet is enqueued after it). */
@media (min-width: 992px) {
	body.st-on.st-swap .container > .row:has(> :nth-child(2):last-child) > [class*="col-"]:has(#sidebar-left, #sidebar),
	body.st-on.st-swap .container > .row:has(> :nth-child(2):last-child) > [class*="col-"]:has(#sidebar) {
		margin-top: 0;
	}

	/* Room for the overlap: the band has no bottom padding of its own (the
	   shipped breadcrumb tab is docked flush to its edge), so the jut would
	   otherwise land on the trail rather than under it. */
	body.st-on[class*="st-hang-"]:not(.st-hang-off) #page_head { padding-bottom: var(--st-jut); }

	/* Measured, not guessed: with the jut alone the centered trail's bottom
	   edge landed at y=490 and the paper's top at y=489 — the crumbs were
	   sitting ON the paper. The three crumb treatments that hang BELOW the
	   title block need the paper's own depth cleared as well. */
	body.st-on[class*="st-hang-"]:not(.st-hang-off).st-crumb-trail #page_head {
		padding-bottom: calc(var(--st-jut) + 34px);
	}

	/* The paper. Not shared with ?sbpaper= on purpose: the hang has to work
	   on a plain URL, and a page that only holds together when a second
	   lab's param is set is not a design option. */
	body.st-on[class*="st-hang-"]:not(.st-hang-off) .container > .row > .single-content {
		position: relative;
		z-index: 3;
		margin-top: calc(-1 * var(--st-jut));
		background: var(--st-paper);
		padding: 34px 40px 40px;
		border-radius: var(--st-radius);
		box-shadow: 0 10px 34px rgba(0, 0, 0, .13), 0 -2px 20px rgba(0, 0, 0, .16);
	}
	body.st-on[class*="st-hang-"]:not(.st-hang-off) .container:has(> .row > .single-content) {
		position: relative;
		z-index: 2;
	}

}

/* ── 5. The rail ────────────────────────────────────────────────────── */

/* The story-facts card. */
body.st-on .st-mod--meta {
	list-style: none;
	margin: 0 0 26px;
	padding: 0 0 22px;
	border-bottom: 1px solid var(--st-line);
}
body.st-on .st-mod--meta .st-meta-title {
	margin: 0 0 14px !important;
	font: 500 13px/1.4 var(--font-body, 'Lexend', sans-serif) !important;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--st-ink-mut) !important;
	border: 0 !important;
	padding: 0 !important;
	background: none !important;
}
body.st-on .st-meta-list { margin: 0; }
body.st-on .st-meta-row {
	display: flex;
	gap: 10px;
	align-items: baseline;
	padding: 7px 0;
	border-top: 1px solid var(--st-line);
}
body.st-on .st-meta-row:first-child { border-top: 0; padding-top: 0; }
body.st-on .st-meta-row dt {
	flex: 0 0 92px;
	font: 400 var(--fs-100)/1.5 var(--font-body, 'Lexend', sans-serif);
	color: var(--st-ink-mut);
}
body.st-on .st-meta-row dd {
	margin: 0;
	font: 400 14px/1.5 var(--font-body, 'Lexend', sans-serif);
	color: var(--st-ink);
}
body.st-on .st-meta-row--tags { flex-wrap: wrap; }
body.st-on .st-chip {
	display: inline-block;
	margin: 0 6px 6px 0;
	padding: 3px 10px;
	border: 1px solid var(--st-line);
	border-radius: 999px;
	font-size: var(--fs-100);
	line-height: 1.5;
	color: var(--st-ink);
	text-decoration: none;
}
body.st-on .st-chip:hover { border-color: var(--st-accent); color: var(--st-accent); }
/* The sidebar lab appends an item count to every category link in the rail
   (?sbcount=paren, a lab default). "Economic and Community Development 686"
   is right on a topic list and wrong on a "filed under" chip — the number
   answers a question nobody asked while reading one story. */
body.st-on .st-chip .sbl-count { display: none; }
body.st-on .st-meta-share {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 16px;
}
body.st-on .st-meta-share-label {
	font: 400 var(--fs-100)/1.5 var(--font-body, 'Lexend', sans-serif);
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--st-ink-mut);
}
body.st-on .st-meta-share a {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 30px; height: 30px;
	border: 1px solid var(--st-line);
	border-radius: 50%;
	color: var(--st-ink);
	text-decoration: none;
}
body.st-on .st-meta-share a:hover { background: var(--st-ink); border-color: var(--st-ink); color: #fff; }

/* Meta (default) — the news taxonomy is still available, but it stops
   being the first thing in the rail and collapses to a quieter list. */
/* Every widget under the meta card, not just categories (#1346): "Recent
   posts" kept the rail's display size — 21px here, 36px on phones — next
   to a 15px "News Categories". */
body.st-on.st-side-meta #sidebar > li.widget > h2.widgettitle {
	font-size: 15px !important;
}
body.st-on.st-side-meta #sidebar > li.widget_categories ul li {
	font-size: 13.5px;
}

/* ── 6. Intro paragraph ─────────────────────────────────────────────── */

/* Lede (default) — bigger, lighter, more space under it. Lexend 350 is
   what the site deploys for long-form body (#1207), so the standfirst
   goes one step lighter still rather than one step bolder. */
body.st-on:not(.st-intro-off) .single-content .st-lede {
	font-size: 21px;
	line-height: 1.55;
	font-weight: 350;
	color: #2b3138;
	margin-bottom: 26px;
}

/* Deck — the lede moves up into the band, under the headline. The band is
   dark, so the type inverts; the measure is tighter than the headline's so
   the two do not read as one block. */

@media (max-width: 991px) {
	body.st-on:not(.st-intro-off) .single-content .st-lede { font-size: 18px; }
	
}

/* ── 7. Related stories ─────────────────────────────────────────────── */

body.st-on .st-related {
	clear: both;
	margin: 56px 0 8px;
	padding-top: 30px;
	border-top: 1px solid var(--st-line);
	padding-bottom: 25px;
}
body.st-on .st-related-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	margin-bottom: 22px;
}
body.st-on .st-related-title {
	margin: 0;
	font: 500 15px/1.4 var(--font-body, 'Lexend', sans-serif);
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--st-ink-mut);
}
body.st-on .st-related-all {
	font: 400 14px/1.5 var(--font-body, 'Lexend', sans-serif);
	color: var(--st-accent);
	text-decoration: none;
	border-bottom: 1px solid currentColor;
}
body.st-on .st-related-all:hover { color: var(--c-red-600, #a80007); }
body.st-on .st-related-items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: grid;
	gap: 26px;
}
body.st-on .st-related-item { margin: 0; }
body.st-on .st-related-item::before { content: none; }
body.st-on .st-related-link {
	display: block;
	text-decoration: none;
	color: inherit;
}
body.st-on .st-related-media {
	display: block;
	aspect-ratio: 16 / 10;
	background: var(--c-neutral-200, #eef0f2) center/cover no-repeat;
	border-radius: var(--st-radius);
	margin-bottom: 12px;
}
body.st-on .st-related-media--blank {
	background: linear-gradient(135deg, var(--c-neutral-200, #eef0f2), var(--c-neutral-300, #e3e6ea));
}
body.st-on .st-related-kicker {
	display: block;
	font: 500 var(--fs-100)/1.4 var(--font-body, 'Lexend', sans-serif);
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--st-accent);
	margin-bottom: 6px;
}
body.st-on .st-related-name {
	display: block;
	font: 400 17px/1.35 var(--font-body, 'Lexend', sans-serif);
	color: var(--st-ink);
}
body.st-on .st-related-link:hover .st-related-name { color: var(--st-accent); }
body.st-on .st-related-date {
	display: block;
	margin-top: 6px;
	font: 400 var(--fs-100)/1.5 var(--font-body, 'Lexend', sans-serif);
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--st-ink-mut);
}

/* Cards (default) — three across. */
body.st-on.st-rel-cards .st-related-items { grid-template-columns: repeat(3, 1fr); }

/* #1342: each related story is a white card — the same box and hover as
   the /news/ list items (sidebar-lab.css, .single_news_wrapper). */
body.st-on .st-related-link {
	height: 100%;
	background: #fff;
	border: 1px solid #dfe3e7;
	border-radius: 10px;
	padding: 18px;
	transition: border-color .15s ease, box-shadow .15s ease;
}
body.st-on .st-related-link:hover,
body.st-on .st-related-link:focus-visible {
	border-color: #9aa2ad;
	box-shadow: 0 0 0 1px #9aa2ad, 0 8px 22px rgba(0, 0, 0, .08);
}

/* #1342 variant 2 (list): one story per row like the /news/ list —
   176x110 thumbnail left, text right — in the story column's width (760px),
   so the cards line up with the article above. Delete this block for
   variant 1 (three cards across). */
body.st-on .st-related { max-width: 760px; }
body.st-on.st-rel-cards .st-related-items {
	grid-template-columns: 1fr;
	gap: 12px;
}
body.st-on .st-related-link {
	display: flex;
	align-items: center;
	gap: 30px;
}
body.st-on .st-related-media {
	flex: 0 0 176px;
	height: 110px;
	aspect-ratio: auto;
	margin-bottom: 0;
}
body.st-on .st-related-text { flex: 1 1 auto; min-width: 0; }
@media (max-width: 575px) {
	body.st-on .st-related-link { flex-direction: column; align-items: stretch; gap: 14px; }
	body.st-on .st-related-media { flex: none; height: auto; aspect-ratio: 16 / 10; }
}

/* Desktop only: the row's columns sit on the container's 15px padding, so a
   block dropped straight into the container lands 15px right of the paper's
   left edge. On phones the same pull would take the related row to the
   viewport edge, where the headline under it starts at x=0. */
@media (min-width: 992px) {
	body.st-on .st-related { margin-left: -15px; margin-right: -15px; }
}

@media (max-width: 991px) {
	body.st-on .st-related-items { grid-template-columns: 1fr !important; gap: 20px; }
	body.st-on .st-related-item.is-lead { grid-row: auto !important; }
	/* The rail card above already ends with a 40px gap (#1346); the full
	   56px on top of it left ~100px of blank on phones. */
	body.st-on .st-related { margin-top: 16px; }
}

/* ── 8. The switcher window ─────────────────────────────────────────── */

/* Wide tables in a story (audit 2026-10-11): the card's padding leaves a
   ~345px measure on phones, and a town-list table at its 401px minimum
   pushed the page sideways. Let the table scroll inside the article. */
@media only screen and (max-width: 767px) {
	body.st-on .single-content table {
		display: block;
		max-width: 100%;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
	}
}

/* Tablet (768-991px): this theme's grid puts col-md-9/col-md-3 side by
   side from 768, leaving a ~180px rail beside a 540px article — the
   "This story" card, chips and category list crammed into it and ran far
   past the article (audit 2026-10-11). Stack the rail under the article,
   as phones already do. Kalman 2026-10-11: "under, yes". */
@media only screen and (min-width: 768px) and (max-width: 991px) {
	body.st-on .container > .row > .single-content,
	body.st-on .container > .row:has(> .single-content) > [class*="col-md-3"] {
		flex: 0 0 100%;
		max-width: 100%;
	}
}
