/* Kryyvo loading states (Contour Draw) fitted to frappe. contour-loaders.css
   is the approved kit, unchanged; this file follows the desk's own light/dark
   setting, styles the server-rendered launch screen, and places the kit's
   components where frappe waits (js/loading.js). */

/* ---------- theme: the desk's setting, not only the OS one ---------- */
:root[data-theme="light"] :where(kryyvo-splash, kryyvo-busy, kryyvo-skeleton, kryyvo-progress) {
	--kc-paper: #fff; --kc-ink: #233944; --kc-muted: #667d89;
	--kc-line: #e0e9ee; --kc-placeholder: #e5ecf0; --kc-sheen: #ffffff70;
}
:root[data-theme="dark"] :where(kryyvo-splash, kryyvo-busy, kryyvo-skeleton, kryyvo-progress) {
	--kc-paper: #16232d; --kc-ink: #e9f1f5; --kc-muted: #a1b6c3;
	--kc-line: #314651; --kc-placeholder: #314754; --kc-sheen: #c1d7e512;
}

/* ---------- 1. launch: the kit's kryyvo-splash, as static markup that draws
   before any script loads (templates/includes/splash_screen.html) ---------- */
.ky-launch {
	--kc-blue: #2177a6; --kc-yellow: #fcce19; --kc-paper: #fff; --kc-ink: #233944; --kc-muted: #667d89; --kc-line: #e0e9ee;
	position: fixed; inset: 0; z-index: 10000; display: grid; place-items: center;
	background: var(--kc-paper); color: var(--kc-ink); font-family: var(--ky-font-body, system-ui, sans-serif);
	/* gives up by itself after 30s, even if no script ever runs (js/loading.js
	   closes it on app_ready long before) */
	animation: ky-launch-give-up 0s linear 30s forwards;
}
@keyframes ky-launch-give-up { to { visibility: hidden; pointer-events: none; } }
@media (prefers-color-scheme: dark) {
	:root:not([data-theme="light"]) .ky-launch { --kc-paper: #16232d; --kc-ink: #e9f1f5; --kc-muted: #a1b6c3; --kc-line: #314651; }
}
:root[data-theme="dark"] .ky-launch { --kc-paper: #16232d; --kc-ink: #e9f1f5; --kc-muted: #a1b6c3; --kc-line: #314651; }
.ky-launch .kc-splash-panel { padding: 28px 20px; text-align: center; }
.ky-launch .kc-kicker { margin-bottom: 24px; font-size: 11px; letter-spacing: 1.2px; color: var(--kc-muted); }
.ky-launch .kc-brand { display: flex; justify-content: center; align-items: center; gap: 17px; }
.ky-launch .kc-logo { display: block; flex-shrink: 0; width: 86px; height: 86px; }
.ky-launch svg { display: block; width: 100%; height: 100%; overflow: visible; }
.ky-launch .kc-guide { fill: none; stroke: var(--kc-yellow); stroke-opacity: .18; stroke-width: 1; vector-effect: non-scaling-stroke; }
.ky-launch .kc-trace {
	fill: none; stroke: var(--kc-yellow); stroke-width: 1.35; stroke-linecap: round; stroke-linejoin: round;
	vector-effect: non-scaling-stroke; stroke-dasharray: 1; stroke-dashoffset: 0;
}
.ky-launch .kc-fill { fill: var(--kc-yellow); }
.ky-launch .kc-wordmark { font-size: 30px; font-weight: 500; line-height: 1.1; letter-spacing: -1px; text-align: left; }
.ky-launch .kc-subtitle { display: block; margin-top: 8px; font-size: 11px; font-weight: 400; line-height: 1.4; letter-spacing: 0; color: var(--kc-muted); }
.ky-launch .kc-splash-label { margin-top: 28px; min-height: 16px; font-size: 11px; color: var(--kc-muted); }
.ky-launch .kc-launch-line { width: 32px; height: 2px; margin: 12px auto 0; overflow: hidden; background: var(--kc-line); }
.ky-launch .kc-launch-line i { display: block; height: 100%; background: var(--kc-blue); transform-origin: left; }
.ky-launch[data-state="entering"] .kc-trace { animation: kc-contour-draw 1.6s cubic-bezier(.4, 0, .2, 1) both; }
.ky-launch[data-state="entering"] .kc-fill { animation: kc-contour-fill 1.6s ease both; }
.ky-launch[data-state="entering"] .kc-wordmark { animation: kc-contour-word 1.6s cubic-bezier(.22, 1, .36, 1) both; }
.ky-launch[data-state="entering"] .kc-launch-line i { animation: kc-contour-line 1.6s cubic-bezier(.4, 0, .2, 1) both; }
.ky-launch[data-state="leaving"] { animation: kc-contour-exit .18s ease both; pointer-events: none; }
@media (prefers-reduced-motion: reduce) {
	/* the launch screen itself keeps its give-up timer */
	.ky-launch *, .ky-launch[data-state="leaving"] { animation: none !important; transition: none !important; }
	.ky-launch .kc-trace { opacity: 0; }
}

/* ---------- 2. busy: the contour K in frappe's freeze overlay (saving,
   submitting, any call made with freeze) ---------- */
#freeze .freeze-message kryyvo-busy { --kc-busy-size: 40px; display: inline-flex; margin-bottom: 14px; }
#freeze .freeze-message kryyvo-busy[hidden] { display: none; }

/* ---------- 3. skeletons, sized like the rows they stand in for ---------- */
/* a list opening: the list panel with its header and 48px rows (css/list.css) */
body.ky-shell .list-skeleton.ky-skeleton { display: block; margin: 0; }
body.ky-shell .ky-skeleton-panel {
	overflow: hidden; border: 1px solid var(--ky-line); border-radius: 13px; background: var(--ky-surface);
}
body.ky-shell .ky-skeleton-panel .ky-skeleton-head { height: 47px; border-bottom: 1px solid var(--ky-line); background: var(--ky-page); }
body.ky-shell .ky-skeleton-panel kryyvo-skeleton { --kc-row-height: 48px; padding: 0 20px; }
body.ky-shell .ky-skeleton-panel kryyvo-skeleton .kc-skeleton-icon { width: 28px; height: 28px; border-radius: 50%; }
/* a query report's data loading: the table panel (css/report.css) */
body.ky-shell #page-query-report .ky-report-loading { display: block; height: auto !important; }
body.ky-shell #page-query-report .ky-report-loading > div { width: 100%; }
body.ky-shell #page-query-report .ky-report-loading kryyvo-skeleton { --kc-row-height: 44px; }
@media (max-width: 800px) {
	body.ky-shell .ky-skeleton-panel kryyvo-skeleton { padding: 0 16px; }
}
