/* ============================================================
   STL Transaction Stack
   Purely editorial block (no live query) — a stacked, layered
   reference diagram. Everything scoped under .stl-block--stack so
   nothing leaks into other blocks.
   ============================================================ */

.stl-block--stack__inner {
	--stl-stack-namecol: 230px;
	--stl-stack-detailcols: 1fr 1fr 1.4fr;
	width: 100%;
	padding: 0 var(--stl-gutter);
}

.stl-block--stack__header {
	margin-bottom: var(--stl-space-7);
}
/* Matches the article-body h2 style used elsewhere on the site (e.g.
 * "Power and land are now the binding constraints…") — same size,
 * weight, letter-spacing, line-height, and bottom margin. */
.stl-block--stack__title {
	font-family: var(--stl-font-heading);
	font-size: var(--stl-fs-32);
	font-weight: 700;
	letter-spacing: 0.8px;
	line-height: 1.35;
	color: var(--stl-navy);
	margin: 0 0 26px;
}
.stl-block--stack__subtitle {
	font-family: var(--stl-font-body);
	font-size: var(--stl-fs-16);
	line-height: var(--stl-lh-normal);
	color: var(--stl-grey-500);
	margin: 0;
	/* No max-width: this wrapped onto an extra line well before reaching
	 * the edge of the (now much wider) chart below it — let it use the
	 * same full width as the layers instead of a leftover narrow-column
	 * cap from an earlier version of this block. */
}

.stl-block--stack__scroll {
	max-height: 74vh;
	overflow-y: auto;
	border: 1px solid var(--stl-hairline);
	border-radius: 4px;
	background: var(--stl-off-white, #F6F7F8);
}

/* Column headings live once, here, instead of repeated in every layer's
 * detail columns — and stay visible while the layers scroll underneath. */
.stl-block--stack__header-row {
	display: grid;
	grid-template-columns: var(--stl-stack-namecol) 1fr;
	position: sticky;
	top: 0;
	z-index: 5;
	background: var(--stl-off-white, #F6F7F8);
	border-bottom: 2px solid var(--stl-navy);
}
.stl-block--stack__name-spacer {
	display: flex;
	align-items: center;
	padding: var(--stl-space-4) var(--stl-space-6);
	font-family: var(--stl-font-heading);
	font-weight: 700;
	font-size: 11px;
	letter-spacing: var(--stl-tracking-caps);
	text-transform: uppercase;
	color: var(--stl-grey-500);
}
.stl-block--stack__labels {
	display: grid;
	grid-template-columns: var(--stl-stack-detailcols);
	gap: var(--stl-space-5);
	padding: var(--stl-space-4) var(--stl-space-5);
}
.stl-block--stack__labels span {
	font-family: var(--stl-font-heading);
	font-weight: 700;
	font-size: 12px;
	letter-spacing: 0.02em;
	color: var(--stl-grey-500);
}

.stl-block--stack__layers {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 4px;
}

.stl-block--stack__connector {
	width: 2px;
	height: 14px;
	background: var(--stl-grey-300);
	margin-left: var(--stl-space-6);
}

.stl-block--stack__layer {
	display: grid;
	grid-template-columns: var(--stl-stack-namecol) 1fr;
	border-radius: 2px;
	overflow: hidden;
	box-shadow: var(--stl-shadow-xs);
	transition: transform var(--stl-dur-fast) var(--stl-ease);
}
/* Same row-hover movement as the case-study block's compact rows
 * (.stl-card--compact:hover), guarded to real-hover devices so it
 * doesn't get "stuck" mid-shift on touch. */
@media (hover: hover) and (pointer: fine) {
	.stl-block--stack__layer:hover {
		transform: translateX(4px);
	}
}

.stl-block--stack__name-col {
	display: flex;
	align-items: center;
	gap: var(--stl-space-3);
	padding: var(--stl-space-5) var(--stl-space-6);
	position: relative;
	background: var(--stl-stack-bg, var(--stl-navy));
	color: var(--stl-stack-text, #fff);
}
.stl-block--stack__icon {
	width: 26px;
	height: 26px;
	flex-shrink: 0;
	/* Always white, regardless of the layer's own text colour (navy on
	 * light-background layers) — the icon reads as a fixed decorative mark,
	 * not body text. */
	color: #fff;
	stroke: currentColor;
	fill: none;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.stl-block--stack__quarter {
	position: absolute;
	right: -14px;
	top: -14px;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: conic-gradient(from 180deg, rgba(255, 255, 255, 0.18) 0deg 90deg, transparent 90deg);
}
.stl-block--stack__layer-index {
	display: block;
	font-family: var(--stl-font-heading);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: var(--stl-tracking-caps);
	text-transform: uppercase;
	opacity: 0.75;
	margin-bottom: 4px;
	color: inherit;
}
.stl-block--stack__layer-title {
	font-family: var(--stl-font-heading);
	font-size: var(--stl-fs-18);
	font-weight: 700;
	letter-spacing: 0.01em;
	margin: 0;
	color: inherit;
}

.stl-block--stack__detail-col {
	background: var(--stl-white);
	padding: var(--stl-space-4) var(--stl-space-5);
	display: grid;
	grid-template-columns: var(--stl-stack-detailcols);
	gap: var(--stl-space-5);
}
.stl-block--stack__field-value {
	font-family: var(--stl-font-body);
	font-size: var(--stl-fs-16);
	line-height: var(--stl-lh-normal);
	color: var(--stl-navy);
}

/* ------------------------------------------------------------
   LEGEND / KEY
   ------------------------------------------------------------ */
.stl-block--stack__key {
	display: flex;
	gap: var(--stl-space-6);
	flex-wrap: wrap;
	margin: var(--stl-space-7) 0 0;
	padding: var(--stl-space-4) var(--stl-space-5);
	background: var(--stl-white);
	border: 1px solid var(--stl-hairline);
	border-radius: 4px;
}
.stl-block--stack__key-item {
	display: flex;
	align-items: center;
	gap: var(--stl-space-2);
	font-family: var(--stl-font-body);
	/* Matches .stl-block--stack__field-value (the graph's own detail
	 * text), not a separate smaller size. */
	font-size: var(--stl-fs-16);
	color: var(--stl-grey-500);
}
.stl-block--stack__key-swatch {
	width: 14px;
	height: 14px;
	border-radius: 3px;
	flex-shrink: 0;
	display: block;
}

.stl-block--stack__footnote {
	font-family: var(--stl-font-body);
	/* Matches .stl-block--stack__field-value and the legend text — same
	 * 16px as the rest of the graph, not a separate smaller size. */
	font-size: var(--stl-fs-16);
	line-height: var(--stl-lh-normal);
	color: var(--stl-grey-500);
	/* No max-width: 900px was leaving one trailing word to wrap onto its
	 * own line — let it use the same full width as the layers instead. */
	margin: var(--stl-space-5) 0 0;
}

@media (max-width: 760px) {
	.stl-block--stack__inner {
		--stl-stack-namecol: 120px;
		--stl-stack-detailcols: 1fr 1fr 1fr;
	}
	.stl-block--stack__layer {
		grid-template-columns: 1fr;
	}
	.stl-block--stack__detail-col {
		grid-template-columns: 1fr;
	}
	.stl-block--stack__header-row {
		grid-template-columns: var(--stl-stack-namecol) 1fr;
	}
	.stl-block--stack__name-spacer {
		padding: var(--stl-space-4) var(--stl-space-3);
		font-size: 9.5px;
	}
	.stl-block--stack__labels {
		padding: var(--stl-space-4) var(--stl-space-4);
		gap: var(--stl-space-3);
	}
	.stl-block--stack__labels span {
		font-size: 9.5px;
	}
}
