/* === vir.group translation visual feedback === */
/* Stored in Mastodon Setting key `custom_css` (DB row, served at /custom.css). */

/* ------------------------------------------------------------------
 * 1. While the translation request is in flight.
 *
 * Mastodon doesn't toggle a class on the button during the fetch, so we
 * piggyback on `:focus`, which sticks from click until the user clicks
 * elsewhere or the button is replaced by the translated content. We run
 * a long-duration pulse (≈30 s of iterations) so it covers any realistic
 * AI translation latency. When translation lands the button is unmounted
 * and the animation simply stops.
 * ------------------------------------------------------------------ */
/* Give the button breathing room so the pulse + expanding ring don't get
   clipped by neighbouring layout. We deliberately do NOT set overflow on
   .status__content / .status__content__text — that breaks Mastodon's
   native long-post collapse ("Read more"), which relies on overflow:hidden
   + max-height. Action bars are siblings of .status__content, so visible
   overflow there is safe. The button itself is small and mid-content, so
   its ::after ring at inset:-5px stays well within .status__content's
   padding and never crosses the clip boundary. */
.status__content__translate-button {
  margin: 6px 8px 6px 0;
  overflow: visible;
}

.detailed-status__action-bar,
.status__action-bar {
  overflow: visible;
}

.status__content__translate-button:focus,
.status__content__translate-button:active {
  position: relative;
  outline: none;
  color: #6364ff !important;
  animation: virgPulseBtn 1.2s ease-in-out 25;
}

.status__content__translate-button:focus::after,
.status__content__translate-button:active::after {
  content: "";
  position: absolute;
  inset: -5px;
  border-radius: 6px;
  pointer-events: none;
  border: 2px solid #6364ff;
  animation: virgRingExpand 1.4s ease-out 22;
  opacity: 0;
}

@keyframes virgPulseBtn {
  0%   { box-shadow: 0 0 0 0 rgba(99, 100, 255, 0.55); }
  70%  { box-shadow: 0 0 0 10px rgba(99, 100, 255, 0); }
  100% { box-shadow: 0 0 0 0 rgba(99, 100, 255, 0); }
}

@keyframes virgRingExpand {
  0%   { transform: scale(1);    opacity: 0.7; }
  100% { transform: scale(1.15); opacity: 0;   }
}

/* ------------------------------------------------------------------
 * 2. When the translation arrives.
 *
 * The `.translate-button` wrapper appears in place of the click button.
 * Fade + soft blur reveal makes the swap feel intentional rather than
 * a sudden DOM change.
 * ------------------------------------------------------------------ */
.translate-button {
  animation: virgReveal 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes virgReveal {
  0%   { opacity: 0; transform: translateY(-3px); filter: blur(2px); }
  100% { opacity: 1; transform: translateY(0);    filter: blur(0);   }
}

/* ------------------------------------------------------------------
 * 3. The "Translated using vir.group" attribution.
 *
 * Subtle accent so the user always sees that the translation is fresh
 * and which provider produced it.
 * ------------------------------------------------------------------ */
/* Wrapper around the attribution — let the shimmer gradient breathe. */
.translate-button {
  margin: 5px;
  overflow: visible;
}

.translate-button__meta {
  position: relative;
  display: inline-block;
  padding: 5px 10px 5px 26px;
  margin: 5px;
  border-radius: 6px;
  background: linear-gradient(
    90deg,
    rgba(99, 100, 255, 0.12) 0%,
    rgba(99, 100, 255, 0.03) 60%,
    transparent 100%
  );
  background-size: 220% 100%;
  border-left: 3px solid #6364ff;
  font-size: 0.82em;
  font-weight: 500;
  line-height: 1.35;
  cursor: pointer;
  transition: background-color 0.2s, transform 0.12s;
  animation: virgShimmer 3s linear infinite;
}

.translate-button__meta:hover {
  background-color: rgba(99, 100, 255, 0.18);
  transform: translateY(-1px);
}

.translate-button__meta:focus-visible {
  outline: 2px solid #6364ff;
  outline-offset: 2px;
}

.translate-button__meta::before {
  content: "✨";
  position: absolute;
  left: 7px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.9em;
  animation: virgSpark 2.2s ease-in-out infinite;
}

@keyframes virgShimmer {
  0%   { background-position: -180% 0; }
  100% { background-position:  180% 0; }
}

@keyframes virgSpark {
  0%, 100% { opacity: 0.55; transform: translateY(-50%) rotate(0deg);   }
  50%      { opacity: 1;    transform: translateY(-50%) rotate(180deg); }
}


