/* Header cart + menu icon styles & animations */

.th-icon {
  display: inline-block;
  vertical-align: middle;
  flex-shrink: 0;
  color: inherit;
}

.th-icon-host {
  color: inherit;
}

.search-header .th-icon-host,
.nav-mobile .th-icon-host {
  color: var(--header-text-color-primary-bg, currentColor);
}

.th-icon svg,
svg.th-icon {
  display: block;
}

.th-icon--menu.th-icon--anim,
.th-icon--dots-pulse {
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.th-burger {
  width: 20px;
  height: 14px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.th-burger i {
  display: block;
  height: 1.7px;
  width: 100%;
  background: currentColor;
  border-radius: 2px;
  transform-origin: center;
  transition: transform 0.28s ease, opacity 0.2s ease, width 0.28s ease;
}

.th-icon--dots-pulse {
  gap: 4px;
}
.th-icon--dots-pulse i {
  width: 4px;
  height: 4px;
  border-radius: 50%;
  background: currentColor;
  display: block;
  animation: th-dot-pulse 1.1s ease-in-out infinite;
}
.th-icon--dots-pulse i:nth-child(2) { animation-delay: 0.15s; }
.th-icon--dots-pulse i:nth-child(3) { animation-delay: 0.3s; }

/* ---- Cart animations (idle + hover intensify) ---- */
@keyframes th-bag-bounce {
  0%, 100% { transform: translateY(0); }
  40% { transform: translateY(-3px); }
  70% { transform: translateY(-1px); }
}
@keyframes th-bag-pulse {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.12); }
}
@keyframes th-bag-float {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2.5px); }
}
@keyframes th-bag-spin {
  0% { transform: rotate(0deg); }
  20% { transform: rotate(-8deg); }
  40% { transform: rotate(8deg); }
  60% { transform: rotate(-4deg); }
  80% { transform: rotate(4deg); }
  100% { transform: rotate(0deg); }
}
@keyframes th-bag-pop {
  0%, 100% { transform: scale(1); }
  30% { transform: scale(1.18); }
  55% { transform: scale(0.94); }
  75% { transform: scale(1.06); }
}
@keyframes th-cart-wiggle {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-7deg); }
  50% { transform: rotate(7deg); }
  75% { transform: rotate(-4deg); }
}
@keyframes th-cart-swing {
  0%, 100% { transform: rotate(0deg); transform-origin: top center; }
  30% { transform: rotate(10deg); }
  60% { transform: rotate(-8deg); }
}
@keyframes th-cart-shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-2px); }
  40% { transform: translateX(2px); }
  60% { transform: translateX(-1.5px); }
  80% { transform: translateX(1.5px); }
}
@keyframes th-draw-stroke {
  to { stroke-dashoffset: 0; }
}
@keyframes th-dot-pulse {
  0%, 100% { transform: scale(1); opacity: 0.55; }
  50% { transform: scale(1.35); opacity: 1; }
}
@keyframes th-burger-wave {
  0%, 100% { transform: translateX(0); }
  50% { transform: translateX(3px); }
}
@keyframes th-burger-bounce-line {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-2px); }
}

.th-icon--bag-bounce { animation: th-bag-bounce 1.6s ease-in-out infinite; }
.th-icon--bag-pulse { animation: th-bag-pulse 1.4s ease-in-out infinite; }
.th-icon--bag-float { animation: th-bag-float 2.2s ease-in-out infinite; }
.th-icon--bag-spin { animation: th-bag-spin 2.4s ease-in-out infinite; }
.th-icon--bag-pop { animation: th-bag-pop 1.8s ease-in-out infinite; }
.th-icon--cart-wiggle { animation: th-cart-wiggle 1.5s ease-in-out infinite; }
.th-icon--cart-swing { animation: th-cart-swing 1.8s ease-in-out infinite; transform-origin: top center; }
.th-icon--cart-shake { animation: th-cart-shake 1.2s ease-in-out infinite; }
.th-icon--cart-pulse { animation: th-bag-pulse 1.4s ease-in-out infinite; }

.th-icon--bag-draw .th-icon__draw,
.th-icon--cart-draw .th-icon__draw {
  stroke-dasharray: 80;
  stroke-dashoffset: 80;
  animation: th-draw-stroke 1.4s ease forwards infinite;
  animation-direction: alternate;
}

a:hover > .th-icon--bag-bounce,
button:hover > .th-icon--bag-bounce,
a:hover .th-icon--bag-bounce,
button:hover .th-icon--bag-bounce { animation-duration: 0.7s; }

a:hover > .th-icon--cart-wiggle,
button:hover > .th-icon--cart-wiggle,
a:hover .th-icon--cart-wiggle,
button:hover .th-icon--cart-wiggle { animation-duration: 0.55s; }

/* ---- Menu animations ---- */
.th-icon--hamburger-pulse .th-burger i {
  animation: th-bag-pulse 1.3s ease-in-out infinite;
}
.th-icon--hamburger-pulse .th-burger i:nth-child(2) { animation-delay: 0.12s; }
.th-icon--hamburger-pulse .th-burger i:nth-child(3) { animation-delay: 0.24s; }

.th-icon--hamburger-bounce .th-burger i {
  animation: th-burger-bounce-line 1s ease-in-out infinite;
}
.th-icon--hamburger-bounce .th-burger i:nth-child(2) { animation-delay: 0.1s; }
.th-icon--hamburger-bounce .th-burger i:nth-child(3) { animation-delay: 0.2s; }

.th-icon--hamburger-wave .th-burger i {
  animation: th-burger-wave 1s ease-in-out infinite;
}
.th-icon--hamburger-wave .th-burger i:nth-child(2) { animation-delay: 0.12s; }
.th-icon--hamburger-wave .th-burger i:nth-child(3) { animation-delay: 0.24s; }

.th-icon--hamburger-spin { animation: th-bag-spin 2.2s ease-in-out infinite; }

.th-icon--hamburger-slide .th-burger i:nth-child(1) { width: 70%; margin-inline-start: auto; }
.th-icon--hamburger-slide .th-burger i:nth-child(3) { width: 70%; }
.th-icon--hamburger-slide:hover .th-burger i:nth-child(1),
button:hover .th-icon--hamburger-slide .th-burger i:nth-child(1) {
  width: 100%;
}
.th-icon--hamburger-slide:hover .th-burger i:nth-child(3),
button:hover .th-icon--hamburger-slide .th-burger i:nth-child(3) {
  width: 100%;
}

.th-icon--hamburger-arrow .th-burger i:nth-child(1),
.th-icon--hamburger-arrow .th-burger i:nth-child(3) {
  width: 70%;
}
.th-icon--hamburger-arrow:hover .th-burger i:nth-child(1),
button:hover .th-icon--hamburger-arrow .th-burger i:nth-child(1) {
  transform: translateY(5px) rotate(35deg);
  width: 55%;
  margin-inline-start: auto;
}
.th-icon--hamburger-arrow:hover .th-burger i:nth-child(3),
button:hover .th-icon--hamburger-arrow .th-burger i:nth-child(3) {
  transform: translateY(-5px) rotate(-35deg);
  width: 55%;
  margin-inline-start: auto;
}

/* Morph to X on open / hover */
.th-icon--hamburger-to-x:hover .th-burger i:nth-child(1),
button:hover .th-icon--hamburger-to-x .th-burger i:nth-child(1),
button[aria-expanded="true"] .th-icon--hamburger-to-x .th-burger i:nth-child(1),
.is-open .th-icon--hamburger-to-x .th-burger i:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}
.th-icon--hamburger-to-x:hover .th-burger i:nth-child(2),
button:hover .th-icon--hamburger-to-x .th-burger i:nth-child(2),
button[aria-expanded="true"] .th-icon--hamburger-to-x .th-burger i:nth-child(2),
.is-open .th-icon--hamburger-to-x .th-burger i:nth-child(2) {
  opacity: 0;
  transform: scaleX(0);
}
.th-icon--hamburger-to-x:hover .th-burger i:nth-child(3),
button:hover .th-icon--hamburger-to-x .th-burger i:nth-child(3),
button[aria-expanded="true"] .th-icon--hamburger-to-x .th-burger i:nth-child(3),
.is-open .th-icon--hamburger-to-x .th-burger i:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

@media (prefers-reduced-motion: reduce) {
  .th-icon--anim,
  .th-icon--anim .th-burger i,
  .th-icon--dots-pulse i,
  .th-icon__draw {
    animation: none !important;
  }
}
