/* ============================================================
   FAQ Component — Shared Accordion
   Used by: index.html, features/ai-appointment-booking-assistant.html
   Not used by: IVF page (has its own .fertility-faq in fertility.css)

   HTML pattern (canonical):
     <section class="faq-section">
       <div class="container">
         <h2 class="section-title">...</h2>
         <div class="faq-grid">
           <div class="faq-item">
             <h3 class="faq-question" role="button" tabindex="0"
                 onclick="toggleFaq(this)"
                 onkeypress="if(event.key==='Enter'||event.key===' '){event.preventDefault();toggleFaq(this);}">
               Question?
               <i class="fas fa-plus-circle"></i>
             </h3>
             <p class="faq-answer">Answer text.</p>
           </div>
           ...
         </div>
       </div>
     </section>

   Icon: fa-plus-circle (rotates 45° → X on active — semantically "open/close")
   ============================================================ */

.faq-section {
    padding: 6rem 0;
    background: #f9fafb;
}

.faq-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 1.25rem;
    max-width: 1050px;
    margin: 3rem auto 0;
}

.faq-item {
    position: relative;
    background: white;
    border-radius: 1rem;
    border: 1px solid rgba(229, 231, 235, 0.7);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                box-shadow 0.3s cubic-bezier(0.16, 1, 0.3, 1),
                border-color 0.3s;
}

/* Top-edge gradient accent — fades in on active */
.faq-item::before {
    content: "";
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(37, 99, 235, 0.6), rgba(16, 185, 129, 0.5), transparent);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.faq-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(37, 99, 235, 0.08);
    border-color: rgba(37, 99, 235, 0.2);
}

.faq-item.active {
    border-color: rgba(37, 99, 235, 0.25);
    box-shadow: 0 4px 12px rgba(15, 23, 42, 0.06), 0 12px 32px rgba(37, 99, 235, 0.10);
}
.faq-item.active::before { opacity: 1; }

.faq-question {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.45;
    letter-spacing: -0.01em;
    color: #1f2937;
    padding: 1.5rem 1.75rem;
    margin: 0;
    cursor: pointer;
    user-select: none;
    background: transparent;
    border: none;
    width: 100%;
    text-align: left;
    font-family: inherit;
}

.faq-question:focus-visible {
    outline: 2px solid #2563eb;
    outline-offset: -2px;
    border-radius: 1rem;
}

.faq-question i {
    flex-shrink: 0;
    color: #2563eb;
    font-size: 1rem;
    margin-top: 0.2rem;
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.faq-item.active .faq-question i {
    transform: rotate(45deg);
}

.faq-answer {
    color: #4b5563;
    font-size: 0.98rem;
    line-height: 1.65;
    padding: 0.35rem 1.75rem 1.25rem;
    margin: 0;
    max-height: 2.75em;            /* peek: first line visible with soft fade */
    overflow: hidden;
    position: relative;
    transition: max-height 0.45s cubic-bezier(0.16, 1, 0.3, 1);
}

/* Soft gradient fade masks the clipped remainder — hints there's more */
.faq-answer::after {
    content: "";
    position: absolute;
    left: 0;
    right: 0;
    bottom: 0;
    height: 1.5em;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1) 85%);
    pointer-events: none;
    opacity: 1;
    transition: opacity 0.3s ease;
}

.faq-item.active .faq-answer {
    max-height: 800px;
}

.faq-item.active .faq-answer::after {
    opacity: 0;
}

@media (max-width: 768px) {
    .faq-section { padding: 4.5rem 0; }
    .faq-grid {
        grid-template-columns: 1fr;
        gap: 0.85rem;
    }
    .faq-question {
        font-size: 0.98rem;
        padding: 1.15rem 1.25rem;
    }
    .faq-answer {
        font-size: 0.92rem;
        padding: 0.3rem 1.25rem 1.1rem;
    }
}
