.pannelli-servizi {
  width: 100%;
}

.pannelli-wrap {
  display: flex;
  gap: 16px;
  align-items: stretch;
}

/* Card base */
.pannello {
  position: relative;
  flex: 1 1 0;
  min-width: 0;
  height: 520px;
  border-radius: 22px;
  overflow: hidden;
  background-size: cover;
  background-position: center;
  cursor: pointer;
  outline: none;
  transition:
    flex 300ms ease,
    transform 300ms ease;
}

/* Overlay per leggibilità testo */
.pannello-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(
    to bottom,
    rgba(0, 0, 0, 0.1) 0%,
    rgba(0, 0, 0, 0.25) 45%,
    rgba(0, 0, 0, 0.6) 100%
  );
}

/* Top: tags + icona */
.pannello-top {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
}

.pannello-tags {
  display: none;
  animation: pannelliFadeIn 180ms ease-out;
}

@keyframes pannelliFadeIn {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.pannello.is-active .pannello-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.pannello-tag {
  display: inline-flex;
  align-items: center;
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.35);
  color: #fff;
  font-size: 12px;
  letter-spacing: 0.02em;
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
}

/* Freccia: SEMPRE in alto a destra (PNG via CSS) */
.pannello-cta {
  position: absolute;
  top: 0px;
  right: 0px;
  width: 44px;
  height: 44px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.85);
  z-index: 3;

  /* PNG custom */
  background-image: url("/wp-content/uploads/2026/01/arrow-attrazioni.png");
  background-repeat: no-repeat;
  background-position: center;
  background-size: 14px 14px;

  pointer-events: none; /* simbolica: non cliccabile */
}

/* Bottom: title + desc */
.pannello-content {
  position: absolute;
  left: 18px;
  right: 18px;
  bottom: 18px;
  z-index: 2;
  color: #fff;
}

.pannello-title {
  margin: 0 0 10px 0;
  font-size: 30px;
  line-height: 1.02;
  text-transform: uppercase;
  font-family: "Gopher Black";
}

.pannello-desc {
  margin: 0;
  font-size: 16px;
  line-height: 20px;
  max-width: 44ch;
}

/* Stato attivo: card più larga come prima in foto */
.pannello.is-active {
  flex: 2.4 1 0;
}

/* Focus accessibile */
.pannello:focus-visible {
  box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.8);
}

/* Responsive */
@media (max-width: 1024px) and (min-width: 768px) {
  .pannelli-wrap {
    flex-wrap: wrap;
    gap: 12px;
  }

  /* Prima card: sempre aperta, full width in cima */
  .pannello:first-child {
    flex: 1 1 100%;
    width: 100%;
    height: 380px;
    cursor: default;
    pointer-events: none;
  }

  .pannello:first-child .pannello-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
  }

  .pannello:first-child .pannello-desc {
    display: block;
  }

  .pannello:first-child .pannello-title {
    font-size: 30px;
  }

  .pannello:first-child .pannello-cta {
    display: none;
  }

  /* Le altre 3 card: riga sotto, espandibili */
  .pannello:not(:first-child) {
    flex: 1 1 0;
    min-width: 0;
    height: 300px;
  }

  .pannello:not(:first-child).is-active {
    flex: 2.2 1 0;
  }

  .pannello:not(:first-child):not(.is-active) .pannello-title {
    font-size: 18px;
    line-height: 1.1;
  }

  .pannello:not(:first-child):not(.is-active) .pannello-desc {
    display: none;
  }

  .pannello:not(:first-child).is-active .pannello-title {
    font-size: 24px;
  }
}

@media (max-width: 767px) {
  .pannelli-wrap {
    flex-direction: column;
    gap: 12px;
  }

  /* Tutte le card impilate, stessa altezza, tutte "aperte" */
  .pannello,
  .pannello:first-child {
    flex: none !important;
    width: 100% !important;
    height: 380px !important;
    cursor: pointer !important;
    pointer-events: auto !important;
    display: block !important;
    transition: none;
  }

  /* Tags sempre visibili */
  .pannello .pannello-tags,
  .pannello:first-child .pannello-tags {
    display: flex !important;
    flex-wrap: wrap;
    gap: 8px;
  }

  /* Descrizione sempre visibile */
  .pannello .pannello-desc,
  .pannello:first-child .pannello-desc {
    display: block !important;
    -webkit-line-clamp: unset !important;
    overflow: visible !important;
  }

  .pannello .pannello-title {
    font-size: 30px;
    line-height: 1.1;
  }

  /* Nascondi freccia */
  .pannello-cta {
    display: none;
  }

  /* Posiziona top e content a 26px dai bordi */
  .pannello-top {
    top: 26px;
    left: 0;
    right: 0;
  }

  .pannello-content {
    left: 26px;
    right: 26px;
    bottom: 26px;
  }

  /* Riduci dimensioni tag */
  .pannello-tag {
    padding: 6px 10px;
    font-size: 10px;
  }
}

/* Desktop: comportamento card non attive */
@media (min-width: 768px) {
  .pannello:not(.is-active) .pannello-desc {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }

  .pannello:not(.is-active) .pannello-title {
    font-size: 28px;
    line-height: 1.05;
  }
}
