/* Enhanced Media Gallery Styles */
.media-gallery {
  margin: 2rem 0;
}

.media-gallery--grid {
  display: grid;
  gap: 1.5rem;
  grid-template-columns: repeat(var(--columns, 3), 1fr);
}

/* Responsive grid adjustments */
@media (max-width: 640px) {
  .media-gallery--grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .media-gallery--grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
  }
}

.media-gallery--masonry {
  columns: var(--columns, 3);
  column-gap: 1.5rem;
}

@media (max-width: 640px) {
  .media-gallery--masonry {
    columns: 1;
    column-gap: 1rem;
  }
}

@media (min-width: 641px) and (max-width: 1024px) {
  .media-gallery--masonry {
    columns: 2;
    column-gap: 1.25rem;
  }
}

.media-gallery--masonry .media-item {
  break-inside: avoid;
  margin-bottom: 1.5rem;
}

.media-item {
  position: relative;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
  transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.1);
}

.media-item:hover {
  transform: translateY(-8px) scale(1.02);
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
  border-color: rgba(94, 94, 255, 0.3);
}

.media-item__image,
.media-item__video {
  width: 100%;
  height: auto;
  display: block;
  transition: transform 0.6s cubic-bezier(0.215, 0.61, 0.355, 1);
}

.media-item:hover .media-item__image,
.media-item:hover .media-item__video {
  transform: scale(1.08);
}

.media-item__overlay {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.9));
  color: white;
  padding: 1.5rem;
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.215, 0.61, 0.355, 1);
  transform: translateY(20px);
}

.media-item:hover .media-item__overlay {
  opacity: 1;
  transform: translateY(0);
}

.media-item__tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.media-item__tag {
  background: rgba(94, 94, 255, 0.8);
  color: white;
  padding: 0.375rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 500;
  backdrop-filter: blur(10px);
  border: 1px solid rgba(94, 94, 255, 0.3);
  transition: all 0.3s ease;
}

.media-item__tag:hover {
  background: rgba(94, 94, 255, 1);
  transform: scale(1.05);
}

.media-item--video {
  aspect-ratio: 16/9;
}

.media-item--video .media-item__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Golden ratio proportions */
.media-item.golden-ratio {
  aspect-ratio: 1.618 / 1;
}

.media-item.golden-ratio-inverse {
  aspect-ratio: 1 / 1.618;
}

/* Enhanced empty state */
.media-gallery__empty {
  text-align: center;
  padding: 3rem 2rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 16px;
  color: #9ca3af;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
}

.media-gallery__empty p:first-child {
  font-size: 1.125rem;
  color: #d1d5db;
  margin-bottom: 0.5rem;
}

/* Enhanced debug info */
.media-gallery__debug {
  font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
}

/* Loading states */
.media-item__image[loading="lazy"] {
  opacity: 0;
  transition: opacity 0.3s ease;
}

.media-item__image[loading="lazy"].loaded {
  opacity: 1;
}

/* Focus states for accessibility */
.media-item:focus-within {
  outline: 2px solid rgba(94, 94, 255, 0.8);
  outline-offset: 2px;
}

/* Dark mode optimizations */
@media (prefers-color-scheme: dark) {
  .media-item {
    background: rgba(0, 0, 0, 0.3);
    border-color: rgba(255, 255, 255, 0.1);
  }
  
  .media-item:hover {
    background: rgba(0, 0, 0, 0.5);
    border-color: rgba(94, 94, 255, 0.5);
  }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .media-item {
    border-width: 2px;
    border-color: #ffffff;
  }
  
  .media-item__tag {
    background: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .media-item,
  .media-item__image,
  .media-item__video,
  .media-item__overlay,
  .media-item__tag {
    transition: none;
  }
  
  .media-item:hover {
    transform: none;
  }
}

