feat(site): focus Mission Core story and center product carousels

This commit is contained in:
DCCONSTRUCTIONS
2026-11-05 20:25:24 +03:00
parent d22c738cc4
commit 5ef2e41d9e
55 changed files with 2284 additions and 3961 deletions
+33
View File
@@ -0,0 +1,33 @@
/* Public-site carousel contract. No translated copies or per-block offsets. */
[data-carousel]{width:100%;min-width:0;position:relative;}
[data-carousel-track]{position:relative;display:flex;gap:24px;align-items:flex-start;justify-content:flex-start;overflow-x:auto;overflow-y:hidden;width:100%;padding:0 max(16px,calc((100% - var(--carousel-item-width))/2)) 12px;box-sizing:border-box;scroll-snap-type:x mandatory;scrollbar-width:none;overscroll-behavior-x:contain;touch-action:pan-x pan-y;}
[data-carousel-track]::-webkit-scrollbar{display:none;}
[data-carousel-track][data-fits="true"]{justify-content:center;padding-inline:16px;}
[data-carousel-track].is-dragging{scroll-snap-type:none;cursor:grabbing;user-select:none;}
.mission-carousel{--carousel-item-width:min(86vw,1280px);}
.mission-carousel.photo-gallery,.mission-carousel.scenario-gallery{--carousel-item-width:min(82vw,560px);}
.mission-carousel .carousel-slide{flex:0 0 var(--carousel-item-width);min-width:0;position:relative;scroll-snap-align:center;scroll-snap-stop:always;transform:none;}
.carousel-media{width:100%;aspect-ratio:16/10;border-radius:22px;overflow:hidden;background:#111;}
.photo-gallery .carousel-media{aspect-ratio:4/3;}
.scenario-gallery .carousel-media{aspect-ratio:3/2;}
.carousel-media img,.carousel-media video{display:block;width:100%;height:100%;object-fit:contain;}
.scenario-gallery .carousel-media img{object-fit:cover;}
.carousel-media a{display:block;width:100%;height:100%;}
.carousel-caption{padding:18px 4px 0;max-width:800px;}
.carousel-caption h3{font-size:clamp(18px,1.7vw,26px);line-height:1.2;font-weight:500;margin:0 0 9px;}
.carousel-caption p{font-size:clamp(15px,1.1vw,18px);line-height:1.45;color:#a7a7a7;margin:0;max-width:64ch;}
.carousel-controls{display:flex;justify-content:center;align-items:center;gap:18px;margin:22px auto 0;}
.carousel-controls[hidden]{display:none;}
.carousel-controls button{width:44px;height:44px;border:0;border-radius:50%;background:#242426;color:#eee;font-size:22px;cursor:pointer;}
.carousel-controls button:disabled{opacity:.3;cursor:default;}
.carousel-controls button:focus-visible,[data-carousel]:focus-visible{outline:2px solid #eee;outline-offset:4px;}
.carousel-count{font-size:13px;color:#aaa;min-width:52px;text-align:center;font-variant-numeric:tabular-nums;}
.mission-carousel .project-video-detail-copy-top{margin-bottom:40px;}
.mission-carousel{padding-block:72px;background:linear-gradient(#000,#101113);}
.mission-carousel .carousel-note{max-width:720px;margin:24px auto 0;padding-inline:20px;text-align:center;color:#777;font-size:12px;line-height:1.4;}
.infrastructure-modules{display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:30px;width:min(86%,1280px);margin:40px auto 0;}
.infrastructure-module h3{font-size:24px;margin-bottom:12px;}
.infrastructure-module p{color:#999;line-height:1.5;}
@media(max-width:767px){.mission-carousel{padding-block:40px;}.carousel-media{border-radius:14px;}[data-carousel-track]{gap:16px;}.infrastructure-modules{grid-template-columns:1fr;gap:22px;}.mission-carousel .project-video-detail-copy-top{margin-bottom:24px;}}
@media(max-width:600px){.project-video-detail.mission-carousel .project-video-detail-hgroup,.project-video-detail.mission-carousel .project-video-detail-hgroup.flip{display:flex;flex-direction:column;align-items:stretch;gap:1.2rem}.project-video-detail.mission-carousel .project-video-detail-hgroup>*{width:100%;max-width:none}.project-video-detail.mission-carousel .project-video-detail-hgroup .main-h{order:0}.project-video-detail.mission-carousel .project-video-detail-hgroup .h-txt{order:1;width:100%;max-width:none}.project-video-detail.mission-carousel .project-video-detail-copy{width:86%}}
+79
View File
@@ -0,0 +1,79 @@
/* Shared finite carousel: fitting groups and every overflow item center exactly. */
(() => {
const reduced = matchMedia('(prefers-reduced-motion: reduce)');
function bind(root) {
if (root.dataset.carouselReady) return;
root.dataset.carouselReady = 'true';
const track = root.querySelector('[data-carousel-track]');
const items = [...track.children];
const prev = root.querySelector('[data-carousel-prev]');
const next = root.querySelector('[data-carousel-next]');
const count = root.querySelector('[data-carousel-count]');
let active = 0, fits = false, settle, dragging = null;
const center = item => item.offsetLeft + item.offsetWidth / 2 - track.clientWidth / 2;
function state() {
prev.disabled = fits || active === 0;
next.disabled = fits || active === items.length - 1;
count.textContent = fits ? `${items.length} / ${items.length}` : `${active + 1} / ${items.length}`;
root.querySelector('[data-carousel-controls]').hidden = items.length < 2;
items.forEach((item, i) => {
item.classList.toggle('current', i === active);
if (i !== active && !fits) item.querySelectorAll('video').forEach(v => v.pause());
});
}
function go(index, smooth = true) {
active = Math.max(0, Math.min(items.length - 1, index));
track.scrollTo({left: fits ? 0 : center(items[active]), behavior: smooth && !reduced.matches ? 'smooth' : 'instant'});
state();
}
function layout() {
const available = root.clientWidth;
const gap = parseFloat(getComputedStyle(track).columnGap) || 0;
const width = items.reduce((sum, item) => sum + item.offsetWidth, 0) + gap * Math.max(0, items.length - 1);
fits = width <= available - 32;
track.dataset.fits = String(fits);
go(active, false);
}
if (!items.length) { root.hidden = true; return; }
prev.addEventListener('click', () => go(active - 1));
next.addEventListener('click', () => go(active + 1));
root.addEventListener('keydown', event => {
if (event.target.matches('input,textarea,select,video')) return;
const target = {ArrowLeft:active-1, ArrowRight:active+1, Home:0, End:items.length-1}[event.key];
if (target !== undefined) { event.preventDefault(); go(target); }
});
track.addEventListener('scroll', () => {
clearTimeout(settle);
settle = setTimeout(() => {
if (fits || dragging) return;
active = items.reduce((best, item, i) => Math.abs(center(item)-track.scrollLeft) < Math.abs(center(items[best])-track.scrollLeft) ? i : best, 0);
state();
}, 100);
}, {passive:true});
// Touch uses native horizontal scrolling; vertical gestures continue down the page.
track.addEventListener('pointerdown', event => {
if (event.pointerType !== 'mouse' || fits || event.target.closest('video,button')) return;
dragging = {x:event.clientX, left:track.scrollLeft, moved:false};
});
window.addEventListener('pointermove', event => {
if (!dragging) return;
const dx = event.clientX-dragging.x;
if (Math.abs(dx)>5) {dragging.moved=true;track.classList.add('is-dragging');track.scrollLeft=dragging.left-dx;}
});
window.addEventListener('pointerup', () => {
if (!dragging) return;
const moved=dragging.moved;dragging=null;track.classList.remove('is-dragging');
if (moved) {active=items.reduce((best,item,i)=>Math.abs(center(item)-track.scrollLeft)<Math.abs(center(items[best])-track.scrollLeft)?i:best,0);go(active);track.dataset.dragged='true';setTimeout(()=>delete track.dataset.dragged,0);}
});
track.addEventListener('click', event => {if(track.dataset.dragged){event.preventDefault();event.stopPropagation();}},true);
track.addEventListener('dragstart', event => event.preventDefault());
// Prevent legacy page smooth-scroll from converting horizontal trackpad input.
track.addEventListener('wheel', event => { if(Math.abs(event.deltaX)>Math.abs(event.deltaY)) event.stopPropagation(); },{passive:true});
track.querySelectorAll('img,video').forEach(media=>media.addEventListener(media.tagName==='IMG'?'load':'loadedmetadata',layout));
new ResizeObserver(layout).observe(root);
const observer=new IntersectionObserver(entries=>entries.forEach(entry=>{if(!entry.isIntersecting)root.querySelectorAll('video').forEach(v=>v.pause());}));observer.observe(root);
layout();
}
function init(){document.querySelectorAll('[data-carousel]').forEach(bind);}
if(document.readyState==='loading')document.addEventListener('DOMContentLoaded',init);else init();
})();