{{- $src := .Get "src" -}}
{{- $alt := .Get "alt" | default "Image" -}}
{{- $caption := .Get "caption" -}}
{{- $class := .Get "class" | default "rounded-lg border border-border/30" -}}

{{- if $src -}}
  <figure class="my-8">
    <img
      src="{{ $src }}"
      alt="{{ $alt }}"
      class="{{ $class }} w-full h-auto"
      loading="lazy"
    />
    {{- if $caption -}}
      <figcaption class="mt-3 text-center text-sm text-text-dim italic">
        {{ $caption }}
      </figcaption>
    {{- end -}}
  </figure>
{{- else -}}
  {{- errorf "image shortcode: 'src' parameter is required" -}}
{{- end -}}
