:root {
  --bg: #000000;
  --fg: #D4D4D4;
  --dim: #6B6B6B;
  --bright: #FFFFFF;
  --accent: #00FF9C;
  --accent-dim: #00B36F;
  --warn: #FFD93D;
  --err: #FF6B6B;
  --archived: #FF8C42;
  --line: #1A1A1A;
  --line-strong: #2A2A2A;
  --accent-soft: rgba(0, 255, 156, 0.18);

  /* Tag system — replaces 8 prior ad-hoc tag/badge/chip classes.
   * See .tag / .hero__tag / .code-label rules below. */
  --tag-fg: var(--dim);
  --tag-fg-accent: var(--accent);
  --tag-fg-warn: var(--warn);
  --tag-border: var(--line-strong);
  --tag-border-accent: var(--accent-dim);
  --tag-border-warn: rgba(255, 217, 61, 0.3);
  --tag-bg-neutral: rgba(255, 255, 255, 0.03);
  --tag-radius: 999px;

  --font-mono: ui-monospace, SFMono-Regular, "JetBrains Mono", "Fira Code", Menlo, Consolas, "Liberation Mono", monospace;

  /* Topbar height: sticky topbar must be cleared by body padding-top on subpages.
   * Desktop: single-line topbar (~56px). Mobile: defensively sized for 2-line wrap
   * (prompt + back link) so article header is never occluded at <=720px. */
  --topbar-h: 56px;
}

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

html {
  background: var(--bg);
  color: var(--fg);
  font-family: var(--font-mono);
  font-size: 14px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
  scroll-behavior: smooth;
}

body {
  background: var(--bg);
  color: var(--fg);
  min-height: 100vh;
  padding: 32px 24px 64px;
  max-width: 800px;
  margin: 0 auto;
  position: relative;
}

@media (max-width: 720px) {
  :root { --topbar-h: 92px; }
  body { padding: 16px 16px 48px; font-size: 14px; max-width: 100%; }
  body[data-page="article"], body[data-page="article-graph"], body[data-page="project"], body[data-page="listing"] { padding-top: var(--topbar-h); }
  body[data-page="personal"], body[data-page="hr"] { padding-top: 16px; }
  .topbar__host-tld { display: none; }
  .topbar__link { min-height: 44px; }
}

@media (min-width: 721px) {
  body[data-page="article"], body[data-page="article-graph"], body[data-page="project"], body[data-page="listing"] { padding-top: 20px; }
}

::selection { background: var(--accent); color: #000; }

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

body::before {
  content: "";
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    rgba(0, 255, 156, 0.015) 0px,
    rgba(0, 255, 156, 0.015) 1px,
    transparent 1px,
    transparent 3px
  );
  pointer-events: none;
  z-index: 1;
}

img, svg { max-width: 100%; height: auto; display: block; }

/* Defensive: clip any rogue horizontal overflow at the root so a single
 * long unbroken token (URL, FQN, hex) on a phone cannot trigger page-level
 * horizontal scroll. Mirrors personal-en/assets/css/heatmap.css:18. */
html, body { overflow-x: clip; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 2px;
}

.skip {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--accent);
  color: #000;
  padding: 6px 10px;
  z-index: 100;
  font-weight: 600;
}
.skip:focus { left: 8px; top: 8px; }

/* ============== TOPBAR (subpages only) ==============
 * Sticky single-line header for articles/projects: terminal prompt on the left,
 * "back to home" link on the right. Background blocks the body scanline and
 * keeps the menu visually separated from the page text underneath.
 */
.topbar {
  position: sticky;
  top: 0;
  z-index: 10;
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  font-size: 13px;
  padding: 14px 20px;
  margin: -20px -24px 24px;
  background: var(--bg);
  border-bottom: 1px solid var(--line-strong);
  flex-wrap: wrap;
  gap: 8px 16px;
}
.topbar__prompt { white-space: nowrap; }
.topbar__host   { color: var(--accent); }
.topbar__host-tld { color: var(--fg); }
.topbar__sep    { color: var(--dim); margin: 0 1px; }
.topbar__path   { color: var(--fg); }
.topbar__path-link { color: inherit; text-decoration: none; }
.topbar__path-link:hover { color: var(--accent); text-decoration: underline; }
.topbar__dollar { color: var(--accent); margin: 0 0 0 1px; }
.topbar__nav { display: inline-flex; gap: 12px; }
.topbar__link { color: var(--dim); text-decoration: none; display: inline-flex; align-items: center; gap: 6px; }
.topbar__link:hover { color: var(--accent); text-decoration: none; }
.topbar__link .tab__icon { flex: 0 0 14px; width: 14px; height: 14px; }

/* ============== TAG SYSTEM (universal) ==============
 * Single primitive family that subsumes the prior 8-class zoo
 * (.badge, .project-stats__chip*, .article-header__tag, .project__tag*,
 *  .article__tag*, .hero__tag, .svc__tag, .card__tag, .cmp__tag, .focus__tag).
 *
 *   .tag          bordered pill, inline label on listings
 *   .hero__tag    bordered pill, kicker at the top of a page/section
 *   .code-label   borderless uppercase accent label (// orch, // SVC-01, …)
 *
 * Pill-style interactive controls (.pill) live in article-graph.css because
 * they carry hover/active state semantics that belong to a button, not a label.
 */

.tag {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.02em;
  color: var(--tag-fg);
  padding: 2px 8px;
  border: 1px solid var(--tag-border);
  background: transparent;
  border-radius: var(--tag-radius);
}
.tag--accent { color: var(--tag-fg-accent); border-color: var(--tag-border-accent); }
.tag--filled { background: var(--tag-bg-neutral); }
.tag--warn   { color: var(--tag-fg-warn); border-color: var(--tag-border-warn); }
.tag--lang   { color: var(--tag-fg-warn); border-color: var(--line); }

.status--active { color: var(--accent); }
.status--wip { color: var(--warn); }
.status--idea { color: var(--dim); }
.status--archived { color: var(--archived); }

.hero__tag {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.12em;
  color: var(--accent);
  padding: 4px 10px;
  border: 1px solid var(--accent-dim);
  border-radius: var(--tag-radius);
  margin-bottom: 20px;
}

.code-label {
  display: inline-block;
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}