{%- comment -%} MW · Marquee — auto-scrolling benefits/announcement strip. {%- endcomment -%}
{%- assign uid = section.id | replace: '_', '' | replace: '-', '' -%}
{% style %}
  #shopify-section-{{ section.id }}{ --mq-bg:{{ section.settings.bg_color }}; --mq-text:{{ section.settings.text_color }}; --mq-ic:{{ section.settings.icon_color }}; }
  .mq-{{ uid }}{ background:var(--mq-bg); overflow:hidden; padding:{{ section.settings.padding }}px 0; }
  .mq-{{ uid }} .mq__track{ display:flex; width:max-content; align-items:center; gap:{{ section.settings.gap }}px; animation:mq-scroll-{{ uid }} {{ section.settings.speed }}s linear infinite; }
  .mq-{{ uid }}:hover .mq__track{ animation-play-state:{% if section.settings.pause_on_hover %}paused{% else %}running{% endif %}; }
  .mq-{{ uid }} .mq__item{ display:inline-flex; align-items:center; gap:{{ section.settings.gap }}px; flex:none; }
  .mq-{{ uid }} .mq__t{ font-family:{{ section.settings.font.family }},{{ section.settings.font.fallback_families }}; font-weight:{{ section.settings.font.weight | default: 600 }}; font-size:{{ section.settings.text_size }}px; letter-spacing:{{ section.settings.letter_spacing | divided_by: 100.0 }}em; text-transform:{{ section.settings.uppercase }}; color:var(--mq-text); white-space:nowrap; }
  .mq-{{ uid }} .mq__sep{ width:{{ section.settings.text_size | plus: 2 }}px; height:{{ section.settings.text_size | plus: 2 }}px; color:var(--mq-ic); flex:none; }
  @keyframes mq-scroll-{{ uid }}{ from{transform:translateX(0)} to{transform:translateX(-50%)} }
{% endstyle %}
<div class="mq-{{ uid }}">
  <div class="mq__track">
    {%- for n in (1..2) -%}{%- for block in section.blocks -%}
      <span class="mq__item" {{ block.shopify_attributes }}><span class="mq__t">{{ block.settings.text | escape }}</span>{% render 'mw-icon', name: section.settings.separator, class: 'mq__sep' %}</span>
    {%- endfor -%}{%- endfor -%}
  </div>
</div>
{% schema %}
{
  "name": "MW · Marquee",
  "tag": "section",
  "class": "mw-section mw-marquee",
  "settings": [
    { "type": "select", "id": "separator", "label": "Separator icon", "default": "sparkle", "options": [ {"value":"sparkle","label":"Sparkle"}, {"value":"star","label":"Star"}, {"value":"heart","label":"Heart"}, {"value":"check","label":"Check"}, {"value":"leaf","label":"Leaf"} ] },
    { "type": "range", "id": "speed", "min": 15, "max": 90, "step": 5, "unit": "s", "label": "Scroll duration", "default": 40 },
    { "type": "range", "id": "gap", "min": 16, "max": 80, "step": 4, "unit": "px", "label": "Gap", "default": 40 },
    { "type": "checkbox", "id": "pause_on_hover", "label": "Pause on hover", "default": true },
    { "type": "range", "id": "padding", "min": 6, "max": 48, "step": 2, "unit": "px", "label": "Vertical padding", "default": 16 },
    { "type": "font_picker", "id": "font", "label": "Font", "default": "poppins_n6" },
    { "type": "range", "id": "text_size", "min": 12, "max": 32, "step": 1, "unit": "px", "label": "Text size", "default": 16 },
    { "type": "range", "id": "letter_spacing", "min": 0, "max": 30, "step": 1, "label": "Letter spacing (×0.01em)", "default": 4 },
    { "type": "select", "id": "uppercase", "label": "Case", "default": "uppercase", "options": [ {"value":"none","label":"Normal"}, {"value":"uppercase","label":"Uppercase"} ] },
    { "type": "color", "id": "bg_color", "label": "Background", "default": "#3A3027" },
    { "type": "color", "id": "text_color", "label": "Text", "default": "#F3ECE1" },
    { "type": "color", "id": "icon_color", "label": "Separator icon", "default": "#B79B6E" }
  ],
  "blocks": [
    { "type": "item", "name": "Phrase", "settings": [ { "type": "text", "id": "text", "label": "Text", "default": "Free shipping over $50" } ] }
  ],
  "max_blocks": 12,
  "presets": [ { "name": "MW · Marquee", "blocks": [
    { "type": "item", "settings": { "text": "Free shipping over $50" } },
    { "type": "item", "settings": { "text": "60-day returns" } },
    { "type": "item", "settings": { "text": "Free size swaps, both ways" } },
    { "type": "item", "settings": { "text": "Knitted, not glued" } },
    { "type": "item", "settings": { "text": "Machine washable" } }
  ] } ]
}
{% endschema %}
