/* CWA Spec — GitHub-inspired dark theme */
:root {
  --bg-canvas: #0d1117;
  --bg-default: #161b22;
  --bg-subtle: #1c2128;
  --bg-inset: #010409;
  --border-default: #30363d;
  --border-muted: #21262d;
  --fg-default: #e6edf3;
  --fg-muted: #8b949e;
  --fg-subtle: #6e7681;
  --accent: #7c6bf5;
  --accent-subtle: #6c5ce720;
  --accent-emphasis: #a29bfe;
  --danger: #f85149;
  --success: #3fb950;
  --warning: #d29922;
  --sidebar-width: 260px;
  --header-height: 56px;
  --content-max: 860px;
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: var(--bg-canvas);
  color: var(--fg-default);
  line-height: 1.6;
  overflow-x: hidden;
}

/* ─── Header ─── */
.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-height);
  background: var(--bg-default);
  border-bottom: 1px solid var(--border-default);
  display: flex;
  align-items: center;
  padding: 0 24px;
  z-index: 100;
  gap: 16px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--fg-default);
  font-weight: 700;
  font-size: 18px;
  white-space: nowrap;
}

.logo-icon {
  width: 28px;
  height: 28px;
  background: var(--accent);
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
  color: #fff;
  letter-spacing: -0.5px;
}

.logo-label {
  font-size: 14px;
  color: var(--fg-muted);
  font-weight: 400;
  margin-left: 4px;
}

.header-nav {
  display: flex;
  gap: 4px;
  margin-left: auto;
}

.header-nav a {
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  padding: 6px 12px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.header-nav a:hover {
  color: var(--fg-default);
  background: var(--bg-subtle);
}

.menu-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--fg-default);
  font-size: 24px;
  cursor: pointer;
  padding: 4px;
}

/* ─── Sidebar ─── */
.sidebar {
  position: fixed;
  top: var(--header-height);
  left: 0;
  width: var(--sidebar-width);
  height: calc(100vh - var(--header-height));
  background: var(--bg-default);
  border-right: 1px solid var(--border-default);
  overflow-y: auto;
  padding: 16px 0;
  z-index: 50;
}

.sidebar-section {
  padding: 0 16px;
  margin-bottom: 20px;
}

.sidebar-heading {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-subtle);
  padding: 4px 0 8px;
}

.sidebar-link {
  display: block;
  padding: 6px 12px;
  margin: 1px 0;
  color: var(--fg-muted);
  text-decoration: none;
  font-size: 14px;
  border-radius: 6px;
  transition: background 0.15s, color 0.15s;
}

.sidebar-link:hover {
  color: var(--fg-default);
  background: var(--bg-subtle);
}

.sidebar-link.active {
  color: var(--fg-default);
  background: var(--accent-subtle);
  font-weight: 500;
}

/* ─── Main Content ─── */
.main-content {
  margin-left: var(--sidebar-width);
  padding: calc(var(--header-height) + 32px) 48px 80px;
  max-width: calc(var(--content-max) + var(--sidebar-width) + 96px);
}

.content {
  max-width: var(--content-max);
}

/* ─── Typography ─── */
h1 {
  font-size: 32px;
  font-weight: 700;
  line-height: 1.25;
  margin-bottom: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border-default);
}

h2 {
  font-size: 24px;
  font-weight: 600;
  margin-top: 40px;
  margin-bottom: 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-muted);
}

h3 {
  font-size: 20px;
  font-weight: 600;
  margin-top: 28px;
  margin-bottom: 12px;
}

h4 {
  font-size: 16px;
  font-weight: 600;
  margin-top: 24px;
  margin-bottom: 8px;
}

p {
  margin-bottom: 16px;
}

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

a:hover {
  text-decoration: underline;
}

strong {
  font-weight: 600;
}

.subtitle {
  font-size: 18px;
  color: var(--fg-muted);
  margin-bottom: 32px;
  line-height: 1.5;
}

/* ─── Code ─── */
code {
  font-family: 'SF Mono', 'Cascadia Code', 'Fira Code', Consolas, monospace;
  font-size: 0.875em;
  background: var(--bg-subtle);
  padding: 2px 6px;
  border-radius: 4px;
  border: 1px solid var(--border-muted);
}

pre {
  background: var(--bg-inset);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  padding: 16px 20px;
  overflow-x: auto;
  margin-bottom: 20px;
  line-height: 1.5;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 13px;
}

/* ─── Tables ─── */
table {
  width: 100%;
  border-collapse: collapse;
  margin-bottom: 20px;
  font-size: 14px;
}

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

th {
  background: var(--bg-subtle);
  font-weight: 600;
  font-size: 13px;
}

tr:nth-child(even) {
  background: var(--bg-default);
}

/* ─── Lists ─── */
ul, ol {
  margin-bottom: 16px;
  padding-left: 28px;
}

li {
  margin-bottom: 6px;
}

li > p {
  margin-bottom: 4px;
}

/* ─── Badges / Labels ─── */
.badge {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.badge-required {
  background: #da363440;
  color: var(--danger);
  border: 1px solid #da363440;
}

.badge-optional {
  background: #d2992240;
  color: var(--warning);
  border: 1px solid #d2992240;
}

.badge-permission {
  background: var(--accent-subtle);
  color: var(--accent-emphasis);
  border: 1px solid var(--accent-subtle);
}

.badge-license {
  background: #3fb95030;
  color: var(--success);
  border: 1px solid #3fb95030;
}

/* ─── Callouts ─── */
.callout {
  padding: 16px 20px;
  border-radius: 8px;
  margin-bottom: 20px;
  border-left: 4px solid;
  font-size: 14px;
}

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

.callout-info {
  background: #388bfd15;
  border-color: #388bfd;
  color: #79c0ff;
}

.callout-warning {
  background: #d2992215;
  border-color: var(--warning);
  color: #e3b341;
}

.callout-tip {
  background: #3fb95015;
  border-color: var(--success);
  color: #56d364;
}

.callout-danger {
  background: #f8514915;
  border-color: var(--danger);
  color: #ff7b72;
}

.callout strong {
  display: block;
  margin-bottom: 4px;
}

/* ─── Hero (Landing Page) ─── */
.hero {
  text-align: center;
  padding: 48px 0 40px;
  margin-bottom: 40px;
  border-bottom: 1px solid var(--border-default);
}

.hero-badge {
  display: inline-block;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent-emphasis);
  background: var(--accent-subtle);
  padding: 4px 14px;
  border-radius: 20px;
  margin-bottom: 20px;
  letter-spacing: 0.04em;
}

.hero h1 {
  font-size: 44px;
  border: none;
  padding-bottom: 0;
  margin-bottom: 16px;
}

.hero .subtitle {
  font-size: 20px;
  max-width: 600px;
  margin: 0 auto 28px;
}

.hero-actions {
  display: flex;
  justify-content: center;
  gap: 12px;
  flex-wrap: wrap;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  text-decoration: none;
  transition: background 0.15s, transform 0.1s;
  cursor: pointer;
  border: none;
}

.btn:hover {
  text-decoration: none;
  transform: translateY(-1px);
}

.btn-primary {
  background: var(--accent);
  color: #fff;
}

.btn-primary:hover {
  background: #8b7bf7;
}

.btn-outline {
  background: transparent;
  color: var(--fg-default);
  border: 1px solid var(--border-default);
}

.btn-outline:hover {
  background: var(--bg-subtle);
}

/* ─── Feature Cards ─── */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.feature-card {
  padding: 20px;
  background: var(--bg-default);
  border: 1px solid var(--border-default);
  border-radius: 8px;
  transition: border-color 0.2s;
}

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

.feature-card h4 {
  margin-top: 0;
  margin-bottom: 8px;
}

.feature-card p {
  font-size: 14px;
  color: var(--fg-muted);
  margin-bottom: 0;
}

.feature-icon {
  font-size: 28px;
  margin-bottom: 12px;
  display: block;
}

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

.steps li {
  counter-increment: step;
  position: relative;
  padding-left: 44px;
  margin-bottom: 24px;
}

.steps li::before {
  content: counter(step);
  position: absolute;
  left: 0;
  top: 2px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 14px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* ─── Comparison Table ─── */
.comparison-table th:first-child {
  width: 28%;
}

.check { color: var(--success); }
.cross { color: var(--danger); }

/* ─── Syntax Highlighting (minimal) ─── */
.hl-keyword { color: #ff7b72; }
.hl-string { color: #a5d6ff; }
.hl-number { color: #79c0ff; }
.hl-comment { color: var(--fg-subtle); font-style: italic; }
.hl-property { color: #d2a8ff; }
.hl-function { color: #d2a8ff; }
.hl-type { color: #7ee787; }
.hl-boolean { color: #79c0ff; }
.hl-null { color: #79c0ff; }
.hl-tag { color: #7ee787; }
.hl-attr { color: #79c0ff; }

/* ─── Responsive ─── */
@media (max-width: 768px) {
  .sidebar {
    display: none;
  }

  .sidebar.open {
    display: block;
    width: 100%;
    z-index: 90;
  }

  .main-content {
    margin-left: 0;
    padding: calc(var(--header-height) + 24px) 20px 60px;
  }

  .menu-toggle {
    display: block;
  }

  .header-nav {
    display: none;
  }

  .hero h1 {
    font-size: 32px;
  }

  .hero .subtitle {
    font-size: 16px;
  }

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

  table {
    display: block;
    overflow-x: auto;
  }
}
