/* =============================================================================
   MUSE · Base — reset, document defaults, primitives, utilities
   ========================================================================== */

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

html, body { height: 100%; }

body {
  font-family: var(--font-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
  background: var(--canvas);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  overflow: hidden;            /* the app owns its own scroll regions */
}

button, input, textarea, select { font: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; }
a { color: inherit; text-decoration: none; }
img, svg { display: block; max-width: 100%; }
:focus { outline: none; }
:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: var(--r-xs);
}

/* Inline SVG icons (Phosphor set, US-019) inherit color + size from context.
   Stroke width comes from each SVG's own attribute — don't override it here. */
.icon { width: 18px; height: 18px; flex: none; }
.icon--sm { width: 16px; height: 16px; }
.icon--lg { width: 22px; height: 22px; }

/* Scrollbars — quiet, on-brand */
.scroll { scrollbar-width: thin; scrollbar-color: var(--ink-faint) transparent; }
.scroll::-webkit-scrollbar { width: 10px; height: 10px; }
.scroll::-webkit-scrollbar-track { background: transparent; }
.scroll::-webkit-scrollbar-thumb {
  background: var(--ink-faint);
  border-radius: var(--r-pill);
  border: 3px solid transparent;
  background-clip: content-box;
}
.scroll::-webkit-scrollbar-thumb:hover { background: var(--ink-low); }

/* ── Typographic primitives ──────────────────────────────────────────────── */
.eyebrow {
  font: 600 10.5px/1 var(--font-ui);
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-low);
}
.tnum { font-variant-numeric: tabular-nums; }
.mono { font-family: var(--font-mono); }

/* ── Buttons ─────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: var(--s-2);
  height: 38px; padding: 0 16px;
  border-radius: var(--r-pill);
  font: 500 13.5px/1 var(--font-ui);
  letter-spacing: -0.01em;
  color: var(--ink);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  transition: background var(--dur-fast) var(--ease-out),
              box-shadow var(--dur-fast) var(--ease-out),
              transform var(--dur-fast) var(--ease-out);
}
.btn:hover { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.btn:active { transform: scale(0.97); }
.btn .icon { width: 17px; height: 17px; }

.btn--primary {
  color: var(--on-accent);
  background: var(--accent-grad);
  box-shadow: var(--sh-accent);
}
.btn--primary:hover { box-shadow: var(--sh-accent), 0 0 0 4px var(--accent-soft); background: var(--accent-grad); }

.btn--ghost { background: transparent; box-shadow: none; color: var(--ink-mid); }
.btn--ghost:hover { background: var(--hover); box-shadow: none; color: var(--ink); }

.btn--danger { color: var(--on-accent); background: var(--danger); box-shadow: none; }
.btn--danger:hover { background: color-mix(in srgb, var(--danger) 86%, #000); box-shadow: 0 0 0 4px var(--danger-soft); }

.btn--sm { height: 32px; padding: 0 12px; font-size: 12.5px; }
.btn--lg { height: 46px; padding: 0 22px; font-size: 15px; }
.btn--block { width: 100%; }

/* Icon-only button */
.iconbtn {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: var(--r-sm);
  color: var(--ink-mid);
  transition: background var(--dur-fast) var(--ease-out), color var(--dur-fast) var(--ease-out);
}
.iconbtn:hover { background: var(--hover); color: var(--ink); }
.iconbtn:active { background: var(--hover-strong); }
.iconbtn--sm { width: 28px; height: 28px; border-radius: var(--r-xs); }

/* ── Form fields ─────────────────────────────────────────────────────────── */
.field {
  width: 100%; height: 46px; padding: 0 14px;
  border-radius: var(--r-md);
  background: var(--surface);
  box-shadow: inset 0 0 0 1px var(--line);
  color: var(--ink);
  transition: box-shadow var(--dur-fast) var(--ease-out);
}
.field::placeholder { color: var(--ink-low); }
.field:focus { box-shadow: inset 0 0 0 1.5px var(--accent), 0 0 0 4px var(--accent-soft); }

.label { display: block; font: 500 12.5px/1 var(--font-ui); color: var(--ink-2); margin-bottom: var(--s-2); }

/* ── Pills / chips / badges ──────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  height: 26px; padding: 0 10px;
  border-radius: var(--r-pill);
  font: 500 11.5px/1 var(--font-ui);
  color: var(--ink-mid);
  background: var(--sunken);
}
.dot { width: 7px; height: 7px; border-radius: 50%; background: var(--ink-low); flex: none; }
.dot--ok { background: var(--ok); }
.dot--live { background: var(--accent); box-shadow: 0 0 0 0 var(--accent-tint); animation: muse-pulse 2.2s var(--ease-in-out) infinite; }

@keyframes muse-pulse {
  0%   { box-shadow: 0 0 0 0 var(--accent-tint); }
  70%  { box-shadow: 0 0 0 7px rgba(226,59,59,0); }
  100% { box-shadow: 0 0 0 0 rgba(226,59,59,0); }
}

/* ── Helpers ─────────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
[hidden] { display: none !important; }
.spin { animation: muse-spin 0.9s linear infinite; }
@keyframes muse-spin { to { transform: rotate(360deg); } }
