:root {
  --page: #f9f9f7;
  --surface: #fcfcfb;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --muted: #898781;
  --hairline: #e1e0d9;
  --border: rgba(11, 11, 11, 0.1);
  --accent: #2a78d6;      /* categorical slot 1 */
  --accent-2: #1baf7a;    /* categorical slot 2 */
  --good: #006300;        /* success text (light) */
  --bad: #d03b3b;         /* status critical */
  --code-bg: #f0efec;
}
@media (prefers-color-scheme: dark) {
  :root {
    --page: #0d0d0d;
    --surface: #1a1a19;
    --ink: #ffffff;
    --ink-2: #c3c2b7;
    --muted: #898781;
    --hairline: #2c2c2a;
    --border: rgba(255, 255, 255, 0.1);
    --accent: #3987e5;
    --accent-2: #199e70;
    --good: #0ca30c;
    --bad: #d03b3b;
    --code-bg: #262624;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--page);
  color: var(--ink);
  font: 17px/1.65 system-ui, -apple-system, "Segoe UI", sans-serif;
}

.site-header {
  display: flex;
  align-items: baseline;
  gap: 0.75rem;
  padding: 1.1rem 1.25rem;
  border-bottom: 1px solid var(--hairline);
}
.site-avatar {
  width: 26px;
  height: 26px;
  align-self: center;
  flex-shrink: 0;
}
@keyframes avatar-blink {
  0%, 60% { opacity: 1; }
  61%, 100% { opacity: 0; }
}
.avatar-cursor { animation: avatar-blink 1.4s steps(1) infinite; }
@media (prefers-reduced-motion: reduce) {
  .avatar-cursor { animation: none; }
}
.site-name {
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--ink);
  text-decoration: none;
}
.site-tag { color: var(--muted); font-size: 0.85rem; }

main {
  max-width: 44rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

h1 { font-size: 1.9rem; line-height: 1.25; margin: 0.4rem 0 1rem; }
h2 { font-size: 1.35rem; margin-top: 2.2rem; }
h3 { font-size: 1.1rem; margin-top: 1.8rem; }
a { color: var(--accent); }
blockquote {
  margin: 1.25rem 0;
  padding: 0.1rem 1.1rem;
  border-left: 3px solid var(--accent);
  color: var(--ink-2);
}
code {
  font: 0.86em/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  background: var(--code-bg);
  padding: 0.12em 0.35em;
  border-radius: 4px;
}
pre {
  background: var(--code-bg);
  padding: 0.9rem 1.1rem;
  border-radius: 8px;
  overflow-x: auto;
}
pre code { background: none; padding: 0; }
hr { border: 0; border-top: 1px solid var(--hairline); margin: 2.2rem 0; }

table { border-collapse: collapse; width: 100%; margin: 1.25rem 0; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.5rem 0.7rem; border-bottom: 1px solid var(--hairline); }
th { color: var(--ink-2); font-weight: 600; }

.article-meta { color: var(--muted); font-size: 0.85rem; margin: 0; }

figure {
  margin: 2rem 0;
  padding: 1.25rem;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
figure svg { display: block; width: 100%; height: auto; }
figcaption { color: var(--ink-2); font-size: 0.85rem; margin-top: 0.8rem; }

/* diagram roles (inline SVGs use these via class) */
.d-ink { fill: var(--ink); }
.d-ink2 { fill: var(--ink-2); }
.d-muted { fill: var(--muted); }
.d-line { stroke: var(--ink-2); fill: none; }
.d-hair { stroke: var(--hairline); }
.d-box { fill: var(--surface); stroke: var(--ink-2); }
.d-accent { stroke: var(--accent); fill: none; }
.d-accent-fill { fill: var(--accent); }
.d-accent2 { stroke: var(--accent-2); fill: none; }
.d-accent2-fill { fill: var(--accent-2); }
.d-good { stroke: var(--good); fill: none; }
.d-good-fill { fill: var(--good); }
.d-bad { stroke: var(--bad); fill: none; }
.d-bad-fill { fill: var(--bad); }
svg text { font: 12px system-ui, -apple-system, "Segoe UI", sans-serif; }

.article-nav {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 3rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--hairline);
  font-size: 0.9rem;
}
.article-nav a { text-decoration: none; }

.hero p { color: var(--ink-2); font-size: 1.05rem; }

.article-list { list-style: none; padding: 0; counter-reset: art; }
.article-list li {
  counter-increment: art;
  padding: 1.1rem 0;
  border-bottom: 1px solid var(--hairline);
}
.article-list li::before {
  content: counter(art, decimal-leading-zero);
  color: var(--muted);
  font-size: 0.8rem;
  display: block;
}
.article-list .li-title { font-weight: 650; font-size: 1.12rem; }
.article-list a { text-decoration: none; }
.article-list p { margin: 0.3rem 0 0; color: var(--ink-2); font-size: 0.95rem; }

.site-footer {
  max-width: 44rem;
  margin: 0 auto;
  padding: 1.25rem;
  border-top: 1px solid var(--hairline);
  color: var(--muted);
  font-size: 0.85rem;
}
