/* Homepage and the noindex lab demo. Effects are scoped to .home. */

.home {
  --hero-inset: max(24px, calc((100vw - min(var(--shell), calc(100vw - 48px))) / 2));
}

/* Spotlight follows the pointer via --mx/--my. Opacity is the only animated property. */
.home [data-spotlight] { --mx: 50%; --my: 42%; }
.home [data-spotlight]::before,
.home [data-spotlight]::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.25s ease;
}
.home [data-spotlight]::before {
  z-index: 2;
  background: radial-gradient(460px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.42), transparent 42%);
}
.home [data-spotlight].light::before {
  background: radial-gradient(420px circle at var(--mx) var(--my), rgba(60, 108, 255, 0.28), transparent 46%);
}
.home [data-spotlight]::after {
  z-index: 4;
  padding: 1.5px;
  background: radial-gradient(380px circle at var(--mx) var(--my), rgba(255, 255, 255, 0.95), transparent 36%);
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0);
  mask-composite: exclude;
}
@media (hover: hover) and (pointer: fine) {
  .home [data-spotlight]:hover::before,
  .home [data-spotlight]:hover::after,
  .home [data-spotlight]:focus-visible::before,
  .home [data-spotlight]:focus-visible::after { opacity: 1; }
}

/* Tilt is applied in motion.js as a transform on [data-cutout] only. */
.home [data-cutout] { transform: translateZ(0); }
.home .reveal.is-in .feature-grid > [data-cutout] { transition: none; }
.home [data-cutout] .media { transform: translateZ(0); }
@media (hover: hover) and (pointer: fine) {
  .home [data-cutout]:hover .media img { transform: scale(1.04); }
  .home [data-cutout] .media img { transition: transform 0.45s ease; }
}

@media (hover: hover) and (pointer: fine) {
  .home [data-magnet] { will-change: transform; }
}

/* Curved gallery. Static swipe row, upgraded to a 3D arc on a fine pointer. */
.motion-hero-stack { position: relative; }
.motion-demo .arch-band { margin-top: -120px; }
.arch-band {
  position: relative;
  z-index: 3;
  margin-top: 0;
  background: #0b1020;
  color: #fff;
  padding: 0 0 22px;
}
.arch-kicker {
  position: absolute;
  top: 12px;
  left: 0;
  right: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  align-items: baseline;
  width: min(var(--shell), calc(100% - 48px));
  margin: 0 auto;
  color: rgba(255, 255, 255, 0.78);
  font-size: 13px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-shadow: 0 1px 10px rgba(0, 0, 0, 0.55);
}
html[lang="zh-CN"] .arch-kicker { letter-spacing: 0.14em; text-transform: none; font-size: 14px; }
.arch-kicker a { color: #fff; text-decoration: none; letter-spacing: 0; text-transform: none; font-size: 14px; }
.arch-clip { height: 268px; overflow: hidden; }
.arch-stage { height: 100%; overflow: visible; }
.arch-track {
  display: flex;
  gap: 12px;
  height: 100%;
  overflow-x: auto;
  scroll-snap-type: x mandatory;
  padding: 0 20px 8px;
  scrollbar-width: none;
}
.arch-track::-webkit-scrollbar { display: none; }
.arch-panel {
  position: relative;
  flex: 0 0 min(78vw, 240px);
  height: 100%;
  scroll-snap-align: center;
  border-radius: 16px;
  overflow: hidden;
  background: #16181f;
  color: #fff;
  text-decoration: none;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.28);
}
.arch-panel img { width: 100%; height: 100%; object-fit: cover; }
.arch-panel.is-cutout { background: #f3f3f5; }
.arch-panel.is-cutout img { object-fit: contain; padding: 14%; }
.arch-panel span {
  position: absolute;
  left: 12px;
  right: 12px;
  bottom: 12px;
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.45);
}
.arch-panel.is-cutout span { color: #1d1d1f; text-shadow: none; }

/* Upgraded only after motion.js confirms a fine pointer and no reduced motion. */
.arch-stage.is-ready { perspective: 980px; perspective-origin: 50% 42%; transform-style: preserve-3d; }
.arch-stage.is-ready .arch-track {
  display: block;
  overflow: visible;
  position: relative;
  height: 100%;
  padding: 0;
  transform-style: preserve-3d;
}
.arch-stage.is-ready .arch-panel {
  --panel-w: 220px;
  position: absolute;
  left: 50%;
  top: 8px;
  flex: none;
  width: var(--panel-w);
  height: 246px;
  margin-left: calc(var(--panel-w) / -2);
  scroll-snap-align: none;
}

html.is-arch-hero .arch-band {
  margin-top: 0;
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: calc(100% - (var(--hero-inset) + 44rem));
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  padding: 72px 0 28px;
  background: transparent;
}
html.is-arch-hero .hero-picture { opacity: 0; }
html.is-arch-hero .arch-clip { flex: 1; height: auto; min-height: 0; }
html.is-arch-hero .arch-stage { height: 100%; }
html.is-arch-hero .arch-kicker { top: auto; bottom: 16px; width: calc(100% - 36px); text-shadow: none; }
html.is-arch-hero .arch-stage.is-ready .arch-panel {
  --panel-w: min(250px, 46%);
  height: min(340px, 52%);
  top: 12%;
}

/* Category marquee. The track is two copies; the animation moves -50%. */
.loop-band { padding: 8px 0 36px; background: #fff; }
.loop-viewport {
  overflow: hidden;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
  mask-image: linear-gradient(90deg, transparent, #000 7%, #000 93%, transparent);
}
.loop-track { display: flex; width: max-content; }
.loop-band.is-on .loop-track { animation: loop-marquee 42s linear infinite; }
.loop-viewport:hover .loop-track { animation-play-state: paused; }
.loop-set { display: flex; gap: 42px; list-style: none; margin: 0; padding: 0 42px 0 0; }
.loop-item {
  display: grid;
  justify-items: center;
  gap: 10px;
  width: 132px;
  text-decoration: none;
  color: inherit;
}
.loop-item img {
  width: 88px;
  height: 88px;
  object-fit: contain;
  background: var(--bg-2);
  border-radius: 18px;
  padding: 10px;
}
.loop-item.is-photo img { object-fit: cover; padding: 0; }
.loop-item span { font-size: 13px; line-height: 1.3; text-align: center; color: var(--muted); }
@keyframes loop-marquee { to { transform: translate3d(-50%, 0, 0); } }

/* Scroll-drawn process line. scaleY is the only animated property. */
.home .tl { position: relative; margin-top: clamp(40px, 6vw, 72px); padding-left: 48px; }
.home .tl-rail {
  position: absolute;
  left: 5px;
  top: 8px;
  bottom: 8px;
  width: 2px;
  background: rgba(255, 255, 255, 0.16);
}
.home .tl-fill {
  display: block;
  width: 100%;
  height: 100%;
  background: #fff;
  transform-origin: top center;
  transform: scaleY(1);
}
.js .home .tl-fill { transform: scaleY(0); }
.home .tl ol { list-style: none; display: grid; gap: 64px; margin: 0; padding: 0; }
.home .tl li { position: relative; display: grid; grid-template-columns: 88px minmax(0, 36rem); gap: 18px; align-items: start; }
.home .tl li::before {
  content: "";
  position: absolute;
  left: -48px;
  top: 14px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 0 5px #0b0b0f;
}
.home .tl-index {
  font-size: clamp(40px, 5vw, 64px);
  font-weight: 600;
  letter-spacing: -0.04em;
  line-height: 1;
  color: rgba(255, 255, 255, 0.28);
}
.home .tl strong { display: block; font-size: 22px; letter-spacing: -0.02em; }
.home .tl p { margin-top: 8px; color: rgba(255, 255, 255, 0.68); font-size: 16px; line-height: 1.5; }

@media (prefers-reduced-motion: reduce) {
  .loop-band.is-on .loop-track,
  .loop-track { animation: none !important; transform: none !important; }
  .loop-set[aria-hidden="true"] { display: none; }
  .js .home .tl-fill { transform: scaleY(1) !important; }
  .arch-stage.is-ready,
  .arch-stage.is-ready .arch-track,
  .arch-stage.is-ready .arch-panel { transform: none !important; }
  .home [data-magnet],
  .home [data-cutout],
  .home [data-cutout] .media img { transform: none !important; transition: none !important; }
}

@media (max-width: 680px) {
  .arch-clip, .arch-stage { height: auto; perspective: none; }
  .arch-track { height: auto; padding-bottom: 4px; display: flex; overflow-x: auto; }
  .arch-panel,
  .arch-stage.is-ready .arch-panel {
    position: relative; left: auto; top: auto; margin-left: 0;
    flex: 0 0 78vw; width: auto; height: auto; aspect-ratio: 4 / 5; transform: none !important;
  }
  .home .tl li { grid-template-columns: 1fr; gap: 8px; }
  .motion-demo .arch-band,
  .arch-band { margin-top: 0; }
  html.is-arch-hero .arch-band {
    position: relative;
    width: auto;
    inset: auto;
    display: block;
    padding: 18px 0 22px;
    background: #0b1020;
  }
  html.is-arch-hero .hero-picture { opacity: 1; }
  html.is-arch-hero .arch-kicker { width: min(var(--shell), calc(100% - 32px)); }
  .arch-kicker, .loop-item { letter-spacing: 0; }
}
