{{ 'section-policy-v2.css' | asset_url | stylesheet_tag }}

<section class='policy-v10'>
  <div {% render 'section-attr' %}>
    {% render 'section-bg-image' %}
    <xo-container {% render 'section-layout' %}>
      {%- if section.settings.is_grid -%}
        <xo-grid
          style='--xs: 1;--sm: 1 ; --md: 2 ; --xl: {{ section.settings.limit }}; --xo-grid-col-gap: {{section.settings.col_gap}}px; --xo-grid-row-gap: {{section.settings.row_gap}}px;'
        >
          {%- for block in section.blocks -%}
            <div class='policy-v10__box' style='--bg: {{ block.settings.bg }}'>
              <div class='policy-v10__wrap'>
                <div>
                  <div class='policy-v10__svg'>
                    {% if block.settings.svg != empty %}
                      {{ block.settings.svg }}
                    {% elsif block.settings.image_svg != empty %}
                      {% render 'image', image: block.settings.image_svg %}
                    {%- else -%}
                      {% render 'image', image: block.settings.img_default %}
                    {% endif %}
                  </div>
                </div>
                <div class='policy-v10__info'>
                  <h6 class='policy-v10__title'>
                    {{ block.settings.title }}
                  </h6>
                  <div class='policy-v10__desc'>
                    {{ block.settings.description }}
                  </div>
                </div>
              </div>
            </div>
          {%- endfor -%}
        </xo-grid>
      {%- else -%}
        <xo-carousel
          xo-per-view='{{ section.settings.limit_carousel }}'
          xo-overflow='visible'
          xo-gap='{{ section.settings.carousel_gap }}'
          xo-breakpoints="
                      {
            600: {
              perView: 1,
              gap: 10,
              overflow: 'visible'
              },
              992: {
                perView: 2,
                overflow: 'visible'
              },
            }
          "
          xo-render-bullet='<span></span>'
        >
          <xo-carousel-inner>
            <xo-carousel-list>
              {%- for block in section.blocks -%}
                <xo-carousel-slide>
                  <div class='policy-v10__box' style='--bg: {{ block.settings.bg }}'>
                    <div class='policy-v10__wrap'>
                      <div>
                        <div>
                          <div class='policy-v10__svg'>
                            {% if block.settings.svg != empty %}
                              {{ block.settings.svg }}
                            {% elsif block.settings.image_svg != empty %}
                              {% render 'image', image: block.settings.image_svg %}
                            {%- else -%}
                              {% render 'image', image: block.settings.img_default %}
                            {% endif %}
                          </div>
                        </div>
                        <div class='policy-v10__info'>
                          <h6 class='policy-v10__title'>
                            {{ block.settings.title }}
                          </h6>
                          <div class='policy-v10__desc'>
                            {{ block.settings.description }}
                          </div>
                        </div>
                      </div>
                    </div>
                  </div>
                </xo-carousel-slide>
              {%- endfor -%}
            </xo-carousel-list>
          </xo-carousel-inner>
        </xo-carousel>
      {%- endif -%}
    </xo-container>
  </div>
</section>

{% schema %}
{
  "name": "t:sections.policy_v2.name",
  "tag": "section",
  "class": "section",
  "settings": [
    {
      "type": "header",
      "content": "Setting layout"
    },
    {
      "type": "select",
      "id": "width",
      "label": "t:sections.all.width.label",
      "default": "box",
      "options": [
        {
          "value": "box",
          "label": "t:sections.all.width.options__1.label"
        },
        {
          "value": "wide",
          "label": "t:sections.all.width.options__2.label"
        },
        {
          "value": "fullwidth",
          "label": "t:sections.all.width.options__3.label"
        }
      ]
    },
    {
      "type": "checkbox",
      "id": "is_grid",
      "label": "t:sections.policy_v2.settings.checkbox.grid",
      "default": true
    },
    {
      "type": "header",
      "content": "t:sections.policy_v2.settings.header.content-1"
    },
    {
      "type": "range",
      "id": "limit_carousel",
      "min": 2,
      "max": 5,
      "step": 1,
      "label": "t:sections.policy_v2.settings.carousel.label",
      "default": 3
    },
    {
      "type": "range",
      "id": "carousel_gap",
      "min": 0,
      "max": 80,
      "step": 1,
      "unit": "px",
      "label": "t:sections.policy_v2.settings.carousel.gap",
      "default": 0
    },
    {
      "type": "header",
      "content": "t:sections.policy_v2.settings.header.content-2"
    },
    {
      "type": "range",
      "id": "limit",
      "min": 2,
      "max": 5,
      "step": 1,
      "label": "t:sections.policy_v2.settings.columns.label",
      "default": 3
    },
    {
      "type": "range",
      "id": "col_gap",
      "min": 0,
      "max": 80,
      "step": 1,
      "unit": "px",
      "label": "t:sections.policy_v2.settings.columns-gap.label",
      "default": 0
    },
    {
      "type": "range",
      "id": "row_gap",
      "min": 0,
      "max": 80,
      "step": 1,
      "unit": "px",
      "label": "t:sections.policy_v2.settings.rows-gap.label",
      "default": 0
    },
    {
      "type": "header",
      "content": "t:sections.all.heading.content"
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.color_scheme.label"
    },
    {
      "type": "color",
      "id": "background_color",
      "label": "t:sections.all.bg_color.label"
    },
    {
      "type": "color_background",
      "id": "background_gradient",
      "label": "t:sections.all.bg_gradient.label"
    },
    {
      "type": "image_picker",
      "id": "background_image_desktop",
      "label": "t:sections.all.background_image_desktop.label"
    },
    {
      "type": "image_picker",
      "id": "background_image_mobile",
      "label": "t:sections.all.background_image_mobile.label"
    },
    {
      "type": "checkbox",
      "id": "use_parallax",
      "label": "t:sections.all.use_parallax.label",
      "default": true
    },
    {
      "type": "number",
      "id": "padding_top",
      "label": "t:sections.all.padding_top.label",
      "default": 50
    },
    {
      "type": "number",
      "id": "padding_bottom",
      "label": "t:sections.all.padding_bottom.label",
      "default": 50
    }
  ],
  "blocks": [
    {
      "name": "Items box ",
      "type": "items-box",
      "settings": [
        {
          "type": "color",
          "id": "bg",
          "label": "t:sections.policy_v2.settings.background.label",
          "default": "#c99a5c"
        },
        {
          "type": "html",
          "id": "svg",
          "label": "t:sections.policy_v2.settings.svg.label"
        },
        {
          "type": "image_picker",
          "id": "image_svg",
          "label": "t:sections.policy_v2.settings.image-icon.label",
          "info": "t:sections.policy_v2.settings.image-icon.info"
        },
        {
          "type": "text",
          "id": "title",
          "label": "t:sections.policy_v2.settings.title.label",
          "default": "t:sections.policy_v2.settings.title.default",
          "info": "t:sections.policy_v2.settings.text.info"
        },
        {
          "type": "text",
          "id": "description",
          "label": "t:sections.policy_v2.settings.description.label",
          "default": "t:sections.policy_v2.settings.description.default",
          "info": "t:sections.policy_v2.settings.text.info"
        }
      ]
    }
  ],
  "presets": [
    {
      "name": "t:sections.policy_v2.presets.name"
    }
  ]
}
{% endschema %}
