/* =========================================================
   Dragons & Legends — galerie
   Palette sombre + accent or, sur la base du template oneappaday.
   ========================================================= */

:root {
  --accent: #e3b23c;
  --accent-soft: rgba(227, 178, 60, 0.14);
  --bg: #0b1018;
  --bg-panel: #111826;
  --bg-raised: #17202f;
  --line: rgba(255, 255, 255, 0.09);
  --line-strong: rgba(255, 255, 255, 0.16);
  --text: #eef4ff;
  --muted: #93a3ba;
  --muted-dim: #6b7b91;
  --radius: 10px;
  --head-h: 116px;
}

* { box-sizing: border-box; }

/* Pas de `html, body { height: 100% }` ici : le template le pose pour des
   apps qui tiennent en un ecran, mais combine a l'`overflow-x: hidden` du
   bloc footer il fige la hauteur du document a celle de la fenetre — la
   galerie devient alors totalement non defilante. `.app` reserve deja la
   place du footer via min-height. */

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text);
  background: var(--bg);
}

.app {
  width: min(1680px, calc(100% - 28px));
  min-height: calc(100dvh - var(--gl-footer-h, 44px));
  margin: 0 auto;
  padding: 0 0 28px;
}

/* ---------- En-tete ----------
   Collante et opaque : titre et recherche restent accessibles quel que soit
   l'endroit de la galerie. Le fond n'a pas besoin de deborder jusqu'aux bords
   de la fenetre — tout le contenu vit dans `.app`, et les gouttieres de 14 px
   sont vides ; rien ne peut donc defiler derriere. */

.da-head {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 18px;
  flex-wrap: wrap;
  padding: 16px 0 14px;
  background: var(--bg);
  border-bottom: 1px solid var(--line);
}

.da-brand {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: none;
  text-decoration: none;
  color: inherit;
}
.da-logo {
  width: 30px;
  height: 30px;
  flex: none;
  display: block;
}
@media (max-width: 400px) {
  /* Sous 400 px, le logo dispute la place au titre et au hamburger. */
  .da-logo { display: none; }
}
.da-brand h1 {
  margin: 0;
  font-size: 1.22rem;
  letter-spacing: -0.01em;
  font-weight: 650;
}
.da-brand h1 .amp { color: var(--accent); }
.da-brand .da-count {
  font-size: 0.78rem;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}

.da-searchwrap {
  position: relative;
  flex: 1 1 320px;
  min-width: 220px;
}
.da-searchwrap::before {
  content: "⌕";
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 1.1rem;
  color: var(--muted-dim);
  pointer-events: none;
}
#da-search {
  width: 100%;
  padding: 10px 82px 10px 32px;
  font: inherit;
  font-size: 0.9rem;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: var(--radius);
  outline: none;
  transition: border-color 0.15s, box-shadow 0.15s;
}
#da-search:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
#da-search::placeholder { color: var(--muted-dim); }

.da-search-clear {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  display: none;
  padding: 3px 9px;
  font: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  background: var(--bg-raised);
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
}
.da-search-clear.on { display: block; }
.da-search-clear:hover { color: var(--text); border-color: var(--line-strong); }

/* ---------- Mise en page ---------- */

.da-layout {
  display: grid;
  grid-template-columns: 234px minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  padding-top: 16px;
}

/* Meme raison que le `minmax(0, …)` de la colonne : sans cela, la mosaïque
   et la barre d'outils imposent leur largeur de contenu au conteneur. */
.da-main { min-width: 0; }

/* `--head-h` est mesuree en JS : la hauteur de l'en-tete depend du texte et
   du retour a la ligne de la recherche sur ecran etroit. */
.da-side {
  position: sticky;
  top: calc(var(--head-h, 70px) + 12px);
  max-height: calc(100dvh - var(--head-h, 70px) - var(--gl-footer-h, 44px) - 24px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 4px;
}
.da-side::-webkit-scrollbar { width: 8px; }
.da-side::-webkit-scrollbar-thumb {
  background: var(--line-strong);
  border-radius: 4px;
}

.da-side h2 {
  margin: 0 0 8px;
  font-size: 0.68rem;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted-dim);
  font-weight: 600;
}
.da-side section + section { margin-top: 20px; }

.da-node { user-select: none; }
.da-row {
  display: flex;
  align-items: center;
  gap: 6px;
  width: 100%;
  padding: 5px 8px;
  font: inherit;
  font-size: 0.83rem;
  text-align: left;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 7px;
  cursor: pointer;
}
.da-row:hover { background: var(--bg-panel); color: var(--text); }
.da-row.on { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
.da-row .da-label {
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.da-row .da-n {
  font-size: 0.72rem;
  color: var(--muted-dim);
  font-variant-numeric: tabular-nums;
}
.da-row.on .da-n { color: var(--accent); }
.da-caret {
  width: 12px;
  flex: none;
  font-size: 0.6rem;
  color: var(--muted-dim);
  transition: transform 0.15s;
}
.da-caret.open { transform: rotate(90deg); }
.da-children { display: none; margin-left: 12px; border-left: 1px solid var(--line); padding-left: 4px; }
.da-children.open { display: block; }

.da-chips { display: flex; flex-wrap: wrap; gap: 5px; }
.da-chip {
  padding: 3px 9px;
  font: inherit;
  font-size: 0.73rem;
  color: var(--muted);
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 999px;
  cursor: pointer;
}
.da-chip:hover { color: var(--text); border-color: var(--line-strong); }
.da-chip.on {
  color: #1b1403;
  background: var(--accent);
  border-color: var(--accent);
  font-weight: 600;
}

/* ---------- Barre d'outils ---------- */

.da-toolbar {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}
.da-results { font-size: 0.84rem; color: var(--muted); }
.da-results strong { color: var(--text); font-variant-numeric: tabular-nums; }
.da-tools { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.da-select {
  padding: 6px 10px;
  font: inherit;
  font-size: 0.8rem;
  color: var(--text);
  background: var(--bg-panel);
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  cursor: pointer;
}
.da-active-filters { display: flex; flex-wrap: wrap; gap: 6px; }
.da-active {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 6px 3px 10px;
  font-size: 0.75rem;
  color: var(--accent);
  background: var(--accent-soft);
  border-radius: 999px;
}
.da-active button {
  padding: 0 3px;
  font: inherit;
  line-height: 1;
  color: inherit;
  background: none;
  border: none;
  cursor: pointer;
  opacity: 0.7;
}
.da-active button:hover { opacity: 1; }

.da-reset {
  padding: 3px 11px;
  font: inherit;
  font-size: 0.75rem;
  color: var(--muted);
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}
.da-reset:hover { color: var(--text); border-color: var(--accent); }
.da-reset[hidden] { display: none; }

/* ---------- Grille en mosaïque ----------
   Colonnes reparties en JS plutot qu'en `column-count` : chaque tuile est
   placee dans la colonne la plus courte au moment ou elle arrive, ce qui
   evite au navigateur de tout redistribuer a chaque palier de defilement
   infini — et donc de faire sauter la position de lecture. */

.da-grid {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}
.da-col {
  display: flex;
  flex-direction: column;
  gap: 12px;
  flex: 1 1 0;
  min-width: 0;
}

.da-tile {
  position: relative;
  overflow: hidden;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 0.15s, transform 0.12s;
}
.da-tile:hover { border-color: var(--line-strong); transform: translateY(-2px); }
.da-tile.picked { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); }
/* La tuile porte le ratio exact de l'image (pose en style inline depuis
   l'index) : la place est reservee avant le chargement — aucun saut de
   mise en page — et l'image est vue en entier, sans recadrage. */
.da-tile img {
  width: 100%;
  height: auto;
  aspect-ratio: var(--ar, 1);
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.25s;
}
.da-tile img.loaded { opacity: 1; }

.da-tile-cap {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 18px 8px 7px;
  font-size: 0.7rem;
  line-height: 1.3;
  color: #f2f6ff;
  background: linear-gradient(to top, rgba(6, 10, 18, 0.94), rgba(6, 10, 18, 0));
  opacity: 0;
  transition: opacity 0.15s;
  pointer-events: none;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.da-tile:hover .da-tile-cap { opacity: 1; }

.da-pick {
  position: absolute;
  top: 7px; right: 7px;
  width: 25px; height: 25px;
  display: grid;
  place-items: center;
  font-size: 0.82rem;
  line-height: 1;
  color: transparent;
  background: rgba(8, 12, 22, 0.62);
  border: 1.5px solid rgba(255, 255, 255, 0.5);
  border-radius: 50%;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.15s, background 0.15s;
}
.da-tile:hover .da-pick, .da-tile.picked .da-pick { opacity: 1; }
.da-pick:hover { border-color: #fff; }
.da-tile.picked .da-pick {
  color: #1b1403;
  background: var(--accent);
  border-color: var(--accent);
}

/* ---------- Accueil : une carte par catégorie ---------- */

.da-home { display: none; }
.da-home.on { display: block; }

.da-home-intro {
  margin: 0 0 22px;
  font-size: 0.92rem;
  line-height: 1.6;
  color: var(--muted);
  max-width: 62ch;
}
.da-home-intro strong { color: var(--text); }

/* 5 catégories : trois colonnes donnent une rangée de 3 puis de 2, plus
   equilibre qu'une quatrieme colonne qui laisserait un orphelin. */
.da-home-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(290px, 1fr));
  gap: 16px;
}
@media (min-width: 1100px) {
  .da-home-cards { grid-template-columns: repeat(3, 1fr); }
}

.da-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  text-align: left;
  font: inherit;
  color: inherit;
  background: var(--bg-panel);
  border: 1px solid var(--line);
  border-radius: 12px;
  cursor: pointer;
  transition: border-color 0.15s, transform 0.14s, box-shadow 0.14s;
}
.da-card:hover {
  border-color: var(--accent);
  transform: translateY(-3px);
  box-shadow: 0 14px 34px rgba(0, 0, 0, 0.4);
}

.da-card-mosaic {
  display: grid;
  grid-template-columns: 2fr 1fr;
  grid-template-rows: 1fr 1fr;
  gap: 2px;
  aspect-ratio: 3 / 2;
  overflow: hidden;
  background: var(--bg);
}
/* `min-height: 0` est indispensable : sans lui, la taille intrinseque des
   vignettes fait gonfler les rangees de la grille et l'aspect-ratio du
   conteneur ne tient plus — les cartes prenaient alors des hauteurs
   differentes selon les images tirees. */
.da-card-mosaic img {
  width: 100%;
  height: 100%;
  min-width: 0;
  min-height: 0;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.3s;
}
.da-card-mosaic img.loaded { opacity: 1; }
.da-card-mosaic img:first-child { grid-row: span 2; }

.da-card-body { padding: 13px 15px 15px; }
.da-card-title {
  display: flex;
  align-items: baseline;
  gap: 8px;
  margin-bottom: 5px;
}
.da-card-title h3 { margin: 0; font-size: 1rem; font-weight: 620; }
.da-card-title .da-n { font-size: 0.78rem; color: var(--accent); font-variant-numeric: tabular-nums; }
.da-card-subs {
  font-size: 0.76rem;
  line-height: 1.5;
  color: var(--muted-dim);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.da-sentinel { height: 1px; }
.da-empty {
  padding: 60px 20px;
  text-align: center;
  color: var(--muted-dim);
  font-size: 0.9rem;
}
.da-empty strong { color: var(--muted); }

/* ---------- Panier ---------- */

.da-cart {
  position: fixed;
  right: 16px;
  bottom: calc(var(--gl-footer-h, 44px) + 14px);
  z-index: 45;
  width: min(340px, calc(100vw - 32px));
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 12px;
  box-shadow: 0 18px 46px rgba(0, 0, 0, 0.55);
  transform: translateY(calc(100% + 70px));
  transition: transform 0.22s ease;
}
.da-cart.on { transform: translateY(0); }

.da-cart-head {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-bottom: 1px solid var(--line);
}
.da-cart-head strong { font-size: 0.87rem; }
.da-cart-head .da-cart-n {
  padding: 1px 8px;
  font-size: 0.72rem;
  font-weight: 700;
  color: #1b1403;
  background: var(--accent);
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
}
.da-cart-head .da-cart-toggle {
  margin-left: auto;
  padding: 2px 8px;
  font: inherit;
  font-size: 0.72rem;
  color: var(--muted);
  background: none;
  border: none;
  border-radius: 5px;
  cursor: pointer;
  transition: transform 0.18s, color 0.15s;
}
.da-cart-head .da-cart-toggle:hover { color: var(--text); }
.da-cart.folded .da-cart-toggle { transform: rotate(180deg); }

.da-cart-body { max-height: 40vh; overflow-y: auto; padding: 9px; }
.da-cart.folded .da-cart-body, .da-cart.folded .da-cart-foot { display: none; }

.da-cart-items { display: flex; flex-wrap: wrap; gap: 7px; }
.da-cart-item {
  position: relative;
  width: 56px; height: 56px;
  overflow: hidden;
  border-radius: 7px;
  border: 1px solid var(--line);
}
.da-cart-item img { width: 100%; height: 100%; object-fit: cover; display: block; }
.da-cart-item button {
  position: absolute;
  inset: 0;
  font: inherit;
  font-size: 0.95rem;
  color: #fff;
  background: rgba(8, 12, 22, 0.72);
  border: none;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.13s;
}
.da-cart-item:hover button { opacity: 1; }

.da-cart-foot {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 11px 13px;
  border-top: 1px solid var(--line);
}
.da-btn {
  padding: 8px 14px;
  font: inherit;
  font-size: 0.83rem;
  font-weight: 600;
  color: #1b1403;
  background: var(--accent);
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: filter 0.15s;
}
.da-btn:hover:not(:disabled) { filter: brightness(1.08); }
.da-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.da-btn-ghost {
  color: var(--muted);
  background: none;
  border: 1px solid var(--line-strong);
}
.da-btn-ghost:hover { color: var(--text); }
.da-cart-hint { font-size: 0.72rem; color: var(--muted-dim); margin-left: auto; text-align: right; }
.da-cart-hint.warn { color: var(--accent); }

/* ---------- Visionneuse ---------- */

.da-lightbox {
  position: fixed;
  inset: 0;
  z-index: 90;
  display: none;
  background: rgba(5, 8, 14, 0.93);
  backdrop-filter: blur(4px);
}
/* `grid-template-rows` doit etre explicite : sans ligne definie, la rangee se
   dimensionne sur son contenu, la hauteur de la scene depend donc de celle de
   l'image — et le `max-height: 100%` de l'image se resout contre elle-meme.
   Resultat : les images hautes debordaient de l'ecran. `minmax(0, 1fr)` donne
   une rangee bornee par la fenetre, et `min-height: 0` empeche la scene de
   grandir au-dela. */
.da-lightbox.on {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 330px;
  grid-template-rows: minmax(0, 1fr);
}
@media (max-width: 900px) {
  .da-lightbox.on { grid-template-columns: 1fr; grid-template-rows: minmax(0, 1fr) auto; }
}

/* Centrage en flex, pas en grille. Une grille sans `grid-template-rows`
   dimensionne sa rangee implicite sur son contenu : la rangee prenait la
   hauteur naturelle de l'image (1152 px dans une scene de 950 px), et le
   `max-height: 100%` de l'image se resolvait contre cette rangee — donc
   contre elle-meme. En flex, le pourcentage se resout contre la hauteur
   definie du conteneur, et l'image est bornee pour de bon. */
.da-lb-stage {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 22px;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
}
.da-lb-stage img {
  max-width: 100%;
  max-height: 100%;
  width: auto;
  height: auto;
  object-fit: contain;
  border-radius: 6px;
}
.da-lb-nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 42px; height: 62px;
  font-size: 1.4rem;
  color: var(--text);
  background: rgba(17, 24, 38, 0.8);
  border: 1px solid var(--line);
  border-radius: 8px;
  cursor: pointer;
}
.da-lb-nav:hover { background: var(--bg-raised); }
.da-lb-prev { left: 14px; }
.da-lb-next { right: 14px; }

.da-lb-side {
  overflow-y: auto;
  padding: 18px 20px 24px;
  background: var(--bg-panel);
  border-left: 1px solid var(--line);
  min-height: 0;
}
.da-lb-side h3 { margin: 0 0 12px; font-size: 0.95rem; line-height: 1.4; }
.da-lb-close {
  position: absolute;
  top: 14px; right: 14px;
  width: 34px; height: 34px;
  font-size: 1.15rem;
  color: var(--text);
  background: rgba(17, 24, 38, 0.85);
  border: 1px solid var(--line);
  border-radius: 50%;
  cursor: pointer;
  z-index: 2;
}
.da-meta { display: grid; grid-template-columns: auto 1fr; gap: 5px 12px; font-size: 0.77rem; margin-bottom: 14px; }
.da-meta dt { color: var(--muted-dim); }
.da-meta dd { margin: 0; color: var(--text); word-break: break-word; font-variant-numeric: tabular-nums; }
.da-prompt {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 0.74rem;
  line-height: 1.5;
  color: var(--muted);
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  max-height: 200px;
  overflow-y: auto;
  white-space: pre-wrap;
  word-break: break-word;
}
.da-lb-actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* ---------- Divers ---------- */

.da-toast {
  position: fixed;
  left: 50%;
  bottom: calc(var(--gl-footer-h, 44px) + 18px);
  transform: translate(-50%, 22px);
  z-index: 120;
  padding: 10px 18px;
  font-size: 0.82rem;
  color: var(--text);
  background: var(--bg-raised);
  border: 1px solid var(--line-strong);
  border-radius: 999px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s, transform 0.2s;
}
.da-toast.on { opacity: 1; transform: translate(-50%, 0); }

.da-loading { padding: 70px 20px; text-align: center; color: var(--muted); font-size: 0.9rem; }

/* ---------- Bouton hamburger ---------- */

.da-burger {
  display: none;
  flex-direction: column;
  justify-content: center;
  gap: 4px;
  width: 38px;
  height: 34px;
  padding: 0 8px;
  flex: none;
  background: none;
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  cursor: pointer;
}
.da-burger span {
  display: block;
  height: 2px;
  background: var(--muted);
  border-radius: 2px;
  transition: transform 0.2s, opacity 0.15s;
}
.da-burger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.da-burger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.da-burger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.da-backdrop {
  position: fixed;
  inset: 0;
  z-index: 34;
  background: rgba(6, 10, 18, 0.66);
  backdrop-filter: blur(2px);
}
.da-backdrop[hidden] { display: none; }

/* ---------- Mobile ----------
   Le panneau devient un tiroir hors-champ. Empile en pleine largeur, il
   occupait 711 px avant la premiere image sur un ecran de 847 : presque un
   ecran entier de categories avant de voir une seule illustration. */

@media (max-width: 860px) {
  .da-burger { display: flex; }
  /* `minmax(0, 1fr)` et non `1fr` : un element de grille a `min-width: auto`
     et refuse de descendre sous la largeur de son contenu. La colonne prenait
     483 px dans un conteneur de 362, et la mosaïque debordait a droite. */
  .da-layout { grid-template-columns: minmax(0, 1fr); }
  .da-brand { flex: 1; min-width: 0; }
  .da-brand h1 { font-size: 1.05rem; }
  .da-searchwrap { flex-basis: 100%; order: 3; }

  .da-side {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    z-index: 35;
    width: min(300px, 84vw);
    max-height: none;
    padding: 18px 14px calc(var(--gl-footer-h, 44px) + 18px);
    background: var(--bg-panel);
    border-right: 1px solid var(--line-strong);
    box-shadow: 8px 0 34px rgba(0, 0, 0, 0.5);
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    overflow-y: auto;
  }
  .da-side.open { transform: translateX(0); }

  .da-toolbar { gap: 8px; }
  .da-tools { width: 100%; margin-left: 0; }
  .da-tools .da-select { flex: 1; min-width: 0; }
  .da-cart { right: 10px; left: 10px; width: auto; }
}

/* Le tiroir n'a pas lieu d'etre au-dela : le panneau reprend sa colonne. */
@media (min-width: 861px) {
  .da-side.open { transform: none; }
  .da-backdrop { display: none; }
}


    /* =========================================================
       ↓↓↓  NE PAS MODIFIER : footer persistant + modales légales
       (bloc générique réutilisable, préfixe gl-)
       ========================================================= */
    :root { --gl-footer-h: 44px; }

    /* Boîte de garde par défaut : le contenu de l'app ne passe jamais
       sous le footer fixe, et rien ne déborde horizontalement.
       - padding-bottom réserve la hauteur du footer sous le contenu qui défile.
       - overflow-x: hidden empêche tout débordement vers la droite.
       - scroll-padding-bottom garde la cible clavier/ancre au-dessus du footer. */
    html { overflow-x: hidden; }
    body {
      padding-bottom: var(--gl-footer-h);
      overflow-x: hidden;
      max-width: 100%;
      scroll-padding-bottom: var(--gl-footer-h);
    }

    .gl-footer {
      position: fixed;
      left: 0; right: 0; bottom: 0;
      z-index: 40;
      min-height: var(--gl-footer-h);
      display: flex;
      align-items: center;
      justify-content: space-between;
      flex-wrap: nowrap;
      gap: 0.3rem 1.1rem;
      padding: 6px 1.1rem;
      background: #0b1220;
      border-top: 1px solid rgba(255, 255, 255, 0.08);
      box-shadow: 0 -6px 20px rgba(0, 0, 0, 0.3);
      font-size: 0.72rem;
      line-height: 1.4;
      color: rgba(199, 214, 230, 0.75);
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
    }
    .gl-footer-copy { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0; }
    .gl-footer-legal { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; flex: none; }
    .gl-footer-legal a { color: rgba(199, 214, 230, 0.75); text-decoration: none; transition: color 0.15s; }
    .gl-footer-legal a:hover { color: var(--accent, #7aa7ff); }
    .gl-footer-btc { display: inline-flex; align-items: center; gap: 0.4rem; white-space: nowrap; flex: none; }
    .gl-footer-btc code {
      font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
      font-size: 0.7rem;
      letter-spacing: 0.01em;
      color: rgba(199, 214, 230, 0.85);
    }
    .gl-footer-btc-icon { font-size: 0.82rem; line-height: 1; }
    /* Abréviations mobiles : « Cond. » / « Conf. » et masquage de l'adresse BTC. */
    .gl-short { display: none; }
    @media (max-width: 560px) {
      .gl-long { display: none; }
      .gl-short { display: inline; }
      .gl-footer-btc { display: none; }
    }

    .gl-modal-overlay {
      position: fixed;
      inset: 0;
      z-index: 100;
      display: none;
      align-items: center;
      justify-content: center;
      padding: 20px;
      background: rgba(8, 12, 22, 0.6);
      backdrop-filter: blur(3px);
    }
    .gl-modal-overlay.open { display: flex; }
    .gl-modal {
      position: relative;
      width: min(680px, 100%);
      max-height: 85vh;
      overflow-y: auto;
      background: #ffffff;
      color: #172033;
      border-radius: 12px;
      box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
      padding: 28px 32px 32px;
      line-height: 1.6;
      font-family: Inter, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
      animation: glModalIn 0.18s ease;
    }
    @keyframes glModalIn {
      from { transform: translateY(12px); opacity: 0; }
      to   { transform: translateY(0); opacity: 1; }
    }
    .gl-modal h2 { font-size: 1.45rem; margin: 0 0 4px; color: #172033; }
    .gl-modal h3 { font-size: 1.02rem; margin: 20px 0 6px; color: #172033; }
    .gl-modal p, .gl-modal li { color: #334155; font-size: 0.92rem; }
    .gl-modal ul { margin: 8px 0; padding-left: 22px; }
    .gl-modal a { color: #2563eb; }
    .gl-modal .gl-legal-meta { color: #607086; font-size: 0.85rem; margin-bottom: 16px; }
    .gl-modal .gl-legal-callout {
      margin: 16px 0;
      padding: 12px 14px;
      border-left: 4px solid #ca8a04;
      border-radius: 8px;
      background: #fffbeb;
      font-weight: 600;
      font-size: 0.9rem;
      color: #475569;
    }
    .gl-modal-close {
      position: absolute;
      top: 12px;
      right: 14px;
      width: 34px;
      height: 34px;
      border: none;
      border-radius: 50%;
      background: #eef2f7;
      color: #334155;
      font-size: 1.2rem;
      line-height: 1;
      cursor: pointer;
      transition: background 0.15s;
    }
    .gl-modal-close:hover { background: #dde4ec; }

    @media (max-width: 560px) {
      .gl-modal { padding: 22px 18px 26px; }
      .gl-footer { font-size: 0.68rem; }
    }
    /* ↑↑↑  fin du bloc générique footer + modales  ↑↑↑ */


/* =========================================================
   Correctif de mise en page — placé APRÈS le bloc template,
   qu'il ne modifie pas mais dont il neutralise un effet de bord.

   Le bloc footer pose `overflow-x: hidden` sur html et body. Sur une app
   d'un seul écran c'est inoffensif ; ici cela fait calculer `overflow-y`
   à `auto`, donc html et body deviennent des conteneurs de défilement.
   `position: sticky` du panneau latéral s'ancre alors sur eux plutôt que
   sur la fenêtre, et le panneau s'en va dès qu'on fait défiler la galerie.

   Le débordement horizontal reste maîtrisé sans ce garde-fou : `max-width:
   100%` sur body, `min-width: 0` sur les colonnes de la mosaïque.
   ========================================================= */
html, body { overflow-x: visible; overflow-y: visible; }
