/* ==========================================================================
   Aeris SMP, wiki
   Même base sombre et même ambre que le reste du site. Ce qui est propre à
   cette page : la ligne de commande, coloriée par syntaxe et copiable, parce
   que c'est le seul geste que le lecteur vient faire ici.
   Les couleurs de base viennent de style.css, chargé avant celui-ci.
   ========================================================================== */

html { scroll-behavior: smooth; }

:root {
  --mono: 'JetBrains Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;
  /* Bleu sourd : sert uniquement à marquer ce qui est facultatif dans une
     commande. Désaturé exprès, pour que l'ambre reste la seule couleur forte. */
  --optional: #86adcd;
  --bg-raised: #272727;
}

/* --- En-tête du site : navigation à plusieurs liens -------------------- */
.site-nav { display: flex; align-items: center; gap: 22px; }

.nav-link.is-current { color: var(--text); }

/* --- Tête de page ------------------------------------------------------- */
/* Une bande de la capture, assez haute pour rattacher la page au site,
   assez basse pour que la recherche reste visible sans défiler. */
.wiki-head {
  padding: 54px 0 46px;
  background-image:
    linear-gradient(to right, rgba(12, 12, 12, 0.93) 0%, rgba(12, 12, 12, 0.78) 60%, rgba(12, 12, 12, 0.6) 100%),
    url('/img/hero-bg.jpg');
  background-color: #151515;
  background-size: cover;
  background-position: center 35%;
}

.wiki-head h1 {
  font-size: clamp(2rem, 5vw, 3rem);
  text-transform: uppercase;
  letter-spacing: -0.01em;
  color: #fff;
  margin-bottom: 0.35em;
}

.wiki-head .lead {
  max-width: 60ch;
  margin-bottom: 26px;
  color: #d4d4d4;
  font-size: 1.05rem;
}

/* --- Recherche ---------------------------------------------------------- */
.search {
  position: relative;
  max-width: 520px;
}

.search input {
  width: 100%;
  padding: 14px 88px 14px 44px;
  background: rgba(20, 20, 20, 0.92);
  border: 1px solid #4a4a4a;
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--font);
  font-size: 0.97rem;
}

.search input::placeholder { color: #8a8a8a; }
.search input:focus { outline: none; border-color: var(--accent); }

.search-icon {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 16px;
  height: 16px;
  color: #8a8a8a;
  pointer-events: none;
}

.search-hint {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  padding: 3px 8px;
  border: 1px solid #454545;
  border-radius: var(--radius);
  color: #8a8a8a;
  font-family: var(--mono);
  font-size: 0.72rem;
  pointer-events: none;
}

.search input:not(:placeholder-shown) ~ .search-hint { display: none; }

/* Raccourcis vers les quatre gestes les plus demandés. */
.quick-links {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin: 22px 0 0;
  padding: 0;
  list-style: none;
}

.quick-links a {
  display: inline-block;
  padding: 7px 13px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid #4a4a4a;
  border-radius: var(--radius);
  color: #dcdcdc;
  font-size: 0.87rem;
  font-weight: 600;
}

.quick-links a:hover {
  background: rgba(232, 163, 59, 0.14);
  border-color: var(--accent);
  color: #fff;
  text-decoration: none;
}

/* --- Charpente : sommaire + document ----------------------------------- */
.wiki-shell {
  display: grid;
  grid-template-columns: 236px minmax(0, 1fr);
  gap: 56px;
  padding: 44px 0 80px;
  align-items: start;
}

/* --- Sommaire ---------------------------------------------------------- */
.toc { position: sticky; top: 26px; }

.toc-scroll {
  max-height: calc(100vh - 60px);
  overflow-y: auto;
  padding-right: 10px;
  /* Le sommaire garde son défilement pour lui : arrivé en bout de course,
     la molette ne doit pas repartir sur la page. */
  overscroll-behavior: contain;
  scrollbar-width: thin;
  scrollbar-color: #3d3d3d transparent;
}

/* Barre de défilement du sommaire : une ligne fine, sans flèches ni caisson,
   qui s'éclaire quand on la prend. Webkit et Blink ; Firefox est servi par
   les deux propriétés standard ci-dessus. */
.toc-scroll::-webkit-scrollbar { width: 6px; }

/* Pas de flèches en haut et en bas : la barre est une ligne, pas un widget. */
.toc-scroll::-webkit-scrollbar-button { display: none; height: 0; width: 0; }

.toc-scroll::-webkit-scrollbar-track { background: transparent; }

.toc-scroll::-webkit-scrollbar-thumb {
  background: #3d3d3d;
  border-radius: 3px;
}

.toc-scroll::-webkit-scrollbar-thumb:hover { background: #565656; }
.toc-scroll::-webkit-scrollbar-thumb:active { background: var(--accent); }

.toc-group { margin-bottom: 22px; }

.toc-group > h2 {
  margin: 0 0 8px;
  padding-bottom: 7px;
  border-bottom: 1px solid var(--border);
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--text-dim);
}

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

.toc a {
  display: block;
  padding: 5px 10px;
  border-left: 2px solid transparent;
  color: var(--text-dim);
  font-size: 0.91rem;
  line-height: 1.45;
}

.toc a:hover { color: var(--text); text-decoration: none; }

.toc a.is-active {
  border-left-color: var(--accent);
  background: rgba(232, 163, 59, 0.08);
  color: var(--text);
  font-weight: 600;
}

.toc-sub a { padding-left: 22px; font-size: 0.87rem; }

.toc-toggle { display: none; }

/* --- Document ---------------------------------------------------------- */
.wiki-doc { min-width: 0; max-width: 78ch; }

.wiki-doc > section { padding-bottom: 8px; margin-bottom: 52px; }
.wiki-doc > section:last-child { margin-bottom: 0; }

.wiki-doc h2 {
  margin: 0 0 6px;
  font-size: 1.62rem;
  scroll-margin-top: 24px;
}

.wiki-doc h3 {
  margin: 38px 0 10px;
  font-size: 1.1rem;
  font-weight: 700;
  scroll-margin-top: 24px;
}

.wiki-doc h4 {
  margin: 26px 0 8px;
  font-size: 0.97rem;
  font-weight: 700;
  color: var(--text);
}

.wiki-doc .intro {
  margin-bottom: 30px;
  color: var(--text-dim);
  font-size: 1.02rem;
}

.wiki-doc p { max-width: 72ch; }
.wiki-doc ul, .wiki-doc ol { max-width: 72ch; padding-left: 22px; }
.wiki-doc li { margin-bottom: 6px; }

/* Lien d'ancre discret, révélé au survol du titre. */
.anchor {
  margin-left: 10px;
  color: var(--border);
  font-weight: 400;
  opacity: 0;
  transition: opacity 0.12s ease;
}

h2:hover .anchor, h3:hover .anchor, .anchor:focus-visible { opacity: 1; }
.anchor:hover { color: var(--accent); text-decoration: none; }

/* --- Les commandes ----------------------------------------------------- */
/* Une liste séparée par des filets, pas une pile de cartes : c'est un
   tableau de référence qu'on parcourt de haut en bas. */
.cmd-list {
  margin: 18px 0 26px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  overflow: hidden;
}

.cmd {
  padding: 13px 16px;
  border-top: 1px solid var(--border);
}

.cmd:first-child { border-top: none; }

.cmd-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
}

.cmd-line {
  flex: 1 1 auto;
  min-width: 0;
  /* Annule le fond de pastille de `code` : ici la ligne EST le bloc. */
  background: none;
  padding: 0;
  font-family: var(--mono);
  font-size: 0.88rem;
  line-height: 1.55;
  word-break: break-word;
  color: var(--text);
}

.tok-cmd { color: #fff; font-weight: 700; }
.tok-sub { color: var(--text); }
.tok-req { color: var(--accent); }
.tok-opt { color: var(--optional); }

.cmd-copy {
  flex: none;
  padding: 4px 10px;
  background: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text-dim);
  font-family: var(--font);
  font-size: 0.76rem;
  font-weight: 600;
  cursor: pointer;
  transition: color 0.12s ease, border-color 0.12s ease;
}

.cmd-copy:hover { color: var(--text); border-color: #4e4e4e; }
.cmd-copy.is-done { color: var(--green); border-color: #3c5a40; }

.cmd-desc {
  max-width: 66ch;
  margin: 5px 0 0;
  color: var(--text-dim);
  font-size: 0.9rem;
}

.cmd-tags { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: var(--radius);
  font-size: 0.72rem;
  font-weight: 600;
  white-space: nowrap;
}

.tag-lead { background: #3d2f1a; color: var(--accent); }
.tag-regime { background: #2d3540; color: var(--optional); }
.tag-staff { background: #3a2a2a; color: var(--danger); }

/* --- Encadrés ---------------------------------------------------------- */
.note, .warn {
  margin: 22px 0;
  padding: 14px 18px;
  border-left: 3px solid var(--accent);
  border-radius: 0 var(--radius) var(--radius) 0;
  background: var(--bg-raised);
  font-size: 0.94rem;
}

.warn { border-left-color: var(--danger); }

.note > :last-child, .warn > :last-child { margin-bottom: 0; }
.note strong, .warn strong { color: #fff; }

/* --- Tableaux ---------------------------------------------------------- */
.wiki-doc .table-wrap { margin: 20px 0 26px; }

.wiki-doc table { font-size: 0.89rem; }
.wiki-doc thead th { white-space: normal; }
.wiki-doc tbody td { vertical-align: top; }
.wiki-doc tbody td code { white-space: nowrap; }

/* Matrice des régimes : la première colonne reste lisible au défilement. */
.matrix tbody td:first-child { color: var(--text); font-weight: 600; }
.matrix tbody td:not(:first-child) { color: var(--text-dim); }

/* --- Pas à pas -------------------------------------------------------- */
.wiki-doc .steps { margin: 20px 0 26px; }
.wiki-doc .steps li { margin-bottom: 0; }
.wiki-doc .steps .cmd-list { margin: 12px 0 0; background: var(--bg-input); }

/* --- Aide-mémoire ----------------------------------------------------- */
.recap-block { margin-bottom: 34px; }

.recap-block h3 { margin-top: 0; }

.recap table { font-family: var(--mono); font-size: 0.84rem; }
.recap tbody td:first-child { white-space: nowrap; }
.recap tbody td:last-child { font-family: var(--font); color: var(--text-dim); }

/* --- Questions fréquentes --------------------------------------------- */
.faq { margin: 20px 0 0; border-top: 1px solid var(--border); }

.faq details {
  border-bottom: 1px solid var(--border);
}

.faq summary {
  padding: 14px 30px 14px 0;
  position: relative;
  cursor: pointer;
  font-weight: 600;
  list-style: none;
}

.faq summary::-webkit-details-marker { display: none; }

.faq summary::after {
  content: '+';
  position: absolute;
  right: 6px;
  top: 12px;
  color: var(--accent);
  font-size: 1.15rem;
  font-weight: 400;
  line-height: 1.3;
}

.faq details[open] summary::after { content: '\2212'; }
.faq summary:hover { color: #fff; }

.faq-body { padding: 0 30px 16px 0; color: var(--text-dim); font-size: 0.94rem; }
.faq-body > :last-child { margin-bottom: 0; }

/* --- Résultats de recherche ------------------------------------------- */
.results { padding: 4px 0 40px; }

.results-count { margin-bottom: 20px; color: var(--text-dim); font-size: 0.92rem; }

.result {
  display: block;
  padding: 13px 16px;
  margin-bottom: 8px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--bg-panel);
  color: var(--text);
}

.result:hover { border-color: var(--accent); text-decoration: none; }

.result-where { display: block; margin-bottom: 3px; color: var(--text-dim); font-size: 0.78rem; }

.result-title { display: block; font-weight: 600; }

.result-title.is-cmd { font-family: var(--mono); font-size: 0.88rem; font-weight: 400; }

.result-desc { display: block; margin-top: 4px; color: var(--text-dim); font-size: 0.88rem; }

.result mark { background: rgba(232, 163, 59, 0.28); color: #fff; border-radius: 2px; }

/* --- Responsive -------------------------------------------------------- */
@media (max-width: 900px) {
  .wiki-shell { grid-template-columns: minmax(0, 1fr); gap: 0; padding-top: 24px; }

  .toc {
    position: static;
    margin-bottom: 32px;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--bg-panel);
  }

  .toc-toggle {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 14px 16px;
    background: none;
    border: none;
    color: var(--text);
    font-family: var(--font);
    font-size: 0.95rem;
    font-weight: 700;
    cursor: pointer;
  }

  .toc-toggle::after { content: '\25BE'; color: var(--accent); }
  .toc-toggle[aria-expanded='true']::after { content: '\25B4'; }

  .toc-scroll { max-height: none; padding: 0 12px 14px; }

  .wiki-head { padding: 40px 0 34px; }
  .wiki-doc { max-width: none; }
  .wiki-doc > section { margin-bottom: 42px; }

  .cmd-head { flex-wrap: wrap; }
  .cmd-copy { order: 2; }
}

@media (prefers-reduced-motion: reduce) {
  .anchor, .cmd-copy { transition: none; }
  html { scroll-behavior: auto; }
}
