/* docs.htcli.io — documentation site.
   Reuses the landing page design system (tokens.css + fonts) in a GitBook-style
   shell: fixed header, scrollable left sidebar, main content column. Dark /
   terminal aesthetic, not GitBook's default look. */

*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg-page);
  color: var(--text-body);
  font-family: var(--font-mono);
  font-size: 15px;
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

a { color: inherit; text-decoration: none; }
svg { display: block; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }

h1, h2, h3, h4 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--text-hi);
  line-height: 1.18;
}

/* ---------- Layout ---------- */
:root {
  --doc-header-h: 64px;
  --doc-sidebar-w: 296px;
  --doc-content-max: 860px;
}

.doc-header {
  position: fixed;
  top: 0; left: 0; right: 0;
  z-index: 40;
  display: flex;
  align-items: center;
  gap: 20px;
  height: var(--doc-header-h);
  padding: 0 24px;
  background: rgba(3, 8, 6, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line-card);
}

.doc-brand { display: inline-flex; align-items: center; gap: 11px; }
.doc-brand .brand-mark {
  display: inline-flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; border-radius: 8px;
  background: var(--green); color: var(--text-hi);
  font-family: var(--font-display); font-size: 17px; font-weight: 700;
}
.doc-brand .brand-word {
  font-family: var(--font-display); font-size: 26px; font-weight: 700;
  color: var(--text-hi); letter-spacing: -0.01em;
}
.doc-brand .brand-word em { font-style: normal; color: var(--green-text); }
.doc-brand-tag {
  margin-left: 2px; padding: 3px 8px; border-radius: 5px;
  background: var(--bg-eyebrow); border: 1px solid var(--line-accent-dim);
  color: var(--green-text); font-size: 11px; letter-spacing: 0.06em;
}

.doc-search {
  flex: 1;
  max-width: 420px;
  display: flex; align-items: center; gap: 9px;
  height: 38px; padding: 0 14px;
  background: #070d0b; border: 1px solid var(--line-card); border-radius: 8px;
  color: var(--text-faint); font-size: 13px;
}
.doc-search svg { width: 15px; height: 15px; color: var(--text-faint); }
.doc-search input {
  flex: 1; border: 0; background: none; outline: none;
  color: var(--text-body); font-family: var(--font-mono); font-size: 13px;
}
.doc-search kbd {
  font-family: var(--font-mono); font-size: 11px; color: var(--text-faint);
  border: 1px solid var(--line-card); border-radius: 4px; padding: 1px 6px;
}

.doc-header-links { display: inline-flex; align-items: center; gap: 8px; margin-left: auto; }
.doc-ghlink {
  display: inline-flex; align-items: center; gap: 8px;
  height: 38px; padding: 0 14px; border-radius: 8px;
  border: 1px solid var(--line-btn); background: #0b0b0b;
  font-family: var(--font-display); font-size: 14px; color: var(--text-hi);
  transition: border-color 120ms ease;
}
.doc-ghlink:hover { border-color: #3a3a3a; }
.doc-ghlink svg { width: 17px; height: 17px; }

.doc-menu-toggle {
  display: none;
  width: 42px; height: 38px; flex-direction: column; justify-content: center; gap: 5px;
  padding: 0 10px; border: 1px solid var(--line-btn); border-radius: 8px; background: #0b0b0b;
}
.doc-menu-toggle span { display: block; width: 100%; height: 2px; background: var(--text-hi); border-radius: 2px; }

/* ---------- Shell ---------- */
.doc-shell {
  display: grid;
  grid-template-columns: var(--doc-sidebar-w) minmax(0, 1fr);
  padding-top: var(--doc-header-h);
}

.doc-sidebar {
  position: sticky;
  top: var(--doc-header-h);
  align-self: start;
  height: calc(100vh - var(--doc-header-h));
  overflow-y: auto;
  padding: 28px 18px 60px;
  border-right: 1px solid var(--line-card);
  background: var(--bg-tint);
}

.doc-navgroup { margin-bottom: 26px; }
.doc-navgroup-label {
  display: block;
  margin: 0 12px 8px;
  font-family: var(--font-mono);
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-faint);
}
.doc-navgroup ul { list-style: none; margin: 0; padding: 0; }
.doc-navlink {
  display: block;
  padding: 8px 12px;
  border-radius: 7px;
  font-size: 14px;
  color: #b9c0bd;
  border-left: 2px solid transparent;
  transition: background-color 120ms ease, color 120ms ease;
}
.doc-navlink:hover { color: var(--text-hi); background: #0b1411; }
.doc-navlink.is-active {
  color: var(--green-text);
  background: var(--bg-card-highlight);
  border-left-color: var(--green);
}

/* ---------- Content ---------- */
.doc-main { min-width: 0; padding: 0 40px; }
.doc-article {
  max-width: var(--doc-content-max);
  margin: 0 auto;
  padding: 52px 0 96px;
}
.doc-page { display: none; }
.doc-page.is-active { display: block; }

.doc-eyebrow {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 12px; letter-spacing: 0.08em;
  color: var(--green-text);
  margin-bottom: 14px;
}
.doc-article h1 {
  font-size: 42px;
  letter-spacing: -0.01em;
  margin-bottom: 18px;
}
.doc-article h2 {
  font-size: 26px;
  margin: 44px 0 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.doc-article h3 { font-size: 19px; margin: 28px 0 10px; color: #e8ebea; }
.doc-article p { margin: 14px 0; color: var(--text-body); font-size: 15.5px; }
.doc-article ul, .doc-article ol { margin: 14px 0; padding-left: 22px; color: var(--text-body); }
.doc-article li { margin: 7px 0; font-size: 15.5px; }
.doc-article a.inline { color: var(--green-text); border-bottom: 1px solid var(--line-accent-dim); }
.doc-article a.inline:hover { color: var(--green-bright); }
.doc-lead { font-size: 18px !important; color: #aab2af !important; line-height: 1.6; }

.doc-article :not(pre) > code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  color: var(--green-text);
  background: #0b1712;
  border: 1px solid var(--line-terminal);
  border-radius: 5px;
  padding: 1px 6px;
}

/* Code block styled as an htcli terminal */
.doc-term {
  margin: 20px 0;
  background: var(--bg-terminal);
  border: 1px solid var(--line-terminal);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.doc-term-head {
  display: flex; align-items: center; gap: 12px;
  height: 44px; padding: 0 16px;
  background: var(--bg-terminal-header);
  border-bottom: 1px solid var(--line-terminal);
}
.doc-term-dots { display: inline-flex; gap: 7px; }
.doc-term-dots i { width: 10px; height: 10px; border-radius: 50%; }
.doc-term-dots i:nth-child(1) { background: #f4564e; }
.doc-term-dots i:nth-child(2) { background: #f5bf4f; }
.doc-term-dots i:nth-child(3) { background: #29c440; }
.doc-term-title { flex: 1; font-family: var(--font-mono); font-size: 12px; color: var(--text-muted); }
.doc-term-copy {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text-faint);
  transition: color 120ms ease;
}
.doc-term-copy:hover { color: var(--text-hi); }
.doc-term-copy svg { width: 13px; height: 13px; }
.doc-term-body {
  margin: 0; padding: 18px 20px;
  font-family: var(--font-mono); font-size: 14px; line-height: 1.7;
  color: var(--text-body);
  white-space: pre; overflow-x: auto;
}
.doc-term-body .c-green { color: var(--green-text); }
.doc-term-body .c-white { color: var(--text-hi); }
.doc-term-body .c-dim { color: var(--text-faint); }
.doc-term-body .c-yellow { color: #e2ac07; }

/* Callout / note block */
.doc-note {
  display: flex; gap: 12px;
  margin: 20px 0; padding: 16px 18px;
  background: var(--bg-card);
  border: 1px solid var(--line-card);
  border-left: 3px solid var(--green);
  border-radius: 8px;
}
.doc-note.is-warn { border-left-color: #e2ac07; }
.doc-note-ico { color: var(--green-text); flex: 0 0 auto; }
.doc-note.is-warn .doc-note-ico { color: #e2ac07; }
.doc-note-ico svg { width: 18px; height: 18px; }
.doc-note p { margin: 0; font-size: 14px; }
.doc-note strong { color: var(--text-hi); }

/* Options table */
.doc-table { width: 100%; border-collapse: collapse; margin: 18px 0; font-size: 14px; }
.doc-table th, .doc-table td {
  text-align: left; padding: 10px 14px; border-bottom: 1px solid var(--line-soft); vertical-align: top;
}
.doc-table th { color: var(--text-hi); font-family: var(--font-display); font-weight: 500; }
.doc-table td code { white-space: nowrap; }
.doc-table tbody tr:hover { background: #070d0b; }

/* Prev / next pager */
.doc-pager {
  display: flex; gap: 16px; margin-top: 56px; padding-top: 28px;
  border-top: 1px solid var(--line-soft);
}
.doc-pager a {
  flex: 1; padding: 16px 18px;
  border: 1px solid var(--line-card); border-radius: var(--radius-md);
  background: var(--bg-card); transition: border-color 120ms ease;
}
.doc-pager a:hover { border-color: var(--line-accent-dim); }
.doc-pager .dir { font-size: 12px; color: var(--text-faint); }
.doc-pager .ttl { margin-top: 4px; font-family: var(--font-display); font-size: 16px; color: var(--text-hi); }
.doc-pager .next { text-align: right; }
.doc-pager a.is-empty { visibility: hidden; }

.doc-overlay { display: none; }

/* ---------- Responsive ---------- */
@media (max-width: 1024px) {
  :root { --doc-sidebar-w: 248px; }
  .doc-main { padding: 0 28px; }
}

@media (max-width: 767px) {
  .doc-search { display: none; }
  .doc-menu-toggle { display: inline-flex; }
  .doc-ghlink span { display: none; }
  .doc-ghlink { padding: 0 11px; }

  .doc-shell { grid-template-columns: 1fr; }
  .doc-sidebar {
    position: fixed; top: var(--doc-header-h); bottom: 0; left: 0;
    width: min(300px, 84vw); height: auto;
    transform: translateX(-100%); transition: transform 200ms ease;
    z-index: 35;
  }
  .doc-shell.nav-open .doc-sidebar { transform: translateX(0); }
  .doc-overlay {
    display: none; position: fixed; inset: var(--doc-header-h) 0 0; z-index: 30;
    background: rgba(0, 0, 0, 0.62);
  }
  .doc-shell.nav-open .doc-overlay { display: block; }

  .doc-main { padding: 0 20px; }
  .doc-article { padding: 36px 0 72px; }
  .doc-article h1 { font-size: 32px; }
  .doc-article h2 { font-size: 22px; }
  .doc-pager { flex-direction: column; }
}
