:root {
  --ink: #080b12;
  --ink-2: #0d1220;
  --paper: #e7ecf7;
  --paper-dim: rgba(231, 236, 247, 0.62);
  --paper-faint: rgba(231, 236, 247, 0.34);
  --line: rgba(231, 236, 247, 0.12);
  --vert: #3ddc84;
  --orange: #f0a52e;
  --rouge: #f2555a;
  --serif: Georgia, "Iowan Old Style", "Palatino Linotype", Palatino, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background:
    radial-gradient(1200px 700px at 18% -10%, rgba(86, 122, 220, 0.16), transparent 70%),
    radial-gradient(900px 600px at 95% 110%, rgba(190, 120, 90, 0.12), transparent 70%),
    linear-gradient(180deg, var(--ink-2), var(--ink));
  color: var(--paper);
  font-family: var(--sans);
  -webkit-font-smoothing: antialiased;
}

/* --- En-tete ----------------------------------------------------------- */

.top {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px 16px;
  padding: 18px 24px 10px;
}

.brand {
  display: flex;
  align-items: baseline;
  gap: 14px;
  min-width: 0;
}

.brand h1 {
  margin: 0;
  font-family: var(--serif);
  font-size: 26px;
  font-weight: 400;
  letter-spacing: 0.06em;
}

.tagline {
  margin: 0;
  font-size: 12px;
  color: var(--paper-faint);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.lang {
  display: flex;
  gap: 2px;
  flex: none;
}

.lang button {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: transparent;
  color: var(--paper-faint);
  font: 600 10px/1 var(--sans);
  letter-spacing: 0.08em;
  cursor: pointer;
}

.lang button.is-on {
  color: var(--ink);
  background: var(--paper);
  border-color: transparent;
}

/* --- Filtres ----------------------------------------------------------- */

/* Pas de debordement masque ici : il creerait un contexte de rognage, et
   les menus deroulants seraient coupes des leur ouverture. La barre passe
   a la ligne plutot que de defiler. */
.filters {
  position: relative;
  z-index: 30;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 18px;
  padding: 0 24px 14px;
}

.chips {
  display: flex;
  gap: 6px;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--paper-faint);
  font: 500 12px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}

.chip:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.26);
}

.chip.is-on {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

/* Pastilles de fiabilite reduites a leur forme : le mot n'apparait qu'au
   survol ou au focus. Trois chips pleines mangeaient un tiers de la barre
   pour une information que la forme porte deja. */
.chip--rel {
  padding: 6px 9px;
  gap: 0;
}

.chip--rel .chip-text {
  display: inline-block;
  max-width: 0;
  overflow: hidden;
  white-space: nowrap;
  opacity: 0;
  transition: max-width 220ms var(--ease, ease), opacity 160ms,
    margin-left 220ms var(--ease, ease);
}

.chip--rel:hover .chip-text,
.chip--rel:focus-visible .chip-text,
.chips:hover .chip--rel .chip-text {
  max-width: 11em;
  margin-left: 7px;
  opacity: 1;
}

/* Le marqueur vise par la recherche se signale une seconde. */
.mk.is-flash .mk-dot {
  animation: mk-flash 1100ms ease-out;
}

@keyframes mk-flash {
  0% {
    box-shadow: 0 0 0 0 rgba(231, 236, 247, 0.85);
  }
  70% {
    box-shadow: 0 0 0 16px rgba(231, 236, 247, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(231, 236, 247, 0);
  }
}

.chip:not(.is-on) .rel-dot {
  opacity: 0.3;
}

.chips--cat .chip {
  font-size: 11px;
  padding: 5px 10px;
}

.rel-dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
}

.rel-dot--vert {
  background: var(--vert);
}

.rel-dot--orange {
  background: transparent;
  border: 2.5px solid var(--orange);
}

.rel-dot--rouge {
  background: rgba(242, 85, 90, 0.3);
  border: 1.5px solid var(--rouge);
  border-radius: 2px;
  transform: rotate(45deg);
}

/* --- Scene ------------------------------------------------------------- */

.actifs {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  flex-basis: 100%;
}

.actif {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 8px 4px 10px;
  border: 1px solid rgba(231, 236, 247, 0.26);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
  font: 500 11px/1 var(--sans);
  cursor: pointer;
}

.actif:hover {
  border-color: rgba(231, 236, 247, 0.4);
}

.actif-croix {
  font-size: 9px;
  color: var(--paper-faint);
}

.actif:hover .actif-croix {
  color: var(--paper);
}

.actif--tout {
  border-style: dashed;
  background: none;
  color: var(--paper-dim);
}

/* --- Apercu d'une grappe au survol ------------------------------------- */

.mk-apercu {
  position: absolute;
  z-index: 30;
  top: 26px;
  left: 50%;
  transform: translateX(-50%) translateY(-4px);
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: max-content;
  max-width: 290px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: rgba(10, 14, 23, 0.97);
  box-shadow: 0 10px 32px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity 140ms, transform 140ms;
}

.mk-apercu[hidden] {
  display: none;
}

.mk--cluster:hover .mk-apercu,
.mk--cluster:focus-visible .mk-apercu {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.mk-apercu-ligne {
  display: flex;
  align-items: baseline;
  gap: 7px;
}

.mk-apercu-annee {
  flex: none;
  min-width: 52px;
  font: 600 9.5px/1.3 var(--sans);
  letter-spacing: 0.04em;
  color: var(--paper-faint);
}

.mk-apercu-titre {
  font: 400 12px/1.3 var(--serif);
  color: var(--paper);
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.mk-apercu-reste {
  font: 500 10px/1 var(--sans);
  color: var(--paper-faint);
}

.panel-hors-ligne {
  margin: 0 0 8px;
  font: 400 12.5px/1.5 var(--sans);
  color: var(--paper-faint);
}

.panel-retry {
  padding: 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--paper-dim);
  font: 500 11.5px/1 var(--sans);
  cursor: pointer;
}

.panel-retry:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.26);
}

.sans-script {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  padding: 32px;
  text-align: center;
  background: var(--ink);
}

.sans-script h2 {
  margin: 0 0 10px;
  font: 400 26px/1.2 var(--serif);
}

.sans-script p {
  margin: 0;
  max-width: 44ch;
  font: 400 14px/1.6 var(--sans);
  color: var(--paper-dim);
}

/* --- Recherche ---------------------------------------------------------- */

.search {
  position: relative;
}

.search-input {
  width: clamp(150px, 42vw, 186px);
  padding: 6px 11px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--paper);
  font: 500 12px/1 var(--sans);
}

.search-input::placeholder {
  color: var(--paper-faint);
}

.search-input:focus {
  outline: none;
  border-color: rgba(231, 236, 247, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

.search-results {
  position: absolute;
  z-index: 50;
  top: calc(100% + 6px);
  right: 0;
  width: min(340px, 78vw);
  margin: 0;
  padding: 6px;
  list-style: none;
  max-height: min(60vh, 420px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 14, 23, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: legend-in 160ms ease;
}

.search-results[hidden] {
  display: none;
}

.search-item {
  display: flex;
  align-items: baseline;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--paper-dim);
  font: 400 12.5px/1.3 var(--sans);
  text-align: left;
  cursor: pointer;
}

.search-item:hover,
.search-item.is-active {
  background: rgba(255, 255, 255, 0.06);
  color: var(--paper);
}

.search-item .rel-dot {
  align-self: center;
}

.search-year {
  flex: none;
  min-width: 74px;
  font: 600 10px/1.3 var(--sans);
  letter-spacing: 0.04em;
  color: var(--paper-faint);
}

.search-title {
  font-family: var(--serif);
  font-size: 13px;
}

.search-sujet {
  flex: none;
  font: 400 10px/1.3 var(--sans);
  color: var(--paper-faint);
  white-space: nowrap;
}

.mk-apercu-sujet {
  flex: none;
  font: 400 9.5px/1.3 var(--sans);
  color: var(--paper-faint);
  white-space: nowrap;
}

.search-empty {
  padding: 9px;
  font: 400 12px/1 var(--sans);
  color: var(--paper-faint);
}

/* --- Bornes de la frise -------------------------------------------------- */

.ms-panel--range {
  min-width: 232px;
}

.ms-hint {
  margin: 2px 4px 9px;
  font: 400 11px/1.45 var(--sans);
  color: var(--paper-faint);
}

.range-fields {
  display: flex;
  gap: 7px;
}

.range-fields label {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.range-fields span {
  font: 500 11px/1 var(--sans);
  color: var(--paper-faint);
}

.range-fields input {
  width: 100%;
  min-width: 0;
  padding: 6px 8px;
  border: 1px solid var(--line);
  border-radius: 7px;
  background: rgba(255, 255, 255, 0.04);
  color: var(--paper);
  font: 500 12px/1 var(--sans);
}

.range-fields input:focus {
  outline: none;
  border-color: rgba(231, 236, 247, 0.32);
}

.range-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
  margin-top: 9px;
}

.range-preset {
  padding: 5px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: none;
  color: var(--paper-faint);
  font: 500 10.5px/1 var(--sans);
  cursor: pointer;
}

.range-preset:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.26);
}

.ms--range .ms-count {
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* --- Menus de filtre a choix multiple ---------------------------------- */

.menus {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ms {
  position: relative;
}

.ms-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 6px 10px 6px 12px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--paper-faint);
  font: 500 12px/1 var(--sans);
  white-space: nowrap;
  cursor: pointer;
  transition: color 120ms, border-color 120ms, background 120ms;
}

.ms-toggle:hover,
.ms-toggle[aria-expanded='true'] {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.26);
}

/* Un menu qui filtre doit se voir sans etre ouvert. */
.ms.is-filtering .ms-toggle {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

.ms-count {
  display: inline-grid;
  place-items: center;
  min-width: 16px;
  height: 16px;
  padding: 0 5px;
  border-radius: 999px;
  font: 600 10px/1 var(--sans);
  color: var(--paper-faint);
}

.ms-count.is-on {
  background: var(--paper);
  color: var(--ink);
}

.ms-caret {
  width: 0;
  height: 0;
  border-left: 3.5px solid transparent;
  border-right: 3.5px solid transparent;
  border-top: 4px solid currentColor;
  opacity: 0.7;
}

.ms-toggle[aria-expanded='true'] .ms-caret {
  transform: rotate(180deg);
}

.ms-panel {
  position: absolute;
  z-index: 45;
  top: calc(100% + 6px);
  left: 0;
  min-width: 190px;
  max-height: min(56vh, 380px);
  overflow-y: auto;
  padding: 6px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 14, 23, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: legend-in 160ms ease;
}

.ms-panel[hidden] {
  display: none;
}

.ms-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.ms-item {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  padding: 7px 9px;
  border: 0;
  border-radius: 8px;
  background: none;
  color: var(--paper-dim);
  font: 500 12.5px/1.2 var(--sans);
  text-align: left;
  cursor: pointer;
}

.ms-item:hover {
  background: rgba(255, 255, 255, 0.05);
  color: var(--paper);
}

.ms-item.is-on {
  color: var(--paper);
}

.ms-check {
  flex: none;
  width: 13px;
  height: 13px;
  border: 1px solid rgba(231, 236, 247, 0.32);
  border-radius: 4px;
}

.ms-item.is-on .ms-check {
  border-color: transparent;
  background: var(--paper);
  box-shadow: inset 0 0 0 2px rgba(10, 14, 23, 0.97), inset 0 0 0 7px var(--paper);
}

.ms-item-label {
  flex: 1;
}

.ms-item-hint {
  flex: none;
  font: 400 10px/1 var(--sans);
  color: var(--paper-faint);
}

.ms-clear {
  width: 100%;
  margin-top: 4px;
  padding: 7px 9px;
  border: 0;
  border-top: 1px solid var(--line);
  border-radius: 0 0 8px 8px;
  background: none;
  color: var(--paper-faint);
  font: 500 11px/1 var(--sans);
  text-align: left;
  cursor: pointer;
}

.ms-clear:hover:not(:disabled) {
  color: var(--paper);
}

.ms-clear:disabled {
  opacity: 0.4;
  cursor: default;
}

.filters-count {
  margin: 0;
  align-self: center;
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.04em;
  color: var(--paper-faint);
}

.stage {
  position: relative;
  flex: 1;
  min-height: 0;
}

#timeline {
  position: absolute;
  inset: 0;
}

.tl {
  position: relative;
  height: 100%;
  overflow: hidden;
  cursor: grab;
  touch-action: none;
  outline: none;
}

.tl.is-dragging {
  cursor: grabbing;
}

.tl:focus-visible {
  box-shadow: inset 0 0 0 1px rgba(160, 196, 255, 0.5);
}

.tl-canvas {
  position: absolute;
  inset: 0;
}

.tl-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.tl-readout {
  position: absolute;
  display: flex;
  align-items: center;
  gap: 14px;
  top: 12px;
  right: 16px;
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.04em;
  color: var(--paper-faint);
  pointer-events: none;
}

/* Reglette de distorsion : avec l'echelle par paliers, une meme largeur ne
   vaut pas le meme nombre d'annees selon l'endroit. On l'affiche. */
.tl-ruler {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.tl-ruler[hidden] {
  display: none;
}

.tl-ruler-bar {
  display: block;
  height: 7px;
  border-left: 1px solid var(--paper-faint);
  border-right: 1px solid var(--paper-faint);
  border-bottom: 1px solid var(--paper-faint);
}

.tl-ruler-text {
  font: 500 11px/1 var(--sans);
  letter-spacing: 0.04em;
  color: var(--paper-faint);
}

.controls button.is-on {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.32);
  background: rgba(255, 255, 255, 0.06);
}

.tl-overview {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 58px;
  border-top: 1px solid var(--line);
  background: rgba(6, 9, 16, 0.5);
  cursor: pointer;
  touch-action: none;
}

.tl-minimap {
  display: block;
}

/* --- Ambiance par epoque ----------------------------------------------- */

@property --hue {
  syntax: "<number>";
  inherits: true;
  initial-value: 220;
}

.ambient {
  --hue: 220;
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  transition: --hue 1.4s ease;
}

.ambient-glow {
  position: absolute;
  inset: -20%;
  background:
    radial-gradient(52% 48% at 50% 108%, hsla(var(--hue), 70%, 46%, 0.32), transparent 70%),
    radial-gradient(40% 36% at 14% 8%, hsla(calc(var(--hue) + 40), 60%, 50%, 0.16), transparent 70%),
    radial-gradient(36% 32% at 92% 20%, hsla(calc(var(--hue) - 30), 60%, 50%, 0.13), transparent 70%);
  animation: drift 28s ease-in-out infinite alternate;
}

@keyframes drift {
  from {
    transform: translate3d(-1.5%, 0, 0) scale(1);
  }
  to {
    transform: translate3d(1.5%, -1%, 0) scale(1.05);
  }
}

.ambient-era {
  position: absolute;
  left: 50%;
  top: 38%;
  transform: translate(-50%, -50%);
  max-width: 100%;
  font: 400 clamp(56px, 11vw, 168px) / 1 var(--serif);
  letter-spacing: 0.02em;
  white-space: nowrap;
  color: hsla(var(--hue), 60%, 80%, 0.06);
  transition: color 1.4s ease;
}

.ambient-grain {
  position: absolute;
  inset: 0;
  opacity: 0.09;
  mix-blend-mode: overlay;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='180' height='180'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 0.9 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
}

.ambient-vignette {
  position: absolute;
  inset: 0;
  background: radial-gradient(120% 90% at 50% 45%, transparent 55%, rgba(4, 6, 12, 0.55));
}

/* --- Legende repliable ------------------------------------------------- */

.top-right {
  flex-wrap: wrap;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
}

.legend {
  position: relative;
}

.legend-body {
  position: absolute;
  z-index: 60;
  top: calc(100% + 8px);
  right: 0;
  width: min(340px, calc(100vw - 32px));
}

.legend-toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(13, 18, 32, 0.92);
  color: var(--paper-dim);
  font: 500 11.5px/1 var(--sans);
  cursor: pointer;
}

.legend-toggle:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.3);
}

.legend-mark {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  border: 1px solid currentColor;
  background:
    linear-gradient(90deg, var(--vert) 33%, var(--orange) 33% 66%, var(--rouge) 66%);
  opacity: 0.85;
}

.legend-caret {
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 5px solid currentColor;
  transition: transform 180ms ease;
}

.legend-toggle[aria-expanded='false'] .legend-caret {
  transform: rotate(180deg);
}

.legend-body {
  padding: 16px 18px;
  max-height: min(58vh, 430px);
  overflow-y: auto;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: rgba(10, 14, 23, 0.97);
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.5);
  animation: legend-in 200ms ease;
}

.legend-body[hidden] {
  display: none;
}

@keyframes legend-in {
  from {
    opacity: 0;
    transform: translateY(6px);
  }
}

.legend-body h2 {
  margin: 0 0 14px;
  font: 400 16px/1.2 var(--serif);
}

.legend-body h3 {
  margin: 16px 0 8px;
  font: 600 9.5px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.legend-body h3:first-of-type {
  margin-top: 0;
}

.legend-body ul {
  margin: 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 9px;
}

.legend-body li {
  display: flex;
  gap: 10px;
  align-items: flex-start;
  font-size: 12px;
  line-height: 1.45;
  color: var(--paper-dim);
}

.legend-body li > :first-child {
  flex: none;
  margin-top: 2px;
}

.legend-body strong {
  color: var(--paper);
  font-weight: 600;
}

.legend-aside {
  margin: 9px 0 0;
  font-size: 11px;
  line-height: 1.45;
  color: var(--paper-faint);
}

.legend-chip {
  display: grid;
  place-items: center;
  min-width: 20px;
  height: 16px;
  padding: 0 4px;
  border-radius: 4px;
  border: 1px solid var(--line);
  font: 600 9.5px/1 var(--sans);
  color: var(--paper-dim);
}

.legend-cluster {
  display: grid;
  place-items: center;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 1px solid rgba(231, 236, 247, 0.4);
  background: rgba(16, 22, 36, 0.92);
  font: 600 9.5px/1 var(--sans);
  color: var(--paper);
}

.rel-dot.is-person {
  box-shadow: 0 0 0 1px var(--ink), 0 0 0 2.5px currentColor;
  color: var(--vert);
}

/* --- Selecteur de region ----------------------------------------------- */

.select {
  display: inline-flex;
  align-items: center;
  gap: 7px;
}

.select-label {
  font: 500 11px/1 var(--sans);
  color: var(--paper-faint);
}

.select select {
  padding: 6px 10px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.015);
  color: var(--paper-dim);
  font: 500 11.5px/1 var(--sans);
  cursor: pointer;
}

.select select:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.26);
}

.select select option {
  background: #11172a;
  color: var(--paper);
}

/* --- Ecran d'accueil --------------------------------------------------- */

.intro {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: grid;
  place-items: center;
  padding: 24px;
  background:
    radial-gradient(900px 560px at 50% 110%, rgba(86, 122, 220, 0.3), transparent 70%),
    rgba(6, 8, 14, 0.94);
  transition: opacity 480ms ease, visibility 480ms;
}

.intro[hidden] {
  display: none;
}

.intro.is-leaving {
  opacity: 0;
  visibility: hidden;
}

.intro-inner {
  width: min(560px, 100%);
  animation: intro-rise 700ms cubic-bezier(0.2, 0.7, 0.2, 1) both;
}

@keyframes intro-rise {
  from {
    opacity: 0;
    transform: translateY(14px);
  }
}

.intro-kicker {
  margin: 0 0 10px;
  font: 600 11px/1 var(--sans);
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.intro-title {
  margin: 0 0 18px;
  font: 400 clamp(46px, 9vw, 84px) / 1 var(--serif);
  letter-spacing: 0.04em;
}

.intro-lead {
  margin: 0 0 24px;
  font-size: 16px;
  line-height: 1.6;
  color: var(--paper-dim);
}

.intro-legend {
  margin: 0 0 30px;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 12px;
}

.intro-legend li {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--paper-dim);
}

.intro-legend strong {
  color: var(--paper);
  font-weight: 600;
}

.intro-legend .rel-dot {
  margin-top: 4px;
}

.intro-start {
  padding: 13px 24px;
  border: 0;
  border-radius: 999px;
  background: var(--paper);
  color: var(--ink);
  font: 600 14px/1 var(--sans);
  cursor: pointer;
  transition: transform 140ms ease;
}

.intro-start:hover {
  transform: translateY(-1px);
}

.intro-start:active {
  transform: scale(0.97);
}

/* --- Marqueurs --------------------------------------------------------- */

.mk {
  position: absolute;
  top: 0;
  left: 0;
  display: flex;
  align-items: center;
  gap: 9px;
  margin: -8px 0 0 -8px;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  text-align: left;
  pointer-events: auto;
  cursor: pointer;
}

.mk-dot {
  position: relative;
  width: 16px;
  height: 16px;
  flex: none;
  border-radius: 50%;
  transition: transform 140ms ease, box-shadow 140ms ease;
}

.mk--vert .mk-dot {
  background: var(--vert);
  box-shadow: 0 0 0 1px rgba(8, 11, 18, 0.9), 0 0 14px rgba(61, 220, 132, 0.35);
}

.mk--orange .mk-dot {
  background: var(--ink);
  border: 4px solid var(--orange);
  box-shadow: 0 0 0 1px rgba(8, 11, 18, 0.9), 0 0 14px rgba(240, 165, 46, 0.3);
}

.mk--rouge .mk-dot {
  background: rgba(242, 85, 90, 0.22);
  border: 1.5px dashed var(--rouge);
  border-radius: 3px;
  transform: rotate(45deg);
}

/* La taille suit le nombre d'entrees, fixee en ligne par le rendu. */
.mk--cluster .mk-dot {
  display: grid;
  place-items: center;
  width: var(--size, 26px);
  height: var(--size, 26px);
  margin-left: calc((16px - var(--size, 26px)) / 2);
  background: rgba(16, 22, 36, 0.92);
  border: 1px solid rgba(231, 236, 247, 0.4);
  box-shadow: 0 2px 14px rgba(0, 0, 0, 0.5);
}

.mk-count {
  font: 600 11px/1 var(--sans);
  color: var(--paper);
}

.mk-label {
  display: none;
  align-items: center;
  gap: 9px;
}

.mk-text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 150px;
}

.mk-thumb {
  flex: none;
  width: 44px;
  height: 44px;
  overflow: hidden;
  border-radius: 9px;
  background: rgba(255, 255, 255, 0.06);
  box-shadow: 0 0 0 1px rgba(231, 236, 247, 0.16), 0 4px 14px rgba(0, 0, 0, 0.45);
}

.mk-thumb[hidden] {
  display: none;
}

.mk-thumb img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(0.85) contrast(1.04);
}

.mk.is-labelled .mk-label,
.mk:hover .mk-label,
.mk:focus-visible .mk-label {
  display: flex;
}

.mk:hover,
.mk:focus-visible {
  z-index: 20;
}

.mk:not(.is-labelled):hover .mk-label,
.mk:not(.is-labelled):focus-visible .mk-label {
  padding: 5px 9px;
  border-radius: 7px;
  background: rgba(10, 14, 24, 0.94);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.55);
  outline: 1px solid var(--line);
}

.mk:hover .mk-dot,
.mk:focus-visible .mk-dot {
  transform: scale(1.3);
}

.mk--rouge:hover .mk-dot,
.mk--rouge:focus-visible .mk-dot {
  transform: rotate(45deg) scale(1.3);
}

.mk-year {
  font: 600 10px/1.2 var(--sans);
  letter-spacing: 0.06em;
  color: var(--paper-faint);
}

.mk-title {
  font: 400 12.5px/1.25 var(--serif);
  color: var(--paper);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* Personnage : contour double, pour se distinguer d'un evenement ponctuel. */
.mk--person .mk-dot {
  box-shadow: 0 0 0 1.5px var(--ink), 0 0 0 3.5px currentColor;
}

.mk--person.mk--vert .mk-dot {
  color: var(--vert);
}

.mk--person.mk--orange .mk-dot {
  color: var(--orange);
}

.mk--person.mk--rouge .mk-dot {
  color: var(--rouge);
}

.mk.is-selected .mk-dot {
  transform: scale(1.45);
  box-shadow: 0 0 0 2px var(--paper), 0 0 20px rgba(231, 236, 247, 0.4);
}

.mk--rouge.is-selected .mk-dot {
  transform: rotate(45deg) scale(1.45);
}

/* --- Commandes --------------------------------------------------------- */

.controls {
  position: absolute;
  z-index: 30;
  right: 16px;
  top: 34px; /* en haut : en bas, les commandes masquaient l'axe */
  display: flex;
  gap: 6px;
}

.controls button {
  min-width: 32px;
  height: 32px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(13, 18, 32, 0.92);
  color: var(--paper-dim);
  font: 500 14px/1 var(--sans);
  cursor: pointer;
}

.controls button.is-wide {
  font-size: 11px;
}

.controls button:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.3);
}

.help {
  margin: 0;
  padding: 10px 24px 14px;
  font-size: 11px;
  color: var(--paper-faint);
}

/* --- Panneau de detail ------------------------------------------------- */

.panel {
  position: absolute;
  z-index: 40; /* au-dessus des marqueurs, qui montent a 20 au survol */
  top: 0;
  right: 0;
  bottom: 0;
  width: min(420px, 100%);
  padding: 22px 26px 40px;
  overflow-y: auto;
  /* Pas de backdrop-filter ici : Chromium laisse alors passer les marqueurs
     composites par-dessus le panneau. Fond quasi opaque a la place. */
  background: rgba(10, 14, 23, 0.975);
  border-left: 1px solid var(--line);
  animation: panel-in 220ms ease;
}

@keyframes panel-in {
  from {
    transform: translateX(14px);
    opacity: 0;
  }
}

/* La croix se superpose a l'illustration, dont on ignore la clarte : un
   disque sombre opaque la rend lisible sur une photo blanche comme sur une
   gravure noire, sans l'alourdir sur le fond du panneau. */
.panel-close {
  position: absolute;
  z-index: 2;
  top: 14px;
  right: 16px;
  width: 28px;
  height: 28px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 11, 18, 0.72);
  box-shadow: 0 0 0 1px rgba(231, 236, 247, 0.22), 0 2px 10px rgba(0, 0, 0, 0.5);
  color: var(--paper);
  font-size: 12px;
  cursor: pointer;
  transition: background 120ms, color 120ms;
}

.panel-close:hover,
.panel-close:focus-visible {
  background: var(--paper);
  color: var(--ink);
}

/* --- Illustration agrandissable ---------------------------------------- */

.panel-figure-open {
  position: relative;
  display: block;
  width: 100%;
  padding: 0;
  border: 0;
  border-radius: 10px;
  background: none;
  cursor: zoom-in;
}

.panel-figure-open:focus-visible {
  outline: 2px solid rgba(160, 196, 255, 0.7);
  outline-offset: 2px;
}

.panel-figure-hint {
  position: absolute;
  right: 8px;
  bottom: 8px;
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  background: rgba(8, 11, 18, 0.72);
  box-shadow: 0 0 0 1px rgba(231, 236, 247, 0.22);
  color: var(--paper);
  font-size: 13px;
  opacity: 0;
  transition: opacity 140ms;
}

.panel-figure-open:hover .panel-figure-hint,
.panel-figure-open:focus-visible .panel-figure-hint {
  opacity: 1;
}

/* --- Visionneuse plein ecran ------------------------------------------- */

/* Visionneuse : l'image doit toujours tenir entierement a l'ecran. Le
   piege est la hauteur en pourcentage dans une grille dont la rangee se
   dimensionne sur son contenu : l'image imposait alors sa taille reelle et
   debordait d'un conteneur qui ne defile pas. D'ou flex plus min-height a
   zero, qui donne a la rangee une hauteur definie. */
.lightbox {
  position: fixed;
  z-index: 60; /* au-dessus du panneau, qui monte a 40 */
  inset: 0;
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding: 36px 24px 20px;
  background: rgba(4, 6, 12, 0.94);
  cursor: zoom-out;
  animation: lightbox-in 180ms ease;
}

.lightbox[hidden] {
  display: none;
}

@keyframes lightbox-in {
  from {
    opacity: 0;
  }
}

.lightbox-figure {
  display: flex;
  flex: 1 1 auto;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  margin: 0;
  min-height: 0;
}

.lightbox-vue {
  display: flex;
  flex: 1 1 auto;
  align-items: center;
  justify-content: center;
  width: 100%;
  min-height: 0;
  overflow: auto;
  scrollbar-width: thin;
}

.lightbox-img {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  border-radius: 6px;
  cursor: zoom-in;
  opacity: 0;
  transition: opacity 240ms ease;
}

.lightbox.is-loaded .lightbox-img {
  opacity: 1;
}

/* Taille reelle : l'image reprend ses dimensions et la vue defile. Une
   fresque ou une page manuscrite ne se lisent pas autrement. */
.lightbox.is-reelle .lightbox-vue {
  align-items: flex-start;
  justify-content: flex-start;
  cursor: grab;
}

.lightbox.is-reelle .lightbox-vue.is-tire {
  cursor: grabbing;
}

.lightbox.is-reelle .lightbox-img {
  max-width: none;
  max-height: none;
  width: auto;
  height: auto;
  cursor: inherit;
}

.lightbox-barre {
  display: flex;
  flex: none;
  align-items: center;
  justify-content: center;
  gap: 14px;
  flex-wrap: wrap;
}

.lightbox-caption {
  margin: 0;
  font-size: 11px;
  color: var(--paper-faint);
  text-align: center;
}

.lightbox-caption a {
  color: var(--paper-dim);
}

.lightbox-taille {
  padding: 5px 11px;
  border: 1px solid rgba(231, 236, 247, 0.22);
  border-radius: 999px;
  background: none;
  color: var(--paper-dim);
  font: 500 11px/1 var(--sans);
  cursor: pointer;
}

.lightbox-taille:hover {
  color: var(--paper);
  border-color: rgba(231, 236, 247, 0.4);
}

.lightbox-close {
  position: absolute;
  top: 16px;
  right: 18px;
  width: 34px;
  height: 34px;
  border: 0;
  border-radius: 50%;
  background: rgba(8, 11, 18, 0.72);
  box-shadow: 0 0 0 1px rgba(231, 236, 247, 0.22);
  color: var(--paper);
  font-size: 14px;
  cursor: pointer;
}

.lightbox-close:hover,
.lightbox-close:focus-visible {
  background: var(--paper);
  color: var(--ink);
}

.panel-figure {
  margin: 0 0 18px;
}

.panel-figure img {
  display: block;
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: 10px;
}

.panel-figure figcaption {
  margin-top: 6px;
  font-size: 10px;
  color: var(--paper-faint);
}

.panel-kicker {
  margin: 0 0 6px;
  font: 600 10.5px/1 var(--sans);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.panel-title {
  margin: 0 0 14px;
  font: 400 25px/1.2 var(--serif);
  max-width: 22ch;
}

.panel-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 18px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--line);
  font: 500 11px/1 var(--sans);
  color: var(--paper-dim);
}

.badge--vert {
  border-color: rgba(61, 220, 132, 0.35);
  background: rgba(61, 220, 132, 0.08);
}

.badge--orange {
  border-color: rgba(240, 165, 46, 0.35);
  background: rgba(240, 165, 46, 0.08);
}

.badge--rouge {
  border-color: rgba(242, 85, 90, 0.35);
  background: rgba(242, 85, 90, 0.08);
}

.panel-resume {
  margin: 0 0 18px;
  font-size: 14.5px;
  line-height: 1.6;
  color: var(--paper);
}

.panel-note {
  margin: 0 0 18px;
  padding: 13px 15px;
  border-radius: 10px;
  border-left: 2px solid var(--paper-faint);
  background: rgba(255, 255, 255, 0.035);
}

.panel-note--vert {
  border-left-color: var(--vert);
}

.panel-note--orange {
  border-left-color: var(--orange);
}

.panel-note--rouge {
  border-left-color: var(--rouge);
}

.panel-note h3 {
  margin: 0 0 6px;
  font: 600 10.5px/1 var(--sans);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--paper-faint);
}

.panel-note p {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--paper-dim);
}

.panel-extract p {
  margin: 0 0 12px;
  font-size: 13.5px;
  line-height: 1.65;
  color: var(--paper-dim);
}

.panel-credit {
  font-size: 10px !important;
  color: var(--paper-faint) !important;
}

.panel-link {
  display: inline-block;
  margin-top: 4px;
  font: 500 12px/1 var(--sans);
  color: #9dc0ff;
  text-decoration: none;
}

.panel-link:hover {
  text-decoration: underline;
}

.panel-list {
  margin: 0;
  padding: 0;
  list-style: none;
}

.panel-list-item {
  display: flex;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 11px 6px;
  border: 0;
  border-bottom: 1px solid var(--line);
  background: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
}

.panel-list-item:hover {
  background: rgba(255, 255, 255, 0.04);
}

.panel-list-year {
  flex: none;
  min-width: 68px;
  font: 600 10.5px/1 var(--sans);
  color: var(--paper-faint);
}

.panel-list-title {
  font: 400 13.5px/1.3 var(--serif);
}

/* --- Petits ecrans ----------------------------------------------------- */

@media (max-width: 760px) {
  .top {
    padding: 14px 16px 8px;
  }

  .tagline {
    display: none;
  }

  /* Surtout pas nowrap : les menus deroulants ne peuvent plus defiler
     horizontalement depuis qu'ils doivent pouvoir deborder de la barre.
     On empile donc, quitte a prendre deux rangees. */
  .filters {
    flex-wrap: wrap;
    gap: 6px 10px;
    padding: 0 16px 12px;
  }

  .search {
    flex: 1 1 100%;
    order: 3;
  }

  .search-input {
    width: 100%;
  }

  .search-results {
    width: 100%;
  }

  .select {
    flex: 1 1 100%;
  }

  .select select {
    width: 100%;
  }

  .tl-readout {
    top: auto;
    bottom: 68px;
    right: 12px;
  }

  .mk-apercu {
    max-width: min(240px, 70vw);
  }

  .panel {
    top: auto;
    width: 100%;
    max-height: 68%;
    border-left: 0;
    border-top: 1px solid var(--line);
    border-radius: 16px 16px 0 0;
    animation: sheet-in 240ms ease;
  }

  @keyframes sheet-in {
    from {
      transform: translateY(22px);
      opacity: 0;
    }
  }

  .controls {
    right: 12px;
  }

  .help {
    display: none;
  }
}

@media (prefers-reduced-motion: reduce) {
  .panel,
  .mk-dot {
    animation: none;
    transition: none;
  }
}

/* --- Repere geographique actuel sur la fiche ---------------------------- */

.badge--today .drapeaux {
  display: inline-flex;
  gap: 3px;
  flex: none;
}

.badge--today .drapeau {
  width: 18px;
  height: 13px;
  object-fit: cover;
  border-radius: 2px;
  /* Un drapeau clair sur fond sombre a besoin d'un bord, sinon il bave. */
  box-shadow: 0 0 0 1px rgba(8, 11, 18, 0.55);
}

.badge--today .today-label {
  color: var(--paper-faint);
}

.badge--today .geo {
  width: 14px;
  height: 14px;
  flex: none;
  opacity: 0.72;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.6;
}
