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

body {
  font-family: 'Inter', system-ui, sans-serif;
  background: var(--cs-background);
  color: var(--cs-text);
  min-height: 100vh;
}

a {
  color: inherit;
}

/* ── Top navigation ── */
.docs-topnav {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 200;
  height: 56px;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0 24px;
  border-bottom: 1px solid var(--cs-border);
  background: color-mix(in srgb, var(--cs-surface) 88%, transparent);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
}

.hamburger {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  background: var(--cs-surface);
  color: var(--cs-text);
  cursor: pointer;
  flex-shrink: 0;
  transition: background 0.15s, border-color 0.15s;
}

.hamburger:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--cs-primary);
}

.hamburger-icon {
  display: flex;
  flex-direction: column;
  gap: 5px;
  width: 18px;
}

.hamburger-icon span {
  display: block;
  height: 2px;
  background: currentColor;
  border-radius: 1px;
  transition: transform 0.2s, opacity 0.2s;
}

/* ── Docs page: hamburger in shared nav ── */
body.docs-page .docs-hamburger {
  display: none;
}

body.docs-page .nav.sidebar-open .hamburger-icon span:nth-child(1) {
  transform: translateY(7px) rotate(45deg);
}

body.docs-page .nav.sidebar-open .hamburger-icon span:nth-child(2) {
  opacity: 0;
}

body.docs-page .nav.sidebar-open .hamburger-icon span:nth-child(3) {
  transform: translateY(-7px) rotate(-45deg);
}

@media (max-width: 900px) {
  body.docs-page .docs-hamburger {
    display: flex;
  }
}

.topnav-search-wrap {
  flex: 1;
  max-width: 360px;
  position: relative;
}

.topnav-search {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  background: var(--cs-surface);
  color: var(--cs-text);
  font-size: 14px;
  outline: none;
  transition: border-color 0.15s;
}

.topnav-search:focus {
  border-color: var(--cs-primary);
}

.topnav-search-icon {
  position: absolute;
  left: 12px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--cs-text-muted);
  font-size: 14px;
  pointer-events: none;
}

.topnav-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
}

.theme-dropdown {
  position: relative;
}

.theme-dropdown-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  background: var(--cs-surface);
  color: var(--cs-text);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}

.theme-dropdown-btn:hover {
  border-color: var(--cs-primary);
}

.theme-dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  min-width: 160px;
  background: var(--cs-surface);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  padding: 4px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  z-index: 300;
}

.theme-dropdown.open .theme-dropdown-menu {
  display: block;
}

.theme-option {
  display: block;
  width: 100%;
  padding: 8px 12px;
  border: none;
  border-radius: 6px;
  background: none;
  color: var(--cs-text);
  font-size: 13px;
  text-align: left;
  cursor: pointer;
  transition: background 0.15s;
}

.theme-option:hover,
.theme-option.active {
  background: rgba(124, 58, 237, 0.12);
  color: var(--cs-primary);
}

.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 140;
  background: rgba(0, 0, 0, 0.55);
}

.sidebar-overlay.visible {
  display: block;
}

/* ── Sidebar ── */
.docs-sidebar {
  position: fixed;
  top: 56px;
  left: 0;
  bottom: 0;
  width: 240px;
  z-index: 150;
  overflow-y: auto;
  border-right: 1px solid var(--cs-border);
  background: var(--cs-background);
  padding: 16px 0 32px;
}

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 20px 16px;
  text-decoration: none;
}

.sidebar-logo img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-size: 16px;
  font-weight: 800;
  background: linear-gradient(135deg, #7c3aed, #0ea5e9);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

.sidebar-search-wrap {
  padding: 0 16px 16px;
  position: sticky;
  top: 0;
  background: var(--cs-background);
  z-index: 1;
}

.sidebar-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  background: var(--cs-background);
  color: var(--cs-text);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.sidebar-search:focus {
  border-color: var(--cs-primary);
}

.sidebar-nav {
  padding: 0 0 8px;
}

.sidebar-group {
  margin-bottom: 8px;
}

.sidebar-group.hidden {
  display: none;
}

.sidebar-group-title {
  padding: 10px 20px 4px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--cs-text-muted);
}

.sidebar-link {
  display: block;
  padding: 6px 20px;
  font-size: 13px;
  color: var(--cs-text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.sidebar-link:hover {
  color: var(--cs-text);
}

.sidebar-link.active {
  color: #7c3aed;
  font-weight: 500;
}

.sidebar-link.hidden {
  display: none;
}

/* ── Main content ── */
.docs-main {
  margin-left: 240px;
  padding: 72px 40px 80px;
  max-width: 960px;
}

.doc-section {
  margin-bottom: 72px;
  scroll-margin-top: 88px;
}

.doc-section h2 {
  font-size: 1.85rem;
  font-weight: 700;
  margin-bottom: 10px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--cs-border);
}

.doc-section h3 {
  font-size: 1.15rem;
  font-weight: 600;
  margin: 32px 0 12px;
}

.doc-lead {
  color: var(--cs-text-muted);
  line-height: 1.8;
  margin-bottom: 24px;
  font-size: 15px;
}

.doc-section p {
  color: var(--cs-text-muted);
  line-height: 1.75;
  margin-bottom: 16px;
}

/* ── Preview boxes ── */
.preview-box {
  background: var(--cs-background);
  border: 1px solid var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  padding: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.preview-box--column {
  flex-direction: column;
  align-items: stretch;
}

.preview-box--stretch {
  align-items: stretch;
}

.preview-box--cards {
  gap: 16px;
}

.preview-card-item {
  flex: 1;
  min-width: 180px;
}

.preview-input-stack {
  max-width: 420px;
  width: 100%;
  margin: 0 auto;
}

.preview-progress-stack {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
}

.preview-alert-stack {
  width: 100%;
}

/* ── Code tabs ── */
.code-tabs {
  margin-bottom: 24px;
}

.code-tab-bar {
  display: flex;
  gap: 20px;
  background: none;
  border: none;
  border-bottom: 1px solid var(--cs-border);
  border-radius: 0;
  padding: 0;
  margin-bottom: 0;
}

.code-tab-btn {
  padding: 8px 0;
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--cs-text-muted);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: -1px;
}

.code-tab-btn:hover {
  color: var(--cs-text);
}

.code-tab-btn.active {
  background: none;
  color: var(--cs-text);
  border-bottom-color: #7c3aed;
}

.code-tab-panel {
  display: none;
}

.code-tab-panel.active {
  display: block;
}

/* ── Code blocks ── */
.code-block {
  position: relative;
  background: #0d0b1a;
  border: 1px solid var(--cs-border);
  border-radius: 0 0 var(--cs-radius, 8px) var(--cs-radius, 8px);
  padding: 20px 52px 20px 20px;
  font-family: ui-monospace, 'Cascadia Code', 'Fira Code', monospace;
  font-size: 13px;
  line-height: 1.75;
  overflow-x: auto;
  color: #e2e8f0;
}

.code-tabs .code-block {
  border-radius: 0 0 var(--cs-radius, 8px) var(--cs-radius, 8px);
}

.code-block--standalone {
  border-radius: var(--cs-radius, 8px);
  margin-bottom: 20px;
}

.code-block pre {
  margin: 0;
  white-space: pre;
  font-family: inherit;
}

.code-comment { color: #64748b; }
.code-tag { color: #a78bfa; }
.code-attr { color: #38bdf8; }
.code-val { color: #4ade80; }
.code-kw { color: #f472b6; }
.code-fn { color: #fbbf24; }
.code-str { color: #4ade80; }
.code-punc { color: #94a3b8; }

.copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: var(--cs-text-muted);
  padding: 5px 10px;
  border-radius: 6px;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.copy-btn:hover {
  background: var(--cs-primary);
  border-color: var(--cs-primary);
  color: #fff;
}

.copy-btn.copied {
  background: #22c55e;
  border-color: #22c55e;
  color: #fff;
}

/* ── Tables ── */
.class-table,
.props-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
  margin: 16px 0 24px;
}

.class-table th,
.props-table th {
  text-align: left;
  padding: 10px 14px;
  background: var(--cs-surface);
  border-bottom: 1px solid var(--cs-border);
  font-weight: 600;
  color: var(--cs-text-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.class-table td,
.props-table td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--cs-border);
  vertical-align: top;
}

.class-table tr:hover td,
.props-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.class-name {
  font-family: ui-monospace, monospace;
  color: var(--cs-primary);
  font-size: 12px;
  white-space: nowrap;
}

.prop-name {
  font-family: ui-monospace, monospace;
  color: #0ea5e9;
  font-size: 12px;
}

.prop-type {
  font-family: ui-monospace, monospace;
  color: var(--cs-text-muted);
  font-size: 12px;
}

/* ── Callouts ── */
.callout {
  padding: 14px 16px;
  border-radius: var(--cs-radius, 8px);
  border-left: 4px solid var(--cs-primary);
  background: rgba(124, 58, 237, 0.08);
  margin: 20px 0;
  font-size: 14px;
  line-height: 1.65;
  color: var(--cs-text-muted);
}

.callout--tip {
  border-color: #22c55e;
  background: rgba(34, 197, 94, 0.08);
}

.callout--warning {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
}

/* ── Demo utilities (preview-only, not inline styles) ── */
.avatar-demo {
  color: #fff;
}

.avatar-demo--purple { background: #7c3aed; }
.avatar-demo--blue { background: #0ea5e9; }
.avatar-demo--green { background: #22c55e; }
.avatar-demo--pink { background: #ec4899; }
.avatar-demo--muted { background: var(--cs-border); color: var(--cs-text); }

.progress-w-30 { width: 30%; }
.progress-w-45 { width: 45%; }
.progress-w-65 { width: 65%; }
.progress-w-80 { width: 80%; }
.progress-w-85 { width: 85%; }

.size-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  width: 100%;
  justify-content: center;
}

.size-label {
  font-size: 12px;
  color: var(--cs-text-muted);
  min-width: 56px;
  text-align: right;
}

.variant-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  justify-content: center;
  width: 100%;
}

/* ── Stub / coming-soon sections ── */
.doc-stub {
  padding: 24px;
  border: 1px dashed var(--cs-border);
  border-radius: var(--cs-radius, 8px);
  text-align: center;
  color: var(--cs-text-muted);
  font-size: 14px;
  margin-top: 16px;
}

/* docs footer uses shared .site-footer from shadcn.css */

/* ── Responsive ── */
@media (max-width: 900px) {
  .hamburger {
    display: flex;
  }

  .docs-sidebar {
    transform: translateX(-100%);
    transition: transform 0.25s ease;
    top: 60px;
    padding-top: 12px;
  }

  .docs-sidebar.open {
    transform: translateX(0);
  }

  .docs-main {
    margin-left: 0;
    padding-left: 24px;
    padding-right: 24px;
  }

  .topnav-search-wrap {
    max-width: none;
  }
}

@media (max-width: 540px) {
  .topnav-search-wrap {
    display: none;
  }

  .docs-main {
    padding: 72px 16px 48px;
  }
}
