/*
 * FAQ block - structural layout, plus the background/text color below
 * (colors constrained to the theme.json palette via the color picker
 * fields, same approach as every other block). Color Theme is deliberately
 * NOT styled here - it only adds a --theme-{value} modifier class for the
 * theme's own stylesheet to target, same convention as text-columns.
 */

.wp-block-prontoblocks-faq {
  background-color: var(--prontoblocks-faq-bg-color, transparent);
  color: var(--prontoblocks-faq-text-color, inherit);
}

.wp-block-prontoblocks-faq__inner {
  width: 100%;
}

.wp-block-prontoblocks-faq--contain .wp-block-prontoblocks-faq__inner {
  max-width: var(--wp--style--global--wide-size, 1432px);
  margin-inline: auto;
  padding-inline: var(--wp--preset--spacing--8, 24px);
}

.wp-block-prontoblocks-faq__header {
  margin-bottom: 2rem;
  max-width: 720px;
}

.wp-block-prontoblocks-faq__header--align-left {
  text-align: left;
}

.wp-block-prontoblocks-faq__header--align-center {
  text-align: center;
  margin-inline: auto;
}

.wp-block-prontoblocks-faq__header--align-right {
  text-align: right;
  margin-inline: auto 0;
}

.wp-block-prontoblocks-faq__eyebrow {
  margin: 0 0 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-size: 0.875rem;
}

.wp-block-prontoblocks-faq__title {
  margin: 0 0 0.5rem;
}

.wp-block-prontoblocks-faq__list {
  max-width: 800px;
}

.wp-block-prontoblocks-faq--contain .wp-block-prontoblocks-faq__list,
.wp-block-prontoblocks-faq__header--align-center + .wp-block-prontoblocks-faq__list {
  margin-inline: auto;
}

.wp-block-prontoblocks-faq__item {
  border-bottom: 1px solid rgba(0, 0, 0, 0.12);
}

.wp-block-prontoblocks-faq__item:first-child {
  border-top: 1px solid rgba(0, 0, 0, 0.12);
}

.wp-block-prontoblocks-faq__question {
  margin: 0;
}

.wp-block-prontoblocks-faq__question-button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  width: 100%;
  padding: 1.25rem 0;
  background: none;
  border: none;
  color: inherit;
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}

.wp-block-prontoblocks-faq__icon {
  display: flex;
  flex-shrink: 0;
  width: 1rem;
  height: 1rem;
}

.wp-block-prontoblocks-faq__icon svg {
  display: block;
  width: 100%;
  height: 100%;
  transition: transform 0.3s ease-in-out;
}

/*
 * Down chevron by default (closed); rotates to point up once open - same
 * "rotate the closed-state icon" approach as a plus/minus toggle, just with
 * a chevron instead.
 */
.wp-block-prontoblocks-faq__item.is-open .wp-block-prontoblocks-faq__icon svg {
  transform: rotate(180deg);
}

/*
 * Slide open/closed via the grid-template-rows 0fr -> 1fr technique - this
 * animates to the answer's actual (dynamic) content height without any JS
 * measuring, unlike a height/max-height transition. __answer is the grid
 * container; __answer-inner clips the content while collapsed (a 0fr row
 * still lays out its content at full height internally, so something has to
 * hide the overflow) and carries min-height: 0 so it can actually shrink
 * below its content's intrinsic size.
 */
.wp-block-prontoblocks-faq__answer {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.35s ease-in-out;
}

.wp-block-prontoblocks-faq__item.is-open .wp-block-prontoblocks-faq__answer {
  grid-template-rows: 1fr;
}

.wp-block-prontoblocks-faq__answer-inner {
  overflow: hidden;
  min-height: 0;
}

.wp-block-prontoblocks-faq__answer-text {
  margin: 0;
  padding-bottom: 1.25rem;
}

/*
 * The theme's base typography sets `color` directly on `p`/heading elements,
 * which wins over inheritance from an ancestor regardless of the ancestor's
 * own specificity (see the identical override in text-columns/style.css and
 * featured-text/style.css). :where() keeps this at a single class'
 * specificity so it still beats the bare element selector without
 * outranking anything more specific added later.
 */
.wp-block-prontoblocks-faq :where(p, h1, h2, h3, h4, h5, h6, li, blockquote) {
  color: var(--prontoblocks-faq-text-color, inherit);
}

@media (prefers-reduced-motion: reduce) {
  .wp-block-prontoblocks-faq__icon svg,
  .wp-block-prontoblocks-faq__answer {
    transition: none;
  }
}
