@reference "./app.css";

.video-container {
  @apply relative w-full h-auto overflow-hidden transition-all duration-300 ease-in-out;
}

.video-container picture {
  @apply col-span-full;
  grid-row: 1 / 1;
  grid-column: 1 / -1;
}

.video-container.static-fallback {
  @apply bg-transparent;
}

/* Video element */
.project-video {
  @apply relative w-full h-full object-cover object-center transition-all duration-500 ease-in rounded-lg z-[4];
  will-change: transform, opacity;
}

.project-video.loaded {
  @apply opacity-100 scale-100;
}

.project-video.hidden {
  @apply opacity-0 scale-105;
}

/* Skeleton Loading */
.video-skeleton {
  @apply absolute inset-0 w-full h-full min-h-[300px] overflow-hidden z-20;
  background: linear-gradient(90deg, #f0f0f0 25%, #e0e0e0 50%, #f0f0f0 75%);
  background-size: 200% 100%;
  will-change: background-position;
}

.video-skeleton.loading {
  animation: skeleton-shimmer 2s infinite;
}

.skeleton-content {
  @apply relative w-full h-full bg-gray-50 flex items-center justify-center;
}

.skeleton-shimmer {
  @apply absolute top-0 -left-full w-full h-full;
  background: linear-gradient(90deg,
      transparent,
      rgba(255, 255, 255, 0.4),
      transparent);
  animation: skeleton-slide 2s infinite;
}

/* Keyframes para animaciones (no se pueden convertir a @apply) */
@keyframes skeleton-shimmer {
  0% {
    background-position: -200% 0;
  }

  100% {
    background-position: 200% 0;
  }
}

@keyframes skeleton-slide {
  0% {
    left: -100%;
  }

  100% {
    left: 100%;
  }
}

/* Video FadeIn Animation */
.video-fadein {
    animation: videoFadeIn 0.6s ease-in-out forwards;
}

@keyframes videoFadeIn {
    from {
        opacity: 0;
        transform: scale(1.02);
    }
    to {
        opacity: 1;
        transform: scale(1);
    }
}

/* Video Overlay */
.video-overlay {
  @apply z-10 transition-opacity duration-300 absolute top-0 left-0 w-full right-0;
}

.video-title {
  @apply text-4xl font-bold mb-2 leading-tight;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
}

.video-subtitle {
  @apply text-xl font-normal opacity-90 leading-relaxed;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.5);
}

/* Play Button */
.video-play-button {
  @apply absolute top-1/2 left-1/2 w-20 h-20 bg-white/90 border-none rounded-full flex items-center justify-center cursor-pointer transition-all duration-300 z-[4];
  transform: translate(-50%, -50%);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  will-change: transform;
}

.video-play-button:hover {
  @apply bg-white scale-110;
  box-shadow: 0 6px 25px rgba(0, 0, 0, 0.4);
}

.video-play-button:active {
  @apply scale-95;
}

.video-play-button:focus {
  @apply outline-2 outline-blue-500 outline-offset-2;
}

.play-icon {
  @apply w-8 h-8 text-gray-800 ml-1;
}

/* Fallback Image */
.video-fallback {
  @apply hidden w-full h-auto;
}

.fallback-image {
  @apply w-full h-auto max-h-[720px] object-cover object-center rounded-lg;
}

/* Estados de hover para contenedores */
.video-container:hover .video-overlay {
  @apply opacity-100;
}

.video-container:hover .project-video {
  @apply scale-[1.02];
}

.video-container:focus-within .video-overlay {
  @apply opacity-100;
}

/* Estados de carga y error */
.video-container.loaded {
  animation: fadeInUp 0.6s ease-out;
}

.video-container.loading {
  @apply pointer-events-none;
}

.video-container.error {
  @apply bg-red-100 border-2 border-red-200;
}

/* Utilidades adicionales para extensibilidad */
.video-container.full-width {
  @apply w-screen;
  margin-left: calc(-50vw + 50%);
  border-radius: 0;
}

.video-container.rounded-lg {
  @apply rounded-lg;
}

.video-container.rounded-xl {
  @apply rounded-xl;
}

.video-container.shadow-lg {
  @apply shadow-lg;
}

.video-container.shadow-xl {
  @apply shadow-xl;
}

/* Responsive Design */
@media (max-width: 768px) {
  .video-overlay {
    @apply p-6;
  }

  .video-title {
    @apply text-2xl;
  }

  .video-subtitle {
    @apply text-base;
  }

  .video-play-button {
    @apply w-15 h-15;
  }

  .play-icon {
    @apply w-6 h-6;
  }

  .video-skeleton {
    @apply min-h-[200px];
  }
}

@media (max-width: 480px) {
  .video-overlay {
    @apply p-4;
  }

  .video-title {
    @apply text-xl;
  }

  .video-subtitle {
    @apply text-sm;
  }

  .video-play-button {
    @apply w-12 h-12;
  }

  .play-icon {
    @apply w-5 h-5;
  }
}

/* Modo de alto contraste */
@media (prefers-contrast: high) {
  .video-overlay {
    background: linear-gradient(to top,
        rgba(0, 0, 0, 0.95) 0%,
        rgba(0, 0, 0, 0.7) 50%,
        transparent 100%);
  }

  .video-play-button {
    @apply bg-white border-2 border-black;
  }
}

/* Reducir movimiento para usuarios sensibles */
@media (prefers-reduced-motion: reduce) {

  .project-video,
  .video-play-button,
  .video-overlay,
  .video-skeleton {
    @apply transition-none;
    animation: none;
  }

  .video-container:hover .project-video {
    @apply scale-100;
  }
}

/* Modo oscuro */
@media (prefers-color-scheme: dark) {
  .video-skeleton {
    background: linear-gradient(90deg, #374151 25%, #4b5563 50%, #374151 75%);
  }

  .skeleton-content {
    @apply bg-gray-800;
  }

  .video-container.error {
    @apply bg-red-900 border-red-800;
  }
}
