/** Shopify CDN: Minification failed

Line 16:0 Unexpected "{"
Line 16:1 Expected identifier but found "%"
Line 29:0 Unexpected "{"
Line 29:1 Expected identifier but found "%"
Line 30:2 Unexpected "{"
Line 30:3 Unexpected "{"
Line 30:5 Expected identifier but found "'collection-description-seo.css'"
Line 32:2 Unexpected "<"
Line 38:9 Expected identifier but found "%"
Line 39:10 Unexpected "<"
... and 33 more hidden warnings

**/
{%- liquid
  assign section_st = section.settings
  assign section_width = section_st.section_width
  assign color_scheme = section_st.color_scheme
  assign enable_read_more = section_st.enable_read_more
  assign collapsed_height = section_st.collapsed_height

  assign description_html = collection.description
  if section_st.custom_description != blank
    assign description_html = section_st.custom_description
  endif
-%}

{% if description_html != blank %}
  {{ 'collection-description-seo.css' | asset_url | stylesheet_tag }}

  <div
    class="section collection-desc-seo color-{{ color_scheme }} gradient"
    style="--section-pt: {{ section_st.padding_top }}; --section-pb: {{ section_st.padding_bottom }};"
  >
    <div class="{{ section_width }}">
      <div class="collection-desc-seo__inner text-{{ section_st.alignment }}">
        {% if section_st.heading != blank %}
          <h2 class="collection-desc-seo__heading h4 mb-15">{{ section_st.heading }}</h2>
        {% endif %}

        <div
          class="collection-desc-seo__text rich__text-m0{% if enable_read_more %} is-collapsible{% endif %}"
          {% if enable_read_more %}
            style="--collapsed-height: {{ collapsed_height }}px"
            data-collection-desc-text
          {% endif %}
        >
          {{ description_html }}
        </div>

        {% if enable_read_more %}
          <button
            type="button"
            class="btn-link collection-desc-seo__toggle mt-15"
            data-collection-desc-toggle
            aria-expanded="false"
          >
            <span data-label-more>{{ section_st.read_more_label | default: 'Leer más' }}</span>
            <span data-label-less class="hidden">{{ section_st.read_less_label | default: 'Leer menos' }}</span>
          </button>
        {% endif %}
      </div>
    </div>
  </div>

  {% if enable_read_more %}
    <script>
      (function () {
        document.querySelectorAll('[data-collection-desc-toggle]').forEach(function (btn) {
          btn.addEventListener('click', function () {
            var wrap = btn.closest('.collection-desc-seo__inner');
            if (!wrap) return;
            var text = wrap.querySelector('[data-collection-desc-text]');
            var more = btn.querySelector('[data-label-more]');
            var less = btn.querySelector('[data-label-less]');
            var expanded = btn.getAttribute('aria-expanded') === 'true';

            btn.setAttribute('aria-expanded', String(!expanded));
            text.classList.toggle('is-expanded', !expanded);
            more.classList.toggle('hidden', !expanded);
            less.classList.toggle('hidden', expanded);
          });
        });
      })();
    </script>
  {% endif %}
{% endif %}

{% schema %}
{
  "name": "Texto SEO colección",
  "tag": "section",
  "class": "collection-desc-seo-section",
  "settings": [
    {
      "type": "select",
      "id": "section_width",
      "options": [
        { "value": "container", "label": "t:sections.all.section_width.container.label" },
        { "value": "fluid_container", "label": "t:sections.all.section_width.fluid_container.label" },
        { "value": "stretch_width", "label": "t:sections.all.section_width.stretch_width.label" },
        { "value": "full_width", "label": "t:sections.all.section_width.full_width.label" }
      ],
      "default": "stretch_width",
      "label": "t:sections.all.section_width.label"
    },
    {
      "type": "color_scheme",
      "id": "color_scheme",
      "label": "t:sections.all.color_scheme.label",
      "default": "default-color-scheme"
    },
    {
      "type": "select",
      "id": "alignment",
      "label": "t:sections.all.section_header.alignment.label",
      "default": "left",
      "options": [
        { "value": "left", "label": "t:sections.all.content_settings.content_alignment.left.label" },
        { "value": "center", "label": "t:sections.all.content_settings.content_alignment.center.label" },
        { "value": "right", "label": "t:sections.all.content_settings.content_alignment.right.label" }
      ]
    },
    { "type": "header", "content": "Contenido" },
    { "type": "text", "id": "heading", "label": "Titulo (opcional)", "info": "Ej. \"Sobre nuestro bicarbonato de sodio\". Dejalo vacio si no quieres titulo." },
    {
      "type": "richtext",
      "id": "custom_description",
      "label": "Texto SEO personalizado (opcional)",
      "info": "Si lo dejas vacio, se usa automaticamente la descripcion de la coleccion (Productos > Colecciones > Descripcion)."
    },
    { "type": "header", "content": "Leer mas / Leer menos" },
    { "type": "checkbox", "id": "enable_read_more", "label": "Recortar el texto y anadir boton \"Leer mas\"", "default": true },
    { "type": "range", "id": "collapsed_height", "label": "Altura visible antes de recortar", "min": 80, "max": 500, "step": 10, "unit": "px", "default": 160 },
    { "type": "text", "id": "read_more_label", "label": "Texto boton (expandir)", "default": "Leer más" },
    { "type": "text", "id": "read_less_label", "label": "Texto boton (contraer)", "default": "Leer menos" },
    { "type": "header", "content": "t:sections.all.section_padding.label" },
    { "type": "range", "id": "padding_top", "label": "t:sections.all.section_padding.top.label", "default": 40, "min": 0, "max": 100, "step": 2, "unit": "px" },
    { "type": "range", "id": "padding_bottom", "label": "t:sections.all.section_padding.bottom.label", "default": 60, "min": 0, "max": 100, "step": 2, "unit": "px" }
  ],
  "presets": [
    { "name": "Texto SEO colección" }
  ]
}
{% endschema %}