@layer sections{
  [ui-section=announcement-bar]{
    overflow:hidden;
    padding-inline:var(--spacing-0);
  }
  [ui-section=announcement-bar][data-bottom-border="1"]{
    border-block-end:1px solid var(--color-surface-variant);
  }
  /* Exact brand colour from the editor (see sections/announcement-bar.liquid). The foreground is
     picked there from the colour's lightness so the text always keeps at least AA contrast. */
  [ui-section=announcement-bar][data-bar-color=exact]{
    background-color:var(--bar-bg);
    color:var(--bar-fg);
  }
  [ui-section=announcement-bar][data-bar-color=exact] .item a{
    color:inherit;
  }
  /* Brand name inside an announcement: a step heavier than the message, not louder. */
  [ui-section=announcement-bar] .item .brand{
    font-weight:700;
    letter-spacing:0.02em;
  }

  /*
    BASE = static, readable layout. It applies to: auto_rotate off, prefers-reduced-motion: reduce,
    and any browser that does not understand the motion media query. Nothing in this base block
    animates. All movement is added further down, only inside
    @media (prefers-reduced-motion: no-preference), so no animation rule (LTR or RTL) can ever
    reach a visitor who asked for reduced motion; this does not depend on rule order or specificity.
  */
  [ui-section=announcement-bar] .marquee{
    display:flex;
    align-items:center;
    justify-content:center;
    min-height:calc(var(--spacing-32) + var(--spacing-8));
    padding-block:var(--spacing-6);
    padding-inline:var(--spacing-16);
  }
  [ui-section=announcement-bar] .window{
    display:flex;
    flex:1 1 auto;
    justify-content:center;
    min-width:0;
  }
  @media (min-width: 770px){
    [ui-section=announcement-bar] .window{
      max-width:var(--bar-width, 100%);
    }
  }
  [ui-section=announcement-bar] .track{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    width:100%;
  }
  [ui-section=announcement-bar] .copy{
    display:flex;
    flex-wrap:wrap;
    justify-content:center;
    margin:0;
    padding:0;
    list-style:none;
    row-gap:var(--spacing-4);
  }
  [ui-section=announcement-bar] .copy:not(:first-child){
    display:none;
  }
  [ui-section=announcement-bar] .item{
    display:flex;
    align-items:center;
    text-align:center;
    overflow-wrap:anywhere;
  }
  [ui-section=announcement-bar] .item::after{
    content:"";
    display:inline-block;
    flex:0 0 auto;
    width:4px;
    height:4px;
    margin-inline:var(--spacing-16);
    border-radius:50%;
    background-color:currentcolor;
    opacity:0.45;
  }
  [ui-section=announcement-bar] .item:last-child::after{
    display:none;
  }
  [ui-section=announcement-bar] .controls{
    display:none;
  }

  /* MOTION: only for visitors who have not asked for reduced motion. */
  @media (prefers-reduced-motion: no-preference){
    [ui-section=announcement-bar] .marquee[data-motion=marquee]{
      padding-inline:var(--spacing-0);
    }
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .window{
      display:block;
      overflow:hidden;
      -webkit-mask-image:linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
      mask-image:linear-gradient(90deg, transparent, #000 20px, #000 calc(100% - 20px), transparent);
    }
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .track{
      flex-wrap:nowrap;
      justify-content:flex-start;
      width:-moz-max-content;
      width:max-content;
      animation:announcement-marquee var(--loop-seconds) linear infinite;
      will-change:transform;
    }
    [dir="rtl"] [ui-section=announcement-bar] .marquee[data-motion=marquee] .track{
      animation-name:announcement-marquee-rtl;
    }
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .copy,
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .copy:not(:first-child){
      display:flex;
      flex:0 0 auto;
      flex-wrap:nowrap;
      justify-content:flex-start;
    }
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .item{
      text-align:start;
      overflow-wrap:normal;
      white-space:nowrap;
    }
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .item::after,
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .item:last-child::after{
      display:inline-block;
      margin-inline:var(--spacing-32);
    }

    /* Pause: the button sets data-paused (see section.announcement-bar.js). */
    [ui-section=announcement-bar] .marquee[data-motion=marquee][data-paused] .track{
      animation-play-state:paused;
    }
    /* Hover pause only for real hover devices, and only over the text window (never the button),
       so touch taps cannot leave it stuck and a click on "resume" is not blocked by the pointer. */
    @media (hover: hover) and (pointer: fine){
      [ui-section=announcement-bar] .marquee[data-motion=marquee] .window:hover .track{
        animation-play-state:paused;
      }
    }
    /* Keyboard focus on a link pauses it; ordinary click focus (:focus without :focus-visible) does not. */
    [ui-section=announcement-bar] .marquee[data-motion=marquee] .window:has(a:focus-visible) .track{
      animation-play-state:paused;
    }

    [ui-section=announcement-bar] .marquee[data-motion=marquee] .controls{
      display:flex;
      flex:0 0 auto;
      align-items:center;
      padding-inline:var(--spacing-12);
    }
    [ui-section=announcement-bar] .toggle{
      display:grid;
      place-items:center;
      width:32px;
      height:32px;
      padding:0;
      border:1px solid color-mix(in srgb, currentcolor 45%, transparent);
      border-radius:50%;
      background-color:transparent;
      color:inherit;
      cursor:pointer;
    }
    [ui-section=announcement-bar] .toggle:hover{
      background-color:color-mix(in srgb, currentcolor 14%, transparent);
    }
    [ui-section=announcement-bar] .toggle .icon-play{
      display:none;
    }
    [ui-section=announcement-bar] .marquee[data-paused] .toggle .icon-pause{
      display:none;
    }
    [ui-section=announcement-bar] .marquee[data-paused] .toggle .icon-play{
      display:block;
    }
  }

  /* Defensive: reduced motion never animates and never shows the pause control. */
  @media (prefers-reduced-motion: reduce){
    [ui-section=announcement-bar] .marquee .track{
      animation:none !important;
    }
    [ui-section=announcement-bar] .marquee .controls{
      display:none !important;
    }
  }
}
@keyframes announcement-marquee{
  from{
    transform:translateX(0);
  }
  to{
    transform:translateX(calc(-100% / var(--copies)));
  }
}
@keyframes announcement-marquee-rtl{
  from{
    transform:translateX(0);
  }
  to{
    transform:translateX(calc(100% / var(--copies)));
  }
}
