:root {
  --bg: #0b0d12;
  --bg-elevated: #12151c;
  --bg-card: #161a22;
  --border: rgba(255,255,255,.08);
  --border-hover: rgba(96,165,250,.35);
  --text: #e8eaed;
  --text-muted: #8b93a1;
  --text-dim: #5c6470;
  --accent: #60a5fa;
  --accent-soft: rgba(96,165,250,.12);
  --green: #86efac;
  --purple: #c4b5fd;
  --orange: #fdba74;
  --radius: 14px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body {
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  line-height: 1.65;
  min-height: 100vh;
}

.bg-grid {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  background:
    radial-gradient(ellipse 80% 60% at 50% -10%, rgba(96,165,250,.14), transparent 55%),
    radial-gradient(ellipse 50% 40% at 100% 20%, rgba(196,181,253,.08), transparent 50%);
}

.shell {
  position: relative;
  z-index: 1;
  max-width: 820px;
  margin: 0 auto;
  padding: 0 24px 80px;
}

nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 28px 0 20px;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
  color: inherit;
}

.brand-mark {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(37,99,235,.25);
}

.brand-mark img { width: 100%; height: 100%; object-fit: cover; }

.brand-text strong {
  font-family: "Space Grotesk", sans-serif;
  font-size: 16px;
  letter-spacing: -.02em;
}

.brand-text span {
  font-size: 10px;
  color: var(--text-dim);
  letter-spacing: .06em;
  text-transform: uppercase;
}

.nav-links {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 8px 12px;
  border-radius: 8px;
  transition: color .15s, background .15s;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--text);
  background: var(--bg-card);
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}

.lang-switch {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 600;
}

.lang-switch a {
  color: var(--text-dim);
  text-decoration: none;
  padding: 4px 6px;
  border-radius: 4px;
  transition: color .15s;
}

.lang-switch a:hover,
.lang-switch a.active {
  color: var(--accent);
}

.lang-switch span {
  color: var(--text-dim);
  user-select: none;
}

.hero {
  padding: 24px 0 40px;
}

.hero-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  border: 1px solid rgba(96,165,250,.2);
  color: var(--accent);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .04em;
  text-transform: uppercase;
  margin-bottom: 16px;
}

h1 {
  font-family: "Space Grotesk", sans-serif;
  font-size: clamp(2rem, 4vw, 2.8rem);
  font-weight: 700;
  letter-spacing: -.03em;
  line-height: 1.1;
  margin-bottom: 16px;
}

.lead {
  font-size: 18px;
  color: var(--text-muted);
  margin-bottom: 28px;
}

.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 16px;
  margin: 32px 0;
}

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  text-decoration: none;
  color: inherit;
  transition: border-color .15s, transform .15s;
}

.card:hover {
  border-color: var(--border-hover);
  transform: translateY(-2px);
}

.card h3 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 18px;
  margin-bottom: 8px;
}

.card p {
  font-size: 14px;
  color: var(--text-muted);
}

article h2 {
  font-family: "Space Grotesk", sans-serif;
  font-size: 1.5rem;
  margin: 40px 0 16px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
}

article h2:first-of-type { border-top: none; margin-top: 24px; }

article h3 {
  font-size: 1.1rem;
  margin: 24px 0 10px;
  color: var(--accent);
}

article p, article li {
  color: var(--text-muted);
  margin-bottom: 12px;
}

article ul, article ol {
  padding-left: 1.4em;
  margin-bottom: 16px;
}

article li { margin-bottom: 6px; }

article strong { color: var(--text); }

code {
  background: var(--bg-elevated);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: .9em;
}

.diagram {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 24px 0;
  font-family: ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
  overflow-x: auto;
  white-space: pre;
}

.concept-block {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 20px 0;
}

.concept-block h3 {
  margin-top: 0;
  color: var(--text);
}

.table-wrap {
  overflow-x: auto;
  margin: 16px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

th, td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--border);
}

th { color: var(--text); font-weight: 600; }
td { color: var(--text-muted); }

.callout {
  background: var(--accent-soft);
  border: 1px solid rgba(96,165,250,.25);
  border-radius: var(--radius);
  padding: 16px 20px;
  margin: 24px 0;
  font-size: 14px;
  color: var(--text-muted);
}

.callout strong { color: var(--accent); }

footer {
  margin-top: 64px;
  padding-top: 24px;
  border-top: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  font-size: 13px;
  color: var(--text-dim);
}

footer a { color: var(--accent); text-decoration: none; }

@media (max-width: 600px) {
  .nav-links { display: none; }
}
