/* Metrics Lab design tokens.
   Source of truth: metricslab/brand_profile.json + metricslab.io/tailwind.config.mjs
   Palette is WCAG-constrained: Signal Amber is never used for body text. */

:root {
  /* Core palette */
  --ml-navy: #0a0f1f;          /* Lab Navy - canvas */
  --ml-navy-800: #111a2e;
  --ml-navy-700: #18233c;
  --ml-navy-600: #22304f;
  --ml-amber: #ffbd02;         /* Signal Amber - primary accent */
  --ml-amber-600: #e0a500;
  --ml-amber-soft: #ffe8a6;
  --ml-blue: #3790e4;          /* Instrument Blue - secondary */
  --ml-blue-deep: #10508b;
  --ml-mint: #84ebb4;          /* Accent - success / live */
  --ml-paper: #fafafa;         /* Text on dark */
  --ml-claw: #ef4a3c;          /* Danger */

  --ml-text: var(--ml-paper);
  --ml-text-dim: #9aa6bd;
  --ml-text-faint: #64708a;
  --ml-line: rgb(250 250 250 / 0.1);
  --ml-line-strong: rgb(250 250 250 / 0.18);

  /* Typography - Titillium Web for display, Nunito for body */
  --ml-font-display: "Titillium Web", system-ui, sans-serif;
  --ml-font: Nunito, system-ui, -apple-system, "Segoe UI", sans-serif;

  --ml-radius: 1rem;
  --ml-radius-lg: 1.5rem;
  --ml-radius-pill: 999px;

  --ml-shadow-lift: 0 24px 60px -20px rgb(3 8 20 / 0.55);
  --ml-shadow-glow: 0 0 0 1px rgb(55 144 228 / 0.25), 0 18px 50px -24px rgb(55 144 228 / 0.45);

  color-scheme: dark;
}

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

/* Any author `display` beats the UA sheet's `[hidden] { display: none }`,
   so hiding by attribute needs to be restated with weight. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(120% 90% at 82% 8%, rgb(55 144 228 / 0.18), transparent 62%),
    radial-gradient(90% 80% at 8% 96%, rgb(255 189 2 / 0.1), transparent 60%),
    linear-gradient(160deg, var(--ml-navy-800), var(--ml-navy));
  background-attachment: fixed;
  color: var(--ml-text);
  font-family: var(--ml-font);
  font-size: 15px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1,
h2,
h3,
.display {
  font-family: var(--ml-font-display);
  font-weight: 700;
  letter-spacing: -0.01em;
  margin: 0;
}

/* Metrics are always tabular - a brand rule, not a preference. */
.num,
.metric {
  font-variant-numeric: tabular-nums;
}

.card {
  border: 1px solid var(--ml-line);
  border-radius: var(--ml-radius-lg);
  background: linear-gradient(160deg, rgb(17 26 46 / 0.9), rgb(10 15 31 / 0.9));
  box-shadow: var(--ml-shadow-lift);
}

@supports (backdrop-filter: blur(6px)) {
  .card {
    background: linear-gradient(150deg, rgb(55 144 228 / 0.08), rgb(17 26 46 / 0.72));
    backdrop-filter: blur(6px) saturate(125%);
  }
}

.btn {
  font-family: var(--ml-font);
  font-weight: 700;
  font-size: 14px;
  border: 0;
  border-radius: var(--ml-radius-pill);
  padding: 0.7rem 1.4rem;
  cursor: pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}

.btn:hover:not(:disabled) {
  transform: translateY(-1px);
  filter: brightness(1.08);
}

.btn:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

.btn-primary {
  background: var(--ml-amber);
  color: var(--ml-navy);
}

.btn-ghost {
  background: transparent;
  color: var(--ml-text);
  border: 1px solid var(--ml-line-strong);
}

.input {
  width: 100%;
  font-family: var(--ml-font);
  font-size: 14px;
  color: var(--ml-text);
  background: rgb(10 15 31 / 0.6);
  border: 1px solid var(--ml-line-strong);
  border-radius: var(--ml-radius-pill);
  padding: 0.7rem 1.1rem;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.input::placeholder {
  color: var(--ml-text-faint);
}

.input:focus {
  border-color: var(--ml-blue);
  box-shadow: 0 0 0 3px rgb(55 144 228 / 0.2);
}

.pill {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 12px;
  font-weight: 700;
  padding: 0.25rem 0.7rem;
  border-radius: var(--ml-radius-pill);
  border: 1px solid var(--ml-line-strong);
  color: var(--ml-text-dim);
}

.pill-live {
  color: var(--ml-mint);
  border-color: rgb(132 235 180 / 0.4);
  background: rgb(132 235 180 / 0.1);
}

.pill-warn {
  color: var(--ml-amber);
  border-color: rgb(255 189 2 / 0.4);
  background: rgb(255 189 2 / 0.1);
}

.pill-err {
  color: var(--ml-claw);
  border-color: rgb(239 74 60 / 0.4);
  background: rgb(239 74 60 / 0.1);
}

.dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
}

.pill-live .dot {
  animation: ml-pulse 1.6s ease-in-out infinite;
}

@keyframes ml-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%      { opacity: 0.4; transform: scale(0.8); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}
