/* ─────────────────────────────────────────────────────────────
   basta — toc.css
   Floating Table of Contents panel (desktop tab + mobile FAB)
───────────────────────────────────────────────────────────── */

/* ── Root container ──────────────────────────────────────────── */
.b-toc {
  position: fixed;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  z-index: 900;
  display: flex;
  align-items: stretch;
  pointer-events: none;
}

/* ── Tab (the vertical side strip) ──────────────────────────── */
.b-toc__tab {
  pointer-events: auto;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  width: 36px;
  padding: 18px 0;
  background: var(--b-purple, #26002a);
  color: #fff;
  border: none;
  cursor: pointer;
  border-radius: 0 6px 6px 0;
  transition: background 0.2s, opacity 0.2s;
  order: 1;
}

.b-toc__tab:hover {
  background: #3d0044;
}

.b-toc__tab-label {
  font-family: var(--font-body, 'Lato', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  writing-mode: vertical-rl;
  text-orientation: mixed;
  transform: rotate(180deg);
  color: rgba(255, 255, 255, 0.85);
}

/* ── Ticks ───────────────────────────────────────────────────── */
.b-toc__ticks {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}

.b-toc__tick {
  display: block;
  width: 14px;
  height: 2px;
  background: rgba(255, 255, 255, 0.28);
  border-radius: 1px;
  transition: background 0.25s, width 0.25s;
}

.b-toc__tick--active {
  background: var(--b-magenta, #e5006d);
  width: 18px;
}

/* ── Panel ───────────────────────────────────────────────────── */
.b-toc__panel {
  pointer-events: auto;
  order: 2;
  width: 0;
  overflow: hidden;
  background: var(--b-purple, #26002a);
  color: #fff;
  display: flex;
  flex-direction: column;
  transition: width 0.32s cubic-bezier(0.4, 0, 0.2, 1);
}

.b-toc--open .b-toc__panel {
  width: 240px;
}

/* ── Panel header ────────────────────────────────────────────── */
.b-toc__panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.10);
  flex-shrink: 0;
  min-width: 240px;
}

.b-toc__title {
  font-family: var(--font-body, 'Lato', sans-serif);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.6);
}

.b-toc__close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.45);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color 0.2s;
}

.b-toc__close:hover {
  color: #fff;
}

/* ── Navigation list ─────────────────────────────────────────── */
.b-toc__list {
  list-style: none;
  margin: 0;
  padding: 10px 0 16px;
  overflow-y: auto;
  flex: 1;
  min-width: 240px;
  counter-reset: toc-counter;
}

.b-toc__item {
  position: relative;
}

.b-toc__link {
  display: block;
  padding: 9px 16px 9px 20px;
  font-family: var(--font-body, 'Lato', sans-serif);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.35;
  color: rgba(255, 255, 255, 0.55);
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: color 0.2s, padding-left 0.2s;
}

.b-toc__link:hover {
  color: rgba(255, 255, 255, 0.88);
}

.b-toc__item--active .b-toc__link {
  color: #fff;
  padding-left: 26px;
}

.b-toc__item--active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--b-magenta, #e5006d);
  border-radius: 0 2px 2px 0;
}


/* ── Nascosto durante la hero (finché #top è in viewport) ───── */
.b-toc--behind-hero .b-toc__tab,
.b-toc--behind-hero .b-toc__fab {
  visibility: hidden;
  pointer-events: none;
}

/* ── Disabilitato via ACF ────────────────────────────────────── */
.toc-disabled .b-toc,
.toc-disabled .b-toc__fab,
.toc-disabled .b-toc__overlay {
  visibility: hidden;
  pointer-events: none;
}

/* ── FAB (mobile only) ───────────────────────────────────────── */
.b-toc__fab {
  display: none;
}

/* ── Overlay (mobile only) ───────────────────────────────────── */
.b-toc__overlay {
  display: none;
}

/* ── Reduced motion ──────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .b-toc__panel,
  .b-toc__tick,
  .b-toc__link { transition: none; }

  .b-toc__tab,
  .b-toc__close { transition: none; }
}

/* ── Mobile ≤ 880px — stessa tab verticale del desktop ───────── */
@media (max-width: 880px) {

  /* Tab più stretta del margine pagina (gutter mobile ≈ 24px) */
  .b-toc__tab {
    width: 18px;
    padding: 14px 0;
    gap: 10px;
  }

  .b-toc__tab-label {
    font-size: 9px;
    letter-spacing: 0.10em;
  }

  .b-toc__tick {
    width: 10px;
  }

  .b-toc__tick--active {
    width: 13px;
  }

  /* Il pannello aperto si limita a 80vw per non coprire tutto lo schermo */
  .b-toc--open .b-toc__panel {
    width: min(240px, 80vw);
  }

  /* FAB e overlay non usati — rimangono nascosti */
  .b-toc__fab    { display: none !important; }
  .b-toc__overlay { display: none !important; }

  @media (prefers-reduced-motion: reduce) {
    .b-toc__panel { transition: none !important; }
  }
}
