/* ══════════════════════════════════════════════════════════════
   FAQ Accordion — "most requested questions" chat-style accordion
   on the Home page, between #cta and the footer. Chat-bubble
   questions (plus/minus toggle, optional tilted emoji sticker) that
   expand into a gradient reply bubble, single-item-open at a time.
   Reuses .reveal / .section-label / .home-heading-friendly verbatim.
   Depends on tokens defined in scholars-ui.css (:root vars) — most
   colors below inherit theme automatically via var(--surface) etc.;
   only the accent tints need explicit dark overrides.
   ══════════════════════════════════════════════════════════════ */

#faq {
  padding: 90px 24px 110px;
  position: relative;
}

.faq-wrap {
  max-width: 760px;
  margin: 0 auto;
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-md);
  padding: clamp(2rem, 4vw, 3rem);
}

.faq-head {
  text-align: center;
  max-width: 34rem;
  margin: 0 auto 36px;
}

.faq-head .home-heading-friendly {
  font-size: clamp(1.7rem, 3.2vw, 2.3rem);
}

.faq-timestamp {
  margin-top: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

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

.faq-item {
  position: relative;
}

.faq-question {
  display: flex;
  align-items: center;
  gap: 14px;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  font: inherit;
  text-align: left;
  cursor: pointer;
  color: inherit;
}

.faq-question:focus-visible {
  outline: 2px solid var(--purple-500);
  outline-offset: 4px;
  border-radius: var(--radius-md);
}

.faq-bubble {
  position: relative;
  display: inline-flex;
  align-items: center;
  flex: 1 1 auto;
  min-width: 0;
  padding: 14px 20px;
  border-radius: var(--radius-md) var(--radius-md) var(--radius-md) 0;
  background: var(--surface);
  border: 1px solid var(--border-soft);
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease, border-color 0.3s ease, color 0.3s ease, box-shadow 0.3s ease;
}


.faq-question:hover .faq-bubble {
  background: rgba(192, 132, 252, 0.10);
  border-color: rgba(167, 139, 250, 0.3);
}

.faq-question[aria-expanded="true"] .faq-bubble {
  background: linear-gradient(135deg, rgba(192, 132, 252, 0.22), rgba(244, 114, 182, 0.16));
  border-color: rgba(167, 139, 250, 0.4);
  color: var(--purple-700);
  box-shadow: var(--shadow-md);
}

.faq-bubble-text {
  font-weight: 600;
  font-size: 0.98rem;
  line-height: 1.4;
}

.faq-icon {
  position: absolute;
  top: -12px;
  font-size: 20px;
  line-height: 1;
  pointer-events: none;
  filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.18));
}

.faq-icon--left { left: -8px; transform: rotate(-9deg); }
.faq-icon--right { right: -8px; transform: rotate(8deg); }

/* ── Answer: grid-template-rows 0fr → 1fr height animation ── */
.faq-answer-wrap {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 0.45s var(--ease-smooth);
}

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

.faq-answer-inner {
  overflow: hidden;
  min-height: 0;
  display: flex;
  justify-content: flex-end;
}

.faq-answer {
  margin: 10px 0 2px;
  max-width: 480px;
  padding: 14px 18px;
  border-radius: var(--radius-md) 0 var(--radius-md) var(--radius-md);
  background: var(--purple-deep);
  color: #fff;
  font-size: 0.95rem;
  line-height: 1.65;
  box-shadow: var(--shadow-sm);
}

.faq-answer a {
  color: #fff;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  white-space: nowrap;
}

.faq-answer a:hover { opacity: 0.85; }

/* ── Dark mode: most colors inherit via var(--surface/--text/--border)
   already redefined in scholars-ui.css; only accent tints need
   re-tuning for contrast on the deep-plum background. ── */
[data-theme="dark"] .faq-question:hover .faq-bubble {
  background: rgba(167, 139, 250, 0.16);
  border-color: rgba(167, 139, 250, 0.32);
}

[data-theme="dark"] .faq-question[aria-expanded="true"] .faq-bubble {
  background: linear-gradient(135deg, rgba(167, 139, 250, 0.30), rgba(244, 114, 182, 0.22));
  border-color: rgba(167, 139, 250, 0.42);
  color: #e9d5ff;
}

[data-theme="dark"] .faq-answer {
  box-shadow: 0 8px 24px -8px rgba(0, 0, 0, 0.55);
}

@media (prefers-reduced-motion: reduce) {
  .faq-answer-wrap,
  .faq-bubble {
    transition: none !important;
  }
}
