/* ── Variables ─────────────────────────────────────────── */
:root {
  --blue:        #5B88FF;
  --blue-dark:   #4370e8;
  --bg-light:    #F8F9F9;
  --border:      #E2E4E6;
  --text:        #111111;
  --text-muted:  #6B7280;
  --white:       #ffffff;
  --radius:      10px;
  --shadow-sm:   0 1px 4px rgba(0,0,0,.07);
  --shadow-md:   0 4px 16px rgba(0,0,0,.10);
  --transition:  0.18s ease;
}

/* ── Reset & base ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: "Inter", sans-serif;
  color: var(--text);
  background: var(--white);
  -webkit-font-smoothing: antialiased;
}

a { text-decoration: none; color: inherit; }

/* ── Typography ────────────────────────────────────────── */
h1 {
  font-size: 1.875em;   /* 30px — standard titre de page de contenu */
  font-weight: 800;
  line-height: 1.2;
  margin: 0 0 .5em;
}
h2 {
  font-size: 1.25em;    /* 20px */
  font-weight: 600;
  line-height: 1.3;
  margin: 0 0 .4em;
}
h3 {
  font-size: 1.0625em;  /* 17px — clairement au-dessus du corps */
  font-weight: 600;
  margin: 0 0 .4em;
}
p {
  font-size: .9375em;   /* 15px — confortable, légèrement sous h3 */
  line-height: 1.75;
  color: var(--text);
  margin: 0 0 .8em;
}
h5 {
  font-size: .8125em;   /* 13px */
  font-weight: 400;
  color: var(--text-muted);
  margin: 0;
}
h6 {
  font-size: .8125em;   /* 13px */
  font-weight: 400;
  color: var(--white);
  margin: 0 0 .35em;
}

/* ── Header ────────────────────────────────────────────── */
header {
  position: sticky;
  top: 0;
  z-index: 100;
  background: var(--white);
  border-bottom: 1px solid var(--border);
  height: 64px;
  display: flex;
  justify-content: center;
  align-items: center;
}

.header-container1 {
  width: min(86%, 1100px);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 24px;
}

.logo-header {
  font-size: .875em;    /* 14px — deux lignes compactes dans le header */
  font-weight: 800;
  color: var(--text);
  line-height: 1.25;
  flex-shrink: 0;
  letter-spacing: -.01em;
}
.logo-header:hover { color: var(--blue); transition: color var(--transition); }

.header-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  margin-left: auto;
}

.nav-link {
  font-size: .875em;    /* 14px — standard nav pro */
  font-weight: 500;
  color: var(--text-muted);
  transition: color var(--transition);
  white-space: nowrap;
}
.nav-link:hover { color: var(--text); }

.box-flag {
  height: 22px;
  border-radius: 3px;
  opacity: .85;
  transition: opacity var(--transition);
}
.box-flag:hover { opacity: 1; }

/* ── Buttons ───────────────────────────────────────────── */
.btn-primary {
  display: inline-block;
  background: var(--blue);
  color: var(--white);
  font-size: .875em;    /* 14px */
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius);
  transition: background var(--transition), transform var(--transition);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.btn-primary:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

.btn-secondary {
  display: inline-block;
  background: transparent;
  color: var(--text);
  font-size: .875em;    /* 14px */
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.nav-icon-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius);
  transition: background var(--transition);
  flex-shrink: 0;
}
.nav-icon-link:hover { background: var(--bg-light); }

.btn-secondary:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-1px);
}

.btn-danger {
  display: inline-block;
  background: #EF4444;
  color: var(--white);
  font-size: .875em;    /* 14px */
  font-weight: 600;
  padding: 10px 22px;
  border-radius: var(--radius);
  border: none;
  transition: background var(--transition), transform var(--transition);
  cursor: pointer;
  text-align: center;
  white-space: nowrap;
}
.btn-danger:hover {
  background: #DC2626;
  transform: translateY(-1px);
}

/* ── Footer ────────────────────────────────────────────── */
footer {
  background: var(--blue);
  width: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 80px;
}

.footer-container {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  width: min(86%, 1100px);
  padding: 48px 0 56px;
  gap: 40px;
}

.logo-footer {
  font-size: 1em;       /* 16px — cohérent avec logo-header */
  font-weight: 800;
  color: var(--white);
  line-height: 1.2;
  letter-spacing: -.01em;
}

.footer-col h6.section-title {
  text-decoration: underline;
  text-underline-offset: 3px;
  font-weight: 600;
  margin-bottom: .7em;
}

.footer-col h6 { margin-bottom: .4em; }
.footer-col a h6 { transition: opacity var(--transition); }
.footer-col a h6:hover { opacity: .75; }

.footer-account-link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: opacity var(--transition);
}
.footer-account-link:hover { opacity: .75; }
.footer-account-link h6 { margin-bottom: 0; }
.footer-account-icon { width: 14px; height: 14px; flex-shrink: 0; }

.footer-bottom {
  width: min(86%, 1100px);
  border-top: 1px solid rgba(255,255,255,.2);
  padding: 20px 0 32px;
  margin: 0 auto;
}

.footer-copyright {
  font-size: .75em;
  color: rgba(255,255,255,.65);
  margin: 0;
}

/* ── Page layout helpers ───────────────────────────────── */
.body-container1 {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
}

/* Hero – home */
.body-container-home {
  width: min(86%, 1100px);
  min-height: 78vh;
  display: flex;
  align-items: center;
}

/* Visual index */
.body-container-visual {
  width: min(86%, 1100px);
  padding: 60px 0 40px;
  display: flex;
  align-items: flex-start;
  flex-direction: column;
}

/* Content pages (budget, primal, dual…) */
.body-container {
  display: flex;
  justify-content: center;
  align-items: flex-start;
  width: 100%;
}

.bce {
  width: min(86%, 1100px);
  display: flex;
  flex-direction: column;
  padding-bottom: 60px;
}

.bce1 {
  margin: 40px 0 24px;
}

/* ── Visualisation card ────────────────────────────────── */
.bce2 {
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  flex-direction: column;
  background: var(--bg-light);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  padding: 28px 32px 36px;
  box-shadow: var(--shadow-sm);
}

.bce2-titre {
  width: 100%;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  margin-bottom: 24px;
  text-decoration: none;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* ── Viz expand button ─────────────────────────────────── */
.viz-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 6px;
  border: 1.5px solid var(--border);
  color: var(--text-muted);
  background: var(--white);
  flex-shrink: 0;
  transition: border-color var(--transition), color var(--transition), background var(--transition);
}
.viz-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  background: #eff6ff;
}

.bce21 {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 32px;
}

/* Chart column */
.box1-ce {
  width: 62%;
  display: flex;
  flex-direction: column;
}

/* Controls column */
.box2-ce {
  width: 34%;
  display: flex;
  flex-direction: column;
  gap: 24px;
}
.box21-ce, .box22-ce { width: 100%; }

/* ── Chart legend ──────────────────────────────────────── */
.legend-chart {
  display: flex;
  gap: 28px;
  margin-top: 12px;
}
.legend-chart-title1,
.legend-chart-title2 {
  display: flex;
  align-items: center;
  gap: 8px;
}
.legend-chart-line1 {
  width: 22px;
  border-top: 3px solid #e74c3c;
  display: inline-block;
}
.legend-chart-line2 {
  width: 22px;
  border-top: 3px solid var(--blue);
  display: inline-block;
}

/* ── Sliders ───────────────────────────────────────────── */
input[type="range"] {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  background: #E0E2E5;
  border-radius: 2px;
  outline: none;
  margin: 8px 0 4px;
  cursor: pointer;
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  background: var(--blue);
  border: 3px solid var(--white);
  border-radius: 50%;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(91,136,255,.35);
  transition: transform var(--transition);
}
input[type="range"]::-webkit-slider-thumb:hover { transform: scale(1.2); }

.label-val { font-weight: 600; }

/* ── Status banner ─────────────────────────────────────── */
.status-banner {
  font-weight: 600;
  font-size: .9em;
  padding: 10px 14px;
  border-radius: 6px;
  margin-bottom: 12px;
  text-align: center;
  transition: background var(--transition), color var(--transition);
}

.income-control { width: 100%; }

/* ── Navigation actions ────────────────────────────────── */
.bce-end {
  display: flex;
  justify-content: flex-end;
  align-items: center;
  margin-top: 36px;
}

.suivant {
  background: var(--blue);
  color: var(--white);
  font-size: .875em;    /* 14px */
  font-weight: 600;
  border-radius: var(--radius);
  padding: 14px 28px;
  transition: background var(--transition), transform var(--transition);
}
.suivant:hover {
  background: var(--blue-dark);
  transform: translateY(-1px);
}

/* ── Breadcrumb ────────────────────────────────────────── */
.ariane {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: .85em;
  color: var(--text-muted);
  font-style: normal;
  margin-top: 28px;
  transition: color var(--transition);
}
.ariane:hover { color: var(--blue); }

/* ── Visual index – topic list ─────────────────────────── */
.visual-section { margin-bottom: 40px; }

.visual-items {
  list-style: none;
  padding: 0;
  margin: 8px 0 0 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.visual-item-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 16px;
  min-height: 52px;
  border-radius: 8px;
  border: 1px solid var(--border);
  background: var(--white);
  font-size: 1em;
  font-weight: 500;
  color: var(--text);
  transition: border-color var(--transition), color var(--transition), box-shadow var(--transition);
}
.visual-item-link:hover {
  border-color: var(--blue);
  color: var(--blue);
  box-shadow: var(--shadow-sm);
}
.visual-item-link::after {
  content: "→";
  margin-left: auto;
  color: var(--text-muted);
  font-size: .95em;
}

/* ── Home ──────────────────────────────────────────────── */
.main-title {
  font-size: clamp(1.875em, 4vw, 2.75em); /* 30–44px selon viewport */
  font-weight: 800;
  line-height: 1.15;
  margin-bottom: 1.2em;
}
.sub-title {
  font-size: 1.05em;
  color: var(--text-muted);
  max-width: 520px;
  margin-bottom: 2em;
}
.bouton-home {
  display: flex;
  gap: 14px;
}

/* ── D3 chart styles ───────────────────────────────────── */
.budget-line      { stroke: #e74c3c; stroke-width: 2.5; }
.indifference-curve { stroke: var(--blue); stroke-width: 3; fill: none; }
.eq-point         { fill: #27ae60; stroke: var(--white); stroke-width: 2.5; }
.proj             { stroke: #27ae60; stroke-width: 1.5; stroke-dasharray: 5,4; }

/* ── Underline utility ─────────────────────────────────── */
.underline { text-decoration: underline; text-underline-offset: 3px; }

/* ── Responsive — tablette paysage / demi-écran (≤ 900px) */
@media (max-width: 900px) {
  /* Empilement vertical de la zone visualisation */
  .bce21 { flex-direction: column; gap: 24px; }
  .box1-ce,
  .box2-ce { width: 100%; }
}

/* ── Responsive — tablette portrait (≤ 768px) ─────────── */
@media (max-width: 768px) {
  /* Hub cards en colonne unique */
  .hub-grid { grid-template-columns: 1fr; }

  /* Footer en grille souple */
  .footer-container {
    flex-wrap: wrap;
    gap: 24px;
    width: 90%;
    padding: 36px 0 44px;
  }
}

/* ── Responsive — mobile (≤ 600px) ────────────────────── */
@media (max-width: 600px) {
  header { height: 56px; }

  .header-container1 { width: 94%; gap: 10px; }
  .header-nav { gap: 12px; }
  /* Masquer les liens texte, garder drapeau + bouton Explorer */
  .nav-link { display: none; }

  .body-container-home,
  .body-container-visual { width: 94%; min-height: 60vh; padding: 28px 0; }

  .bce { width: 94%; }

  .main-title { font-size: 1.625em; }
  .sub-title  { font-size: .9375em; }

  .bouton-home { flex-direction: column; gap: 10px; }
  .bouton-home .btn-primary,
  .bouton-home .btn-secondary { width: 100%; text-align: center; }

  /* Boutons du header : compacts, jamais en pleine largeur */
  .header-nav .btn-primary,
  .header-nav .btn-secondary {
    padding: 6px 10px;
    font-size: .75em;
    white-space: nowrap;
    flex-shrink: 0;
  }
  .header-nav { gap: 8px; }

  .bce2 { padding: 18px 14px 24px; }
  .bce2-titre { font-size: 1.05em; }

  .legend-chart { flex-wrap: wrap; gap: 10px; }

  .footer-container { flex-direction: column; width: 90%; }
}

/* ── Home – section visualisations ────────────────────── */
.home-explore {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 220px 0 340px;
}

.home-explore-inner {
  width: min(86%, 1100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home-explore-header {
  margin-bottom: 40px;
}

.home-explore-header h2 {
  font-size: clamp(1.375em, 2.5vw, 1.875em);
  font-weight: 800;
  margin-bottom: .35em;
}

.home-explore-header p {
  color: var(--text-muted);
  margin: 0;
}

.home-topic-insert {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  justify-content: center;
}

.home-topic-btn {
  display: inline-block;
  padding: 14px 32px;
  border-radius: var(--radius);
  border: 1.5px solid var(--border);
  font-size: .9375em;
  font-weight: 600;
  color: var(--text);
  transition: border-color var(--transition), color var(--transition), transform var(--transition);
}

.home-topic-btn:hover {
  border-color: var(--blue);
  color: var(--blue);
  transform: translateY(-2px);
}

.home-topic-random {
  margin-top: 16px;
  display: flex;
  justify-content: center;
}

.home-topic-btn--random {
  background: var(--blue);
  color: var(--white);
  border-color: var(--blue);
  cursor: pointer;
  font-family: inherit;
}

.home-topic-btn--random:hover {
  background: var(--blue-dark);
  border-color: var(--blue-dark);
  color: var(--white);
}

@media (max-width: 600px) {
  .home-explore { padding: 80px 0 100px; }
  .home-explore-inner { width: 94%; }
  .home-topic-insert { flex-direction: column; align-items: stretch; }
  .home-topic-btn { text-align: center; }
}

/* ── D3 chart shared (pages visualisation) ─────────────── */
.param-section { margin-bottom: 18px; }
.grid line { stroke: #f0f1f2; stroke-width: 1; }
.grid .domain { display: none; }
.eq-display {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  text-align: center;
  font-size: 1.05em;
  margin-top: 8px;
}

/* ── Info / equilibre boxes ────────────────────────────── */
.info-box, .equilibre-box {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 14px 18px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 8px;
}
.info-row, .eq-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}
.info-label, .eq-label { font-size: .875em; color: var(--text-muted); }
.info-value { font-size: 1em; font-weight: 700; color: var(--text); }
.eq-value { font-size: 1.05em; font-weight: 700; color: var(--text); }
.eq-delta { font-size: .8em; font-weight: 600; padding: 2px 7px; border-radius: 4px; white-space: nowrap; }
.eq-delta.pos { background: #d1fae5; color: #065f46; }
.eq-delta.neg { background: #fee2e2; color: #991b1b; }
.eq-delta.neu { background: var(--bg-light); color: var(--text-muted); }

/* ── Home – audience section ───────────────────────────── */
.home-audience {
  width: 100%;
  display: flex;
  justify-content: center;
  padding: 48px 0;
  margin-top: calc(6vh - 64px);
}

.home-audience-inner {
  width: min(86%, 1100px);
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.home-audience-label {
  font-size: .7em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--blue);
  margin: 0 0 10px;
}

.home-audience-title {
  font-size: 1.25em;
  font-weight: 700;
  margin: 0 0 .4em;
}

.home-audience-sub {
  font-size: .875em;
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 0 1.4em;
}

.home-audience-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: center;
}

.audience-badge {
  display: inline-block;
  padding: 5px 14px;
  border-radius: 999px;
  font-size: .8125em;
  font-weight: 500;
  background: var(--bg-light);
  border: 1px solid var(--border);
  color: var(--text);
}

.audience-badge--blue {
  background: var(--bg-light);
  border-color: var(--border);
  color: var(--text);
}

.home-audience-about {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 64px;
  padding-bottom: 24px;
  border-bottom: 1px solid var(--border);
  text-align: left;
}

.home-audience-about-text {
  font-size: .875em;
  color: var(--text-muted);
  margin: 0;
  max-width: 640px;
}

.home-audience-about-link {
  font-size: .875em;
  font-weight: 600;
  color: var(--blue);
  white-space: nowrap;
  text-decoration: none;
}

.home-audience-about-link:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .home-audience { padding: 32px 0; }
  .home-audience-inner { width: 88%; }
  .home-audience-about { flex-direction: column; align-items: flex-start; gap: 12px; }
}

/* ── Article layout with sidebar ──────────────────────── */
.article-layout {
  display: flex;
  gap: 32px;
  align-items: flex-start;
}

.article-main {
  flex: 1;
  min-width: 0;
}

.article-sidebar {
  width: 196px;
  flex-shrink: 0;
  position: sticky;
  top: 84px;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.sidebar-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
}

.sidebar-card-title {
  font-size: .75em;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-muted);
  margin: 0 0 12px;
}

.sidebar-card-item {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 8px 0;
  border-bottom: 1px solid var(--border);
}

.sidebar-card-item--last {
  border-bottom: none;
  padding-bottom: 0;
}

.sidebar-card-num {
  font-size: .75em;
  font-weight: 600;
  color: var(--blue);
  flex-shrink: 0;
  margin-top: 2px;
}

.sidebar-card-link {
  font-size: .8125em;
  color: var(--text);
  line-height: 1.4;
  transition: color var(--transition);
}

.sidebar-card-link:hover { color: var(--blue); }

.sidebar-cta-actions {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
}

.sidebar-cta-btn {
  width: 100%;
  padding: 8px 12px;
  font-size: .8125em;
}

.article-cta-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 24px;
}

.article-cta-card .sidebar-card-title {
  margin: 0;
}

.article-cta-card .sidebar-cta-actions {
  flex-direction: row;
  margin-top: 0;
}

.article-cta-card .sidebar-cta-btn {
  width: auto;
}

@media (max-width: 480px) {
  .article-cta-card { flex-direction: column; align-items: flex-start; }
  .article-cta-card .sidebar-cta-actions { flex-direction: column; width: 100%; }
  .article-cta-card .sidebar-cta-btn { width: 100%; }
}

@media (max-width: 1100px) {
  .article-sidebar { display: none; }
}

@media (min-width: 1101px) {
  .article-cta-card--mobile { display: none; }
}

/* ── Open economy / promo banner ───────────────────────── */
.open-economy-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  background: var(--blue);
  border-radius: var(--radius);
  padding: 14px 20px;
  margin-top: 20px;
}
.open-economy-banner-text { color: #fff; font-size: .9375em; font-weight: 500; }
.open-economy-banner-btn {
  background: #fff;
  color: var(--blue);
  font-size: .875em;
  font-weight: 600;
  padding: 8px 18px;
  border-radius: 8px;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background var(--transition);
}
.open-economy-banner-btn:hover { background: rgba(255,255,255,.88); }
