/* =========  Foundations (theme-invariant)  ========= */
:root {
  /* Type families — self-hosted, no CDN */
  --tc-font-sans:   "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --tc-font-mono-tm:"IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --tc-font-mono-st:"JetBrains Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --tc-font-serif:  "Instrument Serif", "Iowan Old Style", "Georgia", serif;

  /* The active mono swaps with the theme. Default = telemetry. */
  --tc-font-mono:   var(--tc-font-mono-tm);

  /* Type scale (px so engineers can reason about it) */
  --tc-fs-10: 10px; --tc-fs-11: 11px; --tc-fs-12: 12px;
  --tc-fs-13: 13px; --tc-fs-14: 14px; --tc-fs-16: 16px;
  --tc-fs-18: 18px; --tc-fs-22: 22px; --tc-fs-28: 28px; --tc-fs-36: 36px;

  /* 4pt grid */
  --tc-s-1: 4px;  --tc-s-2: 8px;  --tc-s-3: 12px; --tc-s-4: 16px;
  --tc-s-5: 20px; --tc-s-6: 24px; --tc-s-8: 32px; --tc-s-10: 40px;

  /* Density */
  --tc-row-h: 32px;          /* default */
  --tc-row-h-cozy: 36px;
  --tc-row-h-dense: 28px;

  /* Radius */
  --tc-r-0: 0;     --tc-r-1: 2px;  --tc-r-2: 4px;
  --tc-r-3: 6px;   --tc-r-pill: 999px;

  /* Motion */
  --tc-dur-fast: 120ms;
  --tc-dur-base: 180ms;
  --tc-dur-slow: 240ms;
  --tc-ease: cubic-bezier(0.2, 0, 0, 1);

  /* Shadows */
  --tc-elev-1: 0 1px 2px rgba(14,14,14,0.10);
  --tc-elev-2: 0 1px 2px rgba(14,14,14,0.10), 0 4px 12px rgba(25,25,25,0.10);
  --tc-elev-3: 0 2px 4px rgba(14,14,14,0.12), 0 8px 24px rgba(25,25,25,0.16);
}

/* =========  Telemetry — light (DEFAULT)  ========= */
:root,
[data-theme="telemetry"][data-scheme="light"] {
  --tc-bg:        #f4f4ee;
  --tc-panel:     #fbfaf3;
  --tc-panel-2:   #ecebe4;
  --tc-rule:      #dad8cb;
  --tc-rule-2:    #c4c2b3;
  --tc-ink:       #11140e;
  --tc-ink-2:     #444839;
  --tc-ink-3:     #7d816f;

  --tc-brand:     #ff6a4a;
  --tc-brand-2:   #ff8a5a;
  --tc-brand-fg:  #ffffff;
  --tc-link:      #2563d9;

  /* Semantic outcomes — same identifiers across all 4 themes */
  --tc-pass:      #2f8a4a;   --tc-pass-soft:  #2f8a4a1f;
  --tc-fail:      #c8311a;   --tc-fail-soft:  #c8311a1a;
  --tc-err:       #7a3aa8;   --tc-err-soft:   #7a3aa820;
  --tc-warn:      #a87a00;   --tc-warn-soft:  #a87a0022;
  --tc-skip:      #7d816f;   --tc-skip-soft:  #7d816f22;
  --tc-run:       #2563d9;   --tc-run-soft:   #2563d922;
  --tc-abort:     #6b6b6b;
  --tc-xfail:     #a87a00;
  --tc-xpass:     #a87a00;

  --tc-focus:     0 0 0 3px rgba(37,99,217,0.32);
}

/* =========  Telemetry — dark  ========= */
[data-theme="telemetry"][data-scheme="dark"] {
  --tc-bg:        #0c0e12;
  --tc-panel:     #12151a;
  --tc-panel-2:   #181c23;
  --tc-rule:      #1d2128;
  --tc-rule-2:    #2a2f38;
  --tc-ink:       #e6e9ee;
  --tc-ink-2:     #aab1bc;
  --tc-ink-3:     #6b7380;

  --tc-brand:     #ff6a4a;
  --tc-brand-2:   #ff8a5a;
  --tc-brand-fg:  #0c0e12;
  --tc-link:      #74c2ff;

  --tc-pass:      #5fd58a;   --tc-pass-soft:  #5fd58a1f;
  --tc-fail:      #ff5454;   --tc-fail-soft:  #ff54541a;
  --tc-err:       #c084fc;   --tc-err-soft:   #c084fc20;
  --tc-warn:      #ffb547;   --tc-warn-soft:  #ffb54722;
  --tc-skip:      #6b7380;   --tc-skip-soft:  #6b738022;
  --tc-run:       #4ea2ff;   --tc-run-soft:   #4ea2ff22;
  --tc-abort:     #a59e8b;
  --tc-xfail:     #ffb547;
  --tc-xpass:     #ffb547;

  --tc-focus:     0 0 0 3px rgba(78,162,255,0.42);
}

/* =========  Stencil — light ("Paper")  ========= */
[data-theme="stencil"][data-scheme="light"] {
  --tc-font-mono: var(--tc-font-mono-st);

  --tc-bg:        #f6f3ec;
  --tc-panel:     #fcfaf2;
  --tc-panel-2:   #efeae0;
  --tc-rule:      #d9d3c2;
  --tc-rule-2:    #c4bda9;
  --tc-ink:       #15140f;
  --tc-ink-2:     #3d3a32;
  --tc-ink-3:     #6f6a5d;

  --tc-brand:     #c8442d;     /* muted brick */
  --tc-brand-2:   #b13b2b;
  --tc-brand-fg:  #fbf8f0;
  --tc-link:      #2c5aa0;

  --tc-pass:      #3a6f3f;   --tc-pass-soft:  #3a6f3f1c;
  --tc-fail:      #b13b2b;   --tc-fail-soft:  #b13b2b1a;
  --tc-err:       #7d3a8a;   --tc-err-soft:   #7d3a8a18;
  --tc-warn:      #a87a00;   --tc-warn-soft:  #a87a0020;
  --tc-skip:      #6f6a5d;   --tc-skip-soft:  #6f6a5d20;
  --tc-run:       #2c5aa0;   --tc-run-soft:   #2c5aa01c;
  --tc-abort:     #6f6a5d;
  --tc-xfail:     #a87a00;
  --tc-xpass:     #a87a00;

  --tc-focus:     0 0 0 3px rgba(44,90,160,0.32);

  /* Stencil chrome */
  --tc-graph-paper:
    repeating-linear-gradient(0deg, transparent 0 31px, color-mix(in srgb, var(--tc-rule) 33%, transparent) 31px 32px),
    repeating-linear-gradient(90deg, transparent 0 31px, color-mix(in srgb, var(--tc-rule) 20%, transparent) 31px 32px);
}

/* =========  Stencil — dark  ========= */
[data-theme="stencil"][data-scheme="dark"] {
  --tc-font-mono: var(--tc-font-mono-st);

  --tc-bg:        #171410;
  --tc-panel:     #1a1612;
  --tc-panel-2:   #221d17;
  --tc-rule:      #2c2820;
  --tc-rule-2:    #3a342a;
  --tc-ink:       #e8e3d6;
  --tc-ink-2:     #c4bda9;
  --tc-ink-3:     #a59e8b;

  --tc-brand:     #e6573e;
  --tc-brand-fg:  #171410;
  --tc-link:      #9bb8e0;

  --tc-pass:      #6fb274;
  --tc-fail:      #e6573e;
  --tc-err:       #c084d0;
  --tc-warn:      #d6a84a;
  --tc-skip:      #a59e8b;
  --tc-run:       #74a3e0;

  --tc-focus:     0 0 0 3px rgba(155,184,224,0.42);
}

/* =========  Type roles  ========= */
.tc-t-display { font: 400 var(--tc-fs-36)/1.05 var(--tc-font-serif); letter-spacing: -0.01em; }
.tc-t-headline{ font: 400 var(--tc-fs-28)/1.1 var(--tc-font-serif); letter-spacing: -0.01em; }
.tc-t-title   { font: 600 var(--tc-fs-16)/1.3 var(--tc-font-sans); }
.tc-t-body    { font: 400 var(--tc-fs-14)/1.5 var(--tc-font-sans); }
.tc-t-meta    { font: 500 var(--tc-fs-12)/1.4 var(--tc-font-mono); color: var(--tc-ink-3); }
.tc-t-data    { font: 500 var(--tc-fs-13)/1.4 var(--tc-font-mono); }
.tc-t-eyebrow { font: 700 var(--tc-fs-10)/1 var(--tc-font-mono); letter-spacing: 0.16em; text-transform: uppercase; color: var(--tc-ink-3); }
