:root {
  --media-aspect-video: 16 / 9;
  --media-aspect-image: 16 / 9;
  --media-icon-size: 1.75rem;
}

.media-embed {
  overflow: hidden;
  position: relative;
  display: grid;
  place-content: center;
  padding: var(--space-sm) 0;
}

.media-embed--video {
  aspect-ratio: var(--media-aspect-video);
}

.media-embed--image {
  min-height: var(--media-min-height);
}

.media-embed--image.media-embed--loading {
  aspect-ratio: var(--media-aspect-image);
}

.media-embed--loading {
  background: rgba(0, 0, 0, 0.03);
}

.dark .media-embed--loading {
  background: rgba(255, 255, 255, 0.03);
}

.media-embed--error {
  background: color-mix(in oklch, var(--destructive) 10%, transparent);
}

.media-embed img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: contain;
}

.media-embed--loading img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.media-embed iframe {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
}

.media-status {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.5rem;
}

.media-embed--loading .media-status {
  color: color-mix(in oklch, var(--muted-foreground) 50%, transparent);
  opacity: 0.6;
}

.media-embed:not(.media-embed--loading) .media-placeholder {
  display: none;
}

.media-embed--error .media-status {
  color: var(--destructive);
}

.media-status svg {
  width: var(--media-icon-size);
  height: var(--media-icon-size);
}


.media-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.05),
      transparent);
  transform: translateX(-100%);
  animation: shimmer 2s infinite linear;
  animation-fill-mode: both;
  will-change: transform;
}

@keyframes shimmer {
  to {
    transform: translateX(100%);
  }
}

.media-loading-text {
  font-size: 0.875rem;
  font-weight: 500;
  display: block;
  text-align: center;
}

.loading-dots {
  display: inline-block;
  width: 1.5em;
  text-align: left;
}

.loading-dots::after {
  content: '';
  animation: loading-dots 1.5s infinite;
}

@keyframes loading-dots {

  0%,
  20% {
    content: '';
  }

  40% {
    content: '.';
  }

  60% {
    content: '..';
  }

  80%,
  100% {
    content: '...';
  }
}

