/**
 * Button Slash Animation Block styles
 */

.wp-block-button.has-slash-animation {
    position: relative;
    overflow: visible;
}

.wp-block-button.has-slash-animation .wp-block-button__link {
    transition: all 0.3s ease;
    position: relative;
    z-index: 1;
}

/* Ensure background color doesn't change on hover */
.wp-block-button.has-slash-animation .wp-block-button__link:hover {
    background-color: var(--wp--preset--color--accent-1) !important;
}

.wp-block-button.has-slash-animation .button-slash-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    z-index: 2;
    overflow: visible;
}

.wp-block-button.has-slash-animation .button-slash-overlay svg {
    position: absolute;
    bottom: -5px;
    left: 5px;
    width: 0;
    height: 42px;
    opacity: 0;
    transition: opacity 0.2s ease-out;
    overflow: visible;
}

.wp-block-button.has-slash-animation:hover .button-slash-overlay svg {
    opacity: 1;
    animation: slashGrowAndSlide 0.7s forwards;
}

/* Add a subtle drop shadow on click */
.wp-block-button.has-slash-animation:active .wp-block-button__link {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    transform: translateY(1px);
}

/* Animation for the slash to grow and slide */
@keyframes slashGrowAndSlide {
    0% {
        left: 5px;
        width: 0;
    }
    35% {
        left: 5px;
        width: 20.89px;
    }
    70% {
        left: calc(100% - 25.89px);
        width: 20.89px;
    }
    100% {
        left: calc(100% - 25.89px);
        width: 20.89px;
    }
}

/* Make the slash extend outside/on top of the button */
.wp-block-button.has-slash-animation .button-slash-overlay svg {
    position: absolute;
    left: 5px;
    height: calc(100% + 10px);
    top: -5px;
}

/* Responsive adjustments */
@media (max-width: 767px) {
    .wp-block-button.has-slash-animation .button-slash-overlay svg {
        height: calc(100% + 8px);
        top: -4px;
    }
}