/* AnnouncementBar (spec 2.1): lime band, one rotating message, inline chevrons. */

/* Skipped (covered by shared chunk CSS): ../../sub-components/Icon/styles.css */
/* Skipped (covered by shared chunk CSS): ../../sub-components/Button/styles.css */

.cc_ha5dwmyj_J5393AQYDk .announcement-bar {
  position: relative;
  padding-block: var(--sp-100);
}

/* Every message is empty: hide the whole bar. */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar:not(:has(.announcement-message)) {
  display: none;
}

/* ---------- Layout ---------- */

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__inner {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

/* Mobile: 40px hit areas in flow (bar about 56px), glyphs 30px from the screen edge. */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__inner.has-arrows {
  grid-template-columns: 40px minmax(0, 1fr) 40px;
  column-gap: var(--sp-100);
}

/* Button's inline-icon variant draws the 40px circle and the 20px glyph (iconSize). */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__arrow {
  position: relative;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__arrow--prev {
  left: -10px;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__arrow--next {
  left: 10px;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport {
  min-width: 0;
  text-align: center;
  touch-action: pan-y;
}

/*
 * Slide stacking. The renderer wrapper (.announcement-bar__slides, display: grid via its
 * style prop) holds one runtime container per message, possibly nested in a scoping wrapper,
 * and those containers are box-less. So nothing is ever set on a container: every wrapper
 * between the renderer wrapper and a message root is flattened, and the
 * .announcement-message roots themselves are the grid items, all in one cell. The cell is as
 * tall as the tallest message, so the bar never changes height while rotating.
 */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__slides {
  grid-template-columns: minmax(0, 1fr);
  align-items: center;
}

/* Any wrapper depth: wrappers around a message disappear from layout (beats inline styles). */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__slides :not(.announcement-message):has(.announcement-message) {
  display: contents !important;
}

/* Without :has() a single real-box wrapper level still lands in the shared cell. */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__slides > * {
  grid-area: 1 / 1;
  min-width: 0;
}

/* Leftovers of an empty message (no root inside) share the cell and stay invisible. */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__slides
  :not(.announcement-message, .announcement-message *):not(:has(.announcement-message)) {
  grid-area: 1 / 1;
  visibility: hidden;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__slides .announcement-message {
  grid-area: 1 / 1;
  min-width: 0;
  opacity: 0;
  visibility: hidden;
}

/* After hydration the active message shows. */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__slides .announcement-message[data-active] {
  opacity: 1;
  visibility: visible;
}

/*
 * Before hydration only the first message that has text shows (empty messages render no
 * root). The first rule works without :has() and shows the first container's message; the
 * :has() pair shows every root, then hides each one that has an earlier message before it
 * (as a sibling, or inside an earlier sibling wrapper at any level).
 */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport:not(.is-ready) .announcement-bar__slides > :first-child .announcement-message, .cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport:not(.is-ready) .announcement-bar__slides > .announcement-message:first-child {
  opacity: 1;
  visibility: visible;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport:not(.is-ready) .announcement-bar__slides:has(.announcement-message) .announcement-message {
  opacity: 1;
  visibility: visible;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport:not(.is-ready)
  .announcement-bar__slides
  :is(.announcement-message, :has(.announcement-message))
  ~ .announcement-message, .cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport:not(.is-ready)
  .announcement-bar__slides
  :is(.announcement-message, :has(.announcement-message))
  ~ * .announcement-message {
  opacity: 0;
  visibility: hidden;
}

/* ---------- Transition: fade + 16px slide in the travel direction, on the message roots ---------- */

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport[data-animate][data-dir="next"] .announcement-message[data-active] {
  animation: cc_ha5dwmyj_J5393AQYDk_announcementInNext var(--dur-400) var(--ease-out-quart) both;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport[data-animate][data-dir="prev"] .announcement-message[data-active] {
  animation: cc_ha5dwmyj_J5393AQYDk_announcementInPrev var(--dur-400) var(--ease-out-quart) both;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport[data-animate][data-dir="next"] .announcement-message[data-leaving] {
  animation: cc_ha5dwmyj_J5393AQYDk_announcementOutNext var(--dur-280) var(--ease-in-quad) both;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport[data-animate][data-dir="prev"] .announcement-message[data-leaving] {
  animation: cc_ha5dwmyj_J5393AQYDk_announcementOutPrev var(--dur-280) var(--ease-in-quad) both;
}

@keyframes cc_ha5dwmyj_J5393AQYDk_announcementInNext {
  from {
    opacity: 0;
    transform: translateX(16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cc_ha5dwmyj_J5393AQYDk_announcementInPrev {
  from {
    opacity: 0;
    transform: translateX(-16px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

@keyframes cc_ha5dwmyj_J5393AQYDk_announcementOutNext {
  from {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  to {
    opacity: 0;
    visibility: hidden;
    transform: translateX(-16px);
  }
}

@keyframes cc_ha5dwmyj_J5393AQYDk_announcementOutPrev {
  from {
    opacity: 1;
    visibility: visible;
    transform: none;
  }
  to {
    opacity: 0;
    visibility: hidden;
    transform: translateX(16px);
  }
}

@keyframes cc_ha5dwmyj_J5393AQYDk_announcementFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

@keyframes cc_ha5dwmyj_J5393AQYDk_announcementFadeOut {
  from {
    opacity: 1;
    visibility: visible;
  }
  to {
    opacity: 0;
    visibility: hidden;
  }
}

/* ---------- Close (dismissible) ---------- */

/* Pinned to the screen edge, vertically centred; the message keeps clear of it on both sides. */
.cc_ha5dwmyj_J5393AQYDk .announcement-bar__close {
  position: absolute;
  inset-block: 0;
  right: max(4px, calc(var(--gutter) - 12px));
  margin-block: auto;
  z-index: 1;
}

.cc_ha5dwmyj_J5393AQYDk .announcement-bar__inner.has-close {
  padding-inline: calc(var(--gutter) + 36px);
}

/* ---------- Desktop: 38px bar, ~742px centered cluster ---------- */

@media (min-width: 1024px) {
  .cc_ha5dwmyj_J5393AQYDk .announcement-bar__inner.has-arrows {
    max-width: calc(742px + 2 * var(--gutter));
  }

  .cc_ha5dwmyj_J5393AQYDk .announcement-bar__inner.has-arrows.has-close {
    max-width: calc(742px + 2 * (var(--gutter) + 36px));
  }

  .cc_ha5dwmyj_J5393AQYDk .announcement-bar__arrow {
    margin-block: -9px;
  }

  .cc_ha5dwmyj_J5393AQYDk .announcement-bar__arrow--prev, .cc_ha5dwmyj_J5393AQYDk .announcement-bar__arrow--next {
    left: 0;
  }
}

/* ---------- Reduced motion: plain 150ms crossfade ---------- */

@media (prefers-reduced-motion: reduce) {
  .cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport[data-animate][data-dir] .announcement-message[data-active] {
    animation: cc_ha5dwmyj_J5393AQYDk_announcementFadeIn 150ms linear both;
  }

  .cc_ha5dwmyj_J5393AQYDk .announcement-bar__viewport[data-animate][data-dir] .announcement-message[data-leaving] {
    animation: cc_ha5dwmyj_J5393AQYDk_announcementFadeOut 150ms linear both;
  }
}
