/* Live agent demo (demo.php, assets/js/demo.js). Uses the tokens in site.css. */

.sf-demo { min-width: 0; }
.sf-demo > * { margin-top: 0; }

.sf-demo-actions { margin: 4px 0 20px; }
.sf-demo-run { cursor: pointer; }
/* Running: the button turns teal (the agent at work) and keeps full strength (--accent-ink on teal 10.98:1). */
.sf-demo-run[aria-disabled="true"],
.sf-demo-run[aria-disabled="true"]:hover { background: var(--teal); color: var(--accent-ink); cursor: progress; }

.sf-demo-error {
	margin: 0 0 20px;
	color: var(--error);
	font-weight: 600;
}

.sf-demo-grid {
	display: grid;
	grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.25fr);
	gap: 20px;
	align-items: start;
	margin-bottom: 20px;
}

.sf-demo-inbox,
.sf-demo-logwrap {
	min-width: 0;
	padding: 20px;
	border: 1px solid var(--line);
	border-radius: 10px;
	background: var(--surface);
}

.sf-demo-head {
	margin: 0 0 14px;
	font-size: 17px;
}

/* Inbox */

.sf-demo-docs {
	margin: 0;
	padding: 0;
	list-style: none;
}
.sf-demo-doc {
	padding: 12px 0 12px 12px;
	border-top: 1px solid var(--line);
	border-left: 2px solid transparent;
}
.sf-demo-doc:first-child { border-top: 0; }
.sf-demo-doc.sf-demo-current { border-left-color: var(--teal); }

.sf-demo-doc-head {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
}
.sf-demo-doc-title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.4;
}

.sf-demo-state {
	flex: none;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.03em;
}
.sf-demo-state[data-state="reading"],
.sf-demo-state[data-state="done"] { color: var(--teal); }
.sf-demo-state[data-state="stopped"] { color: var(--error); }

.sf-demo-toggle {
	margin: 6px 0 0;
	padding: 2px 0;
	border: 0;
	background: none;
	color: var(--accent);
	font: 600 14px/1.4 var(--font);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
	cursor: pointer;
}
.sf-demo-toggle:hover { color: var(--teal); }
/* Phones and touch screens: the toggle is a 44 px tap target; the underline stays on the text */
@media (max-width: 900px), (pointer: coarse) {
	.sf-demo-toggle {
		display: inline-flex;
		align-items: center;
		min-height: 44px;
		margin-top: 0;
		padding: 0;
	}
}

.sf-demo-text {
	margin: 10px 0 0;
	padding: 12px;
	border: 1px solid var(--line);
	border-radius: 6px;
	background: var(--bg);
	color: var(--muted);
	font: 400 13px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}

/* Log */

.sf-demo-log { min-height: 120px; }
.sf-demo-empty {
	margin: 0;
	color: var(--muted);
	font-size: 15px;
}

.sf-demo-entry {
	padding: 14px 0;
	border-top: 1px solid var(--line);
}
.sf-demo-entry:first-of-type { padding-top: 0; border-top: 0; }

.sf-demo-entry-head {
	margin: 0 0 8px;
	font-size: 15px;
	line-height: 1.4;
}
.sf-demo-step {
	display: block;
	color: var(--accent);
	font-weight: 600;
}

.sf-demo-entry-title { display: block; }

.sf-demo-reading {
	margin: 0;
	color: var(--teal);
	font-size: 15px;
}

.sf-demo-fields { margin: 0; }
.sf-demo-field {
	display: grid;
	grid-template-columns: 6.5em minmax(0, 1fr);
	gap: 10px;
	padding: 3px 0;
	font-size: 15px;
	line-height: 1.5;
}
.sf-demo-field dt { color: var(--muted); }
.sf-demo-field dd { margin: 0; min-width: 0; }

.sf-demo-route {
	display: inline-block;
	padding: 0 8px;
	border: 1px solid var(--line-strong);
	border-radius: 4px;
	font-weight: 600;
}
.sf-demo-route-review,
.sf-demo-route-reply { border-color: var(--accent); color: var(--accent); }

.sf-demo-reply {
	margin-top: 10px;
	padding: 10px 12px;
	border-left: 2px solid var(--accent);
	background: var(--bg);
}
.sf-demo-reply-label {
	margin: 0 0 4px;
	color: var(--muted);
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.03em;
}
.sf-demo-reply-text {
	margin: 0;
	font-size: 15px;
	white-space: pre-wrap;
}

.sf-demo-time,
.sf-demo-failed,
.sf-demo-finished {
	margin: 8px 0 0;
	color: var(--muted);
	font-size: 13px;
}
.sf-demo-time { color: var(--teal); }
.sf-demo-failed { color: var(--error); font-size: 15px; }
.sf-demo-finished {
	padding-top: 12px;
	border-top: 1px solid var(--line);
	color: var(--text);
	font-size: 15px;
}

.sf-demo-note {
	margin: 0;
	color: var(--muted);
	font-size: 15px;
}

/* Response time line (Stage C, cut to one line 2026-11-03): the label in gold, the value in teal, under the demo. */

.sf-strip[hidden],
.sf-strip-sample[hidden] { display: none; }
.sf-strip {
	margin: 24px 0 0;
	font-size: 15px;
	line-height: 1.5;
}
.sf-strip-label {
	color: var(--accent);
	font-weight: 600;
	letter-spacing: 0.02em;
}
.sf-strip-value {
	color: var(--teal);
	font: 600 16px/1.5 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	font-variant-numeric: tabular-nums;
}
/* Motion only where the visitor allows it: a new entry fades in and the Reading line pulses. */
@media (prefers-reduced-motion: no-preference) {
	.sf-demo-entry { animation: sf-demo-in 0.35s ease-out; }
	.sf-demo-reading { animation: sf-demo-pulse 1.2s ease-in-out infinite; }
}
@keyframes sf-demo-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}
/* The low point stays at 0.7 so the teal line keeps 5.54:1 against the surface (4.5:1 needed; check.py). */
@keyframes sf-demo-pulse {
	50% { opacity: 0.7; }
}

/* Narrow content column: stack the inbox above the log */
@media (max-width: 900px) {
	.sf-demo-grid { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 720px) {
	.sf-demo-inbox,
	.sf-demo-logwrap { padding: 16px; }
	.sf-demo-field { grid-template-columns: minmax(0, 1fr); gap: 0; padding: 4px 0; }
	.sf-demo-field dt { font-size: 13px; }
}

@media print {
	.sf-demo-actions,
	.sf-demo-toggle { display: none; }
	.sf-demo-text[hidden] { display: block; }
}

/* Wide screens: the inbox stays in view while the log grows beside it. It never grows taller than
   the window: with documents open, or on a short window, it scrolls inside, so every document and its
   button stay reachable and focusing one does not move the page away from the log. */
@media (min-width: 901px) {
	.sf-demo-inbox {
		position: sticky;
		top: 32px;
		max-height: calc(100vh - 64px);
		overflow-y: auto;
		overscroll-behavior: contain;
	}
}
