.accordion {
    $handlerSize: 25px;
    $spacing: 20px;

    @extend %block;
    outline: 0;
    position: relative;
    border-radius: var(--baseRadius);
    background: var(--baseColor);
    border: 1px solid var(--baseAlt2Color);
    transition: box-shadow var(--baseAnimationSpeed),
                margin var(--baseAnimationSpeed);

    // header
    .accordion-header {
        outline: 0;
        position: relative;
        display: flex;
        min-height: 52px;
        align-items: center;
        row-gap: 10px;
        column-gap: var(--smSpacing);
        padding: ($spacing - 8) $spacing ($spacing - 10);
        width: 100%;
        user-select: none;
        color: var(--txtPrimaryColor);
        border-radius: inherit;
        transition: background var(--baseAnimationSpeed),
                    box-shadow var(--baseAnimationSpeed);
        .icon {
            width: 18px;
            text-align: center;
            i {
                display: inline-block;
                vertical-align: top;
                font-size: 1.1rem;
            }
        }
        &.interactive {
            padding-right: ($spacing + $handlerSize + 5) ;
            cursor: pointer;
            &:after { // expand/collapse indicator
                content: '\ea4e';
                position: absolute;
                right: $spacing - 5;
                top: 50%;
                margin-top: -($handlerSize * 0.5);
                width: $handlerSize;
                height: $handlerSize;
                line-height: $handlerSize;
                color: var(--txtHintColor);
                font-family: var(--iconFontFamily);
                font-size: 1.3em;
                text-align: center;
                transition: color var(--baseAnimationSpeed);
            }
        }
        &:hover,
        &.focus,
        &:focus-visible {
            &:after {
                color: var(--txtPrimaryColor);
            }
        }
        &:active {
            transition-duration: var(--activeAnimationSpeed);
        }
    }

    // content
    .accordion-content {
        @extend %block;
        padding: $spacing;
    }

    // states
    &:hover,
    &:focus-visible,
    &.active {
        z-index: 9;
        .accordion-header.interactive {
            background: var(--baseAlt1Color);
        }
    }
    &.drag-over {
        .accordion-header {
            background: var(--bodyColor);
        }
    }
    &.active {
        @include shadowize();
        .accordion-header {
            position: relative;
            top: 0;
            z-index: 9;
            box-shadow: 0px 0px 0px 1px var(--baseAlt2Color);
            border-bottom-left-radius: 0;
            border-bottom-right-radius: 0;
            background: var(--bodyColor);
            &.interactive{
                background: var(--bodyColor);
                &:after {
                    color: inherit;
                    content: '\ea78';
                }
            }
        }
    }
    &.disabled {
        z-index: 0;
        border-color: var(--baseAlt1Color);
        .accordion-header {
            color: var(--txtDisabledColor);
        }
    }
}


// wrapper
.accordions {
    .accordion {
        border-radius: 0;
        margin: -1px 0 0;
        &:has(+ .accordion.active) {
           border-bottom-left-radius: var(--baseRadius);
           border-bottom-right-radius: var(--baseRadius);
        }
    }
    & > .accordion.active,
    & > .accordion-wrapper > .accordion.active {
        margin: var(--smSpacing) 0;
        border-radius: var(--baseRadius);
        + .accordion {
            border-top-left-radius: var(--baseRadius);
            border-top-right-radius: var(--baseRadius);
        }
    }
    & > .accordion:first-child,
    & > .accordion-wrapper:first-child > .accordion {
        margin-top: 0;
        border-top-left-radius: var(--baseRadius);
        border-top-right-radius: var(--baseRadius);
    }
    & > .accordion:last-child,
    & > .accordion-wrapper:last-child > .accordion {
        margin-bottom: 0;
        border-bottom-left-radius: var(--baseRadius);
        border-bottom-right-radius: var(--baseRadius);
    }
}
