/* Exploded view, concept B: plays once when it comes into view, then hotspots appear on the exploded unit.
   .xp            full-height dark section
   .xp__canvas    the frames, drawn by explode-play.js
   .xp__layer     sized by the script to the drawn frame, so hotspots keep their place at any screen size
   .xp__spot      one hotspot button at --x / --y (fractions of the frame); .is-open shows its card
   .xp__dim       darkens everything except a circle around the open hotspot
   .xp__replay    small button to play again */

.xp {
  position: relative;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  background: #000;
  color: #f6f7f9;
}

.xp__canvas {
  display: block;
  width: 100%;
  height: 100%;
}

/* Panel variant: a 16:9 frame inside a section instead of a whole screen; the frames fit it exactly,
   so no black bars. Add .led-frame and the light span for the LED edge. */
.xp--panel {
  --led-inset: 7px;
  --led-radius: 10px;
  --led-width: 2px;
  height: auto;
  aspect-ratio: 16 / 9;
  /* Never taller than 78 % of the screen: the width follows, so the ratio always holds and the frame fills it */
  width: min(100%, calc(78vh * 16 / 9));
  margin-inline: auto;
  /* The picture sits inside the LED line, nothing shows between the line and the panel edge */
  padding: calc(var(--led-inset) + var(--led-width));
  border-radius: 3px;
  background: #15181b;
  box-shadow: inset 0 0 0 1px #2c3137, 0 40px 70px -40px rgb(0 0 0 / 0.8);
}

.xp--panel .xp__canvas {
  border-radius: calc(var(--led-radius) - 2px);
}

/* Sheet with the open hotspot's text, used instead of the floating card on narrow screens */
.xp__sheet {
  display: none;
  position: absolute;
  left: var(--space-4);
  right: var(--space-4);
  bottom: var(--space-4);
  z-index: 2;
  padding: 12px 16px;
  border-radius: 3px;
  background: rgb(17 20 24 / 0.92);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px #2c3137, inset 3px 0 0 var(--led-500);
  pointer-events: none;
}

.xp__sheet strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1rem;
  font-weight: 600;
}

.xp__sheet span {
  display: block;
  font-size: var(--text-small);
  line-height: 1.45;
  color: #aeb3bc;
}

/* Phones: a 4:3 box keeps every hotspot inside the crop; the foot shrinks to the replay button;
   the hotspot text goes to the sheet, the replay button steps aside while it shows */
@media (max-width: 760px) {
  .xp__card {
    display: none;
  }

  .xp[data-open] .xp__sheet {
    display: block;
  }

  .xp[data-open] .xp__foot {
    opacity: 0;
    pointer-events: none;
  }

  .xp--panel {
    aspect-ratio: 4 / 3;
    width: 100%;
  }

  .xp--panel .xp__foot {
    left: auto;
    right: var(--space-4);
    bottom: var(--space-4);
    flex-direction: row;
  }

  .xp--panel .xp__lead {
    display: none;
  }
}

.xp__layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

/* Spotlight: a hole in the dark where the open hotspot is */
.xp__dim {
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at var(--sx, 50%) var(--sy, 50%), transparent 0, transparent var(--r, 0px), rgb(0 0 0 / 0.72) calc(var(--r, 0px) + 90px));
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out);
}

.xp[data-open] .xp__dim {
  opacity: 1;
}

.xp__spot[hidden] {
  display: none;
}

.xp__spot {
  touch-action: manipulation;
  position: absolute;
  left: calc(var(--x) * 100%);
  top: calc(var(--y) * 100%);
  z-index: 1;
  width: 44px;
  height: 44px;
  margin: -22px 0 0 -22px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  background: transparent;
  color: #f6f7f9;
  cursor: pointer;
  pointer-events: auto;
  opacity: 0;
  transform: scale(0.6);
  transition:
    opacity var(--dur-slow) var(--ease-out),
    transform var(--dur-slower) var(--ease-emphasis);
}

.xp[data-ready] .xp__spot {
  opacity: 1;
  transform: none;
  transition-delay: calc(var(--i, 0) * 70ms);
}

/* The dot: LED blue with a breathing halo */
.xp__spot::before {
  content: "";
  position: absolute;
  inset: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  background: var(--led-500);
  box-shadow: 0 0 0 2px #000, 0 0 14px rgb(49 187 238 / 0.9);
}

.xp__spot::after {
  content: "";
  position: absolute;
  inset: 50%;
  width: 12px;
  height: 12px;
  margin: -6px 0 0 -6px;
  border-radius: 50%;
  border: 1.5px solid rgb(49 187 238 / 0.7);
  animation: xp-pulse 2.4s var(--ease-out) infinite;
}

@keyframes xp-pulse {
  from {
    transform: scale(1);
    opacity: 0.9;
  }
  to {
    transform: scale(3.2);
    opacity: 0;
  }
}

.xp__spot:hover::after,
.xp__spot.is-open::after,
.xp__spot:focus-visible::after {
  animation: none;
  transform: scale(2.2);
  opacity: 1;
  border-color: var(--led-500);
}

.xp__spot:focus-visible {
  outline: none;
}

.xp__spot:focus-visible::before {
  box-shadow: 0 0 0 2px #000, 0 0 0 4px var(--led-500), 0 0 18px rgb(49 187 238 / 0.9);
}

/* Faded while another hotspot is open */
.xp[data-open] .xp__spot:not(.is-open) {
  opacity: 0.35;
}

.xp[data-open] .xp__spot:not(.is-open)::after {
  animation: none;
  opacity: 0;
}

/* Card next to the dot, flips to the left side near the right edge (.xp__spot--left) */
.xp__card {
  position: absolute;
  left: 34px;
  top: 50%;
  width: max-content;
  max-width: 18rem;
  padding: 12px 16px;
  border-radius: 3px;
  background: rgb(17 20 24 / 0.9);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: inset 0 0 0 1px #2c3137, inset 3px 0 0 var(--led-500), 0 18px 40px -18px rgb(0 0 0 / 0.8);
  text-align: left;
  opacity: 0;
  transform: translate(-6px, -50%);
  pointer-events: none;
  transition:
    opacity var(--dur-base) var(--ease-out),
    transform var(--dur-slow) var(--ease-emphasis);
}

.xp__spot.is-open .xp__card {
  opacity: 1;
  transform: translate(0, -50%);
}

.xp__spot--left .xp__card {
  left: auto;
  right: 34px;
  transform: translate(6px, -50%);
  box-shadow: inset 0 0 0 1px #2c3137, inset -3px 0 0 var(--led-500), 0 18px 40px -18px rgb(0 0 0 / 0.8);
}

.xp__spot--left.is-open .xp__card {
  transform: translate(0, -50%);
}

.xp__card strong {
  display: block;
  margin-bottom: 2px;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
}

.xp__card span {
  display: block;
  font-size: var(--text-small);
  line-height: 1.45;
  color: #aeb3bc;
}

/* Replay and the small lead at the bottom */
.xp__foot {
  position: absolute;
  left: var(--gutter);
  right: var(--gutter);
  bottom: var(--space-6);
  z-index: 2;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
  opacity: 0;
  transition: opacity var(--dur-slow) var(--ease-out) 300ms;
}

.xp[data-ready] .xp__foot {
  opacity: 1;
}

.xp__lead {
  margin: 0;
  color: #aeb3bc;
  font-size: var(--text-small);
}

.xp__replay {
  --btn-bg: rgb(255 255 255 / 0.1);
  --btn-fg: #f6f7f9;
  --btn-border: rgb(255 255 255 / 0.3);
  --btn-bg-hover: rgb(255 255 255 / 0.18);
}

@media (max-width: 760px) {
  .xp__card {
    max-width: 13rem;
    padding: 10px 12px;
  }

  .xp__foot {
    flex-direction: column;
    align-items: flex-start;
  }
}

@media (prefers-reduced-motion: reduce) {
  .xp__spot::after {
    animation: none;
    opacity: 0;
  }
}

/* Video player (explode-video.js): the stage clips the picture; the script places video and still inside it */
.xp__stage {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  background: #000;
}
.xp--panel .xp__stage {
  border-radius: calc(var(--led-radius) - 2px);
}
.xp__video,
.xp__still {
  position: absolute;
  display: block;
  max-width: none; /* the script sizes them, the zoom makes them wider than the stage */
  object-fit: fill;
  background: #000;
}
.xp__video[hidden],
.xp__still[hidden] {
  display: none;
}
