/**
 * Hero Images - CSS para otimizar imagens em baixa resolução
 * Aplica técnicas de upscaling e otimização visual
 */

/* ============================================================================
   HERO SECTIONS - Upscaling inteligente para imagens 200x150px
   ============================================================================ */

.hero--service {
  position: relative;
  min-height: 400px;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
}

/* Wrapper para imagem hero com upscaling */
.hero__image-wrapper {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0;
}

.hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  
  /* Técnica 1: Interpolação suave */
  image-rendering: -webkit-optimize-contrast;
  image-rendering: crisp-edges;
  
  /* Técnica 2: Leve blur para suavizar pixelação */
  filter: blur(0.5px) brightness(0.95);
  
  /* Técnica 3: Transform para melhor renderização */
  transform: scale(1.01);
  transform-origin: center;
  
  /* Transição suave */
  transition: all 0.3s ease;
}

/* Overlay para melhorar contraste e esconder imperfeições */
.hero__overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    135deg,
    rgba(var(--primary-rgb), 0.15) 0%,
    rgba(var(--secondary-rgb), 0.2) 100%
  );
  z-index: 1;
  pointer-events: none;
}

/* Garantir que o conteúdo fique acima */
.hero__content {
  position: relative;
  z-index: 2;
}

/* ============================================================================
   RESPONSIVE - Ajustes por tamanho de tela
   ============================================================================ */

/* Mobile: Menos blur, mais overlay */
@media (max-width: 768px) {
  .hero__image {
    filter: blur(0.3px) brightness(0.93);
    transform: scale(1.02);
  }
  
  .hero__overlay {
    background: linear-gradient(
      135deg,
      rgba(var(--primary-rgb), 0.2) 0%,
      rgba(var(--secondary-rgb), 0.25) 100%
    );
  }
  
  .hero--service {
    min-height: 300px;
  }
}

/* Desktop: Maior blur para esconder pixelação em telas grandes */
@media (min-width: 1920px) {
  .hero__image {
    filter: blur(1px) brightness(0.92);
    transform: scale(1.05);
  }
  
  .hero__overlay {
    background: linear-gradient(
      135deg,
      rgba(var(--primary-rgb), 0.25) 0%,
      rgba(var(--secondary-rgb), 0.3) 100%
    );
  }
}

/* ============================================================================
   VARIAÇÕES POR PÁGINA - Cores personalizadas do overlay
   ============================================================================ */

/* Ensino a Distância - Tom azul */
.hero--ead .hero__overlay {
  background: linear-gradient(
    135deg,
    rgba(59, 130, 246, 0.2) 0%,
    rgba(37, 99, 235, 0.25) 100%
  );
}

/* Digital Signage - Tom roxo */
.hero--digital-signage .hero__overlay {
  background: linear-gradient(
    135deg,
    rgba(139, 92, 246, 0.2) 0%,
    rgba(124, 58, 237, 0.25) 100%
  );
}

/* Webinar - Tom verde */
.hero--webinar .hero__overlay {
  background: linear-gradient(
    135deg,
    rgba(16, 185, 129, 0.2) 0%,
    rgba(5, 150, 105, 0.25) 100%
  );
}

/* TV Corporativa - Tom laranja */
.hero--tv-corporativa .hero__overlay {
  background: linear-gradient(
    135deg,
    rgba(249, 115, 22, 0.2) 0%,
    rgba(234, 88, 12, 0.25) 100%
  );
}

/* Endomarketing - Tom rosa/magenta */
.hero--endomarketing .hero__overlay {
  background: linear-gradient(
    135deg,
    rgba(236, 72, 153, 0.2) 0%,
    rgba(219, 39, 119, 0.25) 100%
  );
}

/* ============================================================================
   ANIMAÇÃO DE ENTRADA
   ============================================================================ */

@keyframes heroImageFadeIn {
  from {
    opacity: 0;
    transform: scale(1.1);
    filter: blur(10px);
  }
  to {
    opacity: 1;
    transform: scale(1.01);
    filter: blur(0.5px);
  }
}

.hero__image {
  animation: heroImageFadeIn 0.8s ease-out;
}

/* ============================================================================
   LOADING STATE - Skeleton enquanto carrega
   ============================================================================ */

.hero__image-wrapper::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    rgba(var(--primary-rgb), 0.1) 0%,
    rgba(var(--primary-rgb), 0.2) 50%,
    rgba(var(--primary-rgb), 0.1) 100%
  );
  animation: shimmer 2s infinite;
  z-index: -1;
}

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

/* Remove skeleton quando imagem carregou */
.hero__image-wrapper.loaded::before {
  display: none;
}

/* ============================================================================
   FALLBACK - Para navegadores que não suportam image-rendering
   ============================================================================ */

@supports not (image-rendering: -webkit-optimize-contrast) {
  .hero__image {
    filter: blur(1px) brightness(0.9);
  }
}

/* ============================================================================
   PRINT - Remover efeitos para impressão
   ============================================================================ */

@media print {
  .hero__image {
    filter: none;
    transform: none;
  }
  
  .hero__overlay {
    display: none;
  }
}

/* ============================================================================
   ACESSIBILIDADE - Reduzir movimento se preferência do usuário
   ============================================================================ */

@media (prefers-reduced-motion: reduce) {
  .hero__image {
    animation: none;
    transition: none;
  }
}

/* ============================================================================
   MODO ESCURO - Ajustes para dark mode
   ============================================================================ */

@media (prefers-color-scheme: dark) {
  .hero__image {
    filter: blur(0.5px) brightness(0.8);
  }
  
  .hero__overlay {
    background: linear-gradient(
      135deg,
      rgba(0, 0, 0, 0.4) 0%,
      rgba(var(--primary-rgb), 0.3) 100%
    );
  }
}

