/* ==========================================================================
   Sections – Hero, services-grid, CTA, stats, project banner, contact
   ========================================================================== */

/* ---------- Hero ---------- */

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

.hero--internal {
  min-height: 40vh;
}

.hero__background {
  position: absolute;
  inset: 0;
  z-index: 0;
}

.hero__image {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Video background hero */
.hero__video {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

/* Nasconde l'immagine fallback quando il video è presente */
.hero__video + .hero__image--fallback {
  display: none;
}

@media (prefers-reduced-motion: reduce) {
  .hero__video {
    display: none;
  }

  .hero__video + .hero__image--fallback {
    display: block;
  }
}

.hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to bottom, rgba(26, 26, 46, 0.65), rgba(26, 26, 46, 0.85));
}

.hero__content {
  position: relative;
  z-index: 1;
  padding-block: var(--space-24);
}

.hero--internal .hero__content {
  padding-block: var(--space-16);
}

.hero__title {
  color: var(--color-white);
  font-size: var(--text-5xl);
  font-weight: var(--fw-extrabold);
  max-width: 800px;
  margin-bottom: var(--space-6);
}

.hero--internal .hero__title {
  font-size: var(--text-4xl);
}

.hero__subtitle {
  color: rgba(255, 255, 255, 0.85);
  font-size: var(--text-xl);
  max-width: 600px;
  margin-bottom: var(--space-8);
  line-height: 1.6;
}

.hero__actions {
  display: flex;
  flex-wrap: wrap;
  gap: var(--space-4);
}

/* ---------- Intro Azienda ---------- */

.intro {
  background-color: var(--color-white);
}

.intro__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
  align-items: center;
}

@media (min-width: 768px) {
  .intro__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.intro__text h2 {
  margin-bottom: var(--space-6);
}

.intro__text p {
  color: var(--color-neutral-800);
  line-height: 1.8;
}

.intro__image {
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.intro__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  aspect-ratio: 4 / 3;
}

/* ---------- Services Grid ---------- */

.services-grid__items {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-8);
}

@media (min-width: 640px) {
  .services-grid__items {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (min-width: 1024px) {
  .services-grid__items {
    grid-template-columns: repeat(3, 1fr);
  }
}

.services-grid__cta {
  text-align: center;
  margin-top: var(--space-12);
}

/* ---------- Products Grid (Mosaic) ---------- */

.products__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-4);
}

@media (min-width: 640px) {
  .products__grid {
    grid-template-columns: repeat(2, 1fr);
    grid-auto-rows: 280px;
  }

  /* Prima card: occupa tutta la larghezza, piu' alta */
  .products__grid .product-card:nth-child(1) {
    grid-column: 1 / -1;
  }

  .products__grid .product-card:nth-child(1) .product-card__image-wrapper {
    aspect-ratio: auto;
    height: 100%;
  }
}

@media (min-width: 1024px) {
  .products__grid {
    grid-template-columns: repeat(12, 1fr);
    grid-template-rows: 320px 320px;
    gap: var(--space-4);
  }

  /* Riga 1: card grande sx (7 col) + card media dx (5 col) */
  .products__grid .product-card:nth-child(1) {
    grid-column: 1 / 8;
    grid-row: 1 / 2;
  }

  .products__grid .product-card:nth-child(2) {
    grid-column: 8 / 13;
    grid-row: 1 / 2;
  }

  /* Riga 2: 3 card uguali */
  .products__grid .product-card:nth-child(3) {
    grid-column: 1 / 5;
    grid-row: 2 / 3;
  }

  .products__grid .product-card:nth-child(4) {
    grid-column: 5 / 9;
    grid-row: 2 / 3;
  }

  .products__grid .product-card:nth-child(5) {
    grid-column: 9 / 13;
    grid-row: 2 / 3;
  }

  /* Tutte le card nel mosaic riempiono la cella */
  .products__grid .product-card {
    height: 100%;
  }

  .products__grid .product-card__image-wrapper {
    aspect-ratio: auto;
    height: 100%;
  }
}

/* ---------- CTA Banner ---------- */

.cta-banner {
  text-align: center;
  position: relative;
  overflow: hidden;
}

.cta-banner--dark {
  background-color: var(--color-primary);
  color: var(--color-white);
}

.cta-banner--dark::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.02) 20px,
    rgba(255, 255, 255, 0.02) 22px
  );
  pointer-events: none;
}

.cta-banner--accent {
  background-color: var(--color-secondary);
  color: var(--color-white);
}

.cta-banner--accent::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: repeating-linear-gradient(
    45deg,
    transparent,
    transparent 20px,
    rgba(255, 255, 255, 0.04) 20px,
    rgba(255, 255, 255, 0.04) 22px
  );
  pointer-events: none;
}

.cta-banner .container {
  position: relative;
  z-index: 1;
}

.cta-banner__title {
  color: var(--color-white);
  margin-bottom: var(--space-4);
}

.cta-banner__text {
  font-size: var(--text-lg);
  opacity: 0.9;
  margin-bottom: var(--space-8);
  max-width: 500px;
  margin-inline: auto;
}

/* ---------- Stats ---------- */

.stats {
  background-color: var(--color-neutral-50);
}

.stats__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-8);
  text-align: center;
}

@media (min-width: 768px) {
  .stats__grid {
    grid-template-columns: repeat(4, 1fr);
  }
}

.stats__item {
  padding: var(--space-6);
}

.stats__number {
  font-family: var(--font-heading);
  font-size: var(--text-4xl);
  font-weight: var(--fw-extrabold);
  color: var(--color-secondary);
  line-height: 1;
}

.stats__suffix {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  font-weight: var(--fw-bold);
  color: var(--color-secondary);
}

.stats__label {
  display: block;
  font-size: var(--text-sm);
  color: var(--color-neutral-800);
  margin-top: var(--space-2);
}

/* ---------- Project Banner FESR ---------- */

.project-banner {
  background-color: var(--color-neutral-100);
  position: relative;
  overflow: hidden;
}

.project-banner::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 6px;
  height: 100%;
  background: linear-gradient(to bottom, var(--color-accent), var(--color-secondary));
}

/* Immagine istituzionale grande in cima */
.project-banner__hero {
  margin-bottom: var(--space-10);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-lg);
}

.project-banner__hero img {
  width: 100%;
  height: auto;
  display: block;
}

.project-banner__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-10);
  align-items: start;
}

@media (min-width: 768px) {
  .project-banner__grid {
    grid-template-columns: 1.4fr 1fr;
    gap: var(--space-16);
  }
}

.project-banner__content {
  border-left: none;
  padding-left: 0;
}

.project-banner__badge {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: var(--space-2) var(--space-4);
  background-color: rgba(245, 166, 35, 0.12);
  color: var(--color-accent);
  font-family: var(--font-heading);
  font-size: var(--text-xs);
  font-weight: var(--fw-bold);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-radius: var(--radius-full);
  margin-bottom: var(--space-6);
}

.project-banner__badge svg {
  flex-shrink: 0;
}

.project-banner__title {
  font-size: var(--text-3xl);
  margin-bottom: var(--space-6);
  line-height: 1.2;
}

.project-banner__text p {
  font-size: var(--text-base);
  line-height: 1.8;
  color: var(--color-neutral-800);
}

/* Sidebar highlights */
.project-banner__sidebar {
  background-color: var(--color-white);
  border-radius: var(--radius-lg);
  padding: var(--space-8);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--color-neutral-200);
}

.project-banner__highlights {
  display: flex;
  flex-direction: column;
  gap: var(--space-6);
  margin: 0;
}

.project-banner__highlight {
  display: flex;
  align-items: center;
  gap: var(--space-4);
}

.project-banner__highlight svg {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
  color: var(--color-secondary);
}

.project-banner__highlight span {
  font-size: var(--text-base);
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
}

/* ---------- Contact Section ---------- */

.contact__grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: var(--space-12);
}

@media (min-width: 768px) {
  .contact__grid {
    grid-template-columns: 1fr 1fr;
  }
}

.contact__info h2 {
  margin-bottom: var(--space-8);
}

.contact__detail {
  display: flex;
  align-items: flex-start;
  gap: var(--space-4);
  margin-bottom: var(--space-6);
}

.contact__detail svg {
  width: 24px;
  height: 24px;
  flex-shrink: 0;
  color: var(--color-secondary);
  margin-top: 2px;
}

.contact__detail-label {
  display: block;
  font-size: var(--text-xs);
  color: var(--color-neutral-300);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: var(--space-1);
}

.contact__detail a {
  font-weight: var(--fw-semibold);
  color: var(--color-primary);
}

.contact__detail a:hover {
  color: var(--color-secondary);
}

.contact__hours {
  margin-top: var(--space-8);
  padding-top: var(--space-6);
  border-top: 1px solid var(--color-neutral-200);
}

.contact__hours-header {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  margin-bottom: var(--space-3);
}

.contact__hours-header svg {
  width: 20px;
  height: 20px;
  color: var(--color-secondary);
  flex-shrink: 0;
}

.contact__hours h3 {
  font-size: var(--text-lg);
  margin-bottom: 0;
}

.contact__hours > h3 {
  margin-bottom: var(--space-3);
}

.contact__hours p {
  font-size: var(--text-sm);
  color: var(--color-neutral-800);
  margin-bottom: var(--space-1);
}

.contact__form h2 {
  margin-bottom: var(--space-6);
}

/* Form Success */
.form-success {
  display: none;
  text-align: center;
  padding: var(--space-12) var(--space-6);
}

.form-success.is-visible {
  display: block;
}

.form-success__icon {
  width: 64px;
  height: 64px;
  margin-inline: auto;
  margin-bottom: var(--space-6);
  color: var(--color-success);
}

.form-success__title {
  font-size: var(--text-2xl);
  margin-bottom: var(--space-3);
}

.form-success__text {
  color: var(--color-neutral-800);
}

/* ---------- Map ---------- */

.map,
.map-section {
  padding-block: 0;
}

.map-section {
  padding-top: var(--section-padding);
  padding-bottom: 0;
}

.map-section__wrapper {
  margin-top: var(--space-8);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-md);
}

.map iframe,
.map-section iframe {
  width: 100%;
  height: 400px;
  border: none;
  display: block;
}

@media (min-width: 768px) {
  .map iframe,
  .map-section iframe {
    height: 500px;
  }
}

/* ---------- Legal content ---------- */

.legal-content {
  padding-block: var(--section-padding);
}

.legal-content h2 {
  font-size: var(--text-2xl);
  margin-top: var(--space-10);
  margin-bottom: var(--space-4);
}

.legal-content h3 {
  font-size: var(--text-xl);
  margin-top: var(--space-8);
  margin-bottom: var(--space-3);
}

.legal-content p {
  margin-bottom: var(--space-4);
  line-height: 1.8;
}

.legal-content ul,
.legal-content ol {
  margin-bottom: var(--space-4);
  padding-left: var(--space-6);
}

.legal-content ul {
  list-style: disc;
}

.legal-content ol {
  list-style: decimal;
}

.legal-content li {
  margin-bottom: var(--space-2);
  line-height: 1.7;
}

.legal-content a {
  text-decoration: underline;
}

/* ---------- Logo Strip ---------- */

.logo-strip {
  padding-block: var(--space-12);
  overflow: hidden;
  background-color: var(--color-neutral-50);
}

.logo-strip__track {
  display: flex;
  gap: var(--space-16);
  animation: logo-scroll 30s linear infinite;
  width: max-content;
}

.logo-strip__track img {
  height: 40px;
  width: auto;
  opacity: 0.5;
  filter: grayscale(1);
  transition: opacity var(--transition-base), filter var(--transition-base);
}

.logo-strip__track img:hover {
  opacity: 1;
  filter: grayscale(0);
}

@keyframes logo-scroll {
  0% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(-50%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .logo-strip__track {
    animation: none;
    flex-wrap: wrap;
    justify-content: center;
  }
}

/* ---------- 404 Page ---------- */

.error-page {
  min-height: 60vh;
  display: flex;
  align-items: center;
  text-align: center;
}

.error-page__code {
  font-family: var(--font-heading);
  font-size: clamp(6rem, 15vw, 12rem);
  font-weight: var(--fw-extrabold);
  color: var(--color-neutral-200);
  line-height: 1;
  margin-bottom: var(--space-4);
}

.error-page__title {
  margin-bottom: var(--space-4);
}

.error-page__text {
  font-size: var(--text-lg);
  color: var(--color-neutral-800);
  margin-bottom: var(--space-8);
  max-width: 500px;
  margin-inline: auto;
}

.error-page__actions {
  display: flex;
  justify-content: center;
  gap: var(--space-4);
  flex-wrap: wrap;
}

/* ---------- Gallery Mosaic ---------- */

.gallery {
  padding-block: var(--section-padding);
  background-color: var(--color-neutral-50);
}

.gallery__grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: var(--space-2);
}

@media (min-width: 640px) {
  .gallery__grid {
    grid-template-columns: repeat(3, 1fr);
    gap: var(--space-3);
  }
}

@media (min-width: 1024px) {
  .gallery__grid {
    grid-template-columns: repeat(4, 1fr);
    grid-auto-rows: 280px;
    gap: var(--space-4);
  }

  .gallery__item:nth-child(1) {
    grid-column: span 2;
    grid-row: span 2;
  }

  .gallery__item:nth-child(5) {
    grid-column: span 2;
  }

  .gallery__item:nth-child(8) {
    grid-row: span 2;
  }
}

.gallery__item {
  position: relative;
  overflow: hidden;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 200px;
}

.gallery__item img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform var(--transition-slow);
}

.gallery__item:hover img,
.gallery__item:focus-within img {
  transform: scale(1.05);
}

.gallery__item::after {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(26, 26, 46, 0.5) 0%, transparent 50%);
  opacity: 0;
  transition: opacity var(--transition-base);
  pointer-events: none;
}

.gallery__item:hover::after,
.gallery__item:focus-within::after {
  opacity: 1;
}

.gallery__caption {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: var(--space-4);
  color: var(--color-white);
  font-size: var(--text-sm);
  font-weight: var(--fw-semibold);
  z-index: 1;
  opacity: 0;
  transform: translateY(8px);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.gallery__item:hover .gallery__caption,
.gallery__item:focus-within .gallery__caption {
  opacity: 1;
  transform: translateY(0);
}

.gallery__zoom-icon {
  position: absolute;
  top: var(--space-3);
  right: var(--space-3);
  width: 36px;
  height: 36px;
  background: rgba(255, 255, 255, 0.9);
  border-radius: var(--radius-full);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1;
  opacity: 0;
  transform: scale(0.8);
  transition: opacity var(--transition-base), transform var(--transition-base);
}

.gallery__zoom-icon svg {
  width: 18px;
  height: 18px;
  color: var(--color-primary);
}

.gallery__item:hover .gallery__zoom-icon,
.gallery__item:focus-within .gallery__zoom-icon {
  opacity: 1;
  transform: scale(1);
}

/* ---------- Lightbox ---------- */

.lightbox {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  background: rgba(0, 0, 0, 0.92);
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition: opacity var(--transition-base), visibility var(--transition-base);
}

.lightbox.is-active {
  opacity: 1;
  visibility: visible;
}

.lightbox__content {
  position: relative;
  max-width: 90vw;
  max-height: 90vh;
  display: flex;
  align-items: center;
  justify-content: center;
}

.lightbox__img {
  max-width: 90vw;
  max-height: 85vh;
  object-fit: contain;
  border-radius: var(--radius-md);
  opacity: 0;
  transform: scale(0.95);
  transition: opacity var(--transition-slow), transform var(--transition-slow);
}

.lightbox.is-active .lightbox__img {
  opacity: 1;
  transform: scale(1);
}

.lightbox__caption {
  position: absolute;
  bottom: -40px;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255, 255, 255, 0.8);
  font-size: var(--text-sm);
}

.lightbox__close {
  position: absolute;
  top: var(--space-4);
  right: var(--space-4);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background var(--transition-fast);
}

.lightbox__close:hover,
.lightbox__close:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox__close svg {
  width: 24px;
  height: 24px;
}

.lightbox__nav {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 48px;
  height: 48px;
  background: rgba(255, 255, 255, 0.1);
  border: none;
  border-radius: var(--radius-full);
  color: var(--color-white);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: background var(--transition-fast);
}

.lightbox__nav:hover,
.lightbox__nav:focus-visible {
  background: rgba(255, 255, 255, 0.25);
}

.lightbox__nav svg {
  width: 24px;
  height: 24px;
}

.lightbox__nav--prev {
  left: var(--space-4);
}

.lightbox__nav--next {
  right: var(--space-4);
}

.lightbox__counter {
  position: absolute;
  top: var(--space-4);
  left: var(--space-4);
  color: rgba(255, 255, 255, 0.6);
  font-size: var(--text-sm);
  z-index: 2;
}

@media (max-width: 639px) {
  .lightbox__nav {
    width: 40px;
    height: 40px;
  }

  .lightbox__nav--prev {
    left: var(--space-2);
  }

  .lightbox__nav--next {
    right: var(--space-2);
  }
}
