/* 
 * HERO SECTION STYLES - OPTIMIZED FOR FIRST CONTENTFUL PAINT
 * Stili dedicati alla sezione hero in stile Apple con ottimizzazioni prestazionali
 * My Place Malpensa - Copyright 2025
 */

:root {
  --hero-bg-gradient: linear-gradient(to bottom, rgba(14, 30, 45, 0.5), rgba(14, 30, 45, 0.7));
  --hero-overlay-color: rgba(7, 25, 43, 0.35); /* Overlay leggero blu scuro elegante */
  --hero-text-color: #ffffff;
  --hero-accent-color: #2196f3; /* Blu più acceso e luminoso */
  --hero-secondary-accent: rgba(255, 255, 255, 0.95);
  --hero-button-radius: 8px; /* Angoli più squadrati per stile moderno */
  --hero-transition: all 0.35s cubic-bezier(0.19, 1, 0.22, 1);
  --hero-shadow: 0 4px 30px rgba(0, 0, 0, 0.15);
  --hero-max-width: 800px;
  --hero-title-gradient: linear-gradient(to right, #ffffff, #ffffff);
  --hero-subtitle-color: #ffffff;
  --hero-description-color: #ffffff;
}

/* Sezione hero principale - Ottimizzata per FCP */
.hero-section {
  position: relative;
  width: 100%;
  min-height: 90vh; /* Più alto per effetto più drammatico */
  max-height: 900px;
  overflow: hidden;
  display: flex;
  align-items: center;
  color: var(--hero-text-color);
  background-color: #13293d; /* Fallback blu scuro elegante prima del caricamento dell'immagine */
  contain: layout paint; /* Miglioramento performance */
  will-change: transform; /* Hint browser per ottimizzazione */
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2); /* Ombra sottile per profondità */
  margin-top: 0; /* Rimuove margine superiore */
  padding-top: 0; /* Rimuove padding superiore */
}

/* Diverse varianti di hero per A/B testing o variazioni stagionali */
.hero-section.variant-standard {
  background-image: var(--hero-bg-gradient), url('../../images/hero/hero-standard.jpg');
  background-size: cover;
  background-position: center;
}

/* Lazy load background con tecnica modern - migliora FCP */
.hero-lazy-bg {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: var(--hero-bg-gradient);
  z-index: 1;
  animation: heroReveal 0.5s ease-out forwards;
  backdrop-filter: blur(2px);
}

/* Overlay con pattern sottile per texture */
.hero-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: var(--hero-overlay-color);
  background-image: url('../../images/overlay-pattern.png');
  background-size: 200px;
  background-repeat: repeat;
  opacity: 0.12;
  z-index: 1;
}

/* Stili per il testo della hero section */
.hero-title {
  background: var(--hero-title-gradient);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  font-weight: 700;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.2);
}

.hero-subtitle {
  color: white;
  font-weight: 500;
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.45);
}

.hero-description {
  color: white;
  font-weight: 400;
  text-shadow: 0 2px 8px rgba(0, 0, 0, 0.5);
  line-height: 1.6;
  max-width: 90%;
  margin: 0 auto 2rem;
}

.hero-bg-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center center;
  z-index: 0;
  opacity: 0;
  transition: opacity 1.2s ease;
  transform: scale(1.02);
  filter: brightness(1.05) contrast(1.05);
}

.hero-bg-loaded .hero-bg-image {
  opacity: 1;
}

/* Container e contenuto */
.hero-content-container {
  position: relative;
  z-index: 2;
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 2rem;
  text-align: center;
}

.hero-content {
  max-width: var(--hero-max-width);
  margin: 0 auto;
  opacity: 0;
  transform: translateY(10px);
  animation: heroContentReveal 0.8s 0.3s ease-out forwards;
}

.hero-logo {
  margin-bottom: 20px;
  height: 60px;
  transform: scale(0.95);
  transition: transform 0.3s ease;
}

.hero-logo:hover {
  transform: scale(1);
}

.hero-logo img {
  height: 100%;
  /* Aumento significativo del contrasto e luminosità per migliore leggibilità */
  filter: drop-shadow(0 3px 8px rgba(0, 0, 0, 0.4)) brightness(1.15) contrast(1.2);
}

/* Gestione visualizzazione logo desktop/mobile */
.logo-mobile {
  display: none; /* Nascosto di default */
}

.logo-desktop {
  display: block; /* Visibile di default */
}

/* Spazio supplementare tra logo e sottotitolo */
.hero-spacer {
  height: 30px;
  width: 100%;
  display: block;
}

.hero-title {
  font-size: 5rem;
  font-weight: 700;
  margin: 0 0 1rem;
  line-height: 1.1;
  letter-spacing: -0.02em;
  text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 0, 0, 0.2);
  color: var(--hero-title-color);
  background: linear-gradient(135deg, #ffffff 0%, #e0e0e0 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  color: transparent; /* Sostituzione di text-fill-color con color per maggiore compatibilità */
  animation: titlePulse 4s ease-in-out infinite alternate;
}

.hero-subtitle {
  font-size: 1.75rem;
  font-weight: 400;
  margin: 0 0 1.5rem;
  color: var(--hero-subtitle-color);
  text-shadow: 0 2px 10px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.5px;
}

.hero-description {
  font-size: 1.25rem;
  line-height: 1.6;
  margin: 0 0 2.5rem;
  color: var(--hero-description-color);
  font-weight: 300;
  text-shadow: 0 1px 8px rgba(0, 0, 0, 0.25);
  max-width: 650px;
  margin-left: auto;
  margin-right: auto;
}

/* Pulsanti hero ottimizzati per accessibilità e performance */
.hero-buttons {
  display: flex;
  justify-content: center;
  gap: 1.25rem;
  margin-top: 3rem;
}

.hero-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 1.1rem 2.5rem;
  border-radius: var(--hero-button-radius);
  font-size: 1.05rem;
  font-weight: 600;
  text-decoration: none;
  transition: var(--hero-transition);
  border: none;
  cursor: pointer;
  white-space: nowrap;
  letter-spacing: 0.01em;
  box-shadow: var(--hero-shadow);
  text-transform: uppercase;
  position: relative;
  overflow: hidden;
}

.hero-button.primary {
  background-color: var(--hero-accent-color);
  color: white;
  border: none;
}

.hero-button.primary:before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: 0.5s;
}

.hero-button.primary:hover:before {
  left: 100%;
}

.hero-button.primary:hover, 
.hero-button.primary:focus {
  background-color: #1976d2;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(33, 150, 243, 0.5);
}

.hero-button.secondary {
  background-color: transparent;
  color: var(--hero-secondary-accent);
  border: 2px solid var(--hero-accent-color);
  position: relative;
  z-index: 1;
}

.hero-button.secondary:before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: var(--hero-accent-color);
  z-index: -1;
  transform: scaleX(0);
  transform-origin: 0 50%;
  transition: transform 0.5s ease-out;
  border-radius: calc(var(--hero-button-radius) - 2px);
}

.hero-button.secondary:hover:before,
.hero-button.secondary:focus:before {
  transform: scaleX(1);
}

.hero-button.secondary:hover,
.hero-button.secondary:focus {
  color: white;
  transform: translateY(-2px);
  box-shadow: 0 8px 25px rgba(33, 150, 243, 0.3);
}

/* Scroll indicator - appare con animazione */
.hero-scroll-indicator {
  position: absolute;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  width: 28px;
  height: 44px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 25px;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding-top: 6px;
  opacity: 0;
  animation: heroScrollFadeIn 0.5s 1.2s forwards;
}

.hero-scroll-indicator::before {
  content: "";
  width: 4px;
  height: 8px;
  background-color: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
  animation: heroScrollIndicator 2s ease-in-out infinite;
}

/* Riposizionamento animazione per dispositivi senza hover */
@media (hover: none) {
  .hero-scroll-indicator {
    animation: none;
    opacity: 0.5;
  }
}

/* Area distintiva per la hero */
.hero-badge {
  position: absolute;
  top: 2.5rem;
  right: 3rem;
  background-color: var(--hero-accent-color);
  padding: 0.5rem 1.25rem;
  border-radius: 4px;
  font-size: 0.85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  color: white;
  z-index: 10;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.25);
  letter-spacing: 0.5px;
  text-transform: uppercase;
}

.hero-badge i {
  font-size: 0.9rem;
  margin-right: 0.5rem;
}

/* Bannerino 8 minuti da Malpensa */
.hero-top-banner {
  position: absolute;
  top: 32px;
  right: 48px;
  z-index: 10;
}

.hero-top-banner-content {
  display: inline-block;
  background: rgba(255,255,255,0.92);
  color: #1976d2;
  font-family: 'SF Pro Display', 'Helvetica Neue', 'Helvetica', sans-serif;
  font-weight: 600;
  font-size: 1.05rem;
  padding: 0.45rem 1.2rem;
  border-radius: 100px;
  box-shadow: 0 2px 12px rgba(33,150,243,0.10);
  letter-spacing: 0.01em;
  border: 1.5px solid #e3eaf5;
}

.hero-top-banner-content i {
  margin-right: 0.5em;
}

/* Animazioni ottimizzate per performance */
@keyframes heroReveal {
  from {
    background-color: #111;
  }
  to {
    background-color: transparent;
  }
}

@keyframes heroContentReveal {
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes heroScrollFadeIn {
  to {
    opacity: 0.8;
  }
}

@keyframes heroScrollIndicator {
  0%, 100% {
    transform: translateY(0);
    opacity: 0.8;
  }
  50% {
    transform: translateY(8px);
    opacity: 0.2;
  }
}

/* Media Queries per responsive design */
@media (max-width: 1200px) {
  .hero-title {
    font-size: 3.5rem;
  }
  
  .hero-badge {
    top: 2rem;
    right: 2rem;
  }
}

@media (max-width: 991px) {
  .hero-section {
    min-height: 75vh;
  }
  
  .hero-title {
    font-size: 3rem;
  }
  
  .hero-subtitle {
    font-size: 1.5rem;
  }
  
  .hero-description {
    font-size: 1.15rem;
  }
}

@media (max-width: 768px) {
  .hero-section {
    min-height: 70vh;
  }

  .hero-top-banner {
    right: 1rem;
    top: 1rem;
  }
  .hero-top-banner-content {
    font-size: 0.8rem;
    padding: 0.3rem 0.8rem;
  }
  
  .hero-content-container {
    padding: 0 1.5rem;
  }
  
  .hero-title {
    font-size: 2.5rem;
  }
  
  .hero-subtitle {
    font-size: 1.25rem;
  }
  
  .hero-description {
    font-size: 1rem;
    margin-bottom: 2rem;
  }
  
  .hero-buttons {
    flex-direction: column;
    gap: 0.75rem;
  }
  
  .hero-button {
    padding: 0.85rem 1.75rem;
    font-size: 1rem;
    width: 100%;
  }
  
  .hero-badge {
    top: 1.5rem;
    right: 1.5rem;
    font-size: 0.8rem;
    padding: 0.4rem 1rem;
  }
  
  .hero-logo {
    height: 45px;
    margin-bottom: 15px;
  }
  
  /* Hero spacer su mobile */
  .hero-spacer {
    height: 25px;
  }
  
  /* Switch logo desktop/mobile */
  .logo-mobile {
    display: block;
  }
  
  /* Trattamento specifico per il logo mobile */
  .hero-logo .logo-mobile {
    /* Ottimizzazione specifica per il contrasto su mobile */
    filter: drop-shadow(0 3px 10px rgba(0, 0, 0, 0.45)) brightness(1.2) contrast(1.25);
    /* Aumenta leggermente le dimensioni del logo mobile */
    max-height: 180px;
  }
  
  .logo-desktop {
    display: none;
  }
}

@media (max-width: 480px) {
  .hero-section {
    min-height: 60vh;
  }
  
  .hero-title {
    font-size: 2rem;
  }
  
  .hero-subtitle {
    font-size: 1.15rem;
  }
  
  .hero-badge {
    top: 1rem;
    right: 1rem;
    font-size: 0.75rem;
    padding: 0.35rem 0.85rem;
  }
}

/* Animazioni */
@keyframes heroReveal {
  0% { opacity: 1; }
  100% { opacity: 0.5; }
}

@keyframes heroContentReveal {
  0% { 
    opacity: 0;
    transform: translateY(15px);
  }
  100% { 
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes titlePulse {
  0% { text-shadow: 0 2px 20px rgba(0, 0, 0, 0.4), 0 0 30px rgba(0, 0, 0, 0.2); }
  100% { text-shadow: 0 2px 25px rgba(0, 0, 0, 0.5), 0 0 40px rgba(33, 150, 243, 0.25); }
}
