/* ============================================================
   ck-ecl1-anim — Entity Centric Learning explainer (v1: single match)
   Fully scoped under .ck-ecl1. Obsidian & Ember palette.
   Signal green is used ONLY on the resolved/match state.
   ============================================================ */

.ck-ecl1 {
	--ck-ecl1-obsidian: #0F0D0C;
	--ck-ecl1-deep:     #1A1614;
	--ck-ecl1-card:     #251E1A;
	--ck-ecl1-border:   #2E2520;
	--ck-ecl1-ember:    #FF4E1F;
	--ck-ecl1-amber:    #F0920A;
	--ck-ecl1-signal:   #00FC88;
	--ck-ecl1-text:     #E8E2DC;
	--ck-ecl1-muted:    #B0A49E;
	--ck-ecl1-dim:      #6f655e;
	--ck-ecl1-fail:     #C03A10;

	position: relative;
	box-sizing: border-box;
	max-width: 1100px;
	margin: 0 auto;
	padding: clamp(24px, 4vw, 48px);
	background:
		radial-gradient(circle, rgba(255,255,255,.05) 1px, transparent 1px) 0 0 / 24px 24px,
		var(--ck-ecl1-obsidian);
	border: 1px solid var(--ck-ecl1-border);
	border-radius: 14px;
	color: var(--ck-ecl1-text);
	font-family: 'Roboto', 'Helvetica Neue', Helvetica, Arial, sans-serif;
	overflow: hidden;
}
.ck-ecl1 *, .ck-ecl1 *::before, .ck-ecl1 *::after { box-sizing: border-box; }

/* ── Header ─────────────────────────────────────────────── */
.ck-ecl1__head { text-align: center; margin-bottom: clamp(20px, 3vw, 36px); }
.ck-ecl1__title {
	margin: 0 0 10px;
	font-size: clamp(20px, 2.6vw, 30px);
	font-weight: 700;
	line-height: 1.2;
	color: #fff;
}
.ck-ecl1__sub {
	margin: 0 auto;
	max-width: 640px;
	font-size: clamp(13px, 1.4vw, 16px);
	line-height: 1.5;
	color: var(--ck-ecl1-muted);
}

/* ── Stage / two panes ──────────────────────────────────── */
.ck-ecl1__stage {
	display: grid;
	grid-template-columns: 1fr auto 1fr;
	gap: clamp(12px, 2vw, 28px);
	align-items: stretch;
}
.ck-ecl1__divider {
	width: 1px;
	background: linear-gradient(180deg, transparent, var(--ck-ecl1-border) 20%, var(--ck-ecl1-border) 80%, transparent);
}
.ck-ecl1__pane {
	display: flex;
	flex-direction: column;
	min-width: 0;
}
.ck-ecl1__pane-title {
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	text-align: center;
	margin-bottom: 16px;
	padding-bottom: 10px;
	border-bottom: 1px solid var(--ck-ecl1-border);
	color: var(--ck-ecl1-muted);
}
.ck-ecl1__pane--ecl .ck-ecl1__pane-title { color: var(--ck-ecl1-amber); }

/* ── Record cards ───────────────────────────────────────── */
.ck-ecl1__recstack { position: relative; }
.ck-ecl1__records { display: flex; flex-direction: column; gap: 8px; }

.ck-ecl1__rec {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px 12px;
	background: rgba(255,255,255,.03);
	border: 1px solid var(--ck-ecl1-border);
	border-radius: 8px;
	transition: opacity .5s ease, transform .5s ease, border-color .4s ease, background .4s ease;
}
.ck-ecl1__rec-src {
	flex: 0 0 auto;
	width: 48px;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--ck-ecl1-ember);
	background: rgba(255,78,31,.10);
	border: 1px solid rgba(255,78,31,.30);
	border-radius: 4px;
	padding: 4px 0;
	text-align: center;
}
.ck-ecl1__feats {
	display: flex;
	flex: 1 1 auto;
	gap: 6px;
	min-width: 0;
}
.ck-ecl1__feat {
	flex: 1 1 0;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 2px;
	transition: color .35s ease, opacity .35s ease;
}
.ck-ecl1__feat-lbl {
	font-size: 8px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--ck-ecl1-dim);
}
.ck-ecl1__feat-val {
	font-size: 12px;
	font-weight: 600;
	color: var(--ck-ecl1-dim);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.ck-ecl1__feat.is-present .ck-ecl1__feat-val { color: var(--ck-ecl1-text); }

/* The new (incoming) record */
.ck-ecl1__compare {
	text-align: center;
	font-size: 11px;
	color: var(--ck-ecl1-muted);
	margin: 14px 0 8px;
	opacity: .85;
}
.ck-ecl1__incoming { position: relative; }
.ck-ecl1__rec--in {
	background: rgba(255,78,31,.06);
	border-color: rgba(255,78,31,.28);
}
.ck-ecl1__rec--in .ck-ecl1__rec-src {
	color: #fff;
	background: var(--ck-ecl1-ember);
	border-color: var(--ck-ecl1-ember);
}

/* Fail tags under the incoming record (left pane) */
.ck-ecl1__fail-tags {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	margin-top: 10px;
	min-height: 22px;
}
.ck-ecl1__tag {
	font-size: 10px;
	font-weight: 600;
	padding: 3px 8px;
	border-radius: 100px;
}
.ck-ecl1__tag--fail {
	color: #ff8a6b;
	background: rgba(192,58,16,.16);
	border: 1px solid rgba(192,58,16,.45);
}

/* ── Entity card (right pane) ───────────────────────────── */
.ck-ecl1__entity {
	position: absolute;
	inset: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	background: linear-gradient(160deg, rgba(255,78,31,.10), rgba(240,146,10,.05)), var(--ck-ecl1-card);
	border: 1px solid rgba(255,78,31,.40);
	border-radius: 8px;
	box-shadow: 0 0 0 1px rgba(255,78,31,.06), 0 8px 30px rgba(0,0,0,.35);
}
.ck-ecl1__entity-lbl {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--ck-ecl1-amber);
}
.ck-ecl1__entity-name {
	font-size: 15px;
	font-weight: 700;
	color: #fff;
	line-height: 1;
}
.ck-ecl1__entity .ck-ecl1__feats { margin-top: auto; }
.ck-ecl1__entity .ck-ecl1__feat-val { color: var(--ck-ecl1-text); }

/* ── Verdict banners ────────────────────────────────────── */
.ck-ecl1__verdict {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: 16px;
	padding: 10px 14px;
	border-radius: 8px;
	font-size: 13px;
	font-weight: 700;
}
.ck-ecl1__verdict-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	font-size: 13px;
	line-height: 1;
}
.ck-ecl1__verdict--fail {
	color: #ff8a6b;
	background: rgba(192,58,16,.12);
	border: 1px solid rgba(192,58,16,.40);
}
.ck-ecl1__verdict--fail .ck-ecl1__verdict-icon { background: rgba(192,58,16,.30); color: #ffb59e; }
.ck-ecl1__verdict--pass {
	color: var(--ck-ecl1-signal);
	background: rgba(0,252,136,.08);
	border: 1px solid rgba(0,252,136,.40);
}
.ck-ecl1__verdict--pass .ck-ecl1__verdict-icon { background: rgba(0,252,136,.20); color: var(--ck-ecl1-signal); }

/* ── Coda ───────────────────────────────────────────────── */
.ck-ecl1__coda {
	text-align: center;
	margin: clamp(20px, 3vw, 32px) auto 0;
	max-width: 620px;
	font-size: clamp(13px, 1.4vw, 15px);
	line-height: 1.5;
	color: var(--ck-ecl1-muted);
}

/* ============================================================
   ANIMATED MODE — JS adds .ck-ecl1--anim, then drives state
   classes on a timeline. Without JS (or with reduced motion),
   the resolved end-state above is shown.
   ============================================================ */
.ck-ecl1--anim .ck-ecl1__rec { opacity: 0; transform: translateY(8px); }
.ck-ecl1--anim .ck-ecl1__rec.is-in { opacity: 1; transform: none; }

.ck-ecl1--anim .ck-ecl1__entity { opacity: 0; transform: scale(.96); transition: opacity .55s ease, transform .55s ease; }
.ck-ecl1--anim .ck-ecl1__entity.is-in { opacity: 1; transform: none; }

/* right-pane records collapse into the entity */
.ck-ecl1--anim .ck-ecl1__pane--ecl .ck-ecl1__rec.is-merged { opacity: .12; transform: scale(.94); }

.ck-ecl1--anim .ck-ecl1__compare { opacity: 0; transition: opacity .4s ease; }
.ck-ecl1--anim .ck-ecl1__compare.is-in { opacity: .85; }

/* a record being actively compared pulses */
.ck-ecl1--anim .ck-ecl1__rec.is-checking { border-color: rgba(255,78,31,.6); background: rgba(255,78,31,.08); }
.ck-ecl1--anim .ck-ecl1__rec.is-fail { border-color: rgba(192,58,16,.45); }

/* feature lights up green when it confirms a match (right pane only) */
.ck-ecl1--anim .ck-ecl1__feat.is-hit .ck-ecl1__feat-val { color: var(--ck-ecl1-signal); }
.ck-ecl1--anim .ck-ecl1__feat.is-hit .ck-ecl1__feat-lbl { color: rgba(0,252,136,.7); }

/* fail tags + verdicts hidden until their beat */
.ck-ecl1--anim .ck-ecl1__tag { opacity: 0; transform: translateY(4px); transition: opacity .35s ease, transform .35s ease; }
.ck-ecl1--anim .ck-ecl1__tag.is-in { opacity: 1; transform: none; }
.ck-ecl1--anim .ck-ecl1__verdict { opacity: 0; transform: translateY(6px); transition: opacity .45s ease, transform .45s ease; }
.ck-ecl1--anim .ck-ecl1__verdict.is-in { opacity: 1; transform: none; }

/* entity reaching matched state gets a brighter ring */
.ck-ecl1--anim .ck-ecl1__entity.is-matched { border-color: rgba(0,252,136,.5); box-shadow: 0 0 0 1px rgba(0,252,136,.10), 0 8px 30px rgba(0,0,0,.4); }

/* ── Responsive: stack the two panes ────────────────────── */
@media (max-width: 760px) {
	.ck-ecl1__stage { grid-template-columns: 1fr; }
	.ck-ecl1__divider { display: none; }
	.ck-ecl1__pane--rtr { padding-bottom: 24px; margin-bottom: 24px; border-bottom: 1px solid var(--ck-ecl1-border); }
	.ck-ecl1__feat-val { font-size: 11px; }
}

@media (prefers-reduced-motion: reduce) {
	.ck-ecl1--anim .ck-ecl1__rec,
	.ck-ecl1--anim .ck-ecl1__entity,
	.ck-ecl1--anim .ck-ecl1__compare,
	.ck-ecl1--anim .ck-ecl1__tag,
	.ck-ecl1--anim .ck-ecl1__verdict { opacity: 1 !important; transform: none !important; }
}
