/* Shared styling for the FPS-meter demos embedded in the blog.
   Instrument-panel look, tuned to match the blog's warm/rust palette
   and its light + dark themes. Kept framework-agnostic so the React
   and Angular demos render identically. */

:root {
  --bg: #fbfaf7;
  --surface: #ffffff;
  --text: #1c1917;
  --muted: #78716c;
  --border: #e7e5e4;
  --accent: #c2410c;
  --good: #15803d;
  --mid: #b45309;
  --bad: #b91c1c;
  --track: #f1efe9;
  --grid: rgba(28, 25, 23, 0.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #1c1917;
    --surface: #292524;
    --text: #f5f5f4;
    --muted: #a8a29e;
    --border: #44403c;
    --accent: #fb923c;
    --good: #4ade80;
    --mid: #fbbf24;
    --bad: #f87171;
    --track: #211d1b;
    --grid: rgba(245, 245, 244, 0.05);
  }
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
}

body {
  font-family: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: var(--bg);
  color: var(--text);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 16px;
  -webkit-font-smoothing: antialiased;
}

.panel {
  width: 100%;
  max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 22px 24px 20px;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 8px 24px rgba(0, 0, 0, 0.05);
  /* faint graph-paper texture for an "instrument" feel */
  background-image:
    linear-gradient(var(--grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--grid) 1px, transparent 1px);
  background-size: 22px 22px;
}

.top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 4px;
}

.badge {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 0.78rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg);
}
.badge .dot { width: 9px; height: 9px; border-radius: 50%; }
.badge.react .dot { background: #61dafb; }
.badge.angular .dot { background: #dd0031; }

.label {
  font-family: "Newsreader", Georgia, serif;
  font-style: italic;
  font-size: 0.95rem;
  color: var(--muted);
}

.readout {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin: 2px 0 14px;
}
.value {
  font-family: "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  font-weight: 500;
  font-size: clamp(3.4rem, 16vw, 5.2rem);
  line-height: 0.9;
  letter-spacing: -0.03em;
  font-variant-numeric: tabular-nums;
  transition: color 0.25s ease;
  color: var(--good);
}
.value.good { color: var(--good); text-shadow: 0 0 26px color-mix(in srgb, var(--good) 35%, transparent); }
.value.mid  { color: var(--mid);  text-shadow: 0 0 26px color-mix(in srgb, var(--mid)  35%, transparent); }
.value.bad  { color: var(--bad);  text-shadow: 0 0 30px color-mix(in srgb, var(--bad)  45%, transparent); }
.unit {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  font-size: 0.95rem;
  color: var(--muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.bars {
  display: flex;
  align-items: flex-end;
  gap: 2px;
  height: 64px;
  padding: 6px;
  background: var(--track);
  border-radius: 8px;
  border: 1px solid var(--border);
  margin-bottom: 16px;
  overflow: hidden;
}
.bar {
  flex: 1 1 0;
  min-width: 0;
  height: 2px;
  border-radius: 2px 2px 0 0;
  background: var(--good);
  transition: height 0.18s ease, background-color 0.18s ease;
}
.bar.good { background: var(--good); }
.bar.mid  { background: var(--mid); }
.bar.bad  { background: var(--bad); }

.controls {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.burn-btn {
  appearance: none;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-weight: 600;
  font-size: 0.92rem;
  padding: 10px 16px;
  border-radius: 10px;
  cursor: pointer;
  transition: transform 0.08s ease, background-color 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  user-select: none;
}
.burn-btn:hover { border-color: var(--accent); }
.burn-btn:active { transform: translateY(1px); }
.burn-btn.active {
  background: var(--bad);
  border-color: var(--bad);
  color: #fff;
  box-shadow: 0 0 0 4px color-mix(in srgb, var(--bad) 20%, transparent);
  animation: pulse 1.1s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 3px color-mix(in srgb, var(--bad) 22%, transparent); }
  50%      { box-shadow: 0 0 0 8px color-mix(in srgb, var(--bad) 8%, transparent); }
}

.load {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 0.82rem;
  color: var(--muted);
}
.load input[type="range"] {
  width: 116px;
  accent-color: var(--accent);
  cursor: pointer;
}
.load .depth {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  color: var(--text);
  min-width: 1.4em;
  text-align: right;
}

.hint {
  margin: 14px 0 0;
  font-size: 0.78rem;
  color: var(--muted);
}
.hint code {
  font-family: "JetBrains Mono", ui-monospace, monospace;
  background: var(--track);
  border: 1px solid var(--border);
  padding: 1px 6px;
  border-radius: 5px;
  font-size: 0.92em;
}

@media (prefers-reduced-motion: reduce) {
  .burn-btn.active { animation: none; }
  .value, .bar { transition: none; }
}
