<section class="studio-story" data-reveal>
  <div class="container">
    <div class="studio-story__layout">
      <div class="studio-story__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="studio-story__img">
        {%- else -%}
          <img src="{{ 'brand-story.png' | asset_url }}" alt="" loading="lazy" class="studio-story__img" onerror="this.style.display='none';this.nextElementSibling.style.display='flex';">
          <div class="studio-story__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="8"/><circle cx="300" cy="250" r="50"/></svg>
          </div>
        {%- endif -%}
      </div>
      <div class="studio-story__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="studio-story__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": "Studio Story",
  "class": "section-studio-story",
  "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": "Studio Story" }]
}
{% endschema %}