/* ═══════════════════════════════════════════════════════════
   Subjekt API — Design System
   Dark-first developer theme with green brand accent
   ═══════════════════════════════════════════════════════════ */

/* ── Tokens ─────────────────────────────────────────────── */
:root {
  /* Brand */
  --brand-50:  #ecfdf3;
  --brand-100: #d1fae5;
  --brand-200: #a7f3d0;
  --brand-300: #6ee7b7;
  --brand-400: #34d399;
  --brand-500: #10b981;
  --brand-600: #059669;
  --brand-700: #047857;
  --brand-800: #065f46;
  --brand-900: #064e3b;

  /* Surfaces */
  --bg-root:    #0a0f0d;
  --bg-surface: #111916;
  --bg-raised:  #16201b;
  --bg-overlay: #1a2520;
  --bg-subtle:  #0e1512;

  /* Text */
  --text-primary:   #e8f0ec;
  --text-secondary: #8fa89a;
  --text-muted:     #5c7a6a;
  --text-inverse:   #0a0f0d;

  /* Borders */
  --border-default: #1e2e26;
  --border-subtle:  #162019;
  --border-strong:  #2a3f33;
  --border-brand:   #059669;

  /* Code */
  --code-bg:     #0d1410;
  --code-border: #1a2a22;
  --code-text:   #a7f3d0;

  /* Status */
  --success: #34d399;
  --warning: #fbbf24;
  --danger:  #f87171;
  --info:    #60a5fa;

  /* Spacing */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  16px;
  --space-lg:  24px;
  --space-xl:  32px;
  --space-2xl: 48px;
  --space-3xl: 64px;
  --space-4xl: 96px;

  /* Radius */
  --radius-sm:   6px;
  --radius-md:   10px;
  --radius-lg:   14px;
  --radius-xl:   20px;
  --radius-full: 9999px;

  /* Shadows */
  --shadow-sm:  0 1px 2px rgba(0,0,0,0.3);
  --shadow-md:  0 4px 12px rgba(0,0,0,0.4);
  --shadow-lg:  0 8px 24px rgba(0,0,0,0.5);
  --shadow-xl:  0 16px 48px rgba(0,0,0,0.6);
  --shadow-glow: 0 0 30px rgba(16,185,129,0.15);

  /* Typography */
  --font-sans:  'Inter', 'Plus Jakarta Sans', -apple-system, 'Segoe UI', sans-serif;
  --font-mono:  'JetBrains Mono', 'IBM Plex Mono', 'SF Mono', 'Cascadia Code', monospace;

  /* Transitions */
  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);
  --duration-fast: 150ms;
  --duration-normal: 250ms;
  --duration-slow: 400ms;
}

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

html {
  font-size: 16px;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  scroll-behavior: smooth;
}

body {
  font-family: var(--font-sans);
  color: var(--text-primary);
  background: var(--bg-root);
  line-height: 1.6;
  min-height: 100vh;
}

/* ── Layout ─────────────────────────────────────────────── */
.container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

.container-narrow {
  max-width: 860px;
  margin: 0 auto;
  padding: 0 var(--space-lg);
}

/* ── Typography ─────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
  margin: 0;
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -0.02em;
  color: var(--text-primary);
}

h1 { font-size: clamp(2.25rem, 5vw, 3.5rem); }
h2 { font-size: clamp(1.5rem, 3vw, 2.25rem); }
h3 { font-size: clamp(1.125rem, 2vw, 1.5rem); }
h4 { font-size: 1.125rem; }

p {
  margin: 0;
  color: var(--text-secondary);
  line-height: 1.7;
}

a {
  color: var(--brand-400);
  text-decoration: none;
  transition: color var(--duration-fast) var(--ease-out);
}
a:hover { color: var(--brand-300); }

small, .text-sm { font-size: 0.875rem; }
.text-xs { font-size: 0.75rem; }
.text-lg { font-size: 1.125rem; }
.text-muted { color: var(--text-muted); }
.text-secondary { color: var(--text-secondary); }
.text-brand { color: var(--brand-400); }
.font-mono { font-family: var(--font-mono); }
.font-medium { font-weight: 500; }
.font-semibold { font-weight: 600; }

/* ── Navigation ─────────────────────────────────────────── */
.site-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-md) 0;
  gap: var(--space-md);
  border-bottom: 1px solid var(--border-default);
}

.brand {
  font-weight: 700;
  font-size: 1.125rem;
  text-decoration: none;
  color: var(--text-primary);
  letter-spacing: -0.01em;
  display: flex;
  align-items: center;
  gap: var(--space-sm);
}

.brand-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--brand-400);
  box-shadow: 0 0 8px rgba(16,185,129,0.4);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: var(--space-xs);
  flex-wrap: wrap;
}

.nav-link {
  text-decoration: none;
  color: var(--text-secondary);
  font-size: 0.875rem;
  font-weight: 500;
  padding: var(--space-sm) 12px;
  border-radius: var(--radius-md);
  transition: all var(--duration-fast) var(--ease-out);
  border: 1px solid transparent;
}

.nav-link:hover {
  color: var(--text-primary);
  background: var(--bg-raised);
  border-color: var(--border-default);
}

.nav-link.active {
  color: var(--brand-400);
  background: rgba(16,185,129,0.08);
  border-color: rgba(16,185,129,0.15);
}

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-sm);
  text-decoration: none;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.875rem;
  padding: 10px 18px;
  border: 1px solid var(--border-strong);
  background: var(--bg-raised);
  color: var(--text-primary);
  cursor: pointer;
  transition: all var(--duration-fast) var(--ease-out);
  white-space: nowrap;
}

.btn:hover {
  background: var(--bg-overlay);
  border-color: var(--border-brand);
  color: var(--brand-300);
  box-shadow: var(--shadow-glow);
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--brand-600);
  border-color: var(--brand-600);
  color: #fff;
}

.btn-primary:hover {
  background: var(--brand-500);
  border-color: var(--brand-500);
  color: #fff;
  box-shadow: 0 0 24px rgba(16,185,129,0.25);
}

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--text-secondary);
}

.btn-ghost:hover {
  background: var(--bg-raised);
  color: var(--text-primary);
  border-color: var(--border-default);
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.8125rem;
}

.btn-row {
  display: flex;
  align-items: center;
  gap: var(--space-sm);
  flex-wrap: wrap;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-lg);
  padding: var(--space-lg);
  transition: all var(--duration-normal) var(--ease-out);
}

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

.card-glow:hover {
  border-color: rgba(16,185,129,0.2);
  box-shadow: var(--shadow-glow);
}

/* ── Chips / Badges ─────────────────────────────────────── */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: var(--radius-full);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  border: 1px solid rgba(16,185,129,0.2);
  background: rgba(16,185,129,0.08);
  color: var(--brand-400);
}

.chip-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--brand-400);
  animation: pulse-dot 2s infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px 8px;
  border-radius: var(--radius-sm);
  font-size: 0.6875rem;
  font-weight: 600;
  font-family: var(--font-mono);
  background: var(--bg-raised);
  color: var(--text-secondary);
  border: 1px solid var(--border-default);
}

.badge-method {
  background: rgba(16,185,129,0.1);
  color: var(--brand-400);
  border-color: rgba(16,185,129,0.2);
}

/* ── Code Blocks ────────────────────────────────────────── */
code {
  font-family: var(--font-mono);
  font-size: 0.875em;
}

:not(pre) > code {
  padding: 2px 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--brand-300);
  font-size: 0.8125em;
}

pre {
  margin: 0;
  padding: var(--space-md);
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius-md);
  overflow-x: auto;
  font-size: 0.8125rem;
  line-height: 1.7;
  -webkit-overflow-scrolling: touch;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  color: var(--code-text);
  font-size: inherit;
}

.code-block {
  position: relative;
}

.code-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--space-sm) var(--space-md);
  background: var(--bg-raised);
  border: 1px solid var(--code-border);
  border-bottom: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  font-size: 0.75rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.code-header + pre {
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}

.copy-btn {
  position: absolute;
  top: var(--space-sm);
  right: var(--space-sm);
  padding: 4px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.6875rem;
  font-family: var(--font-mono);
  cursor: pointer;
  opacity: 0;
  transition: all var(--duration-fast) var(--ease-out);
}

.code-block:hover .copy-btn { opacity: 1; }
.copy-btn:hover {
  color: var(--brand-400);
  border-color: var(--border-brand);
}

/* ── Tables ─────────────────────────────────────────────── */
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.875rem;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border-default);
  vertical-align: top;
}

th {
  color: var(--text-muted);
  font-weight: 600;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

td code {
  font-size: 0.8125rem;
}

tr:hover td {
  background: var(--bg-raised);
}

/* ── Grids ──────────────────────────────────────────────── */
.grid { display: grid; gap: var(--space-md); }
.grid-2 { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-md); }
.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-md); }
.grid-4 { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-md); }

/* ── Sections ───────────────────────────────────────────── */
.section {
  padding: var(--space-3xl) 0;
}

.section-header {
  margin-bottom: var(--space-xl);
}

.section-header p {
  margin-top: var(--space-sm);
  max-width: 580px;
}

.divider {
  border: none;
  border-top: 1px solid var(--border-default);
  margin: var(--space-2xl) 0;
}

/* ── Tabs ───────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-raised);
  border-radius: var(--radius-md);
  padding: 3px;
  border: 1px solid var(--border-default);
  width: fit-content;
}

.tab {
  padding: 6px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  border: none;
  background: none;
  transition: all var(--duration-fast) var(--ease-out);
  font-family: var(--font-sans);
}

.tab:hover {
  color: var(--text-secondary);
}

.tab.active {
  background: var(--bg-overlay);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

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

/* ── Metric Cards ───────────────────────────────────────── */
.metric {
  padding: var(--space-md);
  background: var(--bg-surface);
  border: 1px solid var(--border-default);
  border-radius: var(--radius-md);
}

.metric-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  font-family: var(--font-mono);
}

.metric-label {
  margin-top: 4px;
  font-size: 0.8125rem;
  color: var(--text-muted);
}

/* ── Notice / Alert ─────────────────────────────────────── */
.notice {
  padding: var(--space-md);
  border-radius: var(--radius-md);
  border-left: 3px solid var(--brand-600);
  background: rgba(16,185,129,0.05);
  color: var(--text-secondary);
  font-size: 0.875rem;
}

.notice-warn {
  border-left-color: var(--warning);
  background: rgba(251,191,36,0.05);
}

/* ── Footer ─────────────────────────────────────────────── */
.site-footer {
  border-top: 1px solid var(--border-default);
  padding: var(--space-xl) 0;
  margin-top: var(--space-3xl);
}

.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.footer-links {
  display: flex;
  gap: var(--space-xl);
  flex-wrap: wrap;
}

.footer-col h4 {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: var(--space-sm);
}

.footer-col a {
  display: block;
  color: var(--text-secondary);
  font-size: 0.875rem;
  padding: 3px 0;
  transition: color var(--duration-fast);
}

.footer-col a:hover { color: var(--brand-400); }

.footer-bottom {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Scrollbar ──────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background: var(--border-strong);
  border-radius: 3px;
}
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ── Focus ──────────────────────────────────────────────── */
a:focus-visible,
button:focus-visible,
input:focus-visible,
select:focus-visible,
[tabindex]:focus-visible {
  outline: 2px solid var(--brand-400);
  outline-offset: 2px;
}

/* ── Selection ──────────────────────────────────────────── */
::selection {
  background: rgba(16,185,129,0.25);
  color: var(--text-primary);
}

/* ── Responsive ─────────────────────────────────────────── */
@media (max-width: 1024px) {
  .grid-4 { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
  .container, .container-narrow {
    padding: 0 var(--space-md);
  }

  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
  }

  .site-nav {
    flex-direction: column;
    align-items: flex-start;
    gap: var(--space-sm);
  }

  .nav-links {
    width: 100%;
    overflow-x: auto;
    flex-wrap: nowrap;
    -webkit-overflow-scrolling: touch;
    padding-bottom: var(--space-xs);
  }

  .section {
    padding: var(--space-2xl) 0;
  }

  .footer-inner {
    flex-direction: column;
  }

  .btn-row {
    flex-direction: column;
    align-items: stretch;
  }
  .btn-row .btn {
    justify-content: center;
  }
}

/* ── Animations ─────────────────────────────────────────── */
@keyframes fade-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

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

.animate-in {
  animation: fade-in 0.6s var(--ease-out) both;
}

.animate-in-delay-1 { animation-delay: 0.1s; }
.animate-in-delay-2 { animation-delay: 0.2s; }
.animate-in-delay-3 { animation-delay: 0.3s; }
.animate-in-delay-4 { animation-delay: 0.4s; }
