/* Documentation page styles */

html,
body {
  height: 100%;
  overflow: hidden;
}

/* Documentation shell layout */
.docs-shell {
  height: 100vh;
  min-height: 0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

/* Documentation header */
.docs-header {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 24px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  margin: 16px;
  position: sticky;
  top: 16px;
  z-index: 100;
}

.docs-brand {
  display: flex;
  align-items: center;
  gap: 14px;
  text-decoration: none;
  color: var(--text);
}

.docs-brand .brand-mark {
  display: grid;
  place-items: center;
  width: 44px;
  height: 44px;
  border: 1px solid var(--border);
  border-radius: var(--radius-full);
  background: var(--text);
  box-shadow: none;
  overflow: hidden;
}

.docs-brand .brand-logo {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.docs-title {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  letter-spacing: 0;
}

.docs-subtitle {
  font-size: 12px;
  color: var(--text-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.docs-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.docs-actions .button,
.docs-actions .theme-toggle,
.docs-back-btn {
  box-sizing: border-box;
  height: 42px;
  min-height: 42px;
  border-radius: var(--radius-md);
}

.docs-actions .button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 42px;
  width: 42px;
  min-width: 42px;
  padding: 0;
}

.docs-actions #theme-toggle.theme-toggle {
  flex: 0 0 42px;
  width: 42px;
  height: 42px;
  min-height: 42px;
  padding: 0;
}

.docs-back-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 16px;
  background: var(--bg-subtle);
  border: 1px solid var(--border);
  font-size: 13px;
  font-weight: 500;
  color: var(--text);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  white-space: nowrap;
}

.docs-back-btn:hover {
  background: var(--panel-strong);
  border-color: var(--accent);
  color: var(--accent);
}

.docs-back-btn svg {
  width: 16px;
  height: 16px;
}

/* Documentation layout - three columns */
.docs-layout {
  display: grid;
  grid-template-columns: 220px minmax(0, 1fr) 200px;
  gap: 16px;
  padding: 0 16px 16px;
  flex: 1 1 auto;
  min-height: 0;
  overflow: hidden;
  align-items: stretch;
}

/* Left navigation */
.docs-nav {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  height: 100%;
  min-height: 0;
  overflow-y: auto;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 14px;
  border-radius: var(--radius-md);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: all var(--transition-base);
  text-decoration: none;
  border: 1px solid transparent;
}

.nav-item:hover {
  background: var(--bg-subtle);
  color: var(--text);
  border-color: var(--border-subtle);
}

.nav-item.active {
  background: color-mix(in srgb, var(--surface-card) 72%, var(--accent-soft));
  color: var(--accent);
  border-color: color-mix(in srgb, var(--accent) 28%, var(--border));
}

[data-theme="dark"] .nav-item.active {
  border-color: color-mix(in srgb, var(--accent) 34%, var(--border));
}

.nav-icon {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.nav-icon svg {
  width: 18px;
  height: 18px;
  stroke: currentColor;
}

.nav-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Content area */
.docs-content {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  padding: 24px 32px;
  min-height: 0;
  overflow-y: auto;
  max-width: 100%;
}

.docs-article {
  max-width: 800px;
}

.article-header {
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border-subtle);
}

.article-header h1 {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 500;
  letter-spacing: 0;
}

.article-body {
  font-size: 15px;
  line-height: 1.7;
}

/* Article content styles */
.article-body h1 {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 500;
  margin: 32px 0 16px;
  letter-spacing: 0;
  color: var(--text);
}

.article-body h2 {
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 500;
  margin: 28px 0 14px;
  letter-spacing: 0;
  color: var(--text);
  padding-top: 8px;
}

.article-body h3 {
  font-size: 16px;
  font-weight: 600;
  margin: 20px 0 10px;
  color: var(--text);
}

.article-body p {
  margin: 12px 0;
  color: var(--text);
}

.article-body ul,
.article-body ol {
  margin: 12px 0;
  padding-left: 24px;
}

.article-body li {
  margin: 8px 0;
  line-height: 1.6;
}

.article-body a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color var(--transition-fast);
}

.article-body a:hover {
  border-bottom-color: var(--accent);
}

.article-body code {
  background: var(--bg-subtle);
  padding: 3px 7px;
  border-radius: var(--radius-xs);
  font-family: var(--font-mono);
  font-size: 14px;
  border: 1px solid var(--border-subtle);
}

.article-body pre {
  background: var(--surface-dark);
  color: var(--on-dark);
  padding: 16px;
  border-radius: var(--radius-md);
  overflow-x: auto;
  margin: 16px 0;
  border: 1px solid var(--border-subtle);
}

.article-body pre code {
  background: none;
  padding: 0;
  font-size: 14px;
  line-height: 1.5;
  border: none;
}

.article-body table {
  width: 100%;
  border-collapse: collapse;
  margin: 16px 0;
}

.article-body th,
.article-body td {
  padding: 12px 16px;
  border: 1px solid var(--border);
  text-align: left;
}

.article-body th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 14px;
}

.article-body td {
  font-size: 14px;
}

.article-body blockquote {
  margin: 16px 0;
  padding: 16px 20px;
  background: var(--surface-soft);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
}

.article-body hr {
  border: none;
  height: 1px;
  background: var(--border);
  margin: 24px 0;
}

/* Right table of contents */
.docs-toc {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: var(--surface-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: none;
  height: fit-content;
  max-height: 100%;
  overflow-y: auto;
}

.docs-toc h4 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  letter-spacing: 0.05em;
  text-transform: uppercase;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 8px;
}

.toc-item {
  display: block;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  transition: all var(--transition-fast);
  text-decoration: none;
}

.toc-item:hover {
  background: var(--bg-subtle);
  color: var(--accent);
}

.toc-h3 {
  padding-left: 20px;
  font-size: 12px;
}

/* Responsive layout */
@media (max-width: 1100px) {
  .docs-layout {
    grid-template-columns: 200px minmax(0, 1fr);
  }

  .docs-toc {
    display: none;
  }
}

@media (max-width: 768px) {
  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-nav {
    height: auto;
    max-height: 300px;
    margin-bottom: 16px;
  }

  .docs-shell {
    height: auto;
    min-height: 100vh;
    overflow: visible;
  }

  html,
  body {
    height: auto;
    overflow: auto;
  }

  .docs-layout {
    overflow: visible;
  }

  .docs-content {
    overflow: visible;
  }

  .docs-header {
    flex-wrap: wrap;
    gap: 12px;
  }

  .docs-content {
    padding: 20px;
  }

  .article-header h1 {
    font-size: 24px;
  }
}

@media (max-width: 480px) {
  .docs-shell {
    padding: 0;
  }

  .docs-header {
    margin: 8px;
    padding: 12px 16px;
    border-radius: var(--radius-lg);
  }

  .docs-layout {
    padding: 0 8px 8px;
    gap: 8px;
  }

  .docs-nav {
    padding: 12px;
    border-radius: var(--radius-lg);
  }

  .docs-content {
    padding: 16px;
    border-radius: var(--radius-lg);
  }

  .docs-brand .brand-mark {
    width: 36px;
    height: 36px;
    font-size: 16px;
  }

  .docs-title {
    font-size: 16px;
  }
}

/* Print styles */
@media print {
  .docs-header,
  .docs-nav,
  .docs-toc {
    display: none;
  }

  .docs-layout {
    grid-template-columns: 1fr;
  }

  .docs-shell {
    padding: 0;
  }
}
