/* ==========================================================================
   Documentation (views/documentation.ejs), préfixe dc-
   --------------------------------------------------------------------------
   Page vitrine : héros à halo, une teinte par rubrique (les mêmes que les
   espaces du tableau de bord, variables --t de main.css via [data-teinte]),
   fiches lisibles (étapes numérotées, cases cochées, encadré d'astuces).
   Boutons, champs et focus restent cobalt.

   Mouvement : entrée du héros une seule fois, ouverture d'une fiche en
   fondu court ; transform/opacity seulement, <300 ms, survols derrière
   (hover: hover). Rien ne bouge avec prefers-reduced-motion.
   ========================================================================== */

.dc-page { max-width: 1180px; }

/* --- Héros ----------------------------------------------------------------- */
.dc-hero {
  position: relative; isolation: isolate; text-align: center;
  padding: clamp(1.5rem, 5vw, 3.25rem) 0 2.25rem;
}
.dc-hero::before {
  /* Halo dans la largeur de la page : il ne doit jamais créer de défilement horizontal. */
  content: ""; position: absolute; inset: -12% 0 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(36% 52% at 28% 30%, rgba(47, 107, 255, 0.22), transparent 70%),
    radial-gradient(30% 46% at 72% 24%, rgba(139, 92, 246, 0.17), transparent 70%),
    radial-gradient(28% 40% at 54% 78%, rgba(16, 185, 129, 0.10), transparent 70%);
  filter: blur(8px);
}
.dc-etiquette {
  display: inline-flex; align-items: center; gap: 0.45rem;
  padding: 0.3rem 0.85rem; margin-bottom: 1.2rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent-text); background: var(--accent-soft); border: 1px solid rgba(47, 107, 255, 0.28);
}
.dc-titre {
  margin: 0 auto 1rem; max-width: 18ch;
  font-size: clamp(2.1rem, 5vw, 3.4rem); line-height: 1.04; letter-spacing: -0.04em; font-weight: 800;
}
.dc-degrade {
  background: linear-gradient(100deg, #8fb0ff 0%, #c4b5fd 50%, #6ee7b7 100%);
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.dc-sous-titre { max-width: 60ch; margin: 0 auto; font-size: 1.04rem; line-height: 1.65; color: var(--text-muted); }

.dc-recherche {
  display: flex; align-items: center; gap: 0.75rem;
  max-width: 640px; margin: 1.9rem auto 0; padding: 0 0.75rem 0 1.1rem; height: 56px;
  background: var(--bg-card); border: 1px solid var(--border-strong); border-radius: 16px;
  box-shadow: var(--shadow-pop); color: var(--text-dim); cursor: text;
  transition: border-color 150ms var(--ease-out), box-shadow 150ms var(--ease-out);
}
.dc-recherche:focus-within { border-color: var(--border-active); box-shadow: var(--shadow-pop), 0 0 0 4px rgba(47, 107, 255, 0.14); color: var(--accent-text); }
.dc-recherche input {
  flex: 1; min-width: 0; height: 100%; padding: 0; border: 0; outline: 0; background: transparent;
  font-size: 1rem; color: var(--text);
}
.dc-recherche input::-webkit-search-cancel-button { display: none; }
.dc-kbd {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 6px;
  font-family: var(--font-mono); font-size: 0.8rem; color: var(--text-muted);
  background: var(--bg-surface); border: 1px solid var(--border-strong); border-bottom-width: 2px; border-radius: 7px;
}
.dc-resultats { min-height: 1.3rem; margin: 0.7rem 0 0; font-size: 0.88rem; color: var(--accent-text); }

.dc-chiffres {
  list-style: none; padding: 0; margin: 0.8rem 0 0;
  display: flex; justify-content: center; flex-wrap: wrap; gap: 0.6rem;
}
.dc-chiffres li {
  padding: 0.4rem 0.9rem; border-radius: 999px; font-size: 0.86rem; color: var(--text-muted);
  background: rgba(255, 255, 255, 0.03); border: 1px solid var(--border);
}
.dc-chiffres strong { font-family: var(--font-mono); color: var(--text); margin-right: 0.15rem; }

/* --- Blocs de la page -------------------------------------------------------- */
.dc-bloc-page { margin-top: 2.6rem; }
.dc-h2 {
  margin: 0 0 1rem; font-size: 0.78rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim);
}

/* Bien démarrer : trois étapes reliées */
.dc-etapes {
  list-style: none; padding: 0; margin: 0;
  display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0.9rem;
  counter-reset: none;
}
.dc-etape {
  position: relative; display: flex; flex-direction: column; gap: 0.45rem;
  padding: 1.2rem 1.2rem 1.1rem; border-radius: var(--radius);
  background: linear-gradient(180deg, rgba(47, 107, 255, 0.07), transparent 60%), var(--bg-card);
  border: 1px solid var(--border);
}
.dc-etape-num {
  display: grid; place-items: center; width: 30px; height: 30px; border-radius: 9px;
  font-family: var(--font-mono); font-weight: 700; font-size: 0.9rem;
  color: #fff; background: var(--blue); box-shadow: 0 6px 16px -6px rgba(47, 107, 255, 0.7);
}
.dc-etape h3 { margin: 0.35rem 0 0; font-size: 1rem; font-weight: 650; }
.dc-etape p { margin: 0; flex: 1; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }
.dc-lien {
  display: inline-flex; align-items: center; gap: 0.4rem; margin-top: 0.35rem;
  font-size: 0.88rem; font-weight: 600; color: var(--accent-text); text-decoration: none;
}
.dc-lien:hover { color: var(--text); }

/* Rubriques : une carte teintée par rubrique */
.dc-rubriques { display: grid; grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); gap: 0.8rem; }
.dc-rubrique {
  display: flex; flex-direction: column; gap: 0.4rem;
  padding: 1rem 1.05rem 0.9rem; border-radius: var(--radius); text-decoration: none; color: var(--text);
  background: linear-gradient(180deg, var(--t-doux), transparent 70%), var(--bg-card);
  border: 1px solid var(--border);
  transition: border-color 150ms var(--ease-out), transform 150ms var(--ease-out);
}
.dc-rubrique:hover { color: var(--text); }
.dc-rubrique:active { transform: scale(0.98); }
.dc-rubrique-icone {
  display: grid; place-items: center; width: 36px; height: 36px; margin-bottom: 0.25rem; border-radius: 10px;
  color: var(--t-texte); background: var(--t-doux); border: 1px solid color-mix(in srgb, var(--t) 35%, transparent);
}
.dc-rubrique-nom { font-family: var(--font-heading); font-weight: 650; font-size: 0.98rem; }
.dc-rubrique-texte { flex: 1; font-size: 0.85rem; line-height: 1.5; color: var(--text-muted); }
.dc-rubrique-pied { margin-top: 0.3rem; font-size: 0.8rem; font-weight: 600; color: var(--t-texte); }
.dc-rubrique-pied span { display: inline-block; transition: transform 150ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .dc-rubrique:hover { border-color: color-mix(in srgb, var(--t) 45%, transparent); transform: translateY(-2px); }
  .dc-rubrique:hover .dc-rubrique-pied span { transform: translateX(3px); }
}

/* --- Corps : sommaire collant + contenu ------------------------------------- */
.dc-corps { display: grid; grid-template-columns: 210px minmax(0, 1fr); gap: 2rem; margin-top: 3rem; align-items: start; }
.dc-sommaire {
  position: sticky; top: 76px; max-height: calc(100vh - 96px); overflow-y: auto;
  display: flex; flex-direction: column; gap: 2px; padding-right: 0.25rem;
}
.dc-sommaire-titre { margin: 0 0 0.6rem 0.6rem; font-size: 0.72rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--text-dim); }
.dc-sommaire a {
  display: flex; align-items: center; gap: 0.55rem; padding: 0.42rem 0.6rem; border-radius: 8px;
  font-size: 0.86rem; color: var(--text-muted); text-decoration: none;
  transition: background-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.dc-sommaire a:hover { color: var(--text); background: rgba(255, 255, 255, 0.03); }
.dc-sommaire a.is-active { color: var(--text); background: var(--t-doux); box-shadow: inset 2px 0 0 var(--t); }
.dc-sommaire a.is-masque { display: none; }
.dc-point { flex-shrink: 0; width: 7px; height: 7px; border-radius: 50%; background: var(--t); opacity: 0.85; }

/* Rubrique */
.dc-section { scroll-margin-top: 80px; margin-bottom: 2.6rem; }
.dc-section-tete {
  display: flex; align-items: center; gap: 0.9rem; margin-bottom: 1rem; padding-bottom: 0.9rem;
  border-bottom: 1px solid var(--border);
}
.dc-section-icone {
  flex-shrink: 0; display: grid; place-items: center; width: 44px; height: 44px; border-radius: 12px;
  color: var(--t-texte); background: var(--t-doux); border: 1px solid color-mix(in srgb, var(--t) 35%, transparent);
}
.dc-section-textes { flex: 1; min-width: 0; }
.dc-section-textes h2 { margin: 0; font-size: 1.3rem; letter-spacing: -0.02em; }
.dc-section-textes p { margin: 0.2rem 0 0; font-size: 0.9rem; color: var(--text-muted); }
.dc-section-compte {
  flex-shrink: 0; padding: 0.25rem 0.65rem; border-radius: 999px; font-size: 0.78rem; font-weight: 600;
  color: var(--t-texte); background: var(--t-doux);
}

/* Fiches */
.dc-fiches { display: flex; flex-direction: column; gap: 0.6rem; }
.dc-fiche {
  scroll-margin-top: 80px;
  background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 150ms var(--ease-out);
}
.dc-fiche[open] { border-color: color-mix(in srgb, var(--t) 40%, transparent); box-shadow: var(--shadow-card); }
.dc-fiche.is-cible { border-color: var(--t); }
.dc-fiche summary {
  display: flex; align-items: center; gap: 0.85rem; padding: 0.9rem 1rem; cursor: pointer; list-style: none;
  border-radius: var(--radius);
}
.dc-fiche summary::-webkit-details-marker { display: none; }
.dc-fiche summary:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; }
@media (hover: hover) and (pointer: fine) {
  .dc-fiche:not([open]):hover { border-color: color-mix(in srgb, var(--t) 30%, transparent); }
  .dc-fiche:not([open]):hover .dc-fiche-icone { transform: scale(1.06); }
}
.dc-fiche-icone {
  flex-shrink: 0; display: grid; place-items: center; width: 38px; height: 38px; border-radius: 10px;
  color: var(--t-texte); background: var(--t-doux);
  transition: transform 150ms var(--ease-out);
}
.dc-fiche-tete { flex: 1; min-width: 0; }
.dc-fiche-titre { display: block; font-family: var(--font-heading); font-weight: 650; color: var(--text); }
.dc-fiche-resume {
  display: block; margin-top: 0.15rem; font-size: 0.86rem; color: var(--text-muted);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dc-fiche[open] .dc-fiche-resume { display: none; }
.dc-fiche-meta {
  flex-shrink: 0; padding: 0.2rem 0.55rem; border-radius: 6px; font-size: 0.74rem; font-weight: 600;
  color: var(--text-dim); background: rgba(255, 255, 255, 0.04);
}
.dc-fiche-fleche { flex-shrink: 0; color: var(--text-dim); transition: transform 200ms var(--ease-out); }
.dc-fiche[open] .dc-fiche-fleche { transform: rotate(180deg); color: var(--t-texte); }

.dc-fiche-corps { padding: 0.2rem 1.1rem 1.1rem 4.05rem; }
.dc-fiche[open] .dc-fiche-corps { animation: dc-ouverture 200ms var(--ease-out); }
@keyframes dc-ouverture { from { opacity: 0; transform: translateY(-4px); } }
.dc-chapo { margin: 0 0 1.1rem; font-size: 1rem; line-height: 1.6; color: var(--text); }

.dc-grille { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.dc-grille > :only-child { grid-column: 1 / -1; }
.dc-bloc { padding: 1rem 1.05rem; border-radius: var(--radius-sm); background: var(--bg-surface); border: 1px solid var(--border); }
.dc-bloc h3, .dc-astuce h3 {
  display: flex; align-items: center; gap: 0.45rem; margin: 0 0 0.8rem;
  font-size: 0.78rem; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; color: var(--t-texte);
}

.dc-pas { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.7rem; }
.dc-pas li { position: relative; display: flex; gap: 0.7rem; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }
.dc-pas li:not(:last-child)::before {
  content: ""; position: absolute; left: 11px; top: 26px; bottom: -10px; width: 1px;
  background: color-mix(in srgb, var(--t) 35%, transparent);
}
.dc-pas-num {
  flex-shrink: 0; display: grid; place-items: center; width: 23px; height: 23px; border-radius: 50%;
  font-family: var(--font-mono); font-size: 0.74rem; font-weight: 700;
  color: var(--t-texte); background: var(--t-doux); border: 1px solid color-mix(in srgb, var(--t) 45%, transparent);
}

.dc-coches { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.dc-coches li { display: flex; gap: 0.6rem; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }
.dc-coches li svg { flex-shrink: 0; margin-top: 3px; color: var(--success); }

.dc-astuce {
  margin-top: 1rem; padding: 0.95rem 1.05rem; border-radius: var(--radius-sm);
  background: rgba(245, 181, 68, 0.07); border: 1px solid rgba(245, 181, 68, 0.22);
}
.dc-astuce h3 { color: #fcd58b; }
.dc-astuce ul { margin: 0; padding-left: 1.1rem; display: flex; flex-direction: column; gap: 0.4rem; font-size: 0.9rem; line-height: 1.55; color: var(--text-muted); }

/* Code et commandes dans le texte */
.dc-fiche code {
  padding: 0.08rem 0.38rem; border-radius: 5px; font-family: var(--font-mono); font-size: 0.84em;
  color: var(--text); background: rgba(255, 255, 255, 0.06); border: 1px solid var(--border);
}
.dc-fiche code.dc-cmd { color: var(--accent-text); background: var(--accent-soft); border-color: rgba(47, 107, 255, 0.25); }

/* Rubrique des commandes : une ligne par commande */
.dc-commandes { display: flex; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-sm); overflow: hidden; }
.dc-commande { display: grid; grid-template-columns: minmax(150px, max-content) 1fr; gap: 0.9rem; align-items: baseline; padding: 0.6rem 0.9rem; font-size: 0.9rem; color: var(--text-muted); }
.dc-commande:nth-child(odd) { background: var(--bg-surface); }
.dc-commande code { justify-self: start; white-space: nowrap; }

.dc-fiche-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1.1rem; }
.dc-copier.is-fait { color: var(--success); border-color: rgba(63, 191, 135, 0.4); }

/* Recherche sans résultat */
.dc-vide {
  display: flex; flex-direction: column; align-items: center; gap: 0.5rem; padding: 2.5rem 1rem; text-align: center;
  color: var(--text-dim); border: 1px dashed var(--border-strong); border-radius: var(--radius);
}
.dc-vide[hidden] { display: none; }
.dc-vide p { margin: 0; color: var(--text-muted); }

/* Recherche active : l'introduction s'efface, les résultats remontent */
.dc-page.is-recherche #docsIntro { display: none; }
.dc-page.is-recherche .dc-corps { margin-top: 1.5rem; }
mark.dc-trouve { padding: 0 1px; border-radius: 3px; color: var(--text); background: rgba(47, 107, 255, 0.35); }

/* Appel final */
.dc-fin {
  display: flex; align-items: center; justify-content: space-between; gap: 1.5rem; flex-wrap: wrap;
  margin-top: 1rem; padding: 1.5rem 1.6rem; border-radius: var(--radius);
  background: linear-gradient(110deg, rgba(47, 107, 255, 0.16), rgba(139, 92, 246, 0.10) 60%, rgba(16, 185, 129, 0.08)), var(--bg-card);
  border: 1px solid rgba(47, 107, 255, 0.25);
}
.dc-fin h2 { margin: 0 0 0.3rem; font-size: 1.15rem; }
.dc-fin p { margin: 0; color: var(--text-muted); font-size: 0.92rem; }
.dc-fin-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; }

/* --- Entrée du héros, une seule fois --------------------------------------- */
@media (prefers-reduced-motion: no-preference) {
  .dc-hero > * { animation: dc-entree 420ms var(--ease-out) both; }
  .dc-hero > :nth-child(2) { animation-delay: 40ms; }
  .dc-hero > :nth-child(3) { animation-delay: 80ms; }
  .dc-hero > :nth-child(4) { animation-delay: 120ms; }
  .dc-hero > :nth-child(n+5) { animation-delay: 160ms; }
}
@keyframes dc-entree { from { opacity: 0; transform: translateY(8px); } }
@media (prefers-reduced-motion: reduce) {
  .dc-fiche[open] .dc-fiche-corps { animation: none; }
  .dc-rubrique, .dc-rubrique-pied span, .dc-fiche-icone, .dc-fiche-fleche { transition: none; }
}

/* --- Écrans moyens et petits ------------------------------------------------- */
@media (max-width: 1100px) {
  .dc-corps { grid-template-columns: minmax(0, 1fr); gap: 0; }
  .dc-sommaire { display: none; }
}
@media (max-width: 820px) {
  .dc-etapes { grid-template-columns: minmax(0, 1fr); }
  .dc-grille { grid-template-columns: minmax(0, 1fr); }
  .dc-fiche-corps { padding: 0.2rem 1rem 1rem; }
}
@media (max-width: 560px) {
  .dc-rubriques { grid-template-columns: minmax(0, 1fr); }
  .dc-kbd, .dc-fiche-meta { display: none; }
  .dc-recherche { height: 52px; }
  .dc-section-tete { flex-wrap: wrap; }
  .dc-section-compte { display: none; }
  .dc-commande { grid-template-columns: minmax(0, 1fr); gap: 0.25rem; }
  .dc-fin { padding: 1.25rem; }
}

/* Page d'une fiche (/documentation/<clé>) : la fiche dépliée, en pleine page. */
.dc-ariane { display: flex; flex-wrap: wrap; align-items: center; gap: 0.4rem; margin: 0.4rem 0 1.2rem; font-size: 0.86rem; color: var(--text-dim); }
.dc-ariane a { color: var(--text-muted); text-decoration: none; }
.dc-ariane a:hover { color: var(--text); }
.dc-fiche-page { padding: 1.4rem 1.5rem; border-radius: 20px; background: var(--bg-card); border: 1px solid var(--border); border-top: 3px solid var(--t, var(--blue)); }
.dc-fiche-page h1 { margin: 0; font-size: clamp(1.5rem, 3vw, 2rem); letter-spacing: -0.02em; }
.dc-fiche-page .dc-section-textes p { margin: 0.2rem 0 0; color: var(--text-muted); }
.dc-fiche-page .dc-fiche-corps { padding: 0; }
.dc-fiche-page .dc-fiche-actions { margin-top: 1.4rem; }
