/* ============================================================
   TOC — Barre horizontale fixe en haut
   ============================================================ */

#toc-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: 44px;
  background: #0a1724;
  border-bottom: 1px solid rgba(201,168,76,.2);
  display: flex;
  align-items: center;
  /* Isolation complète : crée un stacking context indépendant
     et passe au-dessus de tout transform/opacity parent */
  z-index: 999;      /* valeur max int32 — rien ne peut passer au-dessus */
  isolation: isolate;       /* contexte de stacking propre                      */
  will-change: transform;   /* force le navigateur à le sortir du flow normal   */
  box-shadow: 0 2px 16px rgba(0,0,0,.55);
  box-sizing: border-box;
  overflow: visible;
  user-select: none;
  -webkit-user-select: none;
}

/* ---- Scroll area horizontal ---- */
#toc-scroll-area {
  flex: 1;
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding: 0 4px 0 12px;
  height: 100%;
  cursor: grab;
}
#toc-scroll-area.is-dragging { cursor: grabbing; scroll-behavior: auto; }
#toc-scroll-area::-webkit-scrollbar { display: none; }

/* ---- Items horizontaux ---- */
.toc-h-item {
  display: flex;
  align-items: center;
  height: 44px;
  padding: 0 14px;
  white-space: nowrap;
  cursor: pointer;
  font-family: 'Cinzel', serif;
  font-size: 10px;
  font-weight: 400;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: rgba(255,255,255,.92);
  border-bottom: 2px solid transparent;
  transition: color .2s, border-color .2s, background .2s;
  text-decoration: none;
  flex-shrink: 0;
}
.toc-h-item:hover {
  color: #e8d5a0;
  background: rgba(201,168,76,.05);
}
.toc-h-item.is-reading {
  color: #c9a84c;
  border-bottom-color: #c9a84c;
  background: rgba(201,168,76,.08);
}

/* Séparateur vertical entre items */
.toc-h-sep {
  width: 1px;
  height: 18px;
  background: rgba(255,255,255,.07);
  flex-shrink: 0;
}

/* ---- Bouton d'expansion ---- */
#toc-expand-btn {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  border: none;
  background: transparent;
  border-left: 1px solid rgba(201,168,76,.15);
  color: rgba(201,168,76,.6);
  transition: color .2s, background .2s;
  outline: none;
}
#toc-expand-btn:hover {
  color: #c9a84c;
  background: rgba(201,168,76,.08);
}
#toc-expand-btn:focus-visible {
  outline: 1px solid #c9a84c;
  outline-offset: -2px;
}
#toc-expand-btn svg {
  transition: transform .25s cubic-bezier(.34,1.56,.64,1);
}
#toc-bar.is-expanded #toc-expand-btn svg {
  transform: rotate(180deg);
}

/* ---- Panneau vertical dépliable ---- */
#toc-v-panel {
  position: absolute;
  top: 44px;
  right: 0;
  width: min(300px, 100vw);
  background: #0a1724;
  border: 1px solid rgba(201,168,76,.22);
  border-top: none;
  border-radius: 0 0 0 14px;
  box-shadow: 0 12px 40px rgba(0,0,0,.6);
  overflow-y: auto;
  overflow-x: hidden;
  max-height: 0;
  opacity: 0;
  pointer-events: none;
  transition: max-height .32s cubic-bezier(.4,0,.2,1), opacity .22s;
}
#toc-bar.is-expanded #toc-v-panel {
  max-height: 520px;
  opacity: 1;
  pointer-events: auto;
}
#toc-v-panel::-webkit-scrollbar { width: 3px; }
#toc-v-panel::-webkit-scrollbar-track { background: transparent; }
#toc-v-panel::-webkit-scrollbar-thumb { background: rgba(201,168,76,.25); border-radius: 4px; }

/* ---- Liste verticale ---- */
.toc-v-list { list-style: none; margin: 0; padding: .4rem 0 .6rem; }
.toc-v-item { position: relative; }
.toc-v-item + .toc-v-item { border-top: 1px solid rgba(255,255,255,.04); }
.toc-v-item.is-reading::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 2px;
  background: #c9a84c;
  border-radius: 0 2px 2px 0;
}

.toc-v-link {
  display: flex;
  align-items: flex-start;
  gap: .55rem;
  padding: .42rem 1rem .42rem .9rem;
  color: rgba(255,255,255,.65);
  font-size: .75rem;
  font-family: 'Cinzel', serif;
  letter-spacing: .07em;
  text-decoration: none;
  cursor: pointer;
  line-height: 1.45;
  transition: color .15s, background .15s;
}
.toc-v-link:hover { color: #e8d5a0; background: rgba(201,168,76,.07); }
.toc-v-item.is-reading .toc-v-link { color: #c9a84c; background: rgba(201,168,76,.1); }

.toc-v-num {
  flex-shrink: 0;
  font-size: .66rem;
  font-weight: 700;
  color: #c9a84c;
  min-width: 26px;
  opacity: .75;
  padding-top: 1px;
}
.toc-v-text { flex: 1; text-align: left; }

/* Sous-liens */
.toc-v-sublist { list-style: none; margin: 0; padding: 0; }
.toc-v-sub-link {
  display: flex;
  align-items: baseline;
  gap: .9rem;
  padding: .28rem 1rem .28rem 2.4rem;
  font-size: .72rem;
  color: #c9a84c;
  text-decoration: none;
  line-height: 1.45;
  transition: color .15s;
}
.toc-v-sub-link::before { content: "·"; color: rgba(201,168,76,.4); flex-shrink: 0; }
.toc-v-sub-link:hover { color: rgba(232,213,160,.85); }

/* ---- Compensation du contenu pour la barre fixe ---- */
body { padding-top: 44px; }

/* scroll-margin-top : décalage natif pour ancres et liens internes */
#calculateur, #aveu, #astronomie, #autres-traditions,
#sept-jours, #zodiaque, #archetype, #mythologie,
#invitation, #sources, #conversion, #comparaisonsignes {
  scroll-margin-top: 68px; /* 44px barre + 24px marge */
}

/* ---- Responsive ---- */
@media (max-width: 480px) {
  .toc-h-item { padding: 0 10px; font-size: 9px; letter-spacing: .07em; }
  #toc-expand-btn { width: 40px; }
  #toc-v-panel { width: 100vw; border-radius: 0; }
}

@media (prefers-reduced-motion: reduce) {
  #toc-expand-btn svg, #toc-v-panel { transition: none; }
}.toc-badge {
  display: inline-block;
  vertical-align: middle;
  font-size: 10px;
  font-weight: 500;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  margin-left: 6px;
  letter-spacing: 0.02em;
  pointer-events: none;
}

.toc-badge--bonus {
  background: #FAEEDA;          /* amber-50 */
  color: #854F0B;               /* amber-600 */
  border: 0.5px solid #FAC775; /* amber-100 */
}

/* Dark mode */
@media (prefers-color-scheme: dark) {
  .toc-badge--bonus {
    background: #633806;        /* amber-800 */
    color: #FAC775;             /* amber-100 */
    border-color: #854F0B;      /* amber-600 */
  }
}