/* SpecDrive docs — modern theme */
:root {
  --bg: #06080c;
  --bg-elevated: #0c1018;
  --bg-card: rgba(14, 20, 32, 0.72);
  --bg-code: #080b12;
  --border: rgba(148, 163, 184, 0.12);
  --border-hover: rgba(56, 189, 248, 0.35);
  --text: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent: #38bdf8;
  --accent-2: #818cf8;
  --accent-glow: rgba(56, 189, 248, 0.45);
  --green: #34d399;
  --purple: #a78bfa;
  --radius: 14px;
  --radius-sm: 8px;
  --font: "Inter", system-ui, sans-serif;
  --mono: "JetBrains Mono", ui-monospace, monospace;
  --nav-h: 68px;
  --sidebar-w: 260px;
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
}

[data-theme="light"] {
  --bg: #f8fafc;
  --bg-elevated: #ffffff;
  --bg-card: rgba(255, 255, 255, 0.85);
  --bg-code: #f1f5f9;
  --border: rgba(15, 23, 42, 0.1);
  --border-hover: rgba(14, 165, 233, 0.4);
  --text: #0f172a;
  --text-muted: #475569;
  --text-dim: #64748b;
  --accent-glow: rgba(14, 165, 233, 0.25);
  --shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

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

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  line-height: 1.7;
  font-size: 16px;
  overflow-x: hidden;
  transition: background 0.4s var(--ease), color 0.4s var(--ease);
}

/* Animated mesh background */
.bg-mesh {
  position: fixed;
  inset: 0;
  z-index: -2;
  overflow: hidden;
  pointer-events: none;
}

.bg-mesh::before {
  content: "";
  position: absolute;
  width: 140%;
  height: 140%;
  top: -20%;
  left: -20%;
  background:
    radial-gradient(ellipse 50% 40% at 20% 20%, rgba(56, 189, 248, 0.15), transparent 50%),
    radial-gradient(ellipse 45% 35% at 80% 10%, rgba(129, 140, 248, 0.12), transparent 50%),
    radial-gradient(ellipse 40% 30% at 60% 80%, rgba(52, 211, 153, 0.08), transparent 50%);
  animation: mesh-drift 22s ease-in-out infinite alternate;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -1;
  background-image:
    linear-gradient(rgba(148, 163, 184, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(148, 163, 184, 0.04) 1px, transparent 1px);
  background-size: 64px 64px;
  mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, black, transparent);
}

@keyframes mesh-drift {
  0% { transform: translate(0, 0) rotate(0deg); }
  100% { transform: translate(-3%, 2%) rotate(2deg); }
}

a { color: var(--accent); text-decoration: none; transition: color 0.2s; }
a:hover { color: var(--accent-2); }

/* Header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 200;
  height: var(--nav-h);
  border-bottom: 1px solid var(--border);
  background: color-mix(in srgb, var(--bg) 75%, transparent);
  backdrop-filter: blur(20px) saturate(1.4);
  transition: border-color 0.3s, box-shadow 0.3s;
}

.site-header.scrolled {
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 1.5rem;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--text);
  text-decoration: none;
  letter-spacing: -0.02em;
}

.brand:hover { text-decoration: none; }

.brand-mark {
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  display: grid;
  place-items: center;
  box-shadow: 0 0 24px var(--accent-glow);
}

.brand-mark svg { width: 18px; height: 18px; }

.nav-right {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 0.15rem;
  list-style: none;
}

.nav-links a {
  color: var(--text-muted);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s var(--ease);
}

.nav-links a:hover,
.nav-links a.active {
  color: var(--text);
  background: var(--bg-elevated);
  text-decoration: none;
}

.nav-links a.active {
  box-shadow: inset 0 0 0 1px var(--border);
}

.nav-cta {
  background: linear-gradient(135deg, var(--accent), var(--accent-2)) !important;
  color: #06080c !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 20px var(--accent-glow);
}

.nav-cta:hover {
  transform: translateY(-1px);
  box-shadow: 0 8px 28px var(--accent-glow);
}

.theme-toggle, .menu-btn {
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--text-muted);
  cursor: pointer;
  display: grid;
  place-items: center;
  font-size: 1rem;
  transition: all 0.25s var(--ease);
}

.theme-toggle:hover, .menu-btn:hover {
  border-color: var(--border-hover);
  color: var(--text);
}

.menu-btn { display: none; }

/* Layout */
main { padding: 0 1.5rem 5rem; }

.container { max-width: 1100px; margin: 0 auto; }
.container-narrow { max-width: 780px; margin: 0 auto; }

/* Hero */
.hero {
  text-align: center;
  padding: 5rem 0 4rem;
  position: relative;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  background: var(--bg-card);
  border: 1px solid var(--border);
  padding: 0.35rem 1rem;
  border-radius: 999px;
  margin-bottom: 1.75rem;
  backdrop-filter: blur(12px);
  animation: fade-up 0.8s var(--ease) both;
}

.hero-badge .pulse {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--green);
  box-shadow: 0 0 12px var(--green);
  animation: pulse 2s ease infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.5; transform: scale(0.85); }
}

.hero h1 {
  font-size: clamp(2.5rem, 6vw, 4rem);
  font-weight: 800;
  letter-spacing: -0.04em;
  line-height: 1.08;
  margin-bottom: 1.25rem;
  animation: fade-up 0.8s var(--ease) 0.1s both;
}

.gradient-text {
  background: linear-gradient(135deg, var(--text) 0%, var(--accent) 50%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.hero p.lead {
  font-size: 1.2rem;
  color: var(--text-muted);
  max-width: 620px;
  margin: 0 auto 2rem;
  animation: fade-up 0.8s var(--ease) 0.2s both;
}

.hero-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.85rem;
  justify-content: center;
  animation: fade-up 0.8s var(--ease) 0.3s both;
}

@keyframes fade-up {
  from { opacity: 0; transform: translateY(24px); }
  to { opacity: 1; transform: translateY(0); }
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  border: 1px solid transparent;
  transition: all 0.3s var(--ease);
  cursor: pointer;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #06080c;
  box-shadow: 0 8px 32px var(--accent-glow);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 40px var(--accent-glow);
  text-decoration: none;
}

.btn-secondary {
  background: var(--bg-card);
  color: var(--text);
  border-color: var(--border);
  backdrop-filter: blur(8px);
}

.btn-secondary:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
  text-decoration: none;
}

/* Stack pills */
.stack-pills {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  justify-content: center;
  margin-top: 2.5rem;
  animation: fade-up 0.8s var(--ease) 0.4s both;
}

.pill {
  padding: 0.35rem 0.9rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--text-muted);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(8px);
  transition: all 0.3s var(--ease);
}

.pill:hover {
  border-color: var(--border-hover);
  color: var(--accent);
  transform: translateY(-2px);
}

/* Sections */
section { margin-bottom: 4rem; }

.section-label {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 0.75rem;
}

h2 {
  font-size: clamp(1.5rem, 3vw, 2rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 1rem;
  color: var(--text);
}

h3 {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  color: var(--text);
}

p { margin-bottom: 1rem; color: var(--text-muted); }
p strong, li strong { color: var(--text); }

.reveal {
  opacity: 0;
  transform: translateY(28px);
  transition: opacity 0.7s var(--ease), transform 0.7s var(--ease);
}

.reveal.visible {
  opacity: 1;
  transform: translateY(0);
}

/* Cards */
.grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 1.15rem;
  margin: 2rem 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  backdrop-filter: blur(16px);
  transition: all 0.35s var(--ease);
  position: relative;
  overflow: hidden;
}

.card::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.06), transparent 60%);
  opacity: 0;
  transition: opacity 0.35s;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-4px);
  box-shadow: var(--shadow);
}

.card:hover::before { opacity: 1; }

.card > * { position: relative; z-index: 1; }

.card-icon {
  width: 44px;
  height: 44px;
  border-radius: 11px;
  display: grid;
  place-items: center;
  font-size: 1.25rem;
  margin-bottom: 1rem;
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.15), rgba(129, 140, 248, 0.1));
  border: 1px solid var(--border);
}

.card p { font-size: 0.9rem; margin-bottom: 0; }

.card-link {
  text-decoration: none;
  color: inherit;
  display: block;
}

.card-link:hover { text-decoration: none; }

/* Workflow pipeline */
.pipeline {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  padding: 1.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  backdrop-filter: blur(16px);
  overflow-x: auto;
}

.pipeline-step {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-sm);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  font-family: var(--mono);
  font-size: 0.78rem;
  white-space: nowrap;
  animation: fade-up 0.6s var(--ease) both;
}

.pipeline-step:nth-child(1) { animation-delay: 0.05s; }
.pipeline-step:nth-child(2) { animation-delay: 0.1s; }
.pipeline-step:nth-child(3) { animation-delay: 0.15s; }
.pipeline-step:nth-child(4) { animation-delay: 0.2s; }
.pipeline-step:nth-child(5) { animation-delay: 0.25s; }
.pipeline-step:nth-child(6) { animation-delay: 0.3s; }
.pipeline-step:nth-child(7) { animation-delay: 0.35s; }

.pipeline-step .file { color: var(--accent); font-weight: 500; }
.pipeline-step .gate { color: var(--green); font-size: 0.7rem; }
.pipeline-arrow { color: var(--text-dim); font-size: 0.85rem; }

/* Code blocks */
.code-block {
  position: relative;
  margin: 1.25rem 0 1.75rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-code);
  overflow: hidden;
  box-shadow: var(--shadow);
}

.code-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.65rem 1rem;
  background: var(--bg-elevated);
  border-bottom: 1px solid var(--border);
  font-size: 0.75rem;
  color: var(--text-dim);
}

.code-dots {
  display: flex;
  gap: 6px;
}

.code-dots span {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.code-dots span:nth-child(1) { background: #ff5f57; }
.code-dots span:nth-child(2) { background: #febc2e; }
.code-dots span:nth-child(3) { background: #28c840; }

pre {
  padding: 1.25rem 1.35rem;
  overflow-x: auto;
  font-family: var(--mono);
  font-size: 0.84rem;
  line-height: 1.65;
  color: var(--text-muted);
  margin: 0;
}

code {
  font-family: var(--mono);
  font-size: 0.88em;
  background: rgba(56, 189, 248, 0.1);
  color: var(--accent);
  padding: 0.15em 0.45em;
  border-radius: 5px;
}

pre code { background: none; color: inherit; padding: 0; font-size: inherit; }

.copy-btn {
  padding: 0.25rem 0.65rem;
  border-radius: 5px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.7rem;
  cursor: pointer;
  transition: all 0.2s;
}

.copy-btn:hover { border-color: var(--accent); color: var(--accent); }

/* Tables */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--bg-card);
  backdrop-filter: blur(12px);
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

th, td {
  text-align: left;
  padding: 0.85rem 1.1rem;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text);
  font-weight: 600;
  background: var(--bg-elevated);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:last-child td { border-bottom: none; }
td { color: var(--text-muted); }
tr:hover td { background: rgba(56, 189, 248, 0.03); }

/* Callout */
.callout {
  border: 1px solid var(--border-hover);
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.08), rgba(129, 140, 248, 0.05));
  padding: 1.15rem 1.35rem;
  border-radius: var(--radius);
  margin: 1.5rem 0;
  backdrop-filter: blur(8px);
}

.callout-title {
  font-weight: 700;
  color: var(--text);
  margin-bottom: 0.35rem;
}

.callout p:last-child { margin-bottom: 0; }

/* Doc page layout */
.doc-layout {
  display: grid;
  grid-template-columns: var(--sidebar-w) 1fr;
  gap: 3rem;
  max-width: 1200px;
  margin: 0 auto;
  padding-top: 2.5rem;
}

.sidebar {
  position: sticky;
  top: calc(var(--nav-h) + 1.5rem);
  align-self: start;
  max-height: calc(100vh - var(--nav-h) - 3rem);
  overflow-y: auto;
}

.sidebar-title {
  font-size: 0.7rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
  margin-bottom: 0.75rem;
}

.sidebar nav a {
  display: block;
  padding: 0.4rem 0.75rem;
  margin-left: -0.75rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.875rem;
  text-decoration: none;
  transition: all 0.2s;
  border-left: 2px solid transparent;
}

.sidebar nav a:hover,
.sidebar nav a.active {
  color: var(--accent);
  background: rgba(56, 189, 248, 0.06);
  border-left-color: var(--accent);
  text-decoration: none;
}

.page-header {
  margin-bottom: 2.5rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border);
}

.page-header h1 {
  font-size: clamp(2rem, 4vw, 2.75rem);
  font-weight: 800;
  letter-spacing: -0.03em;
  margin-bottom: 0.5rem;
}

.page-header p { font-size: 1.1rem; margin: 0; }

ul, ol { margin: 0 0 1rem 1.25rem; color: var(--text-muted); }
li { margin-bottom: 0.4rem; }

/* Footer */
.site-footer {
  border-top: 1px solid var(--border);
  padding: 3rem 1.5rem;
  text-align: center;
  color: var(--text-dim);
  font-size: 0.875rem;
}

.footer-links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-bottom: 1rem;
}

.site-footer a { color: var(--text-muted); }
.site-footer a:hover { color: var(--accent); }

.footer-credit {
  margin-top: 0.75rem;
  font-size: 0.8125rem;
  color: var(--text-dim);
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    transition-duration: 0.01ms !important;
  }
  .reveal { opacity: 1; transform: none; }
}

@media (max-width: 900px) {
  .doc-layout { grid-template-columns: 1fr; }
  .sidebar { position: static; max-height: none; }
}

@media (max-width: 768px) {
  .nav-links { display: none; }
  .nav-links.open {
    display: flex;
    flex-direction: column;
    position: absolute;
    top: var(--nav-h);
    left: 0;
    right: 0;
    background: var(--bg-elevated);
    border-bottom: 1px solid var(--border);
    padding: 1rem;
    box-shadow: var(--shadow);
  }
  .menu-btn { display: grid; }
  .hero { padding: 3rem 0 2.5rem; }
}
