/* ---- press and hold to buy (js/hold-button.js) ---------------------------------------------------------------
   A buy button carries a ring that is full at rest and drains to empty over the 1.5-second hold, with the seconds left in
   its middle. The script writes --buy-hold-left (1 → 0) every frame; the ring's dash is drawn from it, so nothing here
   animates by itself and letting go snaps it back full. Global, because the /buy page is static, the Price alerts buttons
   are Blazor components, and the "Are you sure?" dialog is made by the script in <body>. */

.buy-hold {
    position: relative;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
    touch-action: none;
}

.buy-hold__ring {
    position: relative;
    flex: none;
    width: 1.35rem;
    height: 1.35rem;
    display: inline-grid;
    place-items: center;
}

.buy-hold__ring svg {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    transform: rotate(-90deg);
}

.buy-hold__track { fill: none; stroke: currentColor; opacity: 0.25; stroke-width: 3.5; }

.buy-hold__bar {
    fill: none;
    stroke: currentColor;
    stroke-width: 3.5;
    stroke-linecap: round;
    /* pathLength is 100 in the markup: what is left of the hold is what is drawn. */
    stroke-dasharray: 100;
    stroke-dashoffset: calc(100 * (1 - var(--buy-hold-left, 1)));
}

/* At rest the ring is a quiet full circle; held, it is bold and the seconds left show in its middle. */
.buy-hold:not(.is-holding) .buy-hold__bar { opacity: 0.55; }
.buy-hold.is-holding { filter: brightness(1.08); }
.buy-hold.is-holding .buy-hold__bar { stroke-width: 4.5; }

.buy-hold__left {
    position: relative;
    font-size: 0.5rem;
    font-weight: 750;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

.buy-hold.is-done { opacity: 0.6; cursor: progress; }

.buy-hold--big {
    font-size: 1.05rem;
    padding: 0.75rem 1.4rem;
    min-height: 3.25rem;
    width: 100%;
    justify-content: center;
}

.buy-hold--big .buy-hold__ring { width: 2.1rem; height: 2.1rem; }
.buy-hold--big .buy-hold__left { font-size: 0.68rem; }

/* The "Are you sure?" a quick click opens. */
.buy-hold-confirm {
    border: 1px solid var(--rl-border);
    border-radius: var(--rl-radius, 12px);
    background: var(--rl-surface);
    color: var(--rl-text);
    padding: 1.1rem 1.2rem 1rem;
    width: min(92vw, 24rem);
    box-shadow: var(--rl-shadow-md, 0 18px 48px -18px rgb(0 0 0 / 0.45));
}

.buy-hold-confirm::backdrop { background: rgb(8 10 14 / 0.55); }
.buy-hold-confirm__form { display: flex; flex-direction: column; gap: 0.5rem; margin: 0; }
.buy-hold-confirm__q { margin: 0; font-size: 1rem; font-weight: 650; }
.buy-hold-confirm__hint { margin: 0; font-size: 0.8rem; color: var(--rl-text-muted); }
.buy-hold-confirm__actions { display: flex; justify-content: flex-end; gap: 0.5rem; margin-top: 0.5rem; }

.btn--sm.buy-hold .buy-hold__ring { width: 1.1rem; height: 1.1rem; }
.btn--sm.buy-hold .buy-hold__left { font-size: 0.42rem; }
