#hero {
  --hero-drift-x: 0px;
  --hero-drift-y: 0px;
  --hero-ease: cubic-bezier(.18,.75,.22,1);
}

.studio-hero .hero-visual {
  z-index: 0;
}
.device-photo-plane { position: absolute; inset: 0; }
.device-lighting, .editor-playback { display: none; }

@media (prefers-reduced-motion: no-preference) {
  .device-lighting {
    display: block;
    position: absolute;
    pointer-events: none;
    mask: url("assets/hero-rgb-lights.webp") center / 100% 100% no-repeat;
    animation: lights-arrive 450ms ease-out 700ms backwards;
  }
  .device-lighting span {
    position: absolute;
    animation: rgb-breathe 3.6s ease-in-out infinite;
  }
  .case-light {
    inset: 0 14% 24% 0;
    --light-low: rgb(36 15 82 / 53%);
    --light-high: rgb(192 150 255 / 63%);
  }
  .device-lighting .fan-light {
    inset: 0 0 24% 86%;
    --light-low: rgb(41 28 94 / 58%);
    --light-high: rgb(112 210 255 / 66%);
    animation-duration: 2.7s;
    animation-delay: -1.8s;
  }
  .device-lighting .desk-light {
    inset: 76% 0 0;
    --light-low: rgb(32 18 84 / 48%);
    --light-high: rgb(200 172 255 / 74%);
    animation-duration: 3.1s;
    animation-delay: -4.1s;
  }
}
@keyframes rgb-breathe {
  0%, 100% { background-color: var(--light-low); }
  42% { background-color: var(--light-high); }
  64% { background-color: color-mix(in srgb, var(--light-low) 70%, var(--light-high)); }
  78% { background-color: color-mix(in srgb, var(--light-high) 64%, var(--light-low)); }
}
@keyframes lights-arrive { from { opacity: 0; } to { opacity: 1; } }

@media (prefers-reduced-motion: no-preference) {
  .pins-positioned .editor-playback {
    display: block;
    position: absolute;
    container-type: inline-size;
    pointer-events: none;
    animation: lights-arrive 200ms ease-out 720ms backwards;
    /* Map source pixels to the full 1536 × 1024 photo, including its cover crop. */
    --source-px: calc(100cqw / 1536);
    --source-size: calc(1536 * var(--source-px)) calc(1024 * var(--source-px));
  }
  .editor-preview {
    position: absolute;
    left: calc(403 * var(--source-px));
    top: calc(237 * var(--source-px));
    width: calc(376 * var(--source-px));
    height: calc(209 * var(--source-px));
    overflow: hidden;
  }
  .editor-preview::before {
    content: "";
    position: absolute;
    inset: 0;
    background: var(--hero-photo) calc(-403 * var(--source-px)) calc(-237 * var(--source-px)) / var(--source-size) no-repeat;
    transform-origin: 63% 58%;
    animation: editor-camera 8.5s cubic-bezier(.24,.42,.58,.88) both;
  }
  /* Cover the original stationary cursor with an adjacent strip of the same tracks. */
  .editor-playback::before {
    content: "";
    position: absolute;
    left: calc(552 * var(--source-px));
    top: calc(498 * var(--source-px));
    width: calc(12 * var(--source-px));
    height: calc(133 * var(--source-px));
    background: var(--hero-photo) calc(-540 * var(--source-px)) calc(-498 * var(--source-px)) / var(--source-size) no-repeat;
    clip-path: polygon(0 0, 100% 0, 100% 11%, 74% 11%, 74% 100%, 20% 100%, 20% 11%, 0 11%);
  }
  .editor-playhead {
    position: absolute;
    left: calc(552 * var(--source-px));
    top: calc(500 * var(--source-px));
    width: calc(10 * var(--source-px));
    height: calc(130 * var(--source-px));
    background: #c5e5f3;
    clip-path: polygon(0 0, 100% 0, 100% 3%, 57% 9%, 57% 100%, 43% 100%, 43% 9%, 0 3%);
    animation: editor-forward 8.5s linear both;
  }
}
@keyframes editor-camera {
  from { transform: scale(1); }
  to { transform: translate(-1.4%, .8%) scale(1.16); }
}
@keyframes editor-forward {
  from { transform: translateX(0); }
  to { transform: translateX(calc(330 * var(--source-px))); }
}

.device-hotspot {
  position: absolute;
  z-index: 1;
  display: inline-grid;
  align-items: center;
  justify-items: center;
  width: 44px;
  height: 44px;
  padding: 0;
  border-radius: 50%;
  transform: translate(-50%, -50%);
  visibility: hidden;
  color: #fff;
}
.pins-positioned .device-hotspot { visibility: visible; }
.device-hotspot-mark {
  display: grid;
  place-items: center;
  position: relative;
  width: 25px;
  height: 25px;
  border-radius: 50%;
  border: 1.5px solid white;
  background: #2456ed;
  box-shadow: 0 0 0 5px #fff4, 0 2px 12px #071e5544;
}
.device-hotspot-mark::before, .device-hotspot-mark::after {
  content: "";
  position: absolute;
  width: 10px;
  height: 1.5px;
  background: white;
}
.device-hotspot-mark::after { transform: rotate(90deg); }
.device-hotspot-label {
  pointer-events: auto;
  position: absolute;
  top: 50%;
  left: calc(50% + 20px);
  transform: translateY(-50%);
  border-radius: 4px;
  padding: 3px 8px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
  white-space: nowrap;
  max-width: min(13em, 30vw);
  overflow: hidden;
  text-overflow: ellipsis;
  color: #1b2b44;
  background: #fffffff2;
  box-shadow: 0 2px 9px #0a20501f;
}
.device-hotspot:is([data-product="gaming"], [data-product="workstation"]) .device-hotspot-label {
  left: auto;
  right: calc(50% + 20px);
}
.device-hotspot:is(:hover, :focus-visible) .device-hotspot-mark {
  background: #1539ae;
  box-shadow: 0 0 0 7px #ffffff66, 0 2px 12px #071e5544;
}
.device-hotspot:is(:hover, :focus-visible) .device-hotspot-label { background: #fff; }
@media (min-width:576px) and (max-width:920px) {
  .device-hotspot-label { opacity: 0; pointer-events: none; }
  .device-hotspot:is(:hover, :focus-visible) .device-hotspot-label { opacity: 1; pointer-events: auto; }
}

@media (prefers-reduced-motion: no-preference) {
  #hero .hero-label, #hero h1, #hero .hero-actions,
  #hero-copy > p {
    animation: hero-copy-in 540ms var(--hero-ease) backwards;
  }
  #hero h1 { animation-delay: 45ms; }
  #hero-copy > p { animation-delay: 90ms; }
  #hero .hero-actions { animation-delay: 130ms; }
  .device-photo-plane img { animation: studio-unveil 720ms var(--hero-ease) backwards; }
  .pins-positioned .device-hotspot-mark { animation: pin-arrive 430ms var(--hero-ease) 240ms backwards; }
  .pins-positioned .device-hotspot-label { animation: hero-label-in 300ms ease-out 300ms backwards; }
  .device-hotspot-mark { transition: box-shadow 180ms, background 180ms; }
  .device-hotspot-label { transition: opacity 160ms; }
}
@media (prefers-reduced-motion: no-preference) and (hover: hover) and (pointer: fine) {
  .device-photo-plane {
    translate: var(--hero-drift-x) var(--hero-drift-y);
    scale: 1.035;
    transition: translate 230ms ease-out;
  }
}
@keyframes hero-copy-in {
  from { opacity: .1; transform: translateY(15px); }
  to { opacity: 1; transform: none; }
}
@keyframes studio-unveil {
  from { opacity: .45; transform: scale(1.065); }
  to { opacity: 1; transform: none; }
}
@keyframes pin-arrive {
  from { opacity: 0; transform: scale(.55); }
  70% { transform: scale(1.08); }
  to { opacity: 1; transform: none; }
}
@keyframes hero-label-in { from { opacity: 0; } }
