/**-------------------------------
 *  Ticker Tape CSS
 *  v1.0
 *
 *  The scrolling is a CSS transform animation, so the browser runs it on
 *  the compositor (GPU) thread: no layout work per frame, no jitter.
 *  Colours follow the active theme (--clr-cobalt) unless a custom
 *  background is set on the placement.
 *--------------------------------
 */

.ticker-tape {
  --tt-radius: 3px;
  --tt-height: 40px;
  --tt-font: 16px;
  --tt-bg: var(--clr-cobalt, #0050EF);
  --tt-fg: #fff;
  position: relative;
  display: flex;
  align-items: stretch;
  width: 100%;
  box-sizing: border-box;
  margin: 10px 0 20px 0;
  overflow: hidden;
  background: var(--tt-bg);
  color: var(--tt-fg);
  border-radius: var(--tt-radius);
  font-family: var(--font-main, 'Figtree', system-ui, sans-serif);
  font-size: var(--tt-font);
  font-weight: 600;
  line-height: 1.2;
}

/* Shape variants — keyed to NivoCart getShapes() values */
.ticker-shape-rounded-0  { --tt-radius: 0px;  }
.ticker-shape-rounded-3  { --tt-radius: 3px;  }
.ticker-shape-rounded-5  { --tt-radius: 5px;  }
.ticker-shape-rounded-7  { --tt-radius: 7px;  }
.ticker-shape-rounded-9  { --tt-radius: 9px;  }
.ticker-shape-rounded-11 { --tt-radius: 11px; }
.ticker-shape-rounded-13 { --tt-radius: 13px; }
.ticker-shape-rounded-15 { --tt-radius: 15px; }
.ticker-shape-rounded-17 { --tt-radius: 17px; }
.ticker-shape-rounded-19 { --tt-radius: 19px; }
.ticker-shape-rounded-21 { --tt-radius: 21px; }

/* ---------- Viewport + moving track ---------- */
.ticker-tape-viewport {
  flex: 1 1 auto;
  min-width: 0;
  height: var(--tt-height);
  overflow: hidden;
  /* soft fade at both ends */
  -webkit-mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
  mask-image: linear-gradient(90deg, transparent 0, #000 28px, #000 calc(100% - 28px), transparent 100%);
}

.ticker-tape-track {
  display: flex;
  align-items: center;
  width: max-content;
  height: 100%;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  backface-visibility: hidden;
}

/* The animation only starts once the script has measured the content */
.ticker-tape.is-ready .ticker-tape-track {
  animation: ticker-tape-scroll var(--tt-duration, 40s) linear infinite;
}
.ticker-tape.is-ready.ticker-dir-right .ticker-tape-track {
  animation-direction: reverse;
}

@keyframes ticker-tape-scroll {
  from { transform: translate3d(0, 0, 0); }
  to   { transform: translate3d(-50%, 0, 0); }
}

/* Pause: hover (if enabled), keyboard focus on a link, or the pause button */
.ticker-tape.is-paused .ticker-tape-track,
.ticker-tape.ticker-pause-hover .ticker-tape-viewport:hover .ticker-tape-track,
.ticker-tape .ticker-tape-viewport:focus-within .ticker-tape-track {
  animation-play-state: paused;
}

/* ---------- Messages ---------- */
.ticker-tape-list {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
  padding: 0;
  list-style: none;
}

.ticker-tape-list li {
  display: flex;
  flex: 0 0 auto;
  align-items: center;
  margin: 0;
  padding: 0;
  white-space: nowrap;
}

/* Separator after every message, including the last, so both halves are
   identical and the loop is seamless. */
.ticker-tape-list li::after {
  content: attr(data-sep);
  content: attr(data-sep) / "";
  padding: 0 1.4em;
  opacity: 0.7;
}

.ticker-tape .ticker-tape-list a:link,
.ticker-tape .ticker-tape-list a:visited,
.ticker-tape .ticker-tape-list a:hover,
.ticker-tape .ticker-tape-list a:active {
  color: inherit;
  text-decoration: none;
}
.ticker-tape .ticker-tape-list a:hover {
  text-decoration: underline;
}
.ticker-tape .ticker-tape-list a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
  border-radius: 2px;
}

/* ---------- Pause / play button ---------- */
.ticker-tape-toggle {
  flex: 0 0 auto;
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  margin: 0;
  padding: 0;
  border: 0;
  border-radius: 0;
  background: rgba(0, 0, 0, 0.2);
  color: inherit;
  cursor: pointer;
}
.ticker-tape.is-ready .ticker-tape-toggle {
  display: flex;
}
.ticker-tape-toggle:hover {
  background: rgba(0, 0, 0, 0.32);
}
.ticker-tape-toggle:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: -4px;
}
/* pause icon: two bars */
.ticker-tape-toggle span {
  display: block;
  width: 4px;
  height: 14px;
  margin-right: 8px;
  background: currentColor;
  box-shadow: 8px 0 0 currentColor;
}
/* play icon: triangle */
.ticker-tape-toggle[aria-pressed="true"] span {
  width: 0;
  height: 0;
  margin: 0 0 0 3px;
  background: none;
  box-shadow: none;
  border-top: 7px solid transparent;
  border-bottom: 7px solid transparent;
  border-left: 11px solid currentColor;
}

/* ---------- Reduced motion: show every message, no movement ---------- */
@media (prefers-reduced-motion: reduce) {
  .ticker-tape-viewport {
    height: auto;
    min-height: var(--tt-height);
    -webkit-mask-image: none;
    mask-image: none;
  }
  .ticker-tape-track {
    width: auto;
    padding: 6px 14px;
    will-change: auto;
  }
  .ticker-tape.is-ready .ticker-tape-track {
    animation: none;
  }
  .ticker-tape-list {
    flex-wrap: wrap;
    justify-content: center;
  }
  .ticker-tape-list[aria-hidden="true"],
  .ticker-tape-toggle,
  .ticker-tape.is-ready .ticker-tape-toggle {
    display: none;
  }
}
