.af-animated-button-wrap {
    margin-block: var(--af-animated-margin-before, 1.5em) var(--af-animated-margin-after, 1.5em);
}

.af-animated-button-wrap--left { text-align: left; }
.af-animated-button-wrap--center { text-align: center; }
.af-animated-button-wrap--right { text-align: right; }

.af-animated-button,
.af-animated-button-wrap > a.af-animated-button:any-link,
.entry-content .af-animated-button-wrap > a.af-animated-button:any-link {
    color: var(--af-animated-text, #fff);
    text-decoration: none;
}

.af-animated-button {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
    max-width: 100%;
    min-height: 44px;
    padding: var(--af-animated-padding-y, 0.75em) 1.5em;
    overflow: hidden;
    border-radius: var(--af-animated-radius, 0.6em);
    background: var(--af-animated-background, #17645b);
    box-shadow: 0 3px 8px rgb(0 0 0 / 16%);
    font-size: 1rem;
    font-weight: 700;
    line-height: 1.5;
    text-align: center;
    white-space: normal;
    overflow-wrap: anywhere;
    vertical-align: middle;
}

.af-animated-button,
.af-link-motion {
    --af-animated-name: none;
    --af-animated-duration: 0.85s;
}

.af-animated-button--small { font-size: 0.875rem; padding-inline: 1.1em; }
.af-animated-button--large { min-height: 52px; font-size: 1.25rem; padding-inline: 1.8em; }
.af-animated-button[style*="--af-animated-width:"] { width: var(--af-animated-width); }
.af-animated-button--shadow-lower { box-shadow: 0 5px 0 rgb(0 0 0 / 30%); }
.af-animated-button--shadow-soft { box-shadow: 0 7px 22px rgb(0 0 0 / 18%); }
.af-animated-button--shadow-none { box-shadow: none; }

.af-animated-button:focus-visible {
    outline: 2px solid currentColor;
    outline-offset: -4px;
    box-shadow: 0 0 0 3px CanvasText;
}

.af-animated-button--motion-bounce { --af-animated-name: af-animated-bounce; }
.af-animated-button--motion-pulse { --af-animated-name: af-animated-pulse; }
.af-animated-button--motion-swing { --af-animated-name: af-animated-swing; }

.af-link-motion.af-animated-button--motion-shine {
    position: relative;
    overflow: hidden;
}

.af-animated-button--motion-shine::after {
    position: absolute;
    inset-block: 0;
    inset-inline-start: -50%;
    width: 36%;
    background: linear-gradient(90deg, transparent, rgb(255 255 255 / 35%), transparent);
    content: "";
    pointer-events: none;
    transform: skewX(-22deg);
}

.af-animated-button--trigger-appear,
.af-animated-button--trigger-interact:focus-visible,
.afhs-guide-link:focus-visible .af-link-motion.af-animated-button--trigger-interact {
    animation: var(--af-animated-name) var(--af-animated-duration) ease-in-out 2;
}

.af-animated-button--motion-shine.af-animated-button--trigger-appear::after,
.af-animated-button--motion-shine.af-animated-button--trigger-interact:focus-visible::after,
.afhs-guide-link:focus-visible .af-link-motion.af-animated-button--motion-shine.af-animated-button--trigger-interact::after {
    animation: af-animated-shine 1.15s ease-in-out 2;
}

.af-animated-button--trigger-repeat {
    animation: var(--af-animated-name) var(--af-animated-duration) ease-in-out infinite;
}

.af-animated-button--motion-shine.af-animated-button--trigger-repeat::after {
    animation: af-animated-shine 1.15s ease-in-out infinite;
}

@media (hover: hover) {
    .af-animated-button--trigger-interact:hover,
    .afhs-guide-link:hover .af-link-motion.af-animated-button--trigger-interact {
        animation: var(--af-animated-name) var(--af-animated-duration) ease-in-out 2;
    }
    .af-animated-button--motion-shine.af-animated-button--trigger-interact:hover::after,
    .afhs-guide-link:hover .af-link-motion.af-animated-button--motion-shine.af-animated-button--trigger-interact::after {
        animation: af-animated-shine 1.15s ease-in-out 2;
    }
}

@keyframes af-animated-bounce {
    0%, 100% { transform: translateY(0); }
    32% { transform: translateY(-8px); }
    64% { transform: translateY(-3px); }
}

@keyframes af-animated-pulse {
    0%, 100% { transform: scale(1); }
    50% { transform: scale(1.04); }
}

@keyframes af-animated-swing {
    0%, 100% { transform: rotate(0); }
    28% { transform: rotate(-4deg); }
    70% { transform: rotate(4deg); }
}

@keyframes af-animated-shine {
    0%, 10% { transform: skewX(-22deg) translateX(0); }
    80%, 100% { transform: skewX(-22deg) translateX(460%); }
}

@media (prefers-reduced-motion: reduce) {
    .af-animated-button,
    .af-animated-button::after,
    .af-link-motion,
    .af-link-motion::after {
        animation: none !important;
    }
}

.af-animated-button-editor__controls {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(min(100%, 9rem), 1fr));
    gap: 0.5rem 0.875rem;
}

.af-animated-button-editor__controls p { margin: 0; }
.af-animated-button-editor__controls label { display: block; margin-block-end: 0.25rem; }
.af-animated-button-editor__controls select { max-width: 100%; }
.af-animated-button-editor__controls input[type="number"] { width: 6rem; max-width: 100%; }
.af-animated-button-editor__dimensions { margin-block: 1rem; }
.af-animated-button-editor__dimensions legend { font-weight: 600; }
.af-animated-button-editor__preview > .af-animated-button-wrap {
    margin-block: var(--af-animated-margin-before, 0) var(--af-animated-margin-after, 0);
}
#affino-animated-url { margin-block: 0.25rem; }

.af-animated-button-editor__preview {
    margin: 0;
    padding: 1rem;
    border: 1px solid #c3c4c7;
    border-radius: 0.375rem;
    background: #f6f7f7;
}

.af-animated-button-copy {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.af-animated-button-copy input { flex: 1 1 13rem; min-width: 0; font-family: monospace; }
.af-animated-button-copy [role="status"]:not(:empty) { flex-basis: 100%; }
