:root { color-scheme: light; background: #fff; }
* { box-sizing: border-box; }
html, body { width: 100%; height: 100%; margin: 0; overflow: hidden; overscroll-behavior: none; }
body { -webkit-user-select: none; user-select: none; -webkit-touch-callout: none; }
#canvas { position: fixed; inset: 0; overflow: hidden; touch-action: none; background: #fff; cursor: grab; outline: none; }
#canvas.is-panning { cursor: grabbing; }
#world { position: absolute; inset: 0; transform-origin: 0 0; will-change: transform; pointer-events: none; }
.work {
  position: absolute; top: 0; left: 0; margin: 0; padding: 0;
  transform-origin: 0 0; overflow: hidden; cursor: grab;
  border: 0; border-radius: 0; outline: none; touch-action: none;
  -webkit-tap-highlight-color: transparent; will-change: transform;
  contain: layout paint; isolation: isolate; pointer-events: auto;
}
.work:focus-visible { outline: 1px solid #333; outline-offset: 5px; }
.work.is-held { cursor: grabbing; }
.work > canvas, .work > video, .work > img { display: block; width: 100%; height: 100%; object-fit: cover; pointer-events: none; }
.work > video { object-fit: contain; }
.work.has-company { --work-caption-height: 23px; }
.work.has-company > video { height: calc(100% - var(--work-caption-height)); }
.company-name { display: block; padding: 6px 0 0; color: #141414; font: 400 14px/1.2 Arial, Helvetica, sans-serif; letter-spacing: .055em; text-align: center; pointer-events: none; }
.work > .company-name { font-size: clamp(9px, 3vw, 12px); }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }

/* Desktop: three moving panels on a softly curved visual field. */
#canvas.carousel { cursor: default; touch-action: pan-y; }
.carousel::after {
  content: ''; position: absolute; inset: 0; pointer-events: none; z-index: 5;
  background: linear-gradient(90deg, rgba(35,40,45,.075), rgba(35,40,45,.018) 18%, transparent 34%, transparent 66%, rgba(35,40,45,.018) 82%, rgba(35,40,45,.075));
}
.carousel-card {
  position: absolute; left: 50%; top: 50%; margin: 0; padding: 0;
  width: min(34vw, calc(68vh * var(--ratio)));
  border: 0; border-radius: 0; background: transparent; overflow: hidden;
  transform: translate(-50%, -50%); cursor: pointer;
  transition: transform 650ms cubic-bezier(.22,.68,.22,1);
}
.carousel-card[hidden] { display: none; }
.carousel-card .video-preview { transition: filter 650ms, opacity 650ms; }
.carousel-card[data-position="left"] .video-preview, .carousel-card[data-position="right"] .video-preview { filter: blur(4.5px); opacity: .8; }
.carousel-card .company-name { padding-top: 9px; }
.carousel-card[data-position="centre"] { z-index: 3; }
.carousel-card[data-position="left"] { transform: translate(calc(-50% - 37vw), -50%) scale(.78); z-index: 1; }
.carousel-card[data-position="right"] { transform: translate(calc(-50% + 37vw), -50%) scale(.78); z-index: 1; }
.carousel-arrow { position: absolute; top: 50%; transform: translateY(-50%); z-index: 6; width: 48px; height: 48px; border: 0; padding: 10px; background: transparent; color: #454545; cursor: pointer; }
.carousel-arrow.previous { left: 27%; }
.carousel-arrow.next { right: 27%; }
.carousel-arrow svg { width: 100%; height: 100%; fill: none; stroke: currentColor; stroke-width: 1.2; }
.carousel-arrow:hover { color: #000; }
.carousel-arrow:focus-visible, .carousel-card:focus-visible { outline: 1px solid #666; outline-offset: 8px; }
@media (prefers-reduced-motion: reduce) { .carousel-card, .carousel-card .video-preview { transition: none; } }

/* Mobile uses the page's native vertical scroll. */
html.has-feed, .has-feed body { height: auto; min-height: 100%; overflow: visible; overscroll-behavior: auto; touch-action: pan-y; }
#canvas.feed {
  position: static; overflow: visible; touch-action: pan-y; cursor: auto;
  width: min(calc(100% - 32px), 480px); margin: 0 auto;
  padding: max(16px, env(safe-area-inset-top)) 0 max(32px, env(safe-area-inset-bottom));
}
.feed-item { margin: 0 0 36px; }
.feed-item:last-child { margin-bottom: 0; }
.feed-item > .video-preview {
  width: min(100%, calc((100svh - 48px) * var(--feed-aspect-ratio)));
  margin-inline: auto;
}
.feed-item .company-name { padding-top: 8px; }

.video-preview { display: block; position: relative; width: 100%; pointer-events: none; }
.video-preview > img, .video-preview > video {
  display: block; position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain;
}
.video-preview > video { opacity: 0; }
.video-preview.has-video-frame > video { opacity: 1; }
