Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion site/build.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -583,10 +583,16 @@ ${topbar(lang, 'home', pagePath, other(lang, page))}
<div class="hero-actions"><button class="home-download" type="button" data-download-open aria-controls="download-panel" aria-expanded="false">${svg(IC.download, 18)}${t.ctaDownload}</button></div>
${downloadPanel(lang)}
<figure class="hero-shot">
<video src="${r('media/ScienceDiscovery.mp4')}" autoplay muted loop playsinline preload="auto" aria-label="${esc(t.videoLabel)}"></video>
<video class="hero-video" src="${r('media/ScienceDiscovery.mp4')}" autoplay muted loop playsinline preload="auto" aria-label="${esc(t.videoLabel)}"></video>
</figure>
</div>
</section>
<dialog class="video-dialog" id="demo-video">
<div class="video-dialog-inner">
<button class="video-close" type="button" data-close aria-label="${esc(t.close)}">✕</button>
<video class="video-dialog-video" src="${r('media/ScienceDiscovery.mp4')}" controls playsinline preload="metadata" aria-label="${esc(t.videoLabel)}"></video>
</div>
</dialog>
${t.feats.map(feature).join('\n')}
<section class="home-cta">
<h2>${esc(t.bandTitle)}</h2>
Expand Down
Binary file modified site/src/media/ScienceDiscovery.mp4
Binary file not shown.
21 changes: 18 additions & 3 deletions site/src/site.css
Original file line number Diff line number Diff line change
Expand Up @@ -249,14 +249,28 @@ body.home { background: var(--page); }
}
:root[data-theme="dark"] .home-download:hover { background: linear-gradient(180deg, #5aa2ff 0%, #2a78ff 100%); }

/* The recording is the hero's second half and plays on load: no poster, no dialog. It is muted and
looping so the browser's autoplay policy allows it to start without a gesture. */
/* The recording is the hero's second half and plays muted on load so the browser's autoplay policy
lets it start without a gesture. Clicking it opens a dialog with the same video, native controls
and sound. */
.hero-shot {
display: block; width: min(1200px, 62.5vw); margin: clamp(26px, 2.6vw, 50px) auto 0;
border-radius: 14px; background: #0b0b0c; overflow: hidden; box-shadow: var(--shot-shadow);
border-radius: 14px; background: #0b0b0c; overflow: hidden; box-shadow: var(--shot-shadow); cursor: pointer;
}
.hero-shot video { display: block; width: 100%; height: auto; background: #0b0b0c; }

/* ---- video dialog ---- */
.video-dialog { border: 0; padding: 0; background: transparent; width: min(1200px, 92vw); max-width: none; }
.video-dialog::backdrop { background: rgba(4, 6, 12, .72); backdrop-filter: blur(2px); -webkit-backdrop-filter: blur(2px); }
.video-dialog-inner { position: relative; }
.video-close {
position: absolute; top: -16px; right: -16px; z-index: 2;
width: 34px; height: 34px; border: 0; border-radius: 50%;
background: #fff; color: #111; font-size: 15px; line-height: 1; cursor: pointer;
box-shadow: 0 2px 12px rgba(0,0,0,.45);
}
.video-close:hover { background: #f1f5f9; }
.video-dialog-video { display: block; width: 100%; height: auto; border-radius: 12px; background: #000; }

/* ---------- feature rows ---------- */
.home-feature {
display: grid; grid-template-columns: 560fr 890fr; column-gap: clamp(40px, 7.8vw, 150px);
Expand Down Expand Up @@ -370,6 +384,7 @@ body.home { background: var(--page); }
.home-hero { margin-top: -56px; padding-top: calc(56px + 28px); }
.hero-wordmark { letter-spacing: 0; }
.hero-shot { border-radius: 10px; }
.video-close { top: -12px; right: -12px; width: 30px; height: 30px; }
.home-feature { padding: 40px 0; }
.feature-figure img { border-radius: 14px; }
.cta-actions { flex-direction: column; align-items: center; }
Expand Down
20 changes: 20 additions & 0 deletions site/src/site.js
Original file line number Diff line number Diff line change
Expand Up @@ -157,6 +157,26 @@
}
}

/* ---------------- video ---------------- */
var heroVideo = $('.hero-video');
var videoDialog = $('#demo-video');
var demoVideo = videoDialog ? $('video', videoDialog) : null;
if (videoDialog) {
var openVideo = function () {
videoDialog.showModal();
if (demoVideo) { try { demoVideo.currentTime = 0; } catch (e) { /* not loaded yet */ } demoVideo.play().catch(function () { /* autoplay refused; native controls still work */ }); }
if (heroVideo) heroVideo.pause();
};
if (heroVideo) heroVideo.addEventListener('click', openVideo);
var closer = $('[data-close]', videoDialog);
if (closer) closer.addEventListener('click', function () { videoDialog.close(); });
videoDialog.addEventListener('click', function (e) { if (e.target === videoDialog) videoDialog.close(); });
videoDialog.addEventListener('close', function () {
if (demoVideo) demoVideo.pause();
if (heroVideo) heroVideo.play().catch(function () {});
});
}

/* ---------------- structure viewer ---------------- */
// The 3D view is a real Mol* viewer, not a picture. The bundle is ~5 MB and the structure file
// another 300 KB, so both are fetched the first time a reader opens one and never on page load.
Expand Down
Loading