{# Import smart link macro for intelligent URL handling #}
{% import "../../includes/macros/smart-link.html" as links %}
{% set c = module.content %}
{% set i = module.images %}
{% set l = module.layout %}
{% set a = module.advanced %}
{# Get image URLs - HubSpot image fields have a .src property #}
{# When an image is selected in the editor, it will have a .src property #}
{# When using defaults from fields.json, we need to apply get_asset_url #}
{# Mobile image #}
{% if i.mobile_image and i.mobile_image.src %}
{# Image is set (either from editor or default) #}
{% set mobile_img_raw = i.mobile_image.src %}
{# Check if it's a relative path from default that needs get_asset_url #}
{% if '../../images/' in mobile_img_raw %}
{% set mobile_img_url = get_asset_url(mobile_img_raw) %}
{% else %}
{# It's already a full URL from the editor #}
{% set mobile_img_url = mobile_img_raw %}
{% endif %}
{% endif %}
{# Desktop background #}
{% if i.desktop_background and i.desktop_background.src %}
{# Image is set (either from editor or default) #}
{% set desktop_bg_raw = i.desktop_background.src %}
{# Check if it's a relative path from default that needs get_asset_url #}
{% if '../../images/' in desktop_bg_raw %}
{% set desktop_bg_url = get_asset_url(desktop_bg_raw) %}
{% else %}
{# It's already a full URL from the editor #}
{% set desktop_bg_url = desktop_bg_raw %}
{% endif %}
{% endif %}
{# Desktop background URL will use query params when needed #}
{# Hero wrapper with CSS variable for desktop background (won't load on mobile) #}
{# Content wrapper - constrained to container width #}
{% if c.eyebrow %}
{{ c.eyebrow|escape }}
{% endif %}
{{ c.heading|escape }}
{% if c.subheading %}
{{ c.subheading|sanitize_html }}
{% endif %}
{# CTAs - Using smart link macro for intelligent URL handling #}
{# Mobile image - hybrid solution with background-image for precise control #}
{% if mobile_img_url %}
{# Calculate aspect ratio for proper sizing #}
{% set aspect_width = i.mobile_image.width|default(926) %}
{% set aspect_height = i.mobile_image.height|default(870) %}
{% set aspect_ratio = aspect_width ~ '/' ~ aspect_height %}
{# Hidden img for SEO and accessibility - 1x1 transparent pixel #}
{% endif %}
{# Preload hints inside module for better encapsulation #}
{% if not a.lazy_load_mobile %}
{% if mobile_img_url %}
{# Preload the exact 350px image we're using for mobile #}
{% endif %}
{# Desktop preload only for larger screens - browser respects media query #}
{% if desktop_bg_url %}
{% set desktop_preload = resize_image_url(desktop_bg_url, 1920) %}
{% endif %}
{% endif %}
{# Critical inline CSS for performance #}
{% require_css %}
{% end_require_css %}