/**
 * Widget FAQ (Accordion)
 *
 * @package Martina
 */

.w-faq {
  display: grid;
  gap: 12px;
  max-width: 780px;
  margin: 0 auto;
}

.w-faq__item {
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.65);
  border: 1px solid rgba(0, 0, 0, 0.06);
  overflow: hidden;
  transition: box-shadow 320ms ease;
}

.w-faq__item:hover {
  box-shadow: var(--shadow-sm);
}

.w-faq__item.is-open {
  box-shadow: var(--shadow-md);
}

.w-faq__question {
  width: 100%;
  text-align: left;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 18px 20px;
  background: transparent;
  border: none;
  cursor: pointer;
  transition: background-color 220ms ease;
}

.w-faq__question:hover {
  background: rgba(var(--color-primary-rgb), 0.15);
}

.w-faq__questionText {
  flex: 1;
  font-weight: 700;
  font-size: 1.05rem;
  line-height: 1.3;
  color: var(--theme-text);
}

.w-faq__icon {
  flex: 0 0 auto;
  position: relative;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: rgba(var(--color-primary-rgb), 0.3);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), background-color 220ms ease;
}

/* Icona + (croce) */
.w-faq__icon::before,
.w-faq__icon::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  background: var(--color-text-primary);
  transition: transform 320ms cubic-bezier(0.22, 1, 0.36, 1), opacity 320ms ease;
}

.w-faq__icon::before {
  width: 12px;
  height: 2px;
  transform: translate(-50%, -50%);
}

.w-faq__icon::after {
  width: 2px;
  height: 12px;
  transform: translate(-50%, -50%);
}

/* Stato aperto: icona diventa - (meno) */
.w-faq__item.is-open .w-faq__icon {
  background: rgba(var(--color-primary-rgb), 0.5);
}

.w-faq__item.is-open .w-faq__icon::after {
  opacity: 0;
  transform: translate(-50%, -50%) rotate(90deg);
}

.w-faq__answer {
  overflow: hidden;
  transition: max-height 500ms cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 450ms cubic-bezier(0.4, 0, 0.2, 1),
              padding 500ms cubic-bezier(0.4, 0, 0.2, 1);
  max-height: 0;
  opacity: 0;
  padding: 0 20px;
}

.w-faq__item.is-open .w-faq__answer {
  opacity: 1;
  padding: 0 20px 20px;
}

/* Transizione più fluida per chiusura */
.w-faq__item:not(.is-open) .w-faq__answer {
  transition: max-height 400ms cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 350ms cubic-bezier(0.4, 0, 0.2, 1) 50ms,
              padding 400ms cubic-bezier(0.4, 0, 0.2, 1);
}

.w-faq__answerInner {
  padding: 0 20px 20px;
  color: var(--theme-muted);
  line-height: 1.7;
}

.w-faq__answerInner p {
  margin: 0 0 10px;
}

.w-faq__answerInner p:last-child {
  margin-bottom: 0;
}

/* Contenuto articolato: elenchi e grassetti dall’editor */
.w-faq__answerInner ul,
.w-faq__answerInner ol {
  margin: 0 0 12px;
  padding-left: 1.4em;
}

.w-faq__answerInner li {
  margin-bottom: 6px;
}

.w-faq__answerInner li:last-child {
  margin-bottom: 0;
}

.w-faq__answerInner strong {
  font-weight: 700;
  color: var(--theme-text);
}

@media (prefers-reduced-motion: reduce) {
  .w-faq__item,
  .w-faq__question,
  .w-faq__icon,
  .w-faq__icon::before,
  .w-faq__icon::after,
  .w-faq__answer {
    transition: none;
  }
}
