<section class="folk-tale" data-reveal>
  <div class="container">
    <div class="folk-tale__layout">
      <div class="folk-tale__media">
        {%- if section.settings.image != blank -%}
          <img src="{{ section.settings.image | image_url: width: 800 }}" srcset="{{ section.settings.image | image_url: width: 400 }} 400w, {{ section.settings.image | image_url: width: 600 }} 600w, {{ section.settings.image | image_url: width: 800 }} 800w" sizes="(max-width: 768px) 100vw, 50vw" alt="{{ section.settings.image.alt | escape }}" loading="lazy" class="folk-tale__img">
        {%- else -%}
          <img src="{{ 'brand-story.png' | asset_url }}" alt="" loading="lazy" class="folk-tale__img" onerror="this.style.display='none';this.nextElementSibling.style.display='flex';">
          <div class="folk-tale__placeholder" style="display:none;">
            <svg viewBox="0 0 600 500" fill="none" stroke="currentColor" stroke-width="1" opacity="0.12" aria-hidden="true"><rect x="100" y="50" width="400" height="400" rx="24"/><circle cx="300" cy="220" r="60"/><path d="M200 350 h200"/></svg>
          </div>
        {%- endif -%}
      </div>
      <div class="folk-tale__content">
        {%- if section.settings.eyebrow != blank -%}
          <span class="section-eyebrow">{{ section.settings.eyebrow }}</span>
        {%- endif -%}
        {%- if section.settings.heading != blank -%}
          <h2 class="section-heading">{{ section.settings.heading }}</h2>
        {%- endif -%}
        {%- if section.settings.text != blank -%}
          <div class="folk-tale__body">{{ section.settings.text }}</div>
        {%- endif -%}
        {%- if section.settings.cta_text != blank -%}
          <a href="{{ section.settings.cta_url | default: '/pages/about' }}" class="btn btn--primary">{{ section.settings.cta_text }}</a>
        {%- endif -%}
      </div>
    </div>
  </div>
</section>

{% schema %}
{
  "name": "Folk Tale",
  "class": "section-folk-tale",
  "settings": [
    { "type": "text", "id": "eyebrow", "label": "Eyebrow" },
    { "type": "text", "id": "heading", "label": "Heading", "default": "Our Story" },
    { "type": "richtext", "id": "text", "label": "Body text" },
    { "type": "text", "id": "cta_text", "label": "Button text" },
    { "type": "text", "id": "cta_url", "label": "Button URL" },
    { "type": "image_picker", "id": "image", "label": "Image" }
  ],
  "presets": [{ "name": "Folk Tale" }]
}
{% endschema %}