:root {
  --bg-primary: #0b0d13;
  --bg-secondary: #131722;
  --bg-card: #181d2a;
  --bg-card-hover: #1f2536;
  --border-subtle: rgba(255, 255, 255, 0.08);
  --border-accent: rgba(16, 185, 129, 0.28);
  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;
  --accent-emerald: #10b981;
  --accent-emerald-glow: rgba(16, 185, 129, 0.15);
  --accent-blue: #38bdf8;
  --accent-purple: #a855f7;
  --accent-red: #ef4444;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.5);
  --transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

[data-theme="light"] {
  --bg-primary: #f8fafc;
  --bg-secondary: #f1f5f9;
  --bg-card: #ffffff;
  --bg-card-hover: #f8fafc;
  --border-subtle: rgba(0, 0, 0, 0.08);
  --border-accent: rgba(16, 185, 129, 0.35);
  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;
  --shadow-card: 0 10px 30px -10px rgba(0, 0, 0, 0.08);
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-main);
  line-height: 1.65;
  -webkit-font-smoothing: antialiased;
  padding-bottom: 80px;
}

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

a:hover {
  text-decoration: underline;
}

.container {
  max-width: 1040px;
  margin: 0 auto;
  padding: 0 24px;
}

/* Header & Nav */
header.site-header {
  position: sticky;
  top: 0;
  z-index: 100;
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  background-color: rgba(11, 13, 19, 0.82);
  border-bottom: 1px solid var(--border-subtle);
}

[data-theme="light"] header.site-header {
  background-color: rgba(248, 250, 252, 0.88);
}

.nav-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 72px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
  text-decoration: none;
}

.brand img {
  width: 34px;
  height: 34px;
  border-radius: 8px;
}

.brand span.badge-pill {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 100px;
  background: var(--accent-emerald-glow);
  color: var(--accent-emerald);
  border: 1px solid var(--border-accent);
}

.nav-links {
  display: flex;
  align-items: center;
  gap: 20px;
  font-size: 0.92rem;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
}

.nav-links a:hover {
  color: var(--text-main);
}

.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--accent-emerald);
  color: #0b0d13 !important;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  text-decoration: none !important;
  transition: var(--transition);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(16, 185, 129, 0.4);
}

.theme-toggle {
  background: transparent;
  border: 1px solid var(--border-subtle);
  color: var(--text-muted);
  border-radius: var(--radius-sm);
  padding: 8px 10px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Hero Section */
.hero {
  padding: 64px 0 48px;
  text-align: center;
}

.badge-official {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 16px;
  border-radius: 100px;
  background: var(--accent-emerald-glow);
  border: 1px solid var(--border-accent);
  color: var(--accent-emerald);
  font-size: 0.85rem;
  font-weight: 600;
  margin-bottom: 24px;
}

.pulse-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background-color: var(--accent-emerald);
  box-shadow: 0 0 10px var(--accent-emerald);
  animation: pulse 2s infinite;
}

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

.hero h1 {
  font-size: clamp(2.2rem, 4.5vw, 3.4rem);
  font-weight: 800;
  line-height: 1.15;
  letter-spacing: -0.03em;
  margin-bottom: 20px;
}

.hero p.lead {
  font-size: clamp(1.05rem, 1.8vw, 1.25rem);
  color: var(--text-muted);
  max-width: 760px;
  margin: 0 auto 32px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  flex-wrap: wrap;
  gap: 14px;
  margin-bottom: 40px;
}

.btn-secondary {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  color: var(--text-main);
  font-weight: 600;
  padding: 10px 18px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: var(--transition);
}

.btn-secondary:hover {
  background: var(--bg-card-hover);
  border-color: rgba(255, 255, 255, 0.2);
  text-decoration: none;
}

/* Stat Grid */
.stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 16px;
  margin: 36px 0;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 20px;
  text-align: left;
  box-shadow: var(--shadow-card);
}

.stat-value {
  font-size: 1.8rem;
  font-weight: 800;
  color: var(--accent-emerald);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 0.88rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Sections */
section {
  margin-top: 64px;
}

.section-header {
  margin-bottom: 28px;
}

.section-header h2 {
  font-size: 1.85rem;
  font-weight: 700;
  letter-spacing: -0.02em;
  margin-bottom: 8px;
}

.section-header p {
  color: var(--text-muted);
  font-size: 1.02rem;
}

/* Card */
.card {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 28px;
  box-shadow: var(--shadow-card);
  margin-bottom: 24px;
}

/* Tabs */
.tab-nav {
  display: flex;
  gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 2px;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  color: var(--text-muted);
  padding: 10px 16px;
  font-weight: 600;
  font-size: 0.92rem;
  cursor: pointer;
  white-space: nowrap;
  transition: var(--transition);
}

.tab-btn.active {
  color: var(--accent-emerald);
  border-bottom-color: var(--accent-emerald);
}

.tab-panel {
  display: none;
}

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

/* Code block */
.code-container {
  position: relative;
  background: #06080d;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  margin: 14px 0;
  overflow-x: auto;
}

pre code {
  font-family: var(--font-mono);
  font-size: 0.88rem;
  color: #e2e8f0;
  display: block;
  line-height: 1.5;
}

.copy-btn {
  position: absolute;
  top: 10px;
  right: 10px;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #f1f5f9;
  font-size: 0.75rem;
  padding: 4px 10px;
  border-radius: 6px;
  cursor: pointer;
  transition: var(--transition);
}

.copy-btn:hover {
  background: var(--accent-emerald);
  color: #000;
}

/* Tables */
.table-responsive {
  overflow-x: auto;
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  margin: 20px 0;
}

table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.92rem;
}

th, td {
  padding: 14px 18px;
  border-bottom: 1px solid var(--border-subtle);
}

th {
  background: var(--bg-secondary);
  color: var(--text-main);
  font-weight: 700;
}

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

tr.highlight-row {
  background: var(--accent-emerald-glow);
}

.badge-tag {
  display: inline-block;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: 4px;
}

.badge-tag.good {
  background: rgba(16, 185, 129, 0.2);
  color: var(--accent-emerald);
}

.badge-tag.bad {
  background: rgba(239, 68, 68, 0.15);
  color: var(--accent-red);
}

/* ADR Accordion */
details.adr-item {
  background: var(--bg-card);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-sm);
  margin-bottom: 12px;
  padding: 16px 20px;
  transition: var(--transition);
}

details.adr-item[open] {
  border-color: var(--border-accent);
}

summary.adr-summary {
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  list-style: none;
}

summary.adr-summary::-webkit-details-marker {
  display: none;
}

.adr-content {
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border-subtle);
  color: var(--text-muted);
  font-size: 0.92rem;
}

/* Architecture visual */
.arch-visual {
  text-align: center;
  margin: 24px 0;
}

.arch-visual img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-card);
}

/* Footer */
footer.site-footer {
  margin-top: 80px;
  padding-top: 40px;
  border-top: 1px solid var(--border-subtle);
  text-align: center;
  color: var(--text-dim);
  font-size: 0.88rem;
}

.footer-links {
  display: flex;
  justify-content: center;
  gap: 20px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.footer-links a {
  color: var(--text-muted);
}

@media (max-width: 768px) {
  .hero-actions {
    flex-direction: column;
  }
  .stat-grid {
    grid-template-columns: 1fr;
  }
}
