/* MotorHub — Interesting (like) control */

.mh-useful {
  margin: 1.75rem 0 0.5rem;
  padding: 1rem 0 0;
  border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem 1rem;
}

.mh-useful__btn {
  position: relative;
  isolation: isolate;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin: 0;
  padding: 0.55rem 1rem;
  border: 1px solid color-mix(in srgb, currentColor 22%, transparent);
  border-radius: 0.4rem;
  /* Beat GeneratePress button { color:#fff; background:#555 } — white text
     vanishes on our light surface in light theme. */
  color: var(--contrast, #222222) !important;
  background: color-mix(in srgb, var(--contrast, #222222) 5%, transparent);
  font: inherit;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.15s ease;
}

.mh-useful__btn:hover:not(:disabled),
.mh-useful__btn:focus:not(:disabled) {
  color: var(--contrast, #222222) !important;
  background: color-mix(in srgb, var(--contrast, #222222) 10%, transparent);
  border-color: color-mix(in srgb, var(--contrast, #222222) 35%, transparent);
}

.mh-useful__btn:active:not(:disabled) {
  transform: scale(0.98);
}

.mh-useful__btn:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}

.mh-useful__btn.is-liked,
.mh-useful__btn:disabled,
.mh-useful__btn.is-liked:hover,
.mh-useful__btn:disabled:hover {
  cursor: default;
  opacity: 0.92;
  color: var(--contrast, #222222) !important;
  border-color: color-mix(in srgb, #2a7a4b 55%, currentColor);
  background: color-mix(in srgb, #2a7a4b 12%, transparent);
}

html[data-mh-theme="dark"] .mh-useful__btn,
html[data-mh-theme="dark"] .mh-useful__btn:hover:not(:disabled),
html[data-mh-theme="dark"] .mh-useful__btn:focus:not(:disabled),
html[data-mh-theme="dark"] .mh-useful__btn.is-liked,
html[data-mh-theme="dark"] .mh-useful__btn:disabled {
  color: #e8eaed !important;
}

.mh-useful__icon {
  font-size: 1.05em;
  line-height: 1;
  display: inline-block;
}

/*
 * Turn-signal via ::after overlay — not button background.
 * GP + our light-theme rules fight animated `background` (flash vanishes on light).
 */
.mh-useful__btn.is-liked.is-thanks-pulse {
  transition: none;
  border-color: #e8a020;
}

.mh-useful__btn.is-liked.is-thanks-pulse::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  pointer-events: none;
  background: #f5a623;
  animation: mh-useful-blinker 2.4s linear 1;
}

.mh-useful__btn.is-liked.is-thanks-pulse > * {
  position: relative;
  z-index: 1;
}

.mh-useful__btn.is-liked.is-thanks-pulse .mh-useful__icon {
  animation: mh-useful-thumb 2.4s linear 1;
}

.mh-useful__count {
  min-width: 1.25em;
  padding: 0.1em 0.4em;
  border-radius: 0.3rem;
  background: color-mix(in srgb, currentColor 10%, transparent);
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 0.92em;
}

.mh-useful__thanks {
  font-size: 0.95em;
  opacity: 0;
  transform: translateY(4px);
  pointer-events: none;
  transition: opacity 0.35s ease, transform 0.35s ease;
}

.mh-useful__thanks.is-visible {
  opacity: 0.9;
  transform: translateY(0);
}

.mh-useful__thanks.is-leaving {
  opacity: 0;
  transform: translateY(-3px);
}

.mh-useful__thanks[hidden] {
  display: none !important;
}

/*
 * Opacity-only overlay: 3 even Mercedes-like blinks (~800ms each).
 * Works on light and dark — no fight with GP button background.
 */
@keyframes mh-useful-blinker {
  0%,
  100% {
    opacity: 0;
  }
  /* blink 1 */
  4% {
    opacity: 0.35;
  }
  10%,
  16% {
    opacity: 0.55;
  }
  22% {
    opacity: 0.28;
  }
  28%,
  33% {
    opacity: 0;
  }
  /* blink 2 */
  37% {
    opacity: 0.35;
  }
  43%,
  49% {
    opacity: 0.55;
  }
  55% {
    opacity: 0.28;
  }
  61%,
  66% {
    opacity: 0;
  }
  /* blink 3 */
  70% {
    opacity: 0.35;
  }
  76%,
  82% {
    opacity: 0.55;
  }
  88% {
    opacity: 0.28;
  }
  94% {
    opacity: 0;
  }
}

@keyframes mh-useful-thumb {
  0%,
  100%,
  28%,
  33%,
  61%,
  66%,
  94% {
    transform: scale(1);
    filter: none;
  }
  10%,
  16%,
  43%,
  49%,
  76%,
  82% {
    transform: scale(1.08);
    filter: drop-shadow(0 0 5px rgba(245, 166, 35, 0.7));
  }
}

@media (prefers-reduced-motion: reduce) {
  .mh-useful__btn,
  .mh-useful__thanks {
    transition: none;
  }

  .mh-useful__btn.is-liked.is-thanks-pulse::after,
  .mh-useful__btn.is-liked.is-thanks-pulse .mh-useful__icon {
    animation: none;
  }
}
