:root,
[data-syntax-theme="github"] {
  color-scheme: light;
  --font-sans: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", "Courier New", monospace;

  --bg-color: #f8fafc;
  --bg-surface: #ffffff;
  --bg-surface-elevated: #f1f5f9;
  --text-color: #0f172a;
  --text-muted: #64748b;
  --border-color: #e2e8f0;
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --accent-color: #0ea5e9;
  --code-bg: #f1f5f9;
  --code-color: #0f172a;
  --syntax-background: var(--code-bg);
  --syntax-foreground: var(--code-color);
  --card-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
  --card-shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
}

html {
  scroll-behavior: smooth;
  scroll-padding-top: 2rem;
}

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

body {
  font-family: var(--font-sans);
  background-color: var(--bg-color);
  color: var(--text-color);
  line-height: 1.6;
  padding: 0;
  margin: 0;
}

/* Container */
.container {
  max-width: 1320px;
  margin: 0 auto;
  padding: 2rem 1.5rem 5rem;
}

/* Header */
header {
  margin-bottom: 2.5rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.header-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 1rem;
}

.title-group h1 {
  font-size: 2.25rem;
  font-weight: 800;
  letter-spacing: -0.025em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.title-tag {
  font-family: var(--font-mono);
  color: var(--primary-color);
}

.description {
  font-size: 1.125rem;
  color: var(--text-muted);
  max-width: 840px;
  line-height: 1.6;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.github-btn,
.npm-btn,
.bramus-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.875rem;
  border-radius: 6px;
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color);
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  text-decoration: none;
  transition: all 0.2s ease;
}

.github-btn:hover,
.npm-btn:hover,
.bramus-btn:hover {
  background: var(--bg-surface-elevated);
  border-color: var(--primary-color);
  color: var(--primary-color);
}

.github-btn svg,
.npm-btn svg,
.bramus-btn svg {
  flex-shrink: 0;
}

/* Page Layout & Sidenav (Scrollspy) */
.page-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 3rem;
  align-items: start;
}

@media (max-width: 800px) {
  .page-layout {
    grid-template-columns: minmax(0, 1fr);
    gap: 2rem;
  }
}

.sidebar {
  position: sticky;
  top: 1.5rem;
  max-height: calc(100vh - 3rem);
  overflow-y: auto;
  padding-right: 0.5rem;
}

@media (max-width: 800px) {
  .sidebar {
    position: static;
    max-height: none;
    overflow-y: visible;
    padding-right: 0;
    padding-bottom: 1.5rem;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 1.5rem;
  }
}

.sidenav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidenav-title {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0 0.75rem 0.25rem;
}

.sidenav-list {
  scroll-target-group: auto;
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

@media (max-width: 800px) {
  .sidenav-list {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0.35rem;
  }
}

.sidenav-list a {
  display: block;
  padding: 0.4rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-muted);
  text-decoration: none;
  border-radius: 6px;
  border-left: 2px solid transparent;
  transition: all 0.15s ease;
}

@media (max-width: 800px) {
  .sidenav-list a {
    border-left: none;
    border-bottom: 2px solid transparent;
    padding: 0.35rem 0.65rem;
  }
}

.sidenav-list a:hover {
  color: var(--text-color);
  background: var(--bg-surface-elevated);
}

.sidenav-list a:is(:target-current, .\:target-current, .is-active) {
  color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
  border-left-color: var(--primary-color);
  font-weight: 600;
}

@media (max-width: 800px) {
  .sidenav-list a:is(:target-current, .\:target-current, .is-active) {
    border-left-color: transparent;
    border-bottom-color: var(--primary-color);
  }
}

.sidenav-divider {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 700;
  color: var(--text-muted);
  padding: 0.75rem 0.75rem 0.25rem;
  margin-top: 0.35rem;
  border-top: 1px solid var(--border-color);
}

@media (max-width: 800px) {
  .sidenav-divider {
    width: 100%;
    border-top: none;
    padding: 0.25rem 0.65rem 0;
  }
}

/* Main Content */
main,
.main-content {
  display: flex;
  flex-direction: column;
  gap: 3.5rem;
  min-width: 0;
}

section {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.main-content > h2,
section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

section > h3 {
  font-size: 1.25rem;
  font-weight: 700;
  letter-spacing: -0.015em;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.section-desc {
  color: var(--text-muted);
  font-size: 1rem;
  max-width: 800px;
}

.section-desc a {
  color: var(--primary-color);
  font-weight: 500;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.section-desc a:hover {
  color: var(--primary-hover);
}

/* Cards & Grid */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 12px;
  padding: 1.5rem;
  box-shadow: var(--card-shadow);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.card-title {
  font-weight: 600;
  font-size: 1rem;
  color: var(--text-color);
}

.card-meta {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  color: var(--text-muted);
  background: var(--bg-surface-elevated);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
}

.card-text {
  font-size: 0.925rem;
  color: var(--text-muted);
}

/* Callout / Fun Fact Box */
.info-box {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  padding: 0.95rem 1.1rem;
  border-radius: 8px;
  background-color: #eff6ff;
  border: 1px solid #bfdbfe;
  color: #1e3a8a;
  font-size: 0.925rem;
  line-height: 1.55;
}

.info-box svg {
  flex-shrink: 0;
  color: var(--primary-color);
  margin-top: 0.15rem;
}

.info-box code {
  background-color: rgba(37, 99, 235, 0.1);
  color: #1e3a8a;
}

/* Features Grid */
.features-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 1.25rem;
}

.feature-card {
  background: var(--bg-surface);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.feature-card h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.feature-card p {
  font-size: 0.875rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* Tables */
.table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border-color);
  border-radius: 8px;
  background: var(--bg-surface);
}

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

.data-table th,
.data-table td {
  padding: 0.75rem 1rem;
  border-bottom: 1px solid var(--border-color);
}

.data-table th {
  background: var(--bg-surface-elevated);
  font-weight: 600;
  color: var(--text-color);
}

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

.data-table a {
  color: var(--primary-color);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.data-table a:hover {
  color: var(--primary-hover);
}

/* Code Snippets & <micro-lighter> */
pre,
code {
  font-family: var(--font-mono);
}

code {
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 0.15rem 0.35rem;
  border-radius: 4px;
  font-size: 0.875em;
}

pre {
  background-color: var(--code-bg);
  color: var(--code-color);
  padding: 1rem;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.875rem;
  line-height: 1.5;
  border: 1px solid var(--border-color);
  margin-top: 0.75rem;
}

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

micro-lighter {
  display: grid;
  position: relative;
  margin-top: 0;
}

micro-lighter > pre {
  margin: 0;
  padding-right: 3rem;
}

micro-lighter::part(copy-button) {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  margin: 0;
  width: 2rem;
  height: 2rem;
  padding: 0;
  box-sizing: border-box;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background-color: var(--bg-surface);
  color: var(--text-muted);
  font-size: 0;
  line-height: 0;
  cursor: pointer;
  transition: color 0.15s ease, border-color 0.15s ease, background-color 0.15s ease;
}

micro-lighter::part(copy-button):hover {
  color: var(--text-color);
  border-color: var(--primary-color);
  background-color: var(--bg-surface-elevated);
}

/* Interactive CLI Preview */
.preview-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.preset-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-right: 0.25rem;
}

.preset-chip {
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  font-weight: 500;
  padding: 0.35rem 0.7rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  color: var(--text-color);
  cursor: pointer;
  transition: border-color 0.15s ease, background-color 0.15s ease, color 0.15s ease;
}

.preset-chip:hover {
  border-color: var(--primary-color);
  background: var(--bg-surface);
}

.preset-chip.is-active {
  border-color: var(--primary-color);
  background: rgba(37, 99, 235, 0.08);
  color: var(--primary-color);
  font-weight: 600;
}

.json-toggle-label {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-color);
  cursor: pointer;
  user-select: none;
  padding: 0.35rem 0.65rem;
  border-radius: 6px;
  border: 1px solid var(--border-color);
  background: var(--bg-surface-elevated);
  transition: border-color 0.15s ease, background-color 0.15s ease;
}

.json-toggle-label:hover {
  border-color: var(--primary-color);
  background: var(--bg-surface);
}

.json-toggle-label input[type="checkbox"] {
  accent-color: var(--primary-color);
  width: 15px;
  height: 15px;
  cursor: pointer;
}

/* Terminal Window Output */
.terminal-window {
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid #1e293b;
  background-color: #0f172a;
  color: #e2e8f0;
  box-shadow: var(--card-shadow);
}

.terminal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.6rem 1rem;
  background-color: #1e293b;
  border-bottom: 1px solid #334155;
}

.terminal-dots {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.terminal-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.terminal-dot-red {
  background-color: #ef4444;
}

.terminal-dot-yellow {
  background-color: #f59e0b;
}

.terminal-dot-green {
  background-color: #22c55e;
}

.terminal-title {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: #94a3b8;
}

.terminal-exit-badge {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 0.15rem 0.45rem;
  border-radius: 4px;
}

.terminal-exit-badge.exit-0 {
  background-color: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.3);
}

.terminal-exit-badge.exit-1 {
  background-color: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.terminal-body {
  font-family: var(--font-mono);
  font-size: 0.85rem;
  line-height: 1.65;
  padding: 1.15rem 1.25rem;
  overflow-x: auto;
  white-space: pre;
}

.term-bold {
  font-weight: 700;
  color: #f8fafc;
}

.term-green {
  color: #4ade80;
}

.term-red {
  color: #f87171;
}

.term-yellow {
  color: #fbbf24;
}

.term-dim {
  color: #94a3b8;
}

.term-dim a {
  color: #94a3b8;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.term-dim a:hover {
  color: #cbd5e1;
}

footer {
  margin-top: 4rem;
  padding-top: 2rem;
  border-top: 1px solid var(--border-color);
  text-align: center;
  color: var(--text-muted);
  font-size: 0.875rem;
}

footer a {
  color: var(--primary-color);
  text-decoration: none;
  font-weight: 500;
}

footer a:hover {
  text-decoration: underline;
}
