diff --git a/assets/media/hero-desktop.mp4 b/assets/media/hero-desktop.mp4 new file mode 100644 index 0000000..2a8a7a5 Binary files /dev/null and b/assets/media/hero-desktop.mp4 differ diff --git a/assets/media/hero-loop.mp4 b/assets/media/hero-mobile.mp4 similarity index 100% rename from assets/media/hero-loop.mp4 rename to assets/media/hero-mobile.mp4 diff --git a/index.html b/index.html index 608731b..5ee3619 100644 --- a/index.html +++ b/index.html @@ -91,7 +91,7 @@ @@ -374,11 +374,11 @@ Cal("init", { origin: "https://cal.shopwisdom.ca" }); var conn = navigator.connection || {}; if (conn.saveData === true) return; if (window.matchMedia('(prefers-reduced-motion: reduce)').matches) return; - var webm = hv.getAttribute('data-src'), mp4 = hv.getAttribute('data-src-mp4'); - if (!webm && !mp4) return; - function addSrc(u, t) { if (!u) return; var s = document.createElement('source'); s.src = u; s.type = t; hv.appendChild(s); } - addSrc(webm, 'video/webm'); // modern browsers pick this (smaller VP9) - addSrc(mp4, 'video/mp4'); // old Safari / iOS fall back to H.264 + // viewport picks the loop: flowing waves on desktop, dotted-particle (C) rotated on mobile + var isMobile = window.matchMedia('(max-width: 760px)').matches; + var mp4 = hv.getAttribute(isMobile ? 'data-src-mobile' : 'data-src-desktop'); + if (!mp4) return; + var s = document.createElement('source'); s.src = mp4; s.type = 'video/mp4'; hv.appendChild(s); hv.load(); hv.addEventListener('playing', function () { hv.classList.add('is-playing'); }, { once: true }); var p = hv.play(); if (p && p.catch) p.catch(function () {}); diff --git a/style.css b/style.css index f250b73..c478e5d 100644 --- a/style.css +++ b/style.css @@ -138,7 +138,7 @@ a.tel { text-decoration: none; } position: absolute; top: 0; right: 0; bottom: 0; width: 56%; z-index: 1; pointer-events: none; background: var(--paper); } -.hero-media::after { content: ""; position: absolute; inset: 0; background: var(--paper); opacity: .2; pointer-events: none; } +.hero-media::after { content: ""; position: absolute; inset: 0; pointer-events: none; background: linear-gradient(to right, var(--paper) 0%, rgba(247,244,239,0) 30%); } .hero-video { width: 100%; height: 100%; object-fit: cover; display: block; opacity: 0; transition: opacity 1s ease; } .hero-video.is-playing { opacity: .5; } @media (max-width: 760px) { @@ -147,6 +147,7 @@ a.tel { text-decoration: none; } faded from the top so the headline reads over paper and the ambient shows lower. Tint ::after still applies. */ .hero-media { left: 0; width: 100%; -webkit-mask-image: linear-gradient(to bottom, transparent 0, #000 18%); mask-image: linear-gradient(to bottom, transparent 0, #000 18%); } + .hero-media::after { background: rgba(247,244,239,.2); } /* flat lightening wash on mobile (no desktop left-fade) */ .hero-video { position: absolute; top: 50%; left: 50%; width: 100vh; height: 100vw; object-fit: cover; object-position: 50% 50%; transform: translate(-50%, -50%) rotate(90deg); mix-blend-mode: normal; } .hero-video.is-playing { opacity: .5; } }