/* ============================================================
   cx-faq — Animated FAQ with category tabs + Plus-rotating items
   Vanilla port of faq-tabs.tsx (21st.dev / framer-motion)
   ============================================================ */

.cx-faq {
  --cx-faq-primary: var(--cx-blue, #00828c);
  --cx-faq-primary-soft: rgba(28,164,175, .12);
  --cx-faq-card-bg: var(--cx-card, #fff);
  --cx-faq-card-bg-open: rgba(248, 250, 252, .6);
  --cx-faq-line: var(--cx-line, #e0e5e9);
  --cx-faq-ink: var(--cx-ink, #021521);
  --cx-faq-mute: var(--cx-ink-soft, #47555d);

  position: relative;
  overflow: hidden;
  padding: 88px 16px 96px;
  font-family: inherit;
}

/* ---------- Header with gradient subtitle + radial glow ---------- */

.cx-faq__head {
  position: relative;
  z-index: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  margin: 0 auto 44px;
  max-width: 760px;
}

.cx-faq__sub {
  margin-bottom: 18px;
  font-size: 13.5px;
  font-weight: 600;
  letter-spacing: .005em;
  background: linear-gradient(90deg, var(--cx-faq-primary), rgba(28,164,175, .55));
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.cx-faq__title {
  margin: 0 0 12px;
  font-size: clamp(2rem, 3.5vw + .5rem, 3rem);
  font-weight: 800;
  letter-spacing: -.025em;
  line-height: 1.05;
  color: var(--cx-faq-ink);
}

.cx-faq__lead {
  margin: 6px 0 0;
  color: var(--cx-faq-mute);
  font-size: 1rem;
  line-height: 1.55;
  max-width: 540px;
}

.cx-faq__glow {
  position: absolute;
  top: -360px;
  left: 50%;
  width: 620px;
  height: 520px;
  border-radius: 999px;
  background: radial-gradient(circle at center, rgba(28,164,175, .14) 0%, rgba(28,164,175, .05) 45%, transparent 75%);
  filter: blur(54px);
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 0;
}

/* ---------- Category tabs ---------- */

.cx-faq__tabs {
  position: relative;
  z-index: 1;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 10px;
  margin-bottom: 44px;
}

.cx-faq__tab {
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  border: 1px solid var(--cx-faq-line);
  background: transparent;
  border-radius: 8px;
  padding: 7px 14px;
  font-family: inherit;
  font-size: 13.5px;
  font-weight: 600;
  color: var(--cx-faq-mute);
  cursor: pointer;
  transition: color .35s cubic-bezier(.4,0,.2,1), border-color .35s cubic-bezier(.4,0,.2,1);
}

.cx-faq__tab:hover { color: var(--cx-faq-ink); }

.cx-faq__tab:focus-visible {
  outline: 2px solid var(--cx-faq-primary);
  outline-offset: 3px;
}

.cx-faq__tab[aria-selected="true"] {
  color: #fff;
  border-color: var(--cx-faq-primary);
}

/* Slide-up fill on the active tab (mimics framer-motion backIn) */
.cx-faq__tab__fill {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(90deg, var(--cx-faq-primary), rgba(28,164,175, .85));
  transform: translateY(100%);
  transition: transform .5s cubic-bezier(.55, -0.2, .6, 1.3); /* approximation of backIn */
}

.cx-faq__tab[aria-selected="true"] .cx-faq__tab__fill { transform: translateY(0); }

.cx-faq__tab__label {
  position: relative;
  z-index: 1;
}

/* ---------- List ---------- */

.cx-faq__list {
  position: relative;
  z-index: 1;
  max-width: 760px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.cx-faq__panel {
  display: contents; /* allow items to be direct children of list for transitions */
}

/* Single category fade-in (replicates framer's AnimatePresence) */
.cx-faq[data-switching="1"] .cx-faq__item.is-visible {
  animation: cxFaqEnter .45s cubic-bezier(.55, -0.2, .6, 1.3) both;
}

@keyframes cxFaqEnter {
  from { opacity: 0; transform: translateY(20px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- FAQ item ---------- */

.cx-faq__item {
  border: 1px solid var(--cx-faq-line);
  border-radius: 14px;
  background: var(--cx-faq-card-bg);
  transition: background-color .3s ease, border-color .3s ease;
  overflow: hidden;
}

.cx-faq__item:hover { border-color: rgba(2,21,33, .14); }

.cx-faq__item[open],
.cx-faq__item.is-open {
  background: var(--cx-faq-card-bg-open);
}

.cx-faq__item:not(.is-visible) { display: none; }

/* Question (summary) */
.cx-faq__q {
  list-style: none;
  cursor: pointer;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  font-size: 1rem;
  font-weight: 600;
  line-height: 1.45;
  color: var(--cx-faq-mute);
  transition: color .25s ease;
  user-select: none;
}

.cx-faq__q::-webkit-details-marker { display: none; }
.cx-faq__q::marker { display: none; }

.cx-faq__item[open] > .cx-faq__q,
.cx-faq__item.is-open > .cx-faq__q,
.cx-faq__q:hover { color: var(--cx-faq-ink); }

.cx-faq__q:focus-visible {
  outline: 2px solid var(--cx-faq-primary);
  outline-offset: -2px;
  border-radius: 14px;
}

/* Plus icon (rotates to X) */
.cx-faq__plus {
  flex-shrink: 0;
  width: 22px;
  height: 22px;
  position: relative;
  color: var(--cx-faq-mute);
  transition: color .25s ease, transform .25s ease;
}

.cx-faq__plus::before,
.cx-faq__plus::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  background: currentColor;
  border-radius: 1px;
  transition: transform .25s ease, background .25s ease;
}

.cx-faq__plus::before {
  width: 14px;
  height: 2px;
  transform: translate(-50%, -50%);
}

.cx-faq__plus::after {
  width: 2px;
  height: 14px;
  transform: translate(-50%, -50%);
}

.cx-faq__item[open] > .cx-faq__q .cx-faq__plus,
.cx-faq__item.is-open > .cx-faq__q .cx-faq__plus {
  transform: rotate(45deg);
  color: var(--cx-faq-ink);
}

/* Answer */
.cx-faq__a {
  overflow: hidden;
  padding: 0 22px;
  max-height: 0;
  opacity: 0;
  transition: max-height .35s cubic-bezier(.4,0,.2,1), opacity .25s ease .05s, padding .35s cubic-bezier(.4,0,.2,1);
}

.cx-faq__a > * {
  color: var(--cx-faq-mute);
  font-size: .96rem;
  line-height: 1.65;
  margin: 0;
}

.cx-faq__a > * + * { margin-top: 10px; }

.cx-faq__item[open] > .cx-faq__a,
.cx-faq__item.is-open > .cx-faq__a {
  max-height: 800px;
  opacity: 1;
  padding-bottom: 18px;
}

/* ---------- Dark mode ---------- */

html[data-theme="dark"] .cx-faq {
  --cx-faq-card-bg: var(--cx-bg-soft, #0a1e2a);
  --cx-faq-card-bg-open: var(--cx-bg-mute, #0e2632);
  --cx-faq-line: var(--cx-line, #1c3542);
  --cx-faq-ink: var(--cx-ink, #f1f4f6);
  --cx-faq-mute: var(--cx-mute, #aab2b8);
}

html[data-theme="dark"] .cx-faq__glow {
  background: radial-gradient(circle at center, rgba(28,164,175, .22) 0%, rgba(28,164,175, .08) 50%, transparent 75%);
}

html[data-theme="dark"] .cx-faq__tab[aria-selected="true"] {
  color: var(--cx-bg, #021521);
}

/* ---------- Reduced motion ---------- */

@media (prefers-reduced-motion: reduce) {
  .cx-faq__item.is-visible { animation-duration: .15s; }
  .cx-faq__tab__fill { transition-duration: .2s; }
  .cx-faq__a { transition-duration: .2s; }
}

/* ---------- Mobile ---------- */

@media (max-width: 640px) {
  .cx-faq { padding: 64px 16px 72px; }
  .cx-faq__head { margin-bottom: 32px; }
  .cx-faq__tabs { margin-bottom: 32px; gap: 8px; }
  .cx-faq__tab { padding: 6px 11px; font-size: 12.5px; }
  .cx-faq__q { padding: 16px 18px; font-size: .96rem; gap: 12px; }
  .cx-faq__a { padding: 0 18px; }
  .cx-faq__item[open] > .cx-faq__a,
  .cx-faq__item.is-open > .cx-faq__a { padding-bottom: 16px; }
}
