/* ============================================================
   AI FAQ Builder — Built-in Frontend Styles
   Matches the design shown in the screenshot:
   - Left column: label + heading + still-questions + button
   - Right column: accordion cards with chevron/circle icon
   Colours driven by CSS variables set inline from ACF Options.
   ============================================================ */

/* ── Section wrapper ─────────────────────────────────────── */
.aifaq-section {
    background-color: var(--aifaq-bg, #ffffff);
    padding: 72px 24px;
    font-family: inherit;
}

.aifaq-inner {
    display: grid;
    grid-template-columns: 300px 1fr;
    gap: 48px;
    max-width: 1200px;
    margin: 0 auto;
    align-items: start;
}

/* ── Left column ─────────────────────────────────────────── */
.aifaq-left {
    position: sticky;
    top: 32px;
}

.aifaq-label {
    display: block;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--aifaq-primary, #e91e63);
    margin-bottom: 12px;
}

.aifaq-heading {
    font-size: clamp(24px, 3vw, 38px);
    font-weight: 700;
    line-height: 1.2;
    color: var(--aifaq-heading, #1a1a1a);
    margin: 0 0 16px;
}

.aifaq-sub {
    font-size: 15px;
    color: var(--aifaq-text, #374151);
    line-height: 1.6;
    margin-bottom: 24px;
}

.aifaq-updated {
    font-size: 13px;
    color: var(--aifaq-text, #374151);
    opacity: 0.75;
    margin: -8px 0 20px;
}

.aifaq-still {
    font-size: 16px;
    font-weight: 600;
    color: var(--aifaq-heading, #1a1a1a);
    margin: 0 0 16px;
}

.aifaq-btn {
    display: inline-block;
    background-color: var(--aifaq-primary, #e91e63);
    color: var(--aifaq-btn-text, #ffffff);
    padding: 12px 24px;
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
    border: none;
    transition: opacity 0.2s ease, transform 0.15s ease;
}

.aifaq-btn:hover {
    opacity: 0.88;
    transform: translateY(-1px);
    color: var(--aifaq-btn-text, #ffffff);
    text-decoration: none;
}

/* ── Right column: accordion ─────────────────────────────── */
.aifaq-right {
    display: flex;
    flex-direction: column;
    gap: 0;
}

.aifaq-item {
    border: 1px solid var(--aifaq-border, #e5e7eb);
    border-radius: 10px;
    background: var(--aifaq-card-bg, #ffffff);
    margin-bottom: 10px;
    overflow: hidden;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.aifaq-item--open {
    border-color: var(--aifaq-primary, #e91e63);
    box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
}

/* ── Question button ─────────────────────────────────────── */
.aifaq-question-wrap {
    margin: 0;
    font: inherit;
}

.aifaq-question {
    display: flex;
    align-items: center;
    justify-content: space-between;
    width: 100%;
    padding: 18px 20px;
    background: transparent;
    border: none;
    cursor: pointer;
    font-size: 15px;
    font-weight: 500;
    color: var(--aifaq-heading, #1a1a1a);
    text-align: left;
    gap: 16px;
    line-height: 1.4;
}

.aifaq-question:hover {
    color: var(--aifaq-primary, #e91e63);
}

/* ── Icon: circle with chevron ───────────────────────────── */
.aifaq-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--aifaq-border, #e5e7eb);
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s ease, transform 0.25s ease;
    position: relative;
}

.aifaq-icon::after {
    content: '';
    display: block;
    width: 8px;
    height: 8px;
    border-right: 2px solid var(--aifaq-heading, #1a1a1a);
    border-bottom: 2px solid var(--aifaq-heading, #1a1a1a);
    transform: rotate(45deg) translate(-2px, -2px);
    transition: transform 0.25s ease, border-color 0.2s ease;
}

/* Open state icon */
.aifaq-item--open .aifaq-icon {
    background-color: var(--aifaq-primary, #e91e63);
    transform: rotate(180deg);
}

.aifaq-item--open .aifaq-icon::after {
    border-color: #ffffff;
}

/* ── Answer ──────────────────────────────────────────────── */
/* The answer text is always in the HTML. Collapsing only happens once the script
   has run (.aifaq-js), so without JavaScript every answer is readable.
   Collapsed answers are also visibility:hidden, so keyboard users cannot tab into
   links they cannot see. Browsers with hidden="until-found" (.aifaq-uf) use that
   instead, which lets find-in-page and text-fragment links open the answer. */
.aifaq-js .aifaq-answer {
    max-height: 0;
    overflow: hidden;
    visibility: hidden;
    transition: max-height 0.3s ease, visibility 0s linear 0.3s;
}

.aifaq-js.aifaq-uf .aifaq-answer {
    visibility: visible;
}

.aifaq-js .aifaq-item--open .aifaq-answer {
    visibility: visible;
    transition: max-height 0.3s ease, visibility 0s linear 0s;
}

.aifaq-reviewed {
    font-size: 13px;
    color: var(--aifaq-text, #374151);
    margin: -6px 0 18px;
}

.aifaq-reviewed a {
    color: inherit;
    text-decoration: underline;
}

/* Second call to action after the last question: shown on phones, where the
   left-column button is above the questions. */
.aifaq-cta-bottom {
    display: none;
    margin: 14px 0 0;
    text-align: center;
}

.aifaq-answer-inner a {
    color: var(--aifaq-primary, #e91e63);
    text-decoration: underline;
}

.aifaq-question:focus-visible,
.aifaq-btn:focus-visible {
    outline: 2px solid var(--aifaq-primary, #e91e63);
    outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
    .aifaq-js .aifaq-answer,
    .aifaq-icon,
    .aifaq-icon::after,
    .aifaq-btn {
        transition: none !important;
    }
}

.aifaq-answer-inner {
    padding: 0 20px 20px;
    font-size: 14px;
    line-height: 1.7;
    color: var(--aifaq-text, #374151);
}

.aifaq-answer-inner p {
    margin: 0 0 12px;
}

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

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 900px) {
    .aifaq-inner {
        grid-template-columns: 1fr;
        gap: 32px;
    }

    .aifaq-left {
        position: static;
        text-align: center;
    }

    .aifaq-section {
        padding: 48px 20px;
    }

    .aifaq-cta-bottom {
        display: block;
    }
}

@media (max-width: 480px) {
    .aifaq-question {
        font-size: 14px;
        padding: 14px 16px;
    }

    .aifaq-answer-inner {
        padding: 0 16px 16px;
    }
}
