/* Internals of the patrolling nine-tail (js/pet-runner.js). Auto-injected by the module.

   This file styles the fox and its bubble and nothing else — the band it paces along, its
   ground line and its backdrop all belong to the page. Everything here is driven by the
   `--ec-*` custom properties, so restyling the bubble to match a section is a matter of
   setting them on the container:

       #ld-pet-band { --ec-bubble-bg: #17120e; --ec-bubble-accent: #e7c184; }               */

.ec-runner {
    --ec-bubble-bg: rgba(21, 17, 13, 0.94);
    --ec-bubble-line: rgba(231, 193, 132, 0.34);
    --ec-bubble-text: #ece5da;
    --ec-bubble-accent: #e7c184;
    --ec-bubble-accent-ink: #1a1410;

    position: absolute;
    left: 0;
    width: var(--ec-frame);
    height: var(--ec-frame);
    /* Only ever moved with a transform, so pacing never touches layout. */
    will-change: transform;
    pointer-events: none;
    z-index: 2;
}

.ec-runner-sprite {
    display: block;
    width: 100%;
    height: 100%;
    /* The sprite sheets are pre-scaled; letting the GPU smooth them again only softens the
       linework, and these are small pixel-art-adjacent frames. */
    image-rendering: auto;
    transform-origin: 50% 50%;
    /* No transition on the mirror: a turn is instant in the animation, and easing it makes the
       fox look like it is sliding through itself. */
}

/* ── bubble ──────────────────────────────────────────────────────────────────────────────
   Positioned by the module (its `left` tracks the fox's centre through a turn); the lift and
   the pointer live here. */

.ec-runner-bubble {
    position: absolute;
    bottom: calc(var(--ec-frame) * 0.72);
    transform: translate(-50%, 6px);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1rem 0.85rem;
    min-width: max-content;
    max-width: 17rem;
    background: var(--ec-bubble-bg);
    border: 1px solid var(--ec-bubble-line);
    border-radius: 12px;
    box-shadow: 0 18px 40px -18px rgba(0, 0, 0, 0.9);
    color: var(--ec-bubble-text);
    font-size: 0.9375rem;
    line-height: 1.45;
    text-align: center;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 260ms ease, transform 260ms cubic-bezier(0.22, 1, 0.36, 1), visibility 0s linear 260ms;
}

.ec-runner.is-talking .ec-runner-bubble {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, 0);
    pointer-events: auto;
    transition-delay: 0s, 0s, 0s;
}

/* The tail. Drawn as a rotated square rather than a border triangle so it can carry the same
   1px edge as the bubble body. */
.ec-runner-bubble::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: -6px;
    width: 11px;
    height: 11px;
    margin-left: -5.5px;
    background: var(--ec-bubble-bg);
    border-right: 1px solid var(--ec-bubble-line);
    border-bottom: 1px solid var(--ec-bubble-line);
    transform: rotate(45deg);
}

.ec-runner-greeting {
    display: block;
    color: inherit;
    opacity: 0.82;
}

.ec-runner-cta {
    display: inline-block;
    padding: 0.45rem 0.95rem;
    border-radius: 999px;
    background: var(--ec-bubble-accent);
    color: var(--ec-bubble-accent-ink);
    font-weight: 700;
    font-size: 0.875rem;
    letter-spacing: 0.01em;
    text-decoration: none;
    white-space: nowrap;
    transition: filter 160ms ease, transform 160ms ease;
}

.ec-runner-cta:hover,
.ec-runner-cta:focus-visible {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.ec-runner-cta:focus-visible {
    outline: 2px solid var(--ec-bubble-accent);
    outline-offset: 3px;
}

@media (prefers-reduced-motion: reduce) {
    .ec-runner-bubble {
        transition: none;
    }
}
