/* Container & Layout */
.wp-block-custom-expandable-group {
    position: relative;
    box-sizing: border-box;
    /* Default overlay color if JS fails - fallback */
    --overlay-color: #303030; 
}

/* Ensure Full Width works */
.wp-block-custom-expandable-group.alignfull {
    width: 100vw;
    max-width: 100vw;
    margin-left: calc(50% - 50vw);
    margin-right: calc(50% - 50vw);
}

/* Content Area */
.wp-block-custom-expandable-group .expandable-group-content {
    position: relative;
    overflow: hidden;
    transition: max-height 0.5s cubic-bezier(0.25, 1, 0.5, 1);
    max-height: var(--collapsed-height);
}

/* THE GRADIENT OVERLAY 
   We use a linear-gradient that fades from transparent to the user-selected color.
   I matched your requested density (starts fast, ends solid).
*/
.wp-block-custom-expandable-group .expandable-group-gradient {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 180px; /* Taller gradient for better fade */
    display: flex;
    align-items: flex-end;
    justify-content: center;
    padding-bottom: 30px;
    z-index: 10;
    
    /* The specific gradient logic using the Variable */
    background: linear-gradient(
        to bottom, 
        rgba(0,0,0,0) 0%, 
        var(--overlay-color) 85%
    );
    transition: opacity 0.3s;
}

/* Button Styling - "Stylish" */
.wp-block-custom-expandable-group .expandable-toggle-btn {
    background: #ffffff;
    color: #333333;
    border: none;
    padding: 12px 32px;
    border-radius: 50px; /* Pill shape */
    font-size: 14px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    cursor: pointer;
    box-shadow: 0 4px 15px rgba(0,0,0,0.2);
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.wp-block-custom-expandable-group .expandable-toggle-btn:hover {
    background: #f0f0f0;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
}

/* Editor Specific Label */
.expandable-editor-label {
    position: absolute;
    top: -20px;
    left: 0;
    background: #eee;
    padding: 2px 6px;
    font-size: 9px;
    border-radius: 3px;
    opacity: 0.7;
}

/* === STATE: Expanded === */
.wp-block-custom-expandable-group.is-expanded .expandable-group-content {
    max-height: none !important;
    overflow: visible;
}

/* When expanded, we keep the button but remove the gradient background */
.wp-block-custom-expandable-group.is-expanded .expandable-group-gradient {
    position: relative;
    height: auto;
    background: none; /* Remove gradient */
    padding-top: 20px;
    padding-bottom: 0;
}

/* === STATE: Short Content (Auto Hide) === */
.wp-block-custom-expandable-group.is-short-content .expandable-group-content {
    max-height: none;
}
.wp-block-custom-expandable-group.is-short-content .expandable-group-gradient {
    display: none;
}