@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800&display=swap');

/* ===================================
   Capstan Documentation Site Styles
   Brutalist Precision — Dark Theme
   =================================== */

/* --- CSS Variables --- */
:root {
  --zinc-50: #fafafa;
  --zinc-100: #f4f4f5;
  --zinc-200: #e4e4e7;
  --zinc-300: #d4d4d8;
  --zinc-400: #a1a1aa;
  --zinc-500: #71717a;
  --zinc-600: #52525b;
  --zinc-700: #3f3f46;
  --zinc-800: #27272a;
  --zinc-900: #18181b;
  --zinc-950: #09090b;

  --accent: #f97316;
  --accent-hover: #ea580c;

  --success: #22c55e;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #3b82f6;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', 'SF Mono', Menlo, Consolas, monospace;

  --text-xs: 0.75rem;
  --text-sm: 0.875rem;
  --text-base: 1rem;
  --text-lg: 1.125rem;
  --text-xl: 1.25rem;
  --text-2xl: 1.5rem;
  --text-3xl: 1.875rem;
  --text-4xl: 2.25rem;
  --text-5xl: 3rem;

  --nav-height: 64px;
  --sidebar-width: 280px;
  --content-max-width: 52rem;
}

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

html {
  -webkit-text-size-adjust: 100%;
  -moz-tab-size: 4;
  tab-size: 4;
  scroll-padding-top: calc(var(--nav-height) + 1rem);
}

body {
  font-family: var(--font-sans);
  font-size: var(--text-base);
  color: var(--zinc-300);
  background: var(--zinc-950);
  line-height: 1.75;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

img, svg, video {
  display: block;
  max-width: 100%;
}

/* --- Typography --- */
h1, h2, h3, h4, h5, h6 {
  color: var(--zinc-50);
  letter-spacing: -0.025em;
  line-height: 1.2;
  font-weight: 700;
}

h1 {
  font-size: var(--text-4xl);
  margin-bottom: 1rem;
}

h2 {
  font-size: var(--text-2xl);
  margin-top: 3rem;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid var(--zinc-800);
}

h3 {
  font-size: var(--text-xl);
  margin-top: 2rem;
  margin-bottom: 0.75rem;
}

p {
  margin-bottom: 1rem;
  color: var(--zinc-400);
  line-height: 1.75;
}

ul, ol {
  margin-bottom: 1rem;
  padding-left: 1.5rem;
}

li {
  margin-bottom: 0.5rem;
  color: var(--zinc-400);
  line-height: 1.75;
}

li::marker {
  color: var(--zinc-600);
}

strong {
  color: var(--zinc-200);
  font-weight: 600;
}

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

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

hr {
  border: none;
  border-top: 1px solid var(--zinc-800);
  margin: 2rem 0;
}

/* --- Navbar --- */
.navbar {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  height: var(--nav-height);
  background: var(--zinc-950);
  border-bottom: 1px solid var(--zinc-800);
  display: flex;
  align-items: center;
  padding: 0 1.5rem;
  z-index: 100;
  gap: 1.5rem;
}

.navbar-brand {
  color: var(--zinc-50);
  font-size: var(--text-lg);
  font-weight: 800;
  text-decoration: none;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.625rem;
  flex-shrink: 0;
}

.navbar-brand:hover {
  color: var(--zinc-50);
  text-decoration: none;
}

.navbar-logo-img {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
}

.navbar-links {
  margin-left: auto;
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.navbar-links a {
  color: var(--zinc-400);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  transition: color 0.15s;
}

.navbar-links a:hover {
  color: var(--zinc-50);
  text-decoration: none;
}

.navbar-links a svg {
  width: 1.25rem;
  height: 1.25rem;
  fill: currentColor;
}

/* --- Sidebar --- */
.sidebar {
  position: fixed;
  top: var(--nav-height);
  left: 0;
  bottom: 0;
  width: var(--sidebar-width);
  background: var(--zinc-950);
  border-right: 1px solid var(--zinc-800);
  overflow-y: auto;
  padding: 1.5rem 0;
  z-index: 90;
  scrollbar-width: thin;
  scrollbar-color: var(--zinc-700) transparent;
}

.sidebar::-webkit-scrollbar {
  width: 4px;
}

.sidebar::-webkit-scrollbar-track {
  background: transparent;
}

.sidebar::-webkit-scrollbar-thumb {
  background: var(--zinc-700);
  border-radius: 2px;
}

.sidebar-section {
  padding: 0 1rem;
  margin-bottom: 1.5rem;
}

.sidebar-section-title {
  color: var(--zinc-500);
  font-size: var(--text-xs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 0.5rem;
  padding: 0 0.75rem;
}

.sidebar a {
  display: block;
  padding: 0.375rem 0.75rem;
  color: var(--zinc-400);
  text-decoration: none;
  font-size: var(--text-sm);
  border-left: 2px solid transparent;
  transition: color 0.15s, border-color 0.15s;
  margin-bottom: 1px;
}

.sidebar a:hover {
  color: var(--zinc-200);
  text-decoration: none;
}

.sidebar a.active {
  color: var(--accent);
  border-left-color: var(--accent);
  font-weight: 500;
}

/* --- Sidebar Overlay (Mobile) --- */
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  z-index: 85;
}

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

/* --- Mobile Menu Button --- */
.mobile-menu-btn {
  display: none;
  background: none;
  border: 1px solid var(--zinc-700);
  color: var(--zinc-300);
  padding: 0.375rem 0.5rem;
  cursor: pointer;
  border-radius: 2px;
  line-height: 1;
  font-size: var(--text-lg);
  transition: border-color 0.15s, color 0.15s;
  margin-left: auto;
  flex-shrink: 0;
}

.mobile-menu-btn:hover {
  border-color: var(--zinc-500);
  color: var(--zinc-50);
}

/* --- Main Content Area --- */
.main-wrapper {
  margin-left: var(--sidebar-width);
  margin-top: 0;
  min-height: calc(100vh - var(--nav-height));
  background: var(--zinc-950);
}

.main-content {
  max-width: var(--content-max-width);
  margin: 0 auto;
  padding: 3rem 2.5rem 5rem;
}

/* --- Buttons --- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.625rem 1.5rem;
  border-radius: 2px;
  font-size: var(--text-sm);
  font-weight: 600;
  font-family: var(--font-sans);
  text-decoration: none;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  line-height: 1.5;
}

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

.btn-primary {
  background: var(--accent);
  color: var(--zinc-950);
  border-color: var(--accent);
}

.btn-primary:hover {
  background: var(--accent-hover);
  border-color: var(--accent-hover);
  color: var(--zinc-950);
}

.btn-secondary {
  background: transparent;
  color: var(--zinc-300);
  border-color: var(--zinc-700);
}

.btn-secondary:hover {
  border-color: var(--zinc-500);
  color: var(--zinc-50);
}

.btn-ghost {
  background: transparent;
  color: var(--zinc-400);
  border-color: transparent;
}

.btn-ghost:hover {
  color: var(--zinc-50);
  background: var(--zinc-900);
}

/* --- Cards --- */
.card {
  background: var(--zinc-950);
  border: 1px solid var(--zinc-800);
  border-radius: 2px;
  padding: 1.5rem;
  margin-bottom: 1rem;
  transition: border-color 0.2s;
}

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

.card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
}

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

/* --- Feature Grid --- */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.feature-card {
  background: var(--zinc-950);
  border: 1px solid var(--zinc-800);
  border-radius: 2px;
  padding: 1.5rem;
  transition: border-color 0.2s;
}

.feature-card:hover {
  border-color: var(--accent);
}

.feature-card h3 {
  margin-top: 0;
  margin-bottom: 0.5rem;
  font-size: var(--text-base);
}

.feature-card p {
  font-size: var(--text-sm);
  margin-bottom: 0;
  color: var(--zinc-500);
}

.feature-icon {
  font-size: var(--text-2xl);
  margin-bottom: 0.5rem;
  display: block;
}

/* --- Hero Section --- */
.hero {
  text-align: center;
  padding: 4rem 0 2.5rem;
}

.hero-banner {
  max-width: 560px;
  width: 100%;
  height: auto;
  margin: 0 auto 1.5rem;
  border-radius: 8px;
}

.hero h1 {
  font-size: var(--text-5xl);
  font-weight: 800;
  margin-bottom: 1rem;
  color: #ffffff;
  letter-spacing: -0.035em;
}

.hero h1 code {
  color: #ff6b00;
  background: none;
  padding: 0;
  font-weight: 800;
  font-size: inherit;
}

.hero-tagline {
  font-size: var(--text-lg);
  color: var(--zinc-400);
  max-width: 600px;
  margin: 0 auto 2rem;
  line-height: 1.6;
}

.hero-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: center;
  flex-wrap: wrap;
  margin-bottom: 3rem;
}

/* --- Code --- */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
  background: var(--zinc-800);
  color: var(--accent);
  padding: 0.125rem 0.375rem;
  border-radius: 2px;
}

pre {
  background: var(--zinc-950);
  border: 1px solid var(--zinc-800);
  color: var(--zinc-300);
  padding: 1.25rem 1.5rem;
  border-radius: 2px;
  overflow-x: auto;
  margin-bottom: 1.5rem;
  line-height: 1.7;
  font-size: var(--text-sm);
}

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

.code-label {
  display: block;
  background: var(--zinc-800);
  color: var(--zinc-500);
  padding: 0.375rem 1.5rem;
  font-size: var(--text-xs);
  font-family: var(--font-mono);
  border-radius: 2px 2px 0 0;
  border: 1px solid var(--zinc-800);
  border-bottom: none;
  margin-bottom: 0;
}

.code-label + pre {
  border-radius: 0 0 2px 2px;
  margin-top: 0;
  border-top: none;
}

/* --- Terminal --- */
.terminal {
  background: var(--zinc-950);
  border: 1px solid var(--zinc-800);
  border-radius: 2px;
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.5rem;
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  color: var(--zinc-300);
  overflow-x: auto;
  line-height: 1.7;
}

.terminal::before {
  content: '$ ';
  color: var(--accent);
  font-weight: 600;
  user-select: none;
}

/* --- Callouts --- */
.callout {
  background: var(--zinc-900);
  border: 1px solid var(--zinc-800);
  border-left: 4px solid var(--zinc-600);
  border-radius: 0 2px 2px 0;
  padding: 1rem 1.25rem;
  margin-bottom: 1.5rem;
}

.callout p {
  margin-bottom: 0;
  color: var(--zinc-400);
}

.callout p:not(:last-child) {
  margin-bottom: 0.5rem;
}

.callout-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
  font-size: var(--text-sm);
}

.callout-info {
  border-left-color: var(--info);
}

.callout-info .callout-title {
  color: var(--info);
}

.callout-warning {
  border-left-color: var(--warning);
}

.callout-warning .callout-title {
  color: var(--warning);
}

.callout-error {
  border-left-color: var(--error);
}

.callout-error .callout-title {
  color: var(--error);
}

.callout-tip {
  border-left-color: var(--success);
}

.callout-tip .callout-title {
  color: var(--success);
}

/* --- Tables --- */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 1.5rem;
  font-size: var(--text-sm);
}

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

th {
  background: var(--zinc-900);
  font-weight: 600;
  font-size: var(--text-xs);
  color: var(--zinc-400);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--zinc-700);
}

tr:nth-child(even) td {
  background: var(--zinc-900);
}

tr:last-child td {
  border-bottom: none;
}

/* --- Comparison Table Indicators --- */
.check {
  color: var(--success);
  font-weight: 700;
}

.partial {
  color: var(--warning);
  font-weight: 700;
}

.cross {
  color: var(--zinc-600);
  font-weight: 700;
}

/* --- Badge --- */
.badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  font-size: var(--text-xs);
  font-weight: 600;
  color: var(--accent);
  background: rgba(249, 115, 22, 0.1);
  border: 1px solid rgba(249, 115, 22, 0.25);
  border-radius: 2px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  vertical-align: middle;
  line-height: 1.5;
}

/* --- Steps --- */
.steps {
  counter-reset: step;
  list-style: none;
  padding-left: 0;
}

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 3rem;
  margin-bottom: 2rem;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 0.125rem;
  width: 2rem;
  height: 2rem;
  background: var(--zinc-900);
  border: 1px solid var(--zinc-700);
  color: var(--accent);
  border-radius: 2px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: var(--text-sm);
  font-family: var(--font-mono);
}

/* --- Footer --- */
.footer {
  border-top: 1px solid var(--zinc-800);
  padding: 1.5rem 0;
  text-align: center;
  font-size: var(--text-sm);
  color: var(--zinc-500);
  margin-top: 4rem;
}

.footer a {
  color: var(--zinc-400);
  transition: color 0.15s;
}

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

/* --- Selection --- */
::selection {
  background: rgba(249, 115, 22, 0.25);
  color: var(--zinc-50);
}

/* --- Responsive: < 768px --- */
@media (max-width: 767px) {
  .navbar {
    padding: 0 1rem;
    gap: 0.75rem;
  }

  .navbar-links {
    display: none;
  }

  .lang-switcher.desktop-only {
    display: none;
  }

  .sidebar {
    display: none;
    position: fixed;
    z-index: 95;
    width: 280px;
    top: var(--nav-height);
    left: 0;
    bottom: 0;
    background: var(--zinc-950);
    border-right: 1px solid var(--zinc-800);
    overflow-y: auto;
  }

  .sidebar.open {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .main-content {
    padding: 1.5rem 1rem 3rem;
  }

  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
  }

  .mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
  }

  h1 {
    font-size: var(--text-2xl);
  }

  h2 {
    font-size: var(--text-xl);
  }

  .hero h1 {
    font-size: var(--text-3xl);
  }

  .hero {
    padding: 2.5rem 0 1.5rem;
  }

  .hero-tagline {
    font-size: var(--text-base);
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .explore-grid {
    grid-template-columns: 1fr;
  }

  .hero-actions {
    flex-direction: column;
    align-items: center;
  }

  .hero-buttons {
    flex-direction: column;
    width: 100%;
  }

  .hero-buttons .btn {
    width: 100%;
    text-align: center;
  }

  .page {
    padding: 0 1rem 3rem;
  }

  /* Table scroll on mobile */
  table {
    font-size: var(--text-xs);
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }

  th, td {
    padding: 0.5rem 0.75rem;
    white-space: nowrap;
  }

  /* Code blocks scroll */
  pre {
    max-width: calc(100vw - 2rem);
  }
}

/* --- Responsive: 768px-1023px --- */
@media (min-width: 768px) and (max-width: 1023px) {
  .navbar-links {
    display: none;
  }

  .lang-switcher.desktop-only {
    display: none;
  }

  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
  }

  .main-wrapper {
    margin-left: 0;
  }

  .mobile-menu-btn {
    display: flex;
    flex-direction: column;
    gap: 4px;
    padding: 0.5rem;
  }

  .mobile-menu-btn span {
    display: block;
    width: 18px;
    height: 2px;
    background: currentColor;
    border-radius: 1px;
  }

  .main-content {
    padding: 2.5rem 2rem 4rem;
    max-width: 42rem;
  }

  .hero h1 {
    font-size: var(--text-4xl);
  }

  table {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
  }
}

/* --- Landing Page --- */
.page {
  margin-top: 4rem;
  max-width: 960px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 2rem 5rem;
}

.hero-buttons {
  display: flex;
  gap: 0.75rem;
}

.explore-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1rem;
  margin: 1.5rem 0;
}

.explore-card {
  display: block;
  background: var(--zinc-900);
  border: var(--border-width) solid var(--zinc-800);
  padding: 1.5rem;
  text-decoration: none;
  transition: border-color 0.15s;
}

.explore-card:hover {
  border-color: var(--accent);
  text-decoration: none;
}

.explore-card h3 {
  color: var(--accent);
  font-size: 0.95rem;
  margin-top: 0;
  margin-bottom: 0.375rem;
}

.explore-card p {
  font-size: 0.85rem;
  margin-bottom: 0;
  color: var(--zinc-500);
}

.table-legend {
  text-align: center;
  font-size: 0.8rem;
  color: var(--zinc-600);
  margin-bottom: 0;
}

.table-legend a {
  color: var(--accent);
}

/* --- Language Switcher --- */
.lang-switcher {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.lang-switcher a {
  font-size: 0.8rem;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  text-decoration: none;
  color: var(--zinc-400);
  transition: background 0.15s, color 0.15s;
}

.lang-switcher a:hover {
  color: var(--zinc-200);
  background: var(--zinc-800);
}

.lang-switcher a.active {
  background: var(--accent);
  color: white;
}

/* --- Responsive: >= 1024px --- */
@media (min-width: 1024px) {
  .sidebar {
    display: block;
  }

  .mobile-menu-btn {
    display: none;
  }

  .sidebar-overlay {
    display: none !important;
  }

  .mobile-nav {
    display: none !important;
  }
}

/* --- Mobile Nav (Homepage) --- */
.mobile-nav {
  display: none;
  background: var(--zinc-900);
  border-bottom: 1px solid var(--zinc-800);
  padding: 0.75rem 1rem;
  flex-direction: column;
  gap: 0.25rem;
}

.mobile-nav.open {
  display: flex;
}

.mobile-nav a {
  display: block;
  padding: 0.625rem 0.75rem;
  color: var(--zinc-300);
  text-decoration: none;
  font-size: var(--text-sm);
  font-weight: 500;
  border-radius: 4px;
  transition: background 0.15s, color 0.15s;
}

.mobile-nav a:hover {
  background: var(--zinc-800);
  color: var(--zinc-50);
  text-decoration: none;
}

.mobile-nav-langs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.375rem;
  padding: 0.5rem 0.75rem 0;
  border-top: 1px solid var(--zinc-800);
  margin-top: 0.375rem;
}

.mobile-nav-langs a {
  display: inline-block;
  padding: 0.2rem 0.5rem;
  font-size: 0.75rem;
  border-radius: 4px;
}

.mobile-nav-langs a.active {
  background: var(--accent);
  color: white;
}
