/*!
 * Tema OrdiniPA — Stili dedicati alla homepage.
 *
 * Caricato SOLO su is_front_page() (vedi Assets::enqueueFrontend).
 * Affina i tre componenti che compongono la home:
 *   - it-hero-wrapper (template-parts/components/hero.php)
 *   - quick-access cards (template-parts/components/quick-access.php)
 *   - news-latest (template-parts/components/news-latest.php)
 */

/* -------------------------------------------------------------------------
 * HERO (it-hero-wrapper)
 * ------------------------------------------------------------------------- */
.oicf-home .it-hero-wrapper {
  position: relative;
  padding-top: 4rem;
  padding-bottom: 4rem;
}

.oicf-home .it-hero-wrapper .display-4 {
  line-height: 1.15;
  letter-spacing: -0.01em;
  font-weight: 700;
}

.oicf-home .it-hero-wrapper .lead {
  font-size: 1.125rem;
  line-height: 1.55;
  opacity: .92;
  max-width: 56ch;
}

.oicf-home .it-hero-wrapper .btn-light {
  font-weight: 600;
}

.oicf-home .it-hero-wrapper .btn-outline-light {
  font-weight: 600;
  border-width: 2px;
}

.oicf-hero-logo {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #fff;
  border-radius: 1rem;
  padding: 1.25rem 1.5rem;
  max-width: 320px;
  box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.12);
}

.oicf-hero-logo__img {
  width: 100%;
  height: auto;
  max-height: 260px;
  object-fit: contain;
}

@media (max-width: 991.98px) {
  .it-hero-wrapper .oicf-hero-logo {
    display: none;
  }
}

@media (min-width: 992px) {
  .oicf-home .it-hero-wrapper {
    padding-top: 5rem;
    padding-bottom: 5rem;
  }
}

/* -------------------------------------------------------------------------
 * QUICK ACCESS (4 card icona)
 * ------------------------------------------------------------------------- */
.oicf-home #quick-access-title {
  font-weight: 700;
}

.oicf-home .card-wrapper > .card {
  transition: transform .2s ease, box-shadow .2s ease;
  border-radius: .5rem;
}

.oicf-home .card-wrapper > .card:hover,
.oicf-home .card-wrapper > .card:focus-within {
  transform: translateY(-3px);
  box-shadow: 0 .75rem 1.5rem rgba(0, 0, 0, .08);
}

.oicf-home .card-wrapper > .card .card-body {
  padding: 1.5rem;
}

.oicf-home .card-wrapper > .card .icon {
  color: var(--bs-primary, #0066CC);
}

.oicf-home .card-wrapper > .card .card-title {
  color: var(--bs-primary, #0066CC);
  margin-bottom: .5rem;
}

.oicf-home .card-wrapper > .card .card-text {
  color: var(--bs-secondary, #5c6f82);
  margin-bottom: 0;
}

/* -------------------------------------------------------------------------
 * NEWS LATEST
 * ------------------------------------------------------------------------- */
.oicf-home section[aria-labelledby="news-latest-title"] {
  background: #f5f6f7;
}

.oicf-home #news-latest-title {
  font-weight: 700;
}

.oicf-home section[aria-labelledby="news-latest-title"] .btn-outline-primary {
  font-weight: 600;
}

/* -------------------------------------------------------------------------
 * AREE DI INTERVENTO / RICERCA SERVIZI — solo se compilata oicf_home_aree
 * ------------------------------------------------------------------------- */
.oicf-home-aree__card.card {
  align-items: flex-start;
  gap: 0.85rem;
  padding: 1.25rem 1.15rem;
  border: 1px solid #E6E9F2;
  border-bottom: 4px solid var(--bs-primary, #0066CC);
  background-color: #fff;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.oicf-home-aree__card.card:hover,
.oicf-home-aree__card.card:focus,
.oicf-home-aree__card.card:focus-visible,
.oicf-home-aree__card.card:active {
  transform: translateY(-3px);
  box-shadow: 0 .75rem 1.5rem rgba(0, 0, 0, .08);
  border: 1px solid var(--bs-primary, #0066CC);
  border-bottom: 4px solid var(--bs-primary, #0066CC);
  outline: none;
}

.oicf-home-aree__card .card-title {
  color: var(--bs-primary, #0066CC);
  font-weight: 600;
  min-height: 2.6em;
  margin-bottom: .5rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.oicf-home-aree__card .card-text {
  min-height: 3em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.oicf-home-aree__card .icon {
  width: 2rem;
  height: 2rem;
  min-width: 2rem;
  fill: currentColor;
}

.oicf-home-ricerca {
  background: #fff;
  border-top: 1px solid #dfe4ea;
}

.oicf-home-ricerca__form .form-label {
  font-weight: 600;
}

/* -------------------------------------------------------------------------
 * COMUNI (stemmi + link) — visibile solo se compilata l'opzione oicf_home_comuni
 * ------------------------------------------------------------------------- */
.oicf-home-comuni {
  background: #f5f6f7;
}

.oicf-home-comuni .row > .col {
  display: flex;
}

.oicf-home-comuni a.oicf-home-comuni__card.card {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 1.1rem 0.7rem;
  text-align: center;
  border-radius: 0.5rem;
  overflow: hidden;
  transition: transform .2s ease, box-shadow .2s ease, border-color .2s ease;
}

.oicf-home-comuni a.oicf-home-comuni__card.card::after {
  content: none;
  display: none;
  margin: 0;
}

.oicf-home-comuni__card:hover,
.oicf-home-comuni__card:focus-visible {
  transform: translateY(-3px);
  box-shadow: 0 .75rem 1.5rem rgba(0, 0, 0, .08);
  border-color: var(--bs-primary, #0066CC) !important;
}

.oicf-home-comuni__stemma-wrap {
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
  width: 4.75rem;
  height: 5.25rem;
  margin-inline: auto;
}

.oicf-home-comuni .card img.oicf-home-comuni__stemma {
  display: block;
  max-width: 72px;
  max-height: 84px;
  width: auto;
  height: auto;
  margin-inline: auto;
  object-fit: contain;
}

.oicf-home-comuni__fallback {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 4rem;
  height: 4rem;
  border-radius: 50%;
  background: #e6eef8;
  color: var(--bs-primary, #0066CC);
  font-weight: 700;
  font-size: 1.25rem;
}

.oicf-home-comuni__name {
  display: block;
  width: 100%;
  color: var(--bs-primary, #0066CC);
  font-weight: 600;
  font-size: 0.9rem;
  line-height: 1.25;
  margin: 0;
  text-align: center;
}

/* -------------------------------------------------------------------------
 * Spacing equilibrato fra le sezioni della home
 * ------------------------------------------------------------------------- */
.oicf-home > section + section,
.oicf-home > .it-hero-wrapper + section {
  margin-top: 0;
}

.oicf-home section {
  scroll-margin-top: 4rem;
}

/* Alternanza bianco / grigio sulle sezioni della home.
   Conta solo i <section> figli di .oicf-home, così resta corretta
   anche se una sezione manca (ricerca, comuni, link utili). */
.oicf-home > section {
  background-color: #fff;
}
.oicf-home > section:nth-of-type(even) {
  background-color: #f5f6f7;
}
.oicf-home > section.oicf-home-ricerca {
  border-top: none;
}
