/* Generic media tile used by capture cards (garage), browse thumbs,
 * and non-capture media (e.g. drive photos/videos). One style block
 * governs every media-tile surface that isn't the lightbox itself.
 *
 * Composition:
 *   .usermedia                 the tile container (clickable card)
 *     .usermedia-image         positioned wrapper for img/video
 *       <img>                  the thumbnail / poster
 *       .usermedia-video-badge optional play indicator (videos)
 *       .usermedia-actions     optional hover action bar
 *         .usermedia-action    individual action button
 *     .usermedia-body          optional caption/footer block
 *       .usermedia-sub         secondary text (date, byline, etc.) */

.usermedia {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
  text-decoration: none;
  color: inherit;
  display: flex;
  flex-direction: column;
  transition: border-color 120ms;
  cursor: pointer;
}

.usermedia:hover {
  border-color: var(--accent);
}

.usermedia:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.usermedia img {
  width: 100%;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  background: var(--panel-2);
  display: block;
}

.usermedia-image {
  position: relative;
}

/* Play-triangle badge for video tiles. Overlays the poster image so
 * users can tell which tiles play a video before they click through.
 * pointer-events none so clicks fall through to the underlying tile. */
.usermedia-video-badge {
  position: absolute;
  bottom: 8px;
  left: 8px;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  font-size: 14px;
  border-radius: 50%;
  pointer-events: none;
}

.usermedia-actions {
  position: absolute;
  top: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  opacity: 0;
  transition: opacity 120ms;
}

.usermedia:hover .usermedia-actions,
.usermedia-actions:focus-within {
  opacity: 1;
}

@media (hover: none), (pointer: coarse) {
  .usermedia-actions {
    opacity: 1;
  }
}

.usermedia-action {
  width: 28px;
  height: 28px;
  border: none;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.65);
  color: #fff;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.usermedia-action:hover {
  background: rgba(0, 0, 0, 0.85);
}

.usermedia-action svg {
  width: 16px;
  height: 16px;
}

.usermedia-action-delete:hover {
  background: #b13b3b;
}

/* Count badge overlaid on the thumb when a tile represents multiple
 * media items (e.g. a drive with several photos). Anchors to
 * .usermedia-image, which is position: relative. */
.usermedia-thumb-count {
  position: absolute;
  bottom: 4px;
  right: 4px;
  padding: 1px 6px;
  font-size: 11px;
  font-weight: 600;
  line-height: 1.4;
  color: #fff;
  background: rgba(0, 0, 0, 0.65);
  border-radius: 999px;
  pointer-events: none;
}

.usermedia-body {
  padding: 10px 12px;
}

.usermedia-sub {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
}
