/**
 * Hero Component - Osona 2024
 * Component per la secció hero amb fons cel i logo centrat
 */

/* === FONTS === */
@font-face {
  font-family: 'Gordita';
  src: url('../../../fonts/Gordita/Gordita-Regular.eot');
  src: url('../../../fonts/Gordita/Gordita-Regular.eot?#iefix') format('embedded-opentype'),
       url('../../../fonts/Gordita/Gordita-Regular.woff2') format('woff2'),
       url('../../../fonts/Gordita/Gordita-Regular.woff') format('woff'),
       url('../../../fonts/Gordita/Gordita-Regular.ttf') format('truetype'),
       url('../../../fonts/Gordita/Gordita-Regular.svg#Gordita-Regular') format('svg');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Gordita';
  src: url('../../../fonts/Gordita/Gordita-Black.eot');
  src: url('../../../fonts/Gordita/Gordita-Black.eot?#iefix') format('embedded-opentype'),
       url('../../../fonts/Gordita/Gordita-Black.woff2') format('woff2'),
       url('../../../fonts/Gordita/Gordita-Black.woff') format('woff'),
       url('../../../fonts/Gordita/Gordita-Black.ttf') format('truetype'),
       url('../../../fonts/Gordita/Gordita-Black.svg#Gordita-Black') format('svg');
  font-weight: 900;
  font-style: normal;
  font-display: swap;
}

.hero {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  height: 100vh;
  overflow: hidden;
}

/* === MODIFIERS === */
.hero--fullscreen {
  height: 100vh;
}

/* === ELEMENTS === */
.hero__background {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-image: url('../../../img/home/fons-cel.jpg');
  background-size: cover;
  background-position: center center;
  background-repeat: no-repeat;
  z-index: var(--z-negative);
}

.hero__background {
  background-image: url('../../../img/home/fons-cel.jpg');
}

.hero__container {
  position: relative;
  z-index: var(--z-10);
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 3rem;
  height: 100%;
  padding: var(--container-padding);
  /* El logo principal (columna central) quedarà perfectament centrat */
  max-width: 100vw;
}

/* Wrapper que agrupa el canvas de partícules, el container del hero i elements flotants com el widget */
.hero__stage {
  position: relative; /* contenir el canvas (absolute) i el widget */
  width: 100%;
  height: 100%;
}

/* Contenidor per mantenir l'espai del logo */
.hero__logo-container {
  position: relative;
  flex-shrink: 0;
  /* Espai que ocupa el logo rotat: amplada = altura original, altura = amplada original */
  width: min(60vw, 75vh);
  height: min(75vh, 60vw);
}

.hero__logo {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 10;
  /* Element principal centrat - mida més gran */
  width: min(75vh, 60vw); /* Mida real del logo */
  height: auto;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(var(--shadow-lg));
  transform: translate(-50%, -50%) rotate(-90deg);
  transition: transform var(--transition-slow), opacity 300ms ease-out;
  opacity: 1;
}

.hero__logo-secondary {
  position: relative;
  z-index: 10;
  width: min(12vh, 8vw); /* Mida secundària més petita */
  height: auto;
  object-fit: contain;
  object-position: center;
  filter: drop-shadow(var(--shadow-md));
  transition: opacity 300ms ease-out;
  opacity: 1;
  flex-shrink: 0;
  /* Element secundari alineat a la dreta de la seva columna */
  align-self: center;
  justify-self: end;
}

.hero__text {
  z-index: 20;
  max-width: 250px;
}

.hero__title {
  font-family: 'Gordita', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 400;
  font-size: 1.5rem;
  line-height: 1.2;
  color: #000;
  margin: 0;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.hero__subtitle {
  font-family: 'Gordita', -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-weight: 900;
  font-size: 1.2rem;
  line-height: 1.2;
  color: #000;
  margin: 1rem 0 0 0;
  letter-spacing: 0.02em;
}

.hero__divider {
  display: block;
  width: 35px;
  height: 1px;
  background-color: #000;
  margin: 1rem 0;
}

/* Logo hover desactivat perquè el canvas està per sobre */
/* .hero__logo:hover {
  transform: rotate(-90deg) scale(1.02);
} */

/* Focus styles desactivats perquè el canvas està per sobre */
/* .hero__logo:focus-visible {
  outline: 3px solid var(--color-primary);
  outline-offset: 4px;
  border-radius: var(--border-radius-md);
} */

/* === RESPONSIVE === */

/* Mobile adjustments */
@media (max-width: 767px) {
  .hero__container {
    display: flex;
    flex-direction: column;
  }
  
  .hero__logo-container {
    width: min(75vw, 65vh);
    height: min(65vh, 75vw);
    order: 2;
  }
  
  .hero__logo {
    width: min(65vh, 75vw); /* Logo principal gran en móvil també */
  }
  
  .hero__logo-secondary {
    width: min(20vh, 40vw); /* Més petit en móvil */
    order: 1;
  }
  
  .hero__text {
    order: 3;
    max-width: 100%;
  }
  
  .hero__title {
    font-size: 1.3rem;
    white-space: normal;
  }
  
  .hero__subtitle {
    font-size: 1.1rem;
  }

  /* Mobile: no full-screen hero, allow page scroll and disable snap on the hero */
  .hero,
  .hero--fullscreen {
    /* Avoid forcing 100vh on small screens so users can scroll content normally */
    height: auto !important;
    /* keep a reasonable minimum so the hero still feels prominent */
    min-height: 60vh !important; /* prefer 60vh on modern browsers */
    min-height: 40vh; /* graceful fallback */
    overflow: visible !important;
    /* Disable per-element snap behaviors on mobile */
    scroll-snap-align: none !important;
    scroll-snap-stop: initial !important;
    display: block !important;
  }

}

/* Tablet */
@media (min-width: 768px) {

  
  .hero__logo-container {
    width: min(10vw, 80vh);
    height: min(80vh, 45vw);
  }
  
  .hero__logo {
    width: min(80vh, 45vw); /* Logo principal més gran en tablet */
  }
  
  .hero__logo-secondary {
    width: min(15vh, 15vw);
  }
  
  .hero__text {
    max-width: 280px;
  }
  
  .hero__title {
    font-size: 1.4rem;
  }
  
  .hero__subtitle {
    font-size: 1.2rem;
  }
}

/* Desktop */
@media (min-width: 1024px) {
  .hero__container {
    gap: 3rem;
  }
  
  .hero__logo-container {
    width: min(125, 85vh);
    height: min(85vh, 40vw);
  }
  
  .hero__logo {
    width: min(85vh, 40vw); /* Logo principal dominant en desktop */
  }
  
  .hero__logo-secondary {
    width: min(18vh, 12vw);
  }
  
  .hero__text {
    max-width: 320px;
  }
  
  .hero__title {
    font-size: 1.6rem;
  }
  
  .hero__subtitle {
    font-size: 1.3rem;
  }
}

/* Large screens */
@media (min-width: 1280px) {
  .hero__container {
    gap: 3rem;
  }
  
  .hero__logo-container {
    /*width: min(16vw, 90vh);*/
    width: min(200px, 90vh);
    height: min(90vh, 35vw);
  }
  
  .hero__logo {
    width: min(75vh, 40vw); /* Logo principal màxim en large screens */
  }
  
  .hero__logo-secondary {
    width: min(500px, 10vw);
  }
  
  .hero__text {
    max-width: 350px;
  }
  
  .hero__title {
    font-size: 1.8rem;
  }
  
  .hero__subtitle {
    font-size: 1.5rem;
  }
}

@media (min-width: 1600px) {
  .hero__logo {
    width: min(60vh, 35vw); /* Logo principal més gran en very large screens */
  }
}

/* === ACCESSIBILITY === */

/* Respectar preferències de moviment reduït */
@media (prefers-reduced-motion: reduce) {
  .hero__logo {
    transition: none !important;
  }
  
  .hero__logo:hover {
    transform: rotate(-90deg); /* Mantenir rotació sense scale */
  }
  
  .hero__logo-secondary {
    transition: none !important;
  }
  
  .hero__text {
    transition: none !important;
  }
}

/* Contrast millorat per usuaris amb visió reduïda */
@media (prefers-contrast: high) {
  .hero__logo {
    filter: drop-shadow(var(--shadow-xl)) contrast(1.2);
  }
  
  .hero__logo-secondary {
    filter: drop-shadow(var(--shadow-lg)) contrast(1.2);
  }
  
  .hero__title,
  .hero__subtitle {
    text-shadow: 1px 1px 2px rgba(255, 255, 255, 0.8);
  }
  
  .hero__divider {
    background-color: #000;
    box-shadow: 0 0 1px rgba(255, 255, 255, 0.8);
  }
}

/* === PERFORMANCE === */

/* Millores per dispositius amb recursos limitats */
@media (max-width: 767px) and (max-resolution: 192dpi) {
  .hero__background {
    background-attachment: scroll; /* Evita problemes en móvils */
  }
}

/* === PRINT STYLES === */
@media print {
  .hero {
    height: auto;
    min-height: auto;
    page-break-inside: avoid;
  }
  
  .hero__background {
    display: none; /* Estalviar tinta */
  }
  
  .hero__logo {
    height: auto;
    max-height: 200px;
    filter: none;
  }
}