/**
 * v2 — Legal pages: sidebar TOC + last-updated banner.
 *
 * Применяется к /privacy /agreement /terms /rules. JS auto-генерирует TOC
 * из <article class="xh-legal-content"> h2[id], так что HTML-правка минимальная.
 *
 * @since 2026-05-16
 */

/* ===== Last-updated banner ===== */
.xh-legal-updated {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 24px;
  padding: 12px 16px;
  background: rgba(255, 204, 0, .07);
  border: 1px solid rgba(255, 204, 0, .2);
  border-left: 3px solid #FFCC00;
  border-radius: 10px;
  font-size: 14px;
  color: var(--xh-text, #e8ecf2);
}
.xh-legal-updated__icon { width: 18px; height: 18px; color: #FFCC00; flex-shrink: 0; }
.xh-legal-updated__label { font-weight: 600; }
.xh-legal-updated__date { color: var(--xh-text-secondary, #a4b3c8); }

/* ===== Layout grid (desktop) ===== */
@media (min-width: 1024px) {
  .xh-legal-layout {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 260px;
    gap: 56px;
    align-items: start;
  }
  .xh-legal-layout .xh-legal-sidebar { order: 2; }
  .xh-legal-layout .xh-legal-content { order: 1; min-width: 0; }
  .xh-legal-toc-mobile { display: none !important; }
}

/* ===== Sticky TOC (desktop) ===== */
.xh-legal-toc-sticky {
  position: sticky;
  top: 96px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  padding: 18px 18px 14px;
  background: rgba(12, 19, 34, .5);
  border: 1px solid rgba(255, 255, 255, .06);
  border-radius: 12px;
}
.xh-legal-toc-sticky__title {
  margin: 0 0 12px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .12em;
  text-transform: uppercase;
  color: #FFCC00;
}
.xh-legal-toc-sticky ol { list-style: none; padding: 0; margin: 0; }
.xh-legal-toc-sticky li { margin: 0; font-size: 13px; line-height: 1.45; }
.xh-legal-toc-sticky a {
  display: block;
  padding: 6px 10px;
  color: var(--xh-text-secondary, #a4b3c8);
  text-decoration: none;
  border-left: 2px solid transparent;
  border-radius: 0 4px 4px 0;
  transition: color .15s ease, border-color .15s ease, background .15s ease;
}
.xh-legal-toc-sticky a:hover {
  color: var(--xh-text, #e8ecf2);
  background: rgba(255, 255, 255, .03);
}
.xh-legal-toc-sticky a.is-active {
  color: #FFCC00;
  border-left-color: #FFCC00;
  background: rgba(255, 204, 0, .06);
  font-weight: 600;
}
.xh-legal-toc-sticky a:focus-visible {
  outline: 2px solid #FFCC00;
  outline-offset: 2px;
}

/* ===== Mobile TOC (collapsible details) ===== */
.xh-legal-toc-mobile {
  margin: 0 0 24px;
  background: rgba(12, 19, 34, .6);
  border: 1px solid rgba(255, 255, 255, .08);
  border-radius: 10px;
  overflow: hidden;
}
.xh-legal-toc-mobile > summary {
  list-style: none;
  cursor: pointer;
  padding: 12px 16px;
  font-size: 13px;
  font-weight: 700;
  color: var(--xh-text, #e8ecf2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.xh-legal-toc-mobile > summary::-webkit-details-marker { display: none; }
.xh-legal-toc-mobile > summary::after {
  content: '+';
  font-size: 18px;
  color: #FFCC00;
  line-height: 1;
}
.xh-legal-toc-mobile[open] > summary::after { content: '−'; }
.xh-legal-toc-mobile ol {
  list-style: none;
  margin: 0;
  padding: 4px 16px 14px;
}
.xh-legal-toc-mobile li { font-size: 13px; line-height: 1.5; }
.xh-legal-toc-mobile a {
  display: block;
  padding: 5px 0;
  color: var(--xh-text-secondary, #a4b3c8);
  text-decoration: none;
}
.xh-legal-toc-mobile a:hover { color: #FFCC00; }

/* ===== Anchor scroll offset ===== */
.xh-legal-content h2 { scroll-margin-top: 90px; }
