/*
  The dashboard's first run and help (app-tour.js): the welcome on the home
  page's ink with its ribbon, the tour with a clip of each screen, the setup
  guide in the top bar, and the explanations pointed at a screen's parts.
  Motion is transform and opacity only; under reduced motion site.css ends
  every transition at once, and the tour shows still pictures instead of clips.
*/

/* ---------- Dialogs ---------- */
.tour-dialog {
  padding: 0; border: 0; border-radius: 16px; overflow: hidden; color: var(--ink); background: var(--app-panel);
  box-shadow: 0 40px 100px -20px rgba(13, 37, 61, 0.45), 0 2px 8px rgba(13, 37, 61, 0.12);
  max-height: calc(100dvh - 32px); opacity: 0; transform: translateY(12px) scale(0.98);
  transition: opacity 0.22s var(--ease-ui), transform 0.32s var(--ease);
}
.tour-dialog.is-open { opacity: 1; transform: none; }
.tour-dialog::backdrop { background: rgba(13, 37, 61, 0.42); opacity: 0; transition: opacity 0.3s var(--ease-ui); }
:root[data-theme="dark"] .tour-dialog::backdrop { background: rgba(0, 0, 0, 0.6); }
.tour-dialog.is-open::backdrop { opacity: 1; }
.tour-x { position: absolute; top: 14px; right: 14px; z-index: 2; width: 34px; height: 34px; display: grid; place-items: center; border: 0; border-radius: 50%; background: transparent; color: inherit; cursor: pointer; }
.tour-x:hover { background: var(--surface-2); }
.tour-x svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; }

/* ---------- The welcome ---------- */
.tour-welcome { width: min(560px, calc(100vw - 32px)); }
.tour-head { position: relative; isolation: isolate; padding: 104px 28px 26px; background: var(--stripe-ink); color: #fff; overflow: hidden; }
.tour-head .tour-x { color: #fff; }
.tour-head .tour-x:hover { background: rgba(255, 255, 255, 0.12); }
.tour-sky { position: absolute; inset: -40px; z-index: -1; }
/* The home page's ribbon, blurred into a slow flame behind the words; a still glow until it draws. */
.tour-sky::before { content: ""; position: absolute; inset: 0; background: radial-gradient(60% 70% at 78% 30%, rgba(234, 34, 97, 0.55), transparent 70%), radial-gradient(50% 60% at 20% 10%, rgba(255, 213, 82, 0.28), transparent 70%); }
.tour-flame { position: absolute; inset: 0; width: 100%; height: 100%; filter: blur(26px); opacity: 0; transition: opacity 1.2s var(--ease-ui); }
.tour-flame.is-drawn { opacity: 0.9; }
.tour-sky::after { content: ""; position: absolute; inset: 0; background: linear-gradient(180deg, rgba(13, 37, 61, 0) 30%, rgba(13, 37, 61, 0.78) 100%); }
.tour-mark { position: absolute; left: 28px; top: 30px; display: grid; gap: 7px; }
.tour-mark span { display: block; height: 11px; border-radius: 6px; transform-origin: left center; }
.tm-claim { width: 46px; background: var(--ruby); }
.tm-source { width: 28px; background: #fff; }
.tour-eyebrow { font-size: 12.5px; font-weight: 500; letter-spacing: 0.08em; text-transform: uppercase; color: var(--yellow); }
.tour-title { margin-top: 8px; font-size: clamp(24px, 1rem + 1.6vw, 30px); font-weight: 300; letter-spacing: -0.02em; line-height: 1.15; color: #fff; }
.tour-body { padding: 22px 28px 26px; display: grid; gap: 10px; color: var(--ink-2); font-size: 15px; }
.tour-quiet { color: var(--mute); font-size: 14px; }
.tour-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
@media (prefers-reduced-motion: no-preference) {
  .tour-welcome.is-open .tm-claim { animation: tour-bar 0.7s var(--ease) 0.15s both; }
  .tour-welcome.is-open .tm-source { animation: tour-bar 0.7s var(--ease) 0.3s both; }
  .tour-welcome.is-open .tour-eyebrow, .tour-welcome.is-open .tour-title { animation: tour-rise 0.6s var(--ease) 0.25s both; }
}
@keyframes tour-bar { from { transform: scaleX(0); } }
@keyframes tour-rise { from { opacity: 0; transform: translateY(10px); } }

/* ---------- The tour ---------- */
.tour-steps { width: min(980px, calc(100vw - 32px)); }
.tour-top { position: relative; padding: 22px 64px 0 28px; }
.tour-bar { display: flex; gap: 6px; }
.tour-bar li { flex: 1; height: 3px; border-radius: 3px; background: var(--line-strong); overflow: hidden; }
.tour-bar li::after { content: ""; display: block; height: 100%; background: var(--ruby); transform: scaleX(0); transform-origin: left; transition: transform 0.4s var(--ease); }
.tour-bar li.is-done::after, .tour-bar li.is-now::after { transform: scaleX(1); }
.tour-top .tour-x { top: 8px; right: 12px; }
.tour-stage { padding: 22px 28px 4px; }
@media (prefers-reduced-motion: no-preference) { .tour-stage { animation: tour-rise 0.36s var(--ease) both; } }
.tour-split { display: grid; grid-template-columns: minmax(0, 1.45fr) minmax(0, 1fr); gap: 30px; align-items: center; }
.tour-media { border-radius: 12px; overflow: hidden; border: 1px solid var(--line); background: var(--bg-soft); box-shadow: 0 22px 48px -24px rgba(13, 37, 61, 0.35); }
.tour-chrome { display: flex; align-items: center; gap: 6px; height: 28px; padding: 0 12px; border-bottom: 1px solid var(--line); background: var(--app-panel); }
.tour-chrome i { width: 8px; height: 8px; border-radius: 50%; background: var(--line-strong); }
.tour-chrome span { margin-left: 10px; font-family: var(--mono); font-size: 11px; color: var(--mute); }
.tour-shot { display: block; width: 100%; height: auto; aspect-ratio: 16 / 10; object-fit: cover; object-position: top left; background: var(--bg-soft); }
.tour-copy { display: grid; gap: 10px; align-content: center; }
.tour-count { font-size: 12.5px; font-weight: 500; letter-spacing: 0.06em; text-transform: uppercase; color: var(--accent-ink); }
.tour-step-title { font-size: clamp(24px, 1rem + 1.4vw, 32px); font-weight: 300; letter-spacing: -0.02em; line-height: 1.12; outline: none; }
.tour-lead { font-size: 16.5px; color: var(--ink); }
.tour-text { font-size: 14.5px; color: var(--ink-2); line-height: 1.6; }
.tour-open { justify-self: start; display: inline-flex; align-items: center; gap: 6px; margin-top: 4px; font-size: 14px; font-weight: 500; color: var(--accent-ink); text-decoration: none; }
.tour-open:hover { text-decoration: underline; text-underline-offset: 3px; }
.tour-open svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.tour-plan { display: grid; gap: 10px; max-width: 680px; }
.tour-foot { display: flex; align-items: center; gap: 10px; padding: 20px 28px 24px; }
.tour-skip { margin-right: auto; color: var(--mute); }
.tour-foot .btn[disabled] { opacity: 0.45; pointer-events: none; }

/* ---------- The steps that make it work (the tour's last step and the guide) ---------- */
.guide-list { display: grid; gap: 4px; margin-top: 6px; }
.guide-item { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; align-items: start; gap: 12px; padding: 10px 10px; border-radius: var(--r-md); color: var(--ink); text-decoration: none; }
.guide-item:hover { background: var(--surface-2); }
.guide-check { width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; border: 1.5px solid var(--line-strong); color: var(--mute); font-size: 12px; }
.guide-check b { font-weight: 500; }
.guide-check svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2.2; stroke-linecap: round; stroke-linejoin: round; }
.is-done .guide-check { border-color: transparent; background: var(--ok-bg); color: var(--ok-ink); }
.guide-text { display: grid; gap: 2px; min-width: 0; }
.guide-text b { font-size: 14.5px; font-weight: 500; }
.guide-text small { font-size: 13px; color: var(--mute); line-height: 1.45; }
.is-done .guide-text b { color: var(--mute); text-decoration: line-through; text-decoration-color: var(--line-strong); }
.guide-tag { align-self: center; padding: 2px 8px; border-radius: 999px; border: 1px solid var(--line); font-size: 11.5px; color: var(--mute); }

/* ---------- The guide and help in the top bar (narrower than 1100px) ---------- */
.guide-pop { position: relative; }
.guide-btn { display: inline-flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px 0 10px; border-radius: 999px; border: 1px solid var(--line); background: var(--app-panel); color: var(--ink); font: inherit; font-size: 13.5px; cursor: pointer; }
.guide-btn:hover { border-color: var(--line-strong); }
.guide-btn-text { display: inline-flex; gap: 6px; white-space: nowrap; }
.guide-btn-count { color: var(--mute); }
.guide-ring { width: 20px; height: 20px; flex: none; transform: rotate(-90deg); }
.guide-ring circle { fill: none; stroke-width: 2.6; }
.guide-ring-track { stroke: var(--line-strong); }
.guide-ring-fill { stroke: var(--ruby); stroke-linecap: round; transition: stroke-dasharray 0.6s var(--ease); }
.guide-btn.is-all .guide-ring-fill { stroke: var(--ok-ink); }
.guide-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 55; width: min(400px, calc(100vw - 24px)); padding: 16px 12px 12px;
  border-radius: 14px; border: 1px solid var(--line); background: var(--dd-bg, var(--app-panel)); box-shadow: 0 24px 60px -18px var(--dd-shadow);
  opacity: 0; transform: translateY(-4px); transition: opacity 0.18s var(--ease-ui), transform 0.24s var(--ease);
}
.guide-panel.is-open { opacity: 1; transform: none; }
.guide-head { display: flex; justify-content: space-between; gap: 12px; padding: 0 6px 0 10px; }
.guide-head .tour-x { position: static; margin: -6px -2px 0 0; }
.guide-title { font-size: 17px; font-weight: 500; }
.guide-meter { height: 4px; margin: 12px 10px 6px; border-radius: 4px; background: var(--surface-2); overflow: hidden; }
.guide-meter span { display: block; height: 100%; background: var(--ruby); transform-origin: left; transition: transform 0.6s var(--ease); }
.guide-foot { padding: 8px 10px 2px; border-top: 1px solid var(--line); margin-top: 6px; }
.help-panel { min-width: 240px; }

/* ---------- At the foot of the sidebar (1100px and wider, docked there by app-tour.js) ---------- */
.rail .guide-pop { display: block; }
.rail .guide-btn, .rail .help-btn { display: flex; align-items: center; width: 100%; height: 32px; padding: 0 10px; gap: 10px; justify-content: flex-start; border: 0; border-radius: var(--r-md); background: none; color: var(--side-mute); font: inherit; font-size: 13.5px; transition: background-color 0.15s var(--ease-ui), color 0.15s var(--ease-ui); }
.rail .guide-btn:hover, .rail .help-btn:hover, .rail .guide-btn[aria-expanded="true"], .rail .help-btn[aria-expanded="true"] { background: var(--side-hover); color: var(--side-ink); border: 0; }
.rail .guide-btn-text { flex: 1; justify-content: space-between; }
.rail .guide-btn-count { color: var(--side-mute); }
.rail .guide-btn.is-all .guide-btn-label { color: #7ee2a0; }
.rail .guide-ring { width: 17px; height: 17px; }
.rail .guide-ring-track { stroke: rgba(255, 255, 255, 0.2); }
.rail .help-btn svg { width: 17px; height: 17px; }
.rail .help-label { display: inline; }
.rail .guide-panel, .rail .help-panel { left: calc(100% + 22px); right: auto; top: auto; bottom: -4px; max-height: calc(100dvh - 32px); overflow-y: auto; transform-origin: bottom left; }
.rail .guide-panel { transform: translateX(-6px); }
.rail .guide-panel.is-open { transform: none; }

/* ---------- The explanations of a screen ---------- */
.hint-spot { position: fixed; left: 0; top: 0; z-index: 65; border-radius: 12px; pointer-events: none; box-shadow: 0 0 0 3px rgba(234, 34, 97, 0.55), 0 0 0 9999px rgba(13, 37, 61, 0.3); }
:root[data-theme="dark"] .hint-spot { box-shadow: 0 0 0 3px rgba(255, 107, 154, 0.6), 0 0 0 9999px rgba(0, 0, 0, 0.5); }
.hint-card { position: fixed; left: 0; top: 0; z-index: 66; padding: 16px 16px 12px; border-radius: 12px; border: 1px solid var(--line); background: var(--app-panel); box-shadow: 0 24px 60px -18px rgba(13, 37, 61, 0.4); }
@media (prefers-reduced-motion: no-preference) { .hint-card { animation: tour-fade 0.24s var(--ease-ui) both; } }
@keyframes tour-fade { from { opacity: 0; } }
.hint-count { font-size: 12px; font-weight: 500; color: var(--accent-ink); }
.hint-title { margin-top: 4px; font-size: 15.5px; font-weight: 500; }
.hint-text { margin-top: 4px; font-size: 14px; color: var(--ink-2); line-height: 1.5; }
.hint-actions { display: flex; justify-content: flex-end; align-items: center; gap: 12px; margin-top: 12px; }

/* ---------- Smaller screens ---------- */
@media (max-width: 860px) {
  .tour-split { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .tour-steps .tour-text { font-size: 14px; }
}
@media (max-width: 640px) {
  .tour-dialog { width: 100vw; max-width: 100vw; max-height: 94dvh; margin: auto 0 0; border-radius: 18px 18px 0 0; overflow-y: auto; }
  .tour-head { padding: 92px 20px 22px; }
  .tour-mark { left: 20px; }
  .tour-body, .tour-stage { padding-left: 20px; padding-right: 20px; }
  .tour-top { padding: 18px 60px 0 20px; }
  .tour-foot { padding: 16px 20px 20px; position: sticky; bottom: 0; background: var(--app-panel); border-top: 1px solid var(--line); }
  .tour-actions .btn { flex: 1 1 100%; justify-content: center; }
  .guide-btn { padding: 0 10px; }
  .guide-btn-label { display: none; }
  .guide-panel { position: fixed; left: 12px; right: 12px; top: 64px; width: auto; max-height: calc(100dvh - 80px); overflow-y: auto; }
}
/* On a narrow phone the ring alone says how far the setup is; the count is in its name. */
@media (max-width: 480px) {
  .guide-btn { width: 36px; height: 36px; padding: 0; justify-content: center; }
  .guide-btn-text { display: none; }
}
