{%- comment -%}
  Gift Bar — trust / notice strip
  Generated from the shared badge/notice skeleton, then tuned. Icon is
  inline SVG so it inherits currentColor and needs no asset.
{%- endcomment -%}

{%- liquid
  assign s = section.settings
  assign uid = section.id
-%}

{% style %}
  .gb2-{{ uid }} {
    padding: {{ s.padding_y }}px 0;
    background: {{ s.bg_color }};
    color: {{ s.text_color }};
  }
  .gb2-{{ uid }}__box {
    display: flex; align-items: {{ s.v_align }}; gap: {{ s.gap }}px;
    justify-content: {% if s.align == 'center' %}center{% elsif s.align == 'right' %}flex-end{% else %}flex-start{% endif %};
    text-align: {{ s.align }};
    max-width: {{ s.max_width }}px;
    margin: 0 auto;
    
  }
  .gb2-{{ uid }}__icon {
    flex: 0 0 auto; color: {{ s.accent_color }};
    width: {{ s.icon_size }}px; height: {{ s.icon_size }}px;
  }
  .gb2-{{ uid }}__icon svg { width: 100%; height: 100%; display: block; }
  .gb2-{{ uid }}__body { min-width: 0; }
  .gb2-{{ uid }}__heading {
    margin: 0; font-size: {{ s.heading_size }}px; font-weight: 600;
    {% if s.uppercase %}text-transform: uppercase; letter-spacing: .06em;{% endif %}
  }
  .gb2-{{ uid }}__text { margin: 4px 0 0; font-size: {{ s.text_size }}px; opacity: .82; }
  .gb2-{{ uid }}__cta {
    display: inline-block; margin-top: 8px; color: inherit;
    font-size: {{ s.text_size }}px; text-decoration: underline; text-underline-offset: 3px;
  }
  .gb2-{{ uid }}__pay {
    display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 10px;
  }
  .gb2-{{ uid }}__pay svg { height: 22px; width: auto; }
  @media screen and (max-width: 749px) {
    .gb2-{{ uid }}__box { flex-direction: {% if s.stack_mobile %}column{% else %}row{% endif %}; text-align: {% if s.stack_mobile %}center{% else %}{{ s.align }}{% endif %}; align-items: center; }
  }
{% endstyle %}

<div class="gb2-{{ uid }}">
  <div class="page-width">
    <div class="gb2-{{ uid }}__box">
      {%- if s.show_icon -%}
        <span class="gb2-{{ uid }}__icon" aria-hidden="true">
          <svg viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="1.6"
               stroke-linecap="round" stroke-linejoin="round"><rect x="3" y="8" width="18" height="13" rx="2"/><path d="M3 12h18M12 8v13"/><path d="M12 8S9.5 3 7.5 3a2.5 2.5 0 0 0 0 5M12 8s2.5-5 4.5-5a2.5 2.5 0 0 1 0 5"/></svg>
        </span>
      {%- endif -%}
      <div class="gb2-{{ uid }}__body">
        {%- if s.heading != blank -%}
          <p class="gb2-{{ uid }}__heading">{{ s.heading | escape }}</p>
        {%- endif -%}
        {%- if s.text != blank -%}
          <div class="gb2-{{ uid }}__text">{{ s.text }}</div>
        {%- endif -%}
        {%- if s.cta_label != blank -%}
          <a class="gb2-{{ uid }}__cta" href="{{ s.cta_link | default: '#' }}">{{ s.cta_label | escape }}</a>
        {%- endif -%}
        {%- if s.show_payments -%}
          <div class="gb2-{{ uid }}__pay">
            {%- for type in shop.enabled_payment_types -%}
              {{ type | payment_type_svg_tag: class: 'icon icon--full-color' }}
            {%- endfor -%}
          </div>
        {%- endif -%}
      </div>
    </div>
  </div>
</div>

{% schema %}
{
  "name": "Gift Bar",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "text",
      "id": "heading",
      "label": "Heading",
      "default": "Free gift on orders over \u09f33000"
    },
    {
      "type": "richtext",
      "id": "text",
      "label": "Text"
    },
    {
      "type": "text",
      "id": "cta_label",
      "label": "Link label"
    },
    {
      "type": "url",
      "id": "cta_link",
      "label": "Link"
    },
    {
      "type": "checkbox",
      "id": "show_icon",
      "label": "Show icon",
      "default": true
    },
    {
      "type": "checkbox",
      "id": "show_payments",
      "label": "Show payment icons",
      "default": false
    },
    {
      "type": "header",
      "content": "Layout"
    },
    {
      "type": "select",
      "id": "align",
      "label": "Alignment",
      "default": "left",
      "options": [
        {
          "value": "left",
          "label": "Left"
        },
        {
          "value": "center",
          "label": "Centre"
        },
        {
          "value": "right",
          "label": "Right"
        }
      ]
    },
    {
      "type": "select",
      "id": "v_align",
      "label": "Vertical alignment",
      "default": "center",
      "options": [
        {
          "value": "flex-start",
          "label": "Top"
        },
        {
          "value": "center",
          "label": "Middle"
        }
      ]
    },
    {
      "type": "checkbox",
      "id": "stack_mobile",
      "label": "Stack on mobile",
      "default": true
    },
    {
      "type": "range",
      "id": "gap",
      "min": 4,
      "max": 40,
      "step": 2,
      "unit": "px",
      "label": "Gap",
      "default": 14
    },
    {
      "type": "range",
      "id": "max_width",
      "min": 300,
      "max": 1200,
      "step": 20,
      "unit": "px",
      "label": "Max width",
      "default": 1000
    },
    {
      "type": "range",
      "id": "icon_size",
      "min": 16,
      "max": 72,
      "step": 2,
      "unit": "px",
      "label": "Icon size",
      "default": 32
    },
    {
      "type": "header",
      "content": "Style"
    },
    {
      "type": "range",
      "id": "heading_size",
      "min": 12,
      "max": 36,
      "step": 1,
      "unit": "px",
      "label": "Heading size",
      "default": 16
    },
    {
      "type": "range",
      "id": "text_size",
      "min": 10,
      "max": 22,
      "step": 1,
      "unit": "px",
      "label": "Text size",
      "default": 14
    },
    {
      "type": "checkbox",
      "id": "uppercase",
      "label": "Uppercase heading",
      "default": false
    },
    {
      "type": "color",
      "id": "bg_color",
      "label": "Section background",
      "default": "#111111"
    },
    {
      "type": "color",
      "id": "text_color",
      "label": "Text",
      "default": "#ffffff"
    },
    {
      "type": "color",
      "id": "accent_color",
      "label": "Icon colour",
      "default": "#ffffff"
    },
    {
      "type": "range",
      "id": "padding_y",
      "min": 0,
      "max": 96,
      "step": 2,
      "unit": "px",
      "label": "Vertical padding",
      "default": 26
    }
  ],
  "presets": [
    {
      "name": "Gift Bar"
    }
  ]
}
{% endschema %}
