/* =========================================================================
   Beekom JOOOL — Flip Accordion
   -------------------------------------------------------------------------
   Classes:
     .bk-jfa              outer vertical stack
     .bk-jfa__item        individual item (closed by default)
     .bk-jfa__item.is-open    expanded state (dark theme)
     .bk-jfa__trigger     clickable button carrying title + icon
     .bk-jfa__title       card heading
     .bk-jfa__icon        icon slot (two SVGs, one visible at a time)
     .bk-jfa__icon-closed rendered when item is closed  (arrow up-right)
     .bk-jfa__icon-open   rendered when item is open    (arrow down-right)
     .bk-jfa__panel       collapsible wrapper around content
     .bk-jfa__content     the text itself
   ========================================================================= */


/* ----- Container --------------------------------------------------------- */

.bk-jfa {
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}


/* ----- Item (closed state is the default) -------------------------------- */

.bk-jfa__item {
    position: relative;
    background-color: #FFFFFF;
    color: #0C1E3E;
    border: 1px solid #E5E7EB;
    border-radius: 16px;
    padding: 32px;
    box-sizing: border-box;
    /*
     * Transition background + colour so the flip between the light and
     * the dark theme feels like a single motion rather than two separate
     * property changes. Also transitions border-color for the same reason.
     */
    transition:
        background-color 300ms cubic-bezier(0.4, 0, 0.2, 1),
        color            300ms cubic-bezier(0.4, 0, 0.2, 1),
        border-color     300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bk-jfa__item.is-open {
    background-color: #0C1E3E;
    color: #FFFFFF;
    border-color: #0C1E3E;
}


/* ----- Trigger button ---------------------------------------------------- */

/*
 * The trigger holds the title on the left and the icon on the right.
 * It's a button so the whole row is clickable and keyboard-focusable —
 * no extra JS needed to handle focus or Enter/Space.
 */
.bk-jfa__trigger {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    width: 100%;
    padding: 0;
    border: none;
    background: transparent;
    color: inherit;
    font: inherit;
    text-align: left;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.bk-jfa__trigger:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: 6px;
    border-radius: 4px;
}


/* ----- Title ------------------------------------------------------------- */

.bk-jfa__title {
    display: block;
    flex: 1 1 auto;
    margin: 0;
    font-size: 22px;
    line-height: 1.3;
    font-weight: 500;
    color: inherit;
}


/* ----- Icon slot --------------------------------------------------------- */

/*
 * Two SVGs are rendered side by side; we hide one based on .is-open so
 * the switch between "arrow up-right" (closed) and "arrow down-right"
 * (open) is instant and doesn't require a rotation animation. This
 * avoids the classic "rotating chevron that doesn't quite line up with
 * the design" pitfall.
 */
.bk-jfa__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    width: 32px;
    height: 32px;
    color: inherit;
    transition: transform 300ms cubic-bezier(0.4, 0, 0.2, 1);
}

.bk-jfa__icon svg {
    width: 100%;
    height: 100%;
    stroke: currentColor;
    fill: none;
}

/* Default: show the closed-state icon (arrow up-right), hide the open one */
.bk-jfa__icon-open {
    display: none;
}

/* Open state: swap icons */
.bk-jfa__item.is-open .bk-jfa__icon-closed {
    display: none;
}
.bk-jfa__item.is-open .bk-jfa__icon-open {
    display: block;
}


/* ----- Collapsible panel ------------------------------------------------- */

/*
 * The panel is max-height animated from 0 to its measured scrollHeight
 * on open, then the inline max-height is removed so content can reflow
 * on resize. The `max-height: none` override on .is-open matches the
 * lesson learned in the Expand Cards plugin (v1.0.2 there): without it,
 * the CSS default (0) snaps back in when JS removes the inline style
 * and the panel auto-collapses.
 */
.bk-jfa__panel {
    overflow: hidden;
    max-height: 0;
    opacity: 0;
    transition:
        max-height 400ms cubic-bezier(0.4, 0, 0.2, 1),
        opacity   300ms ease;
}

.bk-jfa__item.is-open .bk-jfa__panel {
    opacity: 1;
    max-height: none;
}


/* ----- Content ----------------------------------------------------------- */

.bk-jfa__content {
    padding-top: 20px;
    font-size: 16px;
    line-height: 1.6;
    color: inherit;
}

.bk-jfa__content > *:first-child {
    margin-top: 0;
}

.bk-jfa__content > *:last-child {
    margin-bottom: 0;
}

.bk-jfa__content p + p {
    /* a bit of breathing room between paragraphs inside the revealed content */
    margin-top: 1em;
}


/* ----- Reduced motion ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
    .bk-jfa__item,
    .bk-jfa__panel,
    .bk-jfa__icon {
        transition: none !important;
    }
}


/* ----- Mobile tweaks ----------------------------------------------------- */

@media (max-width: 600px) {
    .bk-jfa__item {
        padding: 24px;
        border-radius: 14px;
    }
    .bk-jfa__title {
        font-size: 19px;
    }
    .bk-jfa__icon {
        width: 28px;
        height: 28px;
    }
}
