/* Tether CLI reference — persistent sidebar, scroll-spy, in-page filter.
   Tokens only, from /shared.css. No new colour values. */

html { scroll-behavior: smooth; }

.hero__chips {
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
}

.docs {
  max-width: var(--page);
  margin: 0 auto;
  padding: var(--s-6) var(--gutter) var(--s-8);
  display: grid;
  grid-template-columns: 15rem minmax(0, 1fr);
  gap: var(--s-7);
  align-items: start;
  min-width: 0;
}

/* SIDEBAR */

.toc {
  position: sticky;
  top: calc(var(--s-8) + var(--s-1));
  align-self: start;
  max-height: calc(100vh - var(--s-9));
  overflow-y: auto;
  /* Keep the offset keyboard outline inside the scrollport on every edge. */
  padding: 6px var(--s-2) 6px 6px;
  scroll-padding-block: 8px;
  min-width: 0;
}

.toc__title {
  font-size: var(--t-11);
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 var(--s-3);
}

.toc__search { margin-bottom: var(--s-4); }

.toc__label {
  display: block;
  font-size: var(--t-12);
  font-weight: 560;
  color: var(--text-2);
  margin-bottom: var(--s-1);
}

.toc__input {
  width: 100%;
  min-height: 44px;
  padding: 10px var(--s-3);
  border-radius: var(--r-md);
  border: 1px solid var(--hairline-strong);
  background: var(--surface-1);
  color: var(--text-1);
  font: inherit;
  font-size: var(--t-13);
}

.toc__input::placeholder { color: var(--text-3); }

.toc__input:focus-visible {
  outline: 3px solid var(--focus-ring);
  outline-offset: 2px;
  border-color: var(--info);
}

.toc__help,
.toc__count {
  margin: var(--s-2) 0 0;
  font-size: var(--t-11);
  line-height: 1.5;
  color: var(--text-3);
}

.toc__count:empty { display: none; }
/* Real inline SVG per section (CSP-legal markup, same technique as
   web/landing/styles.css .feature__icon): the sidebar previously carried a
   left-border tick as the only thing distinguishing the active section, and
   twelve identical rows of plain text otherwise. */
.toc__list {
  list-style: none;
  margin: 0;
  padding: 0;
  border-left: 1px solid var(--hairline);
}

.toc__link {
  display: flex;
  align-items: center;
  gap: var(--s-2);
  min-height: 44px;
  padding: var(--s-1) var(--s-3);
  margin-left: -1px;
  border-left: 2px solid transparent;
  color: var(--text-3);
  font-size: var(--t-13);
  line-height: 1.4;
  text-decoration: none;
  transition: color var(--dur-fast) var(--ease),
              border-left-color var(--dur-fast) var(--ease),
              background-color var(--dur-fast) var(--ease);
}
.toc__icon {
  flex: none;
  width: 15px;
  height: 15px;
  color: var(--text-3);
  transition: color var(--dur-fast) var(--ease);
}

.toc__link:hover {
  color: var(--text-1);
  background: var(--overlay-up);
}
.toc__link:hover .toc__icon { color: var(--info); }

.toc__link[aria-current="location"] {
  color: var(--text-1);
  border-left-color: var(--pass);
  font-weight: 560;
  background: var(--tint-pass);
}
.toc__link[aria-current="location"] .toc__icon { color: var(--pass); }
/* --tint-pass sits close in luminance to the shared --info focus outline in
   dark mode (measured contrast 1.11:1) and --tint-pass is --surface-1 (near
   white) in light mode, where the shared outline is also too close in
   luminance. --on-info is the wrong swap: it is tuned for a *solid* --info
   fill (.btn--primary) and flips to white in light mode, invisible on the
   light --surface-1 tint. --text-1 contrasts against the tint in both
   schemes. */
.toc__link[aria-current="location"]:focus-visible {
  outline-color: var(--text-1);
}

.toc__link[hidden] { display: none; }
.docs__main { min-width: 0; }

.docs__head { margin-bottom: var(--s-7); }

.docs__head h1 {
  font-size: var(--t-display);
  line-height: 1.08;
  letter-spacing: -0.03em;
  text-wrap: balance;
  max-width: 22ch;
  margin-bottom: var(--s-3);
}

.docs__sub {
  text-wrap: pretty;
  max-width: var(--measure);
  font-size: var(--t-15);
  color: var(--text-2);
  line-height: 1.6;
}

.doc {
  padding-top: var(--s-6);
  margin-bottom: var(--s-6);
  border-top: 1px solid var(--hairline);
  scroll-margin-top: var(--s-8);
  min-width: 0;
}

.doc[hidden] { display: none; }

.doc h2 {
  font-size: var(--t-24);
  line-height: 1.24;
  margin-bottom: var(--s-3);
}

.doc h2 code { font-size: inherit; }

.doc h3 {
  margin: var(--s-5) 0 var(--s-2);
  color: var(--text-1);
}

.doc__lead,
.doc__note {
  max-width: var(--measure);
  line-height: 1.6;
  margin-bottom: var(--s-4);
}

.doc__lead { color: var(--text-2); font-size: var(--t-15); }
.doc__note { color: var(--text-3); font-size: var(--t-13); }
.doc__note strong, .doc__lead strong { color: var(--text-1); }

.doc__list {
  max-width: var(--measure);
  margin: 0 0 var(--s-4);
  padding-left: var(--s-5);
  color: var(--text-2);
  font-size: var(--t-13);
  line-height: 1.65;
}

.doc__list li { margin-bottom: var(--s-2); }

.doc__grid {
  list-style: none;
  display: flex;
  flex-wrap: wrap;
  gap: var(--s-2);
  margin: 0 0 var(--s-4);
  padding: 0;
}

.doc__grid li {
  padding: var(--s-1) 10px;
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline);
  background: var(--surface-2);
  font-size: var(--t-12);
  color: var(--text-2);
}

.flagtable {
  margin: 0 0 var(--s-5);
  border-top: 1px solid var(--hairline);
}

.flagtable__row {
  display: grid;
  grid-template-columns: 14rem minmax(0, 1fr);
  gap: var(--s-4);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--hairline);
  min-width: 0;
}

.flagtable dt {
  font-size: var(--t-13);
  color: var(--text-1);
  min-width: 0;
}

.flagtable dd {
  margin: 0;
  font-size: var(--t-13);
  color: var(--text-2);
  line-height: 1.6;
  min-width: 0;
}

.copybtn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 44px;
  min-width: 44px;
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-sm);
  border: 1px solid var(--hairline-strong);
  background: var(--surface-1);
  color: var(--text-2);
  font: inherit;
  font-size: var(--t-11);
  font-weight: 560;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  cursor: pointer;
  transition: color var(--dur-fast) var(--ease),
              border-color var(--dur-fast) var(--ease),
              transform var(--dur-fast) var(--ease);
}

.copybtn:hover { color: var(--text-1); border-color: var(--info); }
.copybtn:active { transform: scale(var(--press-scale)); }

.copybtn[data-copied="done"] { color: var(--pass); border-color: var(--pass-line); background: var(--tint-pass); }
.copybtn[data-copied="fail"] { color: var(--fail); border-color: var(--fail-line); background: var(--tint-fail); }
.copybtn { white-space: nowrap; }
.docs__clear { margin-left: var(--s-2); min-height: var(--tap); }

.docs .code-block { max-width: var(--measure); }

@media (max-width: 60rem) {
  .docs {
    grid-template-columns: minmax(0, 1fr);
    gap: var(--s-5);
  }
  .toc {
    position: static;
    max-height: none;
    overflow: visible;
    padding-bottom: var(--s-4);
    border-bottom: 1px solid var(--hairline);
  }
  /* Stacked, the 12 section links were a 700px column: on a 375x812 phone the h1 started
     at y=898, below the fold, and a reader met a sidebar before the page. As one
     horizontally scrolling strip of pills the same links cost one 44px row. The strip is
     a scroll container whose children are focusable links, so the keyboard reaches every
     one, and docs.js keeps the current pill in view. */
  .toc__list {
    display: flex;
    gap: var(--s-2);
    overflow-x: auto;
    overscroll-behavior-x: contain;
    scroll-snap-type: x proximity;
    scrollbar-width: none;
    border-left: 0;
    padding: 3px;
  }
  .toc__list::-webkit-scrollbar { display: none; }
  .toc__list > li { flex: none; scroll-snap-align: start; }
  .toc__link {
    margin-left: 0;
    border: 1px solid var(--hairline);
    border-radius: var(--r-pill);
    white-space: nowrap;
  }
  .toc__link[aria-current="location"] { border-color: var(--pass); }
  .flagtable__row { grid-template-columns: minmax(0, 1fr); gap: var(--s-1); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .toc__link,
  .toc__icon,
  .copybtn {
    transition-duration: 0s;
  }
}


/* Depth pass: reference tables and chip grids sit on a lit card surface. */
.flagtable {
  padding: 0 var(--s-4);
  border: 1px solid var(--hairline);
  border-radius: var(--r-lg);
  background: var(--surface-1);
  box-shadow: var(--depth-1);
}
.flagtable__row:last-child { border-bottom: 0; }
.doc__grid li { box-shadow: var(--lit); }
.copybtn { box-shadow: var(--e-1); }
.copybtn:focus-visible { box-shadow: var(--e-1), var(--focus-halo); }
@media (max-width: 600px) { .flagtable { padding: 0 var(--s-3); } }

/* Install / splitting / troubleshooting additions. */
.docs .code-block pre { overflow-wrap: anywhere; }
.doc__list code, .doc__note code, .doc__lead code, .flagtable code { overflow-wrap: anywhere; }

/* The bench table has seven columns: it scrolls inside its own region (keyboard
   reachable via tabindex) instead of widening the page. */
.tablewrap {
  max-width: 100%;
  margin: 0 0 var(--s-4);
  overflow-x: auto;
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}
.tablewrap:focus-visible { box-shadow: var(--focus-halo); }
.bench {
  width: 100%;
  min-width: 44rem;
  border-collapse: collapse;
  font-size: var(--t-13);
}
.bench th, .bench td {
  padding: var(--s-2) var(--s-3);
  text-align: left;
  white-space: nowrap;
  border-bottom: 1px solid var(--hairline);
  color: var(--text-2);
}
.bench thead th { color: var(--text-1); font-weight: 560; font-size: var(--t-12); }
.bench tbody th { color: var(--text-1); font-weight: 560; }
.bench tbody tr:last-child th, .bench tbody tr:last-child td { border-bottom: 0; }
