/* demo.css — chrome for the public demo at /demo.
 *
 * Three surfaces, all outside the app's own layout so nothing here can shift
 * the real UI the demo is showing off: the prompt-allowance HUD, the "skip
 * ahead" control that shortens a recorded wait, and the closing sign-up card.
 * Everything is themed off the same custom properties as the app (themes.css),
 * so the demo follows whatever palette the visitor lands on.
 */

:root {
	/* Follows the palette like everything else. --on-accent is the per-theme
	   foreground for text sitting ON --accent (themes.css); it exists because no
	   single value clears AA across accents running from pale mint to deep blue. */
	--demo-cta-bg: var(--accent);
	--demo-cta-bg-hover: var(--accent-strong);
	--demo-cta-fg: var(--on-accent);
}

/* ---- UI lock (lockUi() in demo.js) -------------------------------------- */
/* A self-driving step is a stage, not a control surface: a click on a tab, the
   composer or a modal's Close mid-action leaves the UI in a state no recorded
   step describes, and every later card then narrates a screen that isn't there.
   So while the lock is on, the coach card is the only thing that hit-tests —
   every other direct child of <body> (the app shell and its modals) stops
   taking pointer input, and demo.js blocks the keyboard the same way.

   The driver is unaffected: element.click(), .focus() and .value writes never
   hit-test, and the file drops are dispatched at document. */
body.demo-locked > *:not(.coach-overlay):not(.demo-skip) {
	pointer-events: none;
}
/* The mobile FAB re-enables its own menu when open (mobile.css); the lock has
   to win, or a menu left open would stay clickable underneath the card. */
body.demo-locked .pf-fab-menu,
body.demo-locked .pf-fab-opt {
	pointer-events: none;
}
/* A locked surface should not read as clickable while it is being driven. */
body.demo-locked #input,
body.demo-locked #composer button {
	cursor: default;
}

/* ---- prompt allowance HUD ---------------------------------------------- */
/* Sits above app modals (z200) but below the coach overlay (z400), so the
   tour can still spotlight over it. */
.demo-hud {
	position: fixed;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 250;
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 6px 8px 6px 12px;
	border-radius: 999px;
	background: var(--bg-raised);
	border: 1px solid var(--border-strong);
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.35);
	font-size: 12px;
	color: var(--text-dim);
	white-space: nowrap;
}
.demo-hud-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var(--accent);
	animation: mcp-pulse 2.4s ease-in-out infinite;
}
.demo-hud-label {
	font-weight: 600;
	letter-spacing: 0.02em;
	color: var(--text);
}
.demo-hud-count { color: var(--text-muted); }
.demo-hud-count:not(:empty)::before {
	content: "·";
	margin-right: 6px;
	color: var(--text-faint);
}
/* Was var(--bg-deep) as the foreground, which is near-black on dark palettes but
   light grey on light ones — 2.5:1 on PeerForce Light, the demo's own default.
   --on-accent is the token that pairing was missing. */
.demo-hud-cta {
	padding: 4px 10px;
	border-radius: 999px;
	background: var(--demo-cta-bg);
	color: var(--demo-cta-fg);
	font-weight: 600;
	text-decoration: none;
}
.demo-hud-cta:hover { background: var(--demo-cta-bg-hover); }

/* ---- skip-ahead control ------------------------------------------------- */
/* Shares the HUD's slot in the empty middle of the header band. The two never
   coexist -- Skip belongs to the emulated registration, the HUD to the live
   turns after it -- so one position serves both, clear of the composer and of
   wherever the coach card happens to be anchored. Deliberately quiet: the
   recorded waits are the point of the demo, so this is an escape hatch rather
   than an invitation. */
.demo-skip {
	position: fixed;
	top: 12px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 250;
	padding: 6px 12px;
	border-radius: 999px;
	border: 1px solid var(--border-strong);
	background: var(--bg-raised);
	color: var(--text-muted);
	font-size: 11px;
	font-weight: 600;
	cursor: pointer;
	opacity: 0.75;
	transition: opacity 0.15s ease, color 0.15s ease;
}
.demo-skip:hover { opacity: 1; color: var(--text-dim); }
.demo-skip.on {
	color: var(--accent);
	border-color: var(--accent);
	opacity: 1;
	cursor: default;
}

/* ---- closing call to action -------------------------------------------- */
.demo-cta-modal { z-index: 500; }        /* above the coach overlay (z400) */
.demo-cta-modal .ds-modal-card { width: 400px; text-align: center; }
.demo-cta-modal h3 { font-size: 17px; color: var(--text-strong); margin-bottom: 12px; }
.demo-cta-modal p {
	margin: 0 0 10px;
	font-size: 13px;
	line-height: 1.55;
	color: var(--text-muted);
}
.demo-cta-modal .ds-actions { justify-content: center; margin-top: 16px; }
/* Brand accent, not the app's green save colour: this is the one marketing
   call to action in the whole flow, not a form submit. */
.demo-cta-modal .demo-cta-btn {
	display: inline-block;
	padding: 10px 22px;
	border-radius: 8px;
	background: var(--demo-cta-bg);
	color: var(--demo-cta-fg);
	font-size: 13px;
	font-weight: 700;
	text-decoration: none;
}
.demo-cta-modal .demo-cta-btn:hover { background: var(--demo-cta-bg-hover); }

/* ---- demo could not start ---------------------------------------------- */
/* Replaces the whole page when the demo is disabled or this IP has run it too
   often — better than dropping an anonymous visitor onto a login form with no
   explanation. */
.demo-unavailable {
	position: fixed;
	inset: 0;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 24px;
	text-align: center;
	background: var(--bg);
	color: var(--text);
}
.demo-unavailable h1 { margin: 0; font-size: 20px; color: var(--text-strong); }
.demo-unavailable p {
	margin: 0;
	max-width: 34ch;
	font-size: 13px;
	line-height: 1.6;
	color: var(--text-muted);
}
.demo-unavailable .demo-cta {
	margin-top: 8px;
	padding: 8px 18px;
	border-radius: 8px;
	background: var(--demo-cta-bg);
	color: var(--demo-cta-fg);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
}

/* ---- coach card while an auto step is working --------------------------- */
.coach-card.coach-working { cursor: progress; }
.coach-card.coach-working .coach-btn-primary {
	opacity: 0.7;
	cursor: progress;
}

/* ---- mobile ------------------------------------------------------------- */
@media (max-width: 640px) {
	.demo-hud {
		top: auto;
		bottom: 78px;
		font-size: 11px;
		padding: 5px 6px 5px 10px;
	}
	.demo-skip { top: auto; bottom: 78px; font-size: 10px; }
	.demo-cta-modal .ds-modal-card { width: 92vw; }
}

/* ---- modal backdrop while the demo drives ------------------------------- */
/* The app's own modal scrim is 60% black. That is right for normal use, but the
   whole point of the demo is watching the product work: the Explorer filling
   with people, the ETL panel stepping through a file. A heavy scrim hides
   exactly what the visitor is meant to notice, so soften it here only. The
   coach's own dim is already off for self-driving steps (coach.css). */
body.demo-mode .ds-modal,
body.demo-mode .ingest-modal {
	background: rgba(10, 12, 16, 0.3);
}
/* Light palettes need a light veil; black at any opacity reads as grime. */
[data-theme="peerforce-light"] body.demo-mode .ds-modal,
[data-theme="github-light"] body.demo-mode .ds-modal,
[data-theme="solarized-light"] body.demo-mode .ds-modal,
[data-theme="catppuccin-latte"] body.demo-mode .ds-modal,
[data-theme="rose-pine-dawn"] body.demo-mode .ds-modal,
[data-theme="peerforce-light"] body.demo-mode .ingest-modal,
[data-theme="github-light"] body.demo-mode .ingest-modal,
[data-theme="solarized-light"] body.demo-mode .ingest-modal,
[data-theme="catppuccin-latte"] body.demo-mode .ingest-modal,
[data-theme="rose-pine-dawn"] body.demo-mode .ingest-modal {
	background: rgba(120, 128, 145, 0.22);
}

/* ---- starter prompt examples -------------------------------------------- */
/* Shown at handover and reopenable from the HUD. The list scrolls rather than
   the page, so the card stays put on a laptop screen while the prompts — which
   are deliberately long, because that is what a good prompt looks like — remain
   fully readable. */
.demo-examples {
	position: fixed;
	inset: 0;
	z-index: 500;              /* above the coach overlay (z400) */
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	background: rgba(10, 12, 16, 0.55);
}
.demo-examples[hidden] { display: none; }

.demo-examples-card {
	display: flex;
	flex-direction: column;
	width: 560px;
	max-width: 100%;
	max-height: 78vh;
	border-radius: 12px;
	background: var(--card);
	border: 1px solid var(--border-card);
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.4);
	overflow: hidden;
}
.demo-examples-head {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 18px 20px 14px;
	border-bottom: 1px solid var(--border-card);
	background: var(--card-head);
}
.demo-examples-head h3 {
	margin: 0 0 4px;
	font-size: 16px;
	color: var(--text-strong);
}
.demo-examples-head p {
	margin: 0;
	font-size: 12.5px;
	color: var(--text-muted);
}
.demo-examples-close {
	margin-left: auto;
	background: none;
	border: none;
	font-size: 22px;
	line-height: 1;
	color: var(--text-faint);
	cursor: pointer;
	padding: 0 2px;
}
.demo-examples-close:hover { color: var(--text); }

.demo-examples-list {
	overflow-y: auto;          /* the list scrolls, not the page */
	padding: 12px;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.demo-example {
	display: block;
	width: 100%;
	text-align: left;
	padding: 12px 14px;
	border-radius: 10px;
	border: 1px solid var(--border-card);
	background: var(--bg-raised);
	cursor: pointer;
	transition: border-color 0.14s ease, background 0.14s ease, transform 0.08s ease;
}
.demo-example:hover {
	border-color: var(--accent);
	background: rgba(var(--accent-rgb), 0.07);
}
.demo-example:active { transform: translateY(1px); }

.demo-example-tag {
	display: inline-block;
	margin-bottom: 6px;
	padding: 2px 8px;
	border-radius: 999px;
	background: rgba(var(--accent-rgb), 0.14);
	color: var(--accent-soft);
	font-size: 10px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.05em;
}
.demo-example-title {
	display: block;
	margin-bottom: 4px;
	font-size: 14px;
	font-weight: 650;
	color: var(--text-strong);
}
.demo-example-text {
	display: block;
	font-size: 12.5px;
	line-height: 1.55;
	color: var(--text-muted);
}

.demo-hud-examples {
	padding: 4px 10px;
	border-radius: 999px;
	border: 1px solid var(--border-strong);
	background: none;
	color: var(--text-dim);
	font-size: 12px;
	font-weight: 600;
	cursor: pointer;
}
.demo-hud-examples:hover { border-color: var(--accent); color: var(--text-strong); }

@media (max-width: 640px) {
	.demo-examples { padding: 12px; }
	.demo-examples-card { max-height: 86vh; }
	.demo-example-text { font-size: 12px; }
}
