{% liquid assign media_type = section.settings.media_type | default: 'video' if section.settings.cover_desktop != blank assign cover_desktop = section.settings.cover_desktop | image_url: width: 2400 else assign cover_desktop = 'mascara-video.avif' | asset_url endif if section.settings.cover_mobile != blank assign cover_mobile = section.settings.cover_mobile | image_url: width: 1200 else assign cover_mobile = 'mascara-vido-mobile.avif' | asset_url endif comment Video hero: use the video's own first frame as the cover (LCP image). It is tiny (AVIF ~20 KB desktop / ~8 KB mobile) and identical to frame 0, so the switch to video is seamless. endcomment assign cover_w = 1920 assign cover_h = 650 if media_type == 'video' and section.settings.poster_from_video comment Shopify's video preview image is frame 0 of the video, served as AVIF/WebP by the CDN. endcomment if section.settings.video.preview_image assign cover_desktop = section.settings.video.preview_image | image_url: width: 1280 assign cover_w = section.settings.video.preview_image.width | at_most: 1280 assign cover_h = section.settings.video.preview_image.height | times: cover_w | divided_by: section.settings.video.preview_image.width else assign cover_desktop = 'hero-frame-desktop.avif' | asset_url assign cover_w = 1280 assign cover_h = 720 endif if section.settings.video_mobile.preview_image assign cover_mobile = section.settings.video_mobile.preview_image | image_url: width: 720 elsif section.settings.use_light_mobile_video assign cover_mobile = 'hero-frame-mobile.avif' | asset_url elsif section.settings.video.preview_image assign cover_mobile = section.settings.video.preview_image | image_url: width: 900 else assign cover_mobile = cover_desktop endif endif assign video_src = blank assign video_src_mobile = blank if media_type == 'video' if section.settings.video != blank comment Desktop: the largest MP4 up to 1080p. Mobile: the smallest MP4 that is at least 480p. endcomment assign best_h = 0 assign mobile_h = 99999 for source in section.settings.video.sources if source.mime_type == 'video/mp4' or source.format == 'mp4' assign h = source.height | default: 0 if h <= 1080 and h >= best_h assign best_h = h assign video_src = source.url endif if h >= 480 and h < mobile_h assign mobile_h = h assign video_src_mobile = source.url endif endif endfor endif if video_src == blank assign video_src = 'home-video-op.mp4' | asset_url endif comment Mobile: a dedicated vertical, light video (setting) or the theme's hero-mobile.mp4 (~450 KB, cropped 516x720). endcomment if section.settings.video_mobile != blank assign mobile_h = 99999 for source in section.settings.video_mobile.sources if source.mime_type == 'video/mp4' or source.format == 'mp4' assign h = source.height | default: 0 if h >= 480 and h < mobile_h assign mobile_h = h assign video_src_mobile = source.url endif endif endfor elsif section.settings.use_light_mobile_video assign video_src_mobile = 'hero-mobile.mp4' | asset_url endif comment Theme-hosted optimized videos (no Shopify re-encoding: ~1 MB desktop / ~0.4 MB mobile) plus their first frames as the cover. These files must match the videos picked above. endcomment if section.settings.theme_hosted_videos assign video_src = 'seasons-hero-desktop.mp4' | asset_url assign video_src_mobile = 'seasons-hero-mobile.mp4' | asset_url if section.settings.poster_from_video assign cover_desktop = 'hero-frame-desktop.avif' | asset_url assign cover_mobile = 'hero-frame-mobile.avif' | asset_url assign cover_w = 1280 assign cover_h = 720 endif endif endif if section.settings.social_label != blank assign social_label = section.settings.social_label else assign social_label = 'hero.follow' | t endif if section.settings.featured_label != blank assign featured_label = section.settings.featured_label else assign featured_label = 'hero.featured_label' | t endif assign fallback_product = blank for catalog_product in collections.all.products if catalog_product.available assign fallback_product = catalog_product break endif endfor assign show_products = false if section.blocks.size > 0 if fallback_product != blank or request.design_mode assign show_products = true endif endif for block in section.blocks if block.settings.product != blank assign show_products = true endif endfor assign line_1_weight = section.settings.heading_line_1_weight | default: 'light' assign line_2_weight = section.settings.heading_line_2_weight | default: 'medium' assign line_3_weight = section.settings.heading_line_3_weight | default: 'light' %}
{% if section.settings.heading_line_1 != blank or section.settings.heading_line_2 != blank or section.settings.heading_line_3 != blank %}

{% if section.settings.heading_line_1 != blank %} {{ section.settings.heading_line_1 | escape }} {% endif %} {% if section.settings.heading_line_2 != blank %} {{ section.settings.heading_line_2 | escape }} {% endif %} {% if section.settings.heading_line_3 != blank %} {{ section.settings.heading_line_3 | escape }} {% endif %}

{% endif %} {% if show_products %}

{{ featured_label | escape }}

{% for block in section.blocks %} {% liquid assign featured_product = block.settings.product if featured_product != blank unless featured_product.available assign featured_product = blank endunless endif if featured_product == blank and forloop.first assign featured_product = fallback_product endif %} {% if featured_product != blank %}
{% render 'hero-product', product: featured_product %}
{% elsif request.design_mode %}

{{ 'hero.select_product' | t }}

{% endif %} {% endfor %}
{% endif %}
{% javascript %} (() => { if (window.__seasonHero) return; window.__seasonHero = true; const reduceMotion = window.matchMedia('(prefers-reduced-motion: reduce)').matches; const setCartCount = (count) => { const link = document.querySelector('.header__cart'); if (!link || count < 1) return; let badge = link.querySelector('[data-cart-count]'); if (!badge) { badge = document.createElement('span'); badge.className = 'absolute right-0 top-0 flex h-4 min-w-4 items-center justify-center rounded-full bg-brand-mint px-[3px] text-[10px] font-medium leading-none text-black'; badge.setAttribute('data-cart-count', ''); link.appendChild(badge); } badge.textContent = String(count); }; document.querySelectorAll('[data-hero]').forEach((hero) => { const video = hero.querySelector('[data-hero-video]'); if (!video || reduceMotion) return; const markPlaying = () => hero.classList.add('is-playing'); video.addEventListener('playing', markPlaying); // Playback timing (3 s hold on the first-frame cover) is handled by the inline hero script. }); document.addEventListener('submit', async (event) => { if (event.defaultPrevented) return; const form = event.target; if (!(form instanceof HTMLFormElement) || !form.classList.contains('hero__form')) return; const hero = form.closest('[data-hero]'); if (!hero) return; event.preventDefault(); const button = form.querySelector('[type="submit"]'); const variantId = form.querySelector('[name="id"]')?.value; if (!button || button.disabled || !variantId) return; button.disabled = true; try { const addResponse = await fetch(hero.dataset.cartAddUrl, { method: 'POST', headers: { 'Content-Type': 'application/json', Accept: 'application/json', }, body: JSON.stringify({ id: variantId, quantity: 1 }), }); if (!addResponse.ok) return; const cartResponse = await fetch(hero.dataset.cartUrl, { headers: { Accept: 'application/json' }, }); const cart = await cartResponse.json(); if (typeof cart.item_count === 'number') setCartCount(cart.item_count); document.dispatchEvent(new CustomEvent('season:cart:open')); button.classList.add('is-added'); window.setTimeout(() => button.classList.remove('is-added'), 1200); } catch (error) { form.submit(); } finally { button.disabled = false; } }); })(); {% endjavascript %} {% schema %} { "name": "t:hero.name", "tag": "section", "class": "hero-section", "max_blocks": 2, "disabled_on": { "groups": [ "header", "footer" ] }, "settings": [ { "type": "header", "content": "t:hero.heading" }, { "type": "text", "id": "heading_line_1", "label": "t:hero.line_1", "default": "descubre" }, { "type": "select", "id": "heading_line_1_weight", "label": "t:hero.line_1_weight", "default": "light", "options": [ { "value": "light", "label": "t:hero.weight_light" }, { "value": "medium", "label": "t:hero.weight_medium" } ] }, { "type": "text", "id": "heading_line_2", "label": "t:hero.line_2", "default": "lo que tu piel" }, { "type": "select", "id": "heading_line_2_weight", "label": "t:hero.line_2_weight", "default": "medium", "options": [ { "value": "light", "label": "t:hero.weight_light" }, { "value": "medium", "label": "t:hero.weight_medium" } ] }, { "type": "text", "id": "heading_line_3", "label": "t:hero.line_3", "default": "disfrutará" }, { "type": "select", "id": "heading_line_3_weight", "label": "t:hero.line_3_weight", "default": "light", "options": [ { "value": "light", "label": "t:hero.weight_light" }, { "value": "medium", "label": "t:hero.weight_medium" } ] }, { "type": "text", "id": "featured_label", "label": "t:hero.featured_label", "default": "Producto destacado" }, { "type": "header", "content": "t:hero.media" }, { "type": "select", "id": "media_type", "label": "t:hero.media_type", "default": "video", "options": [ { "value": "video", "label": "t:hero.media_video" }, { "value": "image", "label": "t:hero.media_image" } ] }, { "type": "video", "id": "video", "label": "t:hero.video", "info": "t:hero.video_info", "visible_if": "{{ section.settings.media_type == 'video' }}" }, { "type": "video", "id": "video_mobile", "label": "Video móvil (vertical, ligero)", "info": "Opcional. Recomendado: vertical, sin audio, menos de 1 MB.", "visible_if": "{{ section.settings.media_type == 'video' }}" }, { "type": "checkbox", "id": "use_light_mobile_video", "label": "Usar versión ligera incluida en el tema para móvil", "info": "Recorte vertical del video actual (~450 KB). Desactívalo si cambias el video principal y no subes uno móvil.", "default": true, "visible_if": "{{ section.settings.media_type == 'video' }}" }, { "type": "checkbox", "id": "poster_from_video", "label": "Portada = primer cuadro del video", "info": "Muestra el primer cuadro del video (imagen ligera precargada) 3 s antes de reproducir. Desactívalo para usar las portadas de abajo.", "default": true, "visible_if": "{{ section.settings.media_type == 'video' }}" }, { "type": "checkbox", "id": "theme_hosted_videos", "label": "Usar videos optimizados del tema", "info": "Sirve seasons-hero-desktop.mp4 (~1 MB) y seasons-hero-mobile.mp4 (~0.4 MB) desde el tema, sin la recompresión de Shopify (que los vuelve ~2 MB). Si cambias los videos, actualiza esos archivos o desactiva esta opción.", "default": true, "visible_if": "{{ section.settings.media_type == 'video' }}" }, { "type": "image_picker", "id": "cover_desktop", "label": "t:hero.cover_desktop", "info": "t:hero.cover_info" }, { "type": "image_picker", "id": "cover_mobile", "label": "t:hero.cover_mobile" }, { "type": "header", "content": "t:hero.social" }, { "type": "text", "id": "social_label", "label": "t:hero.social_label", "default": "Síguenos" }, { "type": "url", "id": "instagram_url", "label": "t:hero.instagram" }, { "type": "url", "id": "facebook_url", "label": "t:hero.facebook" }, { "type": "url", "id": "linkedin_url", "label": "t:hero.linkedin" } ], "blocks": [ { "type": "featured_product", "name": "t:hero.featured_product", "limit": 2, "settings": [ { "type": "product", "id": "product", "label": "t:hero.product" } ] } ], "presets": [ { "name": "t:hero.name", "blocks": [ { "type": "featured_product" } ] } ] } {% endschema %}