/**
 * OSM Banner Homepage - stile front office
 *
 * Tutte le personalizzazioni (colori, proporzioni, posizioni, dimensioni del
 * titolo) si fanno dalle variabili CSS del blocco .osmbh qui sotto.
 * Lo stile e confinato dentro .osmbh: non tocca il resto del tema.
 */

/* Poppins self-hosted (SIL Open Font License 1.1 - vedi views/fonts/OFL.txt).
   Stesso nome di famiglia usato da osmservices: se entrambi i CSS sono caricati
   il browser scarica il font una volta sola. */

@font-face {
  font-family: 'OSM Poppins';
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url('../fonts/poppins-latin-400-normal.woff2') format('woff2');
}

@font-face {
  font-family: 'OSM Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('../fonts/poppins-latin-600-normal.woff2') format('woff2');
}

.osmbh {
  /* Tipografia */
  --osmbh-font: 'OSM Poppins', 'Poppins', system-ui, -apple-system, 'Segoe UI', sans-serif;

  /* Colori */
  --osmbh-bg: #141a28;
  --osmbh-veil-rgb: 20, 26, 40;
  --osmbh-title-color: #ffffff;
  --osmbh-text-color: rgba(255, 255, 255, 0.86);

  /* Desktop */
  --osmbh-ratio: 2 / 1;
  --osmbh-min-height: 420px;
  --osmbh-focus: 50% 20%;
  --osmbh-veil: linear-gradient(180deg,
      rgba(var(--osmbh-veil-rgb), 0.88) 0%,
      rgba(var(--osmbh-veil-rgb), 0.55) 22%,
      rgba(var(--osmbh-veil-rgb), 0) 40%);
  --osmbh-content-top: 13.75%;
  --osmbh-gutter: clamp(1.5rem, 8.33vw, 7.5rem);
  --osmbh-title-size: clamp(2.25rem, 4.03vw, 3.625rem);
  --osmbh-text-size: clamp(1rem, 1.35vw, 1.25rem);

  /* Mobile (< 768 px) */
  --osmbh-m-band: 5rem;
  --osmbh-m-ratio: 13 / 10;
  --osmbh-m-focus: 50% 50%;
  --osmbh-m-veil: linear-gradient(180deg,
      rgb(var(--osmbh-veil-rgb)) 0%,
      rgba(var(--osmbh-veil-rgb), 0.6) 18%,
      rgba(var(--osmbh-veil-rgb), 0) 40%);
  --osmbh-m-content-top: 0.75rem;
  --osmbh-m-gutter: 1.5rem;
  --osmbh-m-title-size: 2rem;
  --osmbh-m-text-size: 0.9375rem;

  position: relative;
  width: 100%;
  margin: 0;
  overflow: hidden;
  background: var(--osmbh-bg);
  font-family: var(--osmbh-font);
  -webkit-font-smoothing: antialiased;
}

.osmbh *,
.osmbh *::before,
.osmbh *::after {
  box-sizing: border-box;
}

/* Immagine ---------------------------------------------------------------- */

.osmbh__media {
  position: relative;
  aspect-ratio: var(--osmbh-ratio);
  min-height: var(--osmbh-min-height);
}

.osmbh__media picture,
.osmbh .osmbh__img {
  position: absolute;
  top: 0;
  left: 0;
  display: block;
  width: 100%;
  height: 100%;
  max-width: none;
}

.osmbh .osmbh__img {
  object-fit: cover;
  object-position: var(--osmbh-focus);
}

/* velatura solo quando c'e del testo da rendere leggibile */
.osmbh--text .osmbh__media::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  background: var(--osmbh-veil);
  pointer-events: none;
}

/* Testi ------------------------------------------------------------------- */

.osmbh__content {
  position: absolute;
  z-index: 2;
  top: var(--osmbh-content-top);
  left: 0;
  right: 0;
  padding: 0 var(--osmbh-gutter);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
  text-align: center;
}

.osmbh .osmbh__title {
  margin: 0;
  padding: 0;
  border: 0;
  background: none;
  font-family: var(--osmbh-font);
  font-size: var(--osmbh-title-size);
  line-height: 1.14;
  font-weight: 600;
  letter-spacing: -0.02em;
  text-transform: none;
  color: var(--osmbh-title-color);
  text-wrap: balance;
}

.osmbh .osmbh__text {
  margin: 0;
  max-width: 46rem;
  font-family: var(--osmbh-font);
  font-size: var(--osmbh-text-size);
  line-height: 1.6;
  font-weight: 400;
  color: var(--osmbh-text-color);
}

/* Mobile ------------------------------------------------------------------ */

@media (max-width: 767.98px) {
  .osmbh {
    padding-top: var(--osmbh-m-band);
  }

  .osmbh__media {
    aspect-ratio: var(--osmbh-m-ratio);
    min-height: 0;
  }

  .osmbh .osmbh__img {
    object-position: var(--osmbh-m-focus);
  }

  .osmbh--text .osmbh__media::after {
    background: var(--osmbh-m-veil);
  }

  .osmbh__content {
    top: calc(var(--osmbh-m-band) + var(--osmbh-m-content-top));
    padding: 0 var(--osmbh-m-gutter);
    gap: 0.5rem;
  }

  .osmbh .osmbh__title {
    font-size: var(--osmbh-m-title-size);
    line-height: 1.15;
  }

  .osmbh .osmbh__text {
    font-size: var(--osmbh-m-text-size);
  }
}
