/* sections/behavior/behavior.css — tout scopé sous #behavior sauf #behavior-tooltip */

#behavior {
  position: relative;
}

/* ── En-tête de section ──────────────────────────────────────────────────── */
#behavior-header {
  width: 100%;
  padding: 4rem 2rem 2rem;
  text-align: center;
  background: #0a0a0a;
}

#behavior-title {
  font-size: clamp(1.8rem, 3vw, 3rem);
  font-weight: 900;
  color: #ffffff;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  border-bottom: 3px solid #9333ea;
  display: inline-block;
  padding-bottom: 0.5rem;
}

#behavior-scroll-container {
  position: relative;
}

/* ── Couche sticky ───────────────────────────────────────────────────────── */
#behavior-sticky {
  position: sticky;
  top: 0;
  height: 100vh;
  overflow: hidden;
}

/* ── Image plein écran ───────────────────────────────────────────────────── */
#behavior-bg {
  position: absolute;
  inset: 0;
  z-index: 0;
}

#behavior-bg-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: opacity 200ms ease;
}

/* ── Zone image + overlay (B1) ───────────────────────────────────────────── */
#behavior-image-zone {
  position: absolute;
  top: 0;
  bottom: 0;
  z-index: 3;
  overflow: hidden;
  pointer-events: none;
}

/* ── Panneaux latéraux ───────────────────────────────────────────────────── */
#behavior-panel-left,
#behavior-panel-right {
  position: absolute;
  top: 0;
  height: 100%;
  width: 30%;
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(2px);
  -webkit-backdrop-filter: blur(2px);
  z-index: 2;
  overflow-y: auto;
  padding: 2.5rem 1.8rem;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
  color: #f0f0f0;
  transition: width 400ms ease, padding 400ms ease, transform 350ms ease-in;
}

#behavior-panel-left  { left: 0; }
#behavior-panel-right { right: 0; }

#behavior-panel-left.slide-out  { transform: translateX(-100vw); }
#behavior-panel-right.slide-out { transform: translateX(100vw); }

#behavior-panel-left.slide-in,
#behavior-panel-right.slide-in {
  transition: transform 350ms ease-out;
}

/* ── Tooltip global (hors sticky) ───────────────────────────────────────── */
#behavior-tooltip {
  position: absolute;
  display: none;
  background: rgba(0, 0, 0, 0.85);
  color: #f0f0f0;
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-size: 0.78rem;
  line-height: 1.5;
  pointer-events: none;
  z-index: 9999;
  border-left: 3px solid #9333ea;
  max-width: 200px;
}

/* ── Scroll driver ───────────────────────────────────────────────────────── */
#behavior-scroll-driver {
  position: relative;
  height: 200vh;
  pointer-events: none;
  opacity: 0;
}

.behavior-step {
  height: 66vh;
}

.behavior-step--last {
  height: 66vh;
  padding-bottom: 10vh;
}

/* ── Typographie panneaux ────────────────────────────────────────────────── */
.behavior-panel-title {
  font-size: 1.2rem;
  font-weight: 700;
  color: #ffffff;
  margin: 0 0 0.5rem;
  line-height: 1.3;
  flex-shrink: 0;
}

.behavior-panel-accroche {
  font-size: 0.82rem;
  color: #cccccc;
  line-height: 1.65;
  margin: 0 0 0.5rem;
  flex-shrink: 1;
}

/* ── Stats grands chiffres ───────────────────────────────────────────────── */
.behavior-stat-big {
  font-size: 2.6rem;
  font-weight: 900;
  color: #9333ea;
  line-height: 1;
  margin-bottom: 0.3rem;
  font-variant-numeric: tabular-nums;
  flex-shrink: 0;
}

.behavior-stat-label {
  font-size: 0.78rem;
  color: #aaaaaa;
  line-height: 1.5;
  margin: 0 0 0.8rem;
  flex-shrink: 1;
}

.behavior-stat-precision {
  font-size: 0.72rem;
  color: #777777;
}

.behavior-stat-secondary {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f0f0f0;
  margin-bottom: 0.2rem;
}

/* ── Grille 2×2 stats contexte ───────────────────────────────────────────── */
.behavior-stat-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  margin-top: 0.2rem;
  flex-shrink: 0;
}

.behavior-stat-grid-item {
  padding: 0.6rem 0.5rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-right: 1px solid rgba(255, 255, 255, 0.1);
}

.behavior-stat-grid-item:nth-child(even) {
  border-right: none;
}

.behavior-stat-grid-item:nth-last-child(-n+2) {
  border-bottom: none;
}

.behavior-stat-grid-picto {
  display: block;
  margin-bottom: 0.2rem;
  line-height: 1;
}

.behavior-stat-grid-value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #9333ea;
  line-height: 1.1;
  margin-bottom: 0.2rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-variant-numeric: tabular-nums;
}

.behavior-stat-grid-label {
  font-size: 0.72rem;
  color: #aaaaaa;
  line-height: 1.4;
}

/* Variante compacte pour frame 2 */
.behavior-stat-grid--compact .behavior-stat-grid-item {
  padding: 0.3rem 0.4rem;
}

.behavior-stat-grid--compact .behavior-stat-grid-value {
  font-size: 1.6rem;
  margin-bottom: 0.1rem;
}

.behavior-stat-grid--compact .behavior-stat-grid-label {
  font-size: 0.7rem;
}

/* ── Citation ────────────────────────────────────────────────────────────── */
.behavior-citation {
  font-style: italic;
  font-size: 0.8rem;
  color: #dddddd;
  border-left: 3px solid #9333ea;
  padding-left: 0.75rem;
  margin: 0 0 0.8rem;
  line-height: 1.6;
  flex-shrink: 1;
}

.behavior-citation-auteur {
  display: block;
  font-style: normal;
  font-size: 0.7rem;
  color: #888888;
  margin-top: 0.35rem;
}

/* ── Donut — wrapper SVG + légende HTML ─────────────────────────────────── */
.behavior-donut-wrapper {
  display: flex;
  align-items: center;
  gap: 1.2rem;
  flex-shrink: 0;
  margin-bottom: 0.4rem;
}

#behavior-donut {
  display: block;
  flex-shrink: 0;
}

.behavior-donut-legend {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  flex: 1;
}

.behavior-donut-legend li {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.72rem;
  color: #cccccc;
  transition: opacity 150ms;
}

.legend-color {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex-shrink: 0;
}

.legend-label {
  flex: 1;
  color: #cccccc;
}

.legend-pct {
  font-weight: 700;
  color: #ffffff;
  min-width: 2.5rem;
  text-align: right;
}

/* ── Navigation graphiques ───────────────────────────────────────────────── */
.behavior-graph-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin: 0.6rem 0 0.3rem;
  flex-shrink: 0;
}

.behavior-graph-nav button {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  cursor: pointer;
  font-size: 1.1rem;
  line-height: 1;
  transition: background 150ms;
  display: flex;
  align-items: center;
  justify-content: center;
}

.behavior-graph-nav button:hover {
  background: #9333ea;
  border-color: #9333ea;
}

.behavior-graph-counter {
  font-size: 0.78rem;
  color: #888888;
}

/* ── Wrapper graphiques ──────────────────────────────────────────────────── */
.behavior-graph-wrapper {
  overflow: hidden;   /* hidden pour masquer le graphique off-screen */
  flex: 1;
  min-height: 0;
  width: 100%;
  position: relative;
  display: flex;
  flex-direction: column;
}

.behavior-graph-slide {
  display: flex;
  height: 100%;
  transition: transform 300ms ease-in-out;
}

.behavior-graph-item {
  min-width: 100%;
  flex-shrink: 0;
  overflow: visible;  /* visible ici pour que SVG puisse déborder */
  clip-path: none !important;
  display: flex;
  flex-direction: column;
}

.behavior-graph-item svg {
  overflow: visible !important;
  clip-path: none !important;
  display: block;
  flex: 1;
  min-height: 0;
}

.behavior-chart-title {
  font-size: 0.76rem;
  color: #aaaaaa;
  margin: 0 0 0.1rem;
  font-weight: 600;
}

.behavior-chart-subtitle {
  font-size: 0.68rem;
  color: #666666;
  margin: 0 0 0.3rem;
  font-style: italic;
}

/* ── D3 — grille et axes ─────────────────────────────────────────────────── */
#behavior .behavior-grid line {
  stroke: rgba(255, 255, 255, 0.07);
  stroke-dasharray: 3 3;
}

#behavior .tick text {
  fill: #777777;
  font-size: 11px;
}

#behavior .domain {
  display: none;
}

/* ── Cause 1 : D3 pose fill="none" sur le groupe — forcer les textes ────── */
#behavior-panel-right g.behavior-axis-y text,
#behavior-panel-right g.behavior-axis-x text {
  fill: #cccccc !important;
  font-family: 'SUSE', sans-serif !important;
  font-size: 0.7rem !important;
}

#behavior-panel-right g.behavior-axis-x text {
  font-size: 0.72rem !important;
}

/* ── Axes X/Y visibles (bar + line chart) ────────────────────────── */
#behavior .behavior-axis-x .domain {
  display: block;
}

#behavior .behavior-axis-x path,
#behavior .behavior-axis-y path,
#behavior .behavior-axis-x line,
#behavior .behavior-axis-y line {
  stroke: rgba(255, 255, 255, 0.2);
}

#behavior .behavior-axis-y text {
  fill: #cccccc;
  font-family: 'SUSE', sans-serif;
  font-size: 0.68rem;
}

/* ── Overlay : inset:0 relatif à #behavior-image-zone ───────────── */
#behavior-compare-overlay {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms ease;
}

#behavior-compare-overlay.is-visible {
  opacity: 1;
}

#behavior-compare-content {
  background: rgba(0, 0, 0, 0.82);
  backdrop-filter: blur(8px);
  border-radius: 0;
  padding: 2rem 1.5rem;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.8rem;
  border-left: 3px solid #9333ea;
  border-right: 3px solid #9333ea;
  box-sizing: border-box;
}

#behavior-compare-text {
  font-family: 'SUSE', sans-serif;
  font-size: 1rem;
  color: #ffffff;
  line-height: 1.6;
  text-align: center;
  margin: 0;
}

/* Mots en gras toujours en violet */
#behavior-compare-overlay strong,
#behavior-compare-content strong {
  color: #9333ea;
  font-weight: 700;
}

/* ── B2/B3 — Zones visuelles panneau pollution ───────────────────── */
.behavior-panel-zone {
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.behavior-panel-zone:last-child {
  border-bottom: none;
}

.behavior-pollution-headline {
  font-size: 3rem;
  font-weight: 900;
  color: #9333ea;
  line-height: 1;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
  margin-top: 0.3rem;
  margin-bottom: 0.2rem;
}

/* ── B3 — Panneau explicatif (hover pollution → panneau droit) ───── */
.behavior-explanation-panel {
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  gap: 0.75rem;
}

.behavior-explanation-panel strong {
  color: #9333ea;
}

.behavior-explanation-title {
  font-size: 1.4rem;
  font-weight: 900;
  color: #ffffff;
  line-height: 1.2;
  margin: 0;
}

.behavior-explanation-body {
  font-size: 0.85rem;
  color: #cccccc;
  line-height: 1.7;
  margin: 0;
}

.behavior-explanation-source {
  font-size: 0.7rem;
  color: #555555;
  font-style: italic;
  margin-top: auto;
}

/* ── B2 — Ligne de base graphiques ──────────────────────────────── */
.behavior-axis-baseline {
  stroke: rgba(255, 255, 255, 0.35);
  stroke-width: 1.5;
}

/* Axes visibles */
.behavior-axis-x path,
.behavior-axis-y path,
.behavior-axis-x line,
.behavior-axis-y line {
  stroke: rgba(255, 255, 255, 0.2);
}

.behavior-axis-x text,
.behavior-axis-y text {
  fill: #cccccc;
  font-family: 'SUSE', sans-serif;
  font-size: 0.7rem;
}

/* Graphiques non-clippés */
.behavior-graph-item svg,
.behavior-graph-item {
  overflow: visible !important;
}

/* ── B3 — Donut callout labels ───────────────────────────────────── */
.donut-callout-label {
  font-size: 0.9rem;
  font-family: 'SUSE', sans-serif;
}

/* ── B4 — Sources dans les comparaisons hover ────────────────────── */
.behavior-hover-source {
  display: block;
  font-size: 0.7rem;
  color: #777777;
  font-style: italic;
  font-family: 'SUSE', sans-serif;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  padding-top: 0.5rem;
  margin-top: 0.5rem;
}
