/* ==========================================================================
   TrafficTaps docs layout. Loads after brand.css.
   Sidebar (left) · article · on-page contents (right, wide screens)
   ========================================================================== */

.docs { display: grid; gap: 0; grid-template-columns: minmax(0, 1fr); }
.docs-side { border-bottom: 1px solid var(--line); background: var(--bg-soft); }
.docs-side-in { padding: 16px 20px; }
.docs-menu-btn { display: inline-flex; align-items: center; gap: 8px; width: 100%; justify-content: space-between; font: 700 14px/1 var(--font); color: var(--ink-2); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 12px 14px; cursor: pointer; margin-top: 12px; }
.docs-menu-btn svg { width: 16px; height: 16px; transition: transform .25s var(--ease); }
.docs-menu-btn[aria-expanded="true"] svg { transform: rotate(180deg); }
.docs-nav { display: none; margin-top: 14px; }
.docs-nav.is-open { display: block; }
.docs-nav h2 { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); margin: 20px 0 8px; padding-left: 10px; }
.docs-nav h2:first-child { margin-top: 4px; }
.docs-nav ul { display: grid; gap: 1px; }
.docs-nav a { display: block; padding: 7px 10px; border-radius: 8px; font-size: 14px; font-weight: 600; color: var(--ink-2); line-height: 1.35; transition: background-color .15s, color .15s; }
.docs-nav a:hover { background: #fff; color: var(--ink); }
.docs-nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-dark); box-shadow: inset 2px 0 0 var(--blue); }

/* search */
.docs-search { position: relative; }
.docs-search label { display: block; }
.docs-search input { width: 100%; font: 600 14px/1.2 var(--font); color: var(--ink); background: #fff; border: 1px solid var(--line-2); border-radius: 10px; padding: 11px 12px 11px 38px; transition: border-color .2s, box-shadow .2s; }
.docs-search input::placeholder { color: var(--muted-2); }
.docs-search input:focus { outline: none; border-color: var(--blue); box-shadow: 0 0 0 3px rgba(31,95,255,.15); }
.docs-search > svg { position: absolute; left: 12px; top: 50%; width: 16px; height: 16px; margin-top: -8px; color: var(--muted-2); pointer-events: none; }
.docs-search kbd { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); color: var(--muted-2); pointer-events: none; }
.search-results { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 6px); background: #fff; border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-lg); max-height: 60vh; overflow: auto; padding: 6px; }
.search-results[hidden] { display: none; }
.search-results a { display: block; padding: 10px 12px; border-radius: 8px; }
.search-results a:hover, .search-results a.is-sel { background: var(--blue-soft); }
.search-results b { display: block; font-size: 14px; font-weight: 800; color: var(--ink); }
.search-results small { display: block; margin-top: 2px; font-size: 12px; font-weight: 600; color: var(--muted-2); }
.search-results span { display: block; margin-top: 3px; font-size: 12.5px; color: var(--muted); line-height: 1.45; }
.search-results mark { background: #fff1a8; color: inherit; border-radius: 3px; padding: 0 1px; }
.search-empty { padding: 12px; font-size: 13.5px; color: var(--muted); }

/* article */
.docs-main { min-width: 0; padding: 28px 20px 72px; }
.docs-article { max-width: 760px; }
.docs-article .crumbs { margin-bottom: 14px; }
.docs-article h1 { font-size: clamp(1.9rem, 1.3rem + 2vw, 2.6rem); line-height: 1.1; letter-spacing: -.035em; font-weight: 800; text-wrap: balance; }
.docs-intro { margin-top: 14px; font-size: 1.08rem; color: var(--muted); max-width: 64ch; }
.docs-meta { display: flex; flex-wrap: wrap; gap: 8px 16px; margin-top: 16px; font-size: 13px; font-weight: 600; color: var(--muted-2); }
.docs-meta span { display: inline-flex; align-items: center; gap: 6px; }
.docs-meta svg { width: 14px; height: 14px; }
.docs-article .prose { margin-top: 28px; max-width: none; }

/* numbered steps */
.steps-list { grid-template-columns: minmax(0, 1fr); counter-reset: st; list-style: none !important; padding-left: 0 !important; display: grid; gap: 0; }
.steps-list > li { min-width: 0; counter-increment: st; position: relative; padding: 0 0 26px 46px; margin: 0 !important; }
.steps-list > li::before { content: counter(st); position: absolute; left: 0; top: 0; width: 30px; height: 30px; border-radius: 9px; background: var(--ink); color: #fff; font-size: 13px; font-weight: 800; display: grid; place-items: center; }
.steps-list > li::after { content: ""; position: absolute; left: 14px; top: 36px; bottom: 6px; width: 2px; background: var(--line); border-radius: 2px; }
.steps-list > li:last-child { padding-bottom: 0; }
.steps-list > li:last-child::after { display: none; }
.steps-list > li > h3 { margin-top: 2px !important; font-size: 1.08rem; }
.steps-list > li > * + * { margin-top: 10px; }

/* mistakes list */
.mistakes { display: grid; gap: 10px; list-style: none !important; padding: 0 !important; }
.mistakes li { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 10px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 12px; background: #fff; margin: 0 !important; }
.mistakes li > svg { width: 18px; height: 18px; margin-top: 3px; color: var(--red); }

/* prev / next */
.pager { display: grid; gap: 12px; margin-top: 56px; padding-top: 28px; border-top: 1px solid var(--line); }
.pager a { display: block; padding: 16px 18px; border: 1px solid var(--line); border-radius: var(--radius-md); background: #fff; transition: border-color .2s, box-shadow .2s, transform .2s var(--ease); }
.pager a:hover { border-color: #c3d5f2; box-shadow: var(--shadow-md); transform: translateY(-2px); }
.pager small { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted-2); }
.pager b { display: block; margin-top: 4px; font-size: 15.5px; font-weight: 800; color: var(--blue-dark); }
.pager .next { text-align: right; }
.docs-help { margin-top: 28px; font-size: 14px; color: var(--muted); }

/* on-page contents */
.docs-toc { display: none; }
.docs-toc h2 { font-size: 11.5px; font-weight: 800; letter-spacing: .09em; text-transform: uppercase; color: var(--muted-2); }
.docs-toc ul { margin-top: 12px; display: grid; gap: 2px; border-left: 2px solid var(--line); }
.docs-toc a { display: block; margin-left: -2px; padding: 5px 0 5px 14px; border-left: 2px solid transparent; font-size: 13.5px; font-weight: 600; color: var(--muted); line-height: 1.4; }
.docs-toc a:hover { color: var(--ink); }
.docs-toc a.is-active { color: var(--blue-dark); border-left-color: var(--blue); }
.docs-toc .lvl3 a { padding-left: 26px; font-size: 13px; }

@media (min-width: 768px) {
  .pager { grid-template-columns: 1fr 1fr; }
  .pager .next:only-child { grid-column: 2; }
}
@media (min-width: 1024px) {
  .docs { grid-template-columns: 280px minmax(0, 1fr); max-width: 1440px; margin-inline: auto; }
  .docs-side { border-bottom: 0; border-right: 1px solid var(--line); }
  .docs-side-in { position: sticky; top: var(--nav-h); max-height: calc(100vh - var(--nav-h)); overflow: auto; padding: 24px 18px 40px 24px; }
  .docs-menu-btn { display: none; }
  .docs-nav { display: block !important; }
  .docs-main { padding: 40px 48px 96px; }
}
@media (min-width: 1280px) {
  .docs { grid-template-columns: 280px minmax(0, 1fr) 240px; }
  .docs-toc { display: block; padding: 40px 24px 40px 0; }
  .docs-toc-in { position: sticky; top: calc(var(--nav-h) + 32px); max-height: calc(100vh - var(--nav-h) - 64px); overflow: auto; }
}
.code, .table-wrap, .callout, .shot { max-width: 100%; min-width: 0; }
.docs-main, .docs-content, .prose, article { min-width: 0; }
.steps-list > li > .code, .steps-list > li > .table-wrap { max-width: 100%; }
.callout.coming { display: block; background: var(--amber-soft); border-color: var(--amber-line); }
.callout.coming p { margin: 0; }
