/* ══════════════════════════════════════════════════════════════════════════════
   ShiftHR: Onboarding
   ──────────────────────────────────────────────────────────────────────────────
   Guided onboarding overlay, spotlight, step cards, help icons, popovers,
   page banners, nav badges, welcome splash, onboarding progress indicator,
   onboardable widget wrapper, and all onboarding animations.
   ══════════════════════════════════════════════════════════════════════════════ */

/* ── The tour on the kit (#1046) ───────────────────────────────────────────────
   The scrim is the kit's Scrim, the lit widget wears the kit's .shui-spotlit (above the scrim,
   shown and not operated; the widget is also `inert`, OnboardableWidget) and the step card
   docks in the kit's .shui-scrim-dock. What stays here is the page's own: the dimmed widgets
   and the step card's interior. */

/* ── Widget States ─────────────────────────────────────────────────────────── */
/* Dim the widgets not in the spotlight. Previously used `pointer-events: none`, which
   hard-blocked every click, legitimate ones included, when tour state got stuck. The dimmed
   widgets are `inert` during a tour instead (#884). */
.onboarding-disabled {
    opacity: 0.4;
    filter: grayscale(40%);
    transition: opacity .3s, filter .3s;
}

/* ── Step Card ─────────────────────────────────────────────────────────────── */
/* The surface is the kit Card (raised) in the kit's ScrimDock, which takes focus and draws its ring. */

.onboarding-step-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
}

.onboarding-step-icon {
    font-size: 1.4rem;
    width: 36px;
    height: 36px;
    border-radius: var(--radius-full);
    background: var(--color-brand-light);
    color: var(--color-brand);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.onboarding-step-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--color-neutral-900);
}

.onboarding-step-content {
    font-size: .875rem;
    color: var(--color-neutral-500);
    line-height: 1.6;
    margin-bottom: 16px;
}

/* What a card offers beside its words (the example contract, OB2): above the footer. */
.onboarding-step-aside {
    margin-bottom: 16px;
}

/* The example contract's dialog body: the framing line above the read view. */
.example-contract {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* The counter and the controls (OB2, 2 November 2026): both rows wrap, so a long onward label ("Next: Values &
   Behaviours") never breaks the counter over three lines or pushes the control past the card's edge. The counter
   stays on one line; the controls drop to their own right-aligned row when short of room, the onward control last. */
.onboarding-step-footer {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-2);
}

.onboarding-step-counter {
    font-size: .75rem;
    color: var(--color-neutral-500);
    font-weight: 500;
    white-space: nowrap;
}

/* The step card's buttons are the kit's (btn-ghost for the skip, btn-primary, btn-outline). */
.onboarding-step-actions {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: flex-end;
    gap: var(--space-2);
    margin-left: auto;
}

/* The skip's confirmation body (the kit Modal). */
.onboarding-skip-body {
    margin: 0 0 var(--space-3);
    color: var(--color-neutral-900);
    line-height: 1.55;
}

/* ── Help affordance ───────────────────────────────────────────────────────────
   The legacy .help-icon / .help-popover system (defects #386, #420: viewport
   clamping + stacking-context wars) is retired. Help is now the ShiftHR.UI kit
   Help component (.shui-help, hover/focus popover, z-index 1500, bottom-sheet on
   small screens) rendered by OnboardableWidget; only the widget-corner pin below
   remains Web-side. */

/* ── Onboarding Progress Indicator (sidebar) ─────────────────────────────────
   Sidebar tokens, not white-alpha (#889): the white-alpha values date from the
   retired always-dark rail; on today's theme-following light rail they were
   invisible in light mode. The block holds the counter and the quiet skip under it. */
.onboarding-progress-block {
    border-top: 1px solid var(--sidebar-border);
}

.onboarding-progress {
    padding: 10px 12px 4px;
}

.onboarding-progress-skip {
    margin: 0 4px 6px;
}

.onboarding-progress-label {
    font-size: var(--text-xs);
    font-weight: 600;
    color: var(--sidebar-text-muted);
    text-transform: uppercase;
    letter-spacing: .05em;
    margin-bottom: 6px;
}

.onboarding-progress-bar {
    height: 4px;
    border-radius: 2px;
    background: var(--sidebar-border);
    overflow: hidden;
}

.onboarding-progress-fill {
    height: 100%;
    border-radius: 2px;
    background: var(--color-brand);
    transition: width .3s ease;
}

.onboarding-progress-detail {
    font-size: var(--text-xs);
    color: var(--sidebar-text-subtle);
    margin-top: 4px;
}

/* #856 F3: the indicator doubles as the link into the active stage's page. */
a.onboarding-progress--link {
    display: block;
    text-decoration: none;
    color: inherit;
}

a.onboarding-progress--link:hover .onboarding-progress-label,
a.onboarding-progress--link:focus-visible .onboarding-progress-label {
    color: var(--sidebar-text);
}

/* ── Stage-0 pre-engagement focus overlay (#856 R2, owner-ruled 2026-08-26) ──
   Supersedes the DP1(a) kickoff card. The welcome-splash focus treatment:
   everything behind the overlay is dimmed AND non-interactive: the scrim
   covers the viewport and intercepts every pointer event (zero-JS; keyboard
   reach into the background is closed by the panel being the only content
   above the scrim that carries interactive elements the member needs). The
   panel holds the sole ways out: the CTA into /contract plus the quiet
   Settings / Sign out links (their routes are exempt). No dismiss exists. */
/* The scrim and the panel are the kit Modal's overlay and dialog; the content's layout is here. */
.contract-engagement { text-align: center; }

.contract-engagement-seal {
    font-size: 1.6rem;
    color: var(--color-culture);
    margin-bottom: 8px;
}

.contract-engagement-lead {
    margin: 0 0 20px;
    font-size: 0.95rem;
    line-height: 1.55;
    color: var(--color-neutral-900);
    text-align: left;
}

.contract-engagement-lead q {
    display: block;
    margin: var(--space-2) 0;
    font-style: italic;
}

a.contract-engagement-cta { text-decoration: none; display: inline-block; }

.contract-engagement-note {
    margin: 12px 0 0;
    font-size: 0.82rem;
    color: var(--color-neutral-600);
}

.contract-engagement-quiet {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-top: 18px;
    padding-top: 14px;
    border-top: 1px solid var(--color-border-light);
    font-size: 0.82rem;
}

.contract-engagement-quiet a { color: var(--color-neutral-500); }
.contract-engagement-quiet a:hover { color: var(--color-neutral-900); }
/* Sign out is a form's button since #1028: it reads as the link beside it. */
.contract-engagement-quiet-act {
    font: inherit; color: var(--color-neutral-500); background: none; border: none; padding: 0;
    cursor: pointer; text-decoration: underline;
}
.contract-engagement-quiet-act:hover { color: var(--color-neutral-900); }


/* ── Onboardable Widget Wrapper ────────────────────────────────────────────── */
.onboardable-widget {
    position: relative;
    transition: opacity .3s, filter .3s;
    overflow: visible;
}

/* The kit Help dot sits in a gutter the widget reserves at its right, top-aligned, beside the
   content and never over it (#1046: at -10px it covered the first element of Reviews' tab panels,
   the first review card and the Build a cycle button). NOTE: this wrapper is position:absolute +
   z-index, so it forms its OWN stacking context: the kit popover's z-index:1500 is scoped INSIDE
   here, NOT page-wide, so an open popover must lift this wrapper via the :has rule below. */
.onboardable-widget:has(> .onboardable-widget-help) {
    padding-right: var(--space-6);
}

.onboardable-widget-help {
    position: absolute;
    top: 0;
    right: 0;
    z-index: 10;
}

/* When this marker's Help popover is open, lift the wrapper above sibling help
   markers (also position:absolute z-index:10) and page cards: otherwise a later-
   painted sibling "?" covers this open popover, because .shui-help-pop's z-index:1500
   is trapped inside THIS wrapper's stacking context. Mirrors the #501 action-menu
   lift. Defect #722 (2026-06-23). */
.onboardable-widget-help:has(.shui-help-pop.is-open) {
    z-index: 1500;
}

/* A widget's open row menu is lifted by the kit: the DataGrid holding it rises above later
   sibling widgets while it is open (#501's lift, the kit's since #1040). */

/* ── A menu row's count (the roster's unanswered declines) ─────────────────── */
.sidebar-nav a {
    display: flex;
    align-items: center;
}

.nav-count-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 6px;
    border-radius: var(--radius-pill);
    background: var(--color-brand);
    color: var(--color-on-brand);
    font-size: var(--text-xs);
    font-weight: 700;
    margin-left: auto;
}

/* ── A page's tour on offer (the owner, 10 November 2026) ─────────────────────
   The tour icon beside the page's row, a link of its own that starts its tour, and the one mark of
   a tour: no pill, no dot, no tint. The row keeps its width, the icon its small square. */
.nav-row { display: flex; align-items: center; gap: 2px; }
.nav-row > a:not(.nav-tour) { flex: 1 1 auto; min-width: 0; }
.sidebar-nav a.nav-tour, .sidebar-contract-row a.nav-tour {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    padding: 0;
    border-radius: var(--radius-sm);
    color: var(--sidebar-text-muted);
    font-size: var(--text-base);
}
.sidebar-nav a.nav-tour:hover, .sidebar-nav a.nav-tour:focus-visible,
.sidebar-contract-row a.nav-tour:hover, .sidebar-contract-row a.nav-tour:focus-visible { background: var(--sidebar-hover-bg); color: var(--sidebar-text); }
.nav-tour-icon { display: inline-flex; line-height: 1; }
.sidebar-contract-row { display: flex; align-items: center; gap: 2px; }
.sidebar-contract-row > .sidebar-contract-pin { flex: 1 1 auto; min-width: 0; }

/* The sidebar's block: the page on offer under the counter, its tour and the skip. */
.onboarding-progress-offer { padding: 2px 12px 6px; display: flex; flex-direction: column; gap: 4px; }

/* ── Welcome Splash (first-time onboarding) ────────────────────────────────── */
/* The splash is the kit Modal; this is its body's layout. */
.onboarding-welcome { text-align: center; }

/* The tour icon inside the welcome's words, at the words' own height. */
.onboarding-welcome-sign { display: inline-flex; vertical-align: middle; color: var(--color-brand); }

.onboarding-welcome-body {
    font-size: .9rem;
    color: var(--color-neutral-500);
    line-height: 1.6;
    margin-bottom: 8px;
}

.onboarding-welcome-detail {
    font-size: .82rem;
    color: var(--color-neutral-500);
    margin-bottom: 24px;
}

/* The skip dialog's extra act sits far left of Cancel and the act (PF-8 (a), as FormDialog's FooterStart). */
.onboarding-skip-page { margin-right: auto; }
