/* Both documents paint the same window at the handoff point. */
@media (prefers-reduced-motion: no-preference) {
  html[data-journey-product="tongyuye"] {
    --journey-ratio: 1.38428;
    --journey-image: url('tongyuye-interface-preview.webp?v=20261201-win');
  }
  html[data-journey-product="agent-marketplace"] {
    --journey-ratio: 1.44;
    --journey-image: url('agent-marketplace-interface.webp?v=20261201-hub');
  }
  html[data-journey-product="enterprise-api"] {
    --journey-ratio: 1.44;
    --journey-image: url('enterprise-interface.webp');
  }
  html[data-desktop-journey] {
    --journey-width: min(84vw, 93vh, 64rem);
    --journey-dock: translate(var(--journey-x, 0px), var(--journey-y, 0px)) scale(var(--journey-scale, 1));
    --journey-ease: cubic-bezier(.42, 0, .16, 1);
  }
  html[data-desktop-journey]::before,
  html[data-desktop-journey]::after {
    content: "";
    position: fixed;
    pointer-events: none;
    z-index: 2147483600;
  }
  html[data-desktop-journey]::before {
    inset: 0;
    background: radial-gradient(ellipse at 65% 45%, #443264 0%, #221733 44%, #100b20 86%);
  }
  html[data-desktop-journey]::after {
    z-index: 2147483601;
    width: var(--journey-width);
    aspect-ratio: var(--journey-ratio);
    left: 50%;
    top: 50%;
    margin-left: calc(var(--journey-width) / -2);
    margin-top: calc(var(--journey-width) / var(--journey-ratio) / -2);
    background: var(--journey-image) center / contain no-repeat;
    -webkit-mask-image: linear-gradient(to right, transparent, black 0.9%, black 99.1%, transparent), linear-gradient(to bottom, transparent, black 1.2%, black 98.8%, transparent);
    -webkit-mask-composite: source-in;
    mask-composite: intersect;
  }
  html[data-desktop-journey="out"]::before { animation: journey-cover 425ms ease-in-out both; }
  html[data-desktop-journey="out"]::after { animation: journey-lift 425ms var(--journey-ease) both; }
  html[data-desktop-journey="in"]::before { animation: journey-reveal 630ms ease-out both; }
  html[data-desktop-journey="in"]::after { animation: journey-land 630ms var(--journey-ease) both; }
  html[data-desktop-journey="in"] .detail-layout > :first-child {
    animation: journey-copy 630ms ease-out both;
  }
  html[data-desktop-journey="out"]::before { pointer-events: auto; cursor: progress; }
  html[data-desktop-journey="out"] [data-journey-photo] { opacity: 0; }
  html[data-desktop-journey="in"] [data-journey-photo] { animation: journey-photo 630ms linear both; }
  @keyframes journey-photo { 0%, 81% { opacity: 0; } to { opacity: 1; } }
  @keyframes journey-cover { from { opacity: 0; } to { opacity: 1; } }
  @keyframes journey-lift { from { transform: var(--journey-dock); } to { transform: none; } }
  @keyframes journey-reveal { 0%, 10% { opacity: 1; } 90%, 100% { opacity: 0; } }
  @keyframes journey-land {
    from { transform: none; opacity: 1; }
    80% { opacity: 1; }
    to { transform: var(--journey-dock); opacity: 0; }
  }
  @keyframes journey-copy { from { transform: translateY(18px); } to { transform: translateY(0); } }
}

/* On a narrow screen the arriving screenshot stays in the first viewport. */
@media (max-width: 800px) {
  .detail-layout > .project-screenshot { order: -1; }
}
