@font-face {
  font-family: 'Blurline';
  src: url('../fonts/Blurline.ttf') format('truetype');
  font-weight: normal;
  font-style: normal;
}

* {
  box-sizing: border-box;
}

/* ────୨ৎ──── COULEURS : MODE CLAIR (par défaut) ˚────୨ৎ──── */
:root {
  --bg: white;                          /* fond */
  --fg: black;                          /* texte et traits */
  --bg-veil: rgba(255, 255, 255, 0.85); /* fond semi-transparent des infos au survol */
  --line: #cccccc;                      /* traits de séparation gris */
  --dim: #9a9a9a;                       /* texte gris (catégories inactives) */

  /* Boutons gel (style Aqua) : gel blanc argenté */
  --gel-top: #ffffff;
  --gel-bottom: #b9bfc7;
  --gel-border: rgba(0, 0, 0, 0.45);
  --gel-text: black;
  --gel-shine: rgba(255, 255, 255, 0.95);       /* reflet ovale en haut */
  --gel-glow: rgba(255, 255, 255, 0.80);        /* lueur en bas, à l'intérieur */
  --gel-shadow: rgba(0, 0, 0, 0.30);            /* ombre portée sous le bouton */
}

/* ────୨ৎ──── COULEURS : MODE SOMBRE (classe "dark" ajoutée par la barre espace) ˚────୨ৎ──── */
body.dark {
  --bg: black;
  --fg: white;
  --bg-veil: rgba(0, 0, 0, 0.8);
  --line: rgba(255, 255, 255, 0.3);
  --dim: #8a8a8a;

  /* Boutons gel : gel gris fumé */
  --gel-top: #6a6a6a;
  --gel-bottom: #141414;
  --gel-border: rgba(255, 255, 255, 0.45);
  --gel-text: white;
  --gel-shine: rgba(255, 255, 255, 0.55);
  --gel-glow: rgba(255, 255, 255, 0.30);
  --gel-shadow: rgba(255, 255, 255, 0.15);
}

body {
  margin: 0;
  background-color: var(--bg);
  overflow-y: auto;
}

header {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  pointer-events: none;          /* l'en-tête est transparent : seuls les boutons captent les clics */
}

.annonce-container {
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0.1rem 0;
}

.annonce-container marquee {
  font-family: 'Blurline', sans-serif;
  font-weight: 300;
  font-style: normal;
  font-size: 3rem;
  color: var(--fg);
  white-space: nowrap;
}


/* ────୨ৎ──── FINE LIGNE SOUS LE BANDEAU ˚────୨ৎ──── */
.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 10px;
  padding: 6px 0;
}

/* les boutons restent cliquables malgré « pointer-events: none » sur l'en-tête */
.toolbar li,
.toolbar button {
  pointer-events: auto;
}

.nav-categories ul,
.view-options {
  display: flex;
  gap: 6px;
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Petits carrés : catégories et options de vue */
.nav-categories li,
.view-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--fg);
  background: var(--bg);        /* fond plein : noir en mode sombre, blanc en mode clair */
  color: var(--fg);
  font-family: "input-mono", monospace;
  font-size: 0.6rem;
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
}

.view-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;           /* l'icône prend la couleur du texte */
}

/* Les 4 boutons de vue en carré 2×2, dans la même hauteur que les autres boutons (26px) */
.view-options {
  display: grid;
  grid-template-columns: 12px 12px;
  grid-template-rows: 12px 12px;
  gap: 2px;
}

.view-options .view-btn {
  width: 12px;
  height: 12px;
  font-size: 0.45rem;
  line-height: 1;
}

.view-options .view-btn svg {
  width: 7px;
  height: 7px;
}

/* Bouton actif ou survolé : carré rempli */
.nav-categories li:hover,
.nav-categories li.is-active,
.view-btn:hover,
.view-btn.is-active {
  background: var(--fg);
  color: var(--bg);
}

/* Groupe de droite : les 4 vues + le bouton recherche / archive */
.toolbar-right {
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Bouton recherche / archive : même carré que les catégories */
.archive-btn {
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  border: 1px solid var(--fg);
  background: var(--bg);
  color: var(--fg);
  cursor: pointer;
}

.archive-btn svg {
  width: 12px;
  height: 12px;
  fill: currentColor;
}

.archive-btn:hover,
.archive-btn.is-active {
  background: var(--fg);
  color: var(--bg);
}

/* Les tags sont masqués pour l'instant (on les replacera ailleurs).
   « header .header-grid » est plus précis que « .header-grid » : cette règle gagne
   sur celle plus bas dans le fichier qui remet display: flex. */
header .header-grid {
  display: none;
}


/* ────୨ৎ──── IMAGES ˚────୨ৎ──── */
.header-grid {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
  padding: 0rem 2rem;
  overflow-x: auto;
  flex-wrap: nowrap;
  justify-content: flex-start;
  width: 100%;
}

.header-grid .select {
  flex: 0 0 auto;
  white-space: normal;
}

.header-grid .tags {
  background-color: transparent;
  flex: 1 1 auto;
  padding: 0 1rem 0rem 1.5rem;
}

.header-grid ul {
  list-style: none;
  padding: 0;
  margin: 0 0 0.2rem 0;
}

.header-grid .select li {
  font-size: 0.7rem;
  font-family: "input-mono", monospace;
  font-weight: 300;
  color: var(--fg);
  padding: 0.1rem 1rem;
  border: 1px solid var(--fg);
  padding: 3px 6px;
  margin: 2px 50px 5px 3px;
  text-align:center;
}

.header-grid .select li:hover {
  background-color: var(--fg);
  color: var(--bg);
  transform: scale(1.05);
}

.header-grid .select li.is-active {
  background-color: var(--fg);
  color: var(--bg);
  transform: scale(1.05);
}

/* ────୨ৎ──── BOUTONS GEL (style Aqua, années 2000) ˚────୨ৎ──── */
/* Utilisé pour les tags, les boutons de tri ET les pastilles G01 du glossaire */
.tags-section .tags li,
.archive-sort button,
.glossaire-num {
  position: relative;           /* nécessaire pour placer le reflet (::before) */
  display: inline-block;
  border: 1px solid var(--gel-border);
  border-radius: 999px;         /* forme de capsule */
  color: var(--gel-text);
  /* corps du gel : clair en haut, foncé en bas */
  background: linear-gradient(to bottom, var(--gel-top), var(--gel-bottom));
  box-shadow:
    inset 0 -3px 5px var(--gel-glow),   /* lueur en bas, comme la lumière qui traverse le gel */
    0 2px 4px var(--gel-shadow);        /* petite ombre sous le bouton */
}

/* Le reflet ovale brillant sur la moitié haute */
.tags-section .tags li::before,
.archive-sort button::before,
.glossaire-num::before {
  content: '';
  position: absolute;
  top: 1px;
  left: 5px;
  right: 5px;
  height: 50%;
  border-radius: 999px;
  background: linear-gradient(to bottom, var(--gel-shine), transparent);
  pointer-events: none;         /* le reflet ne bloque pas les clics */
}

.tags-section .tags li,
.archive-sort button {
  padding: 3px 9px;
  margin: 4px 4px 4px 0;
  cursor: pointer;
  font-size: 0.7rem;
  font-family: "input-mono", monospace;
  font-weight: 300;
  transition: all 0.2s ease;
}

/* Survol : le gel s'éclaire légèrement */
.tags-section .tags li:hover,
.archive-sort button:hover {
  filter: brightness(1.2);
}

/* Sélectionné : gel enfoncé (dégradé inversé, reflet atténué, ombre à l'intérieur) */
.tags-section .tags li.is-active,
.archive-sort button.is-active {
  background: linear-gradient(to bottom, var(--gel-bottom), var(--gel-top));
  box-shadow:
    inset 0 2px 5px rgba(0, 0, 0, 0.6),
    0 1px 1px var(--gel-shadow);
}

.tags-section .tags li.is-active::before,
.archive-sort button.is-active::before {
  opacity: 0.25;
}

.column.center {
  position: relative;
  display: flex;
  padding-top: 160px;
  padding-bottom: 4rem;
  margin: 0 1rem;
  gap: 20px;
  width: calc(75vw - 70px);
  margin-left: 25vw;
  margin-top: 25vh;
  z-index: 500;
  min-height: 75vh;
}

.grid {
  column-count: 4;
  column-gap: 10px;
}

/* Page Images : grille en pleine largeur, 10px de marge à gauche et à droite.
   Elle commence 10px sous les boutons (--header-h est mesuré par main.js),
   puis passe sous le bandeau et les boutons quand on fait défiler la page
   (#content-images cible uniquement la page Images, pas Sites ni Portraits) */
#content-images .column.center {
  width: auto;
  margin: 0 10px;
  padding-top: calc(var(--header-h, 80px) + 10px);
  min-height: 0;
}

/* La grille : main.js crée les colonnes (6, 4 ou calculées pour la vue « fenêtre »)
   et y distribue les images de gauche à droite, puis de haut en bas */
#contentGrid {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  width: 100%;
}

/* Une colonne de la grille */
.grid-col {
  flex: 1;
  min-width: 0;                 /* la colonne peut rétrécir autant que nécessaire */
}

/* Vue d'ensemble « fenêtre » : écart plus petit entre les images */
#contentGrid.view-fit {
  gap: 4px;
}

#contentGrid.view-fit img {
  margin-bottom: 4px !important;
}

/* ── Vue constellation ── */
/* Un grand espace qui couvre tout l'écran, sous l'en-tête */
.constellation {
  position: fixed;
  inset: 0;
  z-index: 1;
  overflow: hidden;
  cursor: grab;
  touch-action: none;           /* sur écran tactile, le doigt déplace la constellation */
}

.constellation.dragging {
  cursor: grabbing;
}

/* La carte : on la déplace et on la zoome d'un bloc (main.js règle son « transform ») */
.constellation-world {
  position: absolute;
  left: 0;
  top: 0;
  transform-origin: 0 0;
  will-change: transform;
}

/* Chaque image est placée sur la carte par main.js (left, top, width, height) */
.constellation-world img {
  position: absolute;
  display: block;
  object-fit: cover;
  user-select: none;
  -webkit-user-drag: none;      /* empêche de « tirer » l'image hors de la page */
}

/* Quand la constellation est affichée : on cache la grille et on bloque le scroll de la page */
body.in-constellation {
  overflow: hidden;
}

body.in-constellation #content-images .column.center {
  display: none;
}

.image-item {
  break-inside: avoid;          /* une image n'est jamais coupée entre deux colonnes */
}

.grid img {
  width: 100%;
  height: auto;
  margin-bottom: 10px;
  display: block;
  break-inside: avoid;
}

.image-info-hover {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 300px;
  max-height: 90vh;
  overflow-y: auto;
  font-family: "input-mono", monospace;
  font-weight: 300;
  font-style: normal;
  color: var(--fg);
  font-size: 0.7rem;
  line-height: 1.3rem;
  background-color: var(--bg-veil);
  padding: 1rem;
  border: 1px solid var(--fg);
  display: none;
  z-index: 2000;
}

.magazine-link {
  font-family: "input-mono", monospace;
  font-weight: 300;
  color: var(--fg);
}

.col.select li {
  cursor: pointer;
}

.select li.active {
  background-color: var(--bg);
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: 12px;
  padding: 3px 6px;
  transition: all 0.2s ease;
}


/* ────୨ৎ──── LIVRES ˚────୨ৎ──── */
#content-livres {
  display: flex;
  flex-direction: column;
  gap: 2rem;
  padding-top: 250px;
  width: calc(75vw - 70px);
  margin-left: 25vw;
}

.livre-item {
  display: flex;
  gap: 2rem;
  align-items: flex-end;
  margin-bottom: 4rem;
}

.livre-cover {
  width: 200px;
  height: auto;
  flex-shrink: 0;
  cursor: pointer;
}

.livre-info {
  color: var(--fg);
  font-family: "input-mono", monospace;
  font-weight: 300;
  font-size: 1rem;
  line-height: 1.3rem;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
}

.livre-info h2 {
  font-size: 0.9rem;
  margin: 0 0 0.5rem 0;
  line-height: 0.7rem;
}

.livre-info p {
  margin: 0.1rem 0;
  font-size: 0.8rem;
  line-height: 1.4rem;
}


/* ────୨ৎ──── LEXIQUE ˚────୨ৎ──── */
#glossaireGrid {
  display: flex;
  flex-direction: column;
  width: calc(75vw - 70px);
  margin-left: 25vw;
  padding-top: 160px;
  color: var(--fg);
  font-family: "input-mono", monospace;
}

/* Grande lettre (A, B, C…) en Blurline, comme dans l'édition */
.glossaire-letter {
  font-family: 'Blurline', sans-serif;
  font-weight: normal;
  font-size: 3rem;
  line-height: 1;
  margin: 2.5rem 0 0.8rem 0;
}

/* Une ligne = colonne gauche (pastille + mot) / colonne droite (définition) */
.glossaire-item {
  display: grid;
  grid-template-columns: 260px 1fr;
  column-gap: 2rem;
  align-items: start;
  margin-bottom: 2rem;
  font-size: 0.8rem;
  line-height: 1.6rem;
}

.glossaire-head {
  display: flex;
  align-items: flex-start;
  gap: 0.8rem;
}

/* Pastille G01, G02… (l'aspect gel est défini plus haut, avec les tags) */
.glossaire-num {
  flex: 0 0 auto;
  padding: 0 0.6rem;
  font-size: 0.65rem;
  line-height: 1.2rem;
  margin-top: 0.2rem;
}

/* Mot en majuscules et gras, dans une colonne de largeur fixe (la même pour tous les mots) */
.glossaire-mot {
  flex: 0 0 180px;
  width: 180px;
  display: flex;
  flex-direction: column;       /* les lignes du mot s'empilent */
  font-weight: 700;
  text-transform: uppercase;
}

/* Une ligne du mot : les lettres s'écartent pour remplir toute la largeur */
.glossaire-line {
  display: flex;
  justify-content: space-between;
}

/* Colonne étroite justifiée, sans couper les mots */
.glossaire-definition {
  margin: 0;
  max-width: 52ch;
  font-weight: 300;
  text-align: justify;
  hyphens: none;
}

.glossaire-nature {
  font-style: italic;
}

.image-info strong,
.image-info-hover strong {
  font-weight: 700 !important;
}


/* ────୨ৎ──── ARTICLES ˚────୨ৎ──── */
#articlesGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
}

.article-item-square {
  background-color: var(--bg);
  border: 1px solid var(--fg);
  height: 150px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.2s;
}

.article-item-square:hover {
  transform: scale(1.05);
}

.article-title {
  font-size: 0.8rem;
  line-height: 1.3rem;
  font-family: "input-mono", monospace;
  font-weight: 500;
  font-style: normal;
  color: var(--fg);
  padding: 10px;
  pointer-events: none; /* pour que le click passe au parent */
}

.article-info-hover {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 300px;
  max-height: 90vh;
  overflow-y: auto;
  font-family: "input-mono", monospace;
  font-weight: 400;
  font-style: normal;
  color: var(--bg);
  font-size: 0.7rem;
  line-height: 1.3rem;
  background-color: var(--fg);
  padding: 1rem;
  display: none;
  z-index: 2000;
}

#portraitsGrid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 1rem;
  width: 100%; 
}

.portraits-item-square {
  background-color: var(--bg);
  height: 150px;
  border: 1px solid var(--fg);
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  cursor: pointer;
  padding: 0.5rem;
  transition: transform 0.2s;
}

.portraits-item-square:hover {
  transform: scale(1.05);
}

.portraits-name {
  font-size: 0.8rem;
  line-height: 1.3rem;
  font-family: "input-mono", monospace;
  font-weight: 500;
  font-style: normal;
  color: var(--fg);
  padding: 10px;
}

.portraits-info-hover {
  position: fixed;
  bottom: 20px;
  left: 20px;
  width: 300px;
  max-height: 90vh;
  overflow-y: auto;
  font-family: "input-mono", monospace;
  font-weight: 400;
  font-style: normal;
  color: var(--bg);
  font-size: 0.7rem;
  line-height: 1.3rem;
  background-color: var(--fg);
  padding: 1rem;
  display: none;
  z-index: 2000;
}



/* ────୨ৎ──── MODE RECHERCHE / ARCHIVE ˚────୨ৎ──── */
:root {
  --archive-w: 360px;           /* largeur du rectangle à droite */
}

/* Le rectangle : fermé par défaut, sous l'en-tête, sur toute la hauteur */
.archive-panel {
  display: none;
  position: fixed;
  top: var(--header-h, 80px);
  right: 0;
  bottom: 0;
  width: var(--archive-w);
  z-index: 900;
  flex-direction: column;
  overflow-y: auto;
  padding: 0 16px 16px;
  background: var(--bg);
  border-left: 1px solid var(--line);
  color: var(--fg);
  font-family: "input-mono", monospace;
  font-size: 0.7rem;
}

body.archive-open .archive-panel {
  display: flex;
}

/* Les images se resserrent dans la partie gauche */
body.archive-open #content-images .column.center {
  margin-right: calc(var(--archive-w) + 10px);
}

body.archive-open .constellation {
  right: var(--archive-w);
}

/* Un bloc du rectangle (trier, contexte, forme, image) */
.archive-block {
  padding: 12px 0;
  border-bottom: 1px solid var(--line);
}

/* Titre de bloc : majuscules espacées, comme dans l'édition */
.archive-title {
  margin: 0 0 8px;
  font-size: 0.65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.4em;
}

/* Petit titre de groupe (esthétique, support…) */
.archive-group {
  margin: 8px 0 2px;
  font-size: 0.6rem;
  font-weight: 300;
  color: var(--dim);
}

.archive-panel ul {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* Les tags s'empilent par groupe dans le rectangle */
.archive-panel .tags-section {
  display: flex;
  flex-direction: column;
}

.archive-sort {
  display: flex;
  flex-wrap: wrap;
}

/* Infos de l'image : en bas du rectangle */
.archive-info-block {
  margin-top: auto;             /* pousse ce bloc tout en bas */
  border-bottom: 0;
}

.archive-info {
  line-height: 1.3rem;
  font-weight: 300;
}

.archive-info strong {
  font-weight: 700;
}

.archive-info .archive-placeholder {
  color: var(--dim);
}

/* Image dont les infos sont figées (clic) */
.is-locked {
  outline: 2px solid var(--fg);
  outline-offset: 2px;
}
