/* Ashbury Village Hall – "Coming up at the hall" ticker
   Colours use your site's variables if they exist, otherwise warm defaults. */

.ticker {
  display: flex;
  align-items: center;
  background: var(--colour-primary, #8a4b2a);
  color: #fff;
  font-size: 1rem;
  line-height: 1;
  overflow: hidden;
}

.ticker[hidden] { display: none; }

.ticker__label {
  flex: 0 0 auto;
  padding: 0.75rem 1rem;
  background: var(--colour-accent, #5e2f17);
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  white-space: nowrap;
  position: relative;
  z-index: 1;
}

.ticker__viewport {
  flex: 1 1 auto;
  overflow: hidden;
  /* soft fade at the edges */
  mask-image: linear-gradient(to right, transparent, #000 2rem, #000 calc(100% - 2rem), transparent);
}

.ticker__track {
  display: flex;
  width: max-content;
}

.ticker.is-running .ticker__track {
  animation: ticker-scroll linear infinite;
  animation-duration: 30s; /* overwritten by ticker.js */
}

/* Pause/play button */
.ticker.is-paused .ticker__track {
  animation-play-state: paused;
}

/* On computers with a mouse, also pause while the pointer is over the
   scrolling text (not the button, so Play works straight away).
   Phones skip this, because a tap leaves a "sticky" hover behind. */
@media (hover: hover) and (pointer: fine) {
  .ticker__viewport:hover .ticker__track {
    animation-play-state: paused;
  }
}

.ticker__list {
  display: flex;
  margin: 0;
  padding: 0;
  list-style: none;
  white-space: nowrap;
}

.ticker__list li {
  padding: 0.75rem 0;
}

.ticker__list li::after {
  content: "•";
  margin: 0 1.5rem;
  opacity: 0.6;
}

/* Month names, e.g. NOVEMBER – no bullet straight after them */
.ticker__month {
  font-weight: 700;
  letter-spacing: 0.08em;
  color: var(--colour-highlight, #ffd9a8);
}

.ticker__list li.ticker__month::after {
  content: "";
  margin: 0 0.6rem 0 0;
}

.ticker__pause {
  flex: 0 0 auto;
  margin: 0 0.5rem;
  padding: 0.4rem 0.6rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 4px;
  background: transparent;
  color: inherit;
  font-size: 0.75rem;
  cursor: pointer;
}

.ticker__pause:focus-visible {
  outline: 2px solid #fff;
  outline-offset: 2px;
}

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

/* People who've asked their device to reduce motion get a still list */
@media (prefers-reduced-motion: reduce) {
  .ticker.is-running .ticker__track { animation: none; }
  .ticker__track { width: auto; }
  .ticker__list { flex-wrap: wrap; white-space: normal; }
  .ticker__list[aria-hidden="true"],
  .ticker__pause { display: none; }
  .ticker__viewport { mask-image: none; }
}

/* On small screens, give the events more room:
   shorter label ("Coming up"), tighter spacing, smaller pause button */
@media (max-width: 600px) {
  .ticker { font-size: 0.9rem; }
  .ticker__label {
    padding: 0.75rem 0.5rem;
    font-size: 0.75rem;
    letter-spacing: 0.02em;
  }
  .ticker__label-extra { display: none; }
  .ticker__viewport {
    mask-image: linear-gradient(to right, transparent, #000 0.75rem, #000 calc(100% - 0.75rem), transparent);
  }
  .ticker__list li::after { margin: 0 1rem; }
  .ticker__pause {
    margin: 0 0.3rem;
    padding: 0.3rem 0.45rem;
  }
}
