/* =============================================================
   Topic Encyclopedia — /topics/ and /topics/<slug>/
   Namespace: .igc-tpx-*
   Design tokens from main.css; gold accent (#f5c842) sectionally.
   ============================================================= */

.igc-tpx-hero,
.igc-tpx-pillnav,
.igc-tpx-snapshot,
.igc-tpx-side,
.igc-tpx-trend,
.igc-tpx-div,
.igc-tpx-watch,
.igc-tpx-faq,
.igc-tpx-related,
.igc-tpx-sources,
.igc-tpx-hub,
.igc-tpx-foot,
.igc-tpx-missing {
	--tpx-gold: #f5c842;
	--tpx-gold-soft: rgba(245,200,66,0.14);
	--tpx-gold-ring: rgba(245,200,66,0.40);
	font-family: var(--igc-font);
	color: var(--igc-text);
}

/* ── Hero ─────────────────────────────────────────────────── */
.igc-tpx-hero {
	position: relative;
	overflow: hidden;
	padding: 72px 20px 56px;
	background:
		radial-gradient(ellipse 1000px 500px at 20% 0%, rgba(245,200,66,0.08), transparent 60%),
		radial-gradient(ellipse 800px 500px at 85% 10%, rgba(59,130,246,0.10), transparent 60%),
		radial-gradient(ellipse 600px 400px at 50% 100%, rgba(239,68,68,0.06), transparent 60%),
		linear-gradient(180deg, #060E20 0%, var(--igc-bg) 100%);
	border-bottom: 1px solid var(--igc-border);
}
.igc-tpx-hero__glow {
	position: absolute; inset: 0; pointer-events: none;
	background: radial-gradient(circle at 50% 0%, rgba(245,200,66,0.06), transparent 55%);
}
.igc-tpx-hero__inner {
	position: relative;
	max-width: var(--igc-wrap);
	margin: 0 auto;
}
.igc-tpx-crumbs {
	font-size: 13px;
	color: var(--igc-text-dim);
	margin-bottom: 20px;
}
.igc-tpx-crumbs a { color: var(--igc-text-dim); text-decoration: none; }
.igc-tpx-crumbs a:hover { color: var(--tpx-gold); }
.igc-tpx-crumbs span[aria-hidden] { margin: 0 8px; opacity: 0.5; }

.igc-tpx-badge {
	display: inline-block;
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--tpx-gold-soft);
	color: var(--tpx-gold);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	margin-bottom: 12px;
}
.igc-tpx-hero__head {
	display: flex;
	align-items: flex-start;
	gap: 20px;
	margin-bottom: 20px;
}
.igc-tpx-hero__icon {
	font-size: 48px;
	line-height: 1;
	flex-shrink: 0;
	filter: drop-shadow(0 4px 12px rgba(245,200,66,0.25));
}
.igc-tpx-title {
	font-size: clamp(28px, 4.2vw, 44px);
	line-height: 1.1;
	margin: 4px 0 8px;
	font-weight: 700;
	letter-spacing: -0.02em;
}
.igc-tpx-tagline {
	font-size: 18px;
	color: var(--tpx-gold);
	margin: 0;
	font-weight: 500;
}
.igc-tpx-lede {
	max-width: 820px;
	font-size: 17px;
	line-height: 1.6;
	color: var(--igc-text-dim);
	margin: 0 0 28px;
}
.igc-tpx-stats {
	list-style: none;
	padding: 0; margin: 0;
	display: flex;
	flex-wrap: wrap;
	gap: 28px 40px;
}
.igc-tpx-stats li {
	display: flex;
	flex-direction: column;
	gap: 2px;
}
.igc-tpx-stats strong {
	font-size: 28px;
	color: var(--tpx-gold);
	font-weight: 700;
	line-height: 1;
}
.igc-tpx-stats span {
	font-size: 12px;
	color: var(--igc-text-dim);
	text-transform: uppercase;
	letter-spacing: 0.06em;
}

/* ── Pill nav (sticky on scroll) ─────────────────────────── */
.igc-tpx-pillnav {
	position: sticky;
	top: 0;
	z-index: 20;
	background: rgba(5,11,26,0.92);
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-bottom: 1px solid var(--igc-border);
}
.igc-tpx-pillnav__inner {
	max-width: var(--igc-wrap);
	margin: 0 auto;
	padding: 10px 20px;
	display: flex;
	gap: 6px;
	overflow-x: auto;
	scrollbar-width: none;
}
.igc-tpx-pillnav__inner::-webkit-scrollbar { display: none; }
.igc-tpx-pill {
	flex-shrink: 0;
	padding: 7px 14px;
	border-radius: 999px;
	background: transparent;
	border: 1px solid var(--igc-border);
	color: var(--igc-text-dim);
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	transition: all 0.18s var(--igc-ease);
}
.igc-tpx-pill:hover {
	color: var(--tpx-gold);
	border-color: var(--tpx-gold-ring);
	background: var(--tpx-gold-soft);
}

/* ── Section scaffolding ─────────────────────────────────── */
.igc-tpx-snapshot,
.igc-tpx-side,
.igc-tpx-trend,
.igc-tpx-watch,
.igc-tpx-faq,
.igc-tpx-related,
.igc-tpx-sources,
.igc-tpx-hub {
	padding: 56px 20px;
}
.igc-tpx-snapshot__inner,
.igc-tpx-side__inner,
.igc-tpx-trend__inner,
.igc-tpx-watch__inner,
.igc-tpx-faq__inner,
.igc-tpx-related__inner,
.igc-tpx-sources__inner,
.igc-tpx-hub__inner,
.igc-tpx-div__inner,
.igc-tpx-foot__inner {
	max-width: var(--igc-wrap);
	margin: 0 auto;
}
.igc-tpx-section__head {
	margin-bottom: 28px;
}
.igc-tpx-section-title {
	font-size: 26px;
	font-weight: 700;
	letter-spacing: -0.01em;
	margin: 0 0 8px;
}
.igc-tpx-section-lede {
	font-size: 15px;
	line-height: 1.6;
	color: var(--igc-text-dim);
	margin: 0;
	max-width: 760px;
}

/* ── Snapshot grid ───────────────────────────────────────── */
.igc-tpx-snapshot__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
	gap: 10px;
}
.igc-tpx-chip {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-radius: var(--igc-radius-sm);
	border: 1px solid var(--igc-border);
	background: var(--igc-bg-elev);
	text-decoration: none;
	color: var(--igc-text);
	transition: all 0.18s var(--igc-ease);
	position: relative;
}
.igc-tpx-chip:hover {
	border-color: var(--tpx-accent, var(--tpx-gold));
	background: var(--igc-bg-elev-2);
	transform: translateY(-1px);
}
.igc-tpx-chip__flag {
	font-size: 20px;
	line-height: 1;
	flex-shrink: 0;
}
.igc-tpx-chip__body {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1;
}
.igc-tpx-chip__name {
	font-size: 14px;
	font-weight: 600;
}
.igc-tpx-chip__ref {
	font-size: 11px;
	color: var(--igc-text-dim);
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}
.igc-tpx-chip__dot {
	width: 8px; height: 8px;
	border-radius: 50%;
	background: var(--igc-border-mid);
	flex-shrink: 0;
}
.igc-tpx-chip.is-match .igc-tpx-chip__dot {
	background: var(--tpx-accent, var(--tpx-gold));
	box-shadow: 0 0 8px var(--tpx-accent, var(--tpx-gold));
}
.igc-tpx-chip.is-miss { opacity: 0.72; }

/* ── Side-by-side table ──────────────────────────────────── */
.igc-tpx-side__scroll {
	overflow-x: auto;
	border-radius: var(--igc-radius-md);
	border: 1px solid var(--igc-border);
	background: var(--igc-bg-elev);
}
.igc-tpx-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 14px;
}
.igc-tpx-table thead th {
	position: sticky;
	top: 0;
	background: var(--igc-bg-elev-2);
	text-align: left;
	padding: 14px 14px;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: var(--igc-text-dim);
	border-bottom: 1px solid var(--igc-border);
	white-space: nowrap;
}
.igc-tpx-table tbody tr {
	border-bottom: 1px solid var(--igc-border);
	transition: background 0.15s var(--igc-ease);
}
.igc-tpx-table tbody tr:hover {
	background: var(--tpx-gold-soft);
}
.igc-tpx-table tbody tr:last-child { border-bottom: none; }
.igc-tpx-table th[scope="row"],
.igc-tpx-table td {
	padding: 14px 14px;
	vertical-align: top;
}
.igc-tpx-table__market {
	min-width: 160px;
	border-left: 3px solid var(--tpx-accent, var(--tpx-gold));
}
.igc-tpx-table__flag { font-size: 18px; margin-right: 8px; }
.igc-tpx-table__short { font-weight: 600; }
.igc-tpx-table__ref {
	display: block;
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 11px;
	color: var(--igc-text-dim);
	margin-top: 4px;
}
.igc-tpx-cell.is-yes  { color: var(--igc-success); font-weight: 600; }
.igc-tpx-cell.is-no   { color: var(--igc-danger); font-weight: 600; }
.igc-tpx-cell.is-null { color: var(--igc-text-faint); }
.igc-tpx-cell.is-note { font-style: italic; color: var(--igc-text-dim); }
.igc-tpx-cell.is-num  { font-variant-numeric: tabular-nums; font-weight: 600; }
.igc-tpx-cell__title { font-weight: 500; }
.igc-tpx-cell--excerpt {
	color: var(--igc-text-dim);
	font-size: 13px;
	max-width: 420px;
	line-height: 1.5;
}
.igc-tpx-table__open-h { text-align: right; }
.igc-tpx-table__open { text-align: right; }
.igc-tpx-open {
	color: var(--tpx-gold);
	text-decoration: none;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
}
.igc-tpx-open:hover { text-decoration: underline; }

/* ── Trend cards ─────────────────────────────────────────── */
.igc-tpx-trend {
	background: linear-gradient(180deg, transparent 0%, var(--igc-bg-elev) 100%);
}
.igc-tpx-trend__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
	gap: 18px;
}
.igc-tpx-trend__card {
	position: relative;
	padding: 24px 22px 22px;
	background: var(--igc-bg-elev);
	border: 1px solid var(--igc-border);
	border-radius: var(--igc-radius-md);
}
.igc-tpx-trend__rank {
	position: absolute;
	top: -12px; left: 20px;
	width: 30px; height: 30px;
	border-radius: 50%;
	background: var(--tpx-gold);
	color: #111;
	font-weight: 700;
	font-size: 13px;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: 0 4px 12px rgba(245,200,66,0.25);
}
.igc-tpx-trend__title {
	font-size: 17px;
	font-weight: 600;
	margin: 6px 0 10px;
	color: var(--tpx-gold);
}
.igc-tpx-trend__body {
	font-size: 14px;
	line-height: 1.65;
	color: var(--igc-text-dim);
	margin: 0;
}

/* ── Divergence callout ─────────────────────────────────── */
.igc-tpx-div {
	padding: 48px 20px;
}
.igc-tpx-div__inner {
	padding: 28px 30px;
	border-left: 4px solid var(--tpx-gold);
	background: var(--tpx-gold-soft);
	border-radius: var(--igc-radius-sm);
	max-width: var(--igc-wrap);
	margin: 0 auto;
}
.igc-tpx-div__title {
	font-size: 20px;
	font-weight: 700;
	margin: 0 0 8px;
	color: var(--tpx-gold);
}
.igc-tpx-div__body {
	font-size: 15px;
	line-height: 1.6;
	margin: 0;
}

/* ── Watch list ─────────────────────────────────────────── */
.igc-tpx-watch__list {
	list-style: none;
	padding: 0; margin: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}
.igc-tpx-watch__list li {
	position: relative;
	padding: 14px 18px 14px 42px;
	background: var(--igc-bg-elev);
	border: 1px solid var(--igc-border);
	border-radius: var(--igc-radius-sm);
	font-size: 14px;
	line-height: 1.55;
}
.igc-tpx-watch__list li::before {
	content: "●";
	position: absolute;
	left: 18px; top: 14px;
	color: var(--tpx-gold);
	font-size: 8px;
}

/* ── FAQ ────────────────────────────────────────────────── */
.igc-tpx-faq__list {
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.igc-tpx-faq__item {
	background: var(--igc-bg-elev);
	border: 1px solid var(--igc-border);
	border-radius: var(--igc-radius-sm);
	transition: border-color 0.18s var(--igc-ease);
}
.igc-tpx-faq__item[open] {
	border-color: var(--tpx-gold-ring);
}
.igc-tpx-faq__item summary {
	padding: 16px 20px;
	cursor: pointer;
	font-weight: 600;
	font-size: 15px;
	list-style: none;
	position: relative;
}
.igc-tpx-faq__item summary::-webkit-details-marker { display: none; }
.igc-tpx-faq__item summary::after {
	content: "+";
	position: absolute;
	right: 20px; top: 50%;
	transform: translateY(-50%);
	color: var(--tpx-gold);
	font-size: 20px;
	font-weight: 400;
	transition: transform 0.2s var(--igc-ease);
}
.igc-tpx-faq__item[open] summary::after { content: "−"; }
.igc-tpx-faq__item p {
	padding: 0 20px 18px;
	margin: 0;
	font-size: 14px;
	line-height: 1.65;
	color: var(--igc-text-dim);
}

/* ── Related topics ─────────────────────────────────────── */
.igc-tpx-related__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
	gap: 12px;
	margin-top: 20px;
}
.igc-tpx-related__card {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 18px;
	background: var(--igc-bg-elev);
	border: 1px solid var(--igc-border);
	border-radius: var(--igc-radius-sm);
	text-decoration: none;
	color: var(--igc-text);
	transition: all 0.18s var(--igc-ease);
}
.igc-tpx-related__card:hover {
	border-color: var(--tpx-gold-ring);
	background: var(--igc-bg-elev-2);
	transform: translateY(-2px);
}
.igc-tpx-related__icon { font-size: 22px; }
.igc-tpx-related__name { font-size: 15px; font-weight: 600; }
.igc-tpx-related__lede { font-size: 12px; color: var(--igc-text-dim); line-height: 1.5; }

/* ── Sources (bibliography) ─────────────────────────────── */
.igc-tpx-sources {
	background: linear-gradient(180deg, var(--igc-bg-elev) 0%, var(--igc-bg) 100%);
}
.igc-tpx-sources__subhead {
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.07em;
	color: var(--igc-text-dim);
	margin: 28px 0 12px;
}
.igc-tpx-sources__subhead:first-of-type { margin-top: 8px; }
.igc-tpx-sources__list {
	list-style: none;
	padding: 0; margin: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}
.igc-tpx-sources__list li {
	display: grid;
	grid-template-columns: auto 80px 140px 1fr;
	gap: 12px;
	align-items: baseline;
	padding: 10px 14px;
	border-left: 3px solid var(--tpx-accent, var(--tpx-gold));
	background: var(--igc-bg-elev);
	border-radius: 4px;
	font-size: 13px;
}
.igc-tpx-sources__list li.is-overlay {
	background: var(--tpx-gold-soft);
}
.igc-tpx-sources__flag { font-size: 14px; }
.igc-tpx-sources__short { font-weight: 600; }
.igc-tpx-sources__ref {
	font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
	font-size: 11px;
	color: var(--igc-text-dim);
}
.igc-tpx-sources__title {
	color: var(--igc-text);
	text-decoration: none;
	border-bottom: 1px dotted var(--igc-border-mid);
}
.igc-tpx-sources__title:hover { color: var(--tpx-gold); border-bottom-color: var(--tpx-gold); }
.igc-tpx-sources__theme,
.igc-tpx-sources__note {
	display: block;
	font-size: 11px;
	color: var(--igc-text-faint);
	grid-column: 4;
	margin-top: 2px;
}
.igc-tpx-sources__note { font-style: italic; }
.igc-tpx-sources__foot {
	margin-top: 32px;
	font-size: 12px;
	color: var(--igc-text-faint);
}

@media (max-width: 720px) {
	.igc-tpx-sources__list li {
		grid-template-columns: auto 1fr;
		grid-template-areas:
			"flag short"
			"ref  ref"
			"title title"
			"note  note";
	}
	.igc-tpx-sources__flag  { grid-area: flag; }
	.igc-tpx-sources__short { grid-area: short; }
	.igc-tpx-sources__ref   { grid-area: ref; }
	.igc-tpx-sources__title { grid-area: title; }
	.igc-tpx-sources__theme,
	.igc-tpx-sources__note  { grid-area: note; grid-column: auto; }
}

/* ── Hub (/topics/) ─────────────────────────────────────── */
.igc-tpx-hero--hub { padding-bottom: 64px; }

.igc-tpx-hub__grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
	gap: 16px;
}
.igc-tpx-hub__card {
	display: flex;
	flex-direction: column;
	gap: 14px;
	padding: 24px;
	background: var(--igc-bg-elev);
	border: 1px solid var(--igc-border);
	border-radius: var(--igc-radius-md);
	text-decoration: none;
	color: var(--igc-text);
	transition: all 0.2s var(--igc-ease);
}
.igc-tpx-hub__card:hover {
	border-color: var(--tpx-gold-ring);
	transform: translateY(-2px);
	box-shadow: var(--igc-shadow-2);
}
.igc-tpx-hub__head {
	display: flex;
	align-items: flex-start;
	gap: 14px;
}
.igc-tpx-hub__icon { font-size: 30px; line-height: 1; }
.igc-tpx-hub__heading { flex: 1; min-width: 0; }
.igc-tpx-hub__title {
	font-size: 18px;
	font-weight: 700;
	margin: 2px 0 4px;
}
.igc-tpx-hub__tagline {
	font-size: 13px;
	color: var(--tpx-gold);
	margin: 0;
}
.igc-tpx-hub__lede {
	font-size: 14px;
	line-height: 1.55;
	color: var(--igc-text-dim);
	margin: 0;
	flex: 1;
}
.igc-tpx-hub__foot {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-top: 14px;
	border-top: 1px solid var(--igc-border);
}
.igc-tpx-hub__cov {
	font-size: 12px;
	color: var(--igc-text-dim);
	white-space: nowrap;
}
.igc-tpx-hub__cov strong { color: var(--tpx-gold); }
.igc-tpx-hub__bar {
	flex: 1;
	height: 4px;
	background: var(--igc-border);
	border-radius: 2px;
	overflow: hidden;
	position: relative;
}
.igc-tpx-hub__bar span {
	display: block;
	height: 100%;
	background: var(--tpx-gold);
	border-radius: 2px;
	transition: width 0.3s var(--igc-ease);
}
.igc-tpx-hub__open {
	font-size: 12px;
	color: var(--tpx-gold);
	font-weight: 500;
	white-space: nowrap;
}

/* ── Foot rail ──────────────────────────────────────────── */
.igc-tpx-foot {
	padding: 32px 20px 48px;
	background: var(--igc-bg);
	border-top: 1px solid var(--igc-border);
}
.igc-tpx-foot__inner {
	max-width: var(--igc-wrap-narrow);
	margin: 0 auto;
}
.igc-tpx-foot p {
	font-size: 12px;
	color: var(--igc-text-faint);
	text-align: center;
	margin: 0;
	line-height: 1.6;
}

/* ── Missing topic fallback ─────────────────────────────── */
.igc-tpx-missing { padding: 80px 20px; }
.igc-tpx-missing__inner {
	max-width: 640px;
	margin: 0 auto;
	text-align: center;
}
.igc-tpx-missing h1 { font-size: 28px; margin: 0 0 12px; }
.igc-tpx-missing a { color: var(--tpx-gold); }

/* ── Light mode ─────────────────────────────────────────── */
.igc-light .igc-tpx-hero {
	background:
		radial-gradient(ellipse 800px 400px at 20% 0%, rgba(245,200,66,0.12), transparent 60%),
		linear-gradient(180deg, #fff 0%, var(--igc-bg) 100%);
}
.igc-light .igc-tpx-pillnav {
	background: rgba(255,255,255,0.92);
}

/* ── Print ──────────────────────────────────────────────── */
@media print {
	.igc-tpx-pillnav, .igc-tpx-snapshot, .igc-tpx-related { display: none; }
	.igc-tpx-hero { background: none; padding: 20px 0; }
	.igc-tpx-faq__item { break-inside: avoid; }
	.igc-tpx-faq__item[open] summary::after { content: ""; }
	.igc-tpx-faq__item p { display: block !important; }
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 720px) {
	.igc-tpx-hero__head { flex-direction: column; gap: 12px; }
	.igc-tpx-hero__icon { font-size: 36px; }
	.igc-tpx-stats { gap: 18px 24px; }
	.igc-tpx-stats strong { font-size: 22px; }
	.igc-tpx-section-title { font-size: 22px; }
	.igc-tpx-snapshot, .igc-tpx-side, .igc-tpx-trend, .igc-tpx-watch, .igc-tpx-faq, .igc-tpx-related, .igc-tpx-sources, .igc-tpx-hub {
		padding: 40px 16px;
	}
}
