/* Side contents list of the settings panel (ui/settings-toc.js). The layout follows the width of
   the popup, not the screen (container query): wide → a sticky column on the left; narrow → a
   sticky bar of chips at the top that scrolls sideways (never the page). Colours from the theme. */
.settings-shell { container-type: inline-size; }
.settings-main { min-width: 0; }
.settings-main section { scroll-margin-top: 4rem; }   /* clear of the sticky chip bar */

/* Narrow: chip bar */
.settings-toc {
  position: sticky; top: -.25rem; z-index: 2; margin: 0 -.25rem 1rem; padding: .5rem .25rem;
  background: rgba(18, 12, 8, .94); backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in srgb, var(--gold) 18%, transparent);
}
.settings-toc-list {
  display: flex; gap: .375rem; overflow-x: auto; overscroll-behavior-x: contain;
  scrollbar-width: none; -webkit-overflow-scrolling: touch;
}
.settings-toc-list::-webkit-scrollbar { display: none; }
.settings-toc-item {
  display: flex; flex-shrink: 0; align-items: center; gap: .375rem; min-height: 2.25rem;
  padding: .3rem .8rem; border-radius: 9999px; font-size: .85rem; font-weight: 600; text-align: left;
  color: rgb(214 211 209); background: rgba(255, 255, 255, .08); white-space: nowrap;
  transition: background .15s, color .15s;
}
.settings-toc-item:hover { background: rgba(255, 255, 255, .16); color: var(--ink); }
.settings-toc-item:focus-visible { outline: 2px solid var(--gold); outline-offset: 2px; }
.settings-toc-item.is-active { background: var(--gold); color: rgb(12 10 9); }
.settings-toc-badge {
  min-width: 1.25rem; padding: 0 .35rem; border-radius: 9999px; font-size: .7rem; line-height: 1.25rem;
  text-align: center; color: rgb(12 10 9); background: rgb(251 191 36 / .85);
}
.settings-toc-item.is-active .settings-toc-badge { background: rgba(0, 0, 0, .2); color: inherit; }

/* Wide: sticky left column */
@container (min-width: 44rem) {
  .settings-grid { display: grid; grid-template-columns: 11.5rem minmax(0, 1fr); gap: 1.25rem; align-items: start; }
  .settings-toc {
    top: 0; margin: 0; padding: 0 .25rem 0 0;
    background: none; backdrop-filter: none; border: 0;
    max-height: calc(var(--sheet-max-h, 90vh) - 7rem); overflow-y: auto;
  }
  .settings-main section { scroll-margin-top: .5rem; }
  .settings-toc-list { flex-direction: column; overflow: visible; gap: .25rem; }
  .settings-toc-item {
    justify-content: space-between; border-radius: .75rem; white-space: normal; background: transparent;
  }
  .settings-toc-item.is-active { background: color-mix(in srgb, var(--gold) 90%, transparent); }
}
@media (prefers-reduced-motion: reduce) { .settings-toc-item { transition: none; } }
