/* Phones (≤767px): the landscape module (#ai-perspective) as a square "landscape window" carousel instead of the
   pinned scroll scene. Layers, back to front: violet glow → sliding glass panels → mountain-and-river landscape
   (the panels fade behind the hills) → frosted capsule control. In the capsule every message is a white dot; the
   current one stretches into a bar whose white fill grows over --hz-scene-duration, then the carousel advances.
   Desktop keeps the scroll scene; this markup is hidden there. Script: hz-scene-carousel.js. */
.hz-scene-carousel { display: none; }

@media (max-width: 767px) {
  .metrics-showcase { height: auto; background: #050a14; }
  .metrics-showcase__stage { display: none; }

  .hz-scene-carousel {
    --hz-scene-duration: 5s;
    display: block;
    padding-bottom: 24px;
    background: #050a14;
  }
  .hz-scene-carousel__window { position: relative; aspect-ratio: 1 / 1; overflow: hidden; background: #050a14; }

  /* Both artwork layers share the scene's 1440 × 1000 composition, scaled to cover the square window. */
  .hz-scene-carousel__art { position: absolute; top: 0; left: 50%; height: 100%; aspect-ratio: 1440 / 1000; transform: translateX(-50%); pointer-events: none; }
  .hz-scene-carousel__art--glow { z-index: 0; }
  .hz-scene-carousel__art--landscape { z-index: 2; }
  .hz-scene-carousel__art img { position: absolute; left: 0; display: block; width: 100%; max-width: none; height: 100%; object-fit: fill; }
  /* Same position as the scene's glow (the horizon stays behind the hills), but a softer top fade than the
     desktop mask so the violet rises behind the title, as in the mock. */
  .hz-scene-carousel__art--glow img {
    top: -10%;
    mask-image: linear-gradient(to bottom, transparent 0%, #000 38%);
    -webkit-mask-image: linear-gradient(to bottom, transparent 0%, #000 38%);
  }
  .hz-scene-carousel__art--landscape img {
    bottom: 0;
    height: 74.2%;
    mask-image: linear-gradient(to bottom, #000 90%, transparent 100%);
    -webkit-mask-image: linear-gradient(to bottom, #000 90%, transparent 100%);
  }

  .hz-scene-carousel__track {
    position: absolute;
    z-index: 1;
    inset: 0;
    display: flex;
    overflow-x: auto;
    overflow-y: hidden;
    overscroll-behavior-x: contain;
    scroll-snap-type: x mandatory;
    scrollbar-width: none;
    -webkit-overflow-scrolling: touch;
  }
  .hz-scene-carousel__track::-webkit-scrollbar { display: none; }
  .hz-scene-carousel__track:focus-visible { outline: 2px solid #bea2ff; outline-offset: -2px; }
  .hz-scene-carousel__slide { position: relative; flex: 0 0 100%; height: 100%; scroll-snap-align: center; scroll-snap-stop: always; }

  /* Glass panel: two-thirds of the window, centred over the glow; its lower edge fades behind the hills. */
  .hz-scene-carousel__panel {
    box-sizing: border-box;
    position: absolute;
    top: 30%;
    left: 50%;
    width: 68%;
    aspect-ratio: 1527.8 / 1224.27;
    transform: translateX(-50%);
    padding: 6vw 2.2vw 0;
    background: linear-gradient(123.08deg, rgba(255, 255, 255, .1) 0%, rgba(255, 255, 255, .02) 50%, rgba(255, 255, 255, .06) 100%);
    border: 1px solid rgba(255, 255, 255, .28);
    border-radius: 3vw;
    color: #fff;
    text-align: center;
    font-family: "PingFang SC", "Microsoft YaHei", "Noto Sans CJK SC", sans-serif;
    mask-image: linear-gradient(to bottom, #000 55%, transparent 88%);
    -webkit-mask-image: linear-gradient(to bottom, #000 55%, transparent 88%);
  }
  .hz-scene-carousel .metrics-scene__title { font-size: 6.8vw; line-height: 1.3; }
  .hz-scene-carousel .metrics-scene__copy { max-width: none; margin: 3vw 0 0; font-size: max(10px, 2.6vw); line-height: 1.55; text-shadow: 0 1px 8px rgba(38, 12, 80, .45); }

  /* Frosted capsule: a dot per message; the current one is a bar that fills, then the carousel advances. */
  .hz-scene-carousel__control {
    position: absolute;
    z-index: 3;
    bottom: 5.5%;
    left: 50%;
    display: flex;
    align-items: center;
    gap: 9px;
    padding: 9px 14px;
    transform: translateX(-50%);
    border: 1px solid rgba(255, 255, 255, .38);
    border-radius: 999px;
    background: rgba(255, 255, 255, .08);
    -webkit-backdrop-filter: blur(10px);
    backdrop-filter: blur(10px);
  }
  .hz-scene-carousel__dot {
    position: relative;
    flex: 0 0 auto;
    width: 8px;
    height: 8px;
    padding: 0;
    overflow: hidden;
    border: 0;
    border-radius: 999px;
    background: #fff;
    cursor: pointer;
    transition: width .35s cubic-bezier(.25, 1, .5, 1), background-color .35s ease;
    -webkit-tap-highlight-color: transparent;
  }
  /* Larger touch target than the 8px dot. */
  .hz-scene-carousel__dot::after { position: absolute; inset: -10px -5px; content: ""; }
  .hz-scene-carousel__dot:focus-visible { outline: 2px solid #bea2ff; outline-offset: 3px; }
  .hz-scene-carousel__fill {
    position: absolute;
    inset: 0;
    border-radius: inherit;
    background: #fff;
    transform: scaleX(0);
    transform-origin: left center;
    opacity: 0;
  }
  .hz-scene-carousel__dot.is-active { width: 34px; background: rgba(255, 255, 255, .3); }
  .hz-scene-carousel__dot.is-active .hz-scene-carousel__fill { opacity: 1; animation: hz-scene-fill var(--hz-scene-duration) linear forwards; }
  .hz-scene-carousel.is-paused .hz-scene-carousel__dot.is-active .hz-scene-carousel__fill { animation-play-state: paused; }
}

@media (max-width: 767px) and (prefers-reduced-motion: reduce) {
  /* No automatic advance: the current bar simply shows as full. */
  .hz-scene-carousel__dot { transition: none; }
  .hz-scene-carousel__dot.is-active .hz-scene-carousel__fill { animation: none; transform: scaleX(1); }
}

@keyframes hz-scene-fill { from { transform: scaleX(0); } to { transform: scaleX(1); } }
