/*
 * Icon badge (shared by the icon blocks)
 * Split out of the theme stylesheet so it loads only where it is needed.
 */

/* ---------------------------------------------------------------- Icon badge */

/*
 * A tinted disc holding a brand icon. On hover the logo's coral and teal rings
 * ripple outward. Shared by the Brand Icon, Icon Card and Stat blocks.
 */
.psychwit-badge {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--psychwit-badge-size, 74px);
  height: var(--psychwit-badge-size, 74px);
  flex: 0 0 auto;
}

.psychwit-badge__disc {
  position: relative;
  z-index: 1;
  width: var(--psychwit-badge-size, 74px);
  height: var(--psychwit-badge-size, 74px);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.psychwit-badge__rings {
  position: absolute;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
}

.psychwit-badge__ring {
  position: absolute;
  /* Fill the badge exactly with the border inside, so the ring is concentric
   * with the icon. inset:0 + border-box keeps its centre on the badge centre;
   * a fixed width plus a content-box border would offset it by the border. */
  inset: 0;
  box-sizing: border-box;
  border-radius: 50%;
  pointer-events: none;
  transform-origin: center;
  /* Hidden until the animation drives it, so it never sits as a static ring. */
  opacity: 0;
  animation: psychwit-ripple 2.6s ease-out infinite;
}

.psychwit-badge__ring:nth-child(1) {
  border: 3px solid var(--wp--preset--color--coral);
}

.psychwit-badge__ring:nth-child(2) {
  border: 3px solid var(--wp--preset--color--teal);
  animation-delay: 1.3s;
}

.psychwit-icon-card:hover .psychwit-badge__rings,
.psychwit-stat:hover .psychwit-badge__rings,
.psychwit-value-card:hover .psychwit-badge__rings,
.psychwit-brand-icon:hover .psychwit-badge__rings {
  display: flex;
}

@keyframes psychwit-ripple {
  0% {
    transform: scale(0.55);
    opacity: 0.9;
  }
  100% {
    transform: scale(1.3);
    opacity: 0;
  }
}

@media (prefers-reduced-motion: reduce) {
  /*
   * The ripple is decorative. Under reduced motion, drop it entirely rather
   * than freeze a ring at full opacity (which reads as a solid border around
   * the icon). The card lift and shadow still convey the hover.
   */
  .psychwit-badge__rings {
    display: none !important;
  }
}

/* The badge straddles the card's top edge. */
.psychwit-icon-card .psychwit-badge {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translate(-50%, -50%);
}

.psychwit-value-card .psychwit-badge {
  margin-bottom: 20px;
}

.psychwit-empty .psychwit-badge {
  --psychwit-badge-size: 80px;
  margin-left: auto;
  margin-right: auto;
}
