/* Shared motion policy. JS owns reveal timing, interruption and view state;
 * this final layer keeps existing controls quiet and makes static policy instant. */
html[data-amiux-motion-ready="true"] {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-appear: cubic-bezier(0.32, 0.72, 0, 1);
}

html[data-amiux-motion-ready="true"] .site-header,
html[data-amiux-boot="pending"] .site-header {
  opacity: 1 !important;
  transform: none !important;
}

/* Only an initialized, active controller may conceal unrevealed content. */
html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
  :is(.artist-card, .amiux-socials-item, .amiux-distribution-heading)[data-site-reveal="pending"] {
  opacity: 0;
  transform: none;
}

html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
  :is(.amiux-search-card, .amiux-partner-link)[data-site-reveal="pending"] {
  opacity: 0;
}

/* The outer article now owns entry. Preserve the surface and portrait layers. */
html[data-amiux-motion-ready="true"] .artist-card[data-site-reveal] > div {
  opacity: 1 !important;
  transform: none !important;
}

html[data-amiux-motion-ready="true"]
  :is(.artist-card, .amiux-socials-item, .amiux-distribution-heading)[data-site-reveal="pending"]:focus-within {
  opacity: 1 !important;
  transform: none !important;
}

html[data-amiux-motion-ready="true"]
  :is(.amiux-search-card, .amiux-partner-link)[data-site-reveal="pending"]:focus-within {
  opacity: 1 !important;
}

/* Suppress legacy entrances only after the shared controller has initialized. */
html[data-amiux-motion-ready="true"] .amiux-socials:not([hidden]) .amiux-socials-item,
html[data-amiux-motion-ready="true"] .amiux-partner-link[data-site-reveal],
html[data-amiux-motion-ready="true"]
  .site[data-motion="true"][data-amiux-view="search"] .amiux-search:not([hidden]) .amiux-search-field {
  animation: none !important;
}

/* Familiar controls retain their existing colours, geometry and focus treatment. */
html[data-amiux-motion-ready="true"] .card-surface {
  transition: transform 260ms var(--ease-out), box-shadow 220ms ease;
}

html[data-amiux-motion-ready="true"] .listen-button {
  transition: background-color 180ms ease, transform 120ms var(--ease-out), box-shadow 180ms ease;
}

html[data-amiux-motion-ready="true"] .artist-dialog .close-button {
  transition: background-color 160ms ease, color 160ms ease, transform 120ms var(--ease-out);
}

html[data-amiux-motion-ready="true"] .artist-dialog .close-button svg {
  transform: none !important;
  transition: none;
}

/* Keep native modal positioning, keyframes and the original close lifecycle. */
html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
  .artist-dialog:not([data-state="closed"]) {
  animation-duration: 280ms;
}

html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
  .artist-dialog[data-state="open"][data-motion="true"] .platform-link {
  animation-duration: 240ms;
}

html[data-amiux-motion-ready="true"]
  .artist-dialog .platform-link[data-platform][data-amiux-controls="platform"] {
  transition: border-color 200ms ease, transform 180ms var(--ease-out);
}

html[data-amiux-motion-ready="true"]
  .artist-dialog .platform-link[data-platform][data-amiux-controls="platform"]::before,
html[data-amiux-motion-ready="true"] .amiux-platform-mark::before,
html[data-amiux-motion-ready="true"] .amiux-platform-mark::after {
  transition: opacity 200ms ease;
}

html[data-amiux-motion-ready="true"]
  .artist-dialog .platform-link[data-platform][data-amiux-controls="platform"] .platform-label {
  transition: border-color 200ms ease;
}

html[data-amiux-motion-ready="true"] .amiux-search-card {
  transition: background-color 180ms ease, transform 220ms var(--ease-out);
}

html[data-amiux-motion-ready="true"]
  :is(.amiux-search-card__listen, .amiux-search-more, .amiux-search-retry) {
  transition: background-color 180ms ease, transform 120ms var(--ease-out);
}

html[data-amiux-motion-ready="true"] .amiux-search-platform {
  transition: background-color 180ms ease, transform 200ms var(--ease-out);
}

/* Ungated legacy hover transforms stay still until a fine pointer may use them. */
html[data-amiux-motion-ready="true"]
  :is(.amiux-search-card, .amiux-search-card__listen, .amiux-search-more,
      .amiux-search-retry, .amiux-search-platform):hover {
  transform: none;
}

html[data-amiux-motion-ready="true"] .amiux-partner-link {
  transition: color 180ms ease, transform 240ms var(--ease-out);
}

html[data-amiux-motion-ready="true"] .amiux-partner-mark img {
  transition: filter 220ms ease, transform 240ms var(--ease-out);
}

@media (hover: hover) and (pointer: fine) {
  html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
    .site[data-motion="true"] .card-surface:hover {
    transform: translateY(-3px);
  }

  html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"] .amiux-search-card:hover {
    transform: translateY(-1px);
  }

  html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
    :is(.amiux-search-card__listen, .amiux-search-more, .amiux-search-retry):hover {
    transform: translateY(-1px);
  }

  html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"] .amiux-search-platform:hover {
    transform: translateX(1px);
  }
}

html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"]
  :is(.listen-button, .amiux-search-card__listen, .amiux-search-more, .amiux-search-retry):active {
  transform: scale(0.985);
}

html[data-amiux-motion-ready="true"][data-amiux-motion-policy="active"] .artist-dialog .close-button:active {
  transform: scale(0.97);
}

/* A dialog made static stays still until it closes, even if pointer policy resumes.
 * Do not reset its transform: the native/React modal still owns centering and exit. */
html[data-amiux-motion-ready="true"] :is(.artist-dialog, .amiux-search-dialog)[data-amiux-modal-static="true"],
html[data-amiux-motion-ready="true"] :is(.artist-dialog, .amiux-search-dialog)[data-amiux-modal-static="true"]::before,
html[data-amiux-motion-ready="true"] :is(.artist-dialog, .amiux-search-dialog)[data-amiux-modal-static="true"]::after,
html[data-amiux-motion-ready="true"] :is(.artist-dialog, .amiux-search-dialog)[data-amiux-modal-static="true"] *,
html[data-amiux-motion-ready="true"] :is(.artist-dialog, .amiux-search-dialog)[data-amiux-modal-static="true"] *::before,
html[data-amiux-motion-ready="true"] :is(.artist-dialog, .amiux-search-dialog)[data-amiux-modal-static="true"] *::after,
html[data-amiux-motion-ready="true"] .amiux-search-dialog[data-amiux-modal-static="true"]::backdrop {
  animation: none !important;
  transition: none !important;
}

/* Root policy includes keyboard input, reduced motion, site-off and document hiding.
 * It lives on html so portaled artist dialogs and native search dialogs share it. */
html[data-amiux-motion-ready="true"][data-amiux-motion-policy="static"] *,
html[data-amiux-motion-ready="true"][data-amiux-motion-policy="static"] *::before,
html[data-amiux-motion-ready="true"][data-amiux-motion-policy="static"] *::after {
  animation: none !important;
  transition: none !important;
  scroll-behavior: auto !important;
}

/* Reset interaction offsets only; never reset the dialog's centering transform. */
html[data-amiux-motion-ready="true"][data-amiux-motion-policy="static"]
  :is(.card-surface:hover, .listen-button:active, .artist-dialog .close-button:active,
      .artist-dialog .platform-link:hover, .artist-dialog .platform-link:active,
      .artist-dialog .platform-link:hover .platform-label, .amiux-search-card:hover,
      .amiux-search-card__listen:hover, .amiux-search-card__listen:active,
      .amiux-search-more:hover, .amiux-search-more:active,
      .amiux-search-retry:hover, .amiux-search-retry:active,
      .amiux-search-platform:hover, .amiux-partner-link:hover,
      .amiux-partner-link:hover .amiux-partner-mark img) {
  transform: none !important;
}

html[data-amiux-motion-ready="true"][data-amiux-motion-policy="static"]
  .amiux-socials-arrow svg:first-child {
  transform: translate(-50%, -50%) !important;
  opacity: 1 !important;
}

html[data-amiux-motion-ready="true"][data-amiux-motion-policy="static"]
  .amiux-socials-arrow svg:last-child {
  opacity: 0 !important;
}

/* Media fallback also covers the instant before the JS preference listener runs. */
@media (prefers-reduced-motion: reduce) {
  html[data-amiux-motion-ready="true"] *,
  html[data-amiux-motion-ready="true"] *::before,
  html[data-amiux-motion-ready="true"] *::after {
    animation: none !important;
    transition: none !important;
    scroll-behavior: auto !important;
  }

  html[data-amiux-motion-ready="true"]
    :is(.artist-card, .amiux-socials-item, .amiux-distribution-heading)[data-site-reveal="pending"] {
    opacity: 1 !important;
    transform: none !important;
  }

  html[data-amiux-motion-ready="true"]
    :is(.amiux-search-card, .amiux-partner-link)[data-site-reveal="pending"] {
    opacity: 1 !important;
  }

  html[data-amiux-motion-ready="true"]
    :is(.card-surface:hover, .listen-button:active, .artist-dialog .close-button:active,
        .artist-dialog .platform-link:hover, .artist-dialog .platform-link:active,
        .artist-dialog .platform-link:hover .platform-label, .amiux-search-card:hover,
        .amiux-search-card__listen:hover, .amiux-search-card__listen:active,
        .amiux-search-more:hover, .amiux-search-more:active,
        .amiux-search-retry:hover, .amiux-search-retry:active,
        .amiux-search-platform:hover, .amiux-partner-link:hover,
        .amiux-partner-link:hover .amiux-partner-mark img) {
    transform: none !important;
  }

  html[data-amiux-motion-ready="true"] .amiux-socials-arrow svg:first-child {
    transform: translate(-50%, -50%) !important;
    opacity: 1 !important;
  }

  html[data-amiux-motion-ready="true"] .amiux-socials-arrow svg:last-child {
    opacity: 0 !important;
  }
}
