/* A clear window in the gem surface makes room for the action label. */
:where(.hecwet-kits__card, .kit) { --hw-gem-sweep-delay: 1.15s; }
:where(.hecwet-kits__card, .kit):nth-child(3n + 2) { --hw-gem-sweep-delay: 2.85s; }
:where(.hecwet-kits__card, .kit):nth-child(3n + 3) { --hw-gem-sweep-delay: 4.55s; }

:is(
  #MainContent .hw-jewel-intro .hw-intro__button,
  #MainContent .hecwet-kits__action,
  #MainContent .hw-purchase :is(.add-to-cart-button, .hecwet-buy-now__button),
  body .sticky-add-to-cart__button,
  :is(#MainContent .cart-page, #cart-drawer) .cart__checkout-button,
  .hw-gem-button
) {
  --hw-gem-label-light: linear-gradient(
    90deg,
    transparent,
    #fff6fc90 17%,
    #fff8fddf 31%,
    #fff8fdf5 44% 56%,
    #fff8fddf 69%,
    #fff6fc90 83%,
    transparent
  );
  --hw-gem-bevel: linear-gradient(180deg, #fffc 0, #fff2 14%, transparent 35% 70%, #a83c6d22 94%, #fff9);
  --hw-gem-baguette-fallback: repeating-conic-gradient(from 16deg at 50% 50%, #f6aace 0 28deg, #77395744 28deg 58deg, #ffe9f6 58deg 97deg, #ffd0e5 97deg 149deg);
  --hw-gem-shell: inset 0 0 0 1px #fff9, inset 0 1px 0 #fff, inset 0 -2px 0 #a1457048, 0 2px 4px #9551722e;
  --hw-gem-sweep: linear-gradient(112deg, transparent 43%, #bce9ff45 46%, #fff9 49% 51%, #ffe2f854 55%, transparent 57%);
  --hw-gem-sweep-start: right center, center, center, center;
  --hw-gem-sweep-end: left center, center, center, center;
  min-height: 44px;
  border: 1px solid #95526f;
  border-radius: 9px;
  color: #50253c;
  background-color: #f6c2d9;
  background-image:
    var(--hw-gem-sweep),
    var(--hw-gem-label-light),
    var(--hw-gem-bevel),
    var(--hw-button-baguette, var(--hw-gem-baguette-fallback));
  background-position: var(--hw-gem-sweep-start);
  background-size: 300% 100%, 100% 100%, 100% 100%, auto 76px;
  background-repeat: no-repeat, no-repeat, no-repeat, repeat;
  box-shadow: var(--hw-gem-shell);
  text-shadow: 0 1px .5px #fff;

  &:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) {
    animation: hecwet-gem-light 6.4s linear var(--hw-gem-sweep-delay, .32s) infinite;
  }

  /* Keep the stepped paving mask defined by the purchase stylesheet. */
  &::after {
    background-image: var(--hw-gem-label-light), var(--hw-button-gems, url("hecwet-pave.svg"));
    background-size: 100% 100%, auto 102px;
    background-repeat: no-repeat, repeat;
    background-position: center, left top;
    opacity: 1;
  }

  &:not(:disabled):focus-visible {
    color: #50253c;
    outline: 2px solid #773953;
    outline-offset: 3px;
  }

  &:is(:focus-visible, :active) {
    --hw-gem-sweep: linear-gradient(transparent, transparent);
    animation-play-state: paused;
  }

  &:is(.hecwet-buy-now__button, .cart__checkout-button, .hw-gem-button--primary) {
    --hw-gem-sweep-delay: 2.15s;
    border-color: #9b3f6e;
    font-weight: 750;
  }

  &:is(:disabled, [aria-disabled="true"]) {
    opacity: .62;
    cursor: default;
    background-image: none;
    background-color: #f7ebf1;
    text-shadow: none;
  }
  &:is(:disabled, [aria-disabled="true"])::after { content: none; }

  @media (hover: hover) and (pointer: fine) {
    &:not(:disabled, [aria-disabled="true"]):hover {
      --hw-gem-sweep: linear-gradient(transparent, transparent);
      animation-play-state: paused;
      color: #50253c;
      box-shadow: var(--hw-gem-shell);
    }
  }

  @media (prefers-reduced-motion: reduce) {
    &:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) { animation: none; }
    &, &:not(:disabled):is(:hover, :active) { translate: none; scale: none; transition: none; }
    &::after { transition: none; }
  }

  @media (prefers-reduced-transparency: reduce) {
    &:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) { animation: none; }
    &, &:not(:disabled):is(:hover, :focus-visible) { background: #f9deea; }
    &::after { content: none; }
  }

  @media (forced-colors: active) {
    &:not(:disabled, [aria-disabled="true"], [aria-busy="true"]) { animation: none; }
    &, &:not(:disabled):is(:hover, :focus-visible) {
      background: ButtonFace;
      border-color: ButtonText;
      color: ButtonText;
      box-shadow: none;
      text-shadow: none;
    }
    &:is(a), &:is(a):not(:disabled):is(:hover, :focus-visible) { color: LinkText; border-color: LinkText; }
    &:focus-visible { outline-color: Highlight; }
    &:is(:disabled, [aria-disabled="true"]) { opacity: 1; color: GrayText; border-color: GrayText; }
    &::after { content: none; }
  }
}

/* One brief pass, then the glass stays still for the rest of the cycle. */
@keyframes hecwet-gem-light {
  0%, 8% { background-position: var(--hw-gem-sweep-start); }
  21%, 100% { background-position: var(--hw-gem-sweep-end); }
}
