:root {
  --bg: #fafafa;
  --panel: #ffffff;
  --text: #1a1a1a;
  --muted: #5a5a5a;
  --accent: #4a3aff;
  --accent-2: #00897b;
  --border: #e2e2e2;
  --code-bg: #f3f3f7;
  --max-width: 880px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  line-height: 1.55;
  font-size: 16px;
}

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

header.site-header {
  background: #1f1d3d;
  color: #ffffff;
  padding: 12px 20px;
  border-bottom: 1px solid #15132a;
}
header.site-header .nav-inner {
  max-width: var(--max-width);
  margin: 0 auto;
  display: flex;
  gap: 18px;
  align-items: center;
  flex-wrap: wrap;
}
header.site-header a { color: #ffffff; }
header.site-header .brand {
  font-weight: 600;
  font-size: 1.05rem;
  margin-right: 8px;
}
header.site-header nav {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 0;       /* row spacing only; horizontal spacing comes from margin below */
  align-items: center;
}
header.site-header nav a {
  font-size: 0.92rem;
  opacity: 0.85;
  padding: 4px 10px;
  margin-left: 6px;
  border-left: 1px solid rgba(255,255,255,0.25);
  white-space: nowrap;
}
header.site-header nav a:first-child {
  margin-left: 0;
  border-left: 0;
}
header.site-header nav a:hover { opacity: 1; }

main.container {
  max-width: var(--max-width);
  margin: 24px auto;
  padding: 0 20px 60px;
}

h1, h2, h3 { line-height: 1.25; }
h1 { font-size: 1.9rem; margin-top: 0; }
h2 { margin-top: 2em; border-bottom: 1px solid var(--border); padding-bottom: 4px; }
h3 { margin-top: 1.6em; }

p, ul, ol { font-size: 1rem; }
ul, ol { padding-left: 1.4em; }
li { margin-bottom: 4px; }

code {
  background: var(--code-bg);
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.92em;
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
}
pre {
  background: var(--code-bg);
  padding: 12px 14px;
  border-radius: 6px;
  overflow-x: auto;
  font-size: 0.88em;
}
pre code { background: none; padding: 0; }

blockquote {
  margin: 16px 0;
  padding: 10px 14px;
  border-left: 3px solid var(--accent);
  background: #f1f0fb;
  color: var(--muted);
}

.callout {
  background: #fff8e1;
  border-left: 3px solid #ffb300;
  padding: 10px 14px;
  margin: 16px 0;
  border-radius: 4px;
}

.demo-card {
  border: 1px solid var(--border);
  background: var(--panel);
  border-radius: 8px;
  padding: 16px;
  margin: 12px 0;
}
.demo-card h3 { margin-top: 0; }

.controls {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px 12px;
  align-items: center;
  margin: 12px 0;
}
.controls label {
  font-size: 0.92rem;
  color: var(--muted);
}
.controls input[type=range] { width: 100%; }
.controls .value {
  font-variant-numeric: tabular-nums;
  width: 5em;
  text-align: right;
  color: var(--accent);
  font-weight: 500;
}

button {
  background: var(--accent);
  color: white;
  border: 0;
  padding: 7px 14px;
  border-radius: 5px;
  font-size: 0.95rem;
  cursor: pointer;
}
button:hover { background: #3a2dd8; }
button.secondary {
  background: #e2e2e2;
  color: #1a1a1a;
}
button.secondary:hover { background: #d4d4d4; }

textarea {
  font-family: "SFMono-Regular", Menlo, Consolas, monospace;
  font-size: 0.88em;
  width: 100%;
  min-height: 90px;
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 8px;
}

table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.93rem;
}
table th, table td {
  padding: 4px 8px;
  border-bottom: 1px solid var(--border);
  text-align: right;
}
table th:first-child, table td:first-child { text-align: left; }
table th {
  background: #efeefa;
  font-weight: 600;
}

.plot { width: 100%; min-height: 360px; }

.demo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 12px;
}

.tag {
  display: inline-block;
  background: #ece9ff;
  color: #4a3aff;
  border-radius: 3px;
  padding: 1px 8px;
  font-size: 0.78rem;
  margin-right: 4px;
}

footer.site-footer {
  max-width: var(--max-width);
  margin: 40px auto 20px;
  padding: 16px 20px;
  font-size: 0.85rem;
  color: var(--muted);
  border-top: 1px solid var(--border);
}
