/* ============================================================
   CFA News Ticker — Frontend Ticker Styles
   Matches existing site palette exactly.
   ============================================================ */

/* ─────────────── Ticker Bar ─────────────── */
.cfa-ticker {
  background: var(--cfa-dark, #1E0A30);
  color: #fff;
  display: flex;
  align-items: center;
  height: 40px;
  overflow: hidden;
  position: relative;
  z-index: 900;
  /* Subtle gradient to show text fading at edges */
  -webkit-mask-image: linear-gradient(to right, black 0%, black 5%, black 95%, transparent 100%);
  mask-image:         linear-gradient(to right, black 0%, black 5%, black 95%, transparent 100%);
  /* Override mask on label side */
}

/* ─────────────── Label chip ─────────────── */
.cfa-ticker__label {
  flex-shrink: 0;
  background: var(--cfa-primary, #D44D1A);
  color: #fff;
  padding: 0 18px;
  height: 100%;
  display: flex;
  align-items: center;
  font-weight: 800;
  font-family: 'Poppins', sans-serif;
  letter-spacing: 0.5px;
  font-size: 0.73rem;
  text-transform: uppercase;
  position: relative;
  z-index: 2;
  white-space: nowrap;
  /* Restore mask on label */
  -webkit-mask-image: none;
  mask-image: none;
}

/* Arrow accent on label */
.cfa-ticker__label::after {
  content: '';
  position: absolute;
  right: -10px;
  top: 0;
  width: 0;
  height: 0;
  border-style: solid;
  border-width: 20px 0 20px 10px;
  border-color: transparent transparent transparent var(--cfa-primary, #D44D1A);
  z-index: 3;
}

/* ─────────────── Viewport (clips overflowing track) ─────────────── */
.cfa-ticker__viewport {
  flex: 1;
  overflow: hidden;
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
  padding-left: 14px; /* breathing room after arrow */
}

/* ─────────────── Scrolling Track ─────────────── */
.cfa-ticker__track {
  display: inline-flex;
  align-items: center;
  gap: 0;
  white-space: nowrap;
  will-change: transform;
  animation: cfaTickerScroll 30s linear infinite;
}

/* Pause on hover — accessible + delightful */
.cfa-ticker:hover .cfa-ticker__track,
.cfa-ticker:focus-within .cfa-ticker__track {
  animation-play-state: paused;
}

@keyframes cfaTickerScroll {
  0%   { transform: translateX(0); }
  100% { transform: translateX(-50%); } /* 50% because track is doubled */
}

/* ─────────────── Individual Item ─────────────── */
.cfa-ticker__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 0 4px;
  font-size: 0.82rem;
  color: rgba(255, 255, 255, 0.92);
  font-family: 'Nunito', sans-serif;
  transition: color 0.2s;
}

/* Featured items get a warm highlight */
.cfa-ticker__item--featured {
  color: #FFD87A;
  font-weight: 700;
}

.cfa-ticker__emoji {
  font-size: 0.95rem;
  line-height: 1;
}

/* ─────────────── Link / Button inside item ─────────────── */
.cfa-ticker__link {
  display: inline-flex;
  align-items: center;
  margin-left: 6px;
  background: rgba(255, 255, 255, 0.13);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 30px;
  padding: 2px 11px;
  font-size: 0.72rem;
  font-weight: 700;
  font-family: 'Poppins', sans-serif;
  text-decoration: none;
  letter-spacing: 0.3px;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
  white-space: nowrap;
  cursor: pointer;
}

.cfa-ticker__link:hover,
.cfa-ticker__link:focus {
  background: var(--cfa-primary, #D44D1A);
  border-color: var(--cfa-primary, #D44D1A);
  color: #fff;
  outline: none;
}

.cfa-ticker__link:focus-visible {
  outline: 2px solid var(--cfa-primary, #D44D1A);
  outline-offset: 2px;
}

/* Featured item link */
.cfa-ticker__item--featured .cfa-ticker__link {
  background: rgba(255, 216, 122, 0.2);
  border-color: rgba(255, 216, 122, 0.4);
  color: #FFD87A;
}

.cfa-ticker__item--featured .cfa-ticker__link:hover {
  background: #FFD87A;
  border-color: #FFD87A;
  color: #1E0A30;
}

/* ─────────────── Separator dot ─────────────── */
.cfa-ticker__sep {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.75rem;
  padding: 0 12px;
  user-select: none;
}

/* ─────────────── Reduced Motion (accessibility) ─────────────── */
@media (prefers-reduced-motion: reduce) {
  .cfa-ticker__track {
    animation: none;
    /* Show items stacked/static when motion is reduced */
    white-space: normal;
    flex-wrap: wrap;
    overflow: hidden;
    max-height: 40px;
  }
  /* Show only first item */
  .cfa-ticker__track > *:not(:first-child):not(:nth-child(2)) {
    display: none;
  }
}

/* ─────────────── Mobile ─────────────── */
@media (max-width: 768px) {
  .cfa-ticker         { height: 36px; }
  .cfa-ticker__label  { padding: 0 12px; font-size: 0.66rem; }
  .cfa-ticker__label::after {
    border-width: 18px 0 18px 8px;
  }
  .cfa-ticker__item   { font-size: 0.78rem; }
  .cfa-ticker__sep    { padding: 0 8px; }
  .cfa-ticker__link   { padding: 2px 8px; font-size: 0.68rem; }
  .cfa-ticker__track  {
    animation-duration: 22s; /* slightly faster on mobile */
  }
}

@media (max-width: 480px) {
  .cfa-ticker__label {
    display: none; /* hide on very small screens to save space */
  }
  .cfa-ticker__viewport { padding-left: 8px; }
}

/* ─────────────── Print ─────────────── */
@media print {
  .cfa-ticker { display: none; }
}
