/* ── Guided tours (issue #58) ─────────────────────────────────────────────────
   Every colour here is a --lf-theme-* variable, so a tour repaints with the active
   theme — including a user's own palette — without a line of JavaScript. The only
   literal colour is the backdrop's black, which is an opacity over whatever is
   underneath rather than a colour of its own.

   The z-index is assigned at runtime by core/overlayStack.ts (the root element gets
   an inline style): a tour can point inside a detail modal or a picker, and a fixed
   value here would put it under exactly the overlays it is explaining. */

.lf-wt-root {
    position: fixed;
    inset: 0;
    /* Nothing of the tour swallows a click but the bubble (issue #211): the tour is not modal.
       A click on the application outside the bubble reaches the application AND pauses the tour
       (walkthrough.ts, pointerdown), which waits in the footer to be resumed or ended. */
    pointer-events: none;
}

/* ── The backdrop: four rectangles around the hole ───────────────────────── */
.lf-wt-shade {
    position: fixed;
    background: rgba(0, 0, 0, .55);
    pointer-events: none;
    transition: opacity .12s ease-out;
}

/* Sits exactly over the hole while the step is only describing the control. It used to stop
   the click; now a click there pauses the tour like any other click outside the bubble, so it
   lets it through. Kept as an element because the geometry code still lays it out. */
.lf-wt-block {
    position: fixed;
    pointer-events: none;
    background: transparent;
}

/* ── The ring around the highlighted element ─────────────────────────────── */
.lf-wt-halo {
    position: fixed;
    pointer-events: none;
    border-radius: 6px;
    box-shadow:
        0 0 0 2px var(--lf-theme-accent),
        0 0 0 6px rgba(var(--lf-theme-accent-rgb), .28);
    animation: lf-wt-pulse 1.8s ease-in-out infinite;
}

@keyframes lf-wt-pulse {
    0%, 100% { box-shadow: 0 0 0 2px var(--lf-theme-accent), 0 0 0 6px rgba(var(--lf-theme-accent-rgb), .28); }
    50%      { box-shadow: 0 0 0 2px var(--lf-theme-accent), 0 0 0 10px rgba(var(--lf-theme-accent-rgb), .12); }
}

/* ── The bubble ──────────────────────────────────────────────────────────── */
.lf-wt-bubble {
    position: fixed;
    pointer-events: auto;
    box-sizing: border-box;
    width: min(28rem, calc(100vw - 2rem));
    padding: 1rem 1.1rem .85rem;
    border: 1px solid var(--lf-theme-panel-border);
    border-radius: 8px;
    background: var(--lf-theme-panel-bg);
    color: var(--lf-theme-panel-fg);
    font-family: var(--lf-theme-font-family);
    box-shadow: 0 12px 32px rgba(0, 0, 0, .35);
}

.lf-wt-bubble:focus {
    outline: 2px solid var(--lf-theme-accent);
    outline-offset: 2px;
}

.lf-wt-title {
    margin: 0 0 .4rem;
    font-size: 1.05rem;
    font-weight: 600;
    line-height: 1.3;
}

.lf-wt-body {
    margin: 0;
    font-size: .9rem;
    line-height: 1.5;
}

.lf-wt-image {
    display: block;
    width: 100%;
    height: auto;
    margin: 0 0 .6rem;
    border: 1px solid var(--lf-theme-panel-border);
    border-radius: 4px;
}

.lf-wt-hint {
    margin: .6rem 0 0;
    font-size: .82rem;
    font-weight: 600;
    color: var(--lf-theme-accent);
}

.lf-wt-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: .75rem;
    margin-top: .9rem;
    padding-top: .65rem;
    border-top: 1px solid var(--lf-theme-panel-border);
}

.lf-wt-progress {
    font-size: .78rem;
    color: var(--lf-theme-field-disabled-fg);
    white-space: nowrap;
}

/* The chapter line of a playlist ("Chapter 2 of 10: The grid"), beside the step count. Hidden
   in a plain tour. */
.lf-wt-chapter {
    font-size: .78rem;
    color: var(--lf-theme-field-disabled-fg);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

.lf-wt-actions {
    display: flex;
    align-items: center;
    gap: .4rem;
}

.lf-wt-btn {
    padding: .25rem .7rem;
    border: 1px solid var(--lf-theme-panel-border);
    border-radius: 4px;
    background: var(--lf-theme-toolbar-bg);
    color: var(--lf-theme-toolbar-fg);
    font: inherit;
    font-size: .85rem;
    line-height: 1.5;
    cursor: pointer;
}

.lf-wt-btn:hover { border-color: var(--lf-theme-accent); }

.lf-wt-btn:focus-visible {
    outline: 2px solid var(--lf-theme-accent);
    outline-offset: 1px;
}

.lf-wt-btn-primary {
    border-color: var(--lf-theme-accent);
    background: var(--lf-theme-accent);
    color: #fff;
}

/* "Leave the tour" is an exit, not an action: quiet enough not to compete with Next,
   present enough to be found without hunting for the Esc key. */
.lf-wt-btn-quiet {
    border-color: transparent;
    background: transparent;
    color: var(--lf-theme-field-disabled-fg);
}

.lf-wt-btn-quiet:hover {
    border-color: var(--lf-theme-panel-border);
    color: var(--lf-theme-panel-fg);
}

/* ── The arrow ───────────────────────────────────────────────────────────── */
.lf-wt-arrow {
    position: absolute;
    width: 12px;
    height: 12px;
    background: var(--lf-theme-panel-bg);
    border: 1px solid var(--lf-theme-panel-border);
    transform: rotate(45deg);
}

.lf-wt-bubble[data-side="center"] .lf-wt-arrow { display: none; }

.lf-wt-bubble[data-side="bottom"] .lf-wt-arrow {
    top: -7px;
    margin-left: -6px;
    border-right: 0;
    border-bottom: 0;
}

.lf-wt-bubble[data-side="top"] .lf-wt-arrow {
    bottom: -7px;
    margin-left: -6px;
    border-left: 0;
    border-top: 0;
}

.lf-wt-bubble[data-side="right"] .lf-wt-arrow {
    left: -7px;
    margin-top: -6px;
    border-right: 0;
    border-top: 0;
}

.lf-wt-bubble[data-side="left"] .lf-wt-arrow {
    right: -7px;
    margin-top: -6px;
    border-left: 0;
    border-bottom: 0;
}

/* ── Reduced motion ──────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
    .lf-wt-halo { animation: none; }
    .lf-wt-shade { transition: none; }
}

/* ── The catalogue page (/Walkthrough) ───────────────────────────────────── */
.lf-wt-page-list {
    display: grid;
    gap: .75rem;
    margin: 0;
    padding: 0;
    list-style: none;
}

.lf-wt-card {
    display: flex;
    align-items: flex-start;
    gap: .9rem;
    padding: .9rem 1rem;
    border: 1px solid var(--lf-theme-panel-border);
    border-radius: 6px;
    background: var(--lf-theme-panel-bg);
    color: var(--lf-theme-panel-fg);
}

.lf-wt-card-icon {
    flex: 0 0 auto;
    font-size: 1.4rem;
    line-height: 1.6;
    color: var(--lf-theme-accent);
}

.lf-wt-card-main { flex: 1 1 auto; min-width: 0; }

.lf-wt-card-title {
    margin: 0 0 .2rem;
    font-size: 1rem;
    font-weight: 600;
}

.lf-wt-card-desc {
    margin: 0;
    font-size: .875rem;
    line-height: 1.45;
}

.lf-wt-card-meta {
    display: flex;
    align-items: center;
    gap: .5rem;
    margin-top: .45rem;
    font-size: .78rem;
    color: var(--lf-theme-field-disabled-fg);
}

.lf-wt-card-state[data-state="completed"] { color: var(--lf-theme-recordstate-read); }
.lf-wt-card-state[data-state="dismissed"] { color: var(--lf-theme-recordstate-modified); }

.lf-wt-card-actions {
    flex: 0 0 auto;
    display: flex;
    gap: .4rem;
}

/* ── The automatic demo (issue #58 §10) ───────────────────────────────────────
   A cursor that travels to the thing a step is about, a ripple where it clicks, and a
   small bar to pause, step, change the pace or leave. None of it takes a click: the
   cursor and the ripple are pictures; only the bar answers the pointer. z-index comes
   from core/overlayStack.ts at runtime, like the tour itself. */

.lf-demo-cursor {
    position: fixed;
    left: 0;
    top: 0;
    z-index: 1;
    margin: -4px 0 0 -4px;
    font-size: 1.4rem;
    color: #fff;
    text-shadow: 0 0 2px #000, 0 0 6px rgba(0, 0, 0, .6);
    pointer-events: none;
    transition: transform .6s cubic-bezier(.22, .61, .36, 1);
}

.lf-demo-cursor[hidden] { display: none; }

/* prefers-reduced-motion: a jump from one anchor to the next, not a journey. */
.lf-demo-cursor.lf-demo-cursor-jump { transition: none; }
@media (prefers-reduced-motion: reduce) {
    .lf-demo-cursor { transition: none; }
}

.lf-demo-ripple {
    position: fixed;
    width: 14px;
    height: 14px;
    margin: -7px 0 0 -7px;
    border-radius: 50%;
    border: 2px solid var(--lf-theme-accent);
    pointer-events: none;
    animation: lf-demo-ripple .65s ease-out forwards;
}

@keyframes lf-demo-ripple {
    from { transform: scale(1); opacity: .9; }
    to   { transform: scale(4.5); opacity: 0; }
}

@media (prefers-reduced-motion: reduce) {
    .lf-demo-ripple { animation: none; opacity: 0; }
}

.lf-demo-bar {
    position: fixed;
    left: 50%;
    bottom: 1rem;
    transform: translateX(-50%);
    display: flex;
    align-items: center;
    gap: .35rem;
    padding: .3rem .5rem .55rem;
    border: 1px solid var(--lf-theme-panel-border);
    border-radius: 999px;
    background: var(--lf-theme-panel-bg);
    color: var(--lf-theme-panel-fg);
    box-shadow: 0 6px 24px rgba(0, 0, 0, .35);
    pointer-events: auto;
    font-size: .8rem;
}

.lf-demo-btn {
    width: 2rem;
    height: 2rem;
    border: 0;
    border-radius: 50%;
    background: transparent;
    color: inherit;
    cursor: pointer;
}

.lf-demo-btn:hover { background: rgba(var(--lf-theme-accent-rgb), .18); }
.lf-demo-btn:focus-visible { outline: 2px solid var(--lf-theme-accent); outline-offset: 1px; }

.lf-demo-speed {
    border: 1px solid var(--lf-theme-panel-border);
    border-radius: 6px;
    background: transparent;
    color: inherit;
    font-size: .78rem;
    padding: .1rem .2rem;
}

.lf-demo-progress { padding: 0 .35rem; white-space: nowrap; }

.lf-demo-track {
    position: absolute;
    left: 1rem;
    right: 1rem;
    bottom: .22rem;
    height: 3px;
    border-radius: 3px;
    background: rgba(var(--lf-theme-accent-rgb), .2);
    overflow: hidden;
}

.lf-demo-fill {
    height: 100%;
    width: 0;
    background: var(--lf-theme-accent);
    transition: width .3s ease-out;
}

.lf-demo-bar-paused .lf-demo-fill { opacity: .45; }
