/* Demos de módulo (tema claro del sitio): interfaces dibujadas en HTML que explican cada módulo de Maia Suite.
   Cada demo avanza por pasos acumulativos (.s1 … .s6) que pone demos.js; aquí solo hay estados y transiciones. */

.frag {
	container-type: inline-size;
	width: 100%; height: 100%;
}
.demo {
	--d-bg: var(--card);
	--d-panel: var(--paper);
	--d-line: var(--border);
	--d-ink: var(--ink);
	--d-muted: var(--muted);
	--d-bar: var(--ink);
	--d-code: var(--ink);
	--d-code-ink: oklch(78% 0 0);
	--d-mono: var(--mono); /* taste-skill-ignore: código literal y datos de la interfaz */
	--row: 7.4cqi;

	height: 100%;
	overflow: hidden;
	display: flex; flex-direction: column; gap: 2.6cqi;
	padding: 4cqi;
	background: var(--d-bg);
	border: 1px solid var(--d-line);
	border-radius: var(--radius);
	color: var(--d-ink);
	box-shadow: none;
	font-family: var(--text);
	font-size: 2.4cqi;
	line-height: 1.35;
	font-variant-numeric: tabular-nums;
	text-align: left;
}
.demo pre { margin: 0; font-family: var(--d-mono); font-size: 2.05cqi; line-height: 1.55; white-space: pre; overflow: hidden; }
.demo ul, .demo ol { margin: 0; padding: 0; list-style: none; }
.demo p { margin: 0; }

.d-bar { display: flex; justify-content: space-between; align-items: baseline; gap: 3cqi; }
.d-bar b { font-size: 2.9cqi; font-weight: 500; }
.d-bar span { color: var(--d-muted); font-size: 2.1cqi; text-align: right; }
.d-foot { margin-top: auto; color: var(--d-muted); font-size: 1.95cqi; }
.d-ej { background: color-mix(in srgb, var(--accent) 18%, transparent); color: var(--d-ink); padding: 0 0.8cqi; }

/* Todo lo que entra lo hace desde algo visible: opacidad + poco desplazamiento, nunca desde cero */
.demo .in-up {
	opacity: 0; translate: 0 1.2cqi;
	transition: opacity 260ms ease, translate 360ms var(--ease-out);
}

/* ---------- People: del ingreso a la salida ---------- */
.pp-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 38% 1fr; gap: 3cqi; }
/* .demo ol pone padding 0: aquí hace falta el margen para que la línea una los puntos y no pase bajo el texto */
.demo .pp-tl { position: relative; display: grid; align-content: space-between; padding-left: 3.4cqi; }
.pp-tl::before { content: ""; position: absolute; left: 0.9cqi; top: 1.4cqi; bottom: 1.4cqi; width: 2px; background: color-mix(in srgb, var(--d-ink) 18%, transparent); }
.pp-tl li { position: relative; display: grid; line-height: 1.2; color: var(--d-muted); transition: color 220ms ease; }
.pp-tl li::before {
	content: ""; position: absolute; left: -3.4cqi; top: 0.3cqi; z-index: 1;
	width: 2cqi; height: 2cqi; border-radius: 50%;
	background: var(--d-bg); border: 2px solid var(--d-line);
	transition: background-color 220ms ease, border-color 220ms ease, scale 260ms var(--ease-out);
}
.pp-tl b { font-weight: 500; }
.pp-tl small { font-size: 1.9cqi; }
.pp-tl__end::before { border-style: dashed; }
/* Cada paso enciende su evento; los anteriores quedan marcados */
.s1 .pp-tl li:nth-child(1), .s2 .pp-tl li:nth-child(2), .s3 .pp-tl li:nth-child(3),
.s4 .pp-tl li:nth-child(4), .s5 .pp-tl li:nth-child(5) { color: var(--d-ink); }
.s1 .pp-tl li:nth-child(1)::before, .s2 .pp-tl li:nth-child(2)::before, .s3 .pp-tl li:nth-child(3)::before,
.s4 .pp-tl li:nth-child(4)::before, .s5 .pp-tl li:nth-child(5)::before { background: var(--d-ink); border-color: var(--d-ink); }
.s1:not(.s2) .pp-tl li:nth-child(1)::before, .s2:not(.s3) .pp-tl li:nth-child(2)::before, .s3:not(.s4) .pp-tl li:nth-child(3)::before,
.s4:not(.s5) .pp-tl li:nth-child(4)::before, .s5 .pp-tl li:nth-child(5)::before { background: var(--accent); border-color: var(--accent); scale: 1.25; }

.pp-tiles { display: grid; grid-template-columns: repeat(3, 1fr); grid-auto-rows: 1fr; gap: 1.4cqi; }
.pp-tiles span {
	display: flex; align-items: flex-end;
	padding: 1.6cqi;
	background: var(--d-panel);
	border: 1px solid var(--d-line); border-radius: var(--radius);
	font-size: 2.1cqi; font-weight: 500; line-height: 1.2;
	color: var(--d-muted);
	transition: background-color 240ms ease, color 240ms ease, border-color 240ms ease;
}
/* Lo que ya tocó algún evento queda teñido; lo del evento actual, en acento */
.s1 .t-e1, .s2 .t-e2, .s3 .t-e3, .s4 .t-e4, .s5 .t-e5 { color: var(--d-ink); border-color: color-mix(in srgb, var(--accent) 45%, transparent); background: color-mix(in srgb, var(--accent) 8%, var(--d-panel)); }
/* Texto pequeño sobre naranja va en tinta: el blanco no llega a 4.5:1 */
.s1:not(.s2) .t-e1, .s2:not(.s3) .t-e2, .s3:not(.s4) .t-e3, .s4:not(.s5) .t-e4, .s5 .t-e5 { background: var(--accent); border-color: var(--accent); color: var(--d-ink); }

.pp-log { min-height: 6.4cqi; padding: 1.8cqi 2.4cqi; background: var(--d-code); border-radius: var(--radius); color: var(--accent); }
.pp-log span { display: none; }
.s1:not(.s2) .pp-log span:nth-child(1), .s2:not(.s3) .pp-log span:nth-child(2), .s3:not(.s4) .pp-log span:nth-child(3),
.s4:not(.s5) .pp-log span:nth-child(4), .s5 .pp-log span:nth-child(5) { display: inline; animation: pp-type 320ms var(--ease-out); }
@keyframes pp-type { from { opacity: 0; translate: -1cqi 0; } to { opacity: 1; translate: 0 0; } }

/* ---------- Talent ---------- */
.t-grid {
	flex: 1; min-height: 0;
	display: grid; grid-template-columns: 38% 1fr; grid-template-rows: auto 1fr; gap: 2.6cqi;
}
.t-cv {
	grid-row: 1 / 3;
	position: relative; overflow: hidden;
	display: flex; flex-direction: column; gap: 1.8cqi;
	padding: 2.6cqi;
	background: var(--d-panel);
	border: 1px solid var(--d-line);
	border-radius: var(--radius);
}
.t-file { font-size: 2cqi; color: var(--d-muted); }
.t-doc { display: grid; gap: 1.5cqi; }
.t-doc i { display: block; height: 1.2cqi; border-radius: var(--radius); background: var(--d-line); }
.t-doc i:nth-child(1) { width: 70%; background: var(--d-bar); }
.t-doc i:nth-child(2) { width: 92%; }
.t-doc i:nth-child(3) { width: 84%; }
.t-doc i:nth-child(4) { width: 60%; }
.t-doc i:nth-child(5) { width: 88%; }
.t-doc i:nth-child(6) { width: 45%; }
.t-scan {
	position: absolute; left: 0; right: 0; top: 0; height: 30%;
	background: color-mix(in srgb, var(--accent) 14%, transparent);
	border-bottom: 2px solid var(--accent);
	transform: translateY(-110%);
}
.s2 .t-scan { transform: translateY(340%); transition: transform 1100ms var(--ease-in-out); }
.t-chips { display: flex; flex-wrap: wrap; gap: 1.2cqi; margin-top: auto; }
.t-chips li {
	padding: 0.6cqi 1.4cqi;
	border-radius: var(--radius);
	background: color-mix(in srgb, var(--accent) 16%, transparent);
	color: var(--accent);
	font-size: 2cqi;
	opacity: 0; scale: 0.94;
	transition: opacity 240ms ease, scale 300ms var(--ease-out);
}
.s3 .t-chips li { opacity: 1; scale: 1; }
.s3 .t-chips li:nth-child(2) { transition-delay: 70ms; }
.s3 .t-chips li:nth-child(3) { transition-delay: 140ms; }
.s3 .t-chips li:nth-child(4) { transition-delay: 210ms; }

.t-log { padding: 2cqi 2.4cqi; background: var(--d-code); border: 0; border-radius: var(--radius); color: var(--d-code-ink); }
.t-log span { display: inline-block; opacity: 0; transition: opacity 200ms ease; }
.s4 .t-log span { opacity: 1; }
.s4 .t-log span:nth-child(2) { transition-delay: 120ms; }
.s4 .t-log span:nth-child(3) { transition-delay: 240ms; }
.s4 .t-log span:nth-child(4) { transition-delay: 360ms; }
.t-score { color: var(--accent); font-weight: 500; }

.t-rank { position: relative; height: calc(4 * var(--row)); }
.t-rank li {
	position: absolute; left: 0; right: 0; top: 0;
	height: calc(var(--row) - 1.2cqi);
	display: flex; justify-content: space-between; align-items: center;
	padding: 0 2.2cqi;
	background: var(--d-panel);
	border: 1px solid var(--d-line);
	border-radius: var(--radius);
	transform: translateY(calc((var(--i0) + var(--shift, 0)) * var(--row)));
	transition: transform 520ms var(--ease-in-out), opacity 260ms ease, border-color 260ms ease, scale 360ms var(--ease-out);
}
.t-rank b { font-weight: 500; color: var(--d-muted); }
.t-rank .is-new { opacity: 0; scale: 0.97; z-index: 1; }
.s5 .t-rank li:not(.is-new) { --shift: 1; }
.s5 .t-rank .is-new { opacity: 1; scale: 1; border-color: var(--accent); transition-delay: 160ms; }
.s5 .t-rank .is-new b { color: var(--accent); }

/* ---------- Time ---------- */
.tm-grid { flex: 1; min-height: 0; display: grid; grid-template-columns: 36% 1fr; gap: 3cqi; }
.tm-left { display: flex; flex-direction: column; gap: 1.6cqi; }
.tm-clock {
	position: relative;
	width: 13cqi; aspect-ratio: 3 / 4;
	display: grid; place-items: center;
	background: var(--d-panel);
	border: 1px solid var(--d-line);
	border-radius: var(--radius);
}
.tm-face { width: 6.4cqi; aspect-ratio: 1; border-radius: 50%; border: 2px solid var(--d-muted); }
.tm-ring {
	position: absolute; inset: -1.6cqi;
	border: 2px solid var(--accent);
	border-radius: var(--radius);
	opacity: 0;
}
.tm-clock.punch .tm-ring { animation: tm-punch 620ms var(--ease-out); }
.tm-clock.punch .tm-face { border-color: var(--accent); transition: border-color 120ms ease; }
@keyframes tm-punch { from { opacity: 1; scale: 0.9; } to { opacity: 0; scale: 1.12; } }
.tm-label { font-size: 2cqi; color: var(--d-muted); }
.tm-feed { color: var(--d-muted); }
.tm-feed span { display: inline-block; opacity: 0; translate: -1cqi 0; transition: opacity 220ms ease, translate 300ms var(--ease-out); }
.s1 .tm-feed span:nth-child(1), .s2 .tm-feed span:nth-child(2),
.s3 .tm-feed span:nth-child(3), .s4 .tm-feed span:nth-child(4) { opacity: 1; translate: 0 0; color: var(--d-ink); }

.tm-week { display: flex; flex-direction: column; gap: 1.5cqi; }
.tm-row { display: grid; grid-template-columns: 5.5cqi 1fr 9cqi; align-items: center; gap: 1.6cqi; }
.tm-row span { color: var(--d-muted); }
.tm-row b { font-weight: 500; color: var(--accent); text-align: right; opacity: 0; transition: opacity 240ms ease; }
.tm-bar { display: flex; height: 3cqi; background: var(--d-panel); border-radius: var(--radius); overflow: hidden; }
.tm-bar i {
	display: block; width: calc(var(--w) * 100%);
	background: var(--d-bar);
	transform: scaleX(0); transform-origin: left;
	transition: transform 600ms var(--ease-out);
}
.tm-bar i.x { background: var(--accent); }
.s5 .tm-bar i:not(.x) { transform: scaleX(1); }
.s5 .tm-row:nth-child(2) .tm-bar i { transition-delay: 60ms; }
.s5 .tm-row:nth-child(3) .tm-bar i { transition-delay: 120ms; }
.s5 .tm-row:nth-child(4) .tm-bar i { transition-delay: 180ms; }
.s5 .tm-row:nth-child(5) .tm-bar i { transition-delay: 240ms; }
.s6 .tm-bar i.x { transform: scaleX(1); }
.s6 .tm-row b { opacity: 1; }
.tm-total { margin-top: auto; display: flex; justify-content: space-between; padding: 1.6cqi 2.2cqi; background: var(--d-panel); border-radius: var(--radius); }
.tm-total b { color: var(--accent); font-weight: 500; }

/* ---------- Pay ---------- */
.p-tabs {
	position: relative;
	display: grid; grid-template-columns: repeat(4, 1fr);
	padding: 0.8cqi;
	background: var(--d-panel);
	border-radius: var(--radius);
}
.p-tabs span:not(.p-pill) {
	position: relative; z-index: 1;
	padding: 1.2cqi 0;
	text-align: center; font-weight: 500;
	color: var(--d-muted);
	transition: color 200ms ease;
}
.p-tabs span.on { color: var(--d-ink); }
.p-pill {
	position: absolute; top: 0.8cqi; bottom: 0.8cqi; left: 0.8cqi;
	width: calc((100% - 1.6cqi) / 4);
	background: var(--accent);
	border-radius: var(--radius);
	transition: transform 380ms var(--ease-in-out);
}
.p-body {
	flex: 1; min-height: 0;
	display: grid; grid-template-columns: 1.2fr 1fr; gap: 3cqi; align-content: start;
	transition: opacity 160ms ease, filter 160ms ease;
}
.p-body.swap { opacity: 0; filter: blur(4px); }
.p-concepts { display: grid; gap: 1.2cqi; }
.p-concepts li {
	display: flex; justify-content: space-between; align-items: center;
	padding: 1.5cqi 2cqi;
	background: var(--d-panel);
	border-radius: var(--radius);
}
.p-concepts li::after {
	content: "";
	width: 1.1cqi; height: 2cqi;
	margin-right: 0.6cqi;
	border-right: 2px solid var(--accent);
	border-bottom: 2px solid var(--accent);
	rotate: 45deg;
	opacity: 0; scale: 0.6;
	transition: opacity 180ms ease, scale 260ms var(--ease-out);
}
.s2 .p-concepts li:nth-child(1)::after, .s3 .p-concepts li:nth-child(2)::after,
.s4 .p-concepts li:nth-child(3)::after, .s5 .p-concepts li:nth-child(4)::after { opacity: 1; scale: 1; }
.p-out { display: flex; flex-wrap: wrap; align-content: start; gap: 1.2cqi; }
.p-out li {
	padding: 1cqi 1.8cqi;
	border: 1px solid var(--d-line);
	border-radius: var(--radius);
	color: var(--d-muted);
	transition: color 220ms ease, border-color 220ms ease, background-color 220ms ease;
}
.s6 .p-out li { color: var(--d-ink); border-color: var(--accent); background: color-mix(in srgb, var(--accent) 10%, transparent); }
.s6 .p-out li:nth-child(2) { transition-delay: 80ms; }
.s6 .p-out li:nth-child(3) { transition-delay: 160ms; }
.s6 .p-out li:nth-child(4) { transition-delay: 240ms; }

/* ---------- Cash ---------- */
.c-amount { display: flex; align-items: baseline; gap: 1.4cqi; }
.c-amount span { color: var(--d-muted); font-size: 3cqi; }
.c-amount b { font-size: 8cqi; font-weight: 500; letter-spacing: -0.02em; line-height: 1; }
.c-flow { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); margin-top: 1cqi; }
.c-track { position: absolute; top: 2cqi; left: 12.5%; right: 12.5%; height: 0.6cqi; background: var(--d-line); border-radius: var(--radius); overflow: hidden; }
.c-fill { position: absolute; inset: 0; background: var(--accent); transform: scaleX(0); transform-origin: left; transition: transform 620ms var(--ease-in-out); }
.s2 .c-fill { transform: scaleX(0.3334); }
.s3 .c-fill { transform: scaleX(0.6667); }
.s4 .c-fill { transform: scaleX(1); }
.c-token {
	position: absolute; top: 0.7cqi; left: 12.5%; width: 75%; height: 3.2cqi;
	z-index: 2; pointer-events: none;
	transition: transform 620ms var(--ease-in-out);
}
.c-token::before {
	content: ""; position: absolute; left: -1.6cqi; top: 0;
	width: 3.2cqi; height: 3.2cqi; border-radius: 50%;
	background: var(--accent);
	opacity: 0; transition: opacity 200ms ease;
}
.s1 .c-token::before { opacity: 1; }
.s2 .c-token { transform: translateX(33.333%); }
.s3 .c-token { transform: translateX(66.667%); }
.s4 .c-token { transform: translateX(100%); }
.c-node { display: grid; justify-items: center; gap: 1.6cqi; text-align: center; }
.c-node i {
	position: relative; z-index: 1;
	width: 4.6cqi; aspect-ratio: 1; border-radius: 50%;
	background: var(--d-panel); border: 2px solid var(--d-line);
	transition: border-color 220ms ease;
}
.c-node p { font-weight: 500; color: var(--d-muted); transition: color 220ms ease; }
.c-node small { display: block; font-weight: 400; font-size: 1.9cqi; color: var(--d-muted); }
.s1 .c-node:nth-of-type(1) i, .s2 .c-node:nth-of-type(2) i,
.s3 .c-node:nth-of-type(3) i, .s4 .c-node:nth-of-type(4) i { border-color: var(--accent); }
.s1 .c-node:nth-of-type(1) p, .s2 .c-node:nth-of-type(2) p,
.s3 .c-node:nth-of-type(3) p, .s4 .c-node:nth-of-type(4) p { color: var(--d-ink); }
.c-log { padding: 2cqi 2.4cqi; background: var(--d-code); border: 0; border-radius: var(--radius); color: var(--accent); opacity: 0; transition: opacity 260ms ease; }
.s5 .c-log { opacity: 1; }

/* ---------- BI ---------- */
.b-kpis { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1.8cqi; }
.b-kpis div { padding: 2cqi 2.2cqi; background: var(--d-panel); border-radius: var(--radius); }
.b-kpis small { display: block; color: var(--d-muted); font-size: 1.9cqi; }
.b-kpis b { display: block; margin-top: 0.6cqi; font-size: 4.6cqi; font-weight: 500; letter-spacing: -0.02em; }
.b-chart { display: grid; gap: 1.6cqi; }
.b-row { display: grid; grid-template-columns: 20cqi 1fr; align-items: center; gap: 2cqi; }
.b-row span { color: var(--d-muted); }
.b-row i {
	display: block; height: 3cqi; width: calc(var(--w) * 100%);
	background: var(--d-bar); border-radius: var(--radius);
	transform: scaleX(0); transform-origin: left;
	transition: transform 700ms var(--ease-out);
}
.b-row:first-child i { background: var(--accent); }
.s2 .b-row i { transform: scaleX(1); }
.s2 .b-row:nth-child(2) i { transition-delay: 70ms; }
.s2 .b-row:nth-child(3) i { transition-delay: 140ms; }
.s2 .b-row:nth-child(4) i { transition-delay: 210ms; }
.b-insight { min-height: 7.4cqi; padding: 1.8cqi 2.2cqi; background: var(--d-panel); border-radius: var(--radius); }
.b-tag { color: var(--accent); font-weight: 500; }
.b-text::after { content: ""; display: inline-block; width: 0.7cqi; height: 2.4cqi; margin-left: 0.4cqi; vertical-align: -0.4cqi; background: var(--accent); opacity: 0; }
.s3 .b-text::after { opacity: 1; animation: b-caret 900ms steps(1) infinite; }
@keyframes b-caret { 50% { opacity: 0; } }

@media (prefers-reduced-motion: reduce) {
	.demo *, .demo *::before, .demo *::after { transition-duration: 0ms !important; animation: none !important; }
}

/* Reinicio del ciclo: fundido corto y vuelta al estado inicial sin transiciones */
.demo > * { transition: opacity 220ms ease; }
.demo.d-reset > * { opacity: 0; }
.demo.d-instant, .demo.d-instant * { transition: none !important; }
