/* docs.css — documentation layout */
@import 'flex-tokens.css';

/* -- NAV -- */

.nav {
  position: sticky;
  top: 0;
  z-index: 100;
  background: #ffffff;
}

.nav-inner {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 32px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 2px solid #000;
}

.nav-brand {
  font-family: var(--font);
  color: var(--text-primary);
  font-size: 26px;
  letter-spacing: 0.02em;
  font-weight: 500;
  text-decoration: none;
  text-transform: lowercase;
}

.nav-links {
  display: flex;
  gap: 24px;
  align-items: center;
  font-size: 14px;
}

.nav-links a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s;
}

.nav-links a:hover { color: var(--text-primary); }
.nav-links a.active { color: var(--text-primary); font-weight: 600; }

/* -- PAGE LAYOUT -- */

.page {
  max-width: 780px;
  margin: 0 auto;
  padding: 0 32px 120px;
  position: relative;
}

.page-header {
  padding: 48px 0 20px;
  border-bottom: 2px solid #000;
}

/* -- SIDEBAR (floats outside content) -- */

.sidebar {
  position: sticky;
  top: 76px;
  float: left;
  width: 160px;
  margin-left: -208px;
  padding-top: 32px;
}

.doc-content {
  min-width: 0;
}

.page-title {
  font-family: var(--font);
  font-size: 40px;
  font-weight: 400;
  letter-spacing: -0.04em;
  color: var(--text-primary);
  text-transform: lowercase;
}

.page-desc {
  font-size: 15px;
  color: var(--text-tertiary);
  margin-top: 8px;
}

/* -- TABLE OF CONTENTS (sidebar) -- */

.toc-label {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  margin-bottom: 16px;
}

.toc-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.toc-list li {
  border-left: 2px solid var(--border);
}

.toc-list li.active {
  border-left-color: var(--accent);
}

.toc-list a {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--text-tertiary);
  text-decoration: none;
  display: block;
  padding: 6px 0 6px 14px;
  transition: color 0.15s;
}

.toc-list a:hover { color: var(--text-primary); }
.toc-list li.active a { color: var(--accent); font-weight: 500; }

/* -- SECTIONS -- */

.doc-section {
  padding: 48px 0 0;
}

.doc-section + .doc-section {
  border-top: 1px solid var(--border);
  margin-top: 48px;
}

/* -- HEADINGS -- */

h2 {
  font-family: var(--font);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: -0.03em;
  color: var(--text-primary);
  text-transform: lowercase;
  margin-bottom: 20px;
}

h3 {
  font-family: var(--font);
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  margin-top: 32px;
  margin-bottom: 12px;
}

/* -- BODY TEXT -- */

p {
  margin-bottom: 14px;
  line-height: 1.7;
}

p + h3 { margin-top: 36px; }

/* -- CODE -- */

code {
  font-family: var(--font-mono);
  font-size: 13px;
  background: var(--code-bg);
  padding: 2px 6px;
  border: 1px solid var(--border);
}

pre {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 400;
  line-height: 1.7;
  background: #111;
  color: #abb2bf;
  padding: 20px 24px;
  border: 1px solid #000;
  margin: 14px 0 20px;
  white-space: pre-wrap;
  overflow-wrap: break-word;
  word-break: break-word;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
  color: inherit;
}

.cmd { color: #0070f3; }
.cmt { color: #5c6370; }
.str { color: #98c379; }
.flag { color: #e5c07b; }

/* -- TABLES -- */

table {
  width: 100%;
  border-collapse: collapse;
  margin: 14px 0 20px;
  font-size: 14px;
}

th {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text-tertiary);
  text-align: left;
  padding: 10px 12px;
  border-bottom: 2px solid #000;
  background: var(--bg-subtle);
}

td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

td code {
  font-size: 12px;
  white-space: nowrap;
}

tr:hover { background: var(--bg-subtle); }

/* -- CALLOUT -- */

.callout {
  border-left: 3px solid var(--accent);
  padding: 14px 20px;
  margin: 16px 0 20px;
  background: var(--accent-dim);
  font-size: 14px;
}

.callout code { background: rgba(0,112,243,0.08); border-color: rgba(0,112,243,0.15); }

/* -- FILE TREE -- */

.file-tree {
  font-family: var(--font-mono);
  font-size: 13px;
  line-height: 1.8;
  background: var(--code-bg);
  padding: 20px 24px;
  border: 1px solid #000;
  margin: 14px 0 20px;
}

.file-tree .dim { color: var(--text-faint); }
.file-tree .accent { color: var(--accent); font-weight: 500; }

/* -- FOOTER -- */

.doc-footer {
  margin-top: 64px;
  padding-top: 32px;
  border-top: 2px solid #000;
  font-size: 14px;
  color: var(--text-tertiary);
}

.doc-footer a {
  color: var(--accent);
  text-decoration: none;
}

.doc-footer a:hover { text-decoration: underline; }

/* -- RESPONSIVE -- */

/* hide sidebar when viewport can't fit it outside the content */
@media (max-width: 1060px) {
  .sidebar { display: none; }
}

@media (max-width: 600px) {
  .page { padding: 0 20px 64px; }
  .nav-inner { padding: 0 20px; }
  .page-title { font-size: 32px; }
  h2 { font-size: 24px; }
  pre { padding: 16px 18px; font-size: 12px; }
}
