/**
 * FAQ Component Styles
 * Lives in base theme — applies to all sites using the faq content type.
 *
 * Extends Bootstrap 5 accordion defaults. Subthemes override via CSS
 * variables in :root.
 *
 * Subtheme override tokens:
 *   --faq-border-color           Item dividers (default: subtle gray)
 *   --faq-question-color         Question text (default: body text color)
 *   --faq-question-active-color  Question text when expanded
 *   --faq-question-bg-active     Button bg when expanded
 *   --faq-answer-color           Answer text color
 *   --faq-icon-color             Chevron color
 *   --faq-category-heading-color Category group heading color
 */

/* Wrapper for a whole accordion list (View CSS class). */
.faq-accordion {
  max-width: 900px;
  margin: 0 auto;
}

/* Category group heading (from Views grouping). */
.faq-accordion .views-group-header,
.faq-accordion h3.views-group-title,
.faq-accordion .view-grouping-header {
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--faq-category-heading-color, var(--color-text, #2c4a2e));
  margin: 2.5rem 0 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 2px solid var(--faq-border-color, rgba(0, 0, 0, 0.1));
  letter-spacing: 0.01em;
}

.faq-accordion .views-group-header:first-child,
.faq-accordion .view-grouping:first-child .view-grouping-header {
  margin-top: 0;
}

/* Individual FAQ item. */
.faq-item {
  border: none;
  border-bottom: 1px solid var(--faq-border-color, rgba(0, 0, 0, 0.1));
  background: transparent;
  border-radius: 0;
}

.faq-item:last-child {
  border-bottom: none;
}

.faq-item__heading {
  margin: 0;
  font-family: var(--font-body, inherit);
}

/* Override Bootstrap accordion-button defaults. */
.faq-item__button {
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--faq-question-color, var(--color-text, #2d2d2d));
  background: transparent;
  padding: 1.15rem 1rem 1.15rem 0;
  box-shadow: none;
  border: none;
  text-align: left;
  width: 100%;
  line-height: 1.4;
  transition: color 0.15s ease;
}

.faq-item__button:hover {
  color: var(--faq-question-active-color, var(--color-link, #c17d3c));
  background: transparent;
}

.faq-item__button:focus {
  outline: 2px solid var(--color-link, #c17d3c);
  outline-offset: 2px;
  box-shadow: none;
}

.faq-item__button:not(.collapsed) {
  color: var(--faq-question-active-color, var(--color-link, #c17d3c));
  background: var(--faq-question-bg-active, transparent);
  box-shadow: none;
}

/* Chevron icon — override Bootstrap default with themed color. */
.faq-item__button::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%238a8d88'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
  transition: transform 0.25s ease;
  flex-shrink: 0;
}

.faq-item__button:not(.collapsed)::after {
  background-image: url("data:image/svg+xml,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16' fill='%23c17d3c'%3e%3cpath fill-rule='evenodd' d='M1.646 4.646a.5.5 0 0 1 .708 0L8 10.293l5.646-5.647a.5.5 0 0 1 .708.708l-6 6a.5.5 0 0 1-.708 0l-6-6a.5.5 0 0 1 0-.708z'/%3e%3c/svg%3e");
}

/* Panel body. */
.faq-item__body {
  padding: 0 1rem 1.25rem 0;
  color: var(--faq-answer-color, var(--color-text, #2d2d2d));
  font-size: 0.95rem;
  line-height: 1.6;
}

.faq-item__body p:first-child {
  margin-top: 0;
}

.faq-item__body p:last-child {
  margin-bottom: 0;
}

.faq-item__body ul,
.faq-item__body ol {
  padding-left: 1.25rem;
}

.faq-item__body a {
  color: var(--color-link, #c17d3c);
  text-decoration: underline;
}
