/**
 * V1 — floating Featured Track / On Repeat ambient widget
 */

body[data-profile-layout="v1"] .v1-on-repeat-float-host {
  position: fixed;
  z-index: 3;
  pointer-events: none;
  inset: auto;
  top: max(132px, calc(env(safe-area-inset-top) + 100px));
  right: max(72px, calc(env(safe-area-inset-right) + 56px));
  width: 108px;
  height: 136px;
  opacity: 1;
  visibility: visible;
  transition:
    opacity 220ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host:has(.current-track-pin[hidden]) {
  display: none;
}

body[data-profile-layout="v1"] .current-track-pin--overlay {
  position: static;
  top: auto;
  left: auto;
  z-index: auto;
  transform: none;
}

body[data-profile-layout="v1"] .profile-card-stack[data-active="showcase"] .v1-on-repeat-float-host,
body[data-profile-layout="v1"][data-v1-section="showcase"] .v1-on-repeat-float-host {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition:
    opacity 240ms cubic-bezier(0.4, 0, 0.2, 1),
    visibility 0s linear 240ms;
}

body[data-profile-layout="v1"] .profile-card-stack[data-active="showcase"] .v1-on-repeat-float-host .current-track-pin,
body[data-profile-layout="v1"][data-v1-section="showcase"] .v1-on-repeat-float-host .current-track-pin {
  opacity: 1;
  transition: none;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin {
  position: relative;
  top: auto;
  left: auto;
  z-index: auto;
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 4px;
  width: 108px;
  min-height: 136px;
  padding: 7px 7px 9px;
  margin: 0;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 12px;
  background: rgba(14, 14, 18, 0.72);
  box-shadow:
    0 6px 22px rgba(0, 0, 0, 0.36),
    0 0 0 0.5px rgba(var(--accent-r), 0.1) inset;
  color: inherit;
  text-decoration: none;
  cursor: pointer;
  pointer-events: auto;
  transform: translate3d(0, 0, 0) rotate(-2deg);
  transform-origin: center center;
  animation: v1-on-repeat-float 7.5s ease-in-out infinite;
  will-change: transform;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin::before {
  top: 6px;
  right: 8px;
  width: 6px;
  height: 6px;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin::after {
  display: none;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__cover-wrap {
  width: 100%;
  aspect-ratio: 1;
  height: auto;
  border-radius: 8px;
  overflow: hidden;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__label {
  margin: 1px 0 0;
  font-size: 0.5rem;
  letter-spacing: 0.14em;
  text-align: left;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__meta {
  text-align: left;
  min-width: 0;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__title {
  font-size: 0.72rem;
  line-height: 1.2;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__artist {
  font-size: 0.62rem;
  opacity: 0.82;
}

body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin:hover,
body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin:focus-visible {
  border-color: rgba(var(--accent-r), 0.38);
  outline: none;
}

@keyframes v1-on-repeat-float {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-2deg);
  }

  20% {
    transform: translate3d(-22px, -18px, 0) rotate(2deg);
  }

  40% {
    transform: translate3d(-10px, -32px, 0) rotate(-3deg);
  }

  60% {
    transform: translate3d(-28px, 12px, 0) rotate(3deg);
  }

  80% {
    transform: translate3d(-14px, 28px, 0) rotate(-1deg);
  }
}

@media (min-width: 601px) {
  body[data-profile-layout="v1"] .v1-on-repeat-float-host {
    right: max(128px, calc(env(safe-area-inset-right) + 108px));
  }
}

@media (max-width: 600px) {
  body[data-profile-layout="v1"] .v1-on-repeat-float-host {
    top: max(108px, calc(env(safe-area-inset-top) + 82px));
    right: max(52px, calc(env(safe-area-inset-right) + 36px));
    width: 88px;
    height: 112px;
    transition:
      opacity 230ms cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0s;
  }

  body[data-profile-layout="v1"] .profile-card-stack[data-active="showcase"] .v1-on-repeat-float-host,
  body[data-profile-layout="v1"][data-v1-section="showcase"] .v1-on-repeat-float-host {
    transition:
      opacity 230ms cubic-bezier(0.4, 0, 0.2, 1),
      visibility 0s linear 230ms;
  }

  body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin {
    width: 88px;
    min-height: 112px;
    padding: 6px;
    animation: v1-on-repeat-float-mobile 8.5s ease-in-out infinite;
  }

  body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__title {
    font-size: 0.64rem;
  }

  body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin__artist {
    font-size: 0.56rem;
  }
}

@keyframes v1-on-repeat-float-mobile {
  0%,
  100% {
    transform: translate3d(0, 0, 0) rotate(-1deg);
  }

  25% {
    transform: translate3d(-16px, -12px, 0) rotate(2deg);
  }

  50% {
    transform: translate3d(-8px, -18px, 0) rotate(-2deg);
  }

  75% {
    transform: translate3d(-12px, 8px, 0) rotate(1deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  body[data-profile-layout="v1"] .v1-on-repeat-float-host .current-track-pin {
    animation: none;
    transform: rotate(-2deg);
  }
}
