/* ===== MEDIA SYSTEM ===== */
/* Centralized media management with aspect ratios and responsive behavior */

/* Media System Notes:
Consistency: All videos/images follow same aspect ratios
Swappable: Easy A/B testing of content
Responsive: Media adapts to containers seamlessly
Themed: Future "warm theme" vs "minimal theme" media sets
Scalable: Add new media categories as site grows 
*/

/* ===== CORE MEDIA CONTAINERS ===== */

/* Base media container */
.media-base {
  position: relative;
  overflow: hidden;
  display: block;
  width: 100%;
}

/* Video containers */
.media-video {
  position: relative;
  width: 100%;
  height: 100%;
  overflow: hidden;
}

.media-video video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

/* Image containers */
.media-image {
  position: relative;
  width: 100%;
  overflow: hidden;
  display: block;
}

.media-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  transition: transform var(--transition-normal);
}

/* ===== ASPECT RATIO SYSTEM ===== */

/* 16:9 - Standard HD video/hero images */
.media-16-9 {
  aspect-ratio: 16/9;
}

/* 4:3 - Portrait photos, vintage family photos */
.media-4-3 {
  aspect-ratio: 4/3;
}

/* 1:1 - Square format, profile photos */
.media-1-1 {
  aspect-ratio: 1/1;
}

/* 3:2 - Traditional photography */
.media-3-2 {
  aspect-ratio: 3/2;
}

/* 21:9 - Cinematic/banner */
.media-21-9 {
  aspect-ratio: 21/9;
}

/* Portrait ratios */
.media-2-3 {
  aspect-ratio: 2/3;
}

.media-3-4 {
  aspect-ratio: 3/4;
}

/* ===== SIZE VARIANTS ===== */

/* Thumbnail sizes */
.media-thumb-xs { max-width: 60px; }
.media-thumb-sm { max-width: 120px; }
.media-thumb-md { max-width: 240px; }
.media-thumb-lg { max-width: 360px; }

/* Standard sizes */
.media-sm { max-width: 320px; }
.media-md { max-width: 640px; }
.media-lg { max-width: 960px; }
.media-xl { max-width: 1280px; }
.media-full { width: 100%; }

/* ===== PLACEHOLDER SYSTEM ===== */

.media-placeholder {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  background: 
    repeating-conic-gradient(var(--gray-2) 0% 25%, var(--gray-0) 25% 50%) 
    50% / 20px 20px;
  color: var(--color-tertiary);
  font-family: var(--font-mono);
  font-size: var(--text-sm);
  font-weight: var(--font-medium);
  text-align: center;
  border: var(--border-width-1) solid var(--border-primary);
  transition: all var(--transition-fast);
}

.media-placeholder:hover {
  background: 
    repeating-conic-gradient(var(--gray-3) 0% 25%, var(--gray-1) 25% 50%) 
    50% / 20px 20px;
  color: var(--color-secondary);
}

/* ===== MEDIA CATEGORIES ===== */

/* Hero section media */
.hero-video {
  width: 100%;
  height: 100vh;
  min-height: 600px;
  max-height: 800px;
}

.hero-image {
  width: 100%;
  height: 60vh;
  min-height: 400px;
  max-height: 600px;
}

/* Profile/person photos */
.person-photo {
  aspect-ratio: 1/1;
  width: 100%;
  border-radius: 50%;
  overflow: hidden;
}

.person-photo .media-placeholder {
  border-radius: 50%;
}

/* Family tree specific */
.family-photo {
  aspect-ratio: 4/3;
  width: 100%;
}

/* Memorial/tribute photos */
.memorial-photo {
  aspect-ratio: 3/2;
  width: 100%;
}

/* Concept/feature images */
.concept-image {
  aspect-ratio: 16/9;
  width: 100%;
}

.purpose-image {
  aspect-ratio: 1/1;
  width: 100%;
}

/* ===== INTERACTIVE STATES ===== */

.media-interactive {
  cursor: pointer;
  transition: all var(--transition-normal);
}

.media-interactive:hover img {
  transform: scale(1.05);
}

.media-interactive:hover .media-placeholder {
  transform: scale(1.02);
}

/* Loading states */
.media-loading {
  background: var(--bg-secondary);
  position: relative;
}

.media-loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  border: 2px solid var(--border-primary);
  border-top: 2px solid var(--color-primary);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: translate(-50%, -50%) rotate(0deg); }
  100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* ===== RESPONSIVE MEDIA BEHAVIOR ===== */

/* Mobile optimizations */
@media (max-width: 48rem) {
  .hero-video {
    height: 70vh;
    min-height: 400px;
    max-height: 500px;
  }
  
  .hero-image {
    height: 50vh;
    min-height: 300px;
    max-height: 400px;
  }
  
  .media-thumb-xs { max-width: 40px; }
  .media-thumb-sm { max-width: 80px; }
  .media-thumb-md { max-width: 160px; }
  
  .media-placeholder {
    font-size: var(--text-xs);
  }
}

/* Tablet optimizations */
@media (min-width: 48rem) and (max-width: 64rem) {
  .hero-video {
    height: 80vh;
    min-height: 500px;
    max-height: 700px;
  }
}

/* ===== MEDIA OVERLAYS ===== */

.media-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.3);
  z-index: 1;
}

.media-overlay--dark {
  background: rgba(0, 0, 0, 0.6);
}

.media-overlay--light {
  background: rgba(255, 255, 255, 0.3);
}

.media-overlay--gradient {
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.8) 100%
  );
}

/* ===== ACCESSIBILITY ===== */

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .media-image img,
  .media-interactive,
  .media-placeholder {
    transition: none;
  }
  
  .media-interactive:hover img {
    transform: none;
  }
  
  .media-loading::after {
    animation: none;
  }
}

/* High contrast support */
@media (prefers-contrast: high) {
  .media-placeholder {
    background: var(--gray-0);
    border: var(--border-width-2) solid var(--gray-10);
    color: var(--gray-10);
  }
  
  .media-overlay {
    background: rgba(0, 0, 0, 0.8);
  }
}

/* ===== FUTURE THEMING HOOKS ===== */

/* These will be overridden in themed CSS files */
.media-border-radius {
  border-radius: var(--radius-none); /* Minimal theme = 0 */
}

.media-shadow {
  box-shadow: var(--shadow-none); /* Minimal theme = none */
}

/* For future themes: */
/* .media-border-radius { border-radius: var(--radius-md); } */
/* .media-shadow { box-shadow: var(--shadow-lg); } */

/* ===== PRINT STYLES ===== */

@media print {
  .media-video,
  .media-loading {
    display: none;
  }
  
  .media-placeholder {
    background: none;
    border: 1px solid #000;
  }
  
  .media-image img {
    max-width: 100%;
    height: auto;
  }
}