/* TakeLoot global announcement banner */
.tl-top-banner {
  position: relative;
  z-index: 30;
  width: 100%;
  overflow: hidden;
  color: #fff;
  isolation: isolate;
}

.tl-top-banner__slides {
  display: grid;
  width: 100%;
}

.tl-top-banner__slide {
  grid-area: 1 / 1;
  min-width: 0;
  width: 100%;
  overflow: hidden;
  background: var(--tl-top-banner-background, #9944ff);
  color: inherit;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 320ms ease,
    visibility 320ms ease;
}

.tl-top-banner__slide.is-active,
.tl-top-banner__slide[aria-hidden="false"] {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}

.tl-top-banner__viewport {
  display: flex;
  align-items: center;
  width: 100%;
  height: 28px;
  overflow: hidden;
  /* Provides exact viewport width (100cqw) to children inside max-content tracks */
  container-type: inline-size;
}

.tl-top-banner__track {
  display: flex;
  align-items: center;
  width: 100%;
  min-width: 0;
}

.tl-top-banner__html {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 1 1 100%;
  width: 100%;
  min-width: 0;
  padding: 7px 18px;
  text-align: center;
  line-height: 1.4;
}

/* ==========================================================================
   Admin-Injected HTML Normalization (Filament RichEditor / Raw HTML)
   ========================================================================== */

/* Flatten block-level elements so pasted paragraphs, lists, or headings stay on one line */
.tl-top-banner__html
  :is(p, div, h1, h2, h3, h4, h5, h6, ul, ol, li, blockquote, figure) {
  display: inline;
  margin: 0;
  padding: 0;
  font-size: inherit;
  line-height: inherit;
  list-style: none;
}

/* Separate multiple paragraphs or list items cleanly with a bullet */
.tl-top-banner__html :is(p + p, div + div, li + li)::before {
  content: "•";
  display: inline-block;
  margin-inline: 0.75rem;
  opacity: 0.65;
}

.tl-top-banner__html > :last-child {
  margin-bottom: 0;
}

/* Prevent oversized icons, logos, or badges from breaking banner height */
.tl-top-banner__html :is(img, video, svg) {
  display: inline-block;
  max-height: 22px;
  width: auto;
  max-width: 100%;
  vertical-align: middle;
  flex-shrink: 0;
  margin-inline: 0.25rem;
}

.tl-top-banner__html a {
  color: inherit;
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ==========================================================================
   Continuous Marquee Mode (.is-marquee)
   ========================================================================== */

.tl-top-banner__slide.is-marquee .tl-top-banner__track {
  width: max-content;
  flex: 0 0 auto;
  /* Promote to GPU compositor layer to eliminate sub-pixel judder */
  backface-visibility: hidden;
  transform: translate3d(0, 0, 0);
  will-change: transform;
  animation: tl-top-banner-marquee var(--tl-top-banner-marquee-duration, 24s)
    linear infinite;
}

/* Pause off-screen slides so background tabs/slides don't burn compositor frames */
.tl-top-banner__slide:not(.is-active).is-marquee .tl-top-banner__track,
.tl-top-banner__slide[aria-hidden="true"].is-marquee .tl-top-banner__track {
  animation-play-state: paused;
}

/* Pause cleanly on pointer hover or keyboard focus */
.tl-top-banner:hover
  .tl-top-banner__slide.is-active.is-marquee
  .tl-top-banner__track,
.tl-top-banner:focus-within
  .tl-top-banner__slide.is-active.is-marquee
  .tl-top-banner__track {
  animation-play-state: paused;
}

.tl-top-banner__slide.is-marquee .tl-top-banner__html {
  flex: 0 0 auto;
  width: max-content;
  /* Guarantees each loop segment spans at least the full banner width */
  min-width: 100cqw;
  justify-content: space-around;
  gap: 2.5rem;
  padding-inline: 1.25rem;
  white-space: nowrap;
}

/* Neutralize inline white-space or line-break tags pasted into the admin editor */
.tl-top-banner__slide.is-marquee .tl-top-banner__html * {
  white-space: nowrap !important;
}

.tl-top-banner__slide.is-marquee .tl-top-banner__html br {
  display: none;
}

.tl-top-banner__slide.is-marquee .tl-top-banner__html--clone {
  pointer-events: none;
  user-select: none;
}

@keyframes tl-top-banner-marquee {
  0% {
    transform: translate3d(0, 0, 0);
  }
  100% {
    transform: translate3d(-50%, 0, 0);
  }
}

/* ==========================================================================
   Responsive & Accessibility Overrides
   ========================================================================== */

@media (max-width: 575.98px) {
  .tl-top-banner__html {
    padding: 7px 12px;
    font-size: 12px;
  }

  .tl-top-banner__html :is(img, video, svg) {
    max-height: 18px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .tl-top-banner__slide {
    transition: none;
  }

  .tl-top-banner__slide.is-marquee .tl-top-banner__track {
    animation: none;
    width: 100%;
    transform: none;
  }

  .tl-top-banner__slide.is-marquee .tl-top-banner__html {
    min-width: 100%;
    white-space: normal;
  }

  .tl-top-banner__slide.is-marquee .tl-top-banner__html * {
    white-space: normal !important;
  }

  .tl-top-banner__slide.is-marquee .tl-top-banner__html--clone {
    display: none;
  }
}
