/* ============================================================
   Destins climatiques – feuille de styles principale
   ============================================================ */

/* ── Variables ─────────────────────────────────────────────── */
:root {
	--optimiste: #16a34a;
	--median: #ea580c;
	--pessimiste: #dc2626;

	--bg: #f0f6ff;
	--card-bg: #ffffff;
	--border: #e2e8f0;

	--text: #1e293b;
	--text-muted: #64748b;
	--accent: #0ea5e9;

	--radius: 0.75rem;
	--shadow: 0 1px 4px rgba(0, 0, 0, 0.08);
}

/* ── Dark mode ──────────────────────────────────────────────── */
body.dark {
	--bg: #0f172a;
	--card-bg: #1e293b;
	--border: #334155;
	--text: #f1f5f9;
	--text-muted: #94a3b8;
}

body.dark .home-header h1 {
	color: #f1f5f9;
}

body.dark .timeline-item {
	color: #f1f5f9;
}

body.dark .timeline-item .stage-meta {
	color: #94a3b8;
}

body.dark .timeline-item.active {
	background: #1e3a5f;
	box-shadow: 0 0 0 1px #3b82f6;
}

body.dark .timeline-dot {
	background: #334155;
	border-color: #475569;
}

body.dark .sources-box {
	background: #1e293b;
	border-color: #334155;
	color: #f1f5f9;
}

body.dark .sources-box strong {
	color: #f1f5f9;
}

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

body {
	font-family: system-ui, sans-serif;
	font-size: 1rem;
	line-height: 1.6;
	color: var(--text);
	background: var(--bg);
}

a {
	color: var(--accent);
	text-decoration: none;
}

a:hover {
	text-decoration: underline;
}

img {
	display: block;
	max-width: 100%;
	border-radius: var(--radius);
}

/* ── Conteneur centré ───────────────────────────────────────── */
.container {
	width: min(1200px, 100% - 2rem);
	margin-inline: auto;
	padding-block: 2rem;
}

/* ── Header ─────────────────────────────────────────────────── */
.site-header {
	width: 100%;
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	align-items: center;
	padding: 1.5rem 2rem;
	background: var(--card-bg);
	border-bottom: 1px solid var(--border);
	position: sticky;
	top: 0;
	z-index: 100;
}

.site-header-center {
	text-align: center;
}

.site-header-center h1 {
	font-size: 1rem;
	font-weight: 600;
	color: var(--accent);
}

.site-header-center p {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-top: 0.2rem;
}

.dark-mode-btn {
	background: none;
	border: 1px solid var(--border);
	border-radius: 50%;
	width: 34px;
	height: 34px;
	cursor: pointer;
	font-size: 0.95rem;
	display: flex;
	align-items: center;
	justify-content: center;
	justify-self: end;
}

/* ── Page d'accueil : en-tête ───────────────────────────────── */
.home-header {
	text-align: center;
	padding-block: 2.5rem 1.5rem;
}

.home-header h1 {
	font-size: 1.5rem;
	color: var(--text);
}

.home-header p {
	color: var(--text-muted);
	margin-top: 0.5rem;
	max-width: 700px;
	margin-inline: auto;
}

/* ── Statistiques ───────────────────────────────────────────── */
.stats {
	display: flex;
	justify-content: center;
	gap: 1.5rem;
	margin-block: 2rem;
}

.stat-card {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.75rem 2rem;
	text-align: center;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.5rem;
	width: 260px;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
}

.stat-card img {
	margin: 0 auto 0.75rem;
}

.stat-card .stat-value {
	font-size: 1.4rem;
	font-weight: 700;
	margin-top: 0.5rem;
}

.stat-card .stat-label {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-top: auto;
}

.stats .stat-card:nth-child(1) { background: #e7d9ff; }
.stats .stat-card:nth-child(2) { background: #cdd9c5; }
.stats .stat-card:nth-child(3) { background: #ffe8bf; }

/* ── Titres de section ──────────────────────────────────────── */
.section-title {
	font-size: 1.15rem;
	font-weight: 600;
	margin-block: 3rem 0.4rem;
	text-align: center;
}

.section-subtitle {
	font-size: 0.9rem;
	color: var(--text-muted);
	margin-bottom: 1rem;
	text-align: center;
}

/* ── Grille personnages ─────────────────────────────────────── */
.character-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem;
	width: 100%;
}

.character-card {
	background: var(--card-bg);
	border: 2px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	box-shadow: var(--shadow);
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.character-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
	border-color: var(--accent);
}

.character-card.selected {
	border-color: var(--accent);
}

.character-card .character-name {
	font-weight: 700;
}

.character-card .character-meta {
	font-size: 0.8rem;
	color: var(--text-muted);
	line-height: 1.4;
}

.character-card .btn-follow {
	margin-top: auto;
	padding: 0.5rem;
	border: none;
	border-radius: 0.4rem;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
	background: var(--accent);
}

/* Couleurs hover et bouton par personnage */
.character-card.ajia:hover,
.character-card.ajla:hover,
.character-card.ajia.selected,
.character-card.ajla.selected  { border-color: #3b82f6; }

.character-card.camille:hover,
.character-card.camille.selected { border-color: #0d9488; }

.character-card.isabelle:hover,
.character-card.isabelle.selected { border-color: var(--optimiste); }

.character-card.liam:hover,
.character-card.liam.selected { border-color: #7c3aed; }

.character-card.lukas:hover,
.character-card.lukas.selected { border-color: var(--median); }

.character-card.marco:hover,
.character-card.marco.selected { border-color: #f59e0b; }

.character-card.ajia .btn-follow,
.character-card.ajla .btn-follow { background: #3b82f6; }

.character-card.camille .btn-follow  { background: #0d9488; }
.character-card.isabelle .btn-follow { background: var(--optimiste); }
.character-card.liam .btn-follow     { background: #7c3aed; }
.character-card.lukas .btn-follow    { background: var(--median); }
.character-card.marco .btn-follow    { background: #f59e0b; }

/* Card personnage top coloré */
.character-card-top {
	display: flex;
	align-items: center;
	gap: 1rem;
	padding: 1rem;
	border-radius: var(--radius) var(--radius) 0 0;
	margin: -1rem -1rem 1rem -1rem;
}

.character-card-top img {
	border-radius: 50%;
	flex-shrink: 0;
}

/* ── Grille scénarios ───────────────────────────────────────── */
.scenario-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 1rem;
}

.scenario-card {
	background: var(--card-bg);
	border: 2px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem;
	display: flex;
	flex-direction: column;
	gap: 0.75rem;
	box-shadow: var(--shadow);
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}

.scenario-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.scenario-card .scenario-name {
	font-weight: 700;
	font-size: 1rem;
}

.scenario-card .scenario-desc {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.scenario-card .temp-row {
	display: flex;
	flex-direction: column;
	gap: 0.25rem;
	font-size: 0.9rem;
}

.scenario-card .temp-global {
	color: var(--optimiste);
	font-weight: 700;
	font-size: 1.25rem;
}

.scenario-card .temp-swiss {
	color: var(--pessimiste);
	font-weight: 700;
	font-size: 1.25rem;
}

.scenario-card .scenario-code {
	font-size: 0.75rem;
	color: var(--text-muted);
}

.scenario-card .btn-select {
	padding: 0.5rem;
	border: none;
	border-radius: 0.4rem;
	color: #fff;
	font-weight: 600;
	cursor: pointer;
}

.scenario-card .selected-label {
	text-align: center;
	font-size: 0.8rem;
	color: var(--optimiste);
	font-weight: 600;
}

/* États sélectionnés et hover scénarios */
.scenario-card.optimiste,
.scenario-card.optimiste:hover { border-color: var(--optimiste); }

.scenario-card.median,
.scenario-card.median:hover { border-color: var(--median); }

.scenario-card.pessimiste,
.scenario-card.pessimiste:hover { border-color: var(--pessimiste); }

.scenario-card.optimiste .btn-select { background: var(--optimiste); }
.scenario-card.median .btn-select    { background: var(--median); }
.scenario-card.pessimiste .btn-select { background: var(--pessimiste); }

/* ── Récapitulatif sélection ────────────────────────────────── */
.selection-summary {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.25rem;
	margin-top: 1.5rem;
	text-align: center;
	box-shadow: var(--shadow);
	max-width: 700px;
	margin-inline: auto;
}

.selection-summary h3 {
	font-size: 0.9rem;
	color: var(--text-muted);
	margin-bottom: 1rem;
}

.selection-summary .selection-values {
	display: flex;
	justify-content: center;
	gap: 3rem;
	font-size: 0.9rem;
	margin-bottom: 1rem;
}

.selection-summary .selection-values strong {
	display: block;
	font-size: 1rem;
}

/* ── Boutons ────────────────────────────────────────────────── */
.btn-primary {
	display: inline-block;
	padding: 0.65rem 2rem;
	background: var(--accent);
	color: #fff;
	border: none;
	border-radius: 0.5rem;
	font-weight: 600;
	cursor: pointer;
	font-size: 1rem;
}

.btn-primary:hover {
	background: #0284c7;
	text-decoration: none;
}

.btn-secondary {
	padding: 0.6rem 1.25rem;
	border: 1px solid var(--border);
	border-radius: 0.5rem;
	background: transparent;
	cursor: pointer;
	font-size: 0.9rem;
	color: var(--text);
}

.btn-block {
	display: block;
	width: 100%;
	padding: 0.75rem;
	background: var(--optimiste);
	color: #fff;
	border: none;
	border-radius: 0.5rem;
	font-weight: 600;
	font-size: 1rem;
	cursor: pointer;
	margin-top: 1rem;
	text-align: center;
}

.btn-back-home {
	display: block;
	text-align: center;
	font-size: 0.9rem;
	color: var(--text-muted);
	margin-top: 0.75rem;
}

/* ── Page parcours : navigation ─────────────────────────────── */
.story-nav {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 0.75rem 1.5rem;
	background: var(--card-bg);
	border-bottom: 1px solid var(--border);
}

.story-nav .back-link {
	font-size: 0.9rem;
	color: var(--text);
}

.story-nav .character-badge {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	font-weight: 600;
}

/* ── Onglets scénario ───────────────────────────────────────── */
.scenario-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
	padding: 1rem 1.5rem 0.75rem;
	background: var(--card-bg);
	border-bottom: 1px solid var(--border);
	align-items: center;
	justify-content: center;
}

.scenario-tabs label {
	width: 100%;
	text-align: center;
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-bottom: 0.25rem;
}

.scenario-tabs .hint {
	width: 100%;
	text-align: center;
	font-size: 0.78rem;
	color: var(--text-muted);
	margin-top: 0.25rem;
}

.scenario-tab {
	padding: 0.75rem 1.5rem;
	border: 2px solid var(--border);
	border-radius: 0.5rem;
	text-align: center;
	font-size: 0.9rem;
	cursor: pointer;
	text-decoration: none;
	min-width: 240px;
	transition: background 0.15s, color 0.15s, transform 0.18s ease, box-shadow 0.18s ease;
}

.scenario-tab:hover {
	transform: translateY(-2px);
	box-shadow: 0 6px 16px rgba(0, 0, 0, 0.1);
	text-decoration: none;
}

.scenario-tab .tab-name  { font-weight: 700; }
.scenario-tab .tab-temps { font-size: 0.78rem; margin-top: 0.2rem; }

.scenario-tab.optimiste          { background: #dcfce7; border-color: var(--optimiste); color: var(--optimiste); }
.scenario-tab.median             { background: #fff7ed; border-color: var(--median);    color: var(--median); }
.scenario-tab.pessimiste         { background: #fef2f2; border-color: var(--pessimiste); color: var(--pessimiste); }
.scenario-tab.optimiste.active   { background: var(--optimiste);  border-color: var(--optimiste);  color: #fff; }
.scenario-tab.median.active      { background: var(--median);     border-color: var(--median);     color: #fff; }
.scenario-tab.pessimiste.active  { background: var(--pessimiste); border-color: var(--pessimiste); color: #fff; }

/* ── Layout parcours ────────────────────────────────────────── */
.story-layout {
	display: grid;
	grid-template-columns: 300px 1fr;
	gap: 0;
	min-height: calc(100vh - 60px);
	align-items: start;
}

/* ── Sidebar ────────────────────────────────────────────────── */
.sidebar {
	padding: 2rem 1.5rem;
	background: var(--card-bg);
	border-right: 1px solid var(--border);
	position: sticky;
	top: 0;
	max-height: 100vh;
	overflow-y: auto;
}

.sidebar h2 {
	font-size: 0.95rem;
	font-weight: 700;
	margin-bottom: 1.5rem;
	color: var(--text-muted);
	text-transform: uppercase;
	letter-spacing: 0.05em;
}

/* ── Timeline ───────────────────────────────────────────────── */
.timeline {
	display: flex;
	flex-direction: column;
	gap: 0;
	position: relative;
}

.timeline::before {
	content: "";
	position: absolute;
	left: 17px;
	top: 22px;
	bottom: 22px;
	width: 2px;
	background: var(--border);
	z-index: 0;
}

.timeline-item {
	display: flex;
	align-items: flex-start;
	gap: 0.75rem;
	padding: 0.85rem 0.75rem;
	border-radius: 0.5rem;
	position: relative;
	cursor: pointer;
	transition: background 0.15s;
}

.timeline-item:hover { background: #f8fafc; }

.timeline-item.active {
	background: #eff6ff;
	box-shadow: 0 0 0 1px #bfdbfe;
}

.timeline-item .stage-name {
	font-weight: 600;
	font-size: 0.9rem;
}

.timeline-item .stage-meta {
	font-size: 0.8rem;
	color: var(--text-muted);
}

.timeline-dot {
	width: 12px;
	height: 12px;
	border-radius: 50%;
	border: 2px solid var(--border);
	background: var(--card-bg);
	flex-shrink: 0;
	margin-top: 0.35rem;
	position: relative;
	z-index: 1;
}

.timeline-item.done .timeline-dot   { background: var(--optimiste); border-color: var(--optimiste); }
.timeline-item.active .timeline-dot { background: #3b82f6;          border-color: #3b82f6; }

.badge-en-cours {
	margin-left: auto;
	background: #3b82f6;
	color: #fff;
	font-size: 0.7rem;
	font-weight: 600;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
	white-space: nowrap;
}

/* ── Contenu parcours ───────────────────────────────────────── */
.story-content {
	padding: 2rem 3rem;
	width: 100%;
}

.story-content .stage-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-bottom: 0.25rem;
}

.story-content h2 {
	font-size: 1.5rem;
	font-weight: 700;
}

.story-content .stage-meta {
	font-size: 0.85rem;
	color: var(--text-muted);
	margin-bottom: 1.25rem;
}

/* ── Badge RCP ──────────────────────────────────────────────── */
.rcp-badge {
	font-size: 0.75rem;
	font-weight: 700;
	color: #fff;
	padding: 0.2rem 0.6rem;
	border-radius: 999px;
}

.rcp-badge.rcp-26            { background: var(--optimiste); }
.rcp-badge.rcp-45            { background: var(--median); }
.rcp-badge.rcp-70,
.rcp-badge.rcp-85            { background: var(--pessimiste); }

/* ── Illustration ───────────────────────────────────────────── */
.story-image {
	width: 100%;
	aspect-ratio: 16 / 9;
	object-fit: cover;
	border-radius: var(--radius);
	margin-block: 1rem;
}

/* ── Texte narratif ─────────────────────────────────────────── */
.narrative {
	display: flex;
	flex-direction: column;
	gap: 1rem;
	font-size: 1rem;
}

.narrative p {
	line-height: 1.8;
	text-align: justify;
}

.narrative hr {
	border: none;
	border-top: 1px solid var(--border);
	margin-block: 0.5rem;
}

/* ── Impacts climatiques ────────────────────────────────────── */
.impacts-title {
	font-weight: 600;
	margin-block: 1.5rem 0.75rem;
}

.impacts-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0.75rem;
}

.impact-card {
	background: var(--card-bg);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1.25rem 1rem;
	font-size: 0.85rem;
	box-shadow: var(--shadow);
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 0.5rem;
}

.impact-card > span      { font-size: 2.2rem; }
.impact-card .impact-name { font-weight: 700; }
.impact-card .impact-desc { color: var(--text-muted); }

/* ── Navigation bas de page ─────────────────────────────────── */
.story-nav-bottom {
	display: flex;
	justify-content: space-between;
	padding-block: 1.5rem;
	margin-top: 1.5rem;
	border-top: 1px solid var(--border);
}

/* ── Sources scientifiques ──────────────────────────────────── */
.sources-box {
	background: #f8fafc;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: 1rem 1.25rem;
	margin-top: 1.5rem;
	text-align: left;
	font-size: 0.85rem;
}

.sources-box strong {
	display: block;
	margin-bottom: 0.25rem;
}

/* ── Fin de parcours ────────────────────────────────────────── */
.story-end {
	text-align: center;
	padding: 2rem;
	background: var(--card-bg);
	border-top: 1px solid var(--border);
	border-radius: 0 0 var(--radius) var(--radius);
}

.story-end .checkmark {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: #0ea5e9;
	color: #fff;
	font-size: 1.75rem;
	display: flex;
	align-items: center;
	justify-content: center;
	margin-inline: auto;
	margin-bottom: 1rem;
}

.story-end h3 {
	font-size: 1.1rem;
	font-weight: 700;
	margin-bottom: 0.5rem;
}

.story-end p {
	font-size: 0.9rem;
	color: var(--text-muted);
	max-width: 400px;
	margin-inline: auto;
}

/* ── Styles démo ────────────────────────────────────────────── */
.demo-section {
	margin-block: 3rem 1rem;
	padding-bottom: 0.5rem;
	border-bottom: 2px solid var(--border);
}

.demo-section h2 {
	font-size: 1.4rem;
	font-weight: 700;
	color: var(--text);
	margin-bottom: 0.25rem;
}

.demo-section p {
	font-size: 0.85rem;
	color: var(--text-muted);
}

.demo-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-start;
	margin-top: 1.25rem;
}

.swatch {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 0.4rem;
	font-size: 0.8rem;
	color: var(--text-muted);
}

.swatch-circle {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	border: 1px solid var(--border);
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 768px) {
	.character-grid,
	.scenario-grid  { grid-template-columns: 1fr 1fr; }

	.stats          { flex-wrap: wrap; }

	.story-layout   { grid-template-columns: 1fr; }

	.sidebar {
		position: static;
		max-height: none;
		border-right: none;
		border-bottom: 1px solid var(--border);
	}

	.impacts-grid { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 480px) {
	.character-grid,
	.scenario-grid  { grid-template-columns: 1fr; }

	.scenario-tabs  { flex-direction: column; }

	.stats          { flex-direction: column; align-items: center; }

	.impacts-grid   { grid-template-columns: 1fr; }

	.story-content  { padding: 1.5rem 1rem; }
}
