/* /carnegie/create/ticker.css — Bloomberg-style horizontal marquee.
 *
 * Visual: dark navy bar, monospace text. Positive items render in green
 * (▲ glyph), alert items in red (▼ glyph). Constantly slides right-to-left;
 * pauses on hover for readability.
 */

:root {
  --news-ticker-height: 36px;
  --news-ticker-bg: #0b1116;
  --news-ticker-fg: #e6ebef;
  --news-ticker-positive: #2bd47b;    /* green */
  --news-ticker-alert: #ff4d4d;       /* red */
  --news-ticker-sep-fg: #2a3340;
}

#create-news-ticker.news-ticker {
  position: sticky;
  top: 0;
  z-index: 80;                /* above page content, below modals */
  width: 100%;
  height: var(--news-ticker-height);
  background: var(--news-ticker-bg);
  color: var(--news-ticker-fg);
  font-family: 'Fira Code', 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 13px;
  line-height: var(--news-ticker-height);
  display: flex;
  align-items: stretch;
  overflow: hidden;
  user-select: none;
  -webkit-user-select: none;
  border-bottom: 1px solid #1a2129;
}

#create-news-ticker[hidden] { display: none !important; }

/* The scrolling track. Two identical strips back-to-back; translate
   -50% on the parent loops infinitely with no jump. */
.news-ticker-track {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  width: max-content;
  animation: news-ticker-scroll 90s linear infinite;
  will-change: transform;
}
@keyframes news-ticker-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}
.news-ticker:hover .news-ticker-track {
  animation-play-state: paused;
}

.news-ticker-strip {
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
}

.news-ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0 22px;
}

.news-ticker-symbol {
  font-weight: 700;
  font-size: 12px;
  letter-spacing: 0;
}

.news-ticker-text {
  font-weight: 500;
  letter-spacing: 0.005em;
}

/* Kind-specific coloring. Apply to both the glyph and the text so the
   whole entry reads as one semantic unit. */
.news-ticker-item--positive .news-ticker-symbol,
.news-ticker-item--positive .news-ticker-text {
  color: var(--news-ticker-positive);
}
.news-ticker-item--alert .news-ticker-symbol,
.news-ticker-item--alert .news-ticker-text {
  color: var(--news-ticker-alert);
}

.news-ticker-sep {
  color: var(--news-ticker-sep-fg);
  font-size: 8px;
  padding: 0 4px;
}

/* Position:sticky with top:0 keeps the ticker pinned while the rest of
   the page (including create-header) flows below in normal document
   order. No padding hack needed — sticky occupies layout space at
   scroll position 0. */

/* Phone: slightly smaller chrome + faster loop. */
@media (max-width: 640px) {
  :root {
    --news-ticker-height: 32px;
  }
  #create-news-ticker.news-ticker {
    font-size: 12px;
  }
  .news-ticker-track {
    animation-duration: 60s;
  }
  .news-ticker-item {
    padding: 0 16px;
    gap: 6px;
  }
}

/* Respect users who don't want motion. */
@media (prefers-reduced-motion: reduce) {
  .news-ticker-track {
    animation-duration: 600s; /* practically still */
  }
}
