/* lib/topbar.css — shared Bloomberg-style topbar component.
   Loaded by every page that mounts <div id="topbar-mount" data-active="…">.
   Owns ALL styling for the three-row dark header: ticker, brand, nav. The
   page CSS only handles page-specific chrome below this strip.

   Active-link highlighting is driven by `data-active` on the mount div
   (rendered into class="active" on the matching <a>).

   Theme: dark forced, regardless of body.light — terminal chrome stays
   dark across both modes.
   --------------------------------------------------------------------- */

/* ── Outer band: full-bleed across the viewport ──────────────────────── */
.tb-bar{
  position:sticky;top:0;z-index:30;
  display:flex;flex-direction:column;
  margin:0 calc(50% - 50vw) 22px;
  background:#000;
  border-bottom:1px solid rgba(255,138,0,.30);
}
body.light .tb-bar{background:#000}
.tb-row{
  display:flex;align-items:center;justify-content:space-between;
  max-width:1320px;margin:0 auto;width:100%;
  padding:0 24px;
}

/* ── Row 0: Ticker ───────────────────────────────────────────────────── */
.tb-ticker-row{
  height:34px;background:#04050a;
  border-bottom:1px solid rgba(255,255,255,.05);
  padding-left:0;padding-right:0;
  overflow:hidden;gap:0;
}
.tb-ticker-label{
  flex-shrink:0;
  display:inline-flex;align-items:center;
  padding:0 16px;height:100%;
  font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;
  font-size:10px;font-weight:800;letter-spacing:.18em;
  text-transform:uppercase;color:var(--tb-accent,#ff8a00);
  border-right:1px solid rgba(255,138,0,.18);
  background:rgba(255,138,0,.06);
}
.tb-ticker-viewport{
  flex:1 1 auto;height:100%;overflow:hidden;position:relative;min-width:0;
}
.tb-ticker-viewport::after{
  content:'';position:absolute;right:0;top:0;bottom:0;width:60px;
  background:linear-gradient(90deg,transparent 0%,#04050a 90%);
  pointer-events:none;z-index:2;
}
.tb-ticker-strip{
  display:inline-flex;align-items:center;height:100%;gap:0;white-space:nowrap;
  will-change:transform;
}
/* Animation runs ONLY when the .ticking class is present — added by JS
   after the strip has real items. Starting the animation while the strip
   was still 0-width (loading placeholder) caused Safari to compute
   translateX off the wrong width, then "snap" once real items rendered —
   the symptom the user reported (static, then disappear, then scroll). */
.tb-ticker-strip.ticking{
  animation:tb-ticker-scroll 90s linear infinite;
}
.tb-ticker-strip.ticking:hover{animation-play-state:paused}
@keyframes tb-ticker-scroll{
  from{transform:translateX(0)}
  to{transform:translateX(-50%)}
}
.tb-ticker-item{
  display:inline-flex;align-items:center;gap:8px;
  padding:0 16px;height:100%;text-decoration:none;
  color:rgba(255,255,255,.82);
  border-right:1px solid rgba(255,255,255,.05);
  font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;
  font-size:11px;font-weight:700;
  transition:background .12s ease;
}
.tb-ticker-item:hover{background:rgba(255,255,255,.04)}
.tb-ticker-logo{
  width:18px;height:18px;border-radius:3px;object-fit:cover;
  background:rgba(255,255,255,.05);flex-shrink:0;
}
.tb-ticker-name{
  color:#fff;font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',sans-serif;
  font-size:11.5px;font-weight:600;letter-spacing:-.005em;
  max-width:140px;overflow:hidden;text-overflow:ellipsis;
}
.tb-ticker-price{color:rgba(255,255,255,.85);letter-spacing:0;font-feature-settings:"tnum"}
.tb-ticker-change{
  display:inline-flex;align-items:center;gap:2px;
  padding:2px 6px;border-radius:3px;
  font-size:10.5px;font-weight:800;letter-spacing:0;
  font-feature-settings:"tnum";
}
.tb-ticker-change.pos{background:rgba(30,196,102,.12);color:#1ec466}
.tb-ticker-change.neg{background:rgba(255,77,94,.12);color:#ff4d5e}
.tb-ticker-change.flat{background:rgba(255,255,255,.04);color:rgba(255,255,255,.55)}
.tb-ticker-empty{padding:0 16px;color:rgba(255,255,255,.4);font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;font-size:11px;letter-spacing:.04em}

/* ── Row 1: Brand wordmark + utility cluster ─────────────────────────── */
.tb-brand-row{
  height:62px;border-bottom:1px solid rgba(255,255,255,.06);
}
.tb-brand{
  display:flex;align-items:center;gap:14px;cursor:pointer;
  text-decoration:none;color:inherit;height:100%;
}
.tb-brand-bar{
  width:4px;height:32px;background:var(--tb-accent,#ff8a00);border-radius:1px;
  display:inline-block;flex-shrink:0;
  box-shadow:0 0 12px rgba(255,138,0,.45);
}
.tb-brand-name{
  font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',sans-serif;
  font-size:26px;font-weight:800;letter-spacing:-.02em;color:#fff;line-height:1;
}
.tb-brand-tag{
  font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;
  font-size:11px;font-weight:700;letter-spacing:.22em;
  color:var(--tb-accent,#ff8a00);text-transform:uppercase;line-height:1;
  padding-left:12px;border-left:1px solid rgba(255,255,255,.14);
}
.tb-actions{display:flex;gap:8px;align-items:center;margin-left:auto}
.tb-theme-btn{
  display:inline-flex;align-items:center;gap:7px;
  height:30px;padding:0 12px;border-radius:4px;
  border:1px solid rgba(255,255,255,.14);background:rgba(255,255,255,.04);
  color:rgba(255,255,255,.78);
  cursor:pointer;font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;
  font-size:11px;font-weight:700;letter-spacing:.06em;text-transform:uppercase;
  transition:border-color .12s ease, color .12s ease, background .12s ease;
}
.tb-theme-btn:hover{border-color:var(--tb-accent,#ff8a00);color:var(--tb-accent,#ff8a00);background:rgba(255,138,0,.10)}
.tb-theme-btn .tb-theme-icn{font-size:14px;line-height:1}

/* ── Row 2: Nav strip ────────────────────────────────────────────────── */
.tb-nav-row{
  height:38px;background:#06070a;
}
.tb-nav{display:flex;align-items:stretch;gap:0;height:100%;margin-left:0;flex:1 1 auto}
.tb-nav-link{
  position:relative;display:inline-flex;align-items:center;
  height:100%;padding:0 16px;
  color:rgba(255,255,255,.62);text-decoration:none;
  font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',sans-serif;
  font-size:13px;font-weight:600;letter-spacing:.005em;
  transition:color .12s ease, background .12s ease;
}
.tb-nav-link:first-child{padding-left:0}
.tb-nav-link:hover{color:#fff;background:rgba(255,255,255,.04)}
.tb-nav-link.active{color:#fff}
.tb-nav-link.active::after{
  content:'';position:absolute;left:16px;right:16px;bottom:0;
  height:2px;background:var(--tb-accent,#ff8a00);
}
.tb-nav-link:first-child.active::after{left:0;right:16px}

/* ── Optional breadcrumb on nav row (collection detail page) ─────────── */
.tb-crumb{
  display:flex;align-items:center;gap:6px;
  height:100%;padding:0 16px;margin-left:auto;
  color:rgba(255,255,255,.88);
  font-family:-apple-system,BlinkMacSystemFont,'Inter','Segoe UI',sans-serif;
  font-size:12px;font-weight:600;
}
.tb-crumb-sep{
  color:var(--tb-accent,#ff8a00);opacity:.7;font-weight:600;
  font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;
}

/* ── Responsive: stack hint at narrow widths ─────────────────────────── */
@media(max-width:780px){
  .tb-row{padding:0 14px}
  .tb-brand-name{font-size:20px}
  .tb-brand-tag{font-size:10px;letter-spacing:.18em;padding-left:10px}
  .tb-nav-link{padding:0 12px;font-size:12px}
  .tb-ticker-label{padding:0 12px;font-size:9.5px}
}

/* ── Top Gainers / Top Losers in the topbar ticker row ─────────────
   2026-05-27 v2: ONE continuous scrolling strip (back to the original
   marquee behavior), but the content is curated — labels mark the
   start of each section so the user can read at a glance:

     [ ▲ Top Gainers · 24h ] [green chips] [ ▼ Top Losers · 24h ] [red chips]

   Strip is doubled by JS so the CSS translateX(-50%) loop never gaps. */
.tb-ticker-section-label{
  display:inline-flex;align-items:center;height:100%;
  padding:0 16px;flex-shrink:0;
  font-family:'JetBrains Mono',ui-monospace,'SF Mono',Menlo,monospace;
  font-size:10px;font-weight:800;letter-spacing:.14em;text-transform:uppercase;
  border-right:1px solid rgba(255,255,255,.06);
  border-left:1px solid rgba(255,255,255,.06);
}
.tb-ticker-section-label-up{color:#26a69a;background:rgba(38,166,154,.05)}
.tb-ticker-section-label-down{color:#ef5350;background:rgba(239,83,80,.05)}
