/* Docs global styles — SpyderBot DS tokens only (lint:ds gated). */

:root {
  --docs-header-height: 6.75rem;
  --docs-sidebar-gap: 1.5rem;
  /* D1: blue for links (not accent violet) */
  --docs-link-color: var(--sp-focus-ring);
  --docs-link-hover: var(--sp-status-info-fg);
  --docs-font: var(--sp-font-family);
  --docs-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
}

.docs-layout-container {
  width: 100%;
  max-width: none;
}

.docs-layout-row {
  display: flex;
  flex-direction: column;
  gap: var(--sp-space-6);
}

.docs-layout-main {
  flex: 1;
  min-width: 0;
  overflow-x: clip;
}

@media (min-width: 1024px) {
  .docs-layout-row {
    flex-direction: row;
    align-items: flex-start;
    gap: var(--sp-space-6);
  }

  .docs-layout-sidebar--left {
    width: 16rem;
    flex-shrink: 0;
  }

  .docs-layout-sidebar--right {
    width: 14rem;
    flex-shrink: 0;
  }
}

html.docs-shell {
  scroll-behavior: auto;
  overflow-x: visible !important;
  overflow-y: auto !important;
}

/*
 * globals.css sets body { overflow-x: hidden !important } which breaks position:sticky
 * for all descendants. Use longhands — shorthand does not reliably override the bundle.
 */
body.docs-shell {
  overflow-x: visible !important;
  overflow-y: visible !important;
  font-family: var(--docs-font);
  background: var(--sp-bg-canvas);
  color: var(--sp-text-primary);
}

.docs-layout-sidebar {
  min-width: 0;
}

.docs-page {
  position: relative;
  width: 100%;
  min-height: 100vh;
  background: var(--sp-bg-canvas);
  color: var(--sp-text-primary);
  font-family: var(--docs-font);
}

.docs-site-header {
  position: sticky;
  top: 0;
  z-index: 50;
  width: 100%;
}

@media (min-width: 1024px) {
  .docs-layout-sidebar {
    position: sticky;
    top: calc(var(--docs-header-height) + var(--docs-sidebar-gap));
    align-self: flex-start;
  }

  .docs-sticky-panel {
    max-height: calc(100vh - var(--docs-header-height) - (var(--docs-sidebar-gap) * 2));
    overflow-y: auto;
    overscroll-behavior: contain;
  }
}

.docs-sticky-panel {
  border: 1px solid var(--sp-border-subtle);
  border-radius: var(--sp-radius-xl);
  background: var(--sp-bg-surface);
  padding: 1.25rem 1rem;
  scrollbar-width: thin;
  scrollbar-color: color-mix(in srgb, var(--sp-accent-primary) 35%, transparent) transparent;
}

.docs-sticky-panel--toc {
  background: var(--sp-bg-surface-secondary);
}

.docs-sticky-panel::-webkit-scrollbar {
  width: 6px;
}

.docs-sticky-panel::-webkit-scrollbar-thumb {
  background: color-mix(in srgb, var(--sp-accent-primary) 35%, transparent);
  border-radius: var(--sp-radius-pill);
}

.docs-sticky-panel::-webkit-scrollbar-track {
  background: transparent;
}

/* Sidebar / TOC nav items */
.docs-nav-label {
  font-size: var(--sp-type-micro-size);
  line-height: var(--sp-type-micro-line);
  font-weight: var(--sp-type-micro-weight);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--sp-text-tertiary);
  margin-bottom: var(--sp-space-2);
}

.docs-nav-link {
  display: block;
  width: 100%;
  text-align: left;
  font-size: var(--sp-type-callout-size);
  line-height: var(--sp-type-callout-line);
  border-radius: var(--sp-radius-md);
  padding: 0.375rem 0.5rem;
  text-decoration: none;
  color: var(--sp-text-secondary);
  transition: color 0.15s ease, background 0.15s ease;
}

.docs-nav-link:hover {
  color: var(--sp-text-primary);
  background: var(--sp-bg-hover);
}

.docs-nav-link.is-active {
  color: var(--sp-text-primary);
  background: color-mix(in srgb, var(--sp-accent-primary) 16%, transparent);
  font-weight: 600;
}

.docs-nav-link:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
}

/* Text / content links — D1 blue */
.docs-text-link,
#docs-content a {
  color: var(--docs-link-color);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.docs-text-link:hover,
#docs-content a:hover {
  color: var(--docs-link-hover);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-text-link:focus-visible,
#docs-content a:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
  border-radius: 2px;
}

#docs-content a.docs-internal-link {
  text-decoration: underline;
  text-underline-offset: 2px;
}

#docs-content a.docs-internal-link:hover {
  color: var(--docs-link-hover);
}

.docs-toc-link {
  display: block;
  color: var(--sp-text-tertiary);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s ease, text-decoration-color 0.15s ease;
}

.docs-toc-link:hover {
  color: var(--sp-text-primary);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.docs-toc-link.is-active {
  color: var(--sp-text-primary);
  font-weight: 600;
}

.docs-toc-link:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
}

.docs-toc-link-nested {
  padding-left: 0.75rem;
  font-size: var(--sp-type-callout-size);
}

/* Prose scale (D4 + type tokens) */
#docs-content {
  color: var(--sp-text-secondary);
  font-family: var(--docs-font);
  font-size: var(--sp-type-body-size);
  line-height: 1.75;
  font-weight: var(--sp-type-body-weight);
}

#docs-content h1 {
  color: var(--sp-text-primary);
  font-size: var(--sp-type-display-size);
  line-height: var(--sp-type-display-line);
  font-weight: var(--sp-type-display-weight);
  margin: 0 0 var(--sp-space-4);
}

#docs-content h2,
#docs-content h3,
#docs-content h4 {
  color: var(--sp-text-primary);
  font-weight: 700;
  line-height: 1.35;
  scroll-margin-top: calc(var(--docs-header-height) + 1.5rem);
}

#docs-content h2 {
  font-size: var(--sp-type-title-1-size);
  line-height: var(--sp-type-title-1-line);
  margin-top: 1.75rem;
  margin-bottom: 0.8rem;
  padding-top: 0.25rem;
}

#docs-content h2:first-child {
  margin-top: 0;
  border-top: 0;
  padding-top: 0;
}

#docs-content h3 {
  font-size: var(--sp-type-title-3-size);
  line-height: var(--sp-type-title-3-line);
  margin-top: 1.25rem;
  margin-bottom: 0.5rem;
}

#docs-content h4 {
  font-size: var(--sp-type-headline-size);
  line-height: var(--sp-type-headline-line);
  font-weight: var(--sp-type-headline-weight);
  margin-top: 1rem;
  margin-bottom: 0.4rem;
}

#docs-content p {
  margin: 0.55rem 0;
}

#docs-content ul,
#docs-content ol {
  margin: 0.7rem 0 0.9rem;
  padding-left: 1.3rem;
}

#docs-content ul {
  list-style: outside;
}

#docs-content ol {
  list-style: decimal;
}

#docs-content li {
  margin: 0.2rem 0;
}

#docs-content hr {
  margin: 1.2rem 0;
  border: 0;
  border-top: 1px solid var(--sp-border-subtle);
}

#docs-content strong {
  color: var(--sp-text-primary);
  font-weight: var(--sp-type-body-strong-weight);
}

#docs-content blockquote,
#docs-content .docs-callout {
  margin: 1rem 0;
  padding: 0.85rem 1rem;
  border-radius: var(--sp-radius-lg);
  border: 1px solid var(--sp-border-subtle);
  border-left: 3px solid var(--sp-status-info-fg);
  background: var(--sp-status-info-bg);
  color: var(--sp-text-secondary);
}

#docs-content .docs-callout--info {
  border-left-color: var(--sp-status-info-fg);
  background: var(--sp-status-info-bg);
}

#docs-content .docs-callout--warning {
  border-left-color: var(--sp-status-warning-fg);
  background: var(--sp-status-warning-bg);
}

#docs-content .docs-callout--danger {
  border-left-color: var(--sp-status-danger-fg);
  background: var(--sp-status-danger-bg);
}

#docs-content .docs-callout--success {
  border-left-color: var(--sp-status-success-fg);
  background: var(--sp-status-success-bg);
}

#docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
  font-size: var(--sp-type-callout-size);
}

#docs-content th,
#docs-content td {
  border: 1px solid var(--sp-border-default);
  padding: 0.55rem 0.65rem;
  vertical-align: top;
}

#docs-content th {
  color: var(--sp-text-primary);
  background: var(--sp-bg-surface-secondary);
  font-weight: 600;
}

#docs-content code {
  font-family: var(--docs-mono);
  font-size: 0.9em;
  color: var(--sp-text-primary);
  background: var(--sp-bg-surface-secondary);
  border: 1px solid var(--sp-border-subtle);
  border-radius: var(--sp-radius-xs);
  padding: 0.1em 0.35em;
}

#docs-content pre {
  margin: 1rem 0;
  padding: 1rem 1.15rem;
  border-radius: var(--sp-radius-lg);
  border: 1px solid var(--sp-border-subtle);
  background: var(--sp-bg-surface-secondary);
  color: var(--sp-text-secondary);
  overflow-x: auto;
}

#docs-content pre code {
  background: transparent;
  border: 0;
  padding: 0;
  font-size: var(--sp-type-callout-size);
  line-height: 1.55;
  color: inherit;
}

#docs-content img {
  max-width: 100%;
  height: auto;
  border-radius: var(--sp-radius-lg);
}

.docs-flow-diagram {
  margin: 1.25rem 0;
  padding: 1.25rem 1.5rem;
  border: 1px solid var(--sp-border-subtle);
  border-radius: var(--sp-radius-xl);
  background: var(--sp-bg-surface-secondary);
  max-width: 28rem;
}

.docs-flow-step {
  text-align: center;
}

.docs-flow-step-title {
  color: var(--sp-text-primary);
  font-weight: 600;
  font-size: 1.05rem;
}

.docs-flow-step-subtitle {
  color: var(--sp-text-tertiary);
  font-size: 0.92rem;
  margin-top: 0.2rem;
}

.docs-flow-arrow {
  color: var(--sp-accent-primary);
  font-size: 1.25rem;
  line-height: 1;
  padding: 0.35rem 0;
  text-align: center;
}

.docs-tree-diagram {
  margin: 1rem 0;
  padding: 1rem 1.25rem;
  border: 1px solid var(--sp-border-subtle);
  border-radius: var(--sp-radius-lg);
  background: var(--sp-bg-surface-secondary);
  color: var(--sp-text-secondary);
  font-family: var(--docs-mono);
  font-size: 0.9rem;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-x: auto;
}

.docs-search-panel {
  position: absolute;
  top: calc(100% + 0.35rem);
  left: 0;
  right: 0;
  z-index: 60;
  border: 1px solid var(--sp-border-subtle);
  border-radius: var(--sp-radius-lg);
  background: var(--sp-bg-elevated);
  box-shadow: var(--sp-elevation-2);
  max-height: 22rem;
  overflow-y: auto;
}

.docs-search-list {
  list-style: none;
  margin: 0;
  padding: 0.35rem;
}

.docs-search-hit {
  display: block;
  padding: 0.55rem 0.65rem;
  border-radius: var(--sp-radius-sm);
  text-decoration: none;
}

.docs-search-hit:hover,
.docs-search-hit:focus {
  background: var(--sp-bg-hover);
  outline: none;
}

.docs-search-hit:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 0;
}

.docs-search-hit-title {
  display: block;
  color: var(--sp-text-primary);
  font-size: 0.9rem;
  font-weight: 500;
}

.docs-search-hit-meta {
  display: block;
  color: var(--sp-text-tertiary);
  font-size: 0.75rem;
  margin-top: 0.1rem;
  text-transform: capitalize;
}

.docs-search-empty {
  padding: 0.75rem 1rem;
  color: var(--sp-text-tertiary);
  font-size: 0.85rem;
}

.docs-card {
  display: block;
  border-radius: var(--sp-radius-xl);
  border: 1px solid var(--sp-border-subtle);
  background: var(--sp-bg-surface);
  padding: var(--sp-space-5);
  transition: border-color 0.15s ease, background 0.15s ease;
  text-decoration: none;
  color: inherit;
}

.docs-card:hover {
  border-color: color-mix(in srgb, var(--sp-accent-chrome) 30%, var(--sp-border-subtle));
  background: var(--sp-bg-surface-secondary);
}

.docs-card:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
}

.docs-surface {
  border-radius: var(--sp-radius-xl);
  border: 1px solid var(--sp-border-subtle);
  background: var(--sp-bg-surface);
}

.docs-hero-panel {
  border-radius: calc(var(--sp-radius-xl) + 6px);
  border: 1px solid var(--sp-border-subtle);
  background: var(--sp-bg-surface);
  padding: var(--sp-space-6) var(--sp-space-6);
  box-shadow: var(--sp-elevation-1);
}

.docs-btn-accent {
  display: inline-flex;
  align-items: center;
  border-radius: var(--sp-radius-md);
  background: var(--sp-button-accent-bg);
  color: var(--sp-button-accent-label);
  padding: 0.625rem 1rem;
  font-size: var(--sp-type-callout-size);
  font-weight: 500;
  text-decoration: none;
  transition: background 0.15s ease;
}

.docs-btn-accent:hover {
  background: var(--sp-button-accent-bg-hover);
  color: var(--sp-button-accent-label);
  text-decoration: none;
}

.docs-btn-accent:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
}

.docs-btn-secondary {
  display: inline-flex;
  align-items: center;
  border-radius: var(--sp-radius-md);
  border: 1px solid var(--sp-button-secondary-border);
  background: var(--sp-button-secondary-bg);
  color: var(--sp-button-secondary-label);
  padding: 0.625rem 1rem;
  font-size: var(--sp-type-callout-size);
  text-decoration: none;
  transition: filter 0.15s ease;
}

.docs-btn-secondary:hover {
  filter: brightness(0.97);
  text-decoration: none;
  color: var(--sp-button-secondary-label);
}

.docs-btn-secondary:focus-visible {
  outline: 2px solid var(--sp-focus-ring);
  outline-offset: 2px;
}

/* Embedded product screenshots */
.docs-screenshot {
  margin: 1.25rem 0 1.5rem;
  border: 1px solid var(--sp-border-subtle);
  border-radius: var(--sp-radius-xl);
  overflow: hidden;
  background: var(--sp-bg-surface-secondary);
  box-shadow: var(--sp-elevation-1);
}

.docs-screenshot img {
  display: block;
  width: 100%;
  height: auto;
  vertical-align: middle;
  border-radius: 0;
}

.docs-screenshot figcaption {
  padding: 0.65rem 1rem;
  font-size: var(--sp-type-callout-size);
  color: var(--sp-text-tertiary);
  border-top: 1px solid var(--sp-border-subtle);
  background: var(--sp-bg-surface);
}
