/* ═══════════════════════════════════════════════════════════════════
   LIÈGE INSIDE — CONSTELLATION (styles)
   Feuille propre à constellation.php. La page ne charge PAS site.css,
   mais suit la DA « Relevé » (gris + Archivo + IBM Plex Mono + accent
   orange unique). Le graphe est monochrome : les catégories se lisent à
   la taille et au remplissage (lieu plein / œuvre plein neutre / tag creux).
   Layout en colonne : <header> · #graph-controls · #stage (le graphe
   vit dans un conteneur bordé, les nœuds y sont confinés par le JS).
   ═══════════════════════════════════════════════════════════════════ */

/* ── Palette « Relevé » monochrome (REL.2026) — un seul accent : orange.
   Catégories du graphe distinguées par taille + style de remplissage :
   lieu = disque orange plein · œuvre = disque neutre plein · tag = anneau creux. */
:root {
  --bg:             #18181B;
  --surface:        #18181B;
  --ochre:          #FF4D00;   /* accent unique */
  --ochre-dim:      #FF6A2B;
  --ochre-faint:    rgba(255,77,0,0.10);
  --emerald:        #B2B4AE;   /* nœud œuvre → neutre clair (plein) */
  --emerald-light:  #ECEDEA;   /* (labels œuvre, override plus bas en neutre) */
  --emerald-dim:    rgba(236,237,234,0.26);  /* liens similarité → neutre */
  --tag-color:      #7C7E77;   /* nœud tag → anneau creux (cf. .node.tag) */
  --tag-light:      #7C7E77;   /* labels tag */
  --tag-dim:        rgba(236,237,234,0.16);  /* liens tag → neutre faible */
  --text-primary:   #ECEDEA;
  --text-secondary: #B2B4AE;
  --text-muted:     #7C7E77;
  --border:         rgba(236,237,234,0.14);
  --border-warm:    rgba(236,237,234,0.24);
  --serif-display:  'Archivo', sans-serif;
  --mono:           'IBM Plex Mono', 'Courier New', monospace;
  --link-bg:        rgba(24,24,27,0.7);
}

/* ── Thème clair — parchemin ──
   Le graphe garde ses accents chromatiques (ochre/emerald/tag) ;
   seules les valeurs de fond/texte s'inversent. Les labels sur
   fond cream passent à des teintes plus sombres pour rester lisibles. */
[data-theme="light"] {
  --bg:             #ECEDEA;
  --surface:        #ECEDEA;
  --ochre:          #FF4D00;
  --ochre-dim:      #CC3D00;
  --ochre-faint:    rgba(255,77,0,0.07);
  --emerald:        #2C2F2C;   /* nœud œuvre → encre neutre (plein) */
  --emerald-light:  #15171A;   /* (labels œuvre, override plus bas en neutre) */
  --emerald-dim:    rgba(21,23,26,0.28);   /* liens similarité → neutre */
  --tag-color:      #7A7D76;   /* nœud tag → anneau creux */
  --tag-light:      #7A7D76;   /* labels tag */
  --tag-dim:        rgba(21,23,26,0.18);   /* liens tag → neutre faible */
  --text-primary:   #15171A;
  --text-secondary: #2C2F2C;
  --text-muted:     #7A7D76;
  --border:         rgba(21,23,26,0.16);
  --border-warm:    rgba(21,23,26,0.26);
  --link-bg:        rgba(236,237,234,0.78);
}

* { box-sizing: border-box; }
/* Relevé : aucun arrondi (sauf les pastilles circulaires de la légende). */
* { border-radius: 0 !important; }
#legend .dot { border-radius: 50% !important; }
html, body { margin: 0; padding: 0; height: 100%; overflow: hidden; }
body {
  background: var(--bg);
  color: var(--text-primary);
  font-family: var(--mono);
  display: flex;
  flex-direction: column;
}

/* ═══════════════════════════════════════════════════════════════════
   HEADER — même structure que index.php / lieu.php (header-top, rule,
   meta), paddings légèrement réduits pour laisser la place au graphe.
   ═══════════════════════════════════════════════════════════════════ */
header {
  flex: none;
  padding: 24px 38px 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: relative;
  z-index: 5;
}
header::after {
  content: '';
  position: absolute;
  bottom: -1px;
  left: 0; right: 0;
  height: 1px;
  background: linear-gradient(to right, transparent 0%, var(--ochre-dim) 30%, var(--ochre-dim) 70%, transparent 100%);
  opacity: 0.40;
}
.header-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  min-width: 0;
  margin-bottom: 12px;
}
header h1 {
  margin: 0;
  font-family: var(--serif-display);
  font-size: 32px;
  font-weight: 800;
  font-style: normal;
  letter-spacing: -0.01em;
  color: var(--text-primary);
  line-height: 1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
header h1 span { color: var(--ochre); font-style: normal; }
.header-rule {
  width: 100%;
  height: 1px;
  background: linear-gradient(to right, var(--border-warm) 0%, var(--border) 100%);
  margin-bottom: 11px;
}
.header-meta {
  display: flex;
  align-items: baseline;
  gap: 20px;
  flex-wrap: wrap;
  min-width: 0;
}
.header-museum {
  font-family: var(--serif-display);
  font-size: 16px;
  font-weight: 500;
  color: var(--ochre);
  letter-spacing: 0.08em;
  font-variant: small-caps;
  white-space: nowrap;
}
.header-stats {
  font-family: var(--mono);
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
}
.header-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}
#lang-btn, #theme-btn {
  font-family: var(--mono);
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.12em;
  color: var(--text-secondary);
  background: transparent;
  border: 1px solid var(--border-warm);
  padding: 5px 13px;
  border-radius: 2px;
  cursor: pointer;
  transition: all 0.2s;
  flex-shrink: 0;
}
#lang-btn:hover, #theme-btn:hover {
  border-color: var(--ochre-dim);
  color: var(--ochre);
}
#theme-btn {
  padding: 5px 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
#theme-btn svg {
  width: 14px;
  height: 14px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* ═══════════════════════════════════════════════════════════════════
   CONTRÔLES — barres de chips sous le header.
   ═══════════════════════════════════════════════════════════════════ */
#graph-controls {
  flex: none;
  padding: 10px 38px 12px;
  display: flex;
  flex-direction: column;
  gap: 7px;
}
#filters, #label-toggles {
  display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center;
}
.flabel {
  font-size: 9px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted); margin-right: 4px;
}
.filter-chip, .label-toggle, .spacing-btn, .depth-btn, .zoom-btn {
  background: transparent;
  border: 1px solid var(--ochre-dim);
  color: var(--text-muted);
  padding: 4px 9px;
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  border-radius: 2px;
  cursor: pointer;
  font-family: var(--mono);
  transition: background 0.15s, color 0.15s, border-color 0.15s, opacity 0.15s;
}
.filter-chip:hover, .label-toggle:hover, .spacing-btn:hover, .depth-btn:hover, .zoom-btn:hover { color: var(--ochre); border-color: var(--ochre); }
.filter-chip.active {
  background: var(--ochre-faint);
  color: var(--ochre);
  border-color: var(--ochre);
}
.filter-chip:not(.active) { opacity: 0.6; }
.filter-chip .cnt { opacity: 0.55; margin-left: 4px; font-size: 8px; }
.filter-chip.view-mode {
  border-color: var(--ochre-dim);
  color: var(--ochre);
}
.filter-chip.view-mode.active {
  background: rgba(255,77,0,0.16);
  color: var(--text-primary);
  border-color: var(--ochre);
}

/* Chip "lieu" — même accent orange unique (DA Relevé monochrome) */
.filter-chip.filter-lieu { border-color: var(--ochre-dim); }
.filter-chip.filter-lieu.active {
  background: rgba(255,77,0,0.20);
  color: var(--text-primary);
  border-color: var(--ochre);
}
.filter-sep {
  width: 1px; height: 14px; background: var(--border-warm); opacity: 0.8;
  margin: 0 2px;
}

/* Toggles labels — bordures neutres, état actif en orange unique */
.label-toggle.tg-lieu   { border-color: var(--border-warm); }
.label-toggle.tg-oeuvre { border-color: var(--border-warm); }
.label-toggle.tg-tag    { border-color: var(--border-warm); }
.label-toggle.tg-lieu.active   { background: var(--ochre-faint); color: var(--ochre); border-color: var(--ochre); }
.label-toggle.tg-oeuvre.active { background: var(--ochre-faint); color: var(--ochre); border-color: var(--ochre); }
.label-toggle.tg-tag.active    { background: var(--ochre-faint); color: var(--ochre); border-color: var(--ochre); }
.label-toggle:not(.active) { opacity: 0.55; }
.spacing-btn, .depth-btn, .zoom-btn {
  width: 26px;
  height: 24px;
  padding: 0;
  font-size: 12px;
  line-height: 1;
}
.spacing-btn:disabled, .depth-btn:disabled, .zoom-btn:disabled {
  opacity: 0.35;
  cursor: default;
}
#zoom-value {
  min-width: 44px;
  color: var(--text-secondary);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-align: center;
}
#spacing-value, #depth-value {
  min-width: 54px;
  color: var(--text-secondary);
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

/* ═══════════════════════════════════════════════════════════════════
   STAGE — le conteneur bordé du graphe. Les overlays (panneau focus,
   légende, hint) vivent DANS le cadre, le SVG remplit tout.
   ═══════════════════════════════════════════════════════════════════ */
#stage {
  flex: 1;
  position: relative;
  margin: 0 38px 18px;
  border: 1px solid var(--border-warm);
  border-radius: 3px;
  overflow: hidden;
  min-height: 0;
  background:
    radial-gradient(ellipse 90% 70% at 50% 38%, var(--ochre-faint), transparent 70%),
    var(--bg);
}
#stage svg {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
#stage svg:active { cursor: grabbing; }

/* Panneau de feedback du focus — coin haut-droit du stage. */
#focus-panel {
  position: absolute;
  top: 14px; right: 16px;
  max-width: 380px;
  z-index: 12;
  text-align: right;
  pointer-events: none;
  opacity: 0;
  transform: translateX(8px);
  transition: opacity 0.25s, transform 0.25s;
}
#focus-panel.visible {
  opacity: 1;
  transform: translateX(0);
}
.focus-feedback {
  pointer-events: none;
  user-select: none;
}
.focus-feedback .focus-type {
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--text-muted);
  display: block;
  margin-bottom: 4px;
}
.focus-feedback .focus-label {
  font-family: var(--serif-display);
  font-style: normal;
  font-weight: 800;
  font-size: 22px;
  line-height: 1.2;
  color: var(--ochre);
  display: block;
}
.focus-actions {
  margin-top: 12px;
  display: flex;
  gap: 6px;
  justify-content: flex-end;
  flex-wrap: wrap;
  pointer-events: auto;
}
.focus-link {
  color: var(--ochre);
  text-decoration: none;
  background: var(--link-bg);
  border: 1px solid var(--ochre-dim);
  padding: 4px 10px;
  border-radius: 2px;
  font-size: 9px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  font-family: var(--mono);
  cursor: pointer;
  transition: all 0.15s;
}
.focus-link:hover {
  background: rgba(255,77,0,0.14);
  color: var(--ochre);
  border-color: var(--ochre);
}

/* Mode courant, en filigrane au-dessus de la légende quand pas de focus. */
#legend {
  position: absolute; bottom: 12px; left: 16px; z-index: 10;
  font-size: 10px; letter-spacing: 0.12em; color: var(--text-secondary);
  display: flex; gap: 22px; align-items: center; pointer-events: none;
  text-transform: uppercase; flex-wrap: wrap;
}
#legend .item { display: flex; align-items: center; gap: 8px; }
#legend .dot { width: 10px; height: 10px; border-radius: 50%; }
#legend .dot.lieu   { background: var(--ochre); box-shadow: 0 0 10px rgba(255,77,0,0.6); }
#legend .dot.oeuvre { background: var(--emerald); }
#legend .dot.tag    { background: transparent; border: 1.5px solid var(--tag-color); }

#hint {
  position: absolute; bottom: 12px; right: 16px; z-index: 10;
  font-size: 9px; letter-spacing: 0.18em; color: var(--text-muted);
  text-transform: uppercase; pointer-events: none;
  max-width: 46%;
  text-align: right;
}

/* ═══════════════════════════════════════════════════════════════════
   GRAPHE — liens, nœuds, labels.
   ═══════════════════════════════════════════════════════════════════ */
.link {
  stroke: var(--text-muted);
  stroke-opacity: 0.45;
  stroke-width: 0.9;
  transition: stroke-opacity 0.25s;
  pointer-events: none;
}
.link.kind-tag-link { stroke: var(--tag-dim); stroke-opacity: 0.40; }
.link.kind-similarity { stroke: var(--emerald-dim); stroke-opacity: 0.34; }
.link.kind-theme { stroke: var(--tag-dim); stroke-opacity: 0.48; }
/* Filigrane : les arêtes lieu→œuvre de la vue d'accueil, présentes mais
   discrètes — la première image de la page est une vraie constellation. */
.link.veil { stroke-opacity: 0.16; }
.link.dim { stroke-opacity: 0.07 !important; }
.link.highlight { stroke-opacity: 0.85 !important; stroke-width: 1.4; }

.node { cursor: pointer; transition: opacity 0.25s; }
/* Monochrome : la catégorie se lit à la taille (radius posé par le JS) ET
   au style de remplissage — lieu plein orange, œuvre plein neutre, tag creux. */
.node.lieu circle {
  fill: var(--ochre);
  stroke: rgba(255,77,0,0.35);
  stroke-width: 6;
  filter: drop-shadow(0 0 8px rgba(255,77,0,0.45));
}
.node.oeuvre circle {
  fill: var(--emerald);
  stroke: var(--border-warm);
  stroke-width: 3;
}
.node.tag circle {
  fill: var(--bg);
  stroke: var(--tag-color);
  stroke-width: 1.5;
}
.node.hidden {
  opacity: 0 !important;
  pointer-events: none;
}
.node.dim { opacity: 0.10; }
.node.dim circle { filter: none; animation: none !important; }
.node.focus circle {
  stroke: var(--ochre);
  stroke-width: 3;
  filter: drop-shadow(0 0 12px rgba(255,77,0,0.7));
}
.node.depth-1 circle {
  stroke-width: 3;
  filter: drop-shadow(0 0 8px rgba(255,77,0,0.38));
}
.node.depth-2 { opacity: 0.72; }

/* Scintillement — uniquement sur la vue d'accueil (chemins, sans focus),
   désactivé dès qu'on explore pour ne pas parasiter la lecture.
   Durée/délai par nœud via --twk-* (posés par constellation.js). */
@keyframes li-twinkle {
  0%, 100% { opacity: 0.55; }
  50%      { opacity: 1; }
}
body.view-home .node.oeuvre circle {
  animation: li-twinkle var(--twk-dur, 3.6s) ease-in-out infinite;
  animation-delay: var(--twk-delay, 0s);
}
@media (prefers-reduced-motion: reduce) {
  body.view-home .node.oeuvre circle { animation: none; }
}

.label {
  font-family: var(--mono); font-size: 9px; fill: var(--text-secondary);
  letter-spacing: 0.05em; pointer-events: none;
  paint-order: stroke; stroke: var(--bg); stroke-width: 3;
  opacity: 0.78;
  transition: opacity 0.18s;
}
.label.lieu   { fill: var(--text-primary); font-size: 11px; font-weight: 500; }
.label.oeuvre { fill: var(--text-secondary); font-size: 9px; }
.label.tag    { fill: var(--text-muted); font-size: 8.5px; }
.label.dim    { opacity: 0.12; }
.label.focus-label,
.node:hover .label {
  opacity: 1 !important;
}

/* Toggles : les labels secondaires restent disponibles au survol/focus. */
body:not(.show-labels-lieu)   .label.lieu:not(.focus-label),
body:not(.show-labels-oeuvre) .label.oeuvre:not(.focus-label),
body:not(.show-labels-tag)    .label.tag:not(.focus-label) {
  opacity: 0;
}

/* Pendant l'intro, les labels attendent que les étoiles soient nées. */
body.is-intro .label { opacity: 0 !important; }

#tooltip {
  position: fixed; pointer-events: none;
  background: var(--surface);
  border: 1px solid var(--ochre-dim);
  padding: 11px 15px; border-radius: 2px;
  max-width: 340px;
  font-family: var(--mono); font-size: 11px; line-height: 1.5;
  color: var(--text-primary);
  opacity: 0; transform: translateY(2px);
  transition: opacity 0.15s, transform 0.15s;
  z-index: 20;
  box-shadow: 0 8px 24px rgba(0,0,0,0.6);
}
#tooltip.visible { opacity: 1; transform: translateY(0); }
#tooltip .ttitle {
  font-family: var(--serif-display); font-style: normal; font-weight: 700;
  font-size: 14px; color: var(--ochre); margin-bottom: 5px;
  line-height: 1.25;
}
#tooltip .tmeta {
  color: var(--text-muted); font-size: 9px;
  letter-spacing: 0.16em; text-transform: uppercase; margin-bottom: 5px;
}
#tooltip .tdetail { color: var(--text-secondary); margin-bottom: 6px; }
#tooltip .ttags { display: flex; flex-wrap: wrap; gap: 3px; margin-top: 6px; }
#tooltip .ttag {
  font-size: 9px; letter-spacing: 0.06em;
  background: transparent; color: var(--text-secondary);
  padding: 2px 6px;
  border: 1px solid var(--border-warm);
}
#tooltip .ttag.generic { opacity: 0.45; }
#tooltip .thint {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: 9px; letter-spacing: 0.14em; text-transform: uppercase;
}
