/* ── Ultra-Fast FAQ Accordion ───────────────────────────────────────────
   Uses the CSS grid-row trick: grid-template-rows: 0fr → 1fr
   This is the fastest known CSS accordion — no max-height hack,
   no layout thrashing, no jank. Sub-frame feel on every device.
   ──────────────────────────────────────────────────────────────────── */

/* ── Section Layout ──────────────────────────────────────────────────── */
section.faq-section {
  position: relative;
  padding: 100px 0;
  background:
    radial-gradient(circle at top left, rgba(46, 143, 255, 0.08), transparent 35%),
    radial-gradient(circle at bottom right, rgba(0, 255, 180, 0.05), transparent 30%),
    #02080e;
  color: #ffffff;
  overflow: hidden;
}

.faq-section .section-copy {
  margin-bottom: 64px;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
  padding: 0 24px;
}

.faq-section .section-label {
  display: block;
  color: #2e8fff;
  font-weight: 800;
  letter-spacing: 0.3em;
  margin-bottom: 1.2rem;
  text-transform: uppercase;
  font-size: 0.82rem;
}

.faq-section h2 {
  font-family: 'DM Serif Display', serif;
  font-size: clamp(2.4rem, 5vw, 4rem);
  line-height: 1.08;
  color: #ffffff;
  margin: 0;
  text-wrap: balance;
}

/* ── Accordion Container ─────────────────────────────────────────────── */
.faq-accordion-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 24px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

/* ── Individual Item ─────────────────────────────────────────────────── */
.faq-accordion-item {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 18px;
  overflow: hidden;
  /* Only transition border/shadow — never geometry on the item itself */
  transition: border-color 150ms ease, box-shadow 150ms ease;
  will-change: border-color;
}

.faq-accordion-item:hover {
  border-color: rgba(46, 143, 255, 0.22);
  box-shadow: 0 8px 24px rgba(46, 143, 255, 0.07);
}

.faq-accordion-item.active {
  background: rgba(255, 255, 255, 0.03);
  border-color: rgba(46, 143, 255, 0.32);
  box-shadow: 0 16px 36px rgba(0, 0, 0, 0.18);
}

/* ── Header / Trigger ────────────────────────────────────────────────── */
.faq-accordion-header {
  width: 100%;
  padding: 28px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: transparent;
  border: none;
  cursor: pointer;
  text-align: left;
  outline: none;
  /* No transition needed on the header itself */
}

.faq-accordion-header:focus-visible {
  outline: 2px solid #2e8fff;
  outline-offset: -4px;
  background: rgba(46, 143, 255, 0.05);
}

.faq-accordion-header h3 {
  margin: 0;
  font-family: 'Sora', sans-serif;
  font-size: clamp(1.05rem, 1.6vw, 1.35rem);
  font-weight: 700;
  color: rgba(255, 255, 255, 0.88);
  padding-right: 32px;
  line-height: 1.45;
  transition: color 120ms ease;
}

.faq-accordion-item.active .faq-accordion-header h3 {
  color: #2e8fff;
}

/* ── Icon (+ → ×) ────────────────────────────────────────────────────── */
.faq-accordion-icon {
  position: relative;
  width: 26px;
  height: 26px;
  flex-shrink: 0;
  background: rgba(46, 143, 255, 0.12);
  border-radius: 50%;
  /* Icon rotation is cheap — only transform changes */
  transition: transform 180ms cubic-bezier(0.34, 1.3, 0.64, 1), background 150ms ease;
  will-change: transform;
}

.faq-accordion-icon::before,
.faq-accordion-icon::after {
  content: "";
  position: absolute;
  background-color: #2e8fff;
  top: 50%;
  left: 50%;
  transition: transform 180ms cubic-bezier(0.34, 1.3, 0.64, 1), opacity 120ms ease;
  will-change: transform;
}

.faq-accordion-icon::before {
  width: 11px;
  height: 2px;
  transform: translate(-50%, -50%);
}

.faq-accordion-icon::after {
  width: 2px;
  height: 11px;
  transform: translate(-50%, -50%);
}

/* Active icon */
.faq-accordion-item.active .faq-accordion-icon {
  background: #2e8fff;
  transform: rotate(135deg);
}

.faq-accordion-item.active .faq-accordion-icon::before,
.faq-accordion-item.active .faq-accordion-icon::after {
  background-color: #ffffff;
}

/* ── Content Area — CSS GRID TRICK (fastest possible accordion) ──────────
   grid-template-rows: 0fr  →  1fr
   The inner div has min-height: 0 which clamps content to 0px when closed.
   This avoids the max-height hack entirely — no interpolation over an
   arbitrary large value, no jank, sub-frame feel.
   ──────────────────────────────────────────────────────────────────── */
.faq-accordion-content {
  display: grid;
  grid-template-rows: 0fr;
  transition: grid-template-rows 200ms cubic-bezier(0.4, 0, 0.2, 1);
  will-change: grid-template-rows;
}

.faq-accordion-item.active .faq-accordion-content {
  grid-template-rows: 1fr;
}

/* Inner wrapper — MUST have min-height: 0 for the grid trick to work */
.faq-accordion-content-inner {
  min-height: 0;
  overflow: hidden;
  padding: 0 28px;
  transition: padding 200ms cubic-bezier(0.4, 0, 0.2, 1);
}

.faq-accordion-item.active .faq-accordion-content-inner {
  padding-bottom: 32px;
}

.faq-accordion-content p {
  margin: 0;
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.05rem;
  line-height: 1.8;
  max-width: 860px;
  font-family: 'Outfit', 'Manrope', sans-serif;
  font-weight: 500;
}

/* ── Mobile ──────────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  section.faq-section {
    padding: 72px 0;
  }

  .faq-section .section-copy {
    margin-bottom: 44px;
  }

  .faq-accordion-header {
    padding: 22px 20px;
    align-items: flex-start;
  }

  .faq-accordion-header h3 {
    font-size: 1rem;
    line-height: 1.5;
    padding-right: 20px;
  }

  .faq-accordion-content-inner {
    padding: 0 20px;
  }

  .faq-accordion-item.active .faq-accordion-content-inner {
    padding-bottom: 24px;
  }

  .faq-accordion-content p {
    font-size: 0.97rem;
    line-height: 1.72;
  }

  .faq-accordion-icon {
    width: 22px;
    height: 22px;
    margin-top: 3px;
  }
}

/* ── Reduced motion ──────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .faq-accordion-content,
  .faq-accordion-content-inner,
  .faq-accordion-icon,
  .faq-accordion-item {
    transition: none !important;
  }
}
