/* ============================================================
   traceview — system.css (generated from DESIGN.md v1.1)
   The machine-readable contract. Primitives live here ONLY.
   Sections never redefine buttons/inputs/badges/tables.
   ============================================================ */

/* ---------- 0. font binaries (bound from workspace/sources/type-foundries, plan.md §media) ---------- */
@font-face {
  font-family: "Söhne";
  src: url("assets/fonts/sohne-buch.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Söhne";
  src: url("assets/fonts/sohne-halbfett.woff2") format("woff2");
  font-weight: 600;
  font-style: normal;
  font-display: swap;
}

/* ---------- 1. tokens: color ---------- */
:root {
  --tv-canvas: #0A0B0A;
  --tv-panel: #101310;
  --tv-panel-2: #161A16;
  --tv-void: #000000;
  --tv-ink: #E8ECE8;
  --tv-ink-2: #A9B1A9;
  --tv-ink-3: #7C867C;
  --tv-line: rgba(232, 236, 232, 0.09);
  --tv-line-strong: rgba(232, 236, 232, 0.18);
  --tv-accent: #A8FF53;
  --tv-accent-ink: #0A0B0A;
  --tv-accent-wash: rgba(168, 255, 83, 0.12);
  --tv-warn: #FFB224;
  --tv-warn-wash: rgba(255, 178, 36, 0.12);
  --tv-danger: #FF6B5E;
  --tv-danger-wash: rgba(255, 107, 94, 0.12);

  /* ---------- 2. tokens: type ---------- */
  --font-sans: "Söhne", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
  --tv-display-1: clamp(2.75rem, 5.2vw, 4.5rem);
  --tv-display-2: 2.5rem;
  --tv-title: 1.375rem;
  --tv-body: 1rem;
  --tv-body-sm: 0.875rem;
  --tv-mono-label: 0.6875rem;
  --tv-mono-data: 0.8125rem;
  --tv-lh-display: 1.02;
  --tv-lh-tight: 1.15;
  --tv-lh-body: 1.6;
  --tv-ls-display: -0.03em;
  --tv-ls-tight: -0.02em;
  --tv-ls-label: 0.08em;

  /* ---------- 3. tokens: space + radius ---------- */
  --tv-1: 1px;
  --tv-2: 2px;
  --tv-4: 4px;
  --tv-8: 8px;
  --tv-12: 12px;
  --tv-16: 16px;
  --tv-24: 24px;
  --tv-32: 32px;
  --tv-48: 48px;
  --tv-64: 64px;
  --tv-96: 96px;
  --tv-128: 128px;
  --tv-r-none: 0px;
  --tv-r-xs: 2px;
  --tv-r-sm: 4px;
  --tv-r-md: 8px;
  --tv-container: 1200px;

  /* ---------- 4. tokens: motion ---------- */
  --tv-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --tv-dur-fast: 160ms;
  --tv-dur-med: 320ms;
  --tv-dur-rise: 600ms;
}

/* ---------- 5. Tailwind @theme bridge ---------- */
@theme {
  --color-canvas: #0A0B0A;
  --color-panel: #101310;
  --color-panel-2: #161A16;
  --color-ink: #E8ECE8;
  --color-ink-2: #A9B1A9;
  --color-ink-3: #7C867C;
  --color-accent: #A8FF53;
  --color-warn: #FFB224;
  --color-danger: #FF6B5E;
  --font-sans: "Söhne", "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-mono: "JetBrains Mono", "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}

/* ---------- 6. base ---------- */
*,
*::before,
*::after { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--tv-canvas);
  color: var(--tv-ink);
  font-family: var(--font-sans);
  font-size: var(--tv-body);
  line-height: var(--tv-lh-body);
  -webkit-font-smoothing: antialiased;
}

img, svg { display: block; }
a { color: inherit; text-decoration: none; }
button { font: inherit; cursor: pointer; }

::selection { background: var(--tv-accent); color: var(--tv-accent-ink); }

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

/* ---------- 7. typographic primitives ---------- */
.tv-display-1 {
  font-size: var(--tv-display-1);
  line-height: var(--tv-lh-display);
  letter-spacing: var(--tv-ls-display);
  font-weight: 600;
  margin: 0;
}

.tv-display-2 {
  font-size: var(--tv-display-2);
  line-height: var(--tv-lh-tight);
  letter-spacing: var(--tv-ls-tight);
  font-weight: 600;
  margin: 0;
}

.tv-title {
  font-size: var(--tv-title);
  line-height: 1.25;
  letter-spacing: -0.01em;
  font-weight: 600;
  margin: 0;
}

.tv-body-sm { font-size: var(--tv-body-sm); line-height: 1.55; color: var(--tv-ink-2); }

.tv-mono-label {
  font-family: var(--font-mono);
  font-size: var(--tv-mono-label);
  font-weight: 500;
  letter-spacing: var(--tv-ls-label);
  text-transform: uppercase;
  color: var(--tv-ink-3);
}

.tv-mono-data {
  font-family: var(--font-mono);
  font-size: var(--tv-mono-data);
  font-variant-numeric: tabular-nums;
}

.tv-mono-code {
  font-family: var(--font-mono);
  font-size: var(--tv-mono-data);
  line-height: 1.6;
  font-variant-numeric: tabular-nums;
}

.tv-num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  letter-spacing: -0.02em;
}

/* ---------- 8. buttons ---------- */
.tv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--tv-8);
  border: 1px solid transparent;
  border-radius: var(--tv-r-sm);
  font-weight: 600;
  font-size: var(--tv-body-sm);
  line-height: 1;
  padding: var(--tv-12) var(--tv-24);
  transition: filter var(--tv-dur-fast) var(--tv-ease), background-color var(--tv-dur-fast) var(--tv-ease), border-color var(--tv-dur-fast) var(--tv-ease), color var(--tv-dur-fast) var(--tv-ease);
}

.tv-btn-primary {
  background: var(--tv-accent);
  color: var(--tv-accent-ink);
  border-color: var(--tv-accent);
}
.tv-btn-primary:hover { filter: brightness(1.06); }
.tv-btn-primary:active { transform: translateY(1px); }

.tv-btn-ghost {
  background: transparent;
  color: var(--tv-ink);
  border-color: var(--tv-line-strong);
}
.tv-btn-ghost:hover { background: rgba(232, 236, 232, 0.04); border-color: var(--tv-ink-3); }

.tv-btn-terminal {
  background: transparent;
  color: var(--tv-accent);
  border: none;
  padding: var(--tv-12) var(--tv-4);
  font-family: var(--font-mono);
  font-size: var(--tv-mono-label);
  font-weight: 500;
  letter-spacing: var(--tv-ls-label);
  text-transform: uppercase;
}
.tv-btn-terminal::before { content: ">> "; color: var(--tv-ink-3); }
.tv-btn-terminal:hover { filter: brightness(1.15); }

/* ---------- 9. inputs ---------- */
.tv-input {
  background: var(--tv-panel-2);
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-r-sm);
  color: var(--tv-ink);
  font-family: var(--font-mono);
  font-size: var(--tv-body-sm);
  padding: var(--tv-12) var(--tv-16);
  transition: border-color var(--tv-dur-fast) var(--tv-ease);
}
.tv-input::placeholder { color: var(--tv-ink-3); font-family: var(--font-mono); }
.tv-input:hover { border-color: var(--tv-line-strong); }
.tv-input:focus {
  outline: none;
  border-color: var(--tv-accent);
}

/* ---------- 10. badges / status ---------- */
.tv-badge {
  display: inline-flex;
  align-items: center;
  gap: var(--tv-8);
  border-radius: var(--tv-r-xs);
  font-family: var(--font-mono);
  font-size: var(--tv-mono-label);
  font-weight: 500;
  letter-spacing: var(--tv-ls-label);
  text-transform: uppercase;
  padding: var(--tv-4) var(--tv-8);
  border: 1px solid var(--tv-line);
  color: var(--tv-ink-2);
  background: var(--tv-panel);
}

.tv-badge--live { color: var(--tv-accent); border-color: rgba(168, 255, 83, 0.25); background: var(--tv-accent-wash); }
.tv-badge--warn { color: var(--tv-warn); border-color: rgba(255, 178, 36, 0.25); background: var(--tv-warn-wash); }
.tv-badge--flag { color: var(--tv-danger); border-color: rgba(255, 107, 94, 0.25); background: var(--tv-danger-wash); }

.tv-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--tv-accent);
  flex-shrink: 0;
}
.tv-dot--live { animation: tv-pulse 2s var(--tv-ease) infinite; }
.tv-dot--warn { background: var(--tv-warn); }
.tv-dot--danger { background: var(--tv-danger); }

@keyframes tv-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.35; }
}

/* ---------- 11. panel / card ---------- */
.tv-panel {
  background: var(--tv-panel);
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-r-sm);
}

.tv-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--tv-16);
  padding: var(--tv-12) var(--tv-16);
  border-bottom: 1px solid var(--tv-line);
}

/* ---------- 12. hairline data table (gap:1px technique) ---------- */
.tv-hairgrid {
  display: grid;
  gap: var(--tv-1);
  background: var(--tv-line);
  border: 1px solid var(--tv-line);
}

.tv-hairgrid > * { background: var(--tv-panel); }

/* ---------- 13. install chip ---------- */
.tv-chip {
  display: inline-flex;
  align-items: center;
  gap: var(--tv-8);
  font-family: var(--font-mono);
  font-size: var(--tv-mono-data);
  color: var(--tv-ink-2);
  background: var(--tv-panel-2);
  border: 1px solid var(--tv-line);
  border-radius: var(--tv-r-sm);
  padding: var(--tv-8) var(--tv-16);
}
.tv-chip__prompt { color: var(--tv-accent); user-select: none; }
.tv-chip__copy {
  border: none;
  background: none;
  color: var(--tv-ink-3);
  font-family: var(--font-mono);
  font-size: var(--tv-mono-label);
  text-transform: uppercase;
  letter-spacing: var(--tv-ls-label);
  padding: 0;
}
.tv-chip__copy:hover { color: var(--tv-accent); }

/* ---------- 14. data table ---------- */
.tv-table { width: 100%; border-collapse: collapse; }
.tv-table th {
  font-family: var(--font-mono);
  font-size: var(--tv-mono-label);
  font-weight: 500;
  letter-spacing: var(--tv-ls-label);
  text-transform: uppercase;
  color: var(--tv-ink-3);
  text-align: left;
  padding: var(--tv-8) var(--tv-12);
  border-bottom: 1px solid var(--tv-line);
  background: var(--tv-panel-2);
}
.tv-table td {
  padding: var(--tv-8) var(--tv-12);
  border-bottom: 1px solid var(--tv-line);
  font-family: var(--font-mono);
  font-size: var(--tv-mono-data);
  font-variant-numeric: tabular-nums;
}
.tv-table tr:hover td { background: rgba(232, 236, 232, 0.04); }

/* ---------- 15. reduced-motion floor ---------- */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
  .tv-marquee__track { animation: none !important; }
  .tv-reveal { opacity: 1 !important; transform: none !important; filter: none !important; }
}
