/* ==============================================
   16:9 HERO IMAGE IMPLEMENTATION
   ============================================== */

/* NEW: Main 16:9 container with modern CSS */
.hero-background-16-9 {
  width: 100%;
  aspect-ratio: 16 / 9;
  position: relative;
  overflow: hidden;
  background-color: #000; /* Fallback background */
}

/* Fallback for browsers without aspect-ratio support */
@supports not (aspect-ratio: 16 / 9) {
  .hero-background-16-9 {
    height: 0;
    padding-bottom: 56.25%; /* 16:9 = 56.25% */
    aspect-ratio: unset;
  }
}

/* NEW: 16:9 hero images with smart cropping */
.hero-image-16-9 {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover; /* Intelligent cropping */
  object-position: center; /* Default centering */
  transition: opacity 0.5s ease;
 
  /* Performance optimizations */
  will-change: opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
 
  /* Enhanced image rendering */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
}

/* Layer management for progressive loading */
.hero-image-16-9.thumbnail-layer {
  z-index: 1;
  opacity: 1;
}

.hero-image-16-9.hires-layer {
  z-index: 2;
  opacity: 0;
}

.hero-image-16-9.hires-layer.loaded {
  opacity: 1;
}

/* Smart positioning for different image orientations */
.hero-image-16-9.portrait {
  object-position: center top; /* Focus on top for portraits */
}

.hero-image-16-9.landscape {
  object-position: center center; /* Center for landscapes */
}

.hero-image-16-9.square {
  object-position: center center; /* Center for squares */
}

/* Loading placeholder pattern */
.hero-background-16-9::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    45deg,
    rgba(255, 255, 255, 0.05) 25%,
    transparent 25%
  ),
  linear-gradient(
    -45deg,
    rgba(255, 255, 255, 0.05) 25%,
    transparent 25%
  );
  background-size: 30px 30px;
  z-index: 0;
  opacity: 0.3;
  animation: shimmer 2s infinite linear;
}

@keyframes shimmer {
  0% { background-position: 0 0, 15px 15px; }
  100% { background-position: 30px 30px, 45px 45px; }
}

/* Hide placeholder when image loads */
.hero-image-16-9.loaded ~ .hero-background-16-9::before,
.hero-background-16-9:has(.hero-image-16-9.loaded)::before {
  opacity: 0;
}

/* ==============================================
   UPDATED OVERLAYS FOR 16:9 CONTAINER
   ============================================== */

/* Existing overlays work with new 16:9 container */
.scroll-fade-overlay-background,
.content-reading-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.scroll-fade-overlay-background {
  z-index: 10;
  background: linear-gradient(
    180deg,
    rgba(0, 0, 0, 0.5) 0%,
    rgba(0, 0, 0, 0.8) 20%,
    rgba(0, 0, 0, 0.92) 40%,
    rgba(0, 0, 0, 0.96) 60%,
    rgba(0, 0, 0, 0.98) 80%,
    rgba(0, 0, 0, 0.99) 100%
  );
  opacity: 0;
  transition: opacity 0.1s ease-out;
}

.content-reading-overlay {
  z-index: 5;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0) 0%,
    rgba(0, 0, 0, 0.2) 20%,
    rgba(0, 0, 0, 0.4) 40%,
    rgba(0, 0, 0, 0.6) 60%,
    rgba(0, 0, 0, 0.7) 80%,
    rgba(0, 0, 0, 0.8) 100%
  );
}

/* ==============================================
   RESPONSIVE 16:9 ADJUSTMENTS
   ============================================== */

/* Desktop: Maintain 16:9 */
@media (min-width: 1025px) {
  .hero-background-16-9 {
    aspect-ratio: 16 / 9;
  }
 
  @supports not (aspect-ratio: 16 / 9) {
    .hero-background-16-9 {
      padding-bottom: 56.25%;
    }
  }
}

/* Tablet: Keep 16:9 */
@media (max-width: 1024px) and (min-width: 769px) {
  .hero-background-16-9 {
    aspect-ratio: 16 / 9;
  }
 
  @supports not (aspect-ratio: 16 / 9) {
    .hero-background-16-9 {
      padding-bottom: 56.25%;
    }
  }
}

/* Mobile: Slightly taller ratio for better mobile viewing */
@media (max-width: 768px) {
  .hero-background-16-9 {
    aspect-ratio: 16 / 10; /* Slightly taller */
  }
 
  @supports not (aspect-ratio: 16 / 10) {
    .hero-background-16-9 {
      padding-bottom: 62.5%; /* 16:10 = 62.5% */
    }
  }
 
  /* Adjust positioning for mobile - focus on top for better subject framing */
  .hero-image-16-9 {
    object-position: center top;
  }
}

/* Small mobile: 4:3 ratio */
@media (max-width: 480px) {
  .hero-background-16-9 {
    aspect-ratio: 4 / 3; /* More square for small screens */
  }
 
  @supports not (aspect-ratio: 4 / 3) {
    .hero-background-16-9 {
      padding-bottom: 75%; /* 4:3 = 75% */
    }
  }
}

/* Enhanced text shadows for maximum legibility */
.patent-title.enhanced-accessibility {
  font-size: clamp(2rem, 5vw, 3.5rem);
  font-weight: 800; /* Extra bold for better definition */
  color: white;
  /* Multi-layer text shadow for superior legibility */
  text-shadow:
    0 2px 4px rgba(0,0,0,0.9),
    0 4px 8px rgba(0,0,0,0.7),
    0 8px 16px rgba(0,0,0,0.5),
    0 1px 2px rgba(0,0,0,1); /* Sharp edge definition */
  margin: 0;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-align: left;
  max-width: 100%;
  word-wrap: break-word;
}

/* Enhanced accessibility for all text content */
.enhanced-accessibility {
  text-shadow:
    0 1px 3px rgba(0,0,0,0.9),
    0 2px 6px rgba(0,0,0,0.7),
    0 4px 12px rgba(0,0,0,0.4);
  font-weight: 600; /* Semi-bold for better definition */
}

/* UPDATED: Enhanced metadata badges with box shadows - NO TEXT SHADOWS */
.patent-metadata-badges.enhanced-accessibility {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.metadata-badge {
  padding: 0.4rem 0.8rem;
  border-radius: 6px;
  font-size: 0.8rem;
  font-weight: 700;
  color: white;
  /* Enhanced backgrounds with stronger opacity for better contrast */
  background: rgba(255, 255, 255, 0.15);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.3);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  transition: all 0.3s ease;
  white-space: nowrap;
 
  /* REMOVED: Text shadows - relying on box shadows and backdrop blur */
  text-shadow: none;
 
  /* Box shadows for depth and visibility */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.3),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.metadata-badge:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: translateY(-2px);
 
  /* Enhanced hover shadow */
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.4),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.metadata-badge.patent-id {
  background: rgba(59, 130, 246, 0.4);
  border-color: rgba(59, 130, 246, 0.6);
  color: #E0F2FE;
 
  box-shadow:
    0 2px 8px rgba(59, 130, 246, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.metadata-badge.patent-id:hover {
  box-shadow:
    0 4px 12px rgba(59, 130, 246, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.metadata-badge.category {
  background: rgba(168, 85, 247, 0.4);
  border-color: rgba(168, 85, 247, 0.6);
  color: #F3E8FF;
 
  box-shadow:
    0 2px 8px rgba(168, 85, 247, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.metadata-badge.category:hover {
  box-shadow:
    0 4px 12px rgba(168, 85, 247, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.metadata-badge.recent {
  background: rgba(34, 197, 94, 0.4);
  border-color: rgba(34, 197, 94, 0.6);
  color: #DCFCE7;
 
  box-shadow:
    0 2px 8px rgba(34, 197, 94, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.metadata-badge.recent:hover {
  box-shadow:
    0 4px 12px rgba(34, 197, 94, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.metadata-badge.featured {
  background: rgba(245, 158, 11, 0.4);
  border-color: rgba(245, 158, 11, 0.6);
  color: #FFFBEB;
 
  box-shadow:
    0 2px 8px rgba(245, 158, 11, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.metadata-badge.featured:hover {
  box-shadow:
    0 4px 12px rgba(245, 158, 11, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.metadata-badge.status {
  background: rgba(75, 85, 99, 0.4);
  border-color: rgba(75, 85, 99, 0.6);
  color: #F9FAFB;
 
  box-shadow:
    0 2px 8px rgba(75, 85, 99, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.metadata-badge.status:hover {
  box-shadow:
    0 4px 12px rgba(75, 85, 99, 0.6),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.3);
}

.metadata-badge.status.status-active {
  background: rgba(34, 197, 94, 0.4);
  border-color: rgba(34, 197, 94, 0.6);
  color: #DCFCE7;
}

.metadata-badge.status.status-pending {
  background: rgba(245, 158, 11, 0.4);
  border-color: rgba(245, 158, 11, 0.6);
  color: #FFFBEB;
}

.metadata-badge.status.status-expired {
  background: rgba(239, 68, 68, 0.4);
  border-color: rgba(239, 68, 68, 0.6);
  color: #FEF2F2;
}

/* UPDATED: Enhanced button styling with box shadows instead of text shadows */
.enhanced-button {
  font-weight: 700;
  backdrop-filter: blur(8px);
 
  /* REPLACED: Text shadow with effective box shadow */
  box-shadow:
    0 2px 8px rgba(0, 0, 0, 0.4),
    0 4px 16px rgba(0, 0, 0, 0.2),
    inset 0 1px 0 rgba(255, 255, 255, 0.1);
 
  transition: all 0.3s ease;
}

.enhanced-button:hover {
  transform: translateY(-2px);
 
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.enhanced-button:focus {
  outline: 2px solid white;
  outline-offset: 2px;
 
  /* Enhanced focus shadow */
  box-shadow:
    0 4px 12px rgba(0, 0, 0, 0.5),
    0 8px 24px rgba(0, 0, 0, 0.3),
    0 0 0 4px rgba(255, 255, 255, 0.3),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

/* Performance optimizations for shadows and images */
.metadata-badge,
.enhanced-button {
  will-change: transform, box-shadow;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.scroll-fade-overlay-background,
.content-reading-overlay {
  will-change: opacity;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

/* ==============================================
   FIX: Remove excessive padding from description paragraph
   ============================================== */

/* Override Disney+ utility classes that add excessive padding */
[data-testid="details-featured-description"] {
  padding: 0 !important;
  margin: 1rem 0 !important; /* Add reasonable margin instead */
}

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

/* Accessibility: Reduce motion and effects for users who prefer it */
@media (prefers-reduced-motion: reduce) {
  .metadata-badge,
  .enhanced-button {
    transition: none !important;
    transform: none !important;
  }
 
  .metadata-badge:hover,
  .enhanced-button:hover {
    transform: none !important;
  }
 
  .scroll-fade-overlay-background,
  .hero-image-16-9 {
    transition: none !important;
  }
 
  .hero-background-16-9::before {
    animation: none !important;
  }
}

/* High contrast mode - simplified shadows for better performance */
@media (prefers-contrast: high) {
  .patent-title.enhanced-accessibility,
  .enhanced-accessibility {
    text-shadow:
      0 0 4px rgba(0,0,0,1),
      0 2px 8px rgba(0,0,0,1);
  }
 
  .metadata-badge {
    background: rgba(255, 255, 255, 0.3);
    border: 2px solid rgba(255, 255, 255, 0.8);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
    text-shadow: none; /* Ensure no text shadows in high contrast */
  }
 
  .enhanced-button {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.8);
  }
 
  .hero-background-16-9 {
    border: 2px solid white;
  }
}

/* Focus management for accessibility */
.hero-background-16-9:focus-within {
  outline: 2px solid white;
  outline-offset: 4px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .patent-metadata-badges.enhanced-accessibility {
    gap: 0.375rem;
  }
 
  .metadata-badge {
    padding: 0.3rem 0.6rem;
    font-size: 0.75rem;
 
    /* Simplified shadow for mobile performance - no text shadow */
    text-shadow: none;
    box-shadow:
      0 2px 6px rgba(0, 0, 0, 0.3),
      inset 0 1px 0 rgba(255, 255, 255, 0.2);
  }
 
  .metadata-badge:hover {
    box-shadow:
      0 3px 9px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
 
  .enhanced-button {
    box-shadow:
      0 2px 6px rgba(0, 0, 0, 0.4),
      inset 0 1px 0 rgba(255, 255, 255, 0.1);
  }
 
  .patent-title.enhanced-accessibility {
    font-size: clamp(1.5rem, 6vw, 2.5rem);
    font-weight: 800; /* Maintain extra bold on mobile */
  }
}

@media (max-width: 480px) {
  .patent-metadata-badges.enhanced-accessibility {
    gap: 0.25rem;
  }
 
  .metadata-badge {
    padding: 0.25rem 0.5rem;
    font-size: 0.7rem;
 
    /* Minimal shadow for small screens - no text shadow */
    text-shadow: none;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
  }
 
  .metadata-badge:hover {
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  }
 
  .enhanced-accessibility {
    font-weight: 600; /* Maintain semi-bold on small screens */
  }
}
