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

:root {
  --color-bg: #0a0a0f;
  --color-surface: #12121a;
  --color-surface-hover: #1a1a25;
  --color-border: #2a2a3a;
  --color-border-subtle: #1e1e2a;
  --color-text: #e4e4ec;
  --color-text-muted: #9494a8;
  --color-text-secondary: #b4b4c8;
  --color-primary: #6366f1;
  --color-primary-hover: #818cf8;
  --color-accent: #22d3ee;
  --radius: 8px;
  --container-max: 1000px;
}

html {
  scroll-behavior: smooth;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.7;
  -webkit-font-smoothing: antialiased;
}

.docs-page {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 2.5rem;
  max-width: var(--container-max);
  margin: 0 auto;
  padding: 80px 24px 60px;
}

/* Sidebar */
.docs-sidebar {
  position: sticky;
  top: 80px;
  height: fit-content;
}

.docs-sidebar nav ul {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.docs-sidebar nav a {
  display: block;
  padding: 6px 12px;
  font-size: 0.82rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 6px;
  transition: all 0.15s;
}

.docs-sidebar nav a:hover {
  color: var(--color-text);
  background: var(--color-surface);
}

.docs-sidebar nav a.active {
  color: var(--color-primary-hover);
  background: rgba(99, 102, 241, 0.1);
  font-weight: 500;
}

/* Header */
.docs-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 100;
  background: rgba(10, 10, 15, 0.85);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--color-border);
  height: 56px;
  display: flex;
  align-items: center;
  padding: 0 24px;
}

.docs-header a {
  text-decoration: none;
  color: var(--color-text);
  font-weight: 700;
  font-size: 0.95rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.docs-header .logo svg {
  color: var(--color-primary-hover);
  flex-shrink: 0;
}

.docs-header .back-link {
  margin-left: auto;
  font-size: 0.82rem;
  font-weight: 500;
  color: var(--color-text-muted);
}

.docs-header .back-link:hover {
  color: var(--color-primary-hover);
}

/* Content */
.docs-content {
  min-width: 0;
}

.docs-content h1 {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
  letter-spacing: -0.02em;
}

.docs-content h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin-top: 2.5rem;
  margin-bottom: 0.6rem;
  padding-bottom: 0.4rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.docs-content h3 {
  font-size: 1rem;
  font-weight: 600;
  margin-top: 1.75rem;
  margin-bottom: 0.4rem;
}

.docs-content p {
  color: var(--color-text-secondary);
  margin-bottom: 1rem;
}

.docs-content ul,
.docs-content ol {
  padding-left: 1.25rem;
  margin-bottom: 1rem;
  color: var(--color-text-secondary);
}

.docs-content li {
  margin-bottom: 0.35rem;
}

.docs-content code {
  font-family: "JetBrains Mono", "Fira Code", monospace;
  font-size: 0.82em;
  background: var(--color-surface);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--color-primary-hover);
}

.docs-content pre {
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  overflow-x: auto;
  margin-bottom: 1.25rem;
  font-size: 0.82rem;
  line-height: 1.7;
}

.docs-content pre code {
  background: none;
  padding: 0;
  color: var(--color-text);
}

.docs-content table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.docs-content th,
.docs-content td {
  text-align: left;
  padding: 0.5rem 0.75rem;
  border-bottom: 1px solid var(--color-border-subtle);
}

.docs-content th {
  font-weight: 600;
  color: var(--color-text);
  background: var(--color-surface);
}

.docs-content td {
  color: var(--color-text-secondary);
}

.docs-content td code {
  font-size: 0.8em;
}

.docs-content blockquote {
  border-left: 3px solid var(--color-primary);
  padding: 0.75rem 1rem;
  margin: 0 0 1rem 0;
  background: rgba(99, 102, 241, 0.05);
  border-radius: 0 var(--radius) var(--radius) 0;
}

.docs-content blockquote p {
  margin-bottom: 0;
}

/* Mobile menu toggle */
.docs-menu-toggle {
  display: none;
  align-items: center;
  gap: 0.4rem;
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: 6px;
  color: var(--color-text);
  padding: 0.5rem 0.75rem;
  font-size: 0.85rem;
  font-family: "Inter", sans-serif;
  cursor: pointer;
  margin-bottom: 1rem;
}

.docs-menu-toggle:hover {
  background: var(--color-surface-hover);
  border-color: var(--color-primary);
}

.docs-drawer-overlay {
  display: none;
}

/* Sidebar subnav (rule categories) */
.docs-subnav {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding-left: 0.75rem;
  margin-top: 0.15rem;
  border-left: 1px solid var(--color-border-subtle);
  margin-left: 0.75rem;
}

.docs-subnav a {
  display: block;
  padding: 4px 10px;
  font-size: 0.74rem;
  color: var(--color-text-muted);
  text-decoration: none;
  border-radius: 4px;
  transition: all 0.15s;
}

.docs-subnav a:hover {
  color: var(--color-text-secondary);
  background: var(--color-surface);
}

.docs-subnav a.active {
  color: var(--color-primary-hover);
  background: rgba(99, 102, 241, 0.1);
  font-weight: 500;
}

/* Severity badges */
.severity-badge {
  display: inline-block;
  padding: 0.15em 0.45em;
  font-size: 0.65rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.sev-critical { background: rgba(239, 68, 68, 0.12); color: #ef4444; }
.sev-high { background: rgba(249, 115, 22, 0.1); color: #f97316; }
.sev-medium { background: rgba(234, 179, 8, 0.1); color: #eab308; }
.sev-low { background: rgba(59, 130, 246, 0.1); color: #3b82f6; }
.sev-info { background: rgba(161, 161, 170, 0.1); color: #9494a8; }

/* Category card grid */
.category-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.category-card {
  display: block;
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: 10px;
  padding: 1rem 1.25rem;
  text-decoration: none;
  color: inherit;
  transition: all 0.15s;
}

.category-card:hover {
  border-color: var(--color-primary);
  background: var(--color-surface-hover);
  text-decoration: none;
}

.category-card h3 {
  font-size: 0.9rem;
  font-weight: 600;
  color: var(--color-text);
  margin: 0 0 0.25rem;
}

.category-card .rule-count {
  font-size: 0.78rem;
  color: var(--color-text-muted);
  margin-bottom: 0.5rem;
  font-family: "JetBrains Mono", "Fira Code", monospace;
}

.category-card .severity-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}

/* Preset cards */
.preset-card {
  background: var(--color-surface);
  border: 1px solid var(--color-border-subtle);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.preset-card h3 {
  margin-top: 0;
  font-size: 1rem;
  font-weight: 600;
}

.preset-card .rule-count {
  font-size: 0.85rem;
  color: var(--color-text-muted);
}

.preset-card p {
  margin-bottom: 0.5rem;
}

/* Description list for FAQ / troubleshooting */
.docs-content dt {
  font-weight: 600;
  margin-top: 0.75rem;
  color: var(--color-text);
}

.docs-content dd {
  color: var(--color-text-secondary);
  margin-left: 1rem;
  margin-top: 0.25rem;
}

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

  .docs-menu-toggle {
    display: flex;
  }

  .docs-sidebar {
    position: fixed;
    top: 0;
    left: -280px;
    width: 260px;
    height: 100vh;
    background: var(--color-bg);
    border-right: 1px solid var(--color-border);
    padding: 1.5rem 1rem;
    z-index: 100;
    transition: left 0.25s ease;
    overflow-y: auto;
  }

  .docs-sidebar.open {
    left: 0;
  }

  .docs-drawer-overlay.visible {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 99;
  }
}

.download-buttons {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  margin: 1rem 0 1.5rem;
}

.download-btn {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.7rem 0.9rem;
  background: #1a1a2e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  text-decoration: none;
  color: #e0e0e8;
  transition: border-color 0.15s, background 0.15s;
}

.download-btn:hover {
  border-color: #818cf8;
  background: #22223a;
  text-decoration: none;
}

.download-icon {
  font-size: 1.4rem;
}

.download-info {
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
}

.download-info strong {
  font-size: 0.85rem;
  font-weight: 600;
}

.download-info small {
  font-size: 0.72rem;
  color: #9494a8;
}

/* Rule subnav (individual rules within a category) */
.docs-subnav-rules {
  list-style: none;
  padding: 0;
  margin: 0.15rem 0 0 0.75rem;
}
.docs-subnav-rules a {
  display: block;
  padding: 0.15rem 0.5rem;
  font-size: 0.68rem;
  font-family: 'SFMono-Regular', Consolas, monospace;
  color: #9494a8;
  border-radius: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.docs-subnav-rules a:hover {
  color: #818cf8;
  background: rgba(129, 140, 248, 0.06);
}
.docs-subnav-rules a.active {
  color: #818cf8;
  background: rgba(129, 140, 248, 0.1);
  font-weight: 600;
}

/* Breadcrumb */
.breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.78rem;
  color: #9494a8;
  margin-bottom: 1rem;
}
.breadcrumb a { color: #9494a8; }
.breadcrumb a:hover { color: #a5b4fc; }
.breadcrumb .sep { color: #2a2a3a; }

/* Rule title row */
.rule-title-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

/* Rule key display */
.rule-key-display {
  margin-top: -0.5rem;
  margin-bottom: 1rem;
}
.rule-key-display code {
  font-size: 0.78rem;
}

/* Short description */
.short-desc {
  font-size: 1rem;
  color: #b0b0c0;
  line-height: 1.7;
  margin-bottom: 1.5rem;
  border-left: 3px solid #818cf8;
  padding-left: 1rem;
}

/* Example grid */
.example-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}
@media (max-width: 640px) {
  .example-grid { grid-template-columns: 1fr; }
}
.example-card {
  border-radius: 8px;
  border: 1px solid #2a2a3a;
  overflow: hidden;
}
.example-card pre {
  margin: 0;
  border: none;
  border-radius: 0;
  font-size: 0.75rem;
  line-height: 1.5;
}
.example-label {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.75rem;
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.example-bad .example-label {
  background: rgba(239, 68, 68, 0.1);
  color: #ef4444;
}
.example-good .example-label {
  background: rgba(34, 197, 94, 0.1);
  color: #22c55e;
}

/* Snippet container with copy button */
.snippet-container {
  position: relative;
  margin-bottom: 1.5rem;
}
.snippet-container pre {
  padding-top: 2.5rem;
}
.copy-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  display: flex;
  align-items: center;
  gap: 0.3rem;
  background: #22223a;
  border: 1px solid #2a2a3a;
  border-radius: 6px;
  color: #b0b0c0;
  padding: 0.3rem 0.6rem;
  font-size: 0.72rem;
  font-family: 'Inter', sans-serif;
  cursor: pointer;
  transition: all 0.15s;
  z-index: 2;
}
.copy-btn:hover {
  background: #2a2a3a;
  color: #e0e0e8;
  border-color: #818cf8;
}

/* Rule navigation (prev/next) */
.rule-nav {
  margin-top: 2rem;
  padding-top: 1rem;
  border-top: 1px solid #2a2a3a;
}
.nav-links-row {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
}
.nav-prev, .nav-next {
  font-size: 0.82rem;
  font-weight: 500;
  max-width: 45%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.nav-next { margin-left: auto; text-align: right; }

/* Rules grid (category page) */
.rules-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 0.6rem;
  margin-top: 1rem;
}
.rule-card-link {
  text-decoration: none;
  color: inherit;
}
.rule-card-link:hover { text-decoration: none; }
.rule-card {
  padding: 1rem 1.2rem;
  background: #1a1a2e;
  border: 1px solid #2a2a3a;
  border-radius: 8px;
  transition: border-color 0.15s;
}
.rule-card:hover {
  border-color: #818cf8;
}
.rule-card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.3rem;
}
.rule-card-header code {
  font-size: 0.72rem;
  color: #9494a8;
}
.rule-card h3 {
  margin: 0 0 0.3rem;
  font-size: 0.88rem;
  font-weight: 600;
  color: #e0e0e8;
}
.rule-card p {
  margin: 0;
  font-size: 0.78rem;
  color: #9494a8;
  line-height: 1.5;
}

/* Rule links inside lists */
.rule-link {
  text-decoration: none;
  color: inherit;
  display: block;
  padding: 0.25rem 0;
  border-radius: 4px;
  transition: color 0.15s;
}
.rule-link:hover {
  color: #a5b4fc;
  text-decoration: none;
}
.rule-link:hover code {
  color: #818cf8;
}

.docs-footer {
  text-align: center;
  padding: 1.5rem 2rem;
  color: #94a3b8;
  font-size: 0.85rem;
  border-top: 1px solid #1e293b;
  margin-top: 2rem;
}
.docs-footer p {
  margin: 0;
}

.freshness-date {
  display: block;
  color: #64748b;
  font-size: 0.82rem;
  margin-bottom: 1rem;
}

.rule-card-title {
  font-size: 1rem;
  font-weight: 600;
  margin: 0.5rem 0 0.4rem;
  color: #e2e8f0;
}
