/* ══════════════════════════════════════════════════════
	 Dragonfly Thinking — Iran Crisis Briefing
	 Shared Styles (v2)
	 ══════════════════════════════════════════════════════ */

/* ── Reset & Base ── */
*, *::before, *::after {
	box-sizing: border-box;
	margin: 0;
	padding: 0;
}

html { scroll-behavior: smooth; }

body {
	font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
	background: #fff;
	color: #1e293b;
	line-height: 1.7;
	font-size: 15px;
	-webkit-font-smoothing: antialiased;
}

a { color: #475569; text-decoration: none; transition: color 0.2s; }
a:hover { color: #1e293b; }


/* ── Left Sidebar ── */
.sidebar {
	position: fixed;
	top: 0;
	left: 0;
	width: 280px;
	height: 100vh;
	background: #f8f9fb;
	border-right: 1px solid #e2e8f0;
	display: flex;
	flex-direction: column;
	z-index: 100;
	overflow-y: auto;
	padding: 32px 24px 24px;
	transition: transform 0.3s ease;
}

.sidebar-logo {
	padding-bottom: 18px;
	margin-bottom: 14px;
}

.sidebar-logo img {
	width: 180px;
	height: auto;
	display: block;
}

.sidebar-classification {
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	color: #334155;
	margin-bottom: 28px;
}

.sidebar-title {
	font-size: 18px;
	font-weight: 700;
	color: #0f172a;
	line-height: 1.3;
	margin-bottom: 4px;
}

.sidebar-subtitle {
	font-size: 13px;
	color: #64748b;
	margin-bottom: 6px;
}

.sidebar-date {
	font-size: 13px;
	color: #64748b;
	margin-bottom: 20px;
}

.sidebar-desc {
	font-size: 13px;
	color: #475569;
	line-height: 1.55;
	margin-bottom: 16px;
}

.sidebar-divider {
	border: none;
	border-top: 1px solid #e2e8f0;
	margin: 12px 0 20px;
}

.sidebar-label {
	font-size: 10.5px;
	font-weight: 600;
	letter-spacing: 2.5px;
	text-transform: uppercase;
	color: #334155;
	margin-bottom: 10px;
}

.sidebar-section-label {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #334155;
	margin-bottom: 10px;
}

/* Sidebar toggle (mobile) */
.sidebar-toggle {
	display: none;
	position: fixed;
	top: 12px;
	left: 12px;
	z-index: 200;
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 8px;
	padding: 8px 12px;
	cursor: pointer;
	font-size: 14px;
	color: #1e293b;
	box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}


/* ── Table of Contents (left sidebar) ── */
.toc {
	list-style: none;
	counter-reset: toc;
}

.toc li a {
	display: block;
	padding: 6px 10px;
	font-size: 13px;
	color: #475569;
	border-radius: 6px;
	transition: background 0.2s, color 0.2s;
	line-height: 1.45;
}

.toc li a:hover,
.toc li a.active {
	background: #f1f5f9;
	color: #1e293b;
}

.toc-num {
	display: inline-block;
	width: 22px;
	font-weight: 600;
	color: #94a3b8;
	font-size: 12px;
}


/* ── Sidebar Stat Grid ── */
.sidebar-stat-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 6px;
	margin-bottom: 16px;
}

.sidebar-stat-item {
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	padding: 8px 10px;
}

.sidebar-stat-value {
	font-size: 18px;
	font-weight: 700;
	color: #0f172a;
}

.sidebar-stat-label {
	font-size: 10px;
	color: #334155;
	margin-top: 2px;
}


/* ── Sidebar Legend ── */
.sidebar-legend {
	display: flex;
	flex-direction: column;
	gap: 3px;
	margin-bottom: 16px;
}

.sidebar-legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px;
	border-radius: 6px;
	cursor: pointer;
	transition: background 0.15s;
	border: 1px solid transparent;
}

.sidebar-legend-item:hover { background: #f1f5f9; }
.sidebar-legend-item.active {
	background: #f1f5f9;
	border-color: #e2e8f0;
}

.sidebar-legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.sidebar-legend-name {
	font-size: 12px;
	font-weight: 600;
	color: #1e293b;
	flex: 1;
}

.sidebar-legend-prob {
	font-size: 11px;
	font-weight: 500;
	color: #475569;
}

/* Simple legend (actor network, risk landscape) */
.legend-item {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 12px;
	color: #1e293b;
}

.legend-dot {
	width: 10px;
	height: 10px;
	border-radius: 50%;
	flex-shrink: 0;
}

.legend-line {
	width: 20px;
	height: 4px;
	flex-shrink: 0;
}

.legend-desc {
	color: #475569;
	font-size: 11px;
}


/* ── Filter Buttons (actor network etc) ── */
.filter-section {
	display: flex;
	flex-direction: column;
	gap: 4px;
	margin-bottom: 20px;
}

.filter-section .sidebar-label {
	margin-bottom: 4px;
}

.filter-btn {
	display: block;
	width: 100%;
	padding: 6px 10px;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	background: #fff;
	color: #1e293b;
	font-size: 13px;
	font-family: inherit;
	cursor: pointer;
	text-align: left;
	transition: all 0.15s ease;
}

.filter-btn:hover { background: #f1f5f9; }
.filter-btn.active {
	background: #1e293b;
	color: #fff;
	border-color: #1e293b;
}


/* ── Risk Badges (sidebar summary) ── */
.risk-summary { margin-bottom: 16px; }

.risk-summary-label {
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 2px;
	text-transform: uppercase;
	color: #334155;
	margin-bottom: 8px;
}

.risk-badges {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
}

.risk-badge {
	font-size: 10px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 4px;
}

.risk-badge.extreme { background: rgba(220,38,38,0.08); color: #dc2626; border: 1px solid rgba(220,38,38,0.2); }
.risk-badge.v-high { background: rgba(234,88,12,0.08); color: #ea580c; border: 1px solid rgba(234,88,12,0.2); }
.risk-badge.high { background: rgba(217,119,6,0.08); color: #d97706; border: 1px solid rgba(217,119,6,0.2); }
.risk-badge.moderate { background: rgba(100,116,139,0.08); color: #64748b; border: 1px solid rgba(100,116,139,0.2); }


/* ── Sidebar Uncertainty (scenario tree) ── */
.sidebar-uncertainty {
	background: #f1f5f9;
	border: 1px solid #e2e8f0;
	border-radius: 6px;
	padding: 8px 10px;
	margin-bottom: 6px;
}

.sidebar-uncertainty .axis-name {
	font-size: 11px;
	font-weight: 600;
	color: #475569;
	margin-bottom: 4px;
}

.sidebar-uncertainty .axis-poles {
	font-size: 10px;
	color: #475569;
	display: flex;
	justify-content: space-between;
	gap: 6px;
}

.sidebar-uncertainty .axis-pole {
	flex: 1;
	text-align: center;
	padding: 3px;
	border-radius: 3px;
	background: rgba(37, 99, 235, 0.04);
}

.sidebar-uncertainty .axis-pole-divider {
	color: #e2e8f0;
	align-self: center;
	font-weight: 600;
}


/* ── Right Sidebar (floating page TOC) ── */
.sidebar-right {
	position: fixed;
	top: 28px;
	right: 28px;
	width: 230px;
	display: flex;
	flex-direction: column;
	z-index: 100;
	overflow-y: auto;
	max-height: calc(100vh - 56px);
	padding: 0;
}

.sidebar-right .sidebar-label {
	margin: 0 0 12px;
}

.sidebar-nav {
	list-style: none;
	display: flex;
	flex-direction: column;
	gap: 0;
	border-left: 1px solid #e2e8f0;
}

/* Shared link base */
.sidebar-nav a {
	display: block;
	text-decoration: none;
	transition: color 0.15s, border-color 0.15s;
	border-left: 2px solid transparent;
	margin-left: -1px;
	line-height: 1.4;
}

/* Parent-level items (same style as child — Report Index, Research Brief, etc.) */
.sidebar-nav .nav-parent > a {
	padding: 4px 8px 4px 12px;
	font-size: 13px;
	font-weight: 400;
	color: #334155;
}

/* Child-level items */
.sidebar-nav .nav-child > a {
	padding: 4px 8px 4px 12px;
	font-size: 13px;
	font-weight: 400;
	color: #334155;
}

/* Sub-child-level items — indented under parent */
.sidebar-nav .nav-subchild > a {
	padding: 3px 8px 3px 26px;
	font-size: 12.5px;
	font-weight: 400;
	color: #64748b;
}

/* Hover — all levels */
.sidebar-nav a:hover {
	color: #0f172a;
	background: rgba(15, 23, 42, 0.03);
}

/* Active — blue left border accent */
.sidebar-nav a.active {
	color: #2563eb;
	border-left-color: #2563eb;
	background: rgba(37, 99, 235, 0.04);
}


/* ── Main Content Area ── */
.main {
	margin: 0 auto;
	padding: 48px 56px 80px;
	max-width: calc(800px + 280px + 56px + 280px);
	padding-left: calc(280px + 56px);
	padding-right: calc(230px + 56px);
}

.main-content {
	margin-left: 280px;
	margin-right: 280px;
	padding: 40px 48px 60px;
}

.content-inner {
	max-width: 768px;
	width: 100%;
}


/* ── Page Header ── */
.page-header {
	margin-bottom: 48px;
}

.page-header h1 {
	font-size: 32px;
	font-weight: 700;
	color: #0f172a;
	letter-spacing: -0.02em;
	margin-bottom: 6px;
}

.page-header .subtitle {
	font-size: 14px;
	color: #64748b;
}

.page-header .meta-line {
	font-size: 13px;
	color: #64748b;
	margin-top: 4px;
}


/* ── Sections ── */
.section {
	margin-bottom: 52px;
}

.section-heading {
	display: flex;
	align-items: center;
	gap: 14px;
	margin-bottom: 20px;
}

.section-badge {
	flex-shrink: 0;
	width: 34px;
	height: 34px;
	border-radius: 50%;
	background: #f8f9fb;
	border: 1px solid #e2e8f0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 700;
	color: #1e293b;
}

.section-title {
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #0f172a;
}


/* ── Badges ── */
.badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	font-size: 11px;
	font-weight: 600;
	padding: 3px 10px;
	border-radius: 4px;
	font-family: 'IBM Plex Sans', -apple-system, BlinkMacSystemFont, sans-serif;
}

.badge-public { background: rgba(5,150,105,0.08); color: #059669; border: 1px solid rgba(5,150,105,0.2); }
.badge-estimated { background: rgba(217,119,6,0.06); color: #d97706; border: 1px solid rgba(217,119,6,0.2); }
.badge-govdata, .badge-gov { background: rgba(37,99,235,0.08); color: #2563eb; border: 1px solid rgba(37,99,235,0.2); }

.data-confidence {
	display: flex;
	gap: 10px;
	margin-top: 14px;
	flex-wrap: wrap;
}


/* ── Cards ── */
.card {
	background: #fff;
	border: 1px solid #e2e8f0;
	border-radius: 10px;
	padding: 20px;
	transition: box-shadow 0.2s;
}

.card:hover {
	box-shadow: 0 2px 8px rgba(0,0,0,0.04);
}


/* ── Embed Mode ── */
.embed-mode .sidebar,
.embed-mode .sidebar-right,
.embed-mode .sidebar-toggle {
	display: none;
}

.embed-mode .main,
.embed-mode .main-content {
	margin-left: 0;
	margin-right: 0;
	padding-left: 48px;
	padding-right: 48px;
	max-width: 100%;
}


/* ── Responsive ── */
@media (max-width: 1200px) {
	.sidebar-right { display: none; }
	.main {
		max-width: calc(800px + 280px + 56px);
		padding-right: 56px;
	}
	.main-content {
		margin-right: 0;
	}
}

@media (max-width: 768px) {
	.sidebar {
		transform: translateX(-100%);
	}
	.sidebar.open {
		transform: translateX(0);
	}
	.sidebar-toggle {
		display: flex;
	}
	.sidebar-right {
		display: none;
	}
	.main {
		padding: 48px 24px;
		padding-left: 24px;
		padding-right: 24px;
		max-width: 100%;
	}
	.main-content {
		margin-left: 0;
		margin-right: 0;
		padding: 24px 16px 48px;
	}
}
