/* Carnet : la navigation de proche en proche.

   Chargé UNIQUEMENT par layouts/notes/list.html, jamais dans le CSS global.
   Les classes sont écrites à la main et non en utilities Tailwind : le JS en
   pose et en retire au clic, or Tailwind ne compile que ce qu'il TROUVE dans
   les templates au build — une classe née dans le JS n'aurait aucun style.

   Les valeurs viennent des tokens Lisière, jamais en dur. */

/* Le JS masque par `hidden`. Une carte est un flex item : sans ceci, une règle
   de display l'emporterait sur la feuille de l'agent et rien ne se cacherait. */
.carnet [hidden] { display: none !important; }

/* --- Barre d'outils ------------------------------------------------------ */
.carnet-outils {
  position: sticky;
  top: 0;
  z-index: 10;
  background: color-mix(in srgb, var(--papier-100) 88%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--gris-200);
  padding: 14px 0;
  margin-bottom: 24px;
}
.carnet-recherche {
  width: 100%;
  font: inherit;
  font-size: 15px;
  color: var(--encre-900);
  background: var(--papier-50);
  border: 1px solid var(--gris-300);
  border-radius: var(--radius-md, 8px);
  padding: 9px 12px;
}
.carnet-recherche::placeholder { color: var(--gris-500); }
.carnet-recherche:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
  border-color: transparent;
}

.carnet-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 11px; }
.carnet-chip {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  letter-spacing: .04em;
  color: var(--encre-800);
  background: var(--papier-50);
  border: 1px solid var(--gris-300);
  border-radius: 999px;
  padding: 4px 11px;
  cursor: pointer;
  transition: background .12s, border-color .12s, color .12s;
}
.carnet-chip:hover { border-color: var(--accent); color: var(--accent-ink); }
.carnet-chip[aria-pressed="true"] {
  background: var(--accent-fill);
  border-color: var(--accent);
  color: var(--accent-ink);
}

.carnet-etat {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12.5px;
  color: var(--gris-500);
  margin-top: 10px;
}

/* --- Fil d'Ariane : le chemin parcouru dans le graphe -------------------- */
.carnet-fil { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px; margin-top: 10px; }
/* Un titre de note peut faire 90 signes : sans troncature il passe à la ligne
   et se centre (un bouton centre son texte par défaut), ce qui fait perdre le
   fil au lieu de le montrer. Constaté au rendu sur « Accompagner celles et
   ceux qui accompagnent les organisations de l'économie sociale et solidaire ». */
.carnet-fil button {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12.5px;
  color: var(--accent-ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-align: left;
  text-decoration: underline;
  text-underline-offset: 2px;
  max-width: min(38ch, 100%);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}
.carnet-fil button:last-child { color: var(--gris-500); text-decoration: none; cursor: default; }
.carnet-fil .sep { color: var(--gris-400); font-size: 12px; }

/* --- Les cartes ---------------------------------------------------------- */
.carnet-note { transition: border-color .15s, box-shadow .15s; }
.carnet-note.est-foyer {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px var(--accent);
}

/* Le sens du lien est dit UNE fois, en tête de groupe, et non répété en badge
   sur chaque carte : « cette note la cite » et « cite cette note » se
   ressemblent trop pour se distinguer d'un coup d'œil (constaté au rendu). */
.carnet-groupe {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 11.5px;
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--gris-500);
  display: flex;
  align-items: center;
  gap: 11px;
  margin: 10px 0 0;
}
.carnet-groupe::after {
  content: "";
  flex: 1;
  height: 1px;
  background: var(--gris-200);
}

/* Les voisines : ce vers quoi on peut sauter. Un bouton, pas un lien — sauter
   dans le graphe ne quitte pas la page ; le permalien reste sur le titre. */
.carnet-voisines { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 14px; }
.carnet-saut {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  text-align: left;
  color: var(--encre-800);
  background: var(--papier-100);
  border: 1px solid var(--gris-300);
  border-radius: var(--radius-md, 8px);
  padding: 5px 10px;
  cursor: pointer;
  transition: border-color .12s, color .12s;
}
.carnet-saut:hover { border-color: var(--accent); color: var(--accent-ink); }
.carnet-saut .sens { color: var(--gris-500); }

.carnet-permalien { margin: 13px 0 0; }
.carnet-permalien a {
  font-family: var(--font-mono, ui-monospace, monospace);
  font-size: 12px;
  color: var(--accent-ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.carnet-vide {
  color: var(--encre-800);
  font-size: 16px;
  padding: 28px 0;
}
.carnet-vide button {
  color: var(--accent-ink);
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 2px;
  font: inherit;
}

@media (prefers-reduced-motion: reduce) {
  .carnet-note, .carnet-chip, .carnet-saut { transition: none; }
}
