/* Address check states in the address_verify_modal — see purchase/modals/address_verify_modal.php.
   --eg-address-accent is set from the merchant's checkout button colour by physicalgift.js. */

.eg-address-check {
    --eg-address-accent-fallback: #e01c00;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    min-width: min(320px, 70vw);
    min-height: 220px;
    justify-content: center;
    text-align: center;
    color: #333333;
    animation: eg-address-fade-in 0.25s ease-out;
}

.eg-address-check__map {
    width: 120px;
    height: 96px;
    margin-bottom: 10px;
    overflow: visible;
}

.eg-address-check__ground {
    fill: #f4f4f4;
    stroke: #e3e3e3;
}

.eg-address-check__streets {
    fill: none;
    stroke: #e3e3e3;
    stroke-width: 6;
}

.eg-address-check__route {
    fill: none;
    stroke: var(--eg-address-accent, var(--eg-address-accent-fallback));
    stroke-width: 3;
    stroke-linecap: round;
    stroke-dasharray: 100;
    stroke-dashoffset: 100;
    animation: eg-address-route 1.8s ease-in-out infinite;
}

.eg-address-check__origin {
    fill: #ffffff;
    stroke: var(--eg-address-accent, var(--eg-address-accent-fallback));
    stroke-width: 3;
}

.eg-address-check__pin path {
    fill: var(--eg-address-accent, var(--eg-address-accent-fallback));
}

.eg-address-check__pin circle {
    fill: #ffffff;
}

.eg-address-check__pin,
.eg-address-check__shadow,
.eg-address-check__ripple,
.eg-address-check__badge {
    transform-box: fill-box;
    transform-origin: center bottom;
}

.eg-address-check__pin {
    animation: eg-address-bob 0.9s ease-in-out infinite alternate;
}

.eg-address-check__shadow {
    fill: rgba(0, 0, 0, 0.18);
    transform-origin: center;
    animation: eg-address-shadow 0.9s ease-in-out infinite alternate;
}

.eg-address-check__ripple {
    fill: none;
    stroke: var(--eg-address-accent, var(--eg-address-accent-fallback));
    stroke-width: 1.5;
    transform-origin: center;
    animation: eg-address-ripple 1.8s ease-out infinite;
}

.eg-address-check__title {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
}

.eg-address-check__hint {
    margin: 0;
    max-width: 34ch;
    font-size: 14px;
    color: #555555;
}

/* Confirmed: the route is complete and the pin becomes a check. */
.eg-address-check--confirmed .eg-address-check__route {
    stroke-dashoffset: 0;
    animation: none;
}

.eg-address-check--confirmed .eg-address-check__ripple {
    animation: eg-address-ripple 0.8s ease-out 1 both;
}

.eg-address-check__badge {
    transform-origin: center;
    animation: eg-address-pop 0.4s cubic-bezier(0.3, 1.6, 0.5, 1) both;
}

.eg-address-check__badge circle {
    fill: var(--eg-address-accent, var(--eg-address-accent-fallback));
}

.eg-address-check__badge path {
    fill: none;
    stroke: #ffffff;
    stroke-width: 3;
    stroke-linecap: round;
    stroke-linejoin: round;
    stroke-dasharray: 24;
    stroke-dashoffset: 24;
    animation: eg-address-tick 0.35s 0.2s ease-out forwards;
}

/* Failed: the pin stands still and goes grey; the shopper decides what to do. */
.eg-address-check--failed .eg-address-check__pin {
    animation: none;
}

.eg-address-check--failed .eg-address-check__pin path {
    fill: #9a9a9a;
}

/* .gifting-option-btns brings 50px of top padding meant for the page's button rows. */
.eg-address-check .gifting-option-btns {
    margin-top: 14px;
    padding-top: 0;
}

.eg-address-check__link {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 8px;
    color: inherit;
    font-size: 14px;
    text-decoration: underline;
}

@keyframes eg-address-fade-in {
    from { opacity: 0; transform: translateY(4px); }
    to { opacity: 1; transform: none; }
}

@keyframes eg-address-route {
    0% { stroke-dashoffset: 100; }
    55%, 80% { stroke-dashoffset: 0; }
    100% { stroke-dashoffset: -100; }
}

@keyframes eg-address-bob {
    from { transform: translateY(0); }
    to { transform: translateY(-6px); }
}

@keyframes eg-address-shadow {
    from { transform: scaleX(1); opacity: 1; }
    to { transform: scaleX(0.65); opacity: 0.6; }
}

@keyframes eg-address-ripple {
    from { transform: scale(1); opacity: 0.6; }
    to { transform: scale(3.2); opacity: 0; }
}

@keyframes eg-address-pop {
    from { transform: scale(0.3); }
    to { transform: scale(1); }
}

@keyframes eg-address-tick {
    to { stroke-dashoffset: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .eg-address-check,
    .eg-address-check__pin,
    .eg-address-check__shadow,
    .eg-address-check__ripple,
    .eg-address-check__badge {
        animation: none;
    }

    .eg-address-check__route {
        stroke-dashoffset: 0;
        animation: none;
    }

    .eg-address-check__badge path {
        stroke-dashoffset: 0;
        animation: none;
    }
}
