/* ─── FAQ — Themeable via CSS variables ───────────────────────────────────────
   Variables are set by JS on the root container element, so each FAQ
   instance on the same page can have a different theme.
   ─────────────────────────────────────────────────────────────────────────── */

/* ─── Container ──────────────────────────────────────────────────────────── */

[data-faq] {
  font-family: var(--faq-font, system-ui, -apple-system, 'Segoe UI', sans-serif);
  color: var(--faq-text, #1a1a1a);
}

.faq-wrap {
  max-width: 760px;
  margin: 0 auto;
}

/* ─── Tabs ───────────────────────────────────────────────────────────────── */

.faq-tabs {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-bottom: 28px;
}

.faq-tab {
  padding: 8px 20px;
  border: 1.5px solid var(--faq-border, #e0e0e0);
  border-radius: 100px;
  background: transparent;
  color: var(--faq-muted, #666);
  font-family: var(--faq-font, system-ui, sans-serif);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  text-align: center;
}

.faq-tab:hover {
  border-color: var(--faq-primary, #1a1a1a);
  color: var(--faq-text, #1a1a1a);
}

.faq-tab.is-active {
  border-color: var(--faq-primary, #1a1a1a);
  background: var(--faq-primary, #1a1a1a);
  color: #fff;
}

/* ─── Panels ─────────────────────────────────────────────────────────────── */

.faq-panel {
  display: none;
}

.faq-panel.is-active {
  display: block;
}

/* ─── Accordion list ─────────────────────────────────────────────────────── */

.faq-list {
  display: flex;
  flex-direction: column;
  gap: 0;
}

/* ─── Item ───────────────────────────────────────────────────────────────── */

.faq-item {
  border-bottom: 1px solid var(--faq-border, #e0e0e0);
}

.faq-item:first-child {
  border-top: 1px solid var(--faq-border, #e0e0e0);
}

/* ─── Question button ────────────────────────────────────────────────────── */

.faq-question {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  width: 100%;
  padding: 20px 0;
  background: none;
  border: none;
  cursor: pointer;
  font-family: var(--faq-font, system-ui, sans-serif);
  text-align: left;
}

.faq-question-text {
  font-size: 16px;
  font-weight: 600;
  color: var(--faq-text, #1a1a1a);
  line-height: 1.4;
  transition: color 0.15s;
}

.faq-question:hover .faq-question-text {
  color: var(--faq-primary, #1a1a1a);
}

.faq-item.is-open .faq-question-text {
  color: var(--faq-primary, #1a1a1a);
}

/* ─── Chevron ────────────────────────────────────────────────────────────── */

.faq-chevron {
  flex-shrink: 0;
  width: 20px;
  height: 20px;
  color: var(--faq-muted, #666);
  transition: transform 0.28s ease, color 0.15s;
}

.faq-chevron svg {
  width: 100%;
  height: 100%;
  display: block;
}

.faq-item.is-open .faq-chevron {
  transform: rotate(180deg);
  color: var(--faq-primary, #1a1a1a);
}

/* ─── Answer — smooth height via grid trick ──────────────────────────────── */

.faq-body-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.28s ease;
}

.faq-item.is-open .faq-body-wrap {
  grid-template-rows: 1fr;
}

.faq-body-inner {
  overflow: hidden;
}

.faq-answer {
  padding-bottom: 20px;
  font-size: 15px;
  color: var(--faq-muted, #666);
  line-height: 1.75;
}

/* Allow rich HTML in answers */
.faq-answer p {
  margin: 0 0 12px;
}

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

.faq-answer ul,
.faq-answer ol {
  margin: 8px 0 12px;
  padding-left: 20px;
}

.faq-answer li {
  margin-bottom: 6px;
}

.faq-answer a {
  color: var(--faq-primary, #1a1a1a);
}

.faq-answer strong {
  color: var(--faq-text, #1a1a1a);
  font-weight: 600;
}

/* ─── Mobile ─────────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
  .faq-tab {
    font-size: 13px;
    padding: 7px 16px;
  }

  .faq-question {
    padding: 16px 0;
  }

  .faq-question-text {
    font-size: 15px;
  }

  .faq-answer {
    font-size: 14px;
  }
}