/* Ask 42CM chat — matches the 42 Change Makers theme tokens, with fallbacks. */
.a42 {
	--a42-green: var(--cm-green, #0F5132);
	--a42-leaf: var(--cm-leaf, #1E8E4A);
	--a42-mint: var(--cm-mint, #DDEFE2);
	--a42-sun: var(--cm-sun, #E5D43D);
	--a42-ink: var(--cm-ink, #15241B);
	--a42-muted: var(--cm-muted, #4A5A50);
	--a42-cream: var(--cm-cream, #FFFBEF);
	--a42-paper: var(--cm-paper, #FFFFFF);
	--a42-font: var(--cm-body, 'Nunito Sans', system-ui, -apple-system, 'Segoe UI', Arial, sans-serif);
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99990;
	font-family: var(--a42-font);
	color: var(--a42-ink);
	font-size: 15px;
	line-height: 1.45;
}
.a42 *, .a42 *::before, .a42 *::after { box-sizing: border-box; }

.a42-bubble {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	padding: 12px 18px;
	background: var(--a42-sun);
	color: var(--a42-ink);
	border: 2px solid var(--a42-ink);
	border-radius: 999px;
	box-shadow: 4px 4px 0 var(--a42-ink);
	font: 800 15px/1 var(--a42-font);
	cursor: pointer;
	transition: transform .12s ease, box-shadow .12s ease;
}
.a42-bubble:hover { transform: translate(-1px, -1px); box-shadow: 5px 5px 0 var(--a42-ink); }
.a42-bubble:active { transform: translate(2px, 2px); box-shadow: 2px 2px 0 var(--a42-ink); }
.a42-bubble:focus-visible, .a42 button:focus-visible, .a42 textarea:focus-visible { outline: 3px solid var(--a42-leaf); outline-offset: 2px; }
.a42-bubble svg { width: 20px; height: 20px; flex: none; }
.a42.is-open .a42-bubble { display: none; }

.a42-panel {
	display: none;
	flex-direction: column;
	width: min(380px, calc(100vw - 32px));
	height: min(580px, calc(100vh - 40px));
	height: min(580px, calc(100dvh - 40px));
	background: var(--a42-cream);
	border: 2px solid var(--a42-ink);
	border-radius: 16px;
	box-shadow: 5px 5px 0 var(--a42-ink);
	overflow: hidden;
}
.a42.is-open .a42-panel { display: flex; }

.a42-head {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	background: var(--a42-green);
	color: #fff;
	border-bottom: 2px solid var(--a42-ink);
}
.a42-head strong { font-size: 16px; flex: 1; }
.a42-head small { display: block; font-weight: 400; opacity: .85; font-size: 12px; }
.a42-icon-btn {
	background: transparent;
	border: 0;
	color: #fff;
	width: 32px;
	height: 32px;
	border-radius: 8px;
	cursor: pointer;
	display: grid;
	place-items: center;
}
.a42-icon-btn:hover { background: rgba(255,255,255,.15); }
.a42-icon-btn svg { width: 18px; height: 18px; }

.a42-log {
	flex: 1;
	overflow-y: auto;
	padding: 14px;
	display: flex;
	flex-direction: column;
	gap: 10px;
	overscroll-behavior: contain;
}
.a42-msg {
	max-width: 86%;
	padding: 9px 12px;
	border-radius: 14px;
	white-space: pre-wrap;
	overflow-wrap: anywhere;
}
.a42-msg.bot { background: var(--a42-paper); border: 1.5px solid var(--a42-ink); border-bottom-left-radius: 4px; align-self: flex-start; }
.a42-msg.me { background: var(--a42-mint); border: 1.5px solid var(--a42-green); border-bottom-right-radius: 4px; align-self: flex-end; }
.a42-msg a { color: var(--a42-green); font-weight: 700; text-decoration: underline; }
.a42-typing { display: inline-flex; gap: 4px; }
.a42-typing i { width: 7px; height: 7px; background: var(--a42-muted); border-radius: 50%; animation: a42b 1s infinite ease-in-out; }
.a42-typing i:nth-child(2) { animation-delay: .15s; }
.a42-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes a42b { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.a42-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.a42-chip {
	background: var(--a42-paper);
	border: 1.5px solid var(--a42-ink);
	border-radius: 999px;
	padding: 6px 11px;
	font: 600 13px/1.2 var(--a42-font);
	color: var(--a42-ink);
	cursor: pointer;
	text-align: left;
}
.a42-chip:hover { background: var(--a42-sun); }

.a42-foot { border-top: 2px solid var(--a42-ink); background: var(--a42-paper); padding: 10px; }
.a42-form { display: flex; gap: 8px; align-items: flex-end; }
.a42-form textarea {
	flex: 1;
	resize: none;
	min-height: 42px;
	max-height: 120px;
	padding: 10px 12px;
	border: 1.5px solid var(--a42-ink);
	border-radius: 10px;
	font: 15px/1.35 var(--a42-font);
	color: var(--a42-ink);
	background: #fff;
}
.a42-send {
	height: 42px;
	padding: 0 14px;
	background: var(--a42-green);
	color: #fff;
	border: 2px solid var(--a42-ink);
	border-radius: 10px;
	font: 800 14px/1 var(--a42-font);
	cursor: pointer;
}
.a42-send:disabled { opacity: .55; cursor: wait; }
.a42-row { display: flex; justify-content: space-between; align-items: center; margin-top: 8px; gap: 8px; }
.a42-donate {
	display: inline-block;
	background: var(--a42-sun);
	color: var(--a42-ink) !important;
	border: 1.5px solid var(--a42-ink);
	border-radius: 999px;
	padding: 5px 12px;
	font-weight: 800;
	font-size: 13px;
	white-space: nowrap;
	flex: none;
	text-decoration: none !important;
}
.a42-note { font-size: 11px; color: var(--a42-muted); }

@media (max-width: 480px) {
	.a42 { right: 12px; bottom: 12px; }
	.a42.is-open { right: 0; bottom: 0; left: 0; top: 0; }
	.a42.is-open .a42-panel { width: 100vw; height: 100vh; height: 100dvh; border-radius: 0; border: 0; box-shadow: none; }
	.a42-form textarea { font-size: 16px; } /* stops iOS zoom */
}
@media (prefers-reduced-motion: reduce) {
	.a42-bubble, .a42-typing i { transition: none; animation: none; }
}
@media print { .a42 { display: none; } }
