/**
 * Unified animated product badge for all product-page heroes.
 * SSR-linked on every product page so first paint does not wait for
 * ProductPageBottom / handoff-specific icon CSS variants.
 *
 * Markup contract:
 *   <span class="sg-hero-icon sg-card-icon sg-product-{theme}" aria-hidden="true">
 *     <span class="sg-product-icon"><i></i><i></i><i></i>
 *       <span class="sg-product-core"><span lang="en">LABEL</span></span>
 *     </span>
 *   </span>
 */

:is(.sg-hero-label, .sg-card-icon, .premium-eyebrow, .hero-product-name, .eyebrow) {
  --sg-display: Manrope, Arial, sans-serif;
  --motion-delay: 0s;
}

/* Theme accents (same tokens as product recommendation cards) */
.sg-card-icon.sg-product-blue,
.sg-hero-icon.sg-product-blue { --accent: #5878ef; --accent-rgb: 88, 120, 239; }
.sg-card-icon.sg-product-purple,
.sg-hero-icon.sg-product-purple { --accent: #9466eb; --accent-rgb: 148, 102, 235; }
.sg-card-icon.sg-product-cyan,
.sg-hero-icon.sg-product-cyan { --accent: #39bfd2; --accent-rgb: 57, 191, 210; }
.sg-card-icon.sg-product-shared-hr,
.sg-hero-icon.sg-product-shared-hr { --accent: #58b9ec; --accent-rgb: 88, 185, 236; }
.sg-card-icon.sg-product-recruitment,
.sg-hero-icon.sg-product-recruitment { --accent: #65ba9b; --accent-rgb: 101, 186, 155; }
.sg-card-icon.sg-product-staffing,
.sg-hero-icon.sg-product-staffing { --accent: #d85b9e; --accent-rgb: 216, 91, 158; }
.sg-card-icon.sg-product-orange,
.sg-hero-icon.sg-product-orange { --accent: #fba31d; --accent-rgb: 251, 163, 29; }
.sg-card-icon.sg-product-cor,
.sg-hero-icon.sg-product-cor { --accent: #fde078; --accent-rgb: 253, 224, 120; }

.sg-product-icon {
  position: relative;
  z-index: 1;
  display: grid;
  justify-content: space-between;
  place-items: center;
  flex: 0 0 auto;
  width: 154px;
  height: 142px;
  margin: 0 auto 14px;
}

.sg-product-icon::before,
.sg-product-icon::after {
  content: "";
  position: absolute;
  left: 50%;
  top: 50%;
  border: 1px solid rgba(var(--accent-rgb), .35);
  border-radius: 50%;
  animation-delay: var(--motion-delay, 0s);
}

.sg-product-icon::before {
  width: 166px;
  height: 80px;
  transform: translate(-50%, -50%) rotate(-14deg);
  animation: sgOrbitA 13s linear var(--motion-delay, 0s) infinite;
}

.sg-product-icon::after {
  width: 148px;
  height: 112px;
  transform: translate(-50%, -50%) rotate(68deg);
  animation: sgOrbitB 17s linear var(--motion-delay, 0s) infinite reverse;
}

.sg-product-icon > i {
  position: absolute;
  left: 50%;
  top: 50%;
  width: 31px;
  height: 31px;
  margin: -4px 0 0 -4px;
  border: 2px solid rgba(255, 255, 255, .9);
  border-radius: 50%;
  background: rgba(255, 255, 255, .75);
  box-shadow:
    0 0 0 5px rgba(var(--accent-rgb), .09),
    0 0 17px rgba(var(--accent-rgb), .82);
}

.sg-product-icon > i:nth-child(1) {
  animation: sgMoonA 7.8s linear var(--motion-delay, 0s) infinite;
}
.sg-product-icon > i:nth-child(2) {
  animation: sgMoonB 10.6s linear calc(var(--motion-delay, 0s) - 1.1s) infinite reverse;
}
.sg-product-icon > i:nth-child(3) {
  animation: sgMoonC 13.4s linear calc(var(--motion-delay, 0s) - 2.2s) infinite;
}

.sg-product-core {
  position: relative;
  z-index: 2;
  display: grid;
  width: 92px;
  height: 92px;
  place-items: center;
  border-radius: 28px;
  transform: rotate(-7deg);
  background:
    linear-gradient(145deg, rgba(255, 255, 255, .35), transparent 42%),
    var(--accent);
  box-shadow:
    inset 0 0 0 1px rgba(255, 255, 255, .48),
    inset -3px -3px 7px rgba(255, 255, 255, .12),
    0 18px 36px rgba(var(--accent-rgb), .35),
    0 0 58px rgba(var(--accent-rgb), .2);
  animation: sgPlanetFloat 4.8s ease-in-out var(--motion-delay, 0s) infinite;
}

.sg-product-core::after {
  content: "";
  position: absolute;
  inset: 10px;
  border-radius: 22px;
  border: 1px solid rgba(255, 255, 255, .22);
  pointer-events: none;
}

.sg-product-core span {
  max-width: 76px;
  padding: 0 4px;
  transform: rotate(7deg);
  color: #fff;
  font: 700 10px/1.15 var(--sg-display, Manrope, Arial, sans-serif);
  letter-spacing: .045em;
  text-align: center;
}

@keyframes sgOrbitA {
  to { transform: translate(-50%, -50%) rotate(346deg); }
}
@keyframes sgOrbitB {
  to { transform: translate(-50%, -50%) rotate(428deg); }
}
@keyframes sgMoonA {
  0%, 100% { transform: translate(81px, 0) scale(1.12); opacity: 1; }
  25% { transform: translate(0, 39px) scale(.88); opacity: .8; }
  50% { transform: translate(-81px, 0) scale(.58); opacity: .5; }
  75% { transform: translate(0, -39px) scale(.82); opacity: .78; }
}
@keyframes sgMoonB {
  0%, 100% { transform: translate(0, -72px) scale(.72); opacity: .62; }
  25% { transform: translate(45px, 0) scale(1.08); opacity: 1; }
  50% { transform: translate(0, 72px) scale(.9); opacity: .85; }
  75% { transform: translate(-45px, 0) scale(.58); opacity: .48; }
}
@keyframes sgMoonC {
  0%, 100% { transform: translate(61px, -35px) scale(.78); opacity: .68; }
  25% { transform: translate(43px, 45px) scale(1.1); opacity: 1; }
  50% { transform: translate(-61px, 35px) scale(.78); opacity: .7; }
  75% { transform: translate(-43px, -45px) scale(.52); opacity: .42; }
}
@keyframes sgPlanetFloat {
  0%, 100% { transform: translateY(0) rotate(-7deg); }
  50% {
    transform: translateY(-7px) rotate(-3deg);
    box-shadow:
      inset 0 0 0 1px rgba(255, 255, 255, .48),
      inset -3px -3px 7px rgba(255, 255, 255, .12),
      0 24px 44px rgba(var(--accent-rgb), .4),
      0 0 68px rgba(var(--accent-rgb), .27);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sg-product-icon::before,
  .sg-product-icon::after,
  .sg-product-icon > i,
  .sg-product-core {
    animation: none;
  }
}

/* Badge-scale placement in any product hero label variant */
:is(
  #overview .sg-hero-label,
  .sg-product-hero .sg-hero-label,
  .sg-product-hero .premium-eyebrow,
  .sg-product-hero .hero-product-name,
  .sg-product-hero .eyebrow,
  .sg-service-hero .sg-hero-label
) > :is(.sg-card-icon, .sg-hero-icon) {
  position: relative;
  flex: 0 0 38px;
  width: 38px;
  height: 34px;
  margin: 0;
  display: inline-block;
  vertical-align: middle;
  --sg-display: Manrope, Arial, sans-serif;
  --motion-delay: 0s;
}

:is(
  #overview .sg-hero-label,
  .sg-product-hero .sg-hero-label,
  .sg-product-hero .premium-eyebrow,
  .sg-product-hero .hero-product-name,
  .sg-product-hero .eyebrow,
  .sg-service-hero .sg-hero-label
) :is(.sg-card-icon, .sg-hero-icon) > .sg-product-icon {
  position: absolute;
  top: 50%;
  left: 50%;
  justify-content: center;
  margin: 0;
  transform: translate(-50%, -50%) scale(.22);
}
