/* ==========================================================================
   Copy / download buttons on each thumbnail.

   Top-right. The Tag Spree checkbox sits in the same corner, but the two are
   never on screen together - these hide while picking - and the bottom edge
   belongs to the search-result tag strip.
   ========================================================================== */

.ma-actions {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  z-index: 3;
  display: flex;
  gap: 0.3rem;
  opacity: 0;
  transform: translateY(-3px);
  transition: opacity 0.15s ease, transform 0.15s ease;
}

.meme-item:hover .ma-actions,
.meme-item:focus-within .ma-actions {
  opacity: 1;
  transform: translateY(0);
}

/* No hover on touch, so the buttons have to be there from the start. */
@media (hover: none), (pointer: coarse) {
  .ma-actions {
    opacity: 1;
    transform: none;
  }
}


/* While picking memes for a Tag Spree a click means "pick" - get out of the
   way rather than sit there looking clickable. */
.meme-gallery.mt-picking .ma-actions {
  display: none;
}

.ma-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 1.85rem;
  height: 1.85rem;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 7px;
  background: rgba(0, 0, 0, 0.72);
  color: #fff;
  font: inherit;
  font-weight: 700;
  line-height: 1;
  /* The download one is an <a>, so it needs the link defaults taken off. */
  text-decoration: none;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease,
    transform 0.15s ease;
}

.ma-btn svg {
  width: 0.95rem;
  height: 0.95rem;
}

.ma-btn:hover {
  background: var(--sk-accent, #ff3df0);
  border-color: var(--sk-accent, #ff3df0);
  color: #000;
  transform: translateY(-1px);
}

.ma-btn:focus-visible {
  outline: 2px solid var(--sk-accent, #ff3df0);
  outline-offset: 2px;
}

.ma-btn.ma-ok {
  background: #19e3ff;
  border-color: #19e3ff;
  color: #000;
}

.ma-btn.ma-bad {
  background: #ff5c5c;
  border-color: #ff5c5c;
  color: #000;
}

@media (prefers-reduced-motion: reduce) {
  .ma-actions,
  .ma-btn {
    transition: none;
  }
}

/* Touch: copy only, sized for a thumb.
   Download goes because phones already have a better gesture for it - long
   press, Save image - and because two 44px targets in one corner of a small
   tile leaves nothing to hit but the wrong one. */
@media (pointer: coarse) {
  .ma-download {
    display: none;
  }

  .ma-actions {
    top: 0.3rem;
    right: 0.3rem;
  }

  /* See-through, so the button covers as little of the meme as possible.
     The icon carries its own shadow instead of sitting on a black plate -
     without it a white glyph disappears on a light meme. No backdrop blur
     here either: a dozen blurred layers on a phone is not worth it. */
  .ma-btn {
    width: 2.75rem;
    height: 2.75rem;
    border-radius: 10px;
    background: transparent;
    border-color: rgba(255, 255, 255, 0.45);
    backdrop-filter: none;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.55);
  }

  .ma-btn svg {
    width: 1.35rem;
    height: 1.35rem;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.95))
      drop-shadow(0 0 4px rgba(0, 0, 0, 0.7));
  }
}
