/* Compact map bootstrap and error states. */
.swstrc-map-compact[data-swstrc-map-state="loading"] .swstrc-map-elements,
.swstrc-map-compact[data-swstrc-map-state="error"] .swstrc-map-elements {
    visibility: hidden;
    opacity: 0;
}

.swstrc-map-compact .swstrc-map-elements {
    transition: none;
}

.swstrc-map-compact__map .swstrc-map-loader {
    position: absolute;
    z-index: 2;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .75rem;
    margin: 0;
    color: var(--compact-muted, #68736a);
    font-size: .9rem;
    text-align: center;
    opacity: 1;
    visibility: visible;
    transition: none;
}

.swstrc-map-compact[data-swstrc-map-state="ready"] .swstrc-map-loader {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.swstrc-map-compact[data-swstrc-map-state="loading"] .swstrc-map-loader__label {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

.swstrc-map-compact[data-swstrc-map-state="error"] .swstrc-map-loader__baubles {
    display: none;
}

.swstrc-map-loader__baubles {
    display: flex;
    align-items: flex-start;
    gap: .55rem;
    height: 2rem;
}

.swstrc-map-loader__baubles > span {
    position: relative;
    width: 1rem;
    height: 1rem;
    aspect-ratio: 1;
    flex: 0 0 1rem;
    border: 1px solid rgba(37, 45, 41, .22);
    border-radius: 50%;
    background:
        radial-gradient(circle at 34% 27%, rgba(255, 255, 255, .8) 0 5%, rgba(255, 255, 255, .24) 18%, transparent 44%),
        linear-gradient(145deg, rgba(255, 255, 255, .32), transparent 54%),
        var(--swstrc-map-bauble-color, var(--compact-green, #376134));
    box-shadow: inset -.16rem -.17rem .22rem rgba(0, 0, 0, .18), 0 .12rem .3rem rgba(37, 45, 41, .14);
    transform-origin: 50% -.16rem;
    animation: swstrc-map-bauble-sway 1.8s cubic-bezier(.45, 0, .55, 1) infinite;
}

.swstrc-map-loader__baubles > span::before {
    position: absolute;
    top: -.22rem;
    left: calc(50% - .14rem);
    width: .28rem;
    height: .18rem;
    border-radius: .08rem .08rem 0 0;
    background: var(--compact-gold, #b58900);
    box-shadow: inset 0 1px rgba(255, 255, 255, .45);
    content: "";
}

.swstrc-map-loader__baubles > span::after {
    position: absolute;
    top: .2rem;
    left: .2rem;
    width: .12rem;
    height: .28rem;
    border-radius: 50%;
    background: rgba(255, 255, 255, .7);
    box-shadow: 0 0 .12rem rgba(255, 255, 255, .75);
    content: "";
}

.swstrc-map-loader__baubles > span:nth-child(2) {
    --swstrc-map-bauble-color: var(--compact-gold, #b58900);
    animation-delay: .18s;
}

.swstrc-map-loader__baubles > span:nth-child(3) {
    animation-delay: .36s;
}

@keyframes swstrc-map-bauble-sway {
    0%, 100% { transform: translate3d(0, 0, 0) rotate(-3deg); }
    50% { transform: translate3d(0, -.12rem, 0) rotate(3deg); }
}

.swstrc-map-loader button {
    padding: .45rem .7rem;
    border: 1px solid var(--compact-line, #dedfd8);
    border-radius: .4rem;
    background: var(--color-light, #fefbf6);
    color: var(--compact-ink, #202a24);
    font: inherit;
}

@media (prefers-reduced-motion: reduce) {
    .swstrc-map-compact .swstrc-map-elements,
    .swstrc-map-compact .swstrc-map-loader {
        transition: none;
    }

    .swstrc-map-loader__baubles > span {
        animation: none;
    }
}

/* The invisible ready-state loader must not keep requesting animation frames. */
.swstrc-map-compact[data-swstrc-map-state="ready"] .swstrc-map-loader__baubles > span { animation: none; }
