/* Swop Explainer — hoofd vol kaartjes */
.swex, .swex-mind-fly {
	--swex-mind-rem: #3fae92;
	--swex-mind-gas: #e2917f;
	--swex-mind-skin: color-mix(in srgb, var(--swex-ink, #33424c) 7%, var(--swex-bg, #eef6fb));
	--swex-mind-line: color-mix(in srgb, var(--swex-ink, #33424c) 16%, var(--swex-bg, #eef6fb));
	--swex-mind-brain: color-mix(in srgb, var(--swex-ink, #33424c) 11%, var(--swex-bg, #eef6fb));
	--swex-mind-brick: var(--swex-surface, #fff);
	--swex-mind-week: #fdf3ee;
	--swex-mind-big: #f6dfd5;
	--swex-mind-note: #ffe28a;
	--swex-mind-heard: #ffc7cf;
	--swex-mind-learned: #d9cff6;
	--swex-mind-note-ink: #4a3608;
}

/* Wisselen tussen lichaam en hoofd */
.swex-mind { display: none; }
.swex[data-mode="mind"] .swex-mind { display: flex; flex-direction: column; flex: 1; gap: 8px; animation: swex-mind-in 0.6s ease; }
.swex[data-mode="mind"] .swex-figure > .swex-svg, .swex[data-mode="mind"] .swex-badge { display: none; }
/* Explainers met het hoofd: vaste kolommen voor álle stappen, zodat de tekst niet verspringt */
.swex-has-mind .swex-stage { grid-template-columns: minmax(0, 1.15fr) minmax(0, 1fr); max-width: 1100px; }
.swex-has-mind[data-mode="body"] .swex-figure { width: min(100%, 390px); justify-self: center; }
/* Het hoofd vult de hele hoogte: tijdlijn boven, archief onder, hoofd in het midden */
.swex[data-mode="mind"] .swex-figure { align-self: stretch; display: flex; flex-direction: column; }
/* Tekstkolom: de knoppen staan direct onder de tekst van de stap, de navigatie altijd op dezelfde plek onderaan */
.swex-has-mind .swex-panel { justify-content: flex-start; }
.swex-has-mind .swex-nav { margin-top: auto; }
.swex-has-mind ol.swex-scenes { position: relative; }
.swex-has-mind:not(.swex-nojs) ol.swex-scenes > li.swex-scene:not(.is-active) { position: absolute; top: 0; left: 0; right: 0; }
/* Tot een middelgroot scherm: hoofd boven, tekst eronder */
@container (max-width: 860px) {
	.swex-has-mind .swex-stage { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; gap: 14px; }
	.swex-has-mind[data-mode="mind"] .swex-figure { width: 100%; max-width: 520px; justify-self: center; }
	/* Zelfde volgorde als op mobiel: beeld, navigatie, tekst, acties */
	.swex-has-mind .swex-panel { gap: 14px; }
	.swex-has-mind .swex-nav { order: -1; margin-top: 0; gap: 8px; }
	.swex-has-mind .swex-tools { order: 1; min-height: 0; }
	.swex-has-mind .swex-figure { display: flex; flex-direction: column; justify-content: center; }
}
@container (max-width: 620px) {
	.swex-has-mind .swex-stage { grid-template-columns: minmax(0, 1fr); }
	.swex .swex-mind-cap { min-height: 3.9em; } /* op smal scherm tot drie regels, zonder te verspringen */
	.swex[data-mode="mind"] .swex-figure { max-width: 100%; margin-inline: calc(clamp(18px, 4cqi, 40px) * -0.6); width: auto; }
}
@keyframes swex-mind-in { from { opacity: 0; } }

/* Tijdlijn */
.swex-mind-time { position: relative; display: grid; grid-template-columns: repeat(4, 1fr); }
.swex-mind-time::before { content: ""; position: absolute; left: 12.5%; right: 12.5%; top: 7px; height: 3px; border-radius: 4px; background: var(--swex-mind-line); }
.swex-mind-fill { position: absolute; left: 12.5%; top: 7px; height: 3px; width: 0; border-radius: 4px; background: var(--swex-mind-gas); transition: width 0.6s ease; }
.swex-mind-stop { position: relative; display: grid; justify-items: center; gap: 2px; white-space: nowrap; font-size: clamp(10px, 3cqi, 11px); font-weight: 800; letter-spacing: 0.02em; color: var(--swex-muted); }
.swex-mind-stop i { display: block; width: 17px; height: 17px; border-radius: 50%; border: 3px solid var(--swex-mind-line); background: var(--swex-surface, #fff); transition: border-color 0.3s, background-color 0.3s, transform 0.2s; }
.swex-mind-stop.is-done { color: var(--swex-ink); }
.swex-mind-stop.is-done i { border-color: var(--swex-mind-gas); background: var(--swex-mind-gas); }
.swex-mind-stop.is-now i { transform: scale(1.15); box-shadow: 0 0 0 4px color-mix(in srgb, var(--swex-mind-gas) 25%, transparent); }
.swex-mind-cap { min-height: 2.6em; margin: -2px 0 8px; font-size: clamp(13.5px, 1.7cqi, 15.5px); font-weight: 800; line-height: 1.3; color: var(--swex-ink); text-align: center; text-wrap: balance; }

/* Hoofd */
.swex-mind-head { position: relative; flex: none; width: 100%; margin-block: auto; aspect-ratio: 600 / 390; container-type: inline-size; }
.swex-mind-head svg { position: absolute; inset: 0; width: 100%; height: 100%; overflow: hidden; }
.swex-mind-aura { fill: var(--swex-mind-rem); opacity: 0.1; transition: fill 1.2s ease, opacity 1.2s ease; }
.swex-mind-aura.is-full { fill: var(--swex-mind-gas); }
.swex-mind-skin { fill: var(--swex-mind-skin); stroke: var(--swex-mind-line); stroke-width: 2.5; transition: stroke 0.6s ease; }
.swex-mind-brain { fill: var(--swex-mind-brain); }
.swex-mind-fold { fill: none; stroke: var(--swex-mind-line); stroke-width: 3; stroke-linecap: round; opacity: 0.7; }
.swex-mind-outlet { fill: none; stroke: var(--swex-mind-rem); stroke-width: 5; stroke-linecap: round; stroke-dasharray: 2 14; opacity: 0; transition: opacity 0.5s; }
.swex-mind-head.is-resting .swex-mind-outlet { opacity: 1; animation: swex-mind-flow 1s linear infinite; }
.swex-mind-head.is-night .swex-mind-outlet { opacity: 1; stroke: var(--swex-accent); animation: swex-mind-flow 1s linear infinite; }
@keyframes swex-mind-flow { to { stroke-dashoffset: -16; } }
.swex-mind-head.is-resting .swex-mind-skin { stroke: var(--swex-mind-rem); stroke-width: 3.5; }
.swex-mind-eye, .swex-mind-mouth { fill: none; stroke: var(--swex-ink); stroke-width: 4; stroke-linecap: round; }
.swex-mind-eye { opacity: 0; transition: opacity 1.2s ease 0.4s; }
.swex-mind-mouth { opacity: 0.6; transition: stroke 1s ease, opacity 1s ease; }
.swex-mind-head.is-empty .swex-mind-eye { opacity: 0.75; }
.swex-mind-head.is-empty .swex-mind-mouth { opacity: 0.9; stroke: var(--swex-mind-rem); }
.swex-mind-layer { position: absolute; inset: 0; }
.swex-mind-rest { position: absolute; left: 0; right: 4%; top: 41%; text-align: center; font-weight: 900; font-size: clamp(26px, 11cqw, 72px); letter-spacing: 0.04em; color: var(--swex-mind-rem); opacity: 0; transform: scale(0.85); transition: opacity 1.4s ease, transform 1.4s ease; pointer-events: none; }
.swex-mind-head.is-empty .swex-mind-rest { opacity: 1; transform: none; }

/* Kaartjes: wat je meemaakt */
.swex-mind-brick {
	position: absolute;
	height: 4.93cqw;
	padding: 0 1.4cqw;
	border: 1px solid var(--swex-mind-line);
	border-radius: 7px;
	background: var(--swex-mind-brick);
	color: var(--swex-ink);
	box-shadow: 0 1px 2px rgba(30, 60, 80, 0.08);
	font-size: clamp(8.5px, 2cqw, 12.5px);
	font-weight: 700;
	line-height: 1;
	white-space: nowrap;
	display: flex;
	align-items: center;
	transform: rotate(var(--r, 0deg));
	transition: left 0.6s cubic-bezier(.25, 1.25, .5, 1), top 0.6s cubic-bezier(.25, 1.25, .5, 1), opacity 0.6s ease, transform 0.6s ease, background-color 1.2s ease, height 0.8s ease, font-size 0.8s ease;
}
.swex-mind-brick.is-week { background: var(--swex-mind-week); }
.swex-mind-brick.is-big { background: var(--swex-mind-big); font-weight: 800; border-color: color-mix(in srgb, var(--swex-mind-gas) 45%, var(--swex-mind-line)); }
/* Op de rem: alles voelt lichter en minder groot */
.swex-mind-head.is-resting .swex-mind-brick { height: 4.55cqw; font-size: clamp(8px, 1.8cqw, 11.5px); background: color-mix(in srgb, var(--swex-mind-brick) 55%, var(--swex-bg)); border-color: color-mix(in srgb, var(--swex-mind-rem) 25%, var(--swex-mind-line)); box-shadow: none; }
.swex-mind-head.is-resting .swex-mind-brick.is-week { background: color-mix(in srgb, var(--swex-mind-week) 50%, var(--swex-bg)); }
.swex-mind-head.is-resting .swex-mind-brick.is-big { background: color-mix(in srgb, var(--swex-mind-big) 60%, var(--swex-bg)); }
.swex-mind-head.ordered .swex-mind-brick { transform: none; }
/* Overzicht: kleiner, recht, met ruimte */
.swex-mind-head.calm .swex-mind-brick { height: 3.92cqw; padding: 0 1.25cqw; font-size: clamp(8px, 1.85cqw, 12px); font-weight: 700; transform: none; box-shadow: none; background: color-mix(in srgb, var(--swex-accent) 10%, var(--swex-surface, #fff)); border-color: color-mix(in srgb, var(--swex-mind-line) 60%, transparent); }
.swex-mind-head.calm .swex-mind-brick.is-week { background: color-mix(in srgb, var(--swex-mind-week) 70%, var(--swex-bg)); }
.swex-mind-head.calm .swex-mind-brick.is-big { background: color-mix(in srgb, var(--swex-mind-big) 70%, var(--swex-bg)); }
.swex-mind-brick.is-settled, .swex-mind-head.calm .swex-mind-brick.is-settled { height: 3.6cqw; padding: 0 1.25cqw; font-size: clamp(7.5px, 1.7cqw, 11px); font-weight: 700; opacity: 0.78; transform: none; box-shadow: none; background: color-mix(in srgb, var(--swex-mind-big) 45%, var(--swex-bg)); border-color: transparent; transition: left 2.4s ease, top 2.4s ease, opacity 2.4s ease, height 1.2s ease, font-size 1.2s ease, background-color 1.2s ease; }
.swex-mind-brick.is-out { opacity: 0; transform: translateY(30px) scale(0.6); }

/* Briefjes: wat je hebt aangeleerd */
.swex-mind-note {
	position: absolute;
	z-index: 2;
	width: 21%;
	padding: 1.6% 1.6% 1.8%;
	border-radius: 3px 3px 8px 3px;
	background: var(--swex-mind-note);
	color: var(--swex-mind-note-ink);
	box-shadow: 0 3px 8px rgba(80, 60, 10, 0.14);
	font-size: clamp(7.5px, 2.3cqw, 14.5px);
	font-weight: 800;
	line-height: 1.18;
	text-align: center;
	transform: rotate(var(--r, -4deg));
	transition: left 0.9s cubic-bezier(.4, 0, .2, 1), top 0.9s cubic-bezier(.4, 0, .2, 1), width 0.9s ease, transform 0.9s ease, opacity 0.6s ease, font-size 0.9s ease;
}
.swex-mind-note small { display: block; margin-bottom: 3px; font-size: 0.62em; font-weight: 900; letter-spacing: 0.1em; text-transform: uppercase; opacity: 0.85; }
.swex-mind-note.is-heard { background: var(--swex-mind-heard); }
.swex-mind-note.is-learned { background: var(--swex-mind-learned); }
.swex-mind-note::before { content: ""; position: absolute; top: -5px; left: 50%; width: 10px; height: 10px; margin-left: -5px; border-radius: 50%; background: var(--swex-mind-gas); box-shadow: inset -2px -2px 0 rgba(0, 0, 0, 0.18), 0 2px 3px rgba(0, 0, 0, 0.25); transition: opacity 0.4s; }
.swex-mind-note.is-in { opacity: 0; transform: translateY(-30px) rotate(var(--r, -4deg)); }
.swex-mind-note.is-pulse { animation: swex-mind-pulse 0.7s ease; }
@keyframes swex-mind-pulse { 40% { transform: rotate(var(--r, -4deg)) scale(1.12); } }
.swex-mind-head.is-resting .swex-mind-note { transform: rotate(var(--r, -4deg)) scale(0.9); box-shadow: 0 3px 8px rgba(80, 60, 10, 0.12); }
.swex-mind-head.ordered .swex-mind-note { transform: rotate(0deg) scale(0.92); }
.swex-mind-note.is-tidy { width: 17%; padding: 1% 1.2% 1.2%; transform: none !important; box-shadow: 0 2px 4px rgba(60, 50, 20, 0.12); font-size: clamp(7px, 1.95cqw, 12.5px); }
.swex-mind-note.is-tidy::before { opacity: 0; }

/* Status */
.swex-mind-flags { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 5px; margin-left: auto; }
/* Status staat in de archiefbalk; zolang er een status is, maakt de regel bij het archief plaats */
.swex-mind-drawer:has(.swex-mind-chip:not([hidden])) .swex-mind-front small { display: none; }
.swex-mind-chip { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 9px; border-radius: 999px; background: var(--swex-mind-rem); color: #fff; font-size: 12px; font-weight: 700; line-height: 1; }
.swex-mind-chip[hidden] { display: none; }
.swex-mind-chip.is-hyp { background: var(--swex-strong); }
.swex-mind-chip i { width: 7px; height: 7px; border-radius: 50%; background: #fff; animation: swex-mind-blink 1.4s ease-in-out infinite; }
@keyframes swex-mind-blink { 50% { opacity: 0.3; } }

/* Veilig archief: één strakke balk, wat erin gaat komt als labeltjes in dezelfde balk */
.swex-mind-drawer { display: grid; gap: 6px; min-height: 42px; align-content: center; padding: 7px 12px; border-radius: 12px; background: color-mix(in srgb, var(--swex-ink) 9%, var(--swex-bg)); border: 1px solid var(--swex-mind-line); }
.swex-mind-front { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 2px 12px; color: var(--swex-ink); }
.swex-mind-front strong { display: flex; align-items: center; gap: 8px; font-size: 13px; font-weight: 800; }
.swex-mind-front small { font-size: 12px; color: var(--swex-muted); }
.swex-mind-handle { width: 24px; height: 5px; border-radius: 5px; background: color-mix(in srgb, var(--swex-ink) 30%, transparent); }
.swex-mind-archive { display: flex; flex-wrap: wrap; gap: 4px; max-height: 50px; overflow: hidden; }
.swex-mind-archive:empty { display: none; }
.swex.is-measuring .swex-mind-archive { display: flex; min-height: 50px; }
.swex-mind-tab { padding: 3px 8px; border-radius: 999px; background: var(--swex-surface, #fff); color: var(--swex-muted); font-size: 11px; font-weight: 600; line-height: 1.3; animation: swex-mind-slide 0.5s ease; }
@keyframes swex-mind-slide { from { transform: translateY(6px); opacity: 0; } }

.swex-mind-fly { position: fixed; z-index: 99999; margin: 0; pointer-events: none; }

/* Knoppen (stap "zelf proberen") */
.swex .swex-mind-ctrl[hidden] { display: none; }
.swex .swex-mind-ctrl { display: flex; flex-wrap: wrap; gap: 8px; flex-basis: 100%; }
.swex .swex-mind-ctrl .swex-action { min-height: 38px; padding: 6px 14px; font-size: 14px; }
.swex .swex-mind-ctrl .swex-mind-replay { padding-inline: 6px; }
.swex[data-state="mind_build"]:not(.is-mind-done) .swex-mind-ctrl { display: none; }
.swex[data-state="mind_build"] .swex-mind-ctrl { animation: swex-mind-in 0.6s ease; }
.swex-mind-try { flex-basis: 100%; margin: 0; font-size: 13px; font-weight: 800; color: var(--swex-ink); }
/* Schuif en hartslag op één rij als het past */
.swex-has-mind .swex-balance { flex: 1 1 230px; padding: 8px 14px; }
.swex-has-mind .swex-meter { flex: 0 1 auto; padding: 6px 12px; }
.swex-has-mind .swex-spark { width: 48px; }
/* Smallere tekstkolom naast het hoofd: hartslag netjes houden */
.swex[data-mode="mind"] .swex-unit { white-space: nowrap; }
.swex[data-mode="mind"] .swex-meter { flex-wrap: wrap; row-gap: 2px; }
.swex .swex-mind-stim[aria-pressed="true"] { border-color: var(--swex-mind-rem); background: var(--swex-mind-rem); color: #fff; }
.swex.is-mind-full .swex-mind-ctrl .swex-action:not(.swex-mind-replay) { box-shadow: 0 0 0 3px color-mix(in srgb, var(--swex-mind-rem) 35%, transparent); }
.swex .swex-mind-replay { border-color: transparent; background: transparent; text-decoration: underline; font-weight: 600; }

/* Direct opbouwen zonder animatie */
.swex-mind.is-instant .swex-mind-brick, .swex-mind.is-instant .swex-mind-note { transition: none !important; }

@media (prefers-reduced-motion: reduce) {
	.swex-mind-brick, .swex-mind-note, .swex-mind-fill { transition: none !important; }
	.swex-mind-note.is-pulse, .swex-mind-tab, .swex-mind-outlet, .swex-mind-chip i { animation: none !important; }
}
