/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --chrome-inset: 14px;
  --nav-clearance: 112px;
  --page-gutter: 1.5rem;
  --sticky-clearance: var(--nav-clearance);
  --content-rail-width: 560px;
  --ui-frame-pad: 2px;
  --ui-frame-gap: 3px;
  --ui-control-height: 22px;
  --ui-control-pad-x: 6px;
  --ui-control-pad-y: 2px;
  --form-checkbox-size: 13px;
  --edit-compact-button-width: 126px;
  --edit-compact-action-height: 18px;
}

/* ── TouchDesigner-style form reset : tout carré, compact, dense ── */
:root {
  --area-btn-bg:        #d7f4ff;
  --area-btn-border:    #93c8d0;
  --area-btn-grad:      linear-gradient(90deg, #d7f4ff 0%, #e2f7f2 48%, #ddf7ea 100%);
  --area-btn-grad-hi:   #83bfc8;
  --area-submit-bg:     #ddf7ea;
  --area-submit-border: #83bfc8;
  --area-submit-grad:   linear-gradient(90deg, #ddf7ea 0%, #e2f7f2 52%, #d7f4ff 100%);
  --area-side-grad:     linear-gradient(90deg, rgba(215, 244, 255, 0.62) 0%, rgba(215, 244, 255, 0.18) 60%, transparent 100%);
  --area-frame:         #93c8d0;
  --area-frame-soft:    rgba(215, 244, 255, 0.32);
}
body.area-public {
  --area-btn-bg:        #ffd2e5;
  --area-btn-border:    #c9b4c8;
  --area-btn-grad:      linear-gradient(90deg, #ffd2e5 0%, #ffe4f0 48%, #f8efff 100%);
  --area-btn-grad-hi:   #d9aabd;
  --area-submit-bg:     #f8efff;
  --area-submit-border: #c9b4c8;
  --area-submit-grad:   linear-gradient(90deg, #f8efff 0%, #ffe4f0 52%, #ffd2e5 100%);
  --area-side-grad:     linear-gradient(90deg, rgba(255, 211, 230, 0.62) 0%, rgba(255, 211, 230, 0.20) 60%, transparent 100%);
  --area-frame:         #c9b4c8;
  --area-frame-soft:    rgba(255, 211, 230, 0.32);
}
body[data-palette="encre"] {
  --area-btn-bg:        var(--surface);
  --area-btn-border:    var(--border);
  --area-btn-grad:      linear-gradient(90deg, var(--surface) 0%, var(--surface-overlay) 48%, var(--surface) 100%);
  --area-btn-grad-hi:   var(--accent);
  --area-submit-bg:     var(--surface);
  --area-submit-border: var(--accent);
  --area-submit-grad:   linear-gradient(90deg, var(--surface) 0%, var(--accent-soft) 48%, var(--surface) 100%);
  --area-side-grad:     linear-gradient(90deg, var(--accent-soft) 0%, transparent 100%);
  --area-frame:         var(--accent);
  --area-frame-soft:    var(--accent-soft);
}
body[data-palette="encre"].area-public {
  --area-btn-grad-hi:   var(--public);
  --area-submit-border: var(--public);
  --area-submit-grad:   linear-gradient(90deg, var(--surface) 0%, var(--public-soft) 48%, var(--surface) 100%);
  --area-frame:         var(--public);
  --area-frame-soft:    var(--public-soft);
}
/* Déconnecté : seuls les formulaires/boutons d'« aire » prennent la teinte du
   bouton « Entrer » (cyan) pour éclaircir les dégradés en nuit. Le MENU public
   (--public, rose) n'est jamais touché : il reste identique connecté/déconnecté. */
body[data-auth="guest"].area-public {
  --area-btn-bg:        #d7f4ff;
  --area-btn-border:    #93c8d0;
  --area-btn-grad:      linear-gradient(90deg, #d7f4ff 0%, #e2f7f2 48%, #ddf7ea 100%);
  --area-btn-grad-hi:   #83bfc8;
  --area-submit-bg:     #ddf7ea;
  --area-submit-border: #83bfc8;
  --area-submit-grad:   linear-gradient(90deg, #ddf7ea 0%, #e2f7f2 52%, #d7f4ff 100%);
  --area-side-grad:     linear-gradient(90deg, rgba(215, 244, 255, 0.62) 0%, rgba(215, 244, 255, 0.18) 60%, transparent 100%);
  --area-frame:         #93c8d0;
  --area-frame-soft:    rgba(215, 244, 255, 0.32);
}
body {
  --ui-accent:          var(--user-color, #cccac3);
  --ui-frame:           color-mix(in srgb, var(--ui-accent) 62%, var(--border) 38%);
  --ui-frame-strong:    color-mix(in srgb, var(--ui-accent) 74%, var(--fg-muted) 26%);
  --ui-frame-soft:      color-mix(in srgb, var(--ui-accent) 28%, transparent);
  --ui-bg:              color-mix(in srgb, var(--ui-accent) 16%, var(--surface) 84%);
  --ui-bg-strong:       color-mix(in srgb, var(--ui-accent) 32%, var(--surface) 68%);
  --ui-grad:            linear-gradient(
                          90deg,
                          color-mix(in srgb, var(--ui-accent) 48%, var(--surface) 52%) 0%,
                          color-mix(in srgb, var(--ui-accent) 22%, var(--surface) 78%) 100%
                        );
  --ui-side-grad:       linear-gradient(
                          90deg,
                          color-mix(in srgb, var(--ui-accent) 36%, transparent) 0%,
                          color-mix(in srgb, var(--ui-accent) 12%, transparent) 60%,
                          transparent 100%
                        );
}

input, select, textarea, button,
input[type="file"]::file-selector-button,
dialog, fieldset {
  border-radius: 0;
  font-family: inherit;
}
button,
input[type="button"],
input[type="submit"],
input[type="file"]::file-selector-button {
  appearance: none;
  -webkit-appearance: none;
}
/* Forcer le rendu carré sur les selects natifs (Safari/Chrome arrondissent par défaut) */
select {
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'><path fill='none' stroke='%23686860' stroke-width='1.2' d='M1 1.4l4 3.4 4-3.4'/></svg>");
  background-repeat: no-repeat;
  background-position: right 6px center;
  padding-right: 20px !important;
}
input[type="file"] {
  font-size: 0.72rem;
  color: var(--fg-soft);
  padding: 0;
  background: transparent;
  border: 0;
}
input[type="file"]::file-selector-button {
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 2px 8px;
  margin-right: 8px;
  cursor: pointer;
}
input[type="file"]::file-selector-button:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
}
/* Placeholder gris clair quand l'option vide est sélectionnée */
select:has(option[value=""]:checked) {
  color: var(--fg-faint);
}
select option {
  color: var(--fg);
}
select option[value=""] {
  color: var(--fg-faint);
}
html {
  font-size: 14px;
  scrollbar-width: none;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: var(--bg-grid-size, 28px) var(--bg-grid-size, 28px);
  transition: background-color 0.32s ease;
}
html::-webkit-scrollbar { display: none; }
body {
  font-family: Helvetica, Arial, sans-serif;
  min-height: 100vh;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: var(--bg-grid-size, 28px) var(--bg-grid-size, 28px);
  color: var(--fg);
  transition: background-color 0.32s ease, color 0.32s ease;
}
body.references-area,
body.references-explore-area {
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: var(--bg-grid-size, 28px) var(--bg-grid-size, 28px);
}
/* Modes de visualisation : on retire la grille pour laisser respirer la viz. */
html:has(body.atlas-area),
body.atlas-area {
  background: var(--bg);
}

/* Voile sous la nav : le contenu qui remonte se fond dans le fond avant
   de passer derrière les boutons du menu (évite les icônes qui leakent
   entre les frames des boutons). */
body::before {
  content: '';
  position: fixed;
  inset: 0 0 auto 0;
  height: var(--nav-clearance);
  z-index: 49;
  pointer-events: none;
  background:
    linear-gradient(var(--bg-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--bg-grid) 1px, transparent 1px),
    var(--bg);
  background-size: var(--bg-grid-size, 28px) var(--bg-grid-size, 28px);
  -webkit-mask: linear-gradient(to bottom, #000 0%, #000 68%, transparent 100%);
          mask: linear-gradient(to bottom, #000 0%, #000 68%, transparent 100%);
}
body.atlas-area::before {
  display: none;
}
a { color: inherit; text-decoration: none; }
.visually-hidden {
  position: absolute !important;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ── Custom font ── */
@font-face {
  font-family: 'AdvercaseFont';
  src: url('/assets/fonts/AdvercaseFont-Regular.otf') format('opentype');
  font-weight: normal;
  font-style: normal;
}

/* ── Nav ── */
#nav {
  position: fixed;
  top: var(--chrome-inset); left: 0; right: 0;
  display: flex; align-items: center;
  padding: 0 var(--chrome-inset);
  z-index: 100;
  pointer-events: none;
  background: transparent;
  border: none;
}

/* Logo — cadre simple, hauteur = cadre extérieur du menu */
.nav-logo {
  pointer-events: all;
  display: inline-flex;
  align-items: center;
  gap: 9px;
  border: 1px solid var(--fg);
  padding: 5px 16px;
  background: var(--surface-translucent);
}
.nav-logo a {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.95rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--fg);
  display: block;
  line-height: 1.2;
  text-transform: uppercase;
}
/* Petit cadre « bêta » collé au logo */
.nav-logo-beta {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.5rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg);
  border: 1px solid var(--fg);
  border-radius: 2px;
  padding: 1px 4px;
  line-height: 1.35;
  opacity: 0.62;
  white-space: nowrap;
}

.nav-center {
  pointer-events: none;
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  justify-content: stretch;
  align-items: flex-start;
  gap: 7px;
  width: min(var(--content-rail-width), calc(100vw - 24rem));
}

/* Menu centré — style TouchDesigner : chaque bouton a son cadre, cadre global en plus.
   Le flex-grow vient de --weight (passé inline depuis nav.php) pour que tous les
   boutons fassent la même largeur, quel que soit leur menu d'appartenance. */
.nav-menu {
  pointer-events: all;
  position: static;
  flex: var(--weight, 1) 1 0;
  min-width: 0;
  border: 1px solid var(--border);
  padding: var(--ui-frame-pad);
  background: var(--surface-translucent);
}
.nav-menu-private {
  border-color: var(--private);
  background: var(--private-soft);
}
.nav-menu-laboratory {
  border-color: var(--laboratory);
  background: var(--laboratory-soft);
}
.nav-links {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
  list-style: none;
  gap: var(--ui-frame-gap);
  padding: 0;
}
.nav-links li {
  display: block;
  position: relative;
}
.nav-links li a {
  display: block;
  border: 1px solid var(--border);
  padding: 3px 4px;
  background: var(--surface);
  color: var(--fg);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  text-align: center;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  line-height: 1.2;
  position: relative;
}
.nav-menu-public {
  border-color: var(--public);
  background: var(--public-soft);
}
.nav-menu-public .nav-links li .nav-primary-link {
  border-color: var(--public);
  background: var(--surface);
}
.nav-menu-public .nav-links li:nth-child(1) > .nav-primary-link:hover,
.nav-menu-public .nav-links li:nth-child(1) > .nav-primary-link.active,
.nav-menu-public .nav-links li:nth-child(2) > .nav-primary-link:hover,
.nav-menu-public .nav-links li:nth-child(2) > .nav-primary-link.active,
.nav-menu-public .nav-links li:nth-child(3) > .nav-primary-link:hover,
.nav-menu-public .nav-links li:nth-child(3) > .nav-primary-link.active {
  background: var(--public-grad);
  border-color: var(--public);
  z-index: 1;
}

.nav-menu-private .nav-links li .nav-primary-link {
  border-color: var(--private);
  background: var(--surface);
}
.nav-menu-private .nav-links li:nth-child(1) > .nav-primary-link:hover,
.nav-menu-private .nav-links li:nth-child(1) > .nav-primary-link.active,
.nav-menu-private .nav-links li:nth-child(2) > .nav-primary-link:hover,
.nav-menu-private .nav-links li:nth-child(2) > .nav-primary-link.active {
  background: var(--private-grad);
  border-color: var(--private);
  z-index: 1;
}
.nav-menu-laboratory .nav-links li .nav-primary-link {
  border-color: var(--laboratory);
  background: var(--surface);
}
.nav-menu-laboratory .nav-links li .nav-primary-link:hover,
.nav-menu-laboratory .nav-links li .nav-primary-link.active {
  background: var(--laboratory-grad);
  border-color: var(--laboratory);
  z-index: 1;
}
.nav-links li .nav-secondary-link {
  position: absolute;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  width: auto;
  height: 19px;
  border-color: var(--public);
  background: rgba(var(--surface-rgb), 0.62);
  color: var(--fg-soft);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  justify-content: stretch;
  gap: 0;
  padding: 0;
  z-index: 5;
  white-space: nowrap;
  overflow: visible;
  text-overflow: clip;
  font-size: 0.58rem;
  letter-spacing: 0.08em;
  line-height: 1;
  transform-origin: 50% 0;
  animation: nav-secondary-arrive 0.22s ease-out both;
}
.nav-links li .nav-secondary-link:hover {
  background: rgba(var(--surface-rgb), 0.92);
  border-color: var(--border);
  color: var(--fg);
}
.nav-links li .nav-contribute-link {
  border-color: var(--public);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--public) 34%, var(--surface) 66%) 0%, rgba(var(--surface-rgb), 0.94) 100%);
}
.nav-links li .nav-contribute-link::before {
  content: '+';
  align-self: stretch;
  width: 18px;
  height: auto;
  border: 0;
  border-right: 1px solid var(--public);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.58rem;
  line-height: 1;
}
.nav-links li .nav-contribute-link {
  text-align: center;
}
.nav-links li .nav-contribute-link:hover {
  background: var(--public-grad);
  border-color: var(--public);
  color: var(--fg);
}
.nav-links li .nav-contribute-link:hover::before {
  border-color: var(--public);
  color: var(--fg);
}
@keyframes nav-secondary-arrive {
  from {
    opacity: 0;
    transform: translateY(-4px) scaleY(0.82);
  }
  to {
    opacity: 1;
    transform: translateY(0) scaleY(1);
  }
}
.nav-tools {
  pointer-events: all;
  margin-left: auto;
  display: flex;
  gap: 6px;
  align-items: stretch;
}

.nav-auth {
  border: 1px solid color-mix(in srgb, var(--user-color, var(--fg)) 70%, var(--fg) 30%);
  padding: 2px;
  background: rgba(var(--surface-rgb), 0.94);
}
.nav-auth a {
  display: block;
  border: 1px solid color-mix(in srgb, var(--user-color, var(--fg)) 70%, var(--fg) 30%);
  padding: 2px 8px;
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--user-color, var(--surface)) 86%, var(--surface) 14%) 0%,
    color-mix(in srgb, var(--user-color, var(--surface)) 42%, var(--surface) 58%) 100%
  );
  color: var(--fg-muted);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.2;
}
body[data-palette="encre"] .nav-auth a {
  color: var(--bg);
  font-weight: 700;
}
.nav-auth a:hover,
.nav-auth a:focus-visible {
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--user-color, var(--surface)) 100%, var(--surface) 0%) 0%,
    color-mix(in srgb, var(--user-color, var(--surface)) 64%, var(--surface) 36%) 100%
  );
  border-color: color-mix(in srgb, var(--user-color, var(--fg)) 70%, var(--fg) 30%);
  color: var(--fg);
}
body[data-palette="encre"] .nav-auth a:hover,
body[data-palette="encre"] .nav-auth a:focus-visible {
  color: var(--bg);
}

/* ── Bascule jour / nuit : bouton carré compact, à gauche de l'auth ── */
.nav-theme-toggle {
  pointer-events: all;
  display: flex;
  border: 1px solid color-mix(in srgb, var(--user-color, var(--fg)) 70%, var(--fg) 30%);
  padding: 2px;
  margin: 0;
  background: rgba(var(--surface-rgb), 0.94);
  min-inline-size: 0;
}
.nav-theme-toggle .nav-theme-label {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1;
  width: 28px;
  min-height: 0;
  border: 1px solid color-mix(in srgb, var(--user-color, var(--fg)) 70%, var(--fg) 30%);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--user-color, var(--surface)) 86%, var(--surface) 14%) 0%,
    color-mix(in srgb, var(--user-color, var(--surface)) 42%, var(--surface) 58%) 100%
  );
  color: var(--fg-muted);
  cursor: pointer;
  transition: color 0.14s ease, background 0.14s ease;
}
.nav-theme-toggle .nav-theme-label:hover {
  color: var(--fg);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--user-color, var(--surface)) 100%, var(--surface) 0%) 0%,
    color-mix(in srgb, var(--user-color, var(--surface)) 64%, var(--surface) 36%) 100%
  );
}
body[data-palette="encre"] .nav-theme-toggle .nav-theme-label { color: var(--bg); }
.nav-theme-toggle input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.nav-theme-glyph { font-size: 0.82rem; line-height: 1; }
.nav-theme-moon { display: none; }
.nav-theme-toggle input[data-palette-toggle]:checked ~ .nav-theme-sun { display: none; }
.nav-theme-toggle input[data-palette-toggle]:checked ~ .nav-theme-moon { display: inline; }

/* ── Main offset ── */
main { padding-top: var(--nav-clearance); }

/* ── Portail / page d'entrée ── */
#portal {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem var(--page-gutter);
}
.portal-stage {
  display: grid;
  justify-items: center;
  position: relative;
  isolation: isolate;
}
.portal-frame {
  display: grid;
  justify-items: start;
  gap: 12px;
  padding: 20px 26px 18px;
  border: 1px solid var(--fg);
  background: var(--surface-translucent);
  position: relative;
}
.portal-tag {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.55rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--fg-faint);
}
.portal-rule {
  width: 100%;
  height: 1px;
  background: var(--fg);
  opacity: 0.4;
}
.portal-sub {
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  color: var(--fg-soft);
}
.portal-stage.has-glyph {
  width: min(760px, calc(100vw - 2rem));
  min-height: min(540px, calc(100vh - 2rem));
  align-content: center;
}
.portal-glyph-canvas {
  position: absolute;
  inset: 50% auto auto 50%;
  width: min(72vw, 620px);
  height: min(72vw, 620px);
  max-height: 72vh;
  transform: translate(-50%, -50%);
  z-index: -1;
  opacity: 0.92;
  pointer-events: none;
}
.portal-title {
  font-family: Helvetica, Arial, sans-serif;
  font-size: clamp(2.2rem, 6vw, 3.6rem);
  font-weight: 700;
  letter-spacing: 0.04em;
  line-height: 0.95;
  margin: 0;
  color: var(--fg);
  text-transform: uppercase;
  position: relative;
  z-index: 1;
}
.portal-title span {
  display: inline-block;
  opacity: 0;
  transform: translateY(6px);
  animation: portal-letter-in 0.6s ease-out forwards;
}
.portal-title span:nth-child(1) { animation-delay: 0.04s; }
.portal-title span:nth-child(2) { animation-delay: 0.10s; }
.portal-title span:nth-child(3) { animation-delay: 0.16s; }
.portal-title span:nth-child(4) { animation-delay: 0.22s; }
.portal-title span:nth-child(5) { animation-delay: 0.28s; }
.portal-title span:nth-child(6) { animation-delay: 0.34s; }
@keyframes portal-letter-in {
  to { opacity: 1; transform: translateY(0); }
}
.portal-text {
  display: grid;
  gap: 4px;
  max-width: 48ch;
  opacity: 0;
  animation: portal-fade-in 0.7s ease-out 0.5s forwards;
}
.portal-text p {
  font-size: 0.82rem;
  line-height: 1.5;
  color: var(--fg-soft);
}
.portal-glyph-title {
  border: 1px solid color-mix(in srgb, var(--user-color, var(--accent)) 54%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-soft);
  font-size: 0.62rem;
  letter-spacing: 0.16em;
  line-height: 1.2;
  padding: 3px 8px;
  position: relative;
  text-transform: uppercase;
  z-index: 1;
}
.portal-enter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--fg);
  background: transparent;
  color: var(--fg);
  font-family: Helvetica, Arial, sans-serif;
  font-size: 0.66rem;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  padding: 8px 16px;
  margin-top: 2px;
  transition: background 0.14s ease, color 0.14s ease;
  position: relative;
  z-index: 1;
}
.portal-enter span { transition: transform 0.14s ease; }
.portal-enter:hover,
.portal-enter:focus-visible {
  background: var(--fg);
  color: var(--bg);
  outline: none;
}
.portal-enter:hover span { transform: translateX(3px); }
@keyframes portal-fade-in {
  to { opacity: 1; }
}
/* Sur la page portail on cache totalement la nav : entrée nue, juste la grille. */
body.portal-area #nav,
body.portal-area::before {
  display: none;
}
body.portal-area #portal { padding-top: 0; }

/* ── Tags ── */
.tag {
  display: inline-block;
  font-size: 0.7rem;
  padding: 1px 5px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.7);
  color: var(--fg-soft);
  letter-spacing: 0.03em;
}

/* ── Tag filters ── */
.index-tools {
  padding: 1rem 1.5rem 0;
  display: grid;
  gap: 10px;
}
.index-search {
  display: flex;
  gap: 6px;
  align-items: stretch;
  width: min(520px, 100%);
}
.index-search input {
  min-width: 0;
  flex: 1;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.92);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  padding: 4px 7px;
  line-height: 1.3;
  outline: none;
}
.index-search input:focus {
  border-color: var(--fg);
}
.index-search button {
  border: 1px solid var(--private);
  background: var(--private-soft);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 9px;
  line-height: 1.4;
  cursor: pointer;
}
.index-search a {
  align-self: center;
  color: var(--fg-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
/* ── Projects grid ── */
#projects-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 1rem 1.5rem 1.5rem;
  background: transparent;
  margin-top: 1rem;
  align-items: start;
}
.index-page-layout {
  display: grid;
  grid-template-columns: 178px minmax(0, var(--content-rail-width)) 178px;
  gap: 10px;
  padding: var(--nav-clearance) var(--page-gutter) 3rem;
  align-items: start;
  justify-content: center;
}
#projects-page #projects-grid {
  width: 100%;
  max-width: var(--content-rail-width);
  padding: 0;
  margin-top: 0;
}

/* Carte = cadre extérieur (contient 2 éléments → double cadre logique) */
.project-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  border: 1px solid var(--thumb-color, #c8c8c0);
  padding: 2px;
  background: rgba(var(--surface-rgb), 0.9);
  transition: border-color 0.1s;
  min-width: 0;
}
.project-card:hover { border-color: color-mix(in srgb, var(--thumb-color, #c8c8c0) 88%, var(--fg) 12%); }

/* Cadre image */
.card-thumb {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--thumb-color, #c8c8c0);
  overflow: hidden;
  display: block;
  transition: border-color 0.1s;
}
.project-card:hover .card-thumb { border-color: color-mix(in srgb, var(--thumb-color, #c8c8c0) 88%, var(--fg) 12%); }

.card-thumb img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}
.card-thumb-placeholder {
  width: 100%;
  height: 100%;
  background:
    var(--thumb-grad, linear-gradient(135deg, color-mix(in srgb, var(--thumb-color, #c8c8c0) 66%, var(--surface)), rgba(var(--surface-rgb), 0.82))),
    repeating-linear-gradient(115deg, rgba(var(--fg-rgb), 0.08) 0 1px, transparent 1px 16px);
}

/* Cadre bandeau — séparé du cadre image */
.card-meta {
  border: 1px solid var(--thumb-color, #c8c8c0);
  padding: 1px 4px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 5px;
  background: var(--thumb-grad, rgba(var(--surface-rgb), 0.92));
  transition: border-color 0.1s;
  min-height: 21px;
}
.project-card:hover .card-meta { border-color: color-mix(in srgb, var(--thumb-color, #c8c8c0) 88%, var(--fg) 12%); }

.card-title {
  font-size: 0.72rem;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}
.card-year {
  font-size: 0.68rem;
  color: var(--fg-muted);
  white-space: nowrap;
  flex-shrink: 0;
}

/* ── Librairie : variations cards (projet rose / référence bleu) ── */
.project-card-project {
  --thumb-color: var(--public, #d9aabd);
  --thumb-grad: var(--public-grad);
}
.project-card-ref {
  --thumb-color: var(--private, #93c8d0);
  --thumb-grad: var(--private-grad);
}
.project-card-ref-locked .card-thumb img {
  filter: blur(9px);
  transform: scale(1.08);
}
/* Le bandeau meta passe en colonne : titre puis sous-titre artiste. */
.project-card .card-meta {
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  padding: 2px 4px 3px;
  min-height: auto;
}
.project-card .card-subtitle {
  font-size: 0.62rem;
  color: var(--fg-soft);
  letter-spacing: 0.02em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Sidebar librairie : empilement de 2 blocs séparés, figé au scroll. */
.library-sidebar {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: start;
  position: sticky;
  top: var(--sticky-clearance);
  max-height: calc(100vh - var(--sticky-clearance) - 24px);
  overflow-y: auto;
  scrollbar-width: none;
}
.library-sidebar::-webkit-scrollbar { display: none; }
.library-block {
  width: 100%;
}
.library-search-block {
  width: 100%;
}
.library-block-type,
.library-filter-block {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.86);
  padding: var(--ui-frame-pad);
  display: grid;
  gap: var(--ui-frame-gap);
  align-content: start;
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
}
.library-block-label {
  display: block;
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
  margin-bottom: 0;
}
.index-search-panel {
  display: grid;
  gap: var(--ui-frame-gap);
}
.index-type-filter {
  display: grid;
  gap: var(--ui-frame-gap);
  margin-top: 0;
  padding: var(--ui-frame-pad);
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.56);
}
.index-type-filter a {
  display: block;
  color: var(--fg-soft);
  font-size: 0.74rem;
  letter-spacing: 0;
  line-height: 1.25;
  min-height: 0;
  padding: 1px 3px;
  text-align: left;
  text-transform: none;
  background: transparent;
  border: none;
  transition: background 0.15s, color 0.15s;
}
.index-type-filter a:hover,
.index-type-filter a.active {
  color: var(--fg);
  background: var(--ui-side-grad);
}
.index-type-filter a.active {
  font-weight: 500;
}

/* ── Project single ── */
#project-single {
  max-width: none;
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  margin: var(--nav-clearance) auto 4rem;
  padding: 3px;
}
.detail-page {
  --detail-frame: var(--public);
  --detail-soft: var(--public-soft);
  border: 1px solid var(--detail-outer-frame, var(--ui-frame));
  background: rgba(var(--surface-rgb), 0.9);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  display: grid;
  gap: var(--ui-frame-gap);
  padding: 3px;
}
.detail-page-private {
  --detail-frame: var(--private);
  --detail-soft: var(--private-soft);
}
.project-header {
  display: grid;
  gap: 2px;
  margin-bottom: 0;
  padding: 2px 4px 3px;
  position: relative;
}
.detail-page .detail-header-band {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, auto);
  align-items: start;
  column-gap: 16px;
  margin: -3px -3px 0;
  padding: 8px 10px 9px;
  background: linear-gradient(90deg, var(--detail-soft) 0%, rgba(var(--surface-rgb), 0.72) 100%);
}
.detail-header-main {
  min-width: 0;
}
.detail-header-main h1 {
  margin: 0;
}
.detail-header-side {
  display: grid;
  gap: 1px;
  justify-items: end;
  justify-self: end;
  max-width: min(42%, 18rem);
  min-width: 7rem;
  padding: 3px 0 0 10px;
  text-align: right;
}
.detail-header-date {
  color: var(--fg);
  font-size: 0.82rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.08;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  text-transform: none;
  white-space: nowrap;
}
.detail-header-location {
  color: var(--fg-soft);
  font-size: 0.72rem;
  font-style: normal;
  line-height: 1.15;
  margin: 0;
}
.detail-author-line {
  color: var(--fg-soft);
  min-width: 0;
}
.detail-page .detail-author-line a {
  border-bottom: 0;
  color: inherit;
  text-decoration: none;
}
.detail-page .detail-author-line a:hover {
  color: var(--fg);
  background: var(--detail-soft);
}
.project-header-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
}
.project-header h1 {
  font-size: 1.32rem;
  font-weight: 600;
  line-height: 1.12;
  min-width: 0;
}
.project-year { font-size: 0.82rem; color: var(--fg-muted); }
.project-meta-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  color: var(--fg-soft);
  font-size: 0.78rem;
}
.project-meta-line a {
  border-bottom: 1px solid var(--border-soft);
}
.project-tags { display: flex; flex-wrap: wrap; gap: 4px; }
.project-author {
  margin-top: 2px;
  color: var(--fg-soft);
  font-size: 0.78rem;
}
.project-author .meta-label {
  margin-bottom: 2px;
}

.project-body {
  border-top: 1px solid var(--detail-frame);
  line-height: 1.45;
  margin: -5px -3px 0;
  padding: 6px 8px;
  font-size: 0.84rem;
}

.project-gallery {
  display: grid;
  gap: 8px;
  margin: 0;
}
.project-gallery figure {
  border: 1px solid var(--detail-frame);
  padding: 2px;
  background: rgba(var(--surface-rgb), 0.92);
}
.project-gallery img {
  width: 100%;
  display: block;
}
.project-gallery figcaption {
  padding: 5px 6px 3px;
  color: var(--fg-muted);
  font-size: 0.72rem;
}

.meta-label {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin-bottom: 4px;
}
.project-related,
.project-cited-refs {
  display: grid;
  gap: 4px;
}
.related-grid {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.related-card {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border: 1px solid color-mix(in srgb, var(--detail-frame) 42%, #d8d8d1);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 2px 4px;
  transition: background 0.1s;
  font-size: 0.74rem;
}
.related-title {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.related-card:hover { background: var(--detail-soft); }
.related-year { font-size: 0.75rem; color: var(--fg-muted); }


/* ── About ── */
#about {
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  margin: 0 auto;
  padding: var(--nav-clearance) 0 5rem;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 8px;
  align-items: start;
  justify-content: center;
}
.about-panel {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.86);
  padding: var(--ui-frame-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  display: grid;
  gap: var(--ui-frame-gap);
  min-width: 0;
  --about-accent: var(--public);
  --about-accent-soft: var(--public-soft);
}
.about-panel-title {
  display: block;
  border: 1px solid var(--about-accent);
  background:
    linear-gradient(90deg, var(--about-accent-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
}
.about-panel-content {
  border: 1px solid var(--about-accent);
  background: rgba(var(--surface-rgb), 0.66);
  padding: var(--ui-frame-pad);
  min-width: 0;
}
.about-text-body {
  border: 1px solid var(--public);
  background: rgba(var(--surface-rgb), 0.7);
  padding: 5px 7px;
  min-width: 0;
}
.about-text {
  line-height: 1.32;
  font-size: 0.82rem;
}
.about-text p {
  margin: 0;
}
.about-text p + p {
  margin-top: 0.72em;
}
.about-secondary {
  display: grid;
  gap: 8px;
  margin-top: 6px;
}
.about-text,
.about-secondary {
  grid-column: 1;
}
.about-side {
  position: absolute;
  left: calc(100% + 8px);
  top: var(--nav-clearance);
  width: 178px;
  display: grid;
  gap: 8px;
  align-self: start;
}
.about-secondary-pair {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
  align-items: stretch;
}
.about-secondary-pair > .about-panel {
  align-content: start;
  grid-template-rows: auto auto;
  height: auto;
}
.about-secondary-pair .about-panel-content {
  align-self: start;
  display: grid;
  align-content: center;
  gap: var(--ui-frame-gap);
}
.about-version {
  display: grid;
  gap: var(--ui-frame-gap);
}
.about-version strong {
  display: block;
  font-size: 0.8rem;
  line-height: 1.15;
}
.about-version small,
.about-updates span,
.about-support p,
.about-support-pending {
  color: var(--fg-soft);
  font-size: 0.64rem;
  line-height: 1.12;
}
.about-version small {
  display: block;
  margin-top: 0;
}
.about-updates ol {
  display: grid;
  gap: var(--ui-frame-gap);
  list-style: none;
}
.about-updates li {
  border: 1px solid var(--about-accent);
  background: rgba(var(--surface-rgb), 0.66);
  display: grid;
  gap: 1px;
  padding: 3px 5px;
}
.about-updates time {
  color: var(--fg-muted);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
}
.about-updates strong {
  font-size: 0.72rem;
  line-height: 1.15;
}
.about-support {
  display: grid;
  gap: var(--ui-frame-gap);
  --about-accent: #6dd5a4;
  --about-accent-soft: color-mix(in srgb, #6dd5a4 34%, transparent);
}
.about-version {
  --about-accent: color-mix(in srgb, var(--border) 70%, var(--surface) 30%);
  --about-accent-soft: color-mix(in srgb, var(--border-soft) 42%, transparent);
}
.about-updates {
  --about-accent: color-mix(in srgb, var(--border) 70%, var(--surface) 30%);
  --about-accent-soft: color-mix(in srgb, var(--border-soft) 42%, transparent);
}
.about-legal-short {
  --about-accent: color-mix(in srgb, var(--border) 70%, var(--surface) 30%);
  --about-accent-soft: color-mix(in srgb, var(--border-soft) 42%, transparent);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.about-legal-short .about-panel-title { grid-column: 1 / -1; }
.about-support a,
.about-support-pending,
.about-legal-short a {
  border: 1px solid var(--about-accent);
  background: rgba(var(--surface-rgb), 0.62);
  color: var(--fg);
  display: block;
  font-size: 0.7rem;
  line-height: 1.2;
  padding: 3px 5px;
}
.about-support a:hover,
.about-legal-short a:hover {
  background: linear-gradient(90deg, var(--about-accent-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
}
.about-support-pending {
  color: var(--fg-muted);
}
.about-support-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: var(--ui-frame-gap);
  align-items: stretch;
  align-self: stretch;
}
.about-support-text,
.about-support-action {
  border: 1px solid var(--about-accent);
  background: rgba(var(--surface-rgb), 0.62);
  display: grid;
  align-items: center;
  min-width: 0;
}
.about-support-text {
  padding: 2px 4px;
}
.about-support-text p { margin: 0; }
.about-support-action {
  padding: 0;
}
.about-version .about-panel-content {
  align-items: center;
  align-self: stretch;
  display: grid;
  gap: 1px;
  min-height: 28px;
  padding: 2px 4px;
}
.about-support-link {
  align-items: center;
  background: transparent !important;
  border: 0 !important;
  display: inline-grid !important;
  grid-template-columns: 18px minmax(46px, 1fr);
  height: auto;
  justify-self: stretch;
  min-height: 22px;
  min-width: 72px;
  padding: 0;
}
.about-support-link:hover {
  background: transparent !important;
}
.about-support-action:hover {
  background: linear-gradient(90deg, var(--about-accent-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
}
.about-support-action .about-support-pending {
  border: 0;
  display: grid;
  height: 100%;
  place-items: center;
}
.about-support-link > span:first-child {
  align-items: center;
  align-self: center;
  border-right: 1px solid var(--about-accent);
  background: var(--about-accent-soft);
  display: inline-flex;
  font-size: 0.74rem;
  height: 20px;
  justify-content: center;
  line-height: 1;
  width: 18px;
}
.about-support-link > span:last-child {
  display: block;
  font-size: 0.66rem;
  padding: 0 6px;
  text-align: center;
}
.about-counters dl {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--ui-frame-gap);
}
.about-counters div {
  border: 1px solid var(--public);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 4px 5px 5px;
  min-width: 0;
}
.about-counters dt {
  font-size: 1.1rem;
  font-weight: 600;
  line-height: 1;
}
.about-counters dd {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.12em;
  line-height: 1.15;
  margin-top: 3px;
  text-transform: uppercase;
}
.about-contact a {
  font-size: 0.85rem;
  border-bottom: 1px solid #ddd;
  padding-bottom: 1px;
}
.about-contact a:hover { border-color: var(--fg); }
.about-participants {
  margin-top: 0;
  display: grid;
  gap: var(--ui-frame-gap);
}
.about-participants > div {
  display: grid;
  gap: 4px;
}
.about-person {
  border: 1px solid color-mix(in srgb, var(--user-color) 55%, #b8b8b0);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--user-color) 35%, var(--surface)) 0%, rgba(var(--surface-rgb), 0.76) 100%);
  display: grid;
  grid-template-columns: 16px minmax(0, 1fr);
  gap: 5px;
  align-items: center;
  padding: 2px;
}
.about-person > span {
  width: 14px;
  height: 14px;
  border: 1px solid var(--border-soft);
  background: var(--user-color);
}
.about-participants h2 {
  overflow: hidden;
  font-size: 0.78rem;
  line-height: 1.1;
  margin: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.about-admin-link a {
  color: var(--fg-muted);
  font-size: 0.72rem;
}
.about-admin-link {
  margin-top: 1.2rem;
}
.about-admin-link a {
  border-bottom: 1px solid var(--public);
}

/* ── Legal ── */
#legal-page {
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  margin: 0 auto;
  padding: var(--nav-clearance) 0 5rem;
  display: grid;
  gap: 8px;
}
.legal-header,
.legal-panel {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.9);
  padding: var(--ui-frame-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
}
.legal-header {
  display: grid;
  gap: var(--ui-frame-gap);
}
.legal-header h1,
.legal-panel > span,
.legal-panel h2 {
  border: 1px solid var(--legal-accent, var(--public));
  background:
    linear-gradient(90deg, var(--legal-accent-soft, var(--public-soft)) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  display: block;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
}
.legal-header h1 {
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: 0;
  line-height: 1.15;
  padding: 4px 7px;
  text-transform: none;
}
.legal-header p,
.legal-panel p {
  color: var(--fg-soft);
  font-size: 0.76rem;
  line-height: 1.38;
  margin: 0;
}
.legal-panel p + p {
  margin-top: 0.5em;
}
.legal-panel {
  display: grid;
  gap: var(--ui-frame-gap);
}
.legal-warning {
  --legal-accent: var(--danger, #b84a4a);
  --legal-accent-soft: var(--danger-soft, rgba(184, 74, 74, 0.1));
}
.legal-definition-list {
  display: grid;
  gap: var(--ui-frame-gap);
}
.legal-definition-list div {
  border: 1px solid color-mix(in srgb, var(--public) 42%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.7);
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 8px;
  padding: 3px 5px;
}
.legal-definition-list dt {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.legal-definition-list dd {
  color: var(--fg);
  font-size: 0.76rem;
  line-height: 1.25;
  min-width: 0;
  overflow-wrap: anywhere;
}
.legal-panel a {
  border-bottom: 1px solid var(--border-soft);
}
.legal-panel a:hover {
  border-color: var(--fg);
}
.legal-panel-body {
  border: 1px solid var(--legal-accent, var(--public));
  background: rgba(var(--surface-rgb), 0.66);
  padding: 4px 6px;
}

@media (max-width: 620px) {
  .legal-definition-list div {
    grid-template-columns: minmax(0, 1fr);
    gap: 1px;
  }
}

/* ── Auth ── */
#login-page {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 6rem 1rem;
}
#login-page.view-login .auth-signup,
#login-page.view-signup .auth-login {
  display: none;
}
.auth-view {
  width: min(520px, calc(100vw - 2rem));
  display: grid;
  gap: 7px;
}
.auth-signup {
  width: min(620px, calc(100vw - 2rem));
  grid-template-columns: 36px minmax(0, 1fr);
  align-items: start;
  justify-content: center;
  gap: 8px;
}
.auth-signup-back {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  align-self: start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--public);
  background: var(--public-soft);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  line-height: 1;
  padding: 1px 8px 2px;
  cursor: pointer;
}
.auth-signup-back:hover {
  background: var(--public-grad);
  border-color: var(--public);
}
.auth-panel,
.edit-panel {
  width: min(520px, calc(100vw - 2rem));
  border: 1px solid var(--area-frame);
  background: rgba(var(--surface-rgb), 0.9);
  padding: var(--ui-frame-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
}
.auth-view .auth-panel {
  width: 100%;
}
.auth-signup .auth-panel {
  grid-column: 2;
  grid-row: 1;
}
.auth-kicker,
.edit-panel-head span,
.studio-header span {
  display: block;
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  margin-bottom: 5px;
}
.auth-panel h1,
.edit-panel h1,
.studio-header h1 {
  font-size: 1.2rem;
  font-weight: 600;
  margin-bottom: 16px;
}
.auth-panel form,
.edit-panel form,
.profile-form {
  display: grid;
  gap: var(--ui-frame-gap);
}
.auth-birth {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, rgba(var(--surface-rgb), 0.78) 0%, rgba(var(--surface-rgb), 0.52) 100%);
  display: grid;
  grid-template-columns: 148px minmax(0, 1fr);
  gap: var(--ui-frame-gap);
  min-height: 154px;
  overflow: hidden;
  padding: var(--ui-frame-pad);
}
.auth-birth canvas {
  aspect-ratio: 1 / 1;
  border: 1px solid color-mix(in srgb, var(--user-color, #cccac3) 44%, var(--border-soft));
  display: block;
  height: 148px;
  width: 148px;
}
.auth-birth-meta {
  align-self: end;
  display: grid;
  gap: 3px;
  min-width: 0;
}
.auth-birth-meta span {
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  line-height: 1.15;
  text-transform: uppercase;
}
.auth-birth-meta small {
  color: var(--fg-muted);
  font-size: 0.68rem;
  line-height: 1.22;
}
.auth-panel form > label {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 62%, rgba(var(--surface-rgb), 0.9) 100%);
  padding: var(--ui-frame-pad);
}
.auth-panel form > label.auth-checkbox {
  display: grid;
  align-items: center;
  gap: 6px;
  grid-template-columns: 14px minmax(0, 1fr);
  min-height: var(--ui-control-height);
}
.auth-panel label,
.edit-panel label,
.profile-form label {
  display: grid;
  gap: var(--ui-frame-gap);
}
.auth-panel label span,
.edit-panel label span,
.profile-form label span {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}
.auth-panel input,
.auth-panel textarea,
.edit-panel input,
.edit-panel textarea,
.edit-panel select,
.profile-form input,
.profile-form textarea,
.refs-filter input,
.refs-filter select {
  width: 100%;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.92);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
  outline: none;
  line-height: 1.22;
  min-height: var(--ui-control-height);
}
.auth-panel input:focus,
.auth-panel textarea:focus,
.edit-panel input:focus,
.edit-panel textarea:focus,
.edit-panel select:focus,
.profile-form input:focus,
.profile-form textarea:focus,
.refs-filter input:focus,
.refs-filter select:focus {
  border-color: var(--fg);
}
.auth-panel textarea {
  resize: none;
  overflow: hidden;
}
.form-checkbox {
  cursor: pointer;
}
.form-checkbox input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  background: rgba(var(--surface-rgb), 0.92);
  border: 1px solid var(--border-soft);
  cursor: pointer;
  height: var(--form-checkbox-size);
  margin: 0;
  max-height: var(--form-checkbox-size);
  max-width: var(--form-checkbox-size);
  min-height: var(--form-checkbox-size);
  min-width: var(--form-checkbox-size);
  padding: 0;
  place-self: center start;
  width: var(--form-checkbox-size);
}
.form-checkbox input[type="checkbox"]:checked {
  background:
    linear-gradient(90deg, var(--area-submit-bg) 0%, var(--area-btn-bg) 100%);
  border-color: var(--area-submit-border);
  box-shadow: inset 0 0 0 3px rgba(var(--surface-rgb), 0.86);
}
.form-checkbox input[type="checkbox"]:focus-visible {
  border-color: var(--fg);
  outline: 1px solid var(--fg);
  outline-offset: 2px;
}
.form-checkbox > span {
  align-self: center;
}
.auth-panel button,
.auth-actions button,
.edit-panel button,
.form-actions button,
.profile-form button,
.admin-user-card button,
.refs-filter button,
.studio-header a,
.edit-panel-head a,
.ref-detail-actions a {
  width: fit-content;
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 9px;
  line-height: 1.3;
  min-height: 20px;
  cursor: pointer;
}
.login-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.auth-signup .auth-actions {
  grid-column: 2;
}
.signup-actions {
  display: flex;
  justify-content: flex-end;
}
.join-toggle {
  margin-left: auto;
  background: var(--surface-translucent) !important;
  border-color: var(--public) !important;
}
.color-choice {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 62%, rgba(var(--surface-rgb), 0.9) 100%);
  padding: var(--ui-frame-pad);
  display: grid;
  gap: var(--ui-frame-gap);
}
.color-choice-label {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}
.color-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 5px;
}
.color-grid label {
  display: block;
}
.color-grid input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.color-grid span {
  display: block;
  width: 22px;
  height: 22px;
  border: 1px solid var(--border);
  background: var(--choice-color);
  cursor: pointer;
}
.color-grid input:checked + span {
  border-color: var(--fg);
  box-shadow: 0 0 0 2px rgba(var(--fg-rgb), 0.08);
}

.palette-mode-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
  border: 1px solid var(--ui-frame);
  background: var(--ui-bg);
  padding: 3px 4px 3px 6px;
  cursor: pointer;
}
.palette-mode-toggle > span:first-child {
  color: var(--fg-soft);
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  line-height: 1.1;
}
.palette-mode-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.palette-mode-switch {
  border: 1px solid var(--border);
  background: var(--surface-overlay);
  color: var(--fg-muted);
  min-width: 38px;
  height: 15px;
  padding: 0 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.palette-mode-switch span {
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1;
}
.palette-mode-toggle:hover {
  border-color: var(--ui-frame-strong);
  background: var(--ui-grad);
}
.palette-mode-toggle input[type="checkbox"]:checked + .palette-mode-switch {
  background: var(--ui-frame);
  border-color: var(--ui-frame-strong);
  color: var(--fg);
}
.palette-mode-toggle input[type="checkbox"]:focus-visible + .palette-mode-switch {
  outline: 2px solid var(--ui-frame-strong);
  outline-offset: 2px;
}

/* ── Palette mode toggle ─────────────────────────────────────────────────── */
.palette-choice {
  border: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 6px;
}
.palette-choice legend {
  color: var(--fg-muted);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.auth-panel button:hover,
.auth-actions button:hover,
.edit-panel button:hover,
.form-actions button:hover,
.profile-form button:hover,
.admin-user-card button:hover,
.refs-filter button:hover,
.studio-header a:hover,
.edit-panel-head a:hover,
.ref-detail-actions a:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
  color: var(--fg);
}
.form-actions button[type="submit"]:not(.danger),
.profile-form > button[type="submit"],
.profile-floating-submit button[type="submit"] {
  background: var(--area-submit-bg);
  border-color: var(--area-submit-border);
}
.form-actions button[type="submit"]:not(.danger):hover,
.profile-form > button[type="submit"]:hover,
.profile-floating-submit button[type="submit"]:hover {
  background: var(--area-submit-grad);
  border-color: var(--area-submit-border);
}
.form-error {
  color: var(--danger);
  font-size: 0.74rem;
}
.form-success {
  color: var(--success);
  font-size: 0.74rem;
}
.form-help {
  color: var(--fg-muted);
  font-size: 0.68rem;
  line-height: 1.3;
  margin: 0;
}

/* ── Profile ── */
#profile-page {
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  margin: 0 auto;
  padding: var(--nav-clearance) 0 4rem;
  display: grid;
  gap: 6px;
  position: relative;
  --profile-gap: var(--ui-frame-gap);
  --profile-pad: var(--ui-frame-pad);
  --profile-control: var(--ui-control-height);
}
.profile-panel,
.profile-list,
.profile-display-panel,
.profile-publication-note,
.profile-glyph-workshop,
.profile-glyph-titles {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.9);
  padding: var(--profile-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
}
.profile-panel {
  display: grid;
  gap: var(--profile-gap);
}
.profile-form {
  gap: var(--profile-gap);
}
.profile-form-field {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 62%, rgba(var(--surface-rgb), 0.9) 100%);
  padding: var(--profile-pad);
  display: grid;
  gap: var(--profile-gap);
}
.profile-form-field > span,
.profile-name-grid label span {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  margin: 0;
}
.profile-name-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: var(--profile-gap);
}
.profile-name-grid label {
  display: grid;
  gap: var(--profile-gap);
}
.profile-password-field {
  width: 100%;
}
.profile-form input:not([type="radio"]):not([type="checkbox"]) {
  border-color: var(--border-soft);
  background: rgba(var(--surface-rgb), 0.96);
  min-height: var(--profile-control);
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
}
.profile-checkbox-field {
  grid-template-columns: auto minmax(0, 1fr);
  align-items: center;
}
.profile-checkbox-field input[type="checkbox"] {
  width: auto;
  min-height: 0;
}
.profile-contact-field {
  grid-template-columns: minmax(10rem, 0.72fr) minmax(16rem, 1.28fr);
  align-items: end;
}
.profile-contact-field .profile-email-field {
  display: grid;
  gap: var(--profile-gap);
  min-width: 0;
}
.profile-newsletter-toggle {
  align-items: center;
  align-self: end;
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--success, #6dd5a4) 13%, var(--surface) 87%) 0%, rgba(var(--surface-rgb), 0.86) 100%);
  border: 1px solid color-mix(in srgb, var(--success, #6dd5a4) 38%, var(--border-soft) 62%);
  cursor: pointer;
  display: grid !important;
  gap: 10px;
  grid-template-columns: minmax(0, 1fr) auto;
  min-height: var(--profile-control);
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
  width: 100%;
}
.profile-newsletter-toggle > span:first-child {
  color: var(--fg);
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-transform: uppercase;
  white-space: normal;
}
.profile-newsletter-toggle input[type="checkbox"] {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}
.profile-newsletter-switch {
  align-items: center;
  background: var(--surface-overlay);
  border: 1px solid var(--border);
  color: var(--fg-muted);
  display: inline-flex;
  font-size: 0.62rem !important;
  height: 15px;
  justify-content: center;
  letter-spacing: 0.08em !important;
  min-width: 38px;
  padding: 0 4px;
}
.profile-newsletter-toggle input[type="checkbox"]:checked + .profile-newsletter-switch {
  background: color-mix(in srgb, var(--success, #6dd5a4) 24%, var(--surface) 76%);
  border-color: var(--success, #6dd5a4);
  color: var(--fg);
}
.profile-newsletter-toggle:hover {
  border-color: var(--success, #6dd5a4);
}
.profile-newsletter-toggle input[type="checkbox"]:focus-visible + .profile-newsletter-switch {
  outline: 2px solid var(--ui-frame-strong);
  outline-offset: 2px;
}
.profile-floating-submit {
  margin-top: 0;
  white-space: nowrap;
}
.profile-floating-submit button[type="submit"] {
  border-color: var(--ui-frame);
  background: var(--ui-bg);
  width: 100%;
}
.profile-floating-submit button[type="submit"]:hover {
  border-color: var(--ui-frame-strong);
  background: var(--ui-grad);
}
.profile-list {
  display: grid;
  gap: var(--profile-gap);
}
.profile-list > span {
  margin-bottom: 0;
}
.profile-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 0;
  border: 1px solid var(--ui-frame);
  background: var(--ui-bg);
  padding: 3px 6px;
}
.profile-head span,
.profile-list > span,
.profile-display-panel > span,
.profile-publication-note > span {
  display: block;
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
}
.profile-head h1 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 0;
  line-height: 1.15;
}
.profile-logout {
  width: 100%;
  min-height: 20px;
  white-space: nowrap;
  border: 1px solid var(--danger);
  background: rgba(var(--surface-rgb), 0.62);
  color: var(--danger);
  display: grid;
  place-items: center;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 9px;
  line-height: 1.3;
}
.profile-logout:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
.profile-side-panels {
  position: absolute;
  right: calc(100% + 10px);
  top: var(--nav-clearance);
  width: 190px;
  display: grid;
  gap: 6px;
}
.profile-right-panels {
  position: absolute;
  left: calc(100% + 10px);
  top: var(--nav-clearance);
  width: 168px;
  display: grid;
  gap: 6px;
}
.profile-display-panel {
  position: static;
  width: 100%;
  border-color: var(--ui-frame);
  display: grid;
  gap: var(--profile-gap);
}
.profile-display-panel > span {
  margin-bottom: 0;
}
.profile-side-color-field {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.72);
  display: grid;
  gap: var(--profile-gap);
  margin: 0;
  min-width: 0;
  padding: var(--profile-pad);
}
.profile-display-panel .color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(17px, 1fr));
  gap: 3px;
  min-height: 37px;
  width: 100%;
}
.profile-display-panel .color-grid label {
  min-width: 0;
  height: 100%;
}
.profile-display-panel .color-grid span {
  width: 100%;
  height: 100%;
  min-height: 17px;
  border-color: var(--border-soft);
}
.profile-display-panel .color-grid input:checked + span {
  box-shadow: 0 0 0 1px rgba(var(--fg-rgb), 0.16);
}
.profile-display-panel .profile-palette-choice {
  border: 0;
  background: transparent;
  min-width: 0;
  padding: 0;
}
.profile-display-panel .palette-mode-toggle {
  background: rgba(var(--surface-rgb), 0.72);
  border: 1px solid var(--ui-frame);
  min-height: var(--profile-control);
  padding: 2px 4px 2px 5px;
}
.profile-display-panel .palette-mode-toggle:hover {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
}
.profile-publication-note {
  display: grid;
  gap: var(--profile-gap);
}
.profile-publication-note a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 2px 4px;
  font-size: 0.72rem;
  line-height: 1.25;
}
.profile-publication-note a:hover {
  border-color: var(--ui-frame-strong);
  background: var(--ui-grad);
}
.profile-publication-note small {
  color: var(--fg-muted);
  font-size: 0.7rem;
  flex-shrink: 0;
}
.profile-admin {
  border-color: var(--ui-frame);
}
.profile-admin small {
  min-width: 30px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg);
  padding: 0 5px;
  text-align: center;
}
.profile-list a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 2px 4px;
  font-size: 0.74rem;
  line-height: 1.25;
}
.profile-list a:hover {
  border-color: color-mix(in srgb, var(--user-color, #93c8d0) 64%, #b8b8b0 36%);
  background: linear-gradient(
    90deg,
    color-mix(in srgb, var(--user-color, var(--private)) 74%, var(--surface) 26%) 0%,
    color-mix(in srgb, var(--user-color, var(--private)) 34%, var(--surface) 66%) 100%
  );
}
.profile-list small,
.muted-line {
  color: var(--fg-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}
.profile-publication-note p {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-soft);
  font-size: 0.68rem;
  line-height: 1.28;
  padding: 3px 5px;
}

.profile-glyph-workshop {
  display: grid;
  gap: var(--profile-gap);
  position: relative;
}
.profile-glyph-titles > summary {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
}
.profile-glyph-stage {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(0deg, rgba(var(--surface-rgb), 0.82), rgba(var(--surface-rgb), 0.82)),
    color-mix(in srgb, var(--user-color, #cccac3) 10%, var(--surface) 90%);
  aspect-ratio: 1 / 1;
  height: auto;
  overflow: hidden;
  position: relative;
}
.profile-glyph-stage canvas {
  display: block;
  height: 100%;
  width: 100%;
}
.profile-glyph-titles {
  display: grid;
  gap: var(--profile-gap);
}
.profile-glyph-titles:not([open]) {
  gap: 0;
}
.profile-glyph-titles > summary {
  cursor: pointer;
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  list-style: none;
}
.profile-glyph-titles > summary::-webkit-details-marker {
  display: none;
}
.profile-glyph-titles > summary small {
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0;
}
.profile-glyph-title-list {
  display: grid;
  gap: var(--profile-gap);
  max-height: 260px;
  overflow: auto;
  scrollbar-width: thin;
}
.profile-glyph-title-list label {
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.72);
  display: grid;
  gap: 1px;
  grid-template-columns: auto minmax(0, 1fr);
  padding: 3px 5px;
}
.profile-glyph-title-list input {
  align-self: start;
  margin-top: 2px;
}
.profile-glyph-title-list span,
.profile-glyph-title-list small {
  grid-column: 2;
}
.profile-glyph-title-list span {
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}
.profile-glyph-title-list small {
  color: var(--fg-muted);
  font-size: 0.62rem;
  line-height: 1.18;
}
.profile-glyph-title-list .is-locked {
  opacity: 0.48;
}
.profile-glyph-title-list .is-unlocked:hover {
  border-color: var(--ui-frame-strong);
  background: var(--ui-bg);
}

/* ── Profile : collections dépliables (mêmes paddings/typo que .profile-list) ── */
.profile-collections {
  display: grid;
  gap: 6px;
}
.profile-collection {
  --profile-collection-accent: var(--public);
  --profile-collection-soft: var(--public-soft);
  --profile-collection-grad: var(--public-grad);
  border: 1px solid var(--profile-collection-accent);
  background: rgba(var(--surface-rgb), 0.9);
  padding: var(--profile-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  display: grid;
  gap: var(--profile-gap);
}
.profile-collection:not([open]) {
  gap: 0;
  padding: var(--profile-pad);
}
.profile-collection-drafts {
  --profile-collection-accent: #6dd5a4;
  --profile-collection-soft: color-mix(in srgb, #6dd5a4 34%, transparent);
  --profile-collection-grad: linear-gradient(90deg, color-mix(in srgb, #6dd5a4 52%, var(--surface) 48%) 0%, rgba(var(--surface-rgb), 0.74) 100%);
}
.profile-collection-projects {
  --profile-collection-accent: var(--private);
  --profile-collection-soft: var(--private-soft);
  --profile-collection-grad: var(--private-grad);
}
.profile-collection-artists {
  --profile-collection-accent: var(--public);
  --profile-collection-soft: var(--public-soft);
  --profile-collection-grad: var(--public-grad);
}
.profile-collection > summary {
  list-style: none;
  display: grid;
  grid-template-columns: 14px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--profile-collection-accent);
  background:
    linear-gradient(90deg, var(--profile-collection-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  cursor: pointer;
  padding: 2px 5px;
  margin-bottom: 0;
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.profile-collection > summary::before {
  content: '↓';
  color: var(--fg-muted);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  letter-spacing: 0;
  line-height: 1;
}
.profile-collection[open] > summary::before {
  content: '↑';
  color: var(--fg);
}
.profile-collection > summary > span {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-collection > summary::-webkit-details-marker {
  display: none;
}
.profile-collection > summary > small {
  min-width: 30px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg);
  padding: 0 5px;
  text-align: center;
  font-size: 0.7rem;
  letter-spacing: 0;
}
.profile-collection-list {
  display: grid;
  gap: var(--profile-gap);
}
.profile-collection-link {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 2px 4px;
  font-size: 0.74rem;
  line-height: 1.25;
  color: var(--fg);
  text-decoration: none;
  min-width: 0;
}
.profile-collection-link > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.profile-collection-link > small {
  color: var(--fg-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}
.profile-collection-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: 0;
  padding: 0;
}
.profile-collection-row > a {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  color: inherit;
  text-decoration: none;
  min-width: 0;
  padding: 2px 4px;
}
.profile-collection-row > a > span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}
.profile-collection-row > a > small {
  color: var(--fg-muted);
  font-size: 0.72rem;
  flex-shrink: 0;
}
.profile-row-action {
  display: grid;
  margin: 0;
}
.profile-row-action button {
  border: 1px solid color-mix(in srgb, #ff6d7e 58%, var(--border-soft));
  background: color-mix(in srgb, #ff6d7e 22%, var(--surface));
  color: #ff8794;
  cursor: pointer;
  font: inherit;
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  line-height: 1;
  padding: 0 7px;
  text-transform: uppercase;
}
.profile-row-action button:disabled {
  cursor: not-allowed;
  opacity: 0.34;
}
.profile-collection .profile-collection-link:hover {
  border-color: var(--profile-collection-accent);
  background: var(--profile-collection-grad);
}

/* ── References ── */
#refs-index {
  display: grid;
  grid-template-columns: 178px minmax(0, var(--content-rail-width)) 178px;
  gap: 10px;
  padding: var(--nav-clearance) var(--page-gutter) 3rem;
  align-items: start;
  justify-content: center;
}
.refs-filter {
  align-self: start;
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.86);
  padding: var(--ui-frame-pad);
  margin-top: 0;
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
}
.refs-filter form {
  display: grid;
  gap: var(--ui-frame-gap);
}
.refs-filter form > * {
  width: 100%;
}
.refs-filter button {
  width: 100%;
  text-align: center;
  border-color: var(--ui-frame);
  background: var(--ui-bg);
}
.library-sidebar .refs-filter button:hover {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
}
.refs-filter a {
  text-align: left;
  padding: 1px 0;
}
.refs-filter-group {
  display: grid;
  gap: 5px;
}
.refs-filter-group label,
.inline-check {
  display: flex !important;
  align-items: center;
  gap: 6px;
}
.refs-filter-group input,
.inline-check input {
  width: auto;
}
.refs-filter a {
  color: var(--fg-muted);
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.refs-category-list {
  display: grid;
  gap: var(--ui-frame-gap);
  margin-top: 0;
  padding: var(--ui-frame-pad);
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.56);
}
.refs-category-list a {
  display: block;
  color: var(--fg-soft);
  font-size: 0.74rem;
  line-height: 1.25;
  letter-spacing: 0;
  padding: 1px 3px;
  text-align: left;
  text-transform: none;
}
.refs-category-list a:hover,
.refs-category-list a.active {
  color: var(--fg);
  background: var(--ui-side-grad);
}
.filter-reset {
  display: block;
  margin-top: -4px;
  padding: 2px 3px;
  color: var(--fg-muted);
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-align: center;
  text-transform: uppercase;
}
.refs-filter .filter-reset {
  text-align: center;
}
.library-filter-reset {
  margin-top: -2px;
}
.filter-reset:hover {
  color: var(--fg);
  background: var(--ui-side-grad);
}
.index-side-list {
  position: sticky;
  top: var(--sticky-clearance);
  align-self: start;
  display: grid;
  gap: 4px;
  max-height: calc(100vh - var(--sticky-clearance) - 24px);
  overflow: auto;
  padding: 1px 0 12px;
  scrollbar-width: none;
  margin-top: 0;
  min-width: 0;
}
.index-side-list::-webkit-scrollbar {
  display: none;
}
.index-side-list a {
  display: block;
  color: var(--fg-soft);
  font-size: 0.74rem;
  line-height: 1.25;
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.index-side-list a:hover,
.index-side-list a.active {
  color: var(--fg);
  background: var(--ui-side-grad);
}
.refs-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 6px;
}
#refs-index .refs-grid {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  width: 100%;
  max-width: var(--content-rail-width);
}
.refs-grid-inline {
  position: static;
  width: 100%;
  margin: 2rem 0;
}
.refs-card {
  --card-frame: #c7d6f0;
  border: 1px solid var(--card-frame);
  background: rgba(var(--surface-rgb), 0.92);
  padding: 2px;
}
.refs-card > a {
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.refs-card img,
.refs-card-placeholder {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  display: block;
  border: 1px solid color-mix(in srgb, var(--card-frame) 60%, #b8b8b0);
  background:
    linear-gradient(135deg, #c8c8c0, rgba(244,244,238,0.72)),
    repeating-linear-gradient(115deg, rgba(20,20,18,0.08) 0 1px, transparent 1px 16px);
}
.refs-card > a > div {
  border: 1px solid color-mix(in srgb, var(--card-frame) 60%, #b8b8b0);
  padding: 1px 4px;
  background: rgba(var(--surface-rgb), 0.92);
  height: 27px;
  min-height: 27px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  justify-content: center;
}
.refs-card span {
  color: var(--fg-muted);
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  line-height: 1.2;
}
.refs-card h2 {
  font-size: 0.74rem;
  line-height: 1.1;
  font-weight: 600;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.refs-card p {
  color: var(--fg-soft);
  font-size: 0.68rem;
  line-height: 1.1;
  margin-top: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.refs-card .refs-card-artist {
  color: var(--fg-muted);
  font-size: 0.6rem;
}

.ref-detail {
  max-width: none;
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  margin: var(--nav-clearance) auto 4rem;
  padding: 3px;
}
.ref-detail header {
  display: grid;
  column-gap: 12px;
  row-gap: 2px;
  margin-bottom: 0;
  padding: 2px 4px 3px;
  position: relative;
}
.ref-detail h1 {
  font-size: 1.32rem;
  line-height: 1.12;
  margin: 0;
}
.ref-meta-line {
  display: flex;
  align-items: baseline;
  gap: 0;
  color: var(--fg-soft);
  font-size: 0.78rem;
}
.ref-meta-line a {
  border-bottom: 1px solid var(--border-soft);
}
.ref-meta-line p {
  color: var(--fg-muted);
}
.ref-creator {
  color: var(--fg-muted);
  font-size: 0.78rem;
  margin-top: 0.5rem;
}
.ref-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 0.8rem;
}
.ref-tags span {
  border: 1px solid var(--border-soft);
  color: var(--fg-muted);
  font-size: 0.66rem;
  padding: 1px 5px;
}
.ref-detail-text {
  border-top: 1px solid var(--detail-frame);
  line-height: 1.45;
  margin: -5px -3px 0;
  padding: 6px 8px;
  font-size: 0.84rem;
}
.ref-detail-actions {
  display: flex;
  justify-content: flex-end;
  margin-bottom: 0;
  padding: 1px 4px;
}
.ref-detail-actions:empty { display: none; }
.ref-media-stack {
  display: grid;
  gap: 8px;
}
.ref-media-stack img {
  width: 100%;
  display: block;
  border: 1px solid var(--detail-frame);
  background: rgba(var(--surface-rgb), 0.92);
  padding: 2px;
}

.edit-page {
  display: grid;
  grid-template-columns: minmax(0, min(var(--content-rail-width), calc(100vw - 2rem)));
  justify-content: center;
  align-items: flex-start;
  padding: var(--nav-clearance) 1rem 4rem;
}
.edit-panel {
  width: 100%;
}
.edit-switcher {
  width: 156px;
  display: grid;
  gap: var(--ui-frame-gap);
  position: sticky;
  top: 88px;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  transform: translateX(calc(-100% - 12px));
  border: 1px solid var(--area-frame);
  background: rgba(var(--surface-rgb), 0.86);
  padding: var(--ui-frame-pad);
}
.edit-switcher + .edit-panel {
  grid-column: 1;
  grid-row: 1;
}
.edit-switcher a {
  border: 1px solid var(--area-btn-border);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
  padding: 3px 7px;
  text-transform: uppercase;
}
.edit-switcher a.active {
  background: var(--area-btn-grad);
  color: var(--fg);
  border-color: var(--area-btn-grad-hi);
}
.edit-switcher a:hover {
  border-color: var(--fg);
  color: var(--fg);
}
.edit-switcher a.active:hover {
  border-color: var(--area-btn-grad-hi);
}
.contribution-switcher {
  border-color: var(--ui-frame);
}
.contribution-switcher a.is-private-kind {
  border-color: var(--private);
}
.contribution-switcher a.is-public-kind {
  border-color: var(--public);
}
.contribution-switcher a.is-private-kind:hover,
.contribution-switcher a.is-private-kind.active {
  background: var(--private-grad);
  border-color: var(--private);
  color: var(--fg);
}
.contribution-switcher a.is-public-kind:hover,
.contribution-switcher a.is-public-kind.active {
  background: var(--public-grad);
  border-color: var(--public);
  color: var(--fg);
}
.contribution-page:not(.has-contribution-selection) {
  min-height: 42vh;
}
.contribution-page.has-contribution-selection .edit-panel {
  grid-column: 1;
  grid-row: 1;
}
.edit-panel-head,
.studio-header {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  align-items: start;
  margin-bottom: 16px;
}
.edit-panel textarea {
  resize: vertical;
}
.image-checks {
  border: 1px solid var(--border-soft);
  padding: 8px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(110px, 1fr));
  gap: 8px;
}
.image-checks legend {
  color: var(--fg-muted);
  font-size: 0.72rem;
  padding: 0 4px;
}
.image-checks label {
  display: grid;
  gap: 5px;
}
.image-checks img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  border: 1px solid var(--border-soft);
}
.image-checks input {
  width: auto;
}
.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 5px;
  margin-top: 4px;
}
.form-actions .danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.form-actions .danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}
/* ── Studio ── */
#studio-page {
  padding: var(--nav-clearance) 1.5rem 3rem;
}
.studio-header {
  max-width: 1080px;
  margin: 0 auto 10px;
}
.studio-header.compact {
  margin-top: 10px;
}
.admin-user-list {
  display: grid;
  gap: var(--ui-frame-gap);
}
.admin-user-card {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.92);
  padding: var(--ui-frame-pad);
  display: grid;
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 6px;
  align-items: start;
  min-width: 0;
}
.admin-user-card.is-compact {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
}
.user-color-chip {
  display: block;
  width: 18px;
  height: 18px;
  border: 1px solid var(--border-soft);
  background: var(--user-color);
}
.admin-user-card h2 {
  font-size: 0.8rem;
  line-height: 1.1;
  margin-bottom: 1px;
  min-width: 0;
}
.admin-user-card p,
.admin-user-card small,
.muted-line {
  color: var(--fg-muted);
  font-size: 0.68rem;
  line-height: 1.25;
}
.admin-user-card form {
  display: flex;
  gap: 4px;
  justify-self: end;
}
.admin-active-list {
  gap: 3px;
}
.admin-user-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: var(--ui-frame-gap);
  align-items: stretch;
  min-width: 0;
}
.admin-user-row.has-action {
  grid-template-columns: minmax(0, 1fr) auto;
}
.admin-user-row .admin-user-card {
  height: 100%;
}
.admin-user-identity {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.admin-user-identity h2 {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.admin-user-identity small {
  color: var(--fg-muted);
  flex: 0 0 auto;
  font-size: 0.62rem;
  font-style: italic;
  line-height: 1;
}
.admin-user-action {
  display: grid;
  align-self: stretch;
}
.admin-user-action button {
  height: 100%;
  border: 1px solid var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  padding: 2px 7px;
  text-transform: uppercase;
}
.admin-user-card button.danger {
  border-color: var(--danger-soft);
  background: var(--danger-soft);
  color: var(--danger);
}
.admin-user-action button:hover {
  border-color: var(--danger);
}
.tag-request-chip {
  display: block;
  width: 22px;
  height: 22px;
  border: 1px solid var(--private);
  background: var(--private-soft);
}
.admin-switcher {
  display: grid;
  gap: 3px;
  width: 100%;
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.86);
  padding: 2px;
}
.admin-switcher a {
  border: 1px solid var(--ui-frame);
  background: var(--surface);
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
  padding: 3px 7px;
  text-transform: uppercase;
}
.admin-switcher a.active {
  background: var(--ui-grad);
  color: var(--fg);
  border-color: var(--ui-frame-strong);
}
.admin-switcher a:hover {
  border-color: var(--ui-frame-strong);
  color: var(--fg);
}
.admin-page-header,
.admin-page-layout,
.account-admin-header,
.account-admin-workspace,
.tag-admin-header {
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  max-width: none;
  margin-inline: auto;
}
.admin-page-layout,
.account-admin-workspace {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
  position: relative;
}
.admin-page-layout > .admin-switcher,
.account-admin-workspace > .admin-switcher {
  grid-area: 1 / 1;
  justify-self: start;
  position: sticky;
  top: calc(var(--nav-clearance) + 10px);
  transform: translate(calc(-100% - 12px), -12px);
  width: 142px;
}
.admin-page-content,
.account-admin-main {
  grid-area: 1 / 1;
  display: grid;
  gap: 6px;
  min-width: 0;
}
.account-admin-main .studio-header {
  max-width: none;
  margin: 0;
}
.account-admin-main .studio-header.compact {
  margin-top: 4px;
}
.account-admin-main .admin-user-list {
  gap: var(--ui-frame-gap);
}
.account-admin-main .admin-user-card {
  grid-template-columns: 18px minmax(0, 1fr) auto;
  gap: 7px;
  padding: var(--ui-frame-pad);
}
.account-admin-main .admin-user-card.is-compact {
  grid-template-columns: 18px minmax(0, 1fr);
}
.account-admin-main .user-color-chip {
  width: 15px;
  height: 15px;
}
.account-admin-main .admin-user-card h2 {
  font-size: 0.74rem;
  line-height: 1.1;
  margin: 0;
}
.account-admin-main .admin-user-card p,
.account-admin-main .admin-user-card small {
  font-size: 0.68rem;
  line-height: 1.25;
}
.account-admin-main .admin-user-card form {
  gap: 4px;
}
.account-admin-main .admin-user-card button {
  font-size: 0.6rem;
  padding: 2px 7px;
}
.admin-panel {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.86);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  display: grid;
  gap: var(--ui-frame-gap);
  min-width: 0;
  padding: var(--ui-frame-pad);
}
.admin-panel-title {
  border: 1px solid var(--ui-frame);
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  display: block;
  font-size: 0.66rem;
  font-weight: 500;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
}
.admin-panel-body {
  display: grid;
  gap: var(--ui-frame-gap);
  min-width: 0;
}
.admin-empty-state {
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.72);
  margin: 0;
  padding: 3px 5px;
}
.tag-admin-notice {
  margin: 0;
  max-width: none;
  padding: 3px 5px;
  background: rgba(var(--surface-rgb), 0.78);
  border: 1px solid var(--border-soft);
  font-size: 0.68rem;
  line-height: 1.25;
}
.tag-admin-shell {
  max-width: 1080px;
  margin: 0 auto;
  display: grid;
  grid-template-columns: 260px minmax(0, 1fr);
  gap: 12px;
  align-items: start;
}
.tag-admin-side,
.tag-admin-family {
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.9);
  padding: 3px;
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.045);
}
.tag-admin-side {
  display: grid;
  gap: 5px;
  position: sticky;
  top: calc(var(--nav-clearance) + 12px);
}
.tag-admin-side > header,
.tag-admin-family-head {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  align-items: start;
}
.tag-admin-side > header > span {
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tag-admin-side > header > small,
.tag-admin-family-head > small {
  min-width: 22px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-muted);
  font-size: 0.7rem;
  text-align: center;
  padding: 0 5px;
}
.tag-pending-card {
  display: grid;
  grid-template-columns: 22px minmax(0, 1fr);
  gap: 7px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.58);
  padding: 4px;
}
.tag-pending-card strong {
  display: block;
  font-size: 0.78rem;
  font-weight: 500;
}
.tag-pending-card small {
  display: block;
  color: var(--fg-muted);
  font-size: 0.68rem;
  line-height: 1.3;
}
.tag-pending-card form {
  grid-column: 2;
  display: flex;
  gap: 4px;
}
.tag-pending-card button,
.tag-admin-form button,
.tag-family-form button,
.tag-admin-new button {
  width: fit-content;
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  padding: 2px 7px;
  line-height: 1.35;
  cursor: pointer;
}
.tag-pending-card button:hover,
.tag-admin-form button:hover,
.tag-family-form button:hover,
.tag-admin-new button:hover {
  border-color: var(--fg-muted);
  background: rgba(var(--fg-rgb), 0.055);
}
.tag-pending-card button.danger,
.tag-admin-form button.danger {
  border-color: var(--danger-soft);
  background: transparent;
  color: var(--danger);
}
.tag-admin-tree {
  display: grid;
  gap: 12px;
}
.tag-admin-family {
  border-color: color-mix(in srgb, var(--family-color) 42%, var(--border-soft) 58%);
}
.tag-admin-family-head {
  margin-bottom: 5px;
  padding-bottom: 3px;
  border-bottom: 1px solid color-mix(in srgb, var(--family-color) 34%, var(--border-soft) 66%);
}
.tag-family-form {
  display: grid;
  grid-template-columns: minmax(140px, 1fr) 28px 54px auto;
  gap: 4px;
  min-width: 0;
}
.tag-family-static {
  color: var(--fg-muted);
  font-size: 0.72rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}
.tag-admin-list {
  display: grid;
  gap: 5px;
}
.tag-admin-row {
  border: 1px solid rgba(var(--fg-rgb), 0.12);
  background: rgba(var(--surface-rgb), 0.58);
  padding: 4px;
  display: grid;
  gap: 4px;
}
.tag-admin-form {
  display: grid;
  grid-template-columns: minmax(150px, 1.3fr) minmax(90px, 0.7fr) 92px 28px auto auto;
  gap: 4px;
  align-items: center;
  min-width: 0;
}
.tag-family-form input,
.tag-admin-form input,
.tag-admin-form select,
.tag-admin-new input {
  min-width: 0;
  width: 100%;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.9);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.72rem;
  padding: 2px 5px;
  line-height: 1.25;
  outline: none;
}
.tag-family-form input:focus,
.tag-admin-form input:focus,
.tag-admin-form select:focus,
.tag-admin-new input:focus {
  border-color: var(--fg-muted);
}
.tag-family-form input[type="color"],
.tag-admin-form input[type="color"] {
  padding: 0;
  height: 22px;
}
.tag-admin-meta,
.tag-admin-connections {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.tag-admin-meta span {
  color: var(--fg-muted);
  border: 1px solid rgba(var(--fg-rgb), 0.10);
  background: rgba(var(--surface-rgb), 0.62);
  font-size: 0.66rem;
  padding: 1px 5px;
}
.tag-admin-connections {
  max-height: 96px;
  overflow: auto;
  padding-right: 2px;
}
.tag-admin-connections a,
.tag-admin-empty {
  display: inline-flex;
  align-items: baseline;
  gap: 4px;
  max-width: 100%;
  border: 1px solid rgba(var(--fg-rgb), 0.10);
  background: rgba(var(--surface-rgb), 0.54);
  color: var(--fg-soft);
  font-size: 0.66rem;
  padding: 1px 5px;
  text-decoration: none;
}
.tag-admin-connections a:hover {
  border-color: color-mix(in srgb, var(--family-color) 48%, var(--fg-muted) 52%);
  color: var(--fg);
}
.tag-admin-connections small {
  color: color-mix(in srgb, var(--family-color) 70%, var(--fg-muted) 30%);
  font-weight: 700;
}
.tag-admin-connections span {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tag-admin-connections em {
  color: var(--fg-muted);
  font-style: normal;
}
.tag-admin-empty {
  color: var(--fg-faint);
}
.tag-admin-new {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 4px;
  border: 1px dashed color-mix(in srgb, var(--family-color) 34%, var(--border-soft) 66%);
  background: rgba(var(--surface-rgb), 0.35);
  padding: 4px;
}
.tag-admin-header,
.tag-admin-workspace {
  width: min(var(--content-rail-width), calc(100vw - 2rem));
  max-width: none;
}
.tag-admin-header {
  margin-inline: auto;
}
.tag-admin-workspace {
  margin: 0 auto;
  position: relative;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: start;
}
.tag-admin-workspace .tag-admin-side {
  grid-area: 1 / 1;
  justify-self: start;
  margin-left: -154px;
  position: sticky;
  top: calc(var(--nav-clearance) + 10px);
  width: 142px;
}
.tag-admin-save {
  grid-area: 1 / 1;
  justify-self: end;
  margin-right: -126px;
  position: sticky;
  top: calc(var(--nav-clearance) + 10px);
  width: 116px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.82);
  padding: 3px;
  display: grid;
  gap: 3px;
  justify-items: start;
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.04);
}
.tag-admin-side .admin-switcher {
  margin-bottom: 4px;
}
.tag-admin-save button {
  width: 100%;
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 7px;
  line-height: 1.35;
  cursor: pointer;
}
.tag-admin-save button:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
}
.tag-admin-save small {
  color: var(--fg-muted);
  font-size: 0.66rem;
}
.tag-admin-tree {
  grid-area: 1 / 1;
  gap: 6px;
}
.tag-admin-family {
  padding: 0;
  overflow: hidden;
}
.tag-admin-family-head {
  cursor: pointer;
  margin: 0;
  padding: 4px 5px;
  border-bottom: 1px solid color-mix(in srgb, var(--family-color) 30%, var(--border-soft) 70%);
  user-select: none;
}
.tag-admin-family-head::-webkit-details-marker {
  display: none;
}
.tag-family-title {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.tag-family-title i {
  display: block;
  width: 18px;
  height: 12px;
  border: 1px solid var(--border-soft);
}
.tag-family-title strong {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--fg);
}
.tag-admin-family-body {
  padding: 4px;
  display: grid;
  gap: 4px;
}
.tag-family-form {
  grid-template-columns: minmax(0, 1fr) 26px 44px;
  gap: 3px;
}
.tag-admin-list {
  gap: 4px;
}
.tag-admin-row {
  padding: 3px;
  gap: 3px;
}
.tag-admin-form {
  grid-template-columns: minmax(96px, 1fr) 86px 72px 24px auto;
  gap: 3px;
}
.tag-admin-form button.danger {
  font-size: 0.58rem;
  padding-inline: 5px;
}
.tag-admin-meta {
  gap: 2px;
}
.tag-admin-meta span {
  font-size: 0.62rem;
  padding: 0 4px;
}
.tag-admin-connections {
  max-height: 54px;
  gap: 2px;
}
.tag-admin-connections a {
  font-size: 0.62rem;
  padding: 0 4px;
}
.tag-admin-new {
  grid-template-columns: minmax(0, 1fr);
  padding: 3px;
}

@media (max-width: 900px) {
  .admin-page-layout > .admin-switcher,
  .account-admin-workspace > .admin-switcher,
  .tag-admin-workspace .tag-admin-side,
  .tag-admin-save {
    grid-area: auto;
    position: static;
    width: auto;
    margin-right: 0;
    margin-bottom: 8px;
    transform: none;
  }
  .admin-page-content,
  .account-admin-main {
    grid-area: auto;
  }
  .tag-admin-tree {
    grid-area: auto;
  }
  .tag-admin-shell {
    grid-template-columns: 1fr;
  }
  .tag-admin-side {
    position: static;
  }
  .tag-admin-form,
  .tag-family-form {
    grid-template-columns: 1fr 1fr;
  }
}

/* ── Administration du thésaurus ── */
.rameau-admin {
  width: 100%;
  margin: 0;
  padding-bottom: 0;
  display: grid;
  gap: 6px;
}
.rameau-stat,
.rameau-item {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.88);
}
.rameau-intro {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: stretch;
  gap: var(--ui-frame-gap);
}
.rameau-intro > div {
  border: 1px solid var(--ui-frame);
  background: var(--ui-bg);
  padding: 4px 6px;
}
.rameau-intro h2 {
  margin: 0 0 2px;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.15;
}
.rameau-intro p {
  max-width: 78ch;
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.66rem;
  line-height: 1.25;
}
.rameau-intro form,
.rameau-intro button {
  height: 100%;
}
.rameau-intro form {
  display: grid;
}
.rameau-refresh-button {
  align-items: center;
  display: inline-grid;
  justify-content: center;
  aspect-ratio: 1;
  min-height: 42px;
  min-width: 42px;
  border: 1px solid var(--public);
  background:
    linear-gradient(135deg, var(--public-grad-hi, var(--public)) 0%, var(--public-soft) 100%);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: 0;
  line-height: 1;
  padding: 0;
  text-transform: uppercase;
  width: auto;
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--public) 42%, transparent);
}
.rameau-refresh-button:hover {
  background: var(--public-grad);
  border-color: var(--public);
  color: var(--fg);
}
.rameau-refresh-button span {
  display: block;
  transform: translateY(-0.5px);
}
.rameau-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--ui-frame-gap);
}
.rameau-stat {
  padding: 4px 5px;
}
.rameau-stat strong {
  display: block;
  font-size: 1.08rem;
  font-weight: 500;
  line-height: 1;
}
.rameau-stat span,
.rameau-item-title small,
.rameau-count,
.rameau-column h3 {
  color: var(--fg-muted);
  font-size: 0.61rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.rameau-run {
  margin: 0;
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-muted);
  font-size: 0.66rem;
  padding: 3px 5px;
}
.rameau-items {
  display: grid;
  gap: var(--ui-frame-gap);
}
.rameau-item {
  overflow: hidden;
}
.rameau-item summary {
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  list-style: none;
  min-height: 20px;
  padding: 2px 5px;
}
.rameau-item summary::-webkit-details-marker {
  display: none;
}
.rameau-item[open] summary {
  border-bottom: 1px solid var(--ui-frame);
  background: var(--ui-bg);
}
.rameau-item-title {
  display: flex;
  align-items: baseline;
  gap: 6px;
  min-width: 0;
}
.rameau-item-title strong {
  overflow: hidden;
  font-size: 0.72rem;
  font-weight: 600;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.rameau-item-body {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--ui-frame-gap);
  padding: var(--ui-frame-pad);
}
.rameau-column {
  padding: 3px;
}
.rameau-column h3 {
  margin: 0 0 4px;
}
.rameau-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.rameau-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  font-size: 0.64rem;
  line-height: 1.08;
  min-height: 16px;
  padding: 1px 4px;
}
.rameau-chip small {
  color: var(--fg-muted);
  font-variant-numeric: tabular-nums;
}
.rameau-chip.is-rejected {
  opacity: 0.42;
  text-decoration: line-through;
}
.rameau-chip.is-display {
  border-color: color-mix(in srgb, var(--chip-color, #777) 55%, var(--border-soft));
  background: color-mix(in srgb, var(--chip-color, #777) 9%, var(--surface));
}
.rameau-chip form {
  display: inline;
}
.rameau-chip button {
  border: 0;
  background: transparent;
  color: inherit;
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}
.rameau-empty {
  margin: 0;
  color: var(--fg-muted);
  font-size: 0.68rem;
}

@media (max-width: 620px) {
  .admin-user-card,
  .account-admin-main .admin-user-card {
    grid-template-columns: 18px minmax(0, 1fr);
  }
  .admin-user-row.has-action,
  .account-admin-main .admin-user-row.has-action {
    grid-template-columns: minmax(0, 1fr);
  }
  .admin-user-action,
  .account-admin-main .admin-user-action {
    grid-column: 1 / -1;
    justify-self: start;
  }
  .rameau-intro,
  .rameau-item-body {
    grid-template-columns: minmax(0, 1fr);
  }
  .rameau-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .rameau-item summary {
    align-items: start;
    display: grid;
    grid-template-columns: minmax(0, 1fr);
  }
  .rameau-count {
    justify-self: start;
  }
}

.viz-geo-popup {
  position: absolute;
  z-index: 24;
  width: min(240px, calc(100vw - 28px));
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--ui-frame-strong);
  background: rgba(var(--surface-rgb), 0.96);
  box-shadow: 6px 6px 0 rgba(var(--shadow-rgb), 0.08);
  padding: 4px;
}
.viz-geo-popup strong {
  display: block;
  border-bottom: 1px solid var(--border-soft);
  font-size: 0.64rem;
  letter-spacing: 0.08em;
  margin-bottom: 3px;
  padding: 2px 3px 4px;
  text-transform: uppercase;
}
.viz-geo-popup button {
  display: block;
  width: 100%;
  border: 0;
  border-bottom: 1px solid var(--border-soft);
  background: transparent;
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  font-size: 0.7rem;
  padding: 4px 3px;
  text-align: left;
}
.viz-geo-popup button:hover {
  background: var(--ui-frame-soft);
}
@media (max-width: 760px) {
  .rameau-intro,
  .rameau-item-body {
    grid-template-columns: 1fr;
  }
  .rameau-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

/* ── Atlas (home) ── */
body.home {
  overflow: hidden;
}
body.home main {
  padding-top: 0;
  height: 100vh;
}
#atlas-page {
  position: relative;
  overflow: hidden;
  background: transparent;
  height: 100vh;
  isolation: isolate;
}

/* ── Shared visualization primitives ── */
.viz-stage {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  cursor: grab;
  z-index: 1;
}
.viz-stage.is-hovering-node {
  cursor: pointer;
}
.viz-stage:active {
  cursor: grabbing;
}
.viz-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  touch-action: none;
  transition: opacity 0.42s cubic-bezier(0.4, 0, 0.2, 1);
  opacity: 1;
}
.viz-stage[data-transitioning="true"] .viz-canvas,
.viz-stage[data-transitioning="true"] .viz-labels {
  opacity: 0;
}
.viz-labels {
  transition: opacity 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}
.viz-three-root {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.viz-three-root canvas {
  display: block;
  width: 100% !important;
  height: 100% !important;
}
.viz-labels {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 20;
}
.viz-radial-center-action {
  appearance: none;
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 26;
  width: 30px;
  height: 30px;
  padding: 2px;
  transform: translate(-50%, -50%);
  border: 1px solid color-mix(in srgb, var(--ui-frame, #8d8d87) 72%, transparent);
  background: rgba(var(--surface-rgb), 0.58);
  color: color-mix(in srgb, var(--fg) 72%, var(--surface) 28%);
  cursor: pointer;
  font-family: inherit;
  font-size: 0;
  font-weight: 400;
  letter-spacing: 0;
  line-height: 1;
  display: grid;
  place-items: center;
  box-shadow: 0 10px 24px rgba(var(--shadow-rgb), 0.055);
  transition:
    background 0.16s,
    border-color 0.16s,
    color 0.16s,
    opacity 0.18s,
    transform 0.16s;
}
.viz-radial-center-action:hover,
.viz-radial-center-action:focus-visible {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong, var(--fg-muted));
  color: var(--fg);
  outline: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}
.viz-stage[data-transitioning="true"] .viz-radial-center-action {
  opacity: 0;
}
.viz-radial-shuffle-mark {
  width: 22px;
  height: 22px;
  color: currentColor;
  display: block;
}
.viz-radial-shuffle-mark path {
  fill: none;
  stroke-linecap: square;
  stroke-linejoin: miter;
  stroke-width: 1.55;
}
.viz-radial-shuffle-mark .shuffle-line-main {
  stroke: currentColor;
}
.viz-radial-shuffle-mark .shuffle-line-soft {
  stroke: var(--fg-muted, #8d8d87);
}
.viz-error {
  position: absolute;
  left: 1.5rem;
  bottom: 1.5rem;
  font-size: 0.75rem;
  color: var(--fg-muted);
}

/* ── Shared label primitive ── */
.viz-label {
  position: absolute;
  left: 0;
  top: 0;
  pointer-events: auto;
  border: 0;
  background: transparent;
  color: var(--viz-text, #171714);
  font-family: inherit;
  font-size: 0.55rem;
  line-height: 1.15;
  letter-spacing: 0.015em;
  max-width: none;
  padding: 0;
  text-align: left;
  cursor: pointer;
  text-shadow:
    0 0 7px var(--viz-text-shadow, rgba(249, 248, 244, 0.96)),
    0 0 12px var(--viz-text-shadow, rgba(249, 248, 244, 0.96));
  transform-origin: 0 50%;
  transition: opacity 0.12s, color 0.12s;
  white-space: nowrap;
  backface-visibility: hidden;
  contain: layout style paint;
  text-rendering: geometricPrecision;
  will-change: transform, opacity;
}
.viz-label-project {
  color: var(--viz-text, #171714);
}
.viz-label-library {
  font-size: 0.53rem;
  opacity: 0.86;
}
.viz-label-tag {
  color: var(--viz-text, #171714);
  font-size: 0.62rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.viz-label.muted {
  opacity: 0.16;
}
.viz-label.active {
  filter: brightness(0.85);
}

/* ── Foldable controls dock (bottom-left) ── */
.viz-controls,
.atlas-controls {
  position: absolute;
  left: var(--chrome-inset);
  bottom: 1.25rem;
  z-index: 35;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  pointer-events: none;
  --viz-shell-width: min(194px, calc(100vw - 2.5rem));
  --viz-gap: var(--ui-frame-gap);
  --viz-pad: var(--ui-frame-pad);
  --viz-control: 16px;
}
.viz-controls > * {
  pointer-events: auto;
}
.viz-controls-body {
  display: grid;
  gap: var(--viz-gap);
  width: var(--viz-shell-width);
  border: 1px solid var(--ui-frame, var(--border-soft, rgba(150, 150, 142, 0.72)));
  background: rgba(var(--surface-rgb), 0.86);
  backdrop-filter: blur(18px);
  box-shadow: 0 18px 44px rgba(var(--shadow-rgb), 0.07);
  padding: var(--viz-pad);
  margin-bottom: var(--viz-gap);
  transform-origin: 0 100%;
  opacity: 1;
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.viz-controls[data-expanded="false"] .viz-controls-body {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
  visibility: hidden;
  height: 0;
  margin: 0;
  padding: 0;
  border: none;
  overflow: hidden;
}
.viz-controls-actions {
  display: inline-flex;
  align-items: center;
  gap: var(--viz-gap);
  pointer-events: auto;
}
.viz-controls-toggle {
  width: fit-content;
  max-width: var(--viz-shell-width);
  min-height: 19px;
  border: 1px solid var(--ui-frame, var(--border-soft, rgba(150, 150, 142, 0.72)));
  background: rgba(var(--surface-rgb), 0.72);
  cursor: pointer;
  color: var(--fg-soft, rgba(72, 72, 66, 0.78));
  font-family: inherit;
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 6px 2px 2px;
  line-height: 1.1;
  display: inline-flex;
  align-items: center;
  justify-content: flex-start;
  gap: 5px;
  overflow: hidden;
  white-space: nowrap;
  transition: width 0.18s ease, background 0.12s, border-color 0.12s, color 0.12s, opacity 0.12s;
}
.viz-controls-toggle > span:last-child {
  display: inline-block;
  max-width: 180px;
  overflow: hidden;
  opacity: 1;
  transition: max-width 0.18s ease, opacity 0.12s ease, transform 0.18s ease;
}
.viz-controls-toggle-dot {
  flex: 0 0 13px;
  width: 13px;
  height: 13px;
  border: 1px solid var(--ui-frame, currentColor);
  background: var(--surface-overlay, rgba(var(--surface-rgb), 0.5));
  color: var(--fg-muted, currentColor);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  position: relative;
  font-size: 0.68rem;
  line-height: 1;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.viz-controls-toggle-dot::before {
  content: '↑';
}
.viz-controls[data-expanded="true"] .viz-controls-toggle {
  width: 19px;
  height: 19px;
  padding: 2px;
}
.viz-controls[data-expanded="true"] .viz-controls-toggle > span:last-child {
  max-width: 0;
  opacity: 0;
  transform: translateX(-12px);
}
.viz-controls[data-expanded="true"] .viz-controls-toggle-dot {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong, currentColor);
  color: var(--fg);
}
.viz-controls[data-expanded="true"] .viz-controls-toggle-dot::before {
  content: '↓';
}
.viz-controls-toggle:hover {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong, var(--fg-soft));
  color: var(--fg);
}
.viz-action-button {
  width: 19px;
  height: 19px;
  border: 1px solid var(--ui-frame, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-muted);
  cursor: pointer;
  display: inline-grid;
  place-items: center;
  font-family: inherit;
  font-size: 0.66rem;
  line-height: 1;
  padding: 0;
}
.viz-action-button:hover,
.viz-action-button:focus-visible {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
  color: var(--fg);
  outline: 0;
}
.viz-action-help {
  border-color: var(--public);
  background: var(--public-soft);
  color: var(--fg);
}
.viz-action-help:hover,
.viz-action-help:focus-visible {
  background: var(--public-grad);
  border-color: var(--public);
  color: var(--fg);
}
.viz-controls[data-expanded="false"] .viz-action-button {
  display: none;
}
.viz-action-icon-fit {
  width: 11px;
  height: 11px;
  border: 1px solid currentColor;
  display: block;
  position: relative;
}
.viz-action-icon-fit::before,
.viz-action-icon-fit::after {
  content: '';
  position: absolute;
  inset: 2px;
  border: 1px solid currentColor;
  border-color: currentColor transparent transparent currentColor;
}
.viz-action-icon-fit::after {
  transform: rotate(180deg);
}
.viz-control {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--viz-gap);
  border: 1px solid var(--ui-frame, var(--border-soft, rgba(150, 150, 142, 0.72)));
  background:
    linear-gradient(90deg, var(--ui-frame-soft) 0%, rgba(var(--surface-rgb), 0.72) 100%);
  padding: var(--viz-pad);
  min-height: var(--viz-control);
  min-width: 0;
  width: 100%;
}
.viz-control-range {
  align-items: center;
  gap: var(--viz-gap);
  min-height: var(--viz-control);
}
.viz-control > span {
  color: var(--fg, #171714);
  font-size: 0.61rem;
  letter-spacing: 0;
  text-transform: none;
  line-height: 1.1;
}
.viz-beta-note {
  border: 1px solid color-mix(in srgb, var(--success, #6dd5a4) 48%, var(--border-soft) 52%);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--success, #6dd5a4) 20%, var(--surface) 80%) 0%, rgba(var(--surface-rgb), 0.76) 100%);
  display: grid;
  gap: 1px;
  padding: var(--viz-pad);
}
.viz-beta-note span {
  color: var(--fg);
  font-size: 0.6rem;
  letter-spacing: 0.1em;
  line-height: 1.1;
  text-transform: uppercase;
}
.viz-beta-note small {
  color: var(--fg-soft);
  font-size: 0.58rem;
  line-height: 1.24;
}

/* Easter egg : respiration de l'atlas (taper 5×a). */
.atlas-flash::after {
  content: '';
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 40;
  background: radial-gradient(
    circle at center,
    color-mix(in srgb, var(--accent, #c2632a) 28%, transparent) 0%,
    color-mix(in srgb, var(--accent, #c2632a) 10%, transparent) 38%,
    transparent 70%
  );
  animation: atlas-pulse-flash 0.9s ease-out forwards;
}
@keyframes atlas-pulse-flash {
  0%   { opacity: 0; transform: scale(0.5); }
  35%  { opacity: 1; transform: scale(1); }
  100% { opacity: 0; transform: scale(1.5); }
}

/* Tooltip arête en mode Réseau — petit cadre fin posé près du curseur. */
.viz-link-tooltip {
  position: absolute;
  top: 0;
  left: 0;
  z-index: 40;
  pointer-events: none;
  border: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.96);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0;
  line-height: 1.3;
  padding: 2px 6px;
  white-space: nowrap;
  box-shadow: 0 4px 12px rgba(var(--shadow-rgb), 0.08);
}
.viz-link-tooltip[hidden] { display: none; }
.viz-mode-switch {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: var(--viz-gap);
  width: 100%;
}
.viz-mode-btn {
  aspect-ratio: 1;
  border: 1px solid var(--border-soft, rgba(150, 150, 142, 0.7));
  background: var(--surface-overlay, rgba(var(--surface-rgb), 0.5));
  color: var(--fg-muted, #8d8d87);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family: inherit;
  font-size: 0.60rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  min-height: 0;
  padding: 2px;
  line-height: 1.05;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.viz-mode-btn:hover {
  border-color: var(--ui-frame-strong, var(--fg-muted));
  color: var(--fg-soft);
}
.viz-mode-btn.is-on {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
  color: var(--fg);
}
.viz-mode-icon {
  color: currentColor;
  display: block;
  height: 24px;
  position: relative;
  width: 24px;
}
.viz-mode-icon::before,
.viz-mode-icon::after {
  content: '';
  position: absolute;
}
.viz-mode-icon-radial {
  background:
    radial-gradient(circle at 50% 50%, currentColor 0 2px, transparent 2.5px),
    linear-gradient(currentColor, currentColor) 50% 3px / 1px 18px no-repeat,
    linear-gradient(90deg, currentColor, currentColor) 3px 50% / 18px 1px no-repeat;
}
.viz-mode-icon-radial::before {
  inset: 4px;
  border: 1px solid currentColor;
  opacity: 0.34;
  transform: rotate(45deg);
}
.viz-mode-icon-network {
  background:
    linear-gradient(36deg, transparent 45%, currentColor 46%, currentColor 48%, transparent 49%),
    linear-gradient(142deg, transparent 42%, currentColor 43%, currentColor 45%, transparent 46%),
    radial-gradient(circle at 20% 32%, currentColor 0 2px, transparent 2.6px),
    radial-gradient(circle at 72% 24%, currentColor 0 2px, transparent 2.6px),
    radial-gradient(circle at 45% 70%, currentColor 0 2px, transparent 2.6px),
    radial-gradient(circle at 82% 72%, currentColor 0 2px, transparent 2.6px);
}
.viz-mode-icon-timeline {
  background:
    linear-gradient(90deg, currentColor, currentColor) 3px 50% / 18px 1px no-repeat,
    radial-gradient(circle at 18% 50%, currentColor 0 2px, transparent 2.6px),
    radial-gradient(circle at 50% 50%, currentColor 0 2px, transparent 2.6px),
    radial-gradient(circle at 82% 50%, currentColor 0 2px, transparent 2.6px);
}
.viz-mode-icon-timeline::before,
.viz-mode-icon-timeline::after {
  border-left: 1px solid currentColor;
  height: 6px;
  top: 6px;
}
.viz-mode-icon-timeline::before { left: 4px; }
.viz-mode-icon-timeline::after { right: 4px; top: 12px; }
.viz-mode-icon-sphere {
  border: 1px solid currentColor;
  border-radius: 50%;
}
.viz-mode-icon-sphere::before {
  border: 1px solid currentColor;
  border-left-color: transparent;
  border-right-color: transparent;
  border-radius: 50%;
  inset: 4px 1px;
  opacity: 0.45;
}
.viz-mode-icon-sphere::after {
  border: 1px solid currentColor;
  border-top-color: transparent;
  border-bottom-color: transparent;
  border-radius: 50%;
  inset: 1px 6px;
  opacity: 0.55;
}
.viz-toggle-row {
  display: flex;
  gap: var(--viz-gap);
  width: 100%;
}
.viz-pill {
  flex: 1 1 auto;
  border: 1px solid rgba(150, 150, 142, 0.72);
  background: rgba(var(--surface-rgb), 0.5);
  color: var(--fg-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.6rem;
  letter-spacing: 0.04em;
  min-height: var(--viz-control);
  padding: 1px 5px;
  line-height: 1.1;
  text-transform: lowercase;
  transition: background 0.1s, color 0.1s, border-color 0.1s;
}
.viz-pill:hover {
  border-color: var(--fg);
  color: var(--fg);
}
.viz-pill.is-on {
  background: var(--fg-muted);
  border-color: var(--fg-soft);
  color: var(--bg);
}
.viz-param-btn {
  margin-left: auto;
  border: 1px solid var(--border-soft, rgba(150, 150, 142, 0.72));
  background: rgba(var(--surface-rgb), 0.5);
  color: var(--fg-muted);
  cursor: pointer;
  font-family: inherit;
  font-size: 0.60rem;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding: 0 6px;
  line-height: 1.12;
  min-width: 62px;
  min-height: calc(var(--viz-control) - 3px);
  text-align: center;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.viz-param-btn.is-on {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
  color: var(--fg);
}
.viz-param-btn:hover {
  border-color: var(--ui-frame-strong, var(--fg-muted));
  color: var(--fg-soft);
}
.viz-range {
  appearance: none;
  width: 76px;
  height: 8px;
  margin: 0;
  background: transparent;
  cursor: ew-resize;
}
.viz-range:focus {
  outline: 0;
}
.viz-range::-webkit-slider-runnable-track {
  height: 1px;
  background: var(--border-soft, rgba(150, 150, 142, 0.72));
}
.viz-range::-webkit-slider-thumb {
  appearance: none;
  width: 8px;
  height: 8px;
  margin-top: -3.5px;
  border: 1px solid var(--fg-muted, #8d8d87);
  background: rgba(var(--surface-rgb), 0.86);
}
.viz-range:focus-visible::-webkit-slider-thumb,
.viz-range:hover::-webkit-slider-thumb {
  border-color: var(--ui-frame-strong, var(--fg-muted));
  background: var(--ui-frame, var(--fg-muted));
}
.viz-range::-moz-range-track {
  height: 1px;
  background: var(--border-soft, rgba(150, 150, 142, 0.72));
}
.viz-range::-moz-range-thumb {
  width: 8px;
  height: 8px;
  border: 1px solid var(--fg-muted, #8d8d87);
  border-radius: 0;
  background: rgba(var(--surface-rgb), 0.86);
}
.viz-range:focus-visible::-moz-range-thumb,
.viz-range:hover::-moz-range-thumb {
  border-color: var(--ui-frame-strong, var(--fg-muted));
  background: var(--ui-frame, var(--fg-muted));
}
.viz-td-toggle {
  margin-left: auto;
  border: 1px solid var(--border, #7b7b76);
  background: var(--surface-overlay, rgba(var(--surface-rgb), 0.48));
  color: var(--fg-muted, #8d8d87);
  min-width: 0;
  height: 16px;
  padding: 0 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background 0.18s, color 0.18s, border-color 0.18s;
}
.viz-td-toggle-state {
  font-size: 0.61rem;
  letter-spacing: 0.06em;
  line-height: 1;
}
.viz-td-toggle.is-on {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
  color: var(--fg);
}
.viz-td-toggle:hover {
  border-color: var(--ui-frame-strong, var(--fg-muted));
  color: var(--fg-soft);
}

.atlas-rameau-help {
  position: absolute;
  inset: 0;
  z-index: 45;
  display: grid;
  place-items: center;
  padding: var(--nav-clearance) 1rem 1rem;
  pointer-events: auto;
}
.atlas-rameau-help-global {
  position: fixed;
  padding: 1rem;
}
.atlas-rameau-help[hidden] {
  display: none;
}
.atlas-rameau-help-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(var(--bg-rgb), 0.54);
  backdrop-filter: blur(4px);
}
.atlas-rameau-help-shell {
  position: relative;
  z-index: 1;
  width: min(620px, calc(100vw - 2rem));
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 7px;
  align-items: start;
}
.atlas-rameau-help-card {
  grid-column: 2;
  width: 100%;
  max-height: min(78vh, 680px);
  overflow: auto;
  border: 1px solid var(--private);
  background: rgba(var(--surface-rgb), 0.94);
  box-shadow: 0 22px 70px rgba(var(--shadow-rgb), 0.16);
  display: grid;
  gap: var(--ui-frame-gap);
  padding: var(--ui-frame-pad);
}
.atlas-rameau-help-close {
  grid-column: 1;
  width: 20px;
  height: 20px;
  border: 1px solid var(--private);
  background: rgba(var(--surface-rgb), 0.76);
  color: var(--fg);
  cursor: pointer;
  font: inherit;
  line-height: 1;
  padding: 0;
}
.atlas-rameau-help-close:hover {
  background: var(--private-grad);
}
.atlas-rameau-help-kicker {
  border: 1px solid var(--private);
  background:
    linear-gradient(90deg, var(--private-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  display: block;
  font-size: 0.64rem;
  font-weight: 500;
  letter-spacing: 0.1em;
  line-height: 1.1;
  padding: 3px 5px;
  text-transform: uppercase;
}
.atlas-rameau-copy,
.atlas-rameau-example {
  border: 1px solid color-mix(in srgb, var(--private) 52%, var(--border-soft));
  background:
    linear-gradient(135deg, rgba(var(--surface-rgb), 0.78) 0%, color-mix(in srgb, var(--private-soft) 28%, rgba(var(--surface-rgb), 0.72)) 100%);
  display: grid;
  gap: 6px;
  padding: 6px;
}
.atlas-rameau-copy h2 {
  font-size: 0.84rem;
  line-height: 1.12;
  margin: 0;
  padding: 0;
}
.atlas-rameau-copy p,
.atlas-rameau-example p {
  color: var(--fg-soft);
  font-size: 0.72rem;
  line-height: 1.34;
  margin: 0;
}
.atlas-rameau-example-lines {
  display: grid;
  gap: 3px;
}
.atlas-rameau-example-lines strong {
  color: var(--fg);
}
.atlas-rameau-links {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: var(--ui-frame-gap);
}
.atlas-rameau-links a {
  border: 1px solid var(--private);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg);
  font-size: 0.64rem;
  letter-spacing: 0.04em;
  line-height: 1.12;
  padding: 4px 5px;
  text-align: center;
  text-transform: uppercase;
}
.atlas-rameau-links a:hover {
  background: var(--private-grad);
}

/* ── Selection panel (bottom-right, only visible on selection) ── */
.viz-panel,
.atlas-panel {
  position: absolute;
  right: var(--chrome-inset);
  bottom: 1.25rem;
  z-index: 30;
  width: min(206px, calc(100vw - 2.5rem));
  border: 1px solid var(--viz-panel-accent, var(--border-soft, rgba(150, 150, 142, 0.72)));
  background: var(--surface-translucent, rgba(250, 249, 245, 0.92));
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.10);
  padding: 3px;
  transition: opacity 0.22s ease, transform 0.22s ease, border-color 0.22s ease;
  opacity: 1;
  transform: translateY(0);
  color: var(--fg);
}
.viz-panel.is-idle,
.viz-panel:not(.has-selection) {
  opacity: 0;
  transform: translateY(8px);
  pointer-events: none;
  visibility: hidden;
}
.viz-panel-media {
  border: 1px solid var(--viz-panel-accent, rgba(150, 150, 142, 0.6));
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(135deg, rgba(190, 190, 182, 0.9), rgba(var(--surface-rgb), 0.72)),
    repeating-linear-gradient(115deg, rgba(20, 20, 18, 0.08) 0 1px, transparent 1px 16px);
  background-size: cover;
  background-position: center;
  margin: 0;
}
.viz-panel-media[hidden] {
  display: none;
}
.viz-panel-card {
  display: grid;
  gap: 3px;
  color: inherit;
  text-decoration: none;
}
.viz-panel-card:hover h1 {
  color: var(--fg);
}
.viz-panel-kicker {
  display: block;
  font-size: 0.6rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg);
  border: 1px solid var(--viz-panel-accent, var(--border-soft));
  background:
    linear-gradient(90deg, var(--viz-panel-accent-soft, var(--accent-soft)) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  margin: 0;
  padding: 3px 5px;
}
.viz-panel h1 {
  border: 1px solid var(--viz-panel-accent, var(--border-soft));
  background:
    linear-gradient(90deg, var(--viz-panel-accent-soft, var(--accent-soft)) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  font-size: 0.82rem;
  line-height: 1.1;
  font-weight: 600;
  margin: 0;
  padding: 3px 5px;
}
.viz-panel p {
  border: 1px solid color-mix(in srgb, var(--viz-panel-accent, var(--border-soft)) 42%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.64);
  font-size: 0.7rem;
  line-height: 1.18;
  color: var(--fg-soft);
  margin: 0;
  padding: 3px 5px;
}
.viz-panel-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 4px 6px;
}
.viz-panel-tags span {
  border: 1px solid var(--tag-accent, var(--viz-panel-accent, #d1d1c8));
  color: var(--fg-soft);
  font-size: 0.66rem;
  padding: 1px 5px;
  background: rgba(var(--surface-rgb), 0.45);
}
.viz-panel-tags span[data-tag] {
  cursor: pointer;
  transition: background 0.1s, color 0.1s;
}
.viz-panel-tags span[data-tag]:hover {
  background: var(--tag-accent, var(--viz-panel-accent, #171714));
  color: var(--bg);
}
.viz-panel-people {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0 4px 4px;
}
.viz-panel-link {
  border: 1px solid rgba(120, 120, 112, 0.5);
  background: rgba(var(--surface-rgb), 0.5);
  color: var(--fg-soft);
  font-family: inherit;
  font-size: 0.68rem;
  padding: 2px 6px;
  cursor: pointer;
}
.viz-panel-link:hover {
  border-color: var(--fg);
  background: var(--fg);
  color: var(--bg);
}
.viz-panel-action {
  position: absolute;
  top: 13px;
  right: 13px;
  z-index: 2;
  border: 1px solid rgba(90, 90, 82, 0.75);
  background: rgba(var(--surface-rgb), 0.92);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 7px;
}
.viz-panel-action:hover {
  background: var(--fg);
  color: var(--bg);
}

.viz-labels .viz-label {
  position: absolute;
}

@media (max-width: 920px) {
  .viz-controls,
  .atlas-controls {
    width: min(214px, calc(100vw - 2rem));
  }
  .viz-panel,
  .atlas-panel {
    width: min(232px, calc(100vw - 2rem));
  }
}

@media (max-width: 620px) {
  .viz-controls,
  .atlas-controls {
    left: 0.6rem;
    bottom: 0.6rem;
    width: calc(100vw - 1.2rem);
  }
  .viz-controls-actions {
    max-width: calc(100vw - 1.2rem);
  }
  .viz-panel,
  .atlas-panel {
    right: 0.6rem;
    left: 0.6rem;
    bottom: calc(0.6rem + 200px);
    width: auto;
  }
  .atlas-rameau-help {
    padding: calc(var(--nav-clearance) + 0.5rem) 0.6rem 0.6rem;
  }
  .atlas-rameau-help-shell {
    grid-template-columns: minmax(0, 1fr);
    width: 100%;
  }
  .atlas-rameau-help-close,
  .atlas-rameau-help-card {
    grid-column: 1;
  }
  .atlas-rameau-links {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 880px) {
  :root {
    --chrome-inset: 10px;
  }
  #nav {
    top: var(--chrome-inset);
    padding: 0 var(--chrome-inset);
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: flex-start;
  }
  .nav-logo { padding: 5px 11px; }
  .nav-menu {
    position: static;
    transform: none;
    order: 3;
    width: 100%;
  }
  .nav-tools {
    margin-left: auto;
  }
  .nav-links {
    display: flex;
    overflow-x: auto;
  }
  .nav-links li { flex: 1 0 auto; }
  .nav-links li a {
    text-align: center;
    padding: 4px 6px;
  }
  :root {
    --nav-clearance: 126px;
    --sticky-clearance: 0px;
  }
  main { padding-top: var(--nav-clearance); }
  body.home main { padding-top: 0; }
  .nav-center {
    position: static;
    transform: none;
    order: 3;
    width: 100%;
    max-width: none;
    justify-content: flex-start;
    flex-wrap: wrap;
  }
  .nav-menu {
    width: auto;
  }
  #projects-grid { grid-template-columns: repeat(2, 1fr); }
  #about {
    width: min(var(--content-rail-width), calc(100vw - 2rem));
    grid-template-columns: 1fr;
  }
  .about-text,
  .about-secondary,
  .about-side {
    grid-column: 1;
  }
  .about-side {
    position: static;
    grid-row: auto;
    width: auto;
  }
  .about-counters dl {
    grid-template-columns: repeat(4, minmax(0, 1fr));
  }
  .index-page-layout,
  #refs-index {
    grid-template-columns: 190px minmax(0, 1fr);
    justify-content: stretch;
  }
  .index-side-list {
    position: static;
    grid-column: 1 / -1;
    display: flex;
    flex-wrap: wrap;
    gap: 5px 12px;
    max-height: none;
  }
  #refs-index .refs-grid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}

@media (max-width: 620px) {
  #projects-grid { grid-template-columns: 1fr; padding-inline: 0.85rem; }
  .index-tools { padding-inline: 0.85rem; }
  #project-single,
  #about { padding-inline: 1rem; }
  .auth-birth {
    grid-template-columns: minmax(0, 1fr);
  }
  .auth-birth canvas {
    justify-self: center;
  }
  .about-secondary-pair,
  .about-support-body,
  .about-counters dl {
    grid-template-columns: 1fr;
  }
  .about-support-action {
    min-height: 24px;
  }
  .index-page-layout,
  #refs-index {
    grid-template-columns: 1fr;
    padding-inline: 0.85rem;
  }
  .refs-filter,
  .library-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }
  .index-side-list {
    position: static;
  }
  .edit-panel-head,
  .studio-header {
    display: grid;
  }
  .edit-page {
    display: grid;
    gap: 8px;
    grid-template-columns: minmax(0, 1fr);
  }
  .edit-switcher {
    width: min(760px, calc(100vw - 2rem));
    position: static;
    grid-template-columns: 1fr 1fr;
    grid-row: auto;
    justify-self: stretch;
    transform: none;
  }
  .contribution-switcher {
    grid-template-columns: 1fr;
  }
  .edit-switcher + .edit-panel {
    grid-row: auto;
  }
  .profile-side-panels,
  .profile-right-panels,
  .profile-display-panel {
    position: static;
    width: 100%;
  }
  .profile-floating-submit,
  .profile-logout {
    justify-self: stretch;
    width: 100%;
  }
  .profile-contact-field {
    grid-template-columns: minmax(0, 1fr);
  }
  .profile-newsletter-toggle {
    justify-content: space-between;
  }
  #refs-index .refs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  #project-preview {
    left: 0.85rem;
    right: 0.85rem;
    bottom: 0.85rem;
    width: auto;
    max-height: 44vh;
    overflow: auto;
  }
}

/* === Autocomplete ville / entités === */
.city-input-wrap,
.entity-autocomplete-wrap { position: relative; }
.city-input-wrap .city-search { width: 100%; }
.entity-autocomplete-wrap input { width: 100%; }
.city-suggestions,
.entity-suggestions {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 50;
  margin: 2px 0 0;
  padding: 0;
  list-style: none;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  max-height: 280px;
  overflow-y: auto;
  box-shadow: 0 8px 24px rgba(var(--shadow-rgb), 0.07);
}
.city-suggestion,
.entity-suggestion {
  padding: 4px 8px;
  cursor: pointer;
  font-size: 0.78rem;
  border-bottom: 1px solid var(--border-soft);
}
.city-suggestion:last-child,
.entity-suggestion:last-child { border-bottom: 0; }
.city-suggestion:hover,
.entity-suggestion:hover { background: var(--accent-soft); }
.city-suggestions[hidden],
.entity-suggestions[hidden] { display: none; }

/* === Pont projet ↔ ref (B6e) === */
.project-cited-refs { margin: 1.2rem 0; }
.project-cited-refs .related-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 0.5rem;
}

/* === Lieu (B6c affichage) === */
.project-location, .ref-location {
  color: var(--fg-soft);
  font-size: 0.76rem;
  font-style: normal;
  line-height: 1.25;
  margin: 0;
}

/* ─────────────────────────────────────────────────────────────────
   LINKS EDITOR — liste de chips + modal
   ───────────────────────────────────────────────────────────────── */
.links-editor {
  display: grid;
  gap: 2px;
  background: transparent;
  border: 0;
  padding: 0;
}
.links-editor-label {
  color: var(--fg-soft);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
}
.links-editor .link-add-btn {
  margin-top: 2px;
}
.links-editor .links-list:not(:empty) + .link-add-btn {
  margin-top: 4px;
}
.links-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 3px;
}
.links-list:empty { display: none; }
.link-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  border: 1px solid var(--border);
  background: rgba(var(--surface-rgb), 0.92);
  padding: 1px 5px 1px 7px;
  font-size: 0.72rem;
  line-height: 1.3;
}
.link-item-host {
  color: var(--fg-soft);
  font-variant-numeric: tabular-nums;
}
.link-item-label {
  color: var(--fg);
}
.link-item-label::before {
  content: '— ';
  color: var(--fg-faint);
}
.link-remove {
  border: none;
  background: transparent;
  color: var(--fg-muted);
  font-size: 1rem;
  line-height: 1;
  width: 18px;
  height: 18px;
  cursor: pointer;
  padding: 0;
}
.link-remove:hover { color: var(--danger); }

.link-add-btn {
  align-items: center;
  display: inline-flex;
  justify-content: center;
  width: fit-content;
  min-height: var(--ui-control-height);
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 0 8px;
  line-height: 1;
  cursor: pointer;
}
.link-add-btn:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
  color: var(--fg);
}

/* Modal — centrée à l'écran, layout compact (titre + boutons en header) */
.link-modal {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  margin: 0;
  border: 1px solid var(--area-frame);
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--area-frame) 18%, var(--surface)) 0%,
      var(--surface) 62%,
      var(--surface) 100%
    );
  background-color: var(--surface);
  padding: var(--ui-frame-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.18);
  width: min(440px, 90vw);
  color: var(--fg);
}
.link-modal::backdrop {
  background: rgba(var(--shadow-rgb), 0.28);
  backdrop-filter: blur(1px);
}
.link-modal-form {
  display: grid;
  gap: var(--ui-frame-gap);
}
.link-modal-header {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--area-frame);
  background: var(--area-frame-soft);
  padding: 3px 5px;
}
.link-modal-header h3 {
  font-size: 0.72rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--fg);
  margin: 0;
}
.link-modal-form label {
  display: grid;
  gap: var(--ui-frame-gap);
  border: 1px solid var(--area-frame);
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--area-frame) 14%, var(--surface)) 0%,
      var(--surface) 62%,
      var(--surface) 100%
    );
  padding: var(--ui-frame-pad);
}
.link-modal-form label span {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1.15;
  text-transform: uppercase;
}
.link-modal-form input[type="url"],
.link-modal-form input[type="text"] {
  width: 100%;
  border: 1px solid var(--border-soft);
  background: var(--surface);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
  line-height: 1.22;
  min-height: var(--ui-control-height);
  outline: none;
}
.link-modal-form input:focus { border-color: var(--fg); }
.modal-actions {
  display: flex;
  gap: 5px;
}
.modal-actions button {
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 2px 8px;
  line-height: 1.3;
  cursor: pointer;
}
.modal-actions button[data-modal-cancel] {
  border-color: var(--border-soft);
  background: transparent;
  color: var(--fg-soft);
}
.modal-actions button:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
}
.modal-actions button[data-modal-cancel]:hover { background: rgba(var(--fg-rgb), 0.04); }

/* ─────────────────────────────────────────────────────────────────
   ENTITY LINKS — affichage public (pages détail)
   ───────────────────────────────────────────────────────────────── */
.entity-links {
  list-style: none;
  padding: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin: 0.6rem 0;
}
.entity-links li { display: inline-block; }
.link-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-size: 0.74rem;
  padding: 2px 8px;
  text-decoration: none;
  line-height: 1.4;
}
.link-chip:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
}
.link-chip-glyph {
  color: var(--fg-soft);
  font-size: 0.7rem;
  line-height: 1;
}
.link-chip-kind {
  color: var(--fg-soft);
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.link-chip-label {
  color: var(--fg);
}
.link-chip-kind + .link-chip-label::before {
  content: "·";
  color: var(--fg-faint);
  margin-right: 6px;
}
.link-chip.link-type-youtube,
.link-chip.link-type-vimeo {
  border-color: var(--area-btn-border);
}
.link-chip.link-type-soundcloud {
  border-color: var(--border);
}
.link-chip.link-type-github {
  border-color: var(--fg-faint);
}

/* ─────────────────────────────────────────────────────────────────
   File input — re-override : doit rester transparent même dans
   .edit-panel / .auth-panel (qui posent un cadre par défaut).
   ───────────────────────────────────────────────────────────────── */
.edit-panel input[type="file"],
.auth-panel input[type="file"],
.profile-form input[type="file"],
.refs-filter input[type="file"] {
  width: auto;
  border: 0;
  background: transparent;
  padding: 0;
  font-size: 0.72rem;
  color: var(--fg-soft);
  line-height: 1.3;
}

.form-row {
  display: grid;
  gap: 6px;
}
.form-row.form-row-2 {
  grid-template-columns: 1fr 1fr;
}

/* ─────────────────────────────────────────────────────────────────
   Detail layout : image flottante à gauche, cadre central, liste à droite
   ───────────────────────────────────────────────────────────────── */
#project-single.detail-layout,
.ref-detail.detail-layout {
  --detail-outer-frame: var(--ui-frame);
  width: auto;
  max-width: none;
  margin: 0;
  padding: var(--nav-clearance) var(--page-gutter) 4rem;
  display: grid;
  grid-template-columns:
    178px
    minmax(0, var(--content-rail-width))
    178px;
  gap: 10px;
  align-items: start;
  justify-content: center;
}
.detail-layout .detail-back {
  justify-self: end;
  align-self: start;
  position: static;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--detail-outer-frame, var(--ui-frame));
  background: var(--ui-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  letter-spacing: 0.04em;
  line-height: 1.2;
  padding: 2px 9px;
  text-decoration: none;
}
.detail-layout .detail-nav {
  grid-column: 1;
  grid-row: 1;
  justify-self: stretch;
  align-self: start;
  position: sticky;
  top: var(--sticky-clearance);
  display: grid;
  justify-items: end;
  gap: 8px;
  min-width: 0;
}
.detail-layout .detail-back:hover {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
}
.ref-detail.detail-layout .detail-back {
  border-color: var(--detail-outer-frame, var(--ui-frame));
  background: var(--ui-bg);
}
.ref-detail.detail-layout .detail-back:hover {
  background: var(--ui-grad);
  border-color: var(--ui-frame-strong);
}
.detail-layout .detail-column {
  grid-column: 2;
  grid-row: 1;
  position: relative;
  min-width: 0;
  display: grid;
  gap: 10px;
}
.detail-layout .detail-column .detail-page {
  width: 100%;
  margin: 0;
}
.detail-layout .detail-side-list {
  position: sticky;
  top: var(--sticky-clearance);
  align-self: start;
  display: grid;
  gap: 2px;
  max-height: calc(100vh - var(--sticky-clearance) - 24px);
  overflow: auto;
  scrollbar-width: none;
  min-width: 0;
}
.detail-layout .detail-nav .detail-side-list {
  position: static;
  top: auto;
  width: 100%;
  max-height: none;
  overflow: visible;
  border: 1px solid var(--detail-outer-frame, var(--ui-frame));
  background: rgba(var(--surface-rgb), 0.86);
  padding: var(--ui-frame-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
}
.ref-detail.detail-layout .detail-nav .detail-side-list {
  border-color: var(--detail-outer-frame, var(--ui-frame));
}
.detail-layout .detail-side-list::-webkit-scrollbar { display: none; }
.detail-layout .detail-side-list a {
  display: block;
  color: var(--fg-soft);
  font-size: 0.74rem;
  line-height: 1.25;
  padding: 2px 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  border-bottom: 0;
}
.detail-layout .detail-side-list a:hover {
  color: var(--fg);
  background: var(--area-side-grad, rgba(255, 211, 230, 0.22));
}
.detail-layout .detail-side-list .detail-side-heading {
  display: block;
  font-size: 0.66rem;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--fg-muted);
  margin: 6px 0 2px;
}
.detail-layout .detail-side-list .detail-side-heading:first-child {
  margin-top: 0;
}

.detail-side-column {
  grid-column: 3;
  grid-row: 1;
  position: sticky;
  top: var(--sticky-clearance);
  align-self: start;
  display: grid;
  gap: 5px;
  min-width: 0;
}
.detail-tech-card,
.detail-related-card,
.detail-rameau-card {
  border: 1px solid var(--detail-outer-frame, var(--ui-frame));
  background: rgba(var(--surface-rgb), 0.86);
  padding: var(--ui-frame-pad);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  display: grid;
  gap: var(--ui-frame-gap);
  min-width: 0;
}
.detail-tech-card-private,
.detail-related-card-private,
.detail-rameau-card-private {
  border-color: var(--detail-outer-frame, var(--ui-frame));
}
.detail-tech-title,
.detail-related-title,
.detail-rameau-title {
  display: block;
  border: 1px solid var(--public);
  background:
    linear-gradient(90deg, var(--public-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  font-size: 0.62rem;
  font-weight: 500;
  letter-spacing: 0.08em;
  line-height: 1.05;
  text-transform: uppercase;
  padding: 2px 4px;
  margin-bottom: 0;
}
.detail-rameau-header {
  display: flex;
  gap: var(--ui-frame-gap);
  align-items: stretch;
  min-width: 0;
}
.detail-rameau-header .detail-rameau-title {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-rameau-help-button {
  flex: 0 0 19px;
  width: 19px;
  min-width: 19px;
  height: auto;
  min-height: 17px;
}
.detail-tech-card-private .detail-tech-title,
.detail-related-card-private .detail-related-title,
.detail-rameau-card-private .detail-rameau-title {
  border-color: var(--private);
  background:
    linear-gradient(90deg, var(--private-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
}
.detail-tech-summary {
  border: 1px solid color-mix(in srgb, var(--public) 42%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.68);
  padding: 2px 4px;
  min-width: 0;
  color: var(--fg);
  font-size: 0.68rem;
  line-height: 1.16;
  overflow-wrap: anywhere;
}
.detail-tech-card-private .detail-tech-summary {
  border-color: color-mix(in srgb, var(--private) 46%, var(--border-soft));
}
.detail-tech-line {
  display: block;
}
.detail-tech-line + .detail-tech-line {
  margin-top: 2px;
}
.detail-tech-line strong {
  font-weight: 600;
}
.detail-tech-card a {
  border-bottom: 1px solid var(--border-soft);
}
.detail-tech-card a:hover {
  border-bottom-color: var(--fg);
}
.detail-related-title:not(:first-child) {
  margin-top: 3px;
}
.detail-related-list {
  display: grid;
  gap: 1px;
  border: 1px solid var(--public);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 1px;
}
.detail-related-card-private .detail-related-list {
  border-color: var(--private);
}
.detail-related-list a {
  display: block;
  color: var(--fg-soft);
  font-size: 0.68rem;
  line-height: 1.08;
  min-height: 16px;
  padding: 1px 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.detail-related-list a:hover {
  color: var(--fg);
  background: var(--area-side-grad);
}
#project-single .detail-related-list a {
  color: var(--fg);
  background:
    linear-gradient(90deg, color-mix(in srgb, var(--public) 14%, rgba(var(--surface-rgb), 0.74)) 0%, rgba(var(--surface-rgb), 0.68) 100%);
}
#project-single .detail-related-list a:hover {
  background: var(--public-soft);
}
.detail-rameau-list {
  border: 1px solid var(--private);
  background: rgba(var(--surface-rgb), 0.72);
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
  padding: 1px;
}
.detail-rameau-chip {
  border: 1px solid color-mix(in srgb, var(--tag-accent, var(--private)) 56%, var(--border-soft));
  background:
    linear-gradient(
      90deg,
      color-mix(in srgb, var(--tag-accent, var(--private)) 22%, rgba(var(--surface-rgb), 0.78)) 0%,
      rgba(var(--surface-rgb), 0.72) 100%
  );
  color: var(--fg-soft);
  font-size: 0.64rem;
  line-height: 1.08;
  min-height: 16px;
  padding: 1px 3px;
}
.detail-rameau-empty {
  border: 1px solid var(--private);
  background: rgba(var(--surface-rgb), 0.72);
  color: var(--fg-muted);
  font-size: 0.66rem;
  line-height: 1.12;
  margin: 0;
  padding: 2px 4px;
}

.detail-collaborators {
  font-style: italic;
  color: var(--fg-muted);
}
.detail-edit-link {
  align-self: end;
  justify-self: end;
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.06em;
  text-transform: lowercase;
  text-decoration: none;
  border-bottom: 1px dashed var(--border-soft);
  padding-bottom: 1px;
  margin-top: -8px;
}
.detail-edit-link:hover {
  color: var(--fg);
  border-bottom-color: var(--fg);
}
.detail-edit-link-floating {
  position: absolute;
  top: -22px;
  right: 0;
  z-index: 8;
  margin: 0;
  align-self: auto;
  justify-self: auto;
  text-transform: none;
}

.flash-banner {
  position: fixed;
  top: 8px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 200;
  max-width: min(720px, calc(100vw - 2rem));
  border: 1px solid var(--danger);
  background: var(--danger-bg);
  color: var(--danger);
  padding: 8px 12px;
  font-size: 0.78rem;
  line-height: 1.35;
  box-shadow: 0 8px 24px rgba(var(--shadow-rgb), 0.12);
}
.flash-banner strong {
  display: block;
  margin-bottom: 4px;
  font-size: 0.74rem;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.flash-banner ul {
  margin: 0;
  padding-left: 1.2rem;
}
.flash-banner li {
  margin: 0;
}
.detail-title-band h1 {
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.15;
  margin: 0;
  min-width: 0;
}
.detail-title-band {
  border: 1px solid color-mix(in srgb, var(--detail-frame) 52%, var(--border-soft));
  background: linear-gradient(90deg, var(--detail-soft) 0%, rgba(var(--surface-rgb), 0.72) 100%);
  padding: 3px 6px;
}
.detail-reading-block {
  border: 1px solid color-mix(in srgb, var(--detail-frame) 42%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.72);
  padding: 7px 9px;
  font-size: 0.82rem;
  line-height: 1.32;
}
.detail-page .detail-reading-block.project-body,
.detail-page .detail-reading-block.ref-detail-text {
  border-top: 1px solid color-mix(in srgb, var(--detail-frame) 42%, var(--border-soft));
  margin: 0;
  padding: 7px 9px;
  line-height: 1.32;
  font-size: 0.82rem;
}
.detail-reading-block p {
  margin: 0;
}
.detail-column > .entity-links {
  margin: -4px 0 0;
}
#project-single .detail-column > .entity-links {
  margin-top: -2px;
}
#project-single .detail-column > .entity-links .link-chip {
  border-color: color-mix(in srgb, var(--public) 70%, var(--border-soft));
  background:
    linear-gradient(90deg, var(--public-soft) 0%, rgba(var(--surface-rgb), 0.76) 100%);
  color: var(--fg);
}
#project-single .detail-column > .entity-links .link-chip:hover {
  background: var(--public-grad);
}
#project-single .detail-column > .entity-links .link-chip-glyph,
#project-single .detail-column > .entity-links .link-chip-kind {
  color: var(--fg);
}

.detail-layout .detail-gallery {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 6px;
}
.detail-layout .detail-gallery .media-tile:first-child {
  grid-column: 1 / -1;
}
.detail-layout .detail-gallery .media-tile {
  border: 1px solid var(--detail-outer-frame, var(--ui-frame));
  padding: 2px;
  background: rgba(var(--surface-rgb), 0.92);
  margin: 0;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}
.ref-detail.detail-layout .detail-gallery .media-tile {
  border-color: var(--detail-outer-frame, var(--ui-frame));
}
.detail-layout .detail-gallery .media-tile > img,
.detail-layout .detail-gallery .media-lightbox-trigger > img,
.detail-layout .detail-gallery .media-tile > video {
  width: 100%;
  display: block;
  aspect-ratio: 4 / 3;
  background: var(--surface);
}
.detail-layout .detail-gallery .media-tile > img,
.detail-layout .detail-gallery .media-lightbox-trigger > img {
  object-fit: cover;
  border: 0;
  padding: 0;
}
.detail-layout .detail-gallery .media-tile:first-child .media-lightbox-trigger > img {
  aspect-ratio: auto;
  height: auto;
  object-fit: contain;
}
.media-lightbox-trigger {
  display: block;
  width: 100%;
  border: 0;
  background: transparent;
  padding: 0;
  cursor: zoom-in;
}
.media-lightbox[hidden] {
  display: none;
}
.media-lightbox {
  position: fixed;
  inset: 0;
  z-index: 180;
  display: grid;
  grid-template-columns: 48px minmax(0, 1fr) 48px;
  align-items: center;
  gap: 8px;
  padding: 48px;
  background: rgba(var(--surface-rgb), 0.84);
  backdrop-filter: blur(2px);
}
.has-media-lightbox {
  overflow: hidden;
}
.media-lightbox-figure {
  grid-column: 2;
  display: grid;
  justify-self: center;
  gap: 6px;
  width: fit-content;
  max-width: min(980px, calc(100vw - 150px));
  max-height: calc(100vh - 110px);
  margin: 0;
}
.media-lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 145px);
  border: 1px solid var(--border-soft);
  background: var(--surface);
  object-fit: contain;
  padding: 2px;
  box-shadow: 0 18px 48px rgba(var(--shadow-rgb), 0.16);
}
.media-lightbox-counter {
  color: var(--fg-muted);
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  line-height: 1.1;
  text-align: center;
}
.media-lightbox-close,
.media-lightbox-nav {
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  cursor: pointer;
}
.media-lightbox-close:hover,
.media-lightbox-nav:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
}
.media-lightbox.is-single .media-lightbox-nav {
  display: none;
}
.media-lightbox-close {
  position: absolute;
  top: var(--chrome-inset);
  right: var(--chrome-inset);
  width: 32px;
  height: 28px;
  padding: 0;
  font-size: 1.1rem;
  line-height: 1;
}
.media-lightbox-nav {
  width: 36px;
  height: 44px;
  padding: 0;
  font-size: 1.2rem;
  line-height: 1;
}
.media-lightbox-prev {
  grid-column: 1;
  justify-self: end;
}
.media-lightbox-next {
  grid-column: 3;
  justify-self: start;
}
.detail-layout .detail-gallery .media-tile-video {
  grid-column: 1 / -1;
}
.detail-layout .detail-gallery .media-tile-video > video {
  aspect-ratio: 16 / 9;
  max-height: 72vh;
  object-fit: contain;
}
.detail-layout .detail-gallery .media-tile-audio,
.detail-layout .detail-gallery .media-tile-pdf {
  grid-column: auto;
}
.detail-layout .detail-gallery .media-tile-audio {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 10px;
  background: rgba(var(--fg-rgb), 0.04);
}
.detail-layout .detail-gallery .media-tile-audio audio {
  flex: 1;
  min-width: 0;
}
.detail-layout .detail-gallery .media-tile-doc {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  aspect-ratio: 4 / 3;
  background: rgba(var(--fg-rgb), 0.04);
  color: var(--fg-soft);
  text-decoration: none;
  text-align: center;
  padding: 10px;
}
.detail-layout .detail-gallery .media-tile-pdf-doc {
  position: relative;
  display: block;
  overflow: hidden;
  contain: paint;
  padding: 0;
  background:
    linear-gradient(135deg, rgba(var(--surface-rgb), 0.96), rgba(240, 238, 229, 0.94)),
    repeating-linear-gradient(0deg, rgba(var(--fg-rgb), 0.035) 0 1px, transparent 1px 18px);
}
.detail-layout .detail-gallery .media-tile-pdf-preview {
  position: absolute;
  inset: 8px;
  display: flex;
  align-items: stretch;
  justify-content: center;
  overflow: hidden;
  border: 1px solid rgba(181, 181, 173, 0.55);
  pointer-events: none;
  background: rgba(var(--surface-rgb), 0.58);
  box-shadow: inset 0 0 0 1px rgba(var(--surface-rgb), 0.78);
}
.detail-layout .detail-gallery .media-tile-pdf-sheet {
  width: min(72%, 210px);
  margin: 14px 0 34px;
  padding: 18px 16px;
  display: grid;
  align-content: start;
  gap: 8px;
  background: rgba(var(--surface-rgb), 0.96);
  border: 1px solid rgba(154, 154, 144, 0.62);
  box-shadow: 0 8px 20px rgba(var(--fg-rgb), 0.12);
  transform: rotate(-1deg);
}
.detail-layout .detail-gallery .media-tile-pdf-sheet span {
  display: block;
  height: 4px;
  border-radius: 99px;
  background: rgba(104, 104, 96, 0.34);
}
.detail-layout .detail-gallery .media-tile-pdf-sheet span:first-child {
  width: 46%;
  height: 22px;
  border-radius: 2px;
  background: linear-gradient(90deg, var(--private), var(--public));
}
.detail-layout .detail-gallery .media-tile-pdf-sheet span:nth-child(2) {
  width: 86%;
  margin-top: 8px;
}
.detail-layout .detail-gallery .media-tile-pdf-sheet span:nth-child(3) {
  width: 74%;
}
.detail-layout .detail-gallery .media-tile-pdf-sheet span:nth-child(4) {
  width: 92%;
}
.detail-layout .detail-gallery .media-tile-pdf-sheet span:nth-child(5) {
  width: 62%;
}
.detail-layout .detail-gallery .media-tile-pdf-doc .media-tile-glyph {
  position: absolute;
  top: 8px;
  right: 8px;
  z-index: 2;
  background: rgba(var(--surface-rgb), 0.88);
}
.detail-layout .detail-gallery .media-tile-open {
  position: absolute;
  left: 8px;
  bottom: 8px;
  z-index: 2;
  border: 1px solid rgba(181, 181, 173, 0.85);
  background: rgba(var(--surface-rgb), 0.88);
  color: var(--fg-soft);
  font-size: 0.66rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 3px 7px;
}
.detail-layout .detail-gallery .media-tile-doc:hover {
  background: rgba(var(--fg-rgb), 0.08);
  color: var(--fg);
}
.detail-layout .detail-gallery .media-tile-glyph {
  font-size: 0.8rem;
  letter-spacing: 0.12em;
  color: var(--fg-soft);
  text-transform: uppercase;
  border: 1px solid var(--border-soft);
  padding: 3px 8px;
  background: rgba(var(--surface-rgb), 0.7);
}
.detail-layout .detail-gallery .media-tile-name {
  font-size: 0.7rem;
  color: var(--fg-muted);
  word-break: break-all;
  line-height: 1.25;
}
.detail-layout .detail-gallery figcaption {
  padding: 4px 5px 2px;
  color: var(--fg-muted);
  font-size: 0.7rem;
}

@media (max-width: 980px) {
  #project-single.detail-layout,
  .ref-detail.detail-layout {
    grid-template-columns: 36px minmax(0, 1fr);
  }
  .detail-layout .detail-nav {
    grid-column: 1;
    position: static;
  }
  .detail-layout .detail-back {
    grid-column: 1;
  }
  .detail-layout .detail-column {
    grid-column: 2;
  }
  .detail-side-column {
    grid-column: 2;
    grid-row: 2;
    position: static;
  }
  .detail-layout .detail-side-list {
    grid-column: 1 / -1;
    grid-row: auto;
    position: static;
    max-height: none;
    overflow: visible;
  }
}
@media (max-width: 620px) {
  #project-single.detail-layout,
  .ref-detail.detail-layout {
    grid-template-columns: 32px minmax(0, 1fr);
    padding-inline: 0.6rem;
  }
  .about-counters dl {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
@media (max-width: 480px) {
  .detail-layout .detail-gallery {
    grid-template-columns: minmax(0, 1fr);
  }
  .media-lightbox {
    grid-template-columns: 36px minmax(0, 1fr) 36px;
    gap: 5px;
    padding: 36px 8px;
  }
  .media-lightbox-figure {
    max-width: calc(100vw - 90px);
    max-height: calc(100vh - 96px);
  }
  .media-lightbox img {
    max-height: calc(100vh - 130px);
  }
  .media-lightbox-close {
    top: 10px;
    right: 10px;
  }
  .media-lightbox-nav {
    width: 32px;
    height: 40px;
  }
  .about-counters dl {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ─────────────────────────────────────────────────────────────────
   Edit page — boutons d'action en haut à gauche, hors panel
   ───────────────────────────────────────────────────────────────── */
.edit-page-actions {
  display: grid;
  grid-template-columns: minmax(0, min(var(--content-rail-width), calc(100vw - 2rem)));
  justify-content: center;
  align-items: flex-start;
}
.edit-page > form {
  display: contents;
}
.edit-page > form .edit-panel {
  display: grid;
  gap: 6px;
}
.edit-page-actions .edit-actions {
  width: 156px;
  display: grid;
  gap: 4px;
  position: sticky;
  top: 88px;
  align-self: start;
  grid-column: 1;
  grid-row: 1;
  justify-self: start;
  transform: translateX(calc(-100% - 12px));
}
.edit-page-actions .edit-panel {
  grid-column: 1;
  grid-row: 1;
  display: grid;
  gap: 6px;
}
.edit-actions {
  display: grid;
  gap: 4px;
  width: 156px;
  position: sticky;
  top: 88px;
  align-self: start;
  border: 1px solid var(--area-frame);
  background: rgba(var(--surface-rgb), 0.86);
  padding: 2px;
}
.edit-actions button {
  width: 100%;
  border: 1px solid var(--area-btn-border);
  background: var(--area-btn-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.66rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 4px 9px;
  line-height: 1.4;
  cursor: pointer;
}
.edit-actions button:hover {
  background: var(--area-btn-grad);
  border-color: var(--area-btn-grad-hi);
}
.edit-actions .edit-action-save {
  background: var(--surface);
  border-color: var(--area-submit-border);
}
.edit-actions .edit-action-save:hover {
  background: var(--area-submit-grad);
}
.edit-actions .danger {
  background: transparent;
  border-color: var(--danger);
  color: var(--danger);
}
.edit-actions .danger:hover {
  background: var(--danger-soft);
  border-color: var(--danger);
  color: var(--danger);
}

/* Contribution / édition : panneaux compacts et guidés. */
.edit-page:has(.edit-panel-compact) {
  --edit-ref-gap: var(--ui-frame-gap);
  --edit-ref-pad: var(--ui-frame-pad);
  --edit-ref-control: var(--ui-control-height);
  grid-template-columns: minmax(0, min(var(--content-rail-width), calc(100vw - 2rem)));
  column-gap: 0;
}
.edit-page:has(.edit-panel-compact) .edit-panel-compact {
  grid-column: 1;
  grid-row: 1;
  gap: var(--edit-ref-gap);
  border-color: var(--ui-frame);
}
.edit-page:has(.edit-panel-compact) .edit-context-note {
  grid-column: 1;
  grid-row: 1;
  justify-self: end;
  width: 214px;
  transform: translateX(calc(100% + 12px));
}
.edit-page:has(.edit-panel-compact) .edit-floating-submit {
  grid-column: 1;
  grid-row: 2;
  justify-self: end;
  margin-top: var(--edit-ref-gap);
}
.edit-context-note {
  position: sticky;
  top: 88px;
  border: 0;
  background: transparent;
  box-shadow: none;
  padding: 0;
  display: grid;
  gap: 6px;
  align-self: start;
}
.edit-context-main,
.edit-context-help {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.82);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.045);
  padding: var(--edit-ref-pad);
  display: grid;
  gap: var(--edit-ref-gap);
}
.edit-context-note .edit-context-title,
.edit-context-help > span {
  border: 1px solid var(--area-frame);
  background: var(--area-frame-soft);
  color: var(--fg);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  line-height: 1.25;
  text-transform: uppercase;
  padding: 3px 5px;
}
.edit-context-body,
.edit-context-help p {
  border: 1px solid var(--area-frame);
  background: rgba(var(--surface-rgb), 0.74);
  padding: 3px 5px;
}
.edit-context-body {
  display: grid;
  gap: 4px;
}
.edit-context-body p,
.edit-context-help p {
  color: var(--fg-soft);
  font-size: 0.68rem;
  line-height: 1.22;
  margin: 0;
}
.edit-context-help > span {
  display: block;
}
.edit-context-help p {
  padding: 3px 5px;
}
.edit-panel-compact {
  padding: var(--edit-ref-pad);
  gap: var(--edit-ref-gap);
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.edit-panel-compact > * {
  grid-column: 1 / -1;
}
.edit-panel-compact .edit-panel-head {
  border: 1px solid var(--area-frame);
  background: var(--area-frame-soft);
  padding: 3px 6px;
  margin-bottom: 0;
}
.edit-panel-compact .edit-panel-head span {
  margin-bottom: 1px;
  font-size: 0.62rem;
}
.edit-panel-compact .edit-panel-head h1 {
  margin: 0;
  font-size: 1rem;
  line-height: 1.15;
}
.edit-compact-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: var(--edit-ref-gap);
}
.edit-panel-compact .edit-field {
  border: 1px solid var(--area-frame);
  background:
    linear-gradient(90deg, var(--area-frame-soft) 0%, rgba(var(--surface-rgb), 0.74) 62%, rgba(var(--surface-rgb), 0.9) 100%);
  padding: var(--edit-ref-pad);
  display: grid;
  gap: var(--edit-ref-gap);
  min-width: 0;
  align-content: start;
}
.edit-reference-grid .edit-field-name,
.edit-reference-grid .edit-field-people,
.edit-reference-grid .edit-field-city,
.edit-artist-grid .edit-field-name,
.edit-artist-grid .edit-field-profession,
.edit-project-grid .edit-field-title {
  grid-column: span 3;
}
.edit-reference-grid .edit-field-year,
.edit-project-grid .edit-field-start,
.edit-project-grid .edit-field-end,
.edit-project-grid .edit-field-status {
  grid-column: span 1;
}
.edit-reference-grid .edit-field-category {
  grid-column: span 2;
}
.edit-artist-grid .edit-field-nationality {
  grid-column: span 4;
}
.edit-artist-grid .edit-field-birth {
  grid-column: span 2;
}
.edit-project-grid .edit-field-city {
  grid-column: span 6;
}
.edit-panel-compact .edit-field > span,
.edit-panel-compact .edit-field label > span,
.edit-panel-compact .people-field-label,
.edit-panel-compact .links-editor-label {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  margin: 0;
}
.edit-panel-compact .edit-field > label,
.edit-panel-compact .edit-field .people-field,
.edit-panel-compact .edit-field .links-editor {
  display: grid;
  gap: var(--edit-ref-gap);
}
.edit-panel-compact .edit-field input:not([type="hidden"]):not([type="file"]),
.edit-panel-compact .edit-field textarea,
.edit-panel-compact .edit-field select {
  border-color: var(--border-soft);
  background: rgba(var(--surface-rgb), 0.96);
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
  min-height: var(--edit-ref-control);
}
.edit-panel-compact .people-field {
  grid-template-columns: minmax(0, 1fr) var(--edit-ref-control);
  align-items: start;
}
.edit-panel-compact .people-field-label {
  grid-column: 1 / -1;
}
.edit-panel-compact .people-rows {
  grid-column: 1;
  grid-row: 2;
  gap: var(--edit-ref-gap);
}
.edit-panel-compact .people-row {
  grid-template-columns: minmax(0, 1fr) var(--edit-ref-control);
  gap: var(--edit-ref-gap);
}
.edit-panel-compact .people-row input[type="text"] {
  min-height: var(--edit-ref-control);
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
}
.edit-panel-compact .people-field .people-row-remove,
.edit-panel-compact .people-field .people-row-add {
  width: var(--edit-ref-control);
  min-width: var(--edit-ref-control);
  max-width: var(--edit-ref-control);
  height: var(--edit-ref-control);
  min-height: var(--edit-ref-control);
}
.edit-panel-compact .people-field .people-row-add {
  grid-column: 2;
  grid-row: 2;
}
.edit-panel-compact .edit-field-description textarea {
  min-height: 132px;
}
.edit-panel-compact .edit-field-upload input[type="file"] {
  font-size: 0.66rem;
  line-height: var(--edit-compact-action-height);
  min-height: 0;
}
.edit-panel-compact .edit-field-upload input[type="file"]::file-selector-button {
  width: var(--edit-compact-button-width);
  height: var(--edit-compact-action-height);
  min-height: var(--edit-compact-action-height);
  padding: 0 7px;
  line-height: 1;
}
.edit-panel-compact .edit-field-upload {
  grid-column: 1;
}
.edit-panel-compact .edit-field-links {
  grid-column: 2;
  gap: 0;
}
.edit-panel-compact .edit-field-upload,
.edit-panel-compact .edit-field-links {
  align-content: start;
}
.edit-panel-compact .edit-field-consent {
  grid-template-columns: var(--form-checkbox-size) minmax(0, 1fr);
  align-items: center;
  gap: 5px;
  background:
    linear-gradient(90deg, var(--public-soft) 0%, rgba(var(--surface-rgb), 0.78) 70%);
  padding: 1px 2px;
}
.edit-panel-compact .edit-field-consent input[type="checkbox"] {
  height: var(--form-checkbox-size);
  margin: 0;
  max-height: var(--form-checkbox-size);
  max-width: var(--form-checkbox-size);
  min-height: var(--form-checkbox-size);
  min-width: var(--form-checkbox-size);
  padding: 0;
  width: var(--form-checkbox-size);
}
.edit-panel-compact .edit-field-consent > span {
  color: var(--fg-soft);
  font-size: 0.68rem;
  letter-spacing: 0;
  line-height: 1.15;
  text-transform: none;
}
.edit-panel-compact .links-editor {
  display: grid;
  gap: 0;
  align-items: start;
  line-height: 1.2;
}
.edit-panel-compact .links-editor-label {
  line-height: 1.2;
}
.edit-panel-compact .links-editor .link-add-btn {
  justify-self: start;
  width: var(--edit-compact-button-width);
  height: var(--edit-compact-action-height);
  min-height: var(--edit-compact-action-height);
  margin: 0;
  padding: 0 7px;
}
.edit-panel-compact .links-list {
  margin-top: 0;
}
.edit-panel-compact .links-list:empty {
  display: none;
  margin: 0;
}
.edit-panel-compact .links-list:not(:empty) + .link-add-btn {
  margin-top: 0;
}
.edit-page:has(.edit-panel-compact) .form-actions button {
  border: 1px solid var(--area-submit-border);
  background: var(--area-submit-bg);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.72rem;
  letter-spacing: 0.08em;
  line-height: 1.25;
  text-transform: uppercase;
  min-height: var(--ui-control-height);
  padding: 3px 13px;
}

@media (max-width: 1100px) {
  .edit-page:has(.edit-panel-compact) .edit-context-note {
    position: static;
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
    transform: none;
  }
}

@media (max-width: 720px) {
  .edit-page:has(.edit-panel-compact) {
    grid-template-columns: minmax(0, min(var(--content-rail-width), calc(100vw - 2rem)));
  }
  .edit-page:has(.edit-panel-compact) .edit-context-note {
    position: static;
    grid-column: 1;
    grid-row: auto;
    justify-self: stretch;
    width: 100%;
    transform: none;
  }
  .edit-compact-grid {
    grid-template-columns: 1fr;
  }
  .edit-panel-compact {
    grid-template-columns: 1fr;
  }
  .edit-panel-compact .edit-field-name,
  .edit-panel-compact .edit-field-people,
  .edit-panel-compact .edit-field-year,
  .edit-panel-compact .edit-field-city,
  .edit-panel-compact .edit-field-category,
  .edit-panel-compact .edit-field-profession,
  .edit-panel-compact .edit-field-nationality,
  .edit-panel-compact .edit-field-website,
  .edit-panel-compact .edit-field-birth,
  .edit-panel-compact .edit-field-title,
  .edit-panel-compact .edit-field-start,
  .edit-panel-compact .edit-field-end,
  .edit-panel-compact .edit-field-status,
  .edit-panel-compact .edit-field-project-refs,
  .edit-panel-compact .edit-field-upload,
  .edit-panel-compact .edit-field-links {
    grid-column: 1;
  }
  .edit-page-actions .edit-actions {
    position: static;
    transform: none;
    width: 100%;
    grid-template-columns: 1fr 1fr;
    grid-column: 1;
    grid-row: auto;
    margin-bottom: 8px;
    justify-self: stretch;
  }
  .edit-page-actions .edit-panel {
    grid-row: auto;
  }
}

/* ─────────────────────────────────────────────────────────────────
   People input : libellé au-dessus + une rangée par personne avec ×,
   bouton + à la fin pour en ajouter une autre.
   ───────────────────────────────────────────────────────────────── */
.people-field {
  display: grid;
  gap: 2px;
}
.people-field-label {
  color: var(--fg-soft);
  font-size: 0.7rem;
  letter-spacing: 0.02em;
  line-height: 1.25;
}
.people-rows {
  display: grid;
  gap: 2px;
  min-width: 0;
}
.people-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) var(--ui-control-height);
  gap: var(--ui-frame-gap);
  align-items: stretch;
  min-width: 0;
}
.people-row .entity-autocomplete-wrap {
  min-width: 0;
}
.people-row input[type="text"] {
  width: 100%;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.92);
  color: var(--fg);
  font-family: inherit;
  font-size: 0.78rem;
  padding: var(--ui-control-pad-y) var(--ui-control-pad-x);
  line-height: 1.22;
  min-height: var(--ui-control-height);
  outline: none;
}
.people-row input[type="text"]:focus {
  border-color: var(--fg);
}
.people-field .people-row-remove,
.people-field .people-row-add {
  flex: 0 0 var(--ui-control-height);
  width: var(--ui-control-height);
  min-width: var(--ui-control-height);
  max-width: var(--ui-control-height);
  height: var(--ui-control-height);
  min-height: var(--ui-control-height);
  border: 1px solid var(--border-soft);
  background: transparent;
  color: var(--fg-muted);
  font-family: inherit;
  font-size: 0.78rem;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-transform: none;
  letter-spacing: 0;
}
.people-field .people-row-add {
  align-self: start;
  border-style: dashed;
  background: var(--area-btn-bg);
  border-color: var(--area-btn-border);
  color: var(--fg);
}
.people-field .people-row-remove:hover {
  border-color: var(--danger);
  color: var(--danger);
}
.people-field .people-row-add:hover {
  border-color: var(--fg-soft);
  color: var(--fg);
}

/* ─────────────────────────────────────────────────────────────────
   Image tiles : médias actuels compacts, actions visibles.
   ───────────────────────────────────────────────────────────────── */
.image-tiles,
.current-media {
  border: 1px solid var(--area-frame);
  background: rgba(var(--surface-rgb), 0.72);
  padding: 3px;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(94px, 1fr));
  gap: 4px;
}
.current-media-head {
  grid-column: 1 / -1;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.62);
  padding: 2px 5px;
}
.current-media-head span {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}
.current-media-head small {
  color: var(--fg-soft);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}
.image-tile {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--area-frame) 46%, var(--border-soft));
  background:
    linear-gradient(135deg, rgba(var(--surface-rgb), 0.94) 0%, rgba(var(--surface-rgb), 0.72) 100%);
  overflow: hidden;
  aspect-ratio: 1 / 1;
}
.image-tile img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
  aspect-ratio: auto;
  border: 0;
}
.image-tile.is-main {
  border-color: var(--area-submit-border);
  box-shadow: inset 0 0 0 2px color-mix(in srgb, var(--area-submit-border) 34%, transparent);
}
.image-tile.image-tile-doc {
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(var(--fg-rgb), 0.04);
}
.image-tile-doc-label {
  color: var(--fg-soft);
  font-size: 0.7rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.image-tile-badge {
  position: absolute;
  top: 3px;
  left: 3px;
  border: 1px solid var(--area-submit-border);
  background: rgba(var(--surface-rgb), 0.86);
  color: var(--fg-soft);
  font-size: 0.56rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 1px 4px;
  pointer-events: none;
}
.image-tile-actions {
  position: absolute;
  right: 3px;
  bottom: 3px;
  display: flex;
  align-items: center;
  gap: 3px;
}
.image-tile-action {
  position: relative;
  width: 19px;
  height: 19px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-soft);
  background: rgba(var(--surface-rgb), 0.96);
  color: var(--fg-muted);
  cursor: pointer;
  font-size: 0.62rem;
  line-height: 1;
  padding: 0;
  text-transform: uppercase;
  letter-spacing: 0;
}
.image-tile-action:hover {
  border-color: var(--fg-soft);
  color: var(--fg);
}
.image-tile-action input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}
.image-tile-action.image-tile-radio:has(input:checked) {
  background: var(--area-submit-bg);
  border-color: var(--area-submit-border);
  color: var(--fg);
}
.image-tile-action.image-tile-cb:has(input:checked) {
  background: var(--danger-bg);
  border-color: var(--danger);
  color: var(--danger);
}

/* ── Page artiste enrichie ── */
.artist-meta-line {
  font-size: 0.78rem;
  color: var(--fg-soft);
  margin-top: 4px;
  letter-spacing: 0.04em;
}
.artist-web-link {
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 1px;
}
.artist-web-link:hover {
  color: var(--fg);
  border-bottom-color: var(--fg);
}
.artist-tags-cloud {
  display: flex;
  flex-wrap: wrap;
  gap: 4px 5px;
  margin-top: 14px;
}
.artist-tag-chip {
  display: inline-block;
  font-size: 0.66rem;
  letter-spacing: 0.04em;
  padding: 2px 8px;
  border: 1px solid var(--tag-accent, var(--border-soft));
  color: var(--fg);
  background: rgba(var(--surface-rgb), 0.6);
  border-radius: 0;
  transition: background 0.16s, color 0.16s, border-color 0.16s;
}
.artist-tag-chip:hover {
  background: var(--tag-accent, var(--fg));
  color: var(--surface);
}

/* ── Page tag (mini-atlas centré sur un tag) ── */
.tag-area .tag-header {
  border-bottom: 1px solid var(--tag-accent, var(--border-soft));
}
.tag-kicker {
  display: inline-block;
  font-size: 0.62rem;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--tag-family, var(--fg-soft));
  margin-bottom: 4px;
}
.tag-counters {
  font-size: 0.74rem;
  color: var(--fg-soft);
  letter-spacing: 0.04em;
}
.tag-coocurrents {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 6px;
  margin-top: 14px;
}
.tag-section-label {
  font-size: 0.6rem;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--fg-muted);
  margin-right: 6px;
}
.tag-section {
  margin-top: 1.6rem;
}
.tag-section-title {
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--border-soft);
}
.tag-ref-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.tag-ref-item {
  border-left: 2px solid var(--type-accent, var(--border-soft));
  padding: 6px 10px;
  margin-bottom: 2px;
  background: rgba(var(--surface-rgb), 0.55);
  transition: background 0.16s;
}
.tag-ref-item:hover {
  background: rgba(var(--surface-rgb), 0.92);
}
.tag-ref-item a {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 2px 12px;
  align-items: baseline;
  text-decoration: none;
  color: inherit;
}
.tag-ref-name {
  font-size: 0.82rem;
  font-weight: 500;
}
.tag-ref-artist {
  font-size: 0.72rem;
  color: var(--fg-soft);
  grid-column: 1 / -1;
}
.tag-ref-meta {
  font-size: 0.62rem;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  text-transform: uppercase;
  white-space: nowrap;
}
.tag-ref-meta em {
  font-style: normal;
  color: var(--type-accent, var(--fg-muted));
}
.tag-ref-meta small {
  font-size: 0.92em;
  opacity: 0.7;
}

/* ── /work : message d'attente ── */
#work-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: calc(var(--nav-clearance) + 1rem) 2rem 2rem;
}
.work-empty-panel {
  border: 1px solid var(--ui-frame);
  background: rgba(var(--surface-rgb), 0.9);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  display: grid;
  gap: var(--ui-frame-gap);
  padding: var(--ui-frame-pad);
  width: min(420px, calc(100vw - 2rem));
}
.work-empty-panel > span {
  border: 1px solid var(--private);
  background:
    linear-gradient(90deg, var(--private-soft) 0%, rgba(var(--surface-rgb), 0.74) 100%);
  color: var(--fg);
  font-size: 0.66rem;
  letter-spacing: 0.12em;
  line-height: 1.15;
  padding: 2px 5px;
  text-transform: uppercase;
}
.work-empty-panel p {
  border: 1px solid var(--private);
  background: rgba(var(--surface-rgb), 0.66);
  color: var(--fg-soft);
  font-size: 0.78rem;
  line-height: 1.35;
  margin: 0;
  padding: 5px 7px;
}

/* ── Laboratoire des glyphes ── */
#glyph-laboratory {
  width: min(1080px, calc(100vw - 2rem));
  margin: 0 auto;
  padding: calc(var(--nav-clearance) + 0.5rem) 0 3rem;
  display: grid;
  grid-template-columns: minmax(0, 1fr) 238px;
  gap: 7px;
}
.glyph-lab-head,
.glyph-lab-visual,
.glyph-lab-controls {
  border: 1px solid var(--laboratory);
  background: rgba(var(--surface-rgb), 0.9);
  box-shadow: 0 16px 44px rgba(var(--shadow-rgb), 0.055);
  padding: var(--ui-frame-pad);
}
.glyph-lab-head {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(260px, 0.72fr);
  gap: var(--ui-frame-gap);
}
.glyph-lab-head > div,
.glyph-lab-head > p,
.glyph-lab-family-description,
.glyph-lab-control {
  border: 1px solid color-mix(in srgb, var(--laboratory) 68%, var(--border-soft));
  background:
    linear-gradient(90deg, var(--laboratory-soft) 0%, rgba(var(--surface-rgb), 0.76) 68%, rgba(var(--surface-rgb), 0.9) 100%);
  padding: 4px 6px;
}
.glyph-lab-head > div {
  display: grid;
  align-content: center;
  gap: 1px;
}
.glyph-lab-head span,
.glyph-lab-control legend,
.glyph-lab-control > span {
  color: var(--fg-muted);
  font-size: 0.62rem;
  letter-spacing: 0.09em;
  line-height: 1.15;
  text-transform: uppercase;
}
.glyph-lab-head h1 {
  color: var(--fg);
  font-size: 1rem;
  line-height: 1.15;
}
.glyph-lab-head p {
  color: var(--fg-soft);
  font-size: 0.7rem;
  line-height: 1.3;
}
.glyph-lab-visual {
  min-width: 0;
  display: grid;
  gap: var(--ui-frame-gap);
}
.glyph-lab-canvas-wrap {
  border: 1px solid color-mix(in srgb, var(--laboratory) 72%, var(--border-soft));
  background:
    linear-gradient(0deg, rgba(var(--surface-rgb), 0.76), rgba(var(--surface-rgb), 0.76)),
    radial-gradient(circle at 50% 44%, var(--laboratory-soft), transparent 62%);
  aspect-ratio: 1.36 / 1;
  min-height: 0;
  overflow: hidden;
  position: relative;
}
.glyph-lab-canvas-wrap canvas {
  display: block;
  height: 100%;
  width: 100%;
}
.glyph-lab-labels {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-template-rows: repeat(2, minmax(0, 1fr));
  pointer-events: none;
}
.glyph-lab-labels span {
  align-self: end;
  justify-self: start;
  border: 1px solid color-mix(in srgb, var(--laboratory) 58%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.8);
  color: var(--fg-soft);
  font-size: 0.59rem;
  letter-spacing: 0.1em;
  margin: 5px;
  padding: 2px 5px;
  text-transform: uppercase;
}
.glyph-lab-family-description {
  display: grid;
  grid-template-columns: 112px minmax(0, 1fr);
  gap: 8px;
}
.glyph-lab-family-description strong {
  color: var(--fg);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.glyph-lab-family-description span {
  color: var(--fg-soft);
  font-size: 0.68rem;
  line-height: 1.25;
}
.glyph-lab-controls {
  align-content: start;
  display: grid;
  gap: var(--ui-frame-gap);
}
.glyph-lab-control {
  min-width: 0;
  display: grid;
  gap: 4px;
  margin: 0;
}
.glyph-lab-control > span {
  display: flex;
  justify-content: space-between;
  gap: 6px;
}
.glyph-lab-control output {
  color: var(--fg);
  font-size: 0.62rem;
  letter-spacing: 0;
}
.is-evolution-mode [data-lab-growth-control] {
  opacity: 0.46;
}
.glyph-lab-control input[type="range"] {
  accent-color: var(--laboratory);
  cursor: pointer;
  height: 16px;
  width: 100%;
}
.glyph-lab-control select {
  width: 100%;
  min-height: var(--ui-control-height);
  border: 1px solid color-mix(in srgb, var(--laboratory) 58%, var(--border-soft));
  background-color: rgba(var(--surface-rgb), 0.9);
  color: var(--fg);
  font-size: 0.7rem;
  padding: 2px 20px 2px 5px;
}
.glyph-lab-mode {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.glyph-lab-mode legend,
.glyph-lab-family-picker legend,
.glyph-lab-colors legend {
  grid-column: 1 / -1;
}
.glyph-lab-mode label {
  cursor: pointer;
  display: grid;
}
.glyph-lab-mode input {
  position: absolute;
  opacity: 0;
}
.glyph-lab-mode label span,
.glyph-lab-family-picker button {
  border: 1px solid color-mix(in srgb, var(--laboratory) 58%, var(--border-soft));
  background: rgba(var(--surface-rgb), 0.84);
  color: var(--fg-soft);
  cursor: pointer;
  font-size: 0.62rem;
  letter-spacing: 0.06em;
  line-height: 1.2;
  padding: 3px 4px;
  text-align: center;
  text-transform: uppercase;
}
.glyph-lab-mode input:checked + span,
.glyph-lab-family-picker button.active,
.glyph-lab-family-picker button:hover {
  border-color: var(--laboratory);
  background: var(--laboratory-grad);
  color: var(--fg);
}
.glyph-lab-family-picker {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
.glyph-lab-family-picker button {
  width: 100%;
}
.glyph-lab-colors .color-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 3px;
}
.glyph-lab-colors .color-grid span {
  height: 20px;
  min-width: 0;
  width: 100%;
}
.glyph-webgl-unavailable {
  background:
    repeating-linear-gradient(135deg, var(--laboratory-soft) 0 6px, transparent 6px 12px);
}

@media (max-width: 880px) {
  #glyph-laboratory {
    grid-template-columns: minmax(0, 1fr);
  }
  .glyph-lab-head {
    grid-template-columns: minmax(0, 1fr);
  }
}

@media (max-width: 620px) {
  .glyph-lab-canvas-wrap {
    aspect-ratio: 1 / 1.18;
  }
  .glyph-lab-family-description {
    grid-template-columns: minmax(0, 1fr);
    gap: 2px;
  }
}

/* ── Page about : compteurs ── */
.about-counters {
  margin-top: 0;
}
.about-counters dl {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(112px, 1fr));
  gap: 4px;
  margin: 0;
}
.about-counters div {
  border: 1px solid var(--public);
  padding: 4px 6px;
  background: rgba(var(--surface-rgb), 0.62);
  display: flex;
  flex-direction: column;
  gap: 0;
}
.about-counters dt {
  font-size: 1.16rem;
  font-weight: 600;
  font-family: 'AdvercaseFont', Helvetica, Arial, sans-serif;
  letter-spacing: 0.02em;
  color: var(--fg);
}
.about-counters dd {
  font-size: 0.56rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--fg-soft);
  margin: 0;
}

/* ============================================================
   FINITION TÉLÉPHONE — comble les derniers trous sous 620px / 430px.
   La base responsive (nav replié, atlas, about…) est définie plus haut ;
   ici on resserre les grilles encore trop larges sur petit écran.
   ============================================================ */
@media (max-width: 620px) {
  /* Garde-fou : jamais de défilement horizontal ni de média débordant. */
  html, body { overflow-x: hidden; }
  img, video, canvas, svg, iframe { max-width: 100%; }

  /* Atlas / Librairie : une seule colonne, plus de rail latéral étriqué. */
  .index-page-layout,
  #refs-index {
    grid-template-columns: minmax(0, 1fr);
  }

  /* Sidebar Librairie : filtres dans le flux, pas une zone scrollable minuscule. */
  .library-sidebar {
    position: static;
    max-height: none;
    overflow: visible;
  }

  /* Cartes de références : 2 par ligne au lieu de 3. */
  #refs-index .refs-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  /* Cibles tactiles un peu plus généreuses dans le menu. */
  .nav-links li a {
    padding: 6px 6px;
  }
}

@media (max-width: 430px) {
  /* Très petits écrans : une carte de référence par ligne. */
  #refs-index .refs-grid {
    grid-template-columns: minmax(0, 1fr);
  }
}
