/* Image With Hints Widget */

.iwh {
  width: 100%;
  display: grid;
  grid-template-rows: auto auto auto;
  gap: 16px;
  align-items: center;
  justify-items: center;
}
@media (max-width: 1024px) {
  .iwh {
    gap: 0px;
  }
}

.iwh__top,
.iwh__bottom {
  width: 100%;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}

@media (min-width: 768px) {
  .iwh__top {
    margin-bottom:-300px;
  }
  .iwh__bottom {
    margin-top:-300px;
  }
}

.iwh__center {
  width: 100%;
  display: flex;
  justify-content: center;
}

@media (max-width: 1024px) {
  .iwh__center {
    margin-top:-32px;
    margin-bottom:-32px;
  }
}

.iwh__image img {
  display: block;
  max-width: 100%;
  height: auto;
}

.iwh__hint {
  display: inline-flex;
  flex-direction: column;
  gap: 16px;
  align-items: flex-start;
  min-width: 0;
  --iwh-dodge-x: 0px;
  --iwh-dodge-y: 0px;
  transform: translate3d(var(--iwh-dodge-x), var(--iwh-dodge-y), 0);
  transition: transform 160ms ease;
  will-change: transform;
}

/* Bubble */
.iwh__bubble {
  background-color: var(--primr);
  border-radius: 12px;
  padding: 10px 12px 11px 12px;
  color: var(--white);
  text-align: center;
  line-height: 140%;
  max-width: 100%;
  animation: iwh-wobble-bubble 5.5s ease-in-out infinite;
  transform-origin: 50% 50%;
}

/* Desktop bubble max width */
@media (min-width: 768px) {
  .iwh__bubble {
    max-width: 184px;
  }
}

/* Make each corner slightly out-of-sync */
.iwh__hint--top_left .iwh__bubble,
.iwh__hint--top_left .iwh__pointer-svg {
  animation-delay: -0.8s;
}
.iwh__hint--top_right .iwh__bubble,
.iwh__hint--top_right .iwh__pointer-svg {
  animation-delay: -1.9s;
}
.iwh__hint--bottom_left .iwh__bubble,
.iwh__hint--bottom_left .iwh__pointer-svg {
  animation-delay: -2.7s;
}
.iwh__hint--bottom_right .iwh__bubble,
.iwh__hint--bottom_right .iwh__pointer-svg {
  animation-delay: -3.4s;
}

@keyframes iwh-wobble-bubble {
  0% { transform: translate3d(0, 0, 0) rotate(-1.2deg); }
  25% { transform: translate3d(1.1px, -1.0px, 0) rotate(1.2deg); }
  50% { transform: translate3d(-1.0px, 1.1px, 0) rotate(-0.4deg); }
  75% { transform: translate3d(0.9px, 0.5px, 0) rotate(0.8deg); }
  100% { transform: translate3d(0, 0, 0) rotate(-1.2deg); }
}

@keyframes iwh-wobble-pointer {
  0% { transform: rotate(0deg) translate3d(0, 0, 0); }
  30% { transform: rotate(1.4deg) translate3d(0.7px, -1.1px, 0); }
  60% { transform: rotate(-1.4deg) translate3d(-0.7px, 1.1px, 0); }
  100% { transform: rotate(0deg) translate3d(0, 0, 0); }
}

/* Pointer */
.iwh__pointer {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transform-origin: 50% 50%;
}

.iwh__pointer-svg {
  width: 56px;
  height: 56px;
  display: block;
  animation: iwh-wobble-pointer 4.4s ease-in-out infinite;
  transform-origin: 50% 50%;
}

/* Desktop positioning alignment */
.iwh__hint--top_left,
.iwh__hint--bottom_left {
  justify-self: start;
  justify-content: flex-start;
}

.iwh__hint--top_right,
.iwh__hint--bottom_right {
  justify-self: end;
  justify-content: flex-end;
}



/* Match pointer to bubble inner edge (edge closest to center image) */
.iwh__hint--top_left .iwh__pointer,
.iwh__hint--bottom_left .iwh__pointer {
  align-self: flex-end; /* inner edge is bubble's right edge */
}

.iwh__hint--top_right .iwh__pointer,
.iwh__hint--bottom_right .iwh__pointer {
  align-self: flex-start; /* inner edge is bubble's left edge */
}

/* Pointer rotation: base SVG points down-right */
.iwh__hint--top_left .iwh__pointer {
  transform: rotate(0deg);
}

.iwh__hint--top_right .iwh__pointer {
  transform: scaleX(-1);
}

.iwh__hint--bottom_left .iwh__pointer {
  transform: scaleY(-1);
}

.iwh__hint--bottom_right .iwh__pointer {
  transform: rotate(180deg);
}

/* Mobile behavior */
@media (max-width: 767px) {
  .iwh__top,
  .iwh__bottom {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .iwh__hint {
    width: 100%;
    align-items: stretch;
  }

  .iwh__bubble {
    width: 100%;
    max-width: 100%;
  }

  /* Only show the "inner" pointer (closest to center image):
   * - Top stack: keep pointer only on the last hint (closest to image).
   * - Bottom stack: keep pointer only on the first hint (closest to image).
   */
  .iwh__top .iwh__hint:not(:last-child) .iwh__pointer {
    display: none;
  }

  .iwh__bottom .iwh__hint:not(:first-child) .iwh__pointer {
    display: none;
  }

  /* On mobile: stack bubbles, keep readable alignment */
  .iwh__hint--top_right,
  .iwh__hint--bottom_right {
    justify-self: start;
    justify-content: flex-start;
  }

  /* Mobile pointer directions:
   * top hints: down-right
   * bottom hints: up-left
   */
  .iwh__top .iwh__pointer {
    transform: rotate(0deg) !important;
  }

  .iwh__bottom .iwh__pointer {
    transform: rotate(180deg) !important;
  }

  /* No wobble on mobile */
  .iwh__bubble,
  .iwh__pointer-svg {
    animation: none !important;
  }
}

