/*
 * Onboarding tour overlay (ARC-202) — drawn from JS by tour-engine.js, so the
 * styles live in a global stylesheet (not a scoped .razor.css). Every colour
 * references a --pg-* token, so the overlay tracks the active theme
 * (Noon/Midnight/Dawn/Dusk) automatically, including a theme switch mid-tour.
 *
 * Animation is restricted to transform/opacity per the design rules — the
 * spotlight snaps between steps rather than tweening top/left/width/height.
 */

:root {
    --tour-scrim: rgba(20, 20, 28, 0.55);
    /* Above app chrome + MudBlazor (1300), but below the refresh-required
       modal (2147483600) so a mid-tour deploy prompt still wins. */
    --tour-z: 2147483000;
}

/* Full-screen layer that blocks interaction with the page beneath the tour. */
.tour-overlay {
    position: fixed;
    inset: 0;
    z-index: var(--tour-z);
    pointer-events: auto;
    /* Transparent while a spotlight is shown (the spotlight's box-shadow is the
       scrim); opaque scrim for centred steps that have no spotlight target. */
    background: transparent;
    animation: tour-fade-in var(--duration-normal, 0.2s) var(--ease-out, ease);
}

.tour-overlay.is-centered {
    background: var(--tour-scrim);
    backdrop-filter: blur(2px);
}

/* The cut-out ring around the spotlighted element. The giant box-shadow dims
   everything outside the hole; the inner rings draw the accent halo. */
.tour-spotlight {
    position: fixed;
    z-index: calc(var(--tour-z) + 1);
    pointer-events: none;
    border-radius: var(--radius-md, 8px);
    box-shadow: 0 0 0 9999px var(--tour-scrim),
                0 0 0 2px var(--pg-accent, #924E8C),
                0 0 0 6px var(--pg-accent-focus-ring-strong, rgba(146, 78, 140, 0.25));
    opacity: 0;
    animation: tour-fade-in var(--duration-normal, 0.2s) var(--ease-out, ease) forwards;
}

/* The tooltip / step card. */
.tour-card {
    position: fixed;
    z-index: calc(var(--tour-z) + 2);
    pointer-events: auto;
    width: 340px;
    max-width: calc(100vw - 32px);
    box-sizing: border-box;
    background: var(--pg-surface-raised, #fff);
    color: var(--pg-text, #1a1a1f);
    border: 1px solid var(--pg-border, rgba(0, 0, 0, 0.1));
    border-radius: var(--radius-lg, 12px);
    box-shadow: 0 16px 48px rgba(0, 0, 0, 0.3);
    padding: 20px;
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    -webkit-font-smoothing: antialiased;
    animation: tour-rise var(--duration-normal, 0.2s) var(--ease-out, ease);
}

.tour-card.is-centered {
    left: 50% !important;
    top: 50% !important;
    transform: translate(-50%, -50%);
    animation: tour-rise-centered var(--duration-normal, 0.2s) var(--ease-out, ease);
}

.tour-card-title {
    margin: 0 0 8px;
    font-size: 16px;
    font-weight: 600;
    line-height: 1.35;
    color: var(--pg-text, #1a1a1f);
}

.tour-card-body {
    margin: 0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.55;
    color: var(--pg-text-secondary, rgba(0, 0, 0, 0.6));
}

/* Optional CTA (e.g. demo Upgrade, docs link). */
.tour-card-cta {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    margin-top: 14px;
    text-decoration: none;
}

.tour-card-cta i {
    font-size: 14px;
}

/* Illustrative screenshot shown when a step's live anchor isn't on the page
   (e.g. the block sheet when no block is selected). */
.tour-card-image {
    display: block;
    width: 100%;
    margin-top: 14px;
    border: 1px solid var(--pg-border, rgba(0, 0, 0, 0.1));
    border-radius: var(--radius-md, 8px);
}

/* Progress row: dots + "N of 8". */
.tour-card-progress {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-top: 18px;
}

.tour-card-dots {
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.tour-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--pg-border-hover, rgba(0, 0, 0, 0.2));
    transition: transform var(--duration-fast, 0.12s) var(--ease-out, ease),
                opacity var(--duration-fast, 0.12s) var(--ease-out, ease);
}

.tour-dot.is-active {
    background: var(--pg-accent, #924E8C);
    transform: scale(1.35);
}

.tour-card-count {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--pg-text-tertiary, rgba(0, 0, 0, 0.38));
    white-space: nowrap;
}

/* Footer: Skip on the left, Back/Next on the right. */
.tour-card-actions {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-top: 14px;
}

.tour-card-actions-right {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}

/* Buttons reuse the design system's .pg-btn family; these tour-scoped rules
   only add focus-visible affordances the JS-built markup needs. */
.tour-card .pg-btn:focus-visible {
    outline: 2px solid var(--pg-accent, #924E8C);
    outline-offset: 2px;
}

.tour-card-cta:focus-visible {
    outline: 2px solid var(--pg-accent, #924E8C);
    outline-offset: 2px;
    border-radius: var(--radius-sm, 4px);
}

@keyframes tour-fade-in {
    from { opacity: 0; }
    to   { opacity: 1; }
}

@keyframes tour-rise {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

@keyframes tour-rise-centered {
    from { opacity: 0; transform: translate(-50%, calc(-50% + 8px)); }
    to   { opacity: 1; transform: translate(-50%, -50%); }
}

/* Respect reduced-motion: keep the fade, drop the movement. */
@media (prefers-reduced-motion: reduce) {
    .tour-overlay,
    .tour-spotlight,
    .tour-card,
    .tour-card.is-centered {
        animation: tour-fade-in var(--duration-fast, 0.12s) var(--ease-out, ease);
    }
    .tour-dot { transition: none; }
}
