/* =========================
   Spintax – DOCS PAGES
   Article typography & layout
   ========================= */

/* Header: breadcrumb + theme toggle in one row */
.docs-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) 0;
}

/* Breadcrumb nav */
.docs-nav {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  font-size: var(--fs-sm);
  color: var(--text-muted);
}

.docs-nav a {
  color: var(--text-muted);
  text-decoration: none;
}

.docs-nav a:hover {
  color: var(--text-main);
}

.docs-nav__home {
  display: inline-flex;
  align-items: center;
  gap: 0.35em;
}

.docs-nav__sep {
  color: var(--text-subtle);
}

/* Article */
.docs-article {
  max-width: 720px;
  margin: 0 auto;
  padding-bottom: var(--space-6);
}

.docs-article h1 {
  font-size: clamp(1.75rem, 3vw, 2.5rem);
  font-weight: var(--fw-bold);
  line-height: 1.15;
  letter-spacing: -0.02em;
  margin: 0 0 var(--space-3);
}

.docs-article .docs-lead {
  font-size: 1.05rem;
  line-height: 1.6;
  color: var(--text-muted);
  margin: 0 0 var(--space-6);
}

.docs-article h2 {
  font-size: var(--fs-xl);
  font-weight: var(--fw-semibold);
  line-height: 1.25;
  margin: var(--space-6) 0 var(--space-3);
  padding-top: var(--space-4);
  border-top: 1px solid var(--border-subtle);
}

.docs-article h2:first-of-type {
  border-top: none;
  padding-top: 0;
}

.docs-article h3 {
  font-size: var(--fs-lg);
  font-weight: var(--fw-semibold);
  line-height: 1.3;
  margin: var(--space-5) 0 var(--space-2);
}

.docs-article p {
  font-size: var(--fs-md);
  line-height: 1.7;
  margin: 0 0 var(--space-4);
}

.docs-article ul,
.docs-article ol {
  margin: 0 0 var(--space-4);
  padding-left: 1.5em;
}

.docs-article li {
  font-size: var(--fs-md);
  line-height: 1.7;
  margin-bottom: var(--space-2);
}

.docs-article li strong {
  font-weight: var(--fw-semibold);
}

/* Inline code */
.docs-article code {
  font-family: var(--font-mono);
  font-size: 0.88em;
  background: var(--bg-soft);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xs);
  padding: 0.15em 0.4em;
  word-break: break-word;
}

/* Code blocks */
.docs-article pre {
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  overflow-x: auto;
  margin: 0 0 var(--space-4);
}

.docs-article pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: var(--fs-sm);
  line-height: 1.7;
  color: var(--text-main);
}

/* Syntax highlighting spans inside code blocks */
.docs-article pre .s-enum { color: var(--blue-300); }
.docs-article pre .s-perm { color: var(--gold-300); }
.docs-article pre .s-var  { color: var(--magenta-300); }
.docs-article pre .s-dir  { color: var(--text-subtle); }
.docs-article pre .s-comment { color: var(--text-subtle); font-style: italic; }

:root[data-theme="light"] .docs-article pre .s-enum { color: var(--blue-700); }
:root[data-theme="light"] .docs-article pre .s-perm { color: var(--gold-900); }
:root[data-theme="light"] .docs-article pre .s-var  { color: var(--magenta-700); }

/* Tables — scrollable on mobile */
.docs-table-wrap {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0 0 var(--space-4);
}

.docs-article table {
  width: 100%;
  border-collapse: collapse;
  margin: 0 0 var(--space-4);
  font-size: var(--fs-sm);
  min-width: 480px;
}

.docs-article th,
.docs-article td {
  text-align: left;
  padding: var(--space-2) var(--space-3);
  border-bottom: 1px solid var(--border-subtle);
}

.docs-article th {
  font-weight: var(--fw-semibold);
  color: var(--text-muted);
  font-size: var(--fs-xs);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Links */
.docs-article a {
  color: var(--primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-article a:hover {
  color: var(--primary-hover);
}

/* Buttons inside articles — override link color and underline */
.docs-article a.btn {
  text-decoration: none;
}

.docs-article a.btn--accent {
  color: var(--btn-accent-text) !important;
}

.docs-article a.btn--primary {
  color: var(--btn-primary-text) !important;
}

.docs-article a.btn--ghost {
  color: var(--btn-ghost-text) !important;
}

/* Horizontal rule */
.docs-article hr {
  border: none;
  border-top: 1px solid var(--border-subtle);
  margin: var(--space-6) 0;
}

/* Related links at bottom */
.docs-links {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-3);
  margin-top: var(--space-5);
}

.docs-links a {
  text-decoration: none;
}

/* =========================
   Mobile
   ========================= */
@media (max-width: 480px) {
  .docs-article h1 {
    font-size: 1.5rem;
  }

  .docs-article table {
    font-size: var(--fs-xs);
  }

  .docs-article th,
  .docs-article td {
    padding: var(--space-1) var(--space-2);
  }
}
