/* ============================================================
   Ajebhom's tour of the home page (robot-tour.js): the dimmed page with one lit feature, the robot standing on
   the edge of its speech card, and the launcher button in the corner.
   ============================================================ */

/* the robot over the console steps aside while its double guides the tour */
.is-touring .hm-bot {
    visibility: hidden;
}

/* the page dims; the lit feature is a hole made by one huge shadow */
.htr-mask {
    position: fixed;
    inset: 0;
    z-index: 10040;
}

.htr-hole {
    position: absolute;
    display: block;
    border-radius: 14px;
    box-shadow: 0 0 0 9999px rgba(15, 18, 26, 0);
    pointer-events: none;
    transition: top .5s cubic-bezier(.4, 0, .2, 1), left .5s cubic-bezier(.4, 0, .2, 1), width .5s cubic-bezier(.4, 0, .2, 1),
        height .5s cubic-bezier(.4, 0, .2, 1), box-shadow .35s ease, opacity .3s ease;
}

.htr-mask.is-on .htr-hole {
    box-shadow: 0 0 0 9999px rgba(15, 18, 26, .66);
}

/* hello and goodbye: nothing lit, so no ring */
.htr-hole.is-none::after {
    display: none;
}

/* a soft ring around the lit feature */
.htr-hole::after {
    content: "";
    position: absolute;
    inset: 0;
    border-radius: inherit;
    border: 2px solid rgba(255, 255, 255, .85);
    box-shadow: 0 0 0 6px rgba(201, 29, 19, .35);
    transition: opacity .3s ease;
}

/* leaving: the ring fades with the dark */
.htr-mask:not(.is-on) .htr-hole::after {
    opacity: 0;
}

.htr-mask[hidden],
.htr-guide[hidden],
.htr-card[hidden] {
    display: none;
}

/* ---- the robot: behind its card, so its lower part stands hidden behind the card's edge ---- */
.htr-guide {
    position: fixed;
    top: 0;
    left: 0;
    z-index: 10041;
    pointer-events: none;
    transition: transform .6s cubic-bezier(.45, 0, .2, 1), width .6s ease, height .6s ease;
}

.htr-bot {
    position: relative;
    width: 100%;
    height: 100%;
}

/* the jump along the way, on top of the slide */
.htr-bot.is-hop,
.htr-bot.is-hop-back {
    animation: htr-hop .6s cubic-bezier(.45, 0, .2, 1);
}

@keyframes htr-hop {
    45% { transform: translateY(-34px) rotate(-6deg); }
    80% { transform: translateY(3px); }
}

.htr-bot.is-hop-back {
    animation-name: htr-hop-back;
}

@keyframes htr-hop-back {
    45% { transform: translateY(-34px) rotate(6deg); }
    80% { transform: translateY(3px); }
}

.htr-guide.is-pop .htr-bot {
    animation: htr-pop .5s cubic-bezier(.34, 1.56, .64, 1);
}

@keyframes htr-pop {
    from { transform: scale(.2); opacity: 0; }
}

.htr-img {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
}

    .htr-img.is-on {
        opacity: 1;
    }

/* ---- the speech card ---- */
.htr-card {
    position: fixed;
    z-index: 10042;
    width: min(380px, calc(100vw - 24px));
    padding: 16px 18px 14px;
    border-radius: 20px;
    background: var(--ds-surface);
    border: 1px solid var(--ds-line);
    border-top: 3px solid var(--ds-red);
    box-shadow: 0 26px 70px rgba(15, 18, 26, .32);
    color: var(--ds-text);
    transition: top .5s cubic-bezier(.4, 0, .2, 1), left .5s cubic-bezier(.4, 0, .2, 1);
}

    .htr-card.is-in .htr-title,
    .htr-card.is-in .htr-body {
        animation: htr-text .45s ease both;
    }

    .htr-card.is-in .htr-body {
        animation-delay: .08s;
    }

@keyframes htr-text {
    from { opacity: 0; transform: translateY(6px); }
}

.htr-close {
    position: absolute;
    top: 8px;
    inset-inline-end: 10px;
    border: 0;
    background: none;
    cursor: pointer;
    font-size: 22px;
    line-height: 1;
    color: var(--ds-muted);
}

    .htr-close:hover {
        color: var(--ds-red);
    }

.htr-title {
    margin: 0;
    padding-inline-end: 22px;
    font-size: 16px;
    font-weight: 800;
    line-height: 1.45;
    color: var(--ds-ink);
}

.htr-body {
    margin: 6px 0 0;
    font-size: 13.5px;
    line-height: 1.85;
}

/* hello and goodbye: centred, a little bigger */
.htr-card.is-hello,
.htr-card.is-end {
    text-align: center;
}

    .htr-card.is-hello .htr-title,
    .htr-card.is-end .htr-title {
        padding: 0;
        font-size: 19px;
    }

.htr-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin: 12px 0 10px;
}

    .htr-card.is-hello .htr-foot,
    .htr-card.is-end .htr-foot {
        display: none;
    }

.htr-dots {
    display: flex;
    gap: 5px;
}

    .htr-dots i {
        width: 6px;
        height: 6px;
        border-radius: 99px;
        background: var(--ds-line);
        transition: width .2s ease, background .2s ease;
    }

        .htr-dots i.on {
            width: 18px;
            background: var(--ds-red);
        }

.htr-count {
    font-size: 11.5px;
    font-weight: 800;
    color: var(--ds-muted);
}

.htr-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .htr-actions > span {
        flex: 1;
    }

    .htr-card.is-hello .htr-actions,
    .htr-card.is-end .htr-actions {
        margin-top: 14px;
        flex-direction: row-reverse;
        justify-content: center;
    }

        .htr-card.is-hello .htr-actions > span,
        .htr-card.is-end .htr-actions > span {
            display: none;
        }

.htr-actions button[hidden] {
    display: none;
}

.htr-skip {
    border: 0;
    background: none;
    cursor: pointer;
    padding: 8px 4px;
    font-size: 12.5px;
    font-weight: 700;
    color: var(--ds-muted);
}

    .htr-skip:hover {
        color: var(--ds-ink);
    }

.htr-back,
.htr-next {
    cursor: pointer;
    padding: 8px 16px;
    border-radius: 99px;
    font-size: 13px;
    font-weight: 700;
}

.htr-back {
    border: 1px solid var(--ds-line);
    background: var(--ds-surface);
    color: var(--ds-text);
}

.htr-next {
    border: 0;
    padding-inline: 20px;
    background: var(--ds-red);
    color: #fff;
    box-shadow: 0 10px 24px rgba(201, 29, 19, .26);
}

    .htr-next:hover {
        background: var(--ds-red-dark);
    }

    .htr-next:focus-visible,
    .htr-back:focus-visible {
        outline: 2px solid rgba(201, 29, 19, .45);
        outline-offset: 3px;
    }

/* ---- the replay button: its face in the corner ---- */
.htr-launch {
    position: fixed;
    bottom: 20px;
    inset-inline-end: 20px;
    z-index: 1035;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 16px 4px 6px;
    padding-inline: 6px 16px;
    border: 1px solid var(--ds-line);
    border-radius: 99px;
    background: var(--ds-surface);
    box-shadow: var(--ds-shadow-md);
    cursor: pointer;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    color: var(--ds-ink);
    transition: transform .18s ease, box-shadow .18s ease;
}

    .htr-launch img {
        width: 40px;
        height: 40px;
        object-fit: cover;
        object-position: 50% 18%;
    }

    .htr-launch:hover {
        transform: translateY(-2px);
        box-shadow: var(--ds-shadow-lg);
    }

    .htr-launch[hidden] {
        display: none;
    }

@media (max-width: 575px) {
    .htr-card {
        padding: 14px 14px 12px;
    }

    .htr-body {
        font-size: 13px;
        line-height: 1.75;
    }

    .htr-launch {
        bottom: 16px;
        inset-inline-end: 16px;
        padding: 3px;
    }

        .htr-launch span {
            display: none;
        }
}

@media (prefers-reduced-motion: reduce) {
    .htr-hole,
    .htr-guide,
    .htr-card,
    .htr-launch {
        transition: none;
    }

    .htr-card.is-in .htr-title,
    .htr-card.is-in .htr-body {
        animation: none;
    }
}
