/* =============================================================================
   BroadbandSwitch.uk news ticker
   Replaces the "Some featured deals expire in…" bar on the homepage.
   Everything is namespaced .bbs-ticker so it cannot collide with site styles.
   Fixed height (46px desktop, 42px phone) so there is no layout shift.
   ============================================================================= */

.bbs-ticker {
  --bbst-bg: #fcebf3;
  --bbst-line: #f4c0d8;
  --bbst-pink: #e50571;
  --bbst-ink: #15122b;
  --bbst-muted: #5b5672;
  --bbst-white: #ffffff;
  --bbst-h: 46px;
  --bbst-speed: 48s; /* overwritten by ticker.js from the real content width */

  display: flex;
  align-items: stretch;
  height: var(--bbst-h);
  width: 100%;
  overflow: hidden;
  background: var(--bbst-bg);
  border-top: 1px solid var(--bbst-line);
  border-bottom: 1px solid var(--bbst-line);
  color: var(--bbst-ink);
  font-size: 14px;
  line-height: 1.3;
  box-sizing: border-box;
}
.bbs-ticker *, .bbs-ticker *::before, .bbs-ticker *::after { box-sizing: border-box; }

/* Left label */
.bbs-ticker__label {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0 14px 0 max(16px, env(safe-area-inset-left, 0px));
  background: var(--bbst-pink);
  color: var(--bbst-white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: .1em;
  text-transform: uppercase;
  white-space: nowrap;
}
.bbs-ticker__dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--bbst-white);
  animation: bbst-pulse 1.6s ease-in-out infinite;
}
@keyframes bbst-pulse {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: .45; transform: scale(.75); }
}

/* Scrolling track */
.bbs-ticker__track {
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  position: relative;
}
.bbs-ticker__rail {
  display: flex;
  align-items: center;
  height: 100%;
  width: max-content;
  animation: bbst-scroll var(--bbst-speed) linear infinite;
}
.bbs-ticker__items { display: flex; align-items: center; height: 100%; }
.bbs-ticker:hover .bbs-ticker__rail,
.bbs-ticker:focus-within .bbs-ticker__rail,
.bbs-ticker.is-paused .bbs-ticker__rail { animation-play-state: paused; }
@keyframes bbst-scroll {
  from { transform: translateX(0); }
  to   { transform: translateX(-50%); }
}

/* One headline */
.bbs-ticker__item {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 0 0 0 22px;
  white-space: nowrap;
  color: var(--bbst-ink);
  text-decoration: none;
  font-weight: 500;
}
.bbs-ticker__item::after {
  content: "\00b7";
  color: var(--bbst-line);
  font-size: 20px;
  line-height: 1;
  padding-left: 22px;
}
.bbs-ticker__kind {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--bbst-pink);
  background: var(--bbst-white);
  border: 1px solid var(--bbst-line);
  border-radius: 999px;
  padding: 2px 8px;
  line-height: 1.4;
}
.bbs-ticker__date { font-size: 12px; font-weight: 600; color: var(--bbst-muted); }
.bbs-ticker__title {
  text-decoration: underline;
  text-decoration-color: transparent;
  text-underline-offset: 3px;
  transition: text-decoration-color .15s;
}
.bbs-ticker__item:hover .bbs-ticker__title,
.bbs-ticker__item:focus-visible .bbs-ticker__title { text-decoration-color: var(--bbst-pink); }
.bbs-ticker__item:focus-visible { outline: 3px solid #1b6ef3; outline-offset: -3px; }

/* Pinned compare link on the right */
.bbs-ticker__cta {
  flex: 0 0 auto;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0 max(14px, env(safe-area-inset-right, 0px)) 0 18px;
  background: var(--bbst-white);
  border-left: 1px solid var(--bbst-line);
  position: relative;
}
.bbs-ticker__cta::before {
  content: "";
  position: absolute;
  left: -30px; top: 0; bottom: 0; width: 30px;
  background: linear-gradient(to right, rgba(252, 235, 243, 0), var(--bbst-bg));
  pointer-events: none;
}
.bbs-ticker__cta-link {
  font-size: 14px;
  font-weight: 700;
  color: var(--bbst-pink);
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.bbs-ticker__cta-link:hover { text-decoration-thickness: 2px; }
.bbs-ticker__cta-short { display: none; }
.bbs-ticker__pause {
  display: grid;
  place-items: center;
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 1px solid var(--bbst-line);
  background: var(--bbst-white);
  color: var(--bbst-pink);
  cursor: pointer;
  padding: 0;
  font: inherit;
}
.bbs-ticker__pause svg { width: 12px; height: 12px; fill: currentColor; display: block; }
.bbs-ticker:not(.is-paused) .bbs-ticker__pause .bbst-ic-play { display: none; }
.bbs-ticker.is-paused .bbs-ticker__pause .bbst-ic-pause { display: none; }
.bbs-ticker__pause:focus-visible { outline: 3px solid #1b6ef3; outline-offset: 2px; }

/* Phone */
@media (max-width: 640px) {
  .bbs-ticker { --bbst-h: 42px; font-size: 13px; }
  .bbs-ticker__label { padding-right: 10px; }
  .bbs-ticker__label-long { display: none; }
  .bbs-ticker__cta-long { display: none; }
  /* With no saved postcode the link reads "Deals →"; with one it reads "NE25 0JA →" */
  .bbs-ticker:not(.has-postcode) .bbs-ticker__cta-pc { display: none; }
  .bbs-ticker:not(.has-postcode) .bbs-ticker__cta-short { display: inline; }
  .bbs-ticker__item { padding-left: 16px; }
  .bbs-ticker__item::after { padding-left: 16px; }
  .bbs-ticker__date { display: none; } /* more room for the headline on a phone */
}

/* Reduced motion: no animation, the row scrolls sideways by hand instead */
@media (prefers-reduced-motion: reduce) {
  .bbs-ticker__rail { animation: none; width: auto; }
  .bbs-ticker__track { overflow-x: auto; scrollbar-width: thin; }
  .bbs-ticker__items[aria-hidden="true"] { display: none; }
  .bbs-ticker__dot { animation: none; }
  .bbs-ticker__pause { display: none; }
}

@media print { .bbs-ticker { display: none; } }
