/* Onboarding tour (js/tour.js) — index, watchlist, and analytics.
   Kept out of styles.css on purpose: the tour ships on only 3 pages,
   so its styles shouldn't bump the ?v= of the 7 styles.css
   consumers. Uses the design tokens from styles.css, so light/dark
   theming follows automatically. */

.tour-root {
    position: fixed;
    inset: 0;
    z-index: 4000; /* above the detail slide-over (1000) and alerts panel */
}

/* The moving cutout. Its oversized box-shadow is what dims the rest of
   the page — one element, no canvas/SVG. It ignores pointer events so
   the .tour-root backdrop is what actually blocks the page. */
.tour-spotlight {
    position: fixed;
    border-radius: 10px;
    box-shadow: 0 0 0 200vmax rgba(15, 23, 42, 0.62);
    transition: top 0.25s ease, left 0.25s ease,
                width 0.25s ease, height 0.25s ease;
    pointer-events: none;
}

/* Click-through steps: the spotlight pulses gently to say "this is the
   thing to click"… */
.tour-spotlight--pulse {
    animation: tour-pulse 1.6s ease-in-out infinite;
}

@keyframes tour-pulse {
    0%, 100% { outline: 3px solid rgba(13, 148, 136, 0.9); }
    50%      { outline: 3px solid rgba(13, 148, 136, 0.25); }
}

@media (prefers-reduced-motion: reduce) {
    .tour-spotlight--pulse {
        animation: none;
        outline: 3px solid rgba(13, 148, 136, 0.9);
    }
}

/* …and an invisible button sits exactly over the cutout, forwarding the
   user's click into a real page navigation (js/tour.js advance()). */
.tour-hole {
    position: fixed;
    background: transparent;
    border: none;
    border-radius: 10px;
    padding: 0;
    cursor: pointer;
}

.tour-hole:focus-visible {
    outline: 3px solid var(--color-primary, #0d9488);
    outline-offset: 2px;
}

.tour-card {
    position: fixed;
    width: min(380px, calc(100vw - 24px));
    background: var(--color-bg-secondary, #fff);
    color: var(--color-text, #111827);
    border: 1px solid var(--color-border, #e5e7eb);
    border-radius: var(--border-radius-lg, 0.75rem);
    box-shadow: var(--shadow-lg, 0 8px 24px rgba(0, 0, 0, 0.25));
    padding: 16px 18px;
}

/* Centered modal variant (welcome / finish cards). */
.tour-card--center {
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: min(420px, calc(100vw - 24px));
}

.tour-progress {
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: 600;
    color: var(--color-text-muted, #6b7280);
    margin-bottom: 4px;
}

.tour-title {
    margin: 0 0 6px;
    font-size: var(--font-size-lg, 1.125rem);
    line-height: 1.3;
}

.tour-body {
    margin: 0 0 14px;
    font-size: var(--font-size-sm, 0.875rem);
    line-height: 1.55;
    color: var(--color-text-secondary, #4b5563);
}

/* "Click the highlighted button to keep going." on click-through steps. */
.tour-hint {
    margin: 0 0 14px;
    font-size: var(--font-size-xs, 0.75rem);
    font-weight: 600;
    color: var(--color-primary, #0d9488);
}

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

.tour-actions-spacer {
    flex: 1;
}

.tour-btn {
    font: inherit;
    font-size: var(--font-size-sm, 0.875rem);
    font-weight: 600;
    padding: 7px 14px;
    border-radius: var(--border-radius-md, 0.5rem);
    border: 1px solid var(--color-border-dark, #d1d5db);
    background: var(--color-bg-tertiary, #f1f5f4);
    color: var(--color-text, #111827);
    cursor: pointer;
}

.tour-btn-next {
    background: var(--color-primary, #0d9488);
    border-color: var(--color-primary, #0d9488);
    color: #fff;
}

.tour-btn-next:hover {
    background: var(--color-primary-dark, #0f766e);
}

.tour-btn-skip {
    background: transparent;
    border-color: transparent;
    color: var(--color-text-muted, #6b7280);
    padding-left: 4px;
}

.tour-btn-skip:hover,
.tour-btn-back:hover {
    color: var(--color-text, #111827);
}

/* The header "?" replay pill shares .rehab-btn styling; just keep it
   compact so it reads as an icon, not a nav item. */
.tour-replay-btn {
    padding: 8px 12px;
    font-weight: 700;
}

/* Phones: the card becomes a bottom sheet so the spotlight stays
   unobstructed on a small screen. */
@media (max-width: 640px) {
    .tour-card--sheet {
        top: auto !important;
        left: 8px !important;
        right: 8px;
        bottom: calc(8px + env(safe-area-inset-bottom, 0px));
        width: auto;
    }
}

@media print {
    .tour-root,
    .tour-replay-btn {
        display: none !important;
    }
}
