/* ============================================================================
   ragazzi-announcement.css — the ticker, CARRIED from the static's
   ragazzi-site/css/sections/hero.css (its "Ticker (marquee)" block).

   WHY IT LIVES HERE. In Figma the ticker sits inside the hero frame, so the
   static builds it as part of section 1. In Shopify it is the announcement-bar
   section: it renders on every template, above the header, and the merchant
   edits its messages as blocks. Only the CSS moved — the values are the
   static's, unchanged.

   RENAMED, 1:1, because the block is no longer inside a hero:
     .hero--home .hero__ticker       ->  .ragazzi-ticker
     .hero--home .hero__ticker-item  ->  .ragazzi-ticker__item
     .hero--home .hero__ticker-text  ->  .ragazzi-ticker__text
     .hero--home .hero__ticker-arrow ->  .ragazzi-ticker__arrow
   The marquee template's own names — .marquee-ticker-container, .marquee-ticker,
   .marquee-ticker-initial-child-container, .slider-track — are a CONTRACT with
   ragazzi-marquee.js and must NOT be renamed.

   FIXED ON THE WAY IN (the static is broken here): its @keyframes had the
   namespacing tool applied to the KEYFRAME SELECTORS —
   `@keyframes marquee-ticker-scroll { .hero--home 0% {…} .hero--home to {…} }` —
   which makes the whole at-rule invalid, so the static's ticker does not move.
   A keyframe selector cannot be namespaced; the animation name already is the
   namespace. Restored to `0%` / `to`.
============================================================================ */

/* ---------------------------------------------------------------------------
   SECTION TOKENS — carried verbatim from the static's `.hero--home` block, the
   three that this section reads. Scoped to the section's own class so the block
   travels with it (a token read from a page-level scope breaks the moment the
   section is moved).
--------------------------------------------------------------------------- */
.ragazzi-ticker {
  --size-icon-ticker: clamp(13.55px, calc(25.4px * (var(--max-vw) / var(--vw-base))), 25.4px);
  --sp-ticker-h:      clamp(24.38px, calc(45.71px * (var(--max-vw) / var(--vw-base))), 45.71px);
  --text-ticker:      clamp(10px, calc(18px * (var(--max-vw) / var(--vw-base))), 18px);
}

@media (max-width: 767px) {
  .ragazzi-ticker {
    --size-icon-ticker: clamp(17.07px, calc(20px + (var(--max-vw) - 375px) * 0.015), 40.91px);
    --sp-ticker-h:      clamp(30.72px, calc(36px + (var(--max-vw) - 375px) * 0.015), 73.63px);
    --text-ticker:      clamp(10px, calc(12px + (var(--max-vw) - 375px) * 0.015), 25px);
  }
}

@media (min-width: 768px) and (max-width: 1023px) {
  .ragazzi-ticker {
    --size-icon-ticker: clamp(20px, calc(20px + (var(--max-vw) - 768px) * 0.025), 25.4px);
    --sp-ticker-h:      clamp(36px, calc(36px + (var(--max-vw) - 768px) * 0.025), 45.71px);
    --text-ticker:      clamp(12px, calc(12px + (var(--max-vw) - 768px) * 0.025), 18px);
  }
}

/* ---------------- Ticker (marquee) ----------------
   Figma: viewport 1920 x 45.71 (D) / 375 x 36 (M), black, ONE authored item
   repeated 3x purely to make the loop seamless — the JS makes the copies, so the
   markup carries each authored item exactly once (brief §11 D-1).
   Direction right -> left = the template default, so
   `data-marquee-ticker-is-reversed` is OMITTED (brief §11 D-2).                */
.ragazzi-ticker {
  overflow: hidden;              /* D-8: a non-clipping viewport would push the
                                    page 750px sideways. Figma leaves
                                    clipsContent false on the mobile node; the
                                    section is the real viewport. */
  white-space: nowrap;
  background: var(--color-black);
  height: var(--sp-ticker-h);
  width: 100%;
}

/* JS-BOUND + structural (marquee.css) — copied, values are this project's. */
.ragazzi-ticker.marquee-ticker-container {
  display: flex;
  flex-direction: row;
  position: relative;
  align-items: stretch;
  /* The seam gap must equal .slider-track's column-gap. Both are 0 here: Figma
     places the three copies flush at x 0 / 1920 / 3840, i.e. no gap at all —
     each item is a full viewport wide and centres its own message. */
  column-gap: 0;
}

.ragazzi-ticker.marquee-ticker-container:hover div {
  animation-play-state: var(--pause-on-hover);
}

@keyframes marquee-ticker-scroll {
  0%  { transform: translateZ(0); }
  to  { transform: translate3d(calc(-100% - var(--gap)), 0, 0); }
}

.ragazzi-ticker .marquee-ticker {
  animation: marquee-ticker-scroll var(--duration) linear infinite;
  animation-delay: 0s;
  animation-direction: var(--direction);
  animation-play-state: var(--play);
  transform: translateZ(0);
  display: flex;
  flex: 0 0 auto;
  flex-direction: row;
  align-items: inherit;
}

/* Layout lives on .slider-track so the JS clones (which keep ONLY this class)
   get it too. `align-items: stretch` instead of the template's `center` so the
   item fills the bar's height, exactly as the Figma item frame does (45.71 /
   36 tall, taller than its own content). */
.ragazzi-ticker .slider-track {
  display: inline-flex;
  flex-direction: row;
  align-items: stretch;
  column-gap: 0;
  white-space: nowrap;
}

/* One item = the full frame width with its message centred (Figma 3080:13423 /
   3080:13971). Sized off --max-vw so it tracks the bar at every viewport. */
.ragazzi-ticker__item {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: var(--max-vw);
  /* FIXED px, never clamp(): the marquee re-measures on every ResizeObserver
     tick, and a fluid gap/padding makes --duration jitter (ADAPT.md). */
  padding: 4px 0;
  column-gap: 8px;
  color: var(--color-white);
}

.ragazzi-ticker__text {
  font-family: var(--font-body);
  font-size: var(--text-ticker);
  font-weight: 500;
  line-height: var(--lh-120);
  text-align: center;
}

.ragazzi-ticker__arrow {
  width: var(--size-icon-ticker);
  height: var(--size-icon-ticker);
  flex: 0 0 auto;
  object-fit: contain;
}

@media (min-width: 1024px) {
  .ragazzi-ticker__item {
    padding: 5.08px 0;
    column-gap: 10.16px;
  }
}

/* Reduced motion — continuously moving text is a vestibular trigger; the bar
   keeps its layout and its copy, only the scroll stops. `.marquee-ticker` (not
   the container) is where the animation lives, and the JS clones carry that same
   class, so both copies pause. */
@media (prefers-reduced-motion: reduce) {
  .ragazzi-ticker .marquee-ticker {
    animation-play-state: paused;
  }
}

/* ============================================================================
   MERCHANT SWITCH — "Scroll the messages", off.

   Not part of the design: Figma has one state, and it scrolls. This is the
   layout the bar falls back to when the merchant turns scrolling off, and it is
   kept deliberately small — same bar, same type, the messages simply stand
   still, centred. The section renders no `data-marquee-type` in this mode, so
   the script never touches the element and never clones anything; these rules
   only undo the two things the carried CSS does FOR the animation (a
   viewport-wide item, and the running animation itself).

   The 40px between messages is the one value here with no Figma source — the
   design never shows two messages at rest. Stated rather than smuggled in.
============================================================================ */
.ragazzi-ticker--static {
  display: flex;
  align-items: stretch;
  justify-content: center;
}

.ragazzi-ticker--static .marquee-ticker {
  animation: none;
}

.ragazzi-ticker--static .ragazzi-ticker__item {
  width: auto;
}

.ragazzi-ticker--static .slider-track {
  column-gap: 40px;
}

/* ============================================================================
   ADAPTATION — Dawn reconciliation. Nothing above this line is ours.
============================================================================ */

/* 1. Dawn's utility bar paints itself from the section's colour scheme and pads
      itself with `.page-width`. The design's bar is black, edge to edge, and its
      own height token owns the box — so the scheme colours and the gutter are
      both dropped. `.ragazzi-utility-bar` is a class added to Dawn's own
      wrapper, so this outranks `.utility-bar`/`.page-width` (0,2,0 vs 0,1,0)
      whatever the load order turns out to be. */
.ragazzi-utility-bar.utility-bar {
  background: var(--color-black);
  color: var(--color-white);
  border-bottom: 0;
}

/* 1b. NO RULE for the gutter, and that is deliberate. Dawn pads this bar through
       the `page-width` class, whose widest rule is
       `body:has(.section-header .header:not(.drawer-menu)) .utility-bar .page-width`
       at (0,5,1) — measured on the live page, it left the ticker 50px short of
       each edge where the design runs edge to edge. Nothing sane in this file
       outranks it, so the class is off the grid element in the markup instead
       (sections/announcement-bar.liquid). */

/* 2. Dawn's grid names the announcement cell; the ticker takes it explicitly
      because the social-icon list is rendered BEFORE it in the DOM. */
.ragazzi-utility-bar .ragazzi-ticker {
  grid-area: announcements;
}

/* 3. Dawn's social icons and localization selectors are still merchant options
      on this section. They are not in the design, but a merchant who switches
      one on must not get black-on-black. */
.ragazzi-utility-bar .list-social__link,
.ragazzi-utility-bar .localization-form__select,
.ragazzi-utility-bar .disclosure__link {
  color: var(--color-white);
}
