/**
 * Shared FAQ component.
 */

.jci-faqs {
  margin-top: 80px;
  margin-bottom: 80px;
}

.jci-faqs details {
  border-top: 4px solid #f1eff0;
}

.jci-faqs details:last-child {
  border-bottom: 4px solid #f1eff0;
}

.jci-faqs summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 10px 10px 10px 0;
  font-size: 16px;
  cursor: pointer;
  list-style: none;
}

.jci-faqs summary::-webkit-details-marker {
  display: none;
}

.jci-faqs__icon {
  flex: 0 0 auto;
  transition: transform 180ms ease;
}

.jci-faqs details[open] .jci-faqs__icon {
  transform: rotate(180deg);
}

.jci-faqs__answer {
  max-width: var(--jci-container-max-reading);
  padding: 0 30px 18px 0;
  overflow: clip;
  transform-origin: top left;
}

.jci-faqs details[open] .jci-faqs__answer {
  animation: jci-faq-answer-reveal 180ms cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes jci-faq-answer-reveal {
  from {
    opacity: 0;
    transform: translateY(-4px);
  }

  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.jci-faqs summary:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 4px;
}

@media (max-width: 768px) {
  /* Multi-line FAQ questions read from the top edge on mobile. Keep the shared
   * icon aligned with the first text line rather than vertically centering it. */
  .jci-faqs summary {
    align-items: flex-start;
  }

  .jci-faqs__icon {
    margin-top: 2px;
  }

  /* Program singles share one touch-friendly FAQ rhythm. Short Program keeps
   * its already-approved local declarations, which resolve to these same
   * values; Long Program can now reuse the component without a second design. */
  body.single-program .jci-faqs {
    margin-top: clamp(52px, 12vw, 62px);
  }

  body.single-program .jci-faqs > h2 {
    margin-bottom: 18px;
    font-size: clamp(26px, 7vw, 30px);
    line-height: 1.1;
    letter-spacing: -0.02em;
  }

  body.single-program .jci-faqs details {
    border-top-width: 2px;
  }

  body.single-program .jci-faqs details:last-child {
    border-bottom-width: 2px;
  }

  body.single-program .jci-faqs summary {
    align-items: flex-start;
    min-height: 44px;
    padding: 12px 4px 12px 0;
    line-height: 1.4;
  }

  body.single-program .jci-faqs__icon {
    margin-top: 2px;
  }

  body.single-program .jci-faqs__answer {
    padding: 0 28px 18px 0;
  }

  body.single-program .jci-faqs__answer p {
    margin-top: 0;
    font-size: 16px;
    line-height: 1.55;
  }
}

@media (prefers-reduced-motion: reduce) {
  .jci-faqs__icon {
    transition: none;
  }

  .jci-faqs details[open] .jci-faqs__answer {
    animation: none;
  }
}
