/* Sticky section menu + search for long legal pages (28 Nov 2026). Built by /scripts/legal-toc.js.
   Dark legal theme; brand orange #F49609. */

html { scroll-padding-top: calc(var(--ltoc-top, 0px) + 1.25rem); }

.has-ltoc .legal-toc { display: none; } /* the old in-page list: the menu replaces it */

.ltoc-layout {
  display: grid;
  grid-template-columns: 17rem minmax(0, 56.25rem);
  gap: 3rem;
  justify-content: center;
  max-width: 79rem;
  margin: 0 auto;
  padding: 0 2rem;
}
.ltoc-layout > main { margin: 0; max-width: none; min-width: 0; padding-left: 0; padding-right: 0; }

.ltoc {
  position: sticky;
  top: calc(var(--ltoc-top, 0px) + 1.5rem);
  align-self: start;
  margin-top: 3rem;
  font-size: 0.875rem;
  z-index: 5;
}
.ltoc__bar { display: none; }
.ltoc__panel {
  max-height: calc(100vh - var(--ltoc-top, 0px) - 3rem);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 1rem;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  background: rgba(17, 17, 34, 0.72);
  backdrop-filter: blur(8px);
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.15) transparent;
}

.ltoc__search { position: relative; }
.ltoc__search > i {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  color: #9CA3AF; font-size: 0.8rem; pointer-events: none;
}
.ltoc__input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.6rem 2rem 0.6rem 2.1rem;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  color: #F3F4F6;
  font: inherit;
  -webkit-appearance: none;
  appearance: none;
}
.ltoc__input::placeholder { color: #9CA3AF; }
.ltoc__input::-webkit-search-cancel-button { -webkit-appearance: none; display: none; }
.ltoc__input:focus { outline: none; border-color: #F49609; box-shadow: 0 0 0 3px rgba(244, 150, 9, 0.25); }
.ltoc__clear {
  position: absolute; right: 0.35rem; top: 50%; transform: translateY(-50%);
  width: 1.6rem; height: 1.6rem; border: 0; border-radius: 6px;
  background: transparent; color: #9CA3AF; font-size: 1.15rem; line-height: 1; cursor: pointer;
}
.ltoc__clear:hover, .ltoc__clear:focus-visible { color: #F3F4F6; background: rgba(255, 255, 255, 0.08); outline: none; }
.ltoc__clear[hidden] { display: none; }

.ltoc__status { margin: 0.45rem 0.15rem 0; min-height: 1.1em; color: #F49609; font-size: 0.78rem; }
.ltoc__status:empty { margin: 0; min-height: 0; }

.ltoc__title {
  margin: 1rem 0.15rem 0.5rem;
  color: #9CA3AF;
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.ltoc__list { list-style: none; margin: 0; padding: 0; }
.ltoc__list li[hidden] { display: none; }
.ltoc__link {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  padding: 0.45rem 0.65rem;
  border-left: 2px solid transparent;
  border-radius: 0 8px 8px 0;
  color: #C4C9D4;
  text-decoration: none;
  line-height: 1.35;
  transition: color 0.15s, background 0.15s, border-color 0.15s;
}
.ltoc__link:hover { color: #FFFFFF; background: rgba(255, 255, 255, 0.05); }
.ltoc__link:focus-visible { outline: 2px solid #F49609; outline-offset: 1px; }
.ltoc__link[aria-current] { color: #F49609; border-left-color: #F49609; background: rgba(244, 150, 9, 0.08); font-weight: 600; }
.ltoc__count {
  flex: none;
  min-width: 1.4rem;
  padding: 0.05rem 0.4rem;
  border-radius: 999px;
  background: rgba(244, 150, 9, 0.18);
  color: #F8B54A;
  font-size: 0.72rem;
  font-weight: 600;
  text-align: center;
}
.ltoc__count[hidden] { display: none; }

.ltoc__top {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0.85rem 0.65rem 0.15rem;
  color: #9CA3AF; font-size: 0.78rem; text-decoration: none;
}
.ltoc__top:hover, .ltoc__top:focus-visible { color: #F49609; }

/* Search matches in the page */
mark.ltoc-mark { background: rgba(244, 150, 9, 0.28); color: inherit; border-radius: 3px; padding: 0 1px; }
mark.ltoc-mark.is-current { background: #F49609; color: #111122; box-shadow: 0 0 0 2px rgba(244, 150, 9, 0.35); }

/* ── Phone / tablet: a slim sticky bar under the header ───────────────────── */
@media (max-width: 1099px) {
  .ltoc-layout { display: block; padding: 0; max-width: none; }
  .ltoc-layout > main { padding-left: 1.25rem; padding-right: 1.25rem; }
  .ltoc {
    position: sticky;
    top: var(--ltoc-top, 0px);
    margin: 0;
    z-index: 90;
  }
  .ltoc__bar {
    display: block;
    padding: 0.5rem 1rem;
    background: rgba(17, 17, 34, 0.94);
    backdrop-filter: blur(10px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  }
  .ltoc__toggle {
    display: flex; align-items: center; gap: 0.5rem;
    width: 100%; min-height: 2.75rem; padding: 0.5rem 0.75rem;
    border: 1px solid rgba(255, 255, 255, 0.12); border-radius: 10px;
    background: rgba(255, 255, 255, 0.04); color: #F3F4F6;
    font: inherit; font-weight: 600; text-align: left; cursor: pointer;
  }
  .ltoc__toggle:focus-visible { outline: 2px solid #F49609; outline-offset: 2px; }
  .ltoc__toggle > i { color: #F49609; }
  .ltoc__current {
    flex: 1; min-width: 0; margin-left: 0.25rem;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
    color: #9CA3AF; font-weight: 400;
  }
  .ltoc__current:not(:empty)::before { content: '· '; }
  .ltoc__panel {
    display: none;
    position: absolute; left: 0; right: 0; top: 100%;
    max-height: calc(100vh - var(--ltoc-top, 0px) - 4rem);
    border-radius: 0 0 14px 14px;
    border-top: 0;
    background: rgba(17, 17, 34, 0.98);
    box-shadow: 0 18px 40px rgba(0, 0, 0, 0.45);
  }
  .ltoc.is-open .ltoc__panel { display: block; }
  .ltoc__link { padding: 0.65rem 0.75rem; } /* 44 px tap targets */
}

@media (prefers-reduced-motion: reduce) {
  .ltoc__link { transition: none; }
}

@media print {
  .ltoc { display: none; }
  .ltoc-layout { display: block; padding: 0; }
  mark.ltoc-mark { background: none; }
}
