{%- 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 -%}

{%- capture disclosures_content -%}
  {%- render 'product-disclosures',
    product: product,
    heading: section.settings.heading,
    heading_size: section.settings.heading_size,
    open_by_default: section.settings.open_by_default,
    surface: 'product_page'
  -%}
{%- endcapture -%}

{%- unless disclosures_content == blank -%}
  <div class="color-{{ section.settings.color_scheme }} gradient">
    <div class="page-width section-{{ section.id }}-padding">
      {{ disclosures_content }}
    </div>
  </div>
{%- endunless -%}

{% schema %}
{
  "name": "t:sections.disclosures.name",
  "enabled_on": {
    "templates": ["product"]
  },
  "settings": [
    {
      "type": "paragraph",
      "content": "t:sections.disclosures.settings.paragraph.content"
    },
    {
      "type": "text",
      "id": "heading",
      "label": "t:sections.disclosures.settings.heading.label",
      "default": "t:sections.disclosures.name"
    },
    {
      "type": "select",
      "id": "heading_size",
      "options": [
        {
          "value": "h2",
          "label": "t:sections.all.heading_size.options__1.label"
        },
        {
          "value": "h1",
          "label": "t:sections.all.heading_size.options__2.label"
        },
        {
          "value": "h0",
          "label": "t:sections.all.heading_size.options__3.label"
        }
      ],
      "default": "h2",
      "label": "t:sections.all.heading_size.label"
    },
    {
      "type": "checkbox",
      "id": "open_by_default",
      "label": "t:sections.disclosures.settings.open_by_default.label",
      "default": false
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.colors.label",
      "default": "scheme-1"
    },
    {
      "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
    }
  ],
  "presets": [
    {
      "name": "t:sections.disclosures.name"
    }
  ]
}
{% endschema %}
