/* ============================================================
   STL Expanding Cards
   A row of image cards; one expanded (image + title + description +
   Learn more) at a time, the rest collapsed to a vertical-title strip.
   Learn more opens a shared popup, cloned from a per-card <template>,
   styled the same way as a research-portfolio stream card.
   ============================================================ */

.stl-block--expcards__inner {
	width: 100%;
	padding: 0 var(--stl-gutter);
}
/* Escapes a page-editor column/row's own left/right padding, same
 * full-bleed technique and same !important as .stl-block--cases--full-bleed
 * (stl-blocks.css) — needed there because a base `.stl-block{width:100%}`
 * rule of equal specificity was otherwise winning on the live site,
 * apparently due to a CSS-combining/optimisation plugin reordering rules. */
.stl-block--expcards--full-bleed {
	width: 100vw !important;
	margin-left: calc(50% - 50vw) !important;
	margin-right: calc(50% - 50vw) !important;
}
.stl-block--expcards__header {
	margin-bottom: var(--stl-space-6);
}
/* .stl-section-heading / .stl-section-intro are shared classes used by
 * several blocks (stl-tokens.css) — scoped here under .stl-block--expcards
 * (0,2,0) so the size override only ever applies inside this block and
 * beats the shared rule's own specificity (0,1,0), rather than editing
 * the shared rule itself. */
.stl-block--expcards .stl-section-heading {
	font-size: var(--stl-expc-heading-fs, clamp(28px, 3.2vw, 40px));
}
.stl-block--expcards .stl-section-intro {
	font-size: var(--stl-expc-subtitle-fs, var(--stl-fs-16));
	/* The shared rule caps this at 640px, which reads as needlessly
	 * narrow above a full-width card row — let it use the full row width
	 * instead (matches the subtitle fix already applied to Transaction
	 * Stack and Pillar Cards for the same reason). */
	max-width: none;
}

/* ------------------------------------------------------------
   CARD ROW
   ------------------------------------------------------------ */
.stl-expcards {
	display: flex;
	gap: 6px;
	height: 420px;
	/* With enough cards, the row can demand more width than the section
	 * has — scroll instead of letting flex-shrink crush the active card
	 * (its min-width below keeps it from ever losing its "featured pane"
	 * proportions, the way flex-basis alone couldn't). */
	overflow-x: auto;
}
.stl-expcard {
	position: relative;
	flex: 0 0 90px;
	min-width: 90px;
	border-radius: var(--stl-radius-md);
	overflow: hidden;
	transition: flex-grow var(--stl-dur-base) var(--stl-ease),
	            flex-basis var(--stl-dur-base) var(--stl-ease);
	box-shadow: var(--stl-shadow-xs);
}
.stl-expcard.is-active {
	flex: 1 1 320px;
	min-width: 320px;
}

.stl-expcard__surface {
	display: block;
	width: 100%;
	height: 100%;
	position: relative;
	border: 0;
	margin: 0;
	padding: 0;
	background: var(--stl-burgundy-deep);
	cursor: pointer;
	text-align: left;
	font: inherit;
	color: inherit;
}
.stl-expcard.is-active .stl-expcard__surface {
	cursor: default;
}

.stl-expcard__image {
	position: absolute;
	inset: 0;
	background-size: cover;
	background-position: center;
	transition: transform 900ms var(--stl-ease);
}
@media (hover: hover) and (pointer: fine) {
	.stl-expcard:not(.is-active):hover .stl-expcard__image {
		transform: scale(1.05);
	}
}
.stl-expcard__scrim {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(30, 8, 18, 0) 45%, var(--stl-burgundy-deep) 100%);
}

/* Collapsed-state vertical title, reads bottom-to-top like the card's
 * own spine. Fades out (not display:none) so the expand transition
 * doesn't jump. */
.stl-expcard__label {
	position: absolute;
	left: 0;
	right: 0;
	bottom: var(--stl-space-5);
	display: flex;
	justify-content: center;
	writing-mode: vertical-rl;
	transform: rotate(180deg);
	font-family: var(--stl-font-heading);
	font-weight: 700;
	font-size: var(--stl-fs-16);
	letter-spacing: 0.02em;
	color: #fff;
	text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
	white-space: nowrap;
	max-height: calc(100% - var(--stl-space-6));
	overflow: hidden;
	opacity: 1;
	transition: opacity var(--stl-dur-fast) var(--stl-ease);
	pointer-events: none;
}
.stl-expcard.is-active .stl-expcard__label {
	opacity: 0;
}

/* Expanded-state content: icon + title/description, bottom-left. */
.stl-expcard__panel {
	position: absolute;
	left: var(--stl-space-6);
	right: var(--stl-space-6);
	/* The "Learn more" button is a separate absolutely-positioned sibling
	 * (see .stl-expcard__cta-wrap below — it can't live inside this panel
	 * since the panel sits inside a <button>, which can't contain another
	 * interactive element). Reserving a fixed-height band for it here,
	 * rather than sharing the same bottom offset, means a long
	 * description/bullet list simply grows upward instead of running
	 * underneath the button — the two can never occupy the same row
	 * regardless of how much text there is. */
	bottom: calc(var(--stl-space-6) + 70px);
	display: flex;
	align-items: flex-end;
	gap: var(--stl-space-4);
	opacity: 0;
	transform: translateY(8px);
	transition: opacity var(--stl-dur-base) var(--stl-ease),
	            transform var(--stl-dur-base) var(--stl-ease);
	pointer-events: none;
}
.stl-expcard.is-active .stl-expcard__panel {
	opacity: 1;
	transform: translateY(0);
	transition-delay: 150ms;
}
.stl-expcard__icon {
	flex-shrink: 0;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.14);
	border: 1.5px solid rgba(255, 255, 255, 0.55);
	display: flex;
	align-items: center;
	justify-content: center;
}
.stl-expcard__icon img {
	width: 26px;
	height: 26px;
	object-fit: contain;
	filter: brightness(0) invert(1);
}
.stl-expcard__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}
.stl-expcard__title {
	font-family: var(--stl-font-heading);
	font-size: var(--stl-expc-card-title-fs, var(--stl-fs-24));
	font-weight: 700;
	line-height: var(--stl-lh-tight);
	color: #fff;
}
.stl-expcard__desc {
	font-family: var(--stl-font-body);
	font-size: var(--stl-expc-card-desc-fs, var(--stl-fs-14));
	line-height: var(--stl-lh-normal);
	color: rgba(255, 255, 255, 0.85);
	max-width: 46ch;
}
.stl-expcard__bullets {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
	max-width: 46ch;
}
/* Bullet as a real flex sibling, not an absolutely-positioned
 * pseudo-element, so its left edge sits flush with the title above it
 * with no offset math to keep in sync. */
.stl-expcard__bullets li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-family: var(--stl-font-body);
	font-size: var(--stl-expc-card-desc-fs, var(--stl-fs-14));
	line-height: var(--stl-lh-normal);
	color: rgba(255, 255, 255, 0.85);
}
/* !important: stl-tokens.css carries a global
 * `.stl-block li::before, li::after { display:none !important; content:none !important; }`
 * reset (strips the theme's own decorative list bullets elsewhere) that
 * otherwise wins over this rule and silently hides the dot. */
.stl-expcard__bullets li::before {
	content: "" !important;
	display: block !important;
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	margin-top: 0.55em;
	border-radius: 50%;
	background: var(--stl-orange);
}

/* "Learn more" — a separate element layered over the card (not nested
 * inside the <button>, since a button can't contain interactive
 * descendants), positioned bottom-right, only interactive/visible once
 * its card is expanded. */
.stl-expcard__cta-wrap {
	position: absolute;
	right: var(--stl-space-6);
	bottom: var(--stl-space-6);
	z-index: 2;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity var(--stl-dur-base) var(--stl-ease),
	            transform var(--stl-dur-base) var(--stl-ease);
	pointer-events: none;
}
.stl-expcard.is-active .stl-expcard__cta-wrap {
	opacity: 1;
	transform: translateY(0);
	transition-delay: 150ms;
	pointer-events: auto;
}
.stl-expcard__cta {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 13px 22px;
	border-radius: var(--stl-radius-pill);
	border: 1.5px solid var(--stl-orange);
	font-family: var(--stl-font-heading);
	font-size: var(--stl-fs-12);
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #fff;
	background: var(--stl-orange);
	cursor: pointer;
	transition: background var(--stl-dur-fast) var(--stl-ease),
	            border-color var(--stl-dur-fast) var(--stl-ease),
	            gap var(--stl-dur-fast) var(--stl-ease);
}
.stl-expcard__cta:hover,
.stl-expcard__cta:focus-visible {
	background: var(--stl-red);
	border-color: var(--stl-red);
	gap: 14px;
}
.stl-expcard__cta svg {
	flex-shrink: 0;
	stroke: currentColor;
}

@media (max-width: 760px) {
	.stl-expcards {
		flex-direction: column;
		height: auto;
	}
	.stl-expcard {
		flex: 0 0 64px;
	}
	.stl-expcard.is-active {
		flex: 0 0 380px;
	}
	.stl-expcard__label {
		writing-mode: horizontal-tb;
		transform: none;
		bottom: 0;
		top: 0;
		align-items: center;
		max-height: none;
	}
	.stl-expcard__panel {
		flex-direction: column;
		align-items: flex-start;
	}
}

/* ------------------------------------------------------------
   POPUP (opened from a card's "Learn more")
   ------------------------------------------------------------ */
.stl-expcard-modal-overlay {
	position: fixed;
	inset: 0;
	z-index: 1000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: var(--stl-space-5);
	background: rgba(26, 32, 64, 0.6);
}
.stl-expcard-modal-overlay[hidden] {
	display: none;
}

/* The frame sizes/positions the popup and holds the close button; the
 * actual scrolling happens one level in (.stl-expcard-modal), so the
 * close button can hang slightly outside that box's edge without being
 * clipped by its overflow-y: auto. */
.stl-expcard-modal-frame {
	position: relative;
	width: 100%;
	max-width: 560px;
}
.stl-expcard-modal {
	width: 100%;
	max-height: 85vh;
	overflow-y: auto;
	border-radius: var(--stl-radius-md);
	box-shadow: var(--stl-shadow-xl);
}
.stl-expcard-modal__close {
	position: absolute;
	top: -14px;
	right: -14px;
	z-index: 2;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	border: 0;
	background: var(--stl-orange);
	box-shadow: var(--stl-shadow-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transition: background var(--stl-dur-fast) var(--stl-ease);
}
.stl-expcard-modal__close span {
	color: #fff;
	font-size: 18px;
	line-height: 1;
}
.stl-expcard-modal__close:hover {
	background: var(--stl-red);
}

.stl-expcard-modal__logo {
	width: 64px;
	height: 64px;
	margin-bottom: var(--stl-space-4);
}
.stl-expcard-modal__logo img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}
.stl-expcard-modal__title {
	font-family: var(--stl-font-heading);
	font-size: var(--stl-fs-24);
	font-weight: 700;
	line-height: var(--stl-lh-tight);
	color: var(--stlx-text);
	margin: 0 0 var(--stl-space-2);
}
.stl-expcard-modal__subtitle {
	font-family: var(--stl-font-body);
	font-size: var(--stl-fs-16);
	line-height: var(--stl-lh-normal);
	color: var(--stlx-subtext);
	margin: 0 0 var(--stl-space-5);
}
.stl-expcard-modal__bullets {
	list-style: none;
	/* !important: stl-tokens.css carries `.stl-block ul { margin:0; ... }`,
	 * which beats this rule on specificity (class+element > class alone)
	 * even without !important on its side, silently zeroing this margin. */
	margin: 0 0 var(--stl-space-6) !important;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
/* Bullet as a real flex sibling, not an absolutely-positioned
 * pseudo-element, so its left edge sits flush with the title above it
 * with no offset math to keep in sync. */
.stl-expcard-modal__bullets li {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-family: var(--stl-font-body);
	font-size: var(--stl-fs-16);
	line-height: var(--stl-lh-normal);
	color: var(--stlx-subtext);
}
/* !important: stl-tokens.css carries a global
 * `.stl-block li::before, li::after { display:none !important; content:none !important; }`
 * reset (strips the theme's own decorative list bullets elsewhere) that
 * otherwise wins over this rule and silently hides the dot. */
.stl-expcard-modal__bullets li::before {
	content: "" !important;
	display: block !important;
	flex: 0 0 auto;
	width: 6px;
	height: 6px;
	margin-top: 0.6em;
	border-radius: 50%;
	background: var(--stlx-bullet);
}
.stl-expcard-modal__pubs {
	display: flex;
	flex-direction: column;
	gap: var(--stl-space-2);
	margin-bottom: var(--stl-space-5);
}
.stl-expcard-modal__pill {
	position: relative;
	display: block;
	font-family: var(--stl-font-body);
	font-size: var(--stl-fs-14);
	line-height: var(--stl-lh-normal);
	border-radius: var(--stl-radius-sm);
	padding: var(--stl-space-2) var(--stl-space-4);
	text-decoration: none !important;
	transition: transform var(--stl-dur-fast) var(--stl-ease);
}
a.stl-expcard-modal__pill:hover {
	transform: translateX(4px);
}
.stl-expcard-modal__pill--red    { background: var(--stl-red-tint-5);              color: var(--stl-navy); }
.stl-expcard-modal__pill--orange { background: var(--stl-orange-tint-5);           color: var(--stl-navy); }
.stl-expcard-modal__pill--navy   { background: var(--stl-grey-300);                color: var(--stl-navy); }
.stl-expcard-modal__pill--blue   { background: rgba(255, 255, 255, 0.16);          color: #fff; }
.stl-expcard-modal__badge-new {
	position: absolute;
	top: -8px;
	right: -6px;
	background: var(--stl-red);
	color: var(--stl-white);
	font-family: var(--stl-font-heading);
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	line-height: 1;
	padding: 3px 6px;
	border-radius: var(--stl-radius-sm);
}
.stl-expcard-modal__link-cta {
	display: inline-flex !important;
	align-items: center;
	gap: 10px;
	font-family: var(--stl-font-heading);
	font-size: var(--stl-fs-12);
	font-weight: 700;
	letter-spacing: var(--stl-tracking-caps);
	text-transform: uppercase;
	color: var(--stlx-link) !important;
	text-decoration: none !important;
	border-top: 0 !important;
	border-left: 0 !important;
	border-right: 0 !important;
	border-bottom: 1.5px solid var(--stlx-link) !important;
	padding-bottom: 4px;
	background: none !important;
	transition: color var(--stl-dur-fast) var(--stl-ease),
	            border-color var(--stl-dur-fast) var(--stl-ease),
	            gap var(--stl-dur-fast) var(--stl-ease);
}
.stl-expcard-modal__link-cta:hover {
	color: var(--stlx-link-hover) !important;
	border-bottom-color: var(--stlx-link-hover) !important;
	gap: 14px;
}
.stl-expcard-modal__link-cta svg {
	flex-shrink: 0;
	stroke: currentColor;
}

/* Colour scheme — the whole popup fills with the chosen tint (matching
 * how a research-portfolio stream card fills with its category colour,
 * plus a Blue scheme matching the "25+ publications per year" panel),
 * with a handful of custom properties so title/subtitle/bullets/CTA all
 * adapt their own colour to stay legible against it. */
.stl-expcard-modal__content {
	--stlx-text: var(--stl-navy);
	--stlx-subtext: var(--stl-grey-500);
	--stlx-link: var(--stl-burgundy);
	--stlx-link-hover: var(--stl-orange);
	--stlx-bullet: var(--stl-orange);
	background: var(--stlx-bg, var(--stl-red-tint-4));
	color: var(--stlx-text);
	padding: var(--stl-space-7) var(--stl-space-6) var(--stl-space-6);
	border-radius: var(--stl-radius-md);
}
.stl-expcard-modal__content--red    { --stlx-bg: var(--stl-red-tint-4); }
.stl-expcard-modal__content--orange { --stlx-bg: var(--stl-orange-tint-4); }
.stl-expcard-modal__content--navy   { --stlx-bg: var(--stl-grey-100); }
.stl-expcard-modal__content--blue {
	--stlx-bg: var(--stl-navy-tint-1);
	--stlx-text: #fff;
	--stlx-subtext: rgba(255, 255, 255, 0.85);
	--stlx-link: #fff;
	--stlx-link-hover: rgba(255, 255, 255, 0.7);
	--stlx-bullet: #fff;
}
/* Dark-line icons need inverting to read on the dark Blue scheme. */
.stl-expcard-modal__content--blue .stl-expcard-modal__logo img {
	filter: brightness(0) invert(1);
}
