/* Public surface: landing page, blog index, article page, error pages.
 *
 * Built from the application's existing vocabulary — .dash-card shells,
 * .symbol-bubble chip behaviour, .empty-state, Bootstrap buttons, and the
 * tokens declared in app.css. No new colour is introduced beyond the
 * code-highlighting palette in pygments.css, which renders on a dark surface
 * in both themes because code is always presented dark.
 */

/* ---------- skip link ---------------------------------------------------- */

.skip-link {
	position: absolute;
	left: -9999px;
	top: 0;
	z-index: 2000;
	padding: .6rem 1rem;
	background: var(--bs-card-bg);
	color: var(--bs-body-color);
	border: 1px solid var(--accent);
	border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus {
	left: 0;
	box-shadow: var(--focus-ring);
}

/* ---------- public chrome ------------------------------------------------ */

.public-nav .nav-link.active {
	color: var(--accent-2) !important;
}
.public-footer {
	background-color: var(--bs-body-bg);
}
.footer-heading {
	font-size: .75rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--bs-secondary-color);
	margin-bottom: .75rem;
}
.public-footer a {
	transition: opacity var(--dur-slow) var(--ease);
}
.public-footer a:hover {
	opacity: .7;
}

.social-link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	/* 44px touch target, per the accessibility pass. */
	width: 44px;
	height: 44px;
	border-radius: var(--radius-md);
	border: 1px solid var(--bs-border-color);
	color: inherit;
	transition: border-color var(--dur-base) var(--ease), color var(--dur-base) var(--ease);
}
.social-link:hover {
	border-color: var(--accent);
	color: var(--accent-2);
}

/* ---------- blog shell --------------------------------------------------- */

.blog-container {
	max-width: 1180px;
}
.blog-breadcrumb ol {
	color: var(--bs-secondary-color);
}
.blog-breadcrumb a:hover {
	color: var(--accent-2);
}
.blog-title {
	font-size: clamp(2rem, 4vw, 2.75rem);
	line-height: 1.1;
	letter-spacing: -.02em;
}
.blog-standfirst {
	max-width: 62ch;
	line-height: 1.5;
}

.category-tag {
	text-decoration: none;
}
.category-tag-count {
	opacity: .6;
	font-variant-numeric: tabular-nums;
}

/* ---------- article cards ------------------------------------------------ */

.article-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 1.25rem;
}
@media (min-width: 768px) {
	.article-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
	.article-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}

.article-card {
	position: relative;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}
.article-card:hover {
	box-shadow: var(--shadow-lift);
	transform: translateY(-2px);
}
[data-bs-theme="dark"] .article-card:hover {
	box-shadow: var(--shadow-lift-dark);
}
.article-card:focus-within {
	box-shadow: var(--focus-ring);
}
.article-card-visual {
	line-height: 0;
	border-bottom: 1px solid var(--bs-border-color);
}
.article-card-visual img,
.article-card-visual svg {
	width: 100%;
	height: auto;
	display: block;
	aspect-ratio: 18 / 7;
	object-fit: cover;
}
.article-card-body {
	display: flex;
	flex-direction: column;
	gap: .5rem;
	flex: 1 1 auto;
}
.article-card-title {
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.3;
	margin: 0;
}
.article-card-standfirst {
	margin: 0;
	flex: 1 1 auto;
}
.article-card-foot {
	margin-top: auto;
}
.article-card-flag {
	color: var(--accent-2);
}

.article-card--featured .article-card-title {
	font-size: clamp(1.35rem, 2.6vw, 1.85rem);
}
@media (min-width: 992px) {
	.article-card--featured {
		display: grid;
		grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr);
		align-items: stretch;
	}
	.article-card--featured .article-card-visual {
		border-bottom: 0;
		border-right: 1px solid var(--bs-border-color);
		height: 100%;
	}
	.article-card--featured .article-card-visual svg,
	.article-card--featured .article-card-visual img {
		height: 100%;
		aspect-ratio: auto;
	}
	.article-card--featured .article-card-body {
		padding: 2rem;
		justify-content: center;
	}
}

.author-avatar {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: rgba(var(--accent-rgb), .18);
	color: var(--accent-2);
	font-weight: 600;
	font-size: .8rem;
	letter-spacing: .04em;
	flex: 0 0 auto;
}

.follow-module-title {
	font-size: 1rem;
	font-weight: 600;
	margin-bottom: .25rem;
}
.blog-closing-cta {
	border-style: dashed;
}

/* ---------- article layout ----------------------------------------------- */

.article-layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 2.5rem;
}
@media (min-width: 992px) {
	.article-layout {
		grid-template-columns: minmax(0, 720px) 240px;
		justify-content: center;
		align-items: start;
	}
}

.article-title {
	font-size: clamp(1.9rem, 4.2vw, 2.6rem);
	line-height: 1.1;
	letter-spacing: -.02em;
}
.article-standfirst {
	font-size: 1.125rem;
	line-height: 1.5;
	max-width: 62ch;
}
.article-hero img,
.article-hero svg {
	width: 100%;
	height: auto;
	border-radius: var(--radius-lg);
	border: 1px solid var(--bs-border-color);
	display: block;
}
.article-hero-caption {
	margin-top: .5rem;
}

.article-prose {
	font-size: 1.0625rem;
	line-height: 1.7;
	max-width: 68ch;
}
.article-prose h2 {
	font-size: 1.5rem;
	font-weight: 650;
	margin-top: 2.5rem;
	margin-bottom: .75rem;
	scroll-margin-top: 5rem;
}
.article-prose h3 {
	font-size: 1.2rem;
	font-weight: 600;
	margin-top: 2rem;
	margin-bottom: .5rem;
	scroll-margin-top: 5rem;
}
.article-prose p,
.article-prose ul,
.article-prose ol {
	margin-bottom: 1.15rem;
}
.article-prose a {
	color: var(--accent-2);
	text-underline-offset: .18em;
}
.article-prose blockquote {
	border-left: 3px solid var(--accent);
	padding-left: 1rem;
	margin: 1.75rem 0;
	font-size: 1.15rem;
	line-height: 1.45;
	color: var(--bs-body-color);
}
.article-prose table,
.concept-table {
	width: 100%;
	border-collapse: collapse;
	margin-bottom: 1.5rem;
	font-size: .95rem;
}
.article-prose th,
.article-prose td {
	border: 1px solid var(--bs-border-color);
	padding: .55rem .75rem;
	text-align: left;
}
.article-prose th {
	background: rgba(var(--accent-rgb), .08);
	font-weight: 600;
}
.article-prose img {
	max-width: 100%;
	height: auto;
	border-radius: var(--radius-md);
}

/* ---------- code blocks -------------------------------------------------- */

.code-block {
	margin: 1.75rem 0;
	border: 1px solid var(--bs-border-color);
	border-radius: var(--radius-lg);
	overflow: hidden;
	/* Code is always dark, in both themes. */
	background: #16161c;
}
.code-block-head {
	display: flex;
	align-items: center;
	gap: .75rem;
	padding: .5rem .75rem;
	border-bottom: 1px solid rgba(255,255,255,.08);
	font-size: .8rem;
	color: rgba(255,255,255,.72);
}
.code-block-name {
	font-weight: 600;
}
.code-block-lang {
	margin-left: auto;
	text-transform: uppercase;
	letter-spacing: .06em;
	font-size: .7rem;
	opacity: .7;
}
.code-block-copy {
	min-height: 44px;
	min-width: 44px;
}
.code-block-body {
	overflow-x: auto;
}
.code-block-body:focus-visible {
	box-shadow: inset var(--focus-ring);
}
.code-block pre {
	margin: 0;
	padding: 1rem;
	font-size: .875rem;
	line-height: 1.55;
}

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

.callout {
	border: 1px solid var(--bs-border-color);
	border-left-width: 3px;
	border-radius: var(--radius-md);
	padding: 1rem 1.25rem;
	margin: 1.75rem 0;
	background: var(--bs-card-bg);
}
.callout-label {
	display: flex;
	align-items: center;
	gap: .4rem;
	font-size: .72rem;
	font-weight: 600;
	letter-spacing: .08em;
	text-transform: uppercase;
	margin-bottom: .4rem;
	color: var(--bs-secondary-color);
}
.callout-title {
	font-weight: 600;
	margin-bottom: .35rem;
}
.callout-body > :last-child {
	margin-bottom: 0;
}
.callout--idea { border-left-color: var(--accent); }
.callout--mistake { border-left-color: var(--negative); }
.callout--try { border-left-color: var(--positive); }

/* ---------- contents rail ------------------------------------------------ */

.toc--rail {
	position: sticky;
	top: 2rem;
	max-height: calc(100vh - 4rem);
	overflow-y: auto;
	font-size: .875rem;
}
.toc-heading {
	margin-bottom: .5rem;
}
.toc a {
	display: block;
	padding: .25rem 0 .25rem .6rem;
	border-left: 2px solid var(--bs-border-color);
	color: var(--bs-secondary-color);
	text-decoration: none;
	line-height: 1.35;
}
.toc a:hover,
.toc a.active {
	color: var(--accent-2);
	border-left-color: var(--accent);
}
.toc .toc-level-3 a {
	padding-left: 1.35rem;
	font-size: .82rem;
}
.toc--inline summary {
	cursor: pointer;
	font-weight: 600;
	padding: .5rem 0;
}

/* ---------- article furniture -------------------------------------------- */

.article-progress {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	height: 2px;
	z-index: 1030;
	pointer-events: none;
}
.article-progress span {
	display: block;
	height: 100%;
	background: var(--accent);
	transform: scaleX(0);
	transform-origin: 0 50%;
}

.article-references h2 {
	font-size: 1.15rem;
	font-weight: 600;
}
.article-disclaimer {
	border: 1px solid var(--bs-border-color);
	border-radius: var(--radius-md);
	padding: 1rem 1.25rem;
	color: var(--bs-secondary-color);
	background: rgba(var(--accent-rgb), .04);
}

.adjacent-link {
	display: flex;
	flex-direction: column;
	gap: .15rem;
	max-width: 22rem;
	text-decoration: none;
	color: inherit;
	padding: .75rem 1rem;
	border: 1px solid var(--bs-border-color);
	border-radius: var(--radius-md);
	transition: border-color var(--dur-base) var(--ease);
}
.adjacent-link:hover {
	border-color: var(--accent);
}

/* ---------- landing additions -------------------------------------------- */

.hero-eyebrow {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	padding: .3rem .75rem;
	border-radius: var(--radius-pill);
	border: 1px solid var(--bs-border-color);
	background: rgba(var(--accent-rgb), .08);
	font-size: .8rem;
	color: var(--bs-secondary-color);
}
.hero-cluster {
	display: grid;
	gap: 1rem;
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 992px) {
	.hero-cluster { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); }
	.hero-cluster .hero-code { grid-row: span 2; }
}
.hero-caption {
	margin-top: .75rem;
}
.step-list {
	counter-reset: step;
	display: grid;
	gap: 1.25rem;
	grid-template-columns: minmax(0, 1fr);
}
@media (min-width: 768px) {
	.step-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 1200px) {
	.step-list { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
.step-number {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 2rem;
	height: 2rem;
	border-radius: 50%;
	background: rgba(var(--accent-rgb), .16);
	color: var(--accent-2);
	font-weight: 700;
	margin-bottom: .75rem;
}
/* One layout system, not two. An earlier version put `display: grid` on a
   Bootstrap `.row` and left `.col` on the children; the two collapsed into
   each other and the last card rendered one word wide. */
.feature-grid {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 1.25rem;
}
@media (min-width: 768px) {
	.feature-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (min-width: 992px) {
	.feature-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
	/* Tiered rather than six identical cards: the card carrying the
	   proposition spans two columns. All six topics are preserved. */
	.feature-card--lead { grid-column: span 2; }
}
.feature-grid > * {
	min-width: 0;
}
.feature-grid .dash-card {
	height: 100%;
}

/* ---------- motion ------------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	.article-card,
	.article-card:hover,
	.adjacent-link,
	.social-link,
	.public-footer a {
		transition: none;
		transform: none;
	}
	.article-progress { display: none; }
}

/* ---------- print -------------------------------------------------------- */

@media print {
	.public-nav,
	.public-footer,
	.toc,
	.article-progress,
	.article-related,
	.article-adjacent,
	.blog-closing-cta,
	.follow-module,
	.skip-link,
	.code-block-copy,
	#cookieBanner {
		display: none !important;
	}
	.article-layout { display: block; }
	.article-prose { max-width: none; font-size: 11pt; }
	.code-block { background: #fff; border-color: #999; }
	.code-block pre, .code-block code { color: #000 !important; }
	.article-prose a::after { content: " (" attr(href) ")"; font-size: 9pt; }
}
