/**
 * FAQ Accordion Block Styles
 *
 * @package theme
 */

/* ==========================================================================
   CSS Custom Properties
   ========================================================================== */

.kf-faq {
    --kf-faq-bg: #ffffff;
    --kf-faq-border-color: #e2e8f0;
    --kf-faq-border-width: 1px;
    --kf-faq-border-radius: 8px;
    --kf-faq-duration: 350ms;
    --kf-faq-easing: cubic-bezier(0.33, 1, 0.68, 1);
    --kf-faq-header-padding: 20px 24px;
    --kf-faq-content-padding: 0 24px 24px;
    --kf-faq-gap: 20px;
    --kf-faq-icon-size: 20px;
    --kf-faq-hover-bg: rgba(0, 0, 0, 0.02);
    --kf-faq-focus-color: #3b82f6;

    border: none;
}

/* ==========================================================================
   Container
   ========================================================================== */

.kf-faq .acf-innerblocks-container {
    display: flex;
    flex-direction: column;
    gap: var(--kf-faq-gap);
    width: 100%;
}

/* ==========================================================================
   FAQ Item
   ========================================================================== */

.kf-faq-item {
    position: relative;
    background-color: var(--kf-faq-bg);
    border: var(--kf-faq-border-width) solid var(--kf-faq-border-color);
    border-radius: var(--kf-faq-border-radius);
    overflow: hidden;
}

/* ==========================================================================
   Header / Trigger Button
   ========================================================================== */

.kf-faq-item__header {
    display: flex;
    align-items: center;
    width: 100%;
    padding: var(--kf-faq-header-padding);
    margin: 0;
    background-color: transparent;
    border: none;
    border-radius: 0;
    cursor: pointer;
    font-family: inherit;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.5;
    color: inherit;
    text-align: left;
    appearance: none;
    -webkit-appearance: none;
    transition: background-color var(--kf-faq-duration) var(--kf-faq-easing);

    font-family: Degular;
    font-weight: 500;
    font-size: var(--wp--preset--font-size--x-24);
    line-height: 1.16;
    
}

.kf-faq-item__header:hover {
    background-color: var(--kf-faq-hover-bg);
}

.kf-faq-item__header:focus {
    outline: none;
}

.kf-faq-item__header:focus-visible {
    outline: 2px solid var(--kf-faq-focus-color);
    outline-offset: -2px;
}

/* ==========================================================================
   Title
   ========================================================================== */

.kf-faq-item__title {
    flex: 1 1 auto;
    min-width: 0;


}

/* ==========================================================================
   Icons - Base Styles
   ========================================================================== */

.kf-faq-item__icon {
    display: none;
    flex-shrink: 0;
    width: var(--kf-faq-icon-size);
    height: var(--kf-faq-icon-size);
    color: currentColor;
}

/* ==========================================================================
   Plus/Minus Icon (Start Position)
   ========================================================================== */

.kf-faq--icon-plus-minus .kf-faq-item__icon--plus {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    margin-right: 16px;
}

.kf-faq-item__icon-bar {
    position: absolute;
    background-color: currentColor;
    transition: transform var(--kf-faq-duration) var(--kf-faq-easing),
                opacity var(--kf-faq-duration) var(--kf-faq-easing);
}

.kf-faq-item__icon-bar--h {
    width: 14px;
    height: 2px;
}

.kf-faq-item__icon-bar--v {
    width: 2px;
    height: 14px;
}

/* Animate vertical bar to create minus effect */
.kf-faq-item--open .kf-faq-item__icon-bar--v {
    transform: rotate(90deg);
    opacity: 0;
}

/* ==========================================================================
   Arrow Icon (End Position)
   ========================================================================== */

.kf-faq--icon-arrow .kf-faq-item__icon--arrow {
    display: flex;
    align-items: center;
    justify-content: center;
    margin-left: 16px;
}

.kf-faq-item__icon--arrow svg {
    width: var(--kf-faq-icon-size);
    height: var(--kf-faq-icon-size);
    transition: transform var(--kf-faq-duration) var(--kf-faq-easing);
}

/* Rotate arrow when open */
.kf-faq-item--open .kf-faq-item__icon--arrow svg {
    transform: rotate(180deg);
}

/* ==========================================================================
   Content Panel
   ========================================================================== */

.kf-faq-item__panel {
    height: 0;
    overflow: hidden;
    transition: height var(--kf-faq-duration) var(--kf-faq-easing);
}

.kf-faq-item__content {
    padding: var(--kf-faq-content-padding);
    opacity: 0;
    transform: translateY(-10px);

    font-size: var(--wp--preset--font-size--x-18);
    transition: opacity var(--kf-faq-duration) var(--kf-faq-easing),
                transform var(--kf-faq-duration) var(--kf-faq-easing);
}


.kf-faq-item__content .acf-innerblocks-container p:first-child {
    margin-top: 0;
}

.kf-faq-item__content .acf-innerblocks-container p:last-child {
    margin-bottom: 0;
}

/* Open state */
.kf-faq-item--open .kf-faq-item__content {
    opacity: 1;
    transform: translateY(0);
}

/* Content spacing normalization */
.kf-faq-item__content > *:first-child {
    margin-top: 0;
}

.kf-faq-item__content > *:last-child {
    margin-bottom: 0;
}

/* ==========================================================================
   Always Open Mode
   ========================================================================== */

.kf-faq--always-open .kf-faq-item__header {
    cursor: default;
    pointer-events: none;
}

.kf-faq--always-open .kf-faq-item__header:hover {
    background-color: transparent;
}

.kf-faq--always-open .kf-faq-item__icon {
    display: none !important;
}

.kf-faq--always-open .kf-faq-item__panel {
    height: auto !important;
    overflow: visible;
}

.kf-faq--always-open .kf-faq-item__content {
    opacity: 1;
    transform: none;
}

/* ==========================================================================
   Block Editor Styles
   ========================================================================== */

/* Show content in editor for editing */
.block-editor-block-list__block .kf-faq-item__panel {
    height: auto !important;
    overflow: visible;
}

.block-editor-block-list__block .kf-faq-item__content {
    opacity: 1;
    transform: none;
}

/* Disable header clicks in editor */
.block-editor-block-list__block .kf-faq-item__header {
    pointer-events: none;
    cursor: default;
}

/* Visual indicator for collapsed state in editor */
.block-editor-block-list__block .kf-faq-item:not(.kf-faq-item--open) {
    opacity: 1;
}

/* ==========================================================================
   Responsive Styles
   ========================================================================== */

@media (max-width: 768px) {
    .kf-faq {
        --kf-faq-header-padding: 16px 20px;
        --kf-faq-content-padding: 0 20px 20px;
        --kf-faq-gap: 10px;
    }

    .kf-faq-item__header {
        /* font-size: 15px; */
    }

    .kf-faq--icon-plus-minus .kf-faq-item__icon--plus {
        margin-right: 12px;
    }

    .kf-faq--icon-arrow .kf-faq-item__icon--arrow {
        margin-left: 12px;
    }
}

@media (max-width: 480px) {
    .kf-faq {
        --kf-faq-header-padding: 14px 16px;
        --kf-faq-content-padding: 0 16px 16px;
    }

    .kf-faq-item__header {
        /* font-size: 14px; */
    }
}

/* ==========================================================================
   Print Styles
   ========================================================================== */

@media print {
    .kf-faq-item__panel {
        height: auto !important;
        overflow: visible !important;
    }

    .kf-faq-item__content {
        opacity: 1 !important;
        transform: none !important;
    }

    .kf-faq-item__icon {
        display: none !important;
    }
}

/* ==========================================================================
   Reduced Motion
   ========================================================================== */

@media (prefers-reduced-motion: reduce) {
    .kf-faq-item__header,
    .kf-faq-item__panel,
    .kf-faq-item__content,
    .kf-faq-item__icon-bar,
    .kf-faq-item__icon--arrow svg {
        transition-duration: 0.01ms !important;
    }
}