/* ! =========================
   SETTORI GRID RESTYLE
========================= */

.sector-applications-section {
  padding: 90px 0;
}

.sector-applications-wrapper {
  max-width: 1320px;
  margin: 0 auto;
}

/* =========================
   HEADER
========================= */

.sector-applications-head {
  margin-bottom: 26px;
}

.sector-applications-head h2 {
  margin: 0;

  color: #717985;

  font-size: clamp(2rem, 3vw, 3.1rem);
  line-height: 0.95;

  font-weight: 900;
  letter-spacing: -0.055em;
}

/* =========================
   GRID
========================= */

.sector-grid {
  display: grid;

  grid-template-columns: repeat(3, minmax(0, 1fr));

  gap: 16px;

  align-items: stretch;
}

/* =========================
   CARD
========================= */

.sector-card {
  position: relative;

  min-width: 0;
  min-height: 320px;

  border-radius: 14px;

  overflow: hidden;

  display: flex;
  align-items: flex-end;

  background: #101217;

  color: #ffffff;
  text-decoration: none;

  box-shadow: 0 18px 38px rgba(15, 17, 25, 0.1);

  isolation: isolate;

  transition:
    transform 0.3s ease,
    box-shadow 0.3s ease;
}

.sector-card:hover {
  color: #ffffff;
  text-decoration: none;

  transform: translateY(-4px);

  box-shadow: 0 24px 48px rgba(15, 17, 25, 0.17);
}

/* =========================
   IMAGE
========================= */

.sector-card-img {
  position: absolute;
  inset: 0;

  z-index: 1;

  display: block;

  width: 100%;
  height: 100%;

  object-fit: cover;
  object-position: center;

  transform: scale(1);

  transition:
    transform 0.45s ease,
    filter 0.35s ease;
}

.sector-card:hover .sector-card-img {
  transform: scale(1.07);

  filter: brightness(0.92);
}

/* =========================
   OVERLAY
========================= */

.sector-card-overlay {
  position: absolute;
  inset: 0;

  z-index: 2;

  background: linear-gradient(
    180deg,
    rgba(15, 17, 25, 0.05) 0%,
    rgba(15, 17, 25, 0.18) 35%,
    rgba(15, 17, 25, 0.5) 68%,
    rgba(15, 17, 25, 0.9) 100%
  );

  transition: background 0.35s ease;
}

/*
 * In hover rendiamo più scura
 * l'intera immagine per permettere
 * la lettura anche dei testi lunghi.
 */
.sector-card:hover .sector-card-overlay {
  background: linear-gradient(
    180deg,
    rgba(0, 45, 60, 0.35) 0%,
    rgba(0, 55, 72, 0.55) 38%,
    rgba(0, 42, 57, 0.78) 68%,
    rgba(0, 25, 35, 0.96) 100%
  );
}

/* =========================
   CONTENT
========================= */

.sector-card-content {
  position: relative;

  z-index: 3;

  width: 100%;

  padding: 26px;

  color: #ffffff;

  /*
   * Evita che eventuali elementi
   * interni vengano tagliati.
   */
  overflow: visible;
}

/* =========================
   TITLE
========================= */

.sector-card-content h3 {
  margin: 0;

  max-width: 300px;

  color: #ffffff;

  font-size: clamp(1.45rem, 2vw, 2rem);
  line-height: 0.98;

  font-weight: 900;
  letter-spacing: -0.045em;

  text-shadow: 0 8px 22px rgba(15, 17, 25, 0.24);

  transition: margin-bottom 0.35s ease;
}

/* =========================
   TEXT
========================= */

.sector-card-text {
  max-height: 0;

  margin-top: 0;

  overflow: hidden;

  color: rgba(255, 255, 255, 0.94);

  font-size: 0.92rem;
  line-height: 1.5;

  opacity: 0;

  transform: translateY(10px);

  transition:
    max-height 0.45s ease,
    margin-top 0.35s ease,
    opacity 0.3s ease,
    transform 0.35s ease;
}

/*
 * IMPORTANTE:
 * 300px lascia spazio sufficiente
 * anche ai testi più lunghi.
 */
.sector-card:hover .sector-card-text {
  max-height: 300px;

  margin-top: 14px;

  opacity: 1;

  transform: translateY(0);
}

/* Testi generati dal CMS */

.sector-card-text p {
  margin: 0;

  color: inherit;

  font-size: inherit;
  line-height: inherit;
}

.sector-card-text p + p {
  margin-top: 8px;
}

/* =========================
   CTA
========================= */

.sector-card-link {
  display: inline-flex;
  align-items: center;

  width: fit-content;

  margin-top: 0;

  color: #ffffff;

  font-size: 0.86rem;
  line-height: 1.2;

  font-weight: 800;

  text-transform: uppercase;
  letter-spacing: 0.04em;

  opacity: 0;

  transform: translateY(8px);

  transition:
    margin-top 0.35s ease,
    opacity 0.3s ease,
    transform 0.35s ease,
    color 0.2s ease;
}

.sector-card-link::after {
  content: "→";

  margin-left: 8px;

  transform: translateX(0);

  transition: transform 0.25s ease;
}

/* CTA hover */

.sector-card:hover .sector-card-link {
  margin-top: 18px;

  opacity: 1;

  transform: translateY(0);
}

.sector-card:hover .sector-card-link::after {
  transform: translateX(4px);
}

/* =========================
   TABLET
========================= */

@media (max-width: 991.98px) {
  .sector-applications-section {
    padding: 72px 0;
  }

  .sector-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sector-card {
    min-height: 340px;
  }
}

/* =========================
   MOBILE
========================= */

@media (max-width: 767.98px) {
  .sector-applications-section {
    padding: 58px 0;
  }

  /* Grid */

  .sector-grid {
    grid-template-columns: 1fr;

    gap: 14px;
  }

  /* Card */

  .sector-card {
    min-height: 380px;

    border-radius: 16px;
  }

  /* Overlay sempre più leggibile
     perché da mobile il testo
     rimane sempre aperto */

  .sector-card-overlay {
    background: linear-gradient(
      180deg,
      rgba(15, 17, 25, 0.04) 0%,
      rgba(15, 17, 25, 0.22) 30%,
      rgba(15, 17, 25, 0.66) 58%,
      rgba(15, 17, 25, 0.96) 100%
    );
  }

  /* Content */

  .sector-card-content {
    padding: 24px;
  }

  /* Title */

  .sector-card-content h3 {
    max-width: 100%;

    font-size: 2rem;
  }

  /*
   * MOBILE:
   * testo sempre visibile.
   * Non dipendiamo dall'hover.
   */

  .sector-card-text {
    max-height: none;

    margin-top: 14px;

    overflow: visible;

    opacity: 1;

    transform: none;

    font-size: 0.9rem;
    line-height: 1.5;
  }

  /* CTA sempre visibile */

  .sector-card-link {
    margin-top: 18px;

    opacity: 1;

    transform: none;
  }

  /* Disattiviamo l'effetto di espansione
     perché il contenuto è già aperto */

  .sector-card:hover .sector-card-text {
    max-height: none;

    margin-top: 14px;
  }

  .sector-card:hover .sector-card-link {
    margin-top: 18px;
  }
}
