/* The ticket on the credit link page. It lands, its stub flexes on the perforation, and then it drifts. */
.coupon {
    margin-block: var(--spacing-md) var(--spacing-2xl);
    animation: coupon-drift 3.4s ease-in-out 1s infinite alternate;
}

.coupon__ticket {
    display: flex;
    width: 224px;
    height: 124px;
    filter: var(--shadow-ticket);
    transform: rotate(-5deg);
    transition: transform 0.45s var(--ease-out);
    animation: coupon-land 0.95s var(--ease-out) backwards;
}

.coupon:hover .coupon__ticket {
    transform: rotate(-2deg) scale(1.03);
}

.coupon__main,
.coupon__stub {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.coupon__main {
    flex: 0 0 172px;
}

.coupon__stub {
    flex: 0 0 52px;
    transform-origin: left center;
    transition: transform 0.45s cubic-bezier(0.3, 1.6, 0.5, 1);
    animation: coupon-flex 0.7s var(--ease-press) 0.75s;
}

.coupon:hover .coupon__stub {
    transform: rotate(7deg);
}

.coupon__paper {
    position: absolute;
    inset: 0;
    overflow: visible;
}

.coupon__fill {
    fill: var(--color-surface);
}

.coupon__edge {
    fill: none;
    stroke: var(--color-border);
    stroke-width: var(--border-width);
}

.coupon__perforation {
    fill: none;
    stroke: var(--color-control-border);
    stroke-width: 1.5;
    stroke-linecap: round;
    stroke-dasharray: 0.5 6;
}

.coupon__disc {
    position: relative;
    display: grid;
    place-items: center;
    width: 68px;
    height: 68px;
    background: var(--color-coupon-wash);
    border-radius: var(--radius-full);
    animation: coupon-pop 0.6s var(--ease-out) 0.45s backwards;
}

.coupon__dollar {
    width: 32px;
    height: 32px;
    fill: none;
    stroke: var(--color-coupon-ink);
    stroke-width: 1.9;
    stroke-linecap: round;
    stroke-linejoin: round;
}

.coupon__stub-text {
    position: relative;
    font-family: var(--font-family-mono);
    font-size: 0.75rem;
    letter-spacing: 0.12em;
    color: var(--color-on-surface-muted);
    text-transform: uppercase;
    white-space: nowrap;
    writing-mode: vertical-rl;
}

@keyframes coupon-land {
    0% {
        opacity: 0;
        transform: translateY(34px) rotate(-17deg) scale(0.9);
    }

    55% {
        opacity: 1;
        transform: translateY(-5px) rotate(-2.5deg) scale(1.02);
    }

    80% {
        transform: translateY(1px) rotate(-6deg) scale(0.995);
    }

    100% {
        transform: rotate(-5deg);
    }
}

@keyframes coupon-flex {
    0%,
    100% {
        transform: rotate(0deg);
    }

    35% {
        transform: rotate(9deg);
    }

    70% {
        transform: rotate(-2deg);
    }
}

@keyframes coupon-pop {
    0% {
        transform: scale(0.6);
    }

    60% {
        transform: scale(1.08);
    }

    100% {
        transform: scale(1);
    }
}

@keyframes coupon-drift {
    from {
        transform: translateY(0) rotate(0deg);
    }

    to {
        transform: translateY(-6px) rotate(1.2deg);
    }
}

@media (prefers-reduced-motion: reduce) {
    .coupon,
    .coupon__ticket,
    .coupon__stub,
    .coupon__disc {
        animation: none;
    }

    .coupon__ticket,
    .coupon__stub {
        transition: none;
    }
}
