/*
 * Shared RitchAI navbar + live ticker.
 *
 * This file is injected into EVERY page on the site, including the pages built
 * by the Inside Trader (Flask) and Macro (Vite) repos. Those pages carry their
 * own stylesheets and their own :root custom properties, so nothing here may
 * depend on the host page: every selector is prefixed `.rai-` and every colour
 * is resolved from `--rai-*` variables declared on `.rai-bar` itself.
 *
 * Served from the site root, so `/ritchai-nav.css` resolves from any depth
 * (e.g. /portfolio-tracker/overlap/365/all/).
 */

.rai-bar {
  --rai-bg: #0A0D10;
  --rai-elev: #11161B;
  --rai-surface: #151B21;
  --rai-border: #1C242B;
  --rai-text: #E8EEF2;
  --rai-muted: #8A97A3;
  --rai-dim: #5C6873;
  --rai-green: #34E29A;
  --rai-green-dim: #1F7A56;
  --rai-red: #F0616D;

  position: relative;
  z-index: 2147483000; /* above host-page sticky headers */
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  line-height: 1.55;
}

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

/* ── Nav ─────────────────────────────────────────────────────────────────── */

.rai-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px 32px;
  background: rgba(10, 13, 16, .92);
  backdrop-filter: blur(14px);
  border-bottom: 1px solid var(--rai-border);
}

.rai-brand {
  display: flex;
  align-items: center;
  gap: 11px;
  font-family: 'Space Grotesk', 'Inter', system-ui, sans-serif;
  text-decoration: none;
  flex-shrink: 0;
}

.rai-brand .rai-mark {
  width: 30px;
  height: 30px;
  border-radius: 8px;
  display: grid;
  place-items: center;
  overflow: hidden;
  background: linear-gradient(145deg, var(--rai-green), var(--rai-green-dim));
  color: #04120C;
  font-weight: 700;
  font-size: 15px;
  box-shadow: 0 0 22px -6px var(--rai-green);
}

.rai-brand .rai-mark img { width: 100%; height: 100%; object-fit: cover; display: block; }

.rai-brand b {
  font-weight: 600;
  font-size: 17px;
  letter-spacing: -.01em;
  color: var(--rai-text);
}

.rai-brand b span { color: var(--rai-green); }

.rai-links { display: flex; align-items: center; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }

.rai-links a {
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
  color: var(--rai-muted);
  text-decoration: none;
  padding: 8px 14px;
  border-radius: 7px;
  transition: color .18s, background-color .18s;
  white-space: nowrap;
}

.rai-links a:hover { color: var(--rai-text); background: var(--rai-surface); }
.rai-links a.rai-active { color: var(--rai-green); }

/* ── Ticker ──────────────────────────────────────────────────────────────── */

.rai-ticker {
  border-bottom: 1px solid var(--rai-border);
  background: var(--rai-elev);
  overflow: hidden;
  font-family: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 12.5px;
}

.rai-ticker-track {
  display: inline-flex;
  gap: 34px;
  padding: 9px 0;
  white-space: nowrap;
  animation: rai-scroll 38s linear infinite;
  will-change: transform;
}

.rai-ticker:hover .rai-ticker-track { animation-play-state: paused; }

.rai-tk { color: var(--rai-muted); }
.rai-tk b { color: var(--rai-text); font-weight: 500; margin-right: 8px; }
.rai-up { color: var(--rai-green); }
.rai-down { color: var(--rai-red); }
.rai-flat { color: var(--rai-dim); }

@keyframes rai-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

@media (max-width: 760px) {
  .rai-nav { padding: 12px 16px; gap: 8px; }
  .rai-links { gap: 0; }
  .rai-links a { padding: 7px 8px; font-size: 11.5px; }
  .rai-brand b { font-size: 15px; }
}

@media (prefers-reduced-motion: reduce) {
  .rai-ticker-track { animation: none; }
  .rai-links a { transition: none; }
}
