/* CTSFW FAQs Accordion (namespaced, no theme conflicts, robust flex layout & smooth animation) */

.ctsfw-faqs-acc {
    --acc-border: #e5e7eb;
    --acc-text: #111827;
    --acc-muted: #6b7280;
    --acc-focus: #1d4ed8;
    --acc-bg: #ffffff;
    --acc-bg-alt: #f9fafb;

    color: var(--acc-text);
    background: var(--acc-bg);
    border-top: 1px solid var(--acc-border);
}

.ctsfw-faqs-acc__item {
    border-bottom: 1px solid var(--acc-border);
}

/* Heading wrapper (if used) */
.ctsfw-faqs-acc__heading {
    margin: 0;
}

/* We do NOT reset with all: unset; we want your Tailwind utility classes to work */
.ctsfw-faqs-acc__button {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    width: 100%;
    cursor: pointer;
    padding: 1rem 0;
    line-height: 1.35;
    background: transparent;
    border: 0;
}

.ctsfw-faqs-acc__button:focus-visible {
    outline: 2px solid var(--acc-focus);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Label text (if you use a span/label) */
.ctsfw-faqs-acc__label {
    font-size: 1.125rem;
    font-weight: 500;
}

/* Optional internal icon (used instead of theme accordion-button-base) */
.ctsfw-faqs-acc__icon {
    position: relative;
    width: 1.25rem;
    height: 1.25rem;
    flex: none;
}

.ctsfw-faqs-acc__icon::before,
.ctsfw-faqs-acc__icon::after {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 1.25rem;
    height: 2px;
    background: var(--acc-muted);
    transform: translate(-50%, -50%);
    transition: transform 200ms ease;
}

/* Horizontal bar (minus) */
.ctsfw-faqs-acc__icon::before {
    /* default: horizontal line */
}

/* Vertical bar to form plus sign */
.ctsfw-faqs-acc__icon::after {
    transform: translate(-50%, -50%) rotate(90deg);
}

/* When open: show minus (hide vertical stroke by rotating it flat) */
.ctsfw-faqs-acc__group[data-faq-opened="true"] .ctsfw-faqs-acc__icon::after {
    transform: translate(-50%, -50%) rotate(0deg);
}

/* =============================== */
/*  Panel shell & JS/no-JS states  */
/* =============================== */

/* Base panel styling */
.ctsfw-faqs-acc__panel {
    background: var(--acc-bg);
    padding: 0;
}

/* No-JS fallback: panels are simply open */
.ctsfw-faqs-acc--nojs [data-faq-panel] {
    max-height: none;
    overflow: visible;
    padding: 0 0 1rem 0;
}

/* JS-enhanced: start fully collapsed */
.ctsfw-faqs-acc--js [data-faq-panel] {
    max-height: 0;
    overflow: hidden;
    padding: 0;
    /* important: no padding when collapsed so nothing peeks out */
    transition: max-height 300ms cubic-bezier(.4, 0, .2, 1);
}

/* When parent says opened, allow height and restore padding.
   JS will update max-height inline to scrollHeight, but this keeps
   a sensible fallback and ensures padding appears only when open. */
.ctsfw-faqs-acc__group[data-faq-opened="true"] [data-faq-panel] {
    max-height: 3000px;
    /* large enough for tall answers */
    padding: 0 0 1rem 0;
}

/* Inner wrapper (replaces theme .accordion-inner-base) */
.ctsfw-faqs-acc__inner {
    padding-top: 0.25rem;
}

/* Editor notice */
.ctsfw-faqs-acc__notice {
    margin: 0.75rem 0;
    padding: 0.75rem 1rem;
    background: var(--acc-bg-alt);
    border: 1px solid var(--acc-border);
    font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, "Apple Color Emoji", "Segoe UI Emoji";
}

/* =========================== */
/*  FLEX layout for inner row  */
/* =========================== */

/* Your actual markup:
   <div class="ctsfw-faqs-acc__content">
       <figure class="ctsfw-faqs-acc__image">...</figure>
       <div class="ctsfw-faqs-acc__body">...</div>
   </div>
*/
.ctsfw-faqs-acc__content {
    display: flex !important;
    flex-direction: row !important;
    align-items: flex-start !important;
    gap: 1rem;
    min-width: 0;
}

.ctsfw-faqs-acc .ctsfw-faqs-acc__content {}

/* ~30% image column */
.ctsfw-faqs-acc .ctsfw-faqs-acc__image {
    flex: 0 0 30%;
    max-width: 30%;
    margin: 0;
}

/* Ensure the actual image fills its wrapper and never overflows */
.ctsfw-faqs-acc .ctsfw-faqs-acc__image .ctsfw-faqs-acc__img,
.ctsfw-faqs-acc .ctsfw-faqs-acc__image img {
    display: block;
    width: 100%;
    max-width: 100%;
    height: auto;
    border-radius: 4px;
}

/* Flexible text column */
.ctsfw-faqs-acc .ctsfw-faqs-acc__body {
    flex: 1 1 0%;
    min-width: 0;
}

/* Mobile: keep side-by-side per your earlier requirement */
@media (max-width: 767.98px) {
    .ctsfw-faqs-acc .ctsfw-faqs-acc__content {
        gap: 0.75rem;
    }

    .ctsfw-faqs-acc .ctsfw-faqs-acc__image {
        flex: 0 0 30%;
        max-width: 30%;
    }

    .ctsfw-faqs-acc .ctsfw-faqs-acc__body {
        flex: 1 1 0%;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .ctsfw-faqs-acc--js [data-faq-panel] {
        transition: none;
    }

    .ctsfw-faqs-acc__icon::before,
    .ctsfw-faqs-acc__icon::after {
        transition: none;
    }
}