/*
 * Experimental motion layer.
 * Trial-only: remove this stylesheet + js/experimental-motion.js to restore the
 * previous motion system without touching existing motion.css/p4-accent.css.
 * Motion concepts adapted from yui540/css-animations and
 * yui540/reanimated-css-animations (MIT).
 * See docs/experimental-motion-attribution.md.
 */

:root {
  --exp-motion-yellow: var(--p4-yellow, #ffe600);
  --exp-motion-black: var(--p4-black, #111216);
  --exp-motion-pink: #fe587a;
}

/* ---------- Favorite: reference icon + three flying hearts ---------- */
.favorite {
  position: relative;
  display: inline-grid;
  place-items: center;
  font-size: 0 !important;
  color: transparent !important;
}

.favorite::before {
  content: '';
  display: block;
  width: 24px;
  height: 25px;
  background: url('../assets/ui/experimental-heart-outline.svg') center / contain no-repeat;
  transform-origin: center;
  transition: transform 140ms ease;
}

.favorite.on::before {
  background-image: url('../assets/ui/experimental-heart-fill.svg');
}

.favorite:hover::before {
  transform: scale(1.06);
}

.exp-favorite-heart {
  position: fixed;
  z-index: 10020;
  left: var(--exp-heart-left);
  top: var(--exp-heart-top);
  width: 16px;
  height: 17px;
  pointer-events: none;
  background: url('../assets/ui/experimental-heart-fill.svg') center / contain no-repeat;
  filter: drop-shadow(0 2px 4px rgba(254, 88, 122, .18));
  transform: translate(-50%, -50%) scale(.35);
  animation: exp-favorite-heart-fly 720ms cubic-bezier(.18,.76,.3,1) var(--exp-heart-delay, 0ms) both;
}

@keyframes exp-favorite-heart-fly {
  0% {
    opacity: 0;
    transform: translate(-50%, -45%) scale(.35) rotate(0deg);
  }
  18% {
    opacity: 1;
    transform: translate(-50%, -60%) scale(1.08) rotate(0deg);
  }
  72% { opacity: .92; }
  100% {
    opacity: 0;
    transform:
      translate(
        calc(-50% + var(--exp-heart-x, 0px)),
        calc(-50% + var(--exp-heart-y, -48px))
      )
      scale(.62)
      rotate(var(--exp-heart-rotate, 0deg));
  }
}

/* ---------- Reanimated Room1 / Area4: one sliding discovery tab set ---------- */
.discovery-nav--result-tabs.exp-area4-tabset {
  position: relative;
  isolation: isolate;
}

.discovery-nav--result-tabs.exp-area4-tabset .exp-area4-tab-slider {
  position: absolute;
  z-index: 0;
  left: 0;
  top: 0;
  border-radius: 7px 7px 0 0;
  background: #e9ebf0;
  pointer-events: none;
  transform-origin: center;
  will-change: transform, width;
}

.discovery-nav--result-tabs.exp-area4-tabset .discovery-tab {
  z-index: 1;
  background: transparent !important;
}

.discovery-nav--result-tabs.exp-area4-tabset .discovery-tab:hover:not(.active):not([aria-current="page"]) {
  background: rgba(233, 235, 240, .42) !important;
}

.discovery-nav--result-tabs.exp-area4-tabset .discovery-tab.active,
.discovery-nav--result-tabs.exp-area4-tabset .discovery-tab[aria-current="page"],
.discovery-nav--result-tabs.exp-area4-tabset .discovery-tab.active:hover,
.discovery-nav--result-tabs.exp-area4-tabset .discovery-tab[aria-current="page"]:hover {
  background: transparent !important;
}

/* ---------- Animation settings UI ---------- */
.exp-motion-settings {
  margin-top: 28px;
  padding: 20px;
  border: 1px solid #dfe2e8;
  border-radius: 14px;
  background: #f8f9fb;
}

.exp-motion-settings__head {
  padding-bottom: 18px;
  border-bottom: 1px solid #e2e5ea;
}

.exp-motion-settings__eyebrow {
  margin: 0 0 5px !important;
  color: #8b9098 !important;
  font-size: 11px !important;
  font-weight: 850;
  letter-spacing: .08em;
}

.exp-motion-settings__head h3 {
  margin: 0 0 7px;
  font-size: 19px;
}

.exp-motion-settings__head p,
.exp-motion-setting-copy p,
.exp-motion-group__head p,
.exp-motion-settings__note {
  margin: 0;
  color: #666b75;
}

.exp-motion-groups {
  display: grid;
  gap: 14px;
  margin-top: 16px;
}

.exp-motion-group {
  overflow: hidden;
  border: 1px solid #e1e4e9;
  border-radius: 12px;
  background: #fff;
}

.exp-motion-group__head {
  padding: 13px 16px 11px;
  border-bottom: 1px solid #eceef2;
  background: #f5f6f8;
}

.exp-motion-group__head h4 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 900;
}

.exp-motion-group__head p {
  font-size: 12px;
  line-height: 1.55;
}

.exp-motion-group__items > .exp-motion-setting,
.exp-motion-group__items > [data-exp-motion-slot] > .exp-motion-setting {
  border-top: 1px solid #eceef2;
}

.exp-motion-group__items > .exp-motion-setting:first-child {
  border-top: 0;
}

.exp-motion-setting {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 15px 16px;
}

.exp-motion-setting-copy {
  min-width: 0;
}

.exp-motion-setting-copy h5 {
  margin: 0 0 4px;
  font-size: 14px;
  font-weight: 850;
}

.exp-motion-setting-copy p {
  font-size: 12px;
  line-height: 1.6;
}

.exp-motion-switch {
  position: relative;
  flex: 0 0 auto;
  width: 48px;
  height: 28px;
  cursor: pointer;
}

.exp-motion-switch input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
}

.exp-motion-switch__track {
  position: absolute;
  inset: 0;
  border: 2px solid #c8ccd4;
  border-radius: 999px;
  background: #fff;
  transition: background-color 150ms ease, border-color 150ms ease;
}

.exp-motion-switch__track::after {
  content: '';
  position: absolute;
  top: 3px;
  left: 3px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #7b8089;
  transition: transform 170ms cubic-bezier(.2,.8,.2,1), background-color 150ms ease;
}

.exp-motion-switch input:checked + .exp-motion-switch__track {
  border-color: var(--exp-motion-black);
  background: var(--exp-motion-yellow);
}

.exp-motion-switch input:checked + .exp-motion-switch__track::after {
  background: var(--exp-motion-black);
  transform: translateX(20px);
}

.exp-motion-switch input:focus-visible + .exp-motion-switch__track {
  outline: 3px solid rgba(235,0,101,.28);
  outline-offset: 3px;
}

.exp-motion-settings__note {
  margin-top: 15px;
  font-size: 12px;
  line-height: 1.6;
}

.exp-motion-reset { margin-top: 14px; }

@media (max-width: 620px) {
  .exp-motion-settings {
    margin-inline: -4px;
    padding: 16px 12px;
  }

  .exp-motion-setting {
    align-items: flex-start;
    gap: 14px;
    padding: 14px 12px;
  }

  .exp-motion-group__head {
    padding-inline: 12px;
  }
}

@media (prefers-reduced-motion: reduce) {
  .favorite::before { transition: none !important; }
  .exp-favorite-heart {
    display: none !important;
    animation: none !important;
  }
}
