/* Math Tools – кутии за уроци.
   Цветовете идват от глобалните цветове на Elementor, ако са зададени
   (Site Settings → Global Colors), иначе се ползват стойностите след запетаята. */

:root {
	--mt-radius: 10px;
	--mt-text: var(--e-global-color-text, #1f2937);
	--mt-definition: var(--e-global-color-primary, #2563eb);
	--mt-formula: #7c3aed;
	--mt-example: #059669;
	--mt-mistake: #dc2626;
	--mt-tip: #d97706;
}

/* ---------- Формули ---------- */
.mt-display { display: block; text-align: center; }
.mt-display,
.katex-display {
	margin: 1.1em 0;
	overflow-x: auto;      /* дълги формули се скролват на телефон, вместо да чупят страницата */
	overflow-y: hidden;
	padding: 0.2em 0;
}
.katex { font-size: 1.12em; }

/* ---------- Кутии ---------- */
.mt-box {
	--mt-c: var(--mt-definition);
	position: relative;
	margin: 1.5em 0;
	padding: 1em 1.2em 1.05em;
	border: 1px solid color-mix(in srgb, var(--mt-c) 28%, transparent);
	border-left: 4px solid var(--mt-c);
	border-radius: var(--mt-radius);
	background: color-mix(in srgb, var(--mt-c) 6%, #fff);
	color: var(--mt-text);
}
.mt-formula  { --mt-c: var(--mt-formula); }
.mt-example  { --mt-c: var(--mt-example); }
.mt-mistake  { --mt-c: var(--mt-mistake); }
.mt-tip      { --mt-c: var(--mt-tip); }

.mt-box-title {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin-bottom: 0.55em;
	font-weight: 700;
	font-size: 0.95em;
	color: var(--mt-c);
}
.mt-box-icon {
	display: inline-grid;
	place-items: center;
	width: 1.6em;
	height: 1.6em;
	border-radius: 50%;
	background: var(--mt-c);
	color: #fff;
	font-size: 0.85em;
	line-height: 1;
}
.mt-box-body > :first-child { margin-top: 0; }
.mt-box-body > :last-child  { margin-bottom: 0; }

/* По-малко празно място около формулите в кутиите */
.mt-box-body p { margin: 0 0 0.6em; }
.mt-box-body p:empty { display: none; }
.mt-box .mt-display { margin: 0.35em 0; }
.mt-box-body p:has(> .mt-display:only-child) { margin: 0.2em 0; }

/* Формулата в кутия "Формула" – по-едра и центрирана */
.mt-formula .mt-display .katex,
.mt-formula .katex-display .katex { font-size: 1.3em; }

/* ---------- Скрито решение ---------- */
.mt-solution {
	margin: 1em 0 1.5em;
	border: 1px solid #d1d5db;
	border-radius: var(--mt-radius);
	background: #fff;
}
.mt-solution > summary {
	cursor: pointer;
	list-style: none;
	padding: 0.7em 1.1em;
	font-weight: 600;
	color: var(--mt-example);
	user-select: none;
}
.mt-solution > summary::-webkit-details-marker { display: none; }
.mt-solution > summary::before {
	content: "▸";
	display: inline-block;
	margin-right: 0.5em;
	transition: transform 0.15s ease;
}
.mt-solution[open] > summary::before { transform: rotate(90deg); }
.mt-solution[open] > summary { border-bottom: 1px solid #e5e7eb; }
.mt-solution-body { padding: 0.9em 1.1em; }
.mt-solution-body > :first-child { margin-top: 0; }
.mt-solution-body > :last-child  { margin-bottom: 0; }

/* Вложено решение в кутия "Пример" */
.mt-box .mt-solution { margin-bottom: 0; }

/* ---------- Телефон ---------- */
@media (max-width: 600px) {
	.mt-box { padding: 0.85em 0.9em; }
	.katex { font-size: 1.05em; }
}

/* ---------- Печат: решенията се виждат отворени ---------- */
@media print {
	.mt-solution > summary { display: none; }
	.mt-solution .mt-solution-body { display: block !important; }
	.mt-box { break-inside: avoid; background: none; }
}

/* ---------- Числова ос ---------- */
.mt-numline { display: block; max-width: 440px; margin: 0.6em auto; }
td .mt-numline { margin: 0; min-width: 220px; }

/* ---------- Чертежи с вектори ---------- */
.mt-vecfig { display: block; margin: 0.8em auto; height: auto; }

/* ---------- Графики ---------- */
.mt-plot { display: block; margin: 0.8em auto; height: auto; }
td .mt-plot { margin: 0 auto; }
