/* Guided intro tour: dims the page, spotlights one section at a time and anchors an
   explanatory tooltip beside it. Driven by Components/Controls/Shared/HelpTour.razor
   and positioned by scripts/help-tour.js. */

.help-tour {
    position: fixed;
    inset: 0;
    /* Above the sticky header (100) and nav, below modals (999) so a modal opened mid-tour
       still wins. */
    z-index: 900;
    /* The backdrop is drawn by the spotlight's huge outer shadow, so this layer itself must
       not swallow clicks anywhere except on its own children. */
    pointer-events: none;
    opacity: 0;
    transition: opacity .2s ease-out;
}

    .help-tour.active {
        opacity: 1;
    }

/* The cut-out. The oversized box-shadow paints the dim over the whole viewport while the
   element's own box stays clear, which avoids having to re-stack the highlighted cards. */
.help-tour-spotlight {
    position: fixed;
    top: 0;
    left: 0;
    width: 0;
    height: 0;
    border-radius: var(--card-radius);
    box-shadow: 0 0 0 9999px rgba(0, 46, 77, .55);
    /* Block interaction with the dimmed page so the tour is the only thing clickable. */
    pointer-events: auto;
    transition: top .3s ease-out, left .3s ease-out, width .3s ease-out, height .3s ease-out;
}

    /* Centered steps have no target, so there is nothing to cut out - just dim everything. */
    .help-tour-spotlight.no-target {
        top: 50%;
        left: 50%;
        border-radius: 0;
    }

/* Thin ring drawn just outside the cut-out to make the highlighted edge readable against
   light cards. Separate element so it can animate independently of the shadow. */
.help-tour-ring {
    position: fixed;
    border: 2px solid var(--color-8);
    border-radius: var(--card-radius);
    pointer-events: none;
    transition: top .3s ease-out, left .3s ease-out, width .3s ease-out, height .3s ease-out;
}

    .help-tour-spotlight.no-target ~ .help-tour-ring {
        display: none;
    }

.help-tour-tip {
    position: fixed;
    width: 22rem;
    max-width: calc(100vw - 2rem);
    background: var(--modal-background-color);
    color: var(--text-color);
    border-radius: var(--card-radius);
    box-shadow: var(--shadow-very-far);
    padding: 1.25rem;
    pointer-events: auto;
    transition: top .3s ease-out, left .3s ease-out;
}

.help-tour-tip-head {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin: 0 0 .5rem;
}

    .help-tour-tip-head i {
        color: var(--color-2);
        font-size: 1.1rem;
    }

    .help-tour-tip-head h2 {
        margin: 0;
        font: 600 1.05rem/1.3 var(--font-sans-serif);
        color: var(--color-1);
    }

.help-tour-tip-body {
    margin: 0;
    font-size: .9rem;
    line-height: 1.5;
    color: var(--sub-text-color);
}

.help-tour-tip-foot {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: 1.25rem;
}

.help-tour-count {
    font-size: .8rem;
    color: var(--color-gray);
    white-space: nowrap;
}

.help-tour-actions {
    display: flex;
    align-items: center;
    gap: .5rem;
}

    /* Tour buttons are deliberately smaller than the site default so the tooltip stays compact. */
    .help-tour-actions .button {
        padding: .6rem 1.1rem;
        font-size: .8rem;
        line-height: .8rem;
    }

.help-tour-close {
    position: absolute;
    top: .6rem;
    right: .6rem;
    width: 1.75rem;
    height: 1.75rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--color-gray);
    cursor: pointer;
    text-decoration: none;
    font-size: .9rem;
}

    .help-tour-close:hover {
        background: var(--color-lighter);
        color: var(--color-darkest);
    }

/* Small pointer toward the highlighted element. Hidden on centered steps. */
.help-tour-arrow {
    position: absolute;
    width: 0;
    height: 0;
    border: .55rem solid transparent;
}

    .help-tour-arrow.top {
        bottom: -1.1rem;
        border-top-color: var(--modal-background-color);
    }

    .help-tour-arrow.bottom {
        top: -1.1rem;
        border-bottom-color: var(--modal-background-color);
    }

    .help-tour-arrow.left {
        right: -1.1rem;
        border-left-color: var(--modal-background-color);
    }

    .help-tour-arrow.right {
        left: -1.1rem;
        border-right-color: var(--modal-background-color);
    }

    .help-tour-arrow.none {
        display: none;
    }

/* Replay trigger that sits in a page heading. */
.help-tour-trigger {
    display: inline-flex;
    align-items: center;
    gap: .35rem;
    cursor: pointer;
    color: var(--color-2);
    font-size: .85rem;
    text-decoration: none;
}

    .help-tour-trigger:hover {
        opacity: .8;
    }

@media only screen and (max-width: 767px) {
    .help-tour-tip {
        width: calc(100vw - 2rem);
    }

    /* Anchoring beside a target is not workable at phone widths, so the script pins the
       tooltip to the bottom of the screen and the arrow is dropped. */
    .help-tour-arrow {
        display: none;
    }
}

@media (prefers-reduced-motion: reduce) {
    .help-tour,
    .help-tour-spotlight,
    .help-tour-ring,
    .help-tour-tip {
        transition: none;
    }
}
