/* ====================================================================
 * BACK TO TOP — WRAPPER & POSIZIONAMENTO
 * ==================================================================== */
.cta-btt-wrapper {
    --cta-btt-offset: 30px;
    display: inline-flex;
    line-height: 0;
}

.cta-btt-pos-fixed .cta-btt-wrapper,
.cta-btt-pos-desktop-fixed .cta-btt-wrapper,
.cta-btt-pos-tablet-fixed .cta-btt-wrapper,
.cta-btt-pos-mobile-fixed .cta-btt-wrapper {
    position: fixed;
}

.cta-btt-pos-absolute .cta-btt-wrapper,
.cta-btt-pos-desktop-absolute .cta-btt-wrapper,
.cta-btt-pos-tablet-absolute .cta-btt-wrapper,
.cta-btt-pos-mobile-absolute .cta-btt-wrapper {
    position: absolute;
}

.cta-btt-pos-static .cta-btt-wrapper {
    position: static;
}

/* ====================================================================
 * VISIBILITÀ
 * ==================================================================== */
.cta-btt-visibility-after_scroll {
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: opacity 0.35s ease, visibility 0.35s ease, transform 0.35s ease;
}
.cta-btt-visibility-after_scroll.is-visible {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* ====================================================================
 * BOTTONE BASE
 * ==================================================================== */
.cta-btt {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    position: relative;
    overflow: hidden;
    cursor: pointer;
    z-index: 1;
    line-height: 1;
    transition: all 0.3s ease-in-out;
    padding: 0;

    --cta-effect-color: rgba(0, 123, 255, 0.6);
    --cta-effect-speed: 2s;
    --cta-border-width: 2px;
    --cta-btt-size: 55px;
}

.cta-btt .cta-btn-text {
    display: inline-flex;
    align-items: center;
    line-height: 1;
    z-index: 2;
}

.cta-btt .cta-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    height: 1em;
    transition: transform 0.3s ease-in-out;
    z-index: 2;
}
.cta-btt .cta-icon i,
.cta-btt .cta-icon svg {
    display: block;
    vertical-align: middle;
    margin: 0;
}
.cta-btt .cta-icon-before { margin-right: 8px; }
.cta-btt .cta-icon-after  { margin-left: 8px; }

/* ====================================================================
 * FORME
 * ==================================================================== */
.cta-btt-shape-circle .cta-btt,
.cta-btt-shape-desktop-circle .cta-btt,
.cta-btt-shape-tablet-circle .cta-btt,
.cta-btt-shape-mobile-circle .cta-btt {
    border-radius: 50%;
}
.cta-btt-shape-square .cta-btt  { border-radius: 0; }
.cta-btt-shape-rounded .cta-btt { border-radius: 8px; }
.cta-btt-shape-pill .cta-btt    { border-radius: 999px; padding: 0 18px; }

/* ====================================================================
 * PROGRESS RING CIRCOLARE
 * ==================================================================== */
.cta-btt-has-progress {
    position: relative;
    --cta-btt-ring-size: 6px;
    --cta-btt-ring-gap: 4px;
    --cta-btt-ring-track: rgba(0, 0, 0, 0.1);
    --cta-btt-ring-color: #007bff;
}

.cta-btt-progress-ring {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
    overflow: visible;
    transform: rotate(-90deg); /* parte dall'alto */
    z-index: 0;
}

/* Esterno: sovradimensiona l'area dell'anello */
.cta-btt-has-progress.cta-btt-progress-outside .cta-btt-progress-ring {
    width: calc(100% + (var(--cta-btt-ring-size) + var(--cta-btt-ring-gap)) * 2);
    height: calc(100% + (var(--cta-btt-ring-size) + var(--cta-btt-ring-gap)) * 2);
    top: calc(-1 * (var(--cta-btt-ring-size) + var(--cta-btt-ring-gap)));
    left: calc(-1 * (var(--cta-btt-ring-size) + var(--cta-btt-ring-gap)));
}

/* Interno: resta dentro i bordi del bottone */
.cta-btt-has-progress.cta-btt-progress-inside .cta-btt-progress-ring {
    top: 2px;
    left: 2px;
    width: calc(100% - 4px);
    height: calc(100% - 4px);
}

.cta-btt-ring-track {
    stroke: var(--cta-btt-ring-track);
    stroke-width: var(--cta-btt-ring-size);
    fill: none;
}

.cta-btt-ring-progress {
    stroke: var(--cta-btt-ring-color);
    stroke-width: var(--cta-btt-ring-size);
    fill: none;
    stroke-dasharray: 289.03; /* 2 * PI * 46 */
    stroke-dashoffset: 289.03;
    transition: stroke-dashoffset 0.15s linear;
}

.cta-btt-progress-cap-round .cta-btt-ring-progress { stroke-linecap: round; }
.cta-btt-progress-cap-butt  .cta-btt-ring-progress { stroke-linecap: butt; }

/* ====================================================================
 * ANIMAZIONI ICONA
 * ==================================================================== */
.cta-btt.cta-btt-icon-bounce-up:hover .cta-icon,
.cta-btt.cta-btt-icon-bounce-up:focus-visible .cta-icon {
    animation: ctaBttBounceUp 0.5s ease-in-out;
}
@keyframes ctaBttBounceUp {
    0%, 100% { transform: translateY(0); }
    50%      { transform: translateY(-6px); }
}

.cta-btt.cta-btt-icon-slide-right:hover .cta-icon,
.cta-btt.cta-btt-icon-slide-right:focus-visible .cta-icon {
    animation: ctaIconSlideRight 0.5s ease-in-out;
}
.cta-btt.cta-btt-icon-slide-left:hover .cta-icon,
.cta-btt.cta-btt-icon-slide-left:focus-visible .cta-icon {
    animation: ctaIconSlideLeft 0.5s ease-in-out;
}
.cta-btt.cta-btt-icon-rotate:hover .cta-icon,
.cta-btt.cta-btt-icon-rotate:focus-visible .cta-icon {
    animation: ctaIconRotate 0.6s ease-in-out;
}

/* ====================================================================
 * EFFETTI (riuso classi del bottone CTA)
 * ==================================================================== */
.cta-btt.cta-effect-rotate-border::before { border-radius: inherit; }

.cta-btt.cta-effect-glow.cta-trigger-always,
.cta-btt.cta-effect-glow.cta-trigger-hover:hover {
    animation: ctaGlow var(--cta-effect-speed) infinite;
}
.cta-btt.cta-effect-pulse-scale.cta-trigger-always,
.cta-btt.cta-effect-pulse-scale.cta-trigger-hover:hover {
    animation: ctaPulseScale var(--cta-effect-speed) infinite ease-in-out;
}
.cta-btt.cta-effect-shake.cta-trigger-always,
.cta-btt.cta-effect-shake.cta-trigger-hover:hover {
    animation: ctaShake var(--cta-effect-speed) infinite;
}
.cta-btt.cta-effect-neon.cta-trigger-always,
.cta-btt.cta-effect-neon.cta-trigger-hover:hover {
    animation: ctaNeon var(--cta-effect-speed) infinite alternate;
}
.cta-btt.cta-effect-pulse-border.cta-trigger-always::before,
.cta-btt.cta-effect-pulse-border.cta-trigger-hover:hover::before {
    animation: ctaPulseBorderRing var(--cta-effect-speed) ease-out infinite;
}

/* ====================================================================
 * ACCESSIBILITÀ
 * ==================================================================== */
@media (prefers-reduced-motion: reduce) {
    .cta-btt,
    .cta-btt .cta-icon,
    .cta-btt-wrapper {
        animation: none !important;
        transition: none !important;
    }
    .cta-btt-ring-progress {
        transition: none !important;
    }
}