/* ==========================================================================
   SyncTide — documentation layout
   Sticky sidebar + content + on-this-page rail, callouts, doc tables,
   step lists and role badges. Inherits tokens/typography from base.css.
   ========================================================================== */

.docs-wrap { max-width: 1340px; margin: 0 auto; padding: 0 28px; }

/* ---- header band ---- */
.docs-header {
  padding: calc(var(--nav-h) + 70px) 0 30px;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.docs-header .eyebrow {
  font-family: "JetBrains Mono", monospace;
  font-size: 12px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); display: flex; align-items: center; gap: 12px;
  margin-bottom: 14px;
}
.docs-header .eyebrow::before { content: ""; width: 28px; height: 1px; background: var(--accent); }
.docs-header h1 { font-size: clamp(36px, 5vw, 60px); line-height: 1.02; margin-bottom: 14px; }
.docs-header p { color: var(--text-dim); font-size: 18px; max-width: 640px; }
.docs-meta {
  margin-top: 22px; display: flex; gap: 10px 22px; flex-wrap: wrap;
  font-family: "JetBrains Mono", monospace; font-size: 12.5px; color: var(--text-muted);
}
.docs-meta span { display: inline-flex; align-items: center; gap: 8px; }
.docs-meta .pip { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-3); box-shadow: 0 0 10px var(--accent-3); }

/* ---- 3-column shell ---- */
.docs-shell {
  display: grid;
  grid-template-columns: 264px minmax(0, 1fr) 212px;
  gap: 48px;
  align-items: start;
  padding: 40px 0 100px;
}

/* ---- left sidebar ---- */
.docs-side {
  position: sticky;
  top: calc(var(--nav-h) + 22px);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 32px);
  overflow-y: auto;
  padding-right: 8px;
  scrollbar-width: thin;
}
.docs-search {
  position: relative;
  margin-bottom: 14px;
}
.docs-search input {
  width: 100%;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--text);
  font-family: inherit;
  font-size: 13.5px;
  padding: 10px 12px 10px 36px;
  transition: border-color .2s, box-shadow .2s;
}
.docs-search input:focus {
  outline: none; border-color: var(--accent);
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 16%, transparent);
}
.docs-search svg {
  position: absolute; left: 12px; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; color: var(--text-muted); pointer-events: none;
}
.docs-nav { display: flex; flex-direction: column; gap: 1px; }
.docs-nav .group-label {
  font-family: "JetBrains Mono", monospace;
  font-size: 10.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--text-muted); padding: 11px 10px 4px;
}
.docs-nav .group-label:first-child { padding-top: 0; }
.docs-nav a {
  display: block;
  padding: 5px 12px;
  border-radius: 8px;
  font-size: 13.5px;
  color: var(--text-muted);
  border-left: 2px solid transparent;
  transition: color .15s, background .15s, border-color .15s;
}
.docs-nav a:hover { color: var(--text); background: color-mix(in srgb, var(--surface) 70%, transparent); }
.docs-nav a.active {
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-left-color: var(--accent);
  font-weight: 500;
}
.docs-nav a.is-hidden { display: none; }
.docs-nav .group-label.is-hidden { display: none; }

/* ---- main content ---- */
.docs-main { min-width: 0; }
.docs-section {
  padding-top: 8px;
  margin-bottom: 64px;
  scroll-margin-top: calc(var(--nav-h) + 28px);
}
.docs-section > h2 {
  font-size: clamp(26px, 3vw, 34px);
  letter-spacing: -0.02em;
  margin-bottom: 8px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
  scroll-margin-top: calc(var(--nav-h) + 28px);
}
.docs-section > .lead-in { color: var(--text-dim); font-size: 16.5px; margin: 16px 0 10px; max-width: 70ch; }
.docs-block { margin-top: 30px; scroll-margin-top: calc(var(--nav-h) + 28px); }
.docs-block h3 {
  font-size: 19px; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; gap: 10px;
}
.docs-block h3 .num {
  font-family: "JetBrains Mono", monospace; font-size: 12px; font-weight: 500;
  color: var(--accent); border: 1px solid color-mix(in srgb, var(--accent) 35%, transparent);
  background: color-mix(in srgb, var(--accent) 10%, transparent);
  border-radius: 6px; padding: 2px 7px;
}
.docs-main p { color: var(--text-dim); font-size: 15px; line-height: 1.7; margin: 10px 0; max-width: 72ch; }
.docs-main p strong { color: var(--text); font-weight: 600; }
.docs-main a.inline { color: var(--accent); }
.docs-main a.inline:hover { text-decoration: underline; }

.docs-main ul.bullets { list-style: none; padding: 0; margin: 14px 0; display: grid; gap: 9px; max-width: 72ch; }
.docs-main ul.bullets li { position: relative; padding-left: 22px; color: var(--text-dim); font-size: 15px; line-height: 1.6; }
.docs-main ul.bullets li::before {
  content: ""; position: absolute; left: 4px; top: 9px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 8px color-mix(in srgb, var(--accent) 60%, transparent);
}
.docs-main ul.bullets li strong { color: var(--text); }

/* numbered steps */
ol.steps { list-style: none; counter-reset: step; padding: 0; margin: 18px 0; display: grid; gap: 14px; max-width: 72ch; }
ol.steps li {
  counter-increment: step;
  position: relative; padding-left: 46px;
  color: var(--text-dim); font-size: 15px; line-height: 1.6; min-height: 30px;
  display: flex; align-items: center;
}
ol.steps li::before {
  content: counter(step);
  position: absolute; left: 0; top: 0;
  width: 30px; height: 30px; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  font-family: "JetBrains Mono", monospace; font-size: 13px; font-weight: 500;
  color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent);
  border: 1px solid color-mix(in srgb, var(--accent) 30%, transparent);
}
ol.steps li strong { color: var(--text); }

/* callouts */
.callout {
  display: flex; gap: 14px;
  border-radius: 12px;
  padding: 16px 18px;
  margin: 20px 0;
  font-size: 14.5px; line-height: 1.6;
  border: 1px solid var(--border);
  background: color-mix(in srgb, var(--surface) 55%, transparent);
  max-width: 74ch;
}
.callout .ic { flex-shrink: 0; width: 20px; height: 20px; margin-top: 1px; }
.callout p { margin: 0; color: var(--text-dim); font-size: 14.5px; }
.callout p strong { color: var(--text); }
.callout.note { border-color: color-mix(in srgb, var(--accent) 38%, transparent); background: color-mix(in srgb, var(--accent) 8%, transparent); }
.callout.note .ic { color: var(--accent); }
.callout.tip { border-color: color-mix(in srgb, var(--accent-3) 38%, transparent); background: color-mix(in srgb, var(--accent-3) 8%, transparent); }
.callout.tip .ic { color: var(--accent-3); }
.callout.warn { border-color: color-mix(in srgb, var(--warn) 40%, transparent); background: color-mix(in srgb, var(--warn) 9%, transparent); }
.callout.warn .ic { color: var(--warn); }

/* tables */
.docs-table-wrap { overflow-x: auto; margin: 20px 0; border: 1px solid var(--border); border-radius: 12px; }
table.docs-table { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 480px; }
table.docs-table thead th {
  text-align: left; padding: 12px 16px;
  font-family: "JetBrains Mono", monospace; font-weight: 500;
  font-size: 11px; letter-spacing: 0.1em; text-transform: uppercase; color: var(--text-muted);
  background: color-mix(in srgb, var(--surface) 70%, transparent);
  border-bottom: 1px solid var(--border);
}
table.docs-table td { padding: 12px 16px; border-bottom: 1px solid color-mix(in srgb, var(--border) 70%, transparent); color: var(--text-dim); vertical-align: top; line-height: 1.55; }
table.docs-table tbody tr:last-child td { border-bottom: 0; }
table.docs-table tbody tr:hover td { background: color-mix(in srgb, var(--surface) 35%, transparent); }
table.docs-table td strong, table.docs-table td b { color: var(--text); font-weight: 600; }
table.docs-table code { white-space: nowrap; }

/* code block */
pre.code {
  background: #070b14;
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 16px 18px;
  overflow-x: auto;
  margin: 18px 0;
  font-family: "JetBrains Mono", monospace;
  font-size: 13px; line-height: 1.6; color: var(--text-dim);
  max-width: 74ch;
}
pre.code .c { color: var(--text-muted); }
pre.code .k { color: var(--accent); }

/* role badges */
.role { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: 11.5px; font-weight: 600; font-family: "JetBrains Mono", monospace; letter-spacing: 0.04em; }
.role::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.role.viewer { color: #8aa0c6; background: color-mix(in srgb, #8aa0c6 14%, transparent); }
.role.operator { color: var(--accent); background: color-mix(in srgb, var(--accent) 14%, transparent); }
.role.admin { color: var(--accent-2); background: color-mix(in srgb, var(--accent-2) 16%, transparent); }

/* status dots in tables */
.dot-status { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; color: var(--text); }
.dot-status::before { content: ""; width: 10px; height: 10px; border-radius: 50%; }
.dot-status.green::before { background: var(--accent-3); box-shadow: 0 0 8px var(--accent-3); }
.dot-status.red::before { background: var(--danger); box-shadow: 0 0 8px var(--danger); }
.dot-status.grey::before { background: var(--text-muted); }

/* figure / screenshot frame */
.docs-figure {
  margin: 24px 0;
  border-radius: 14px; overflow: hidden;
  border: 1px solid var(--border);
  background: #0a0e1a;
  box-shadow: 0 30px 70px -30px rgba(0,0,0,0.6);
}
.docs-figure .bar { display: flex; align-items: center; gap: 7px; padding: 9px 13px; background: #0c1322; border-bottom: 1px solid var(--border); }
.docs-figure .bar i { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }
.docs-figure .bar .r { background: #ff5d73; } .docs-figure .bar .y { background: #f2c14e; } .docs-figure .bar .g { background: #3ddc97; }
.docs-figure .bar span { margin-left: 10px; font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-muted); }
.docs-figure img { display: block; width: 100%; }
.docs-figure figcaption { padding: 11px 16px; font-size: 12.5px; color: var(--text-muted); border-top: 1px solid var(--border); }

/* right rail — on this page */
.docs-toc {
  position: sticky;
  top: calc(var(--nav-h) + 28px);
  align-self: start;
  font-size: 13px;
}
.docs-toc .toc-title {
  font-family: "JetBrains Mono", monospace; font-size: 10.5px; letter-spacing: 0.18em;
  text-transform: uppercase; color: var(--text-muted); margin-bottom: 12px;
}
.docs-toc ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 2px; border-left: 1px solid var(--border); }
.docs-toc a {
  display: block; padding: 5px 0 5px 14px; margin-left: -1px;
  border-left: 1px solid transparent; color: var(--text-muted); font-size: 12.5px; line-height: 1.4;
  transition: color .15s, border-color .15s;
}
.docs-toc a:hover { color: var(--text-dim); }
.docs-toc a.active { color: var(--accent); border-left-color: var(--accent); }

/* prev / next */
.docs-pager { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 24px; }
.docs-pager a {
  border: 1px solid var(--border); border-radius: 12px; padding: 16px 18px;
  display: flex; flex-direction: column; gap: 4px; transition: border-color .2s, transform .2s;
}
.docs-pager a:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.docs-pager .dir { font-family: "JetBrains Mono", monospace; font-size: 11px; color: var(--text-muted); letter-spacing: 0.08em; }
.docs-pager .ttl { color: var(--text); font-weight: 600; font-size: 14.5px; }
.docs-pager .next { text-align: right; align-items: flex-end; }

/* mobile sidebar toggle */
.docs-side-toggle { display: none; }

@media (max-width: 1100px) {
  .docs-shell { grid-template-columns: 240px minmax(0,1fr); }
  .docs-toc { display: none; }
}
@media (max-width: 820px) {
  .docs-shell { grid-template-columns: 1fr; padding-top: 16px; }
  .docs-side {
    position: fixed;
    inset: 0 auto 0 0;
    z-index: 60;
    width: 290px; max-width: 84vw; max-height: none; height: 100%;
    background: var(--bg-1);
    border-right: 1px solid var(--border);
    padding: calc(var(--nav-h) + 24px) 18px 24px;
    transform: translateX(-102%);
    transition: transform .3s var(--ease-out);
  }
  body.docs-side-open .docs-side { transform: translateX(0); }
  body.docs-side-open::after {
    content: ""; position: fixed; inset: 0; z-index: 55; background: rgba(0,0,0,0.5);
  }
  .docs-side-toggle {
    display: inline-flex; align-items: center; gap: 8px;
    position: sticky; top: calc(var(--nav-h) + 12px); z-index: 40;
    margin: 4px 0 18px;
    padding: 10px 16px; border-radius: 10px;
    background: var(--surface); border: 1px solid var(--border-hi); color: var(--text);
    font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer;
  }
  .docs-side-toggle svg { width: 16px; height: 16px; }
  .docs-header { padding-top: calc(var(--nav-h) + 44px); }
  .docs-pager { grid-template-columns: 1fr; }
}
