{{ 'core-principles.css' | asset_url | stylesheet_tag }}

{%- style -%}
  .section-{{ section.id }}-padding {
    padding-top: {{ section.settings.padding_top | times: 0.75 | round: 0 }}px;
    padding-bottom: {{ section.settings.padding_bottom | times: 0.75 | round: 0 }}px;
  }

  @media screen and (min-width: 750px) {
    .section-{{ section.id }}-padding {
      padding-top: {{ section.settings.padding_top }}px;
      padding-bottom: {{ section.settings.padding_bottom }}px;
    }
  }
{%- endstyle -%}

<div class="core-principles page-width--narrow section-{{ section.id }}-padding">
  <div class="core-principles__header">
    <h2 class="{{ section.settings.heading_size }} {{ section.settings.heading_alignment }}" id="core-principles-heading">
      {{ section.settings.heading }}
    </h2>
  </div>

  <ul
    class="grid grid--1-col core-principles__grid"
    role="list"
    aria-labelledby="core-principles-heading">
    {% for block in section.blocks %}
      <li class="grid__item core-principles__item">
        <div class="core-principles-content">

          <!-- Left content -->
          <div class="desk-left-content content-side content-side-icon-title icon-{{ section.settings.icon_alignment }} title-{{ section.settings.title_alignment }} mbl-icon-{{ section.settings.mobile_icon_alignment }} mbl-title-{{ section.settings.mobile_title_alignment }}">
            <div class="core-principles__icon">
              {% if block.settings.icon != blank %}
                {{ block.settings.icon  | image_url: width: block.settings.icon.width  | image_tag:  alt: block.settings.icon_alt | default: block.settings.title,  loading: 'lazy',  role: 'img'
                }}
              {% endif %}
            </div>
            <h3 class="core-principles__title h4">
              {{ block.settings.title }}
            </h3>
          </div>

          <!-- Right content -->
          <div class="desk-right-content content-side content-side-text {{ section.settings.text_alignment }} mbl-text-{{ section.settings.mobile_text_alignment }}">
            <p>
              {{ block.settings.text }}
            </p>
          </div>

        </div>
      </li>
    {% endfor %}
  </ul>
</div>

{% schema %}
  {
    "name": "Core Principles",
    "tag": "section",
    "settings": [
      {
        "type": "text",
        "id": "heading",
        "label": "Section Heading",
        "default": "Our Core Principles"
      },
      {
        "type": "select",
        "id": "heading_size",
        "options": [
          {
            "value": "h4",
            "label": "t:sections.all.heading_size.options__1.label"
          },
          {
            "value": "h3",
            "label": "t:sections.all.heading_size.options__2.label"
          },
          {
            "value": "h2",
            "label": "t:sections.all.heading_size.options__3.label"
          },
          {
            "value": "h1",
            "label": "t:sections.all.heading_size.options__4.label"
          }
        ],
        "default": "h2",
        "label": "t:sections.all.heading_size.label"
      },
      {
        "type": "select",
        "id": "heading_alignment",
        "label": "t:sections.collapsible_content.settings.heading_alignment.label",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "header",
        "content": "Desktop body"
      },
      {
        "type": "select",
        "id": "icon_alignment",
        "label": "Icon align",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "select",
        "id": "title_alignment",
        "label": "Title align",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "select",
        "id": "text_alignment",
        "label": "Text align",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "header",
        "content": "Mobile body"
      },
      {
        "type": "select",
        "id": "mobile_icon_alignment",
        "label": "Icon align",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "select",
        "id": "mobile_title_alignment",
        "label": "Title align",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "select",
        "id": "mobile_text_alignment",
        "label": "Text align",
        "options": [
          {
            "value": "left",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__1.label"
          },
          {
            "value": "center",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__2.label"
          },
          {
            "value": "right",
            "label": "t:sections.collapsible_content.settings.heading_alignment.options__3.label"
          }
        ],
        "default": "center"
      },
      {
        "type": "header",
        "content": "t:sections.all.padding.section_padding_heading"
      },
      {
        "type": "range",
        "id": "padding_top",
        "min": 0,
        "max": 100,
        "step": 4,
        "unit": "px",
        "label": "t:sections.all.padding.padding_top",
        "default": 36
      },
      {
        "type": "range",
        "id": "padding_bottom",
        "min": 0,
        "max": 100,
        "step": 4,
        "unit": "px",
        "label": "t:sections.all.padding.padding_bottom",
        "default": 36
      }
    ],
    "blocks": [
      {
        "type": "principle",
        "name": "Principle",
        "settings": [
          {
            "type": "image_picker",
            "id": "icon",
            "label": "Icon"
          },
          {
            "type": "text",
            "id": "title",
            "label": "Title",
            "default": "Fast & Reliable"
          },
          {
            "type": "textarea",
            "id": "text",
            "label": "Description",
            "default": "Your description here..."
          }
        ]
      }
    ],
    "max_blocks": 6,
    "presets": [
      {
        "name": "Core Principles",
        "blocks": [
          {
            "type": "principle",
            "settings": {
              "title": "Fast & Reliable",
              "text": "We understand that timing is everything..."
            }
          },
          {
            "type": "principle",
            "settings": {
              "title": "Human & Honest",
              "text": "While we strive for accuracy..."
            }
          },
          {
            "type": "principle",
            "settings": {
              "title": "Helpful & Dedicated",
              "text": "Our experienced customer service team..."
            }
          }
        ]
      }
    ]
  }
{% endschema %}