/* MathsBox cookie consent — banner + policy modal
   Link from shared <head>: <link rel="stylesheet" href="…/cookie-consent.css"> */

:root {
	--mb-cookie-ink: #111827;
	--mb-cookie-muted: #6b7280;
	--mb-cookie-line: #e5e7eb;
}

.cookie-banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 80;
	display: flex;
	justify-content: flex-end;
	padding: 0 28px 28px;
	pointer-events: none;
}

.cookie-banner[hidden] { display: none; }

.cookie-card {
	pointer-events: auto;
	width: min(580px, 100%);
	background: #fff;
	border-radius: 16px;
	box-shadow: 0 10px 40px rgba(17, 24, 39, 0.14);
	padding: 18px 20px;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: 16px;
	transform: translateY(120%);
	opacity: 0;
	transition: transform 0.32s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.28s ease;
}

.cookie-banner.is-in .cookie-card {
	transform: translateY(0);
	opacity: 1;
}

.cookie-banner.is-out .cookie-card {
	transform: translateY(120%);
	opacity: 0;
}

.cookie-copy {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.cookie-head {
	display: flex;
	align-items: center;
	gap: 8px;
}

.cookie-icon {
	font-size: 1.15rem;
	line-height: 1;
}

.cookie-title {
	font-size: 1rem;
	font-weight: 700;
	color: #1f2937;
	letter-spacing: -0.01em;
	margin: 0;
}

.cookie-text {
	font-size: 0.9rem;
	line-height: 1.5;
	color: #6b7280;
	margin: 0;
}

.cookie-readmore {
	border: 0;
	background: none;
	padding: 0;
	font: inherit;
	color: #6b7280;
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cookie-readmore:hover { color: #111827; }

.cookie-foot-btns {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 8px;
	flex: 0 0 auto;
}

.cookie-reject,
.cookie-accept {
	border: 0;
	border-radius: 10px;
	padding: 10px 16px;
	font-size: 0.88rem;
	font-weight: 700;
	cursor: pointer;
	font-family: inherit;
	white-space: nowrap;
}

.cookie-reject {
	background: #f3f4f6;
	color: #9ca3af;
}

.cookie-reject:hover {
	background: #e5e7eb;
	color: #6b7280;
}

.cookie-accept {
	background: #111827;
	color: #fff;
}

.cookie-accept:hover { background: #000; }

.site-footer-link {
	border: 0;
	background: none;
	padding: 0;
	font-family: inherit;
	font-size: 0.86rem;
	font-weight: 600;
	color: var(--mb-cookie-muted);
	cursor: pointer;
	text-decoration: underline;
	text-underline-offset: 2px;
}

.site-footer-link:hover { color: var(--mb-cookie-ink); }

body.modal-open { overflow: hidden; }

.cookie-modal {
	position: fixed;
	inset: 0;
	z-index: 100;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.cookie-modal[hidden] { display: none; }

.cookie-modal-backdrop {
	position: absolute;
	inset: 0;
	border: 0;
	background: rgba(17, 24, 39, 0.45);
	cursor: pointer;
	opacity: 0;
	transition: opacity 0.22s ease;
}

.cookie-modal.is-in .cookie-modal-backdrop { opacity: 1; }

.cookie-modal-panel {
	position: relative;
	width: min(480px, 100%);
	max-height: min(88vh, 640px);
	overflow: auto;
	background: #fff;
	border-radius: 18px;
	box-shadow: 0 24px 64px rgba(17, 24, 39, 0.22);
	display: flex;
	flex-direction: column;
	transform: translateY(16px) scale(0.98);
	opacity: 0;
	transition: transform 0.22s cubic-bezier(0.22, 1, 0.36, 1), opacity 0.2s ease;
}

.cookie-modal.is-in .cookie-modal-panel {
	transform: translateY(0) scale(1);
	opacity: 1;
}

.cookie-modal-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 20px 12px;
	border-bottom: 1px solid var(--mb-cookie-line);
	flex: 0 0 auto;
}

.cookie-modal-head h2 {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	color: var(--mb-cookie-ink);
}

.cookie-modal-close {
	border: 0;
	background: #f3f4f6;
	width: 32px;
	height: 32px;
	border-radius: 999px;
	font-size: 1.25rem;
	line-height: 1;
	color: #6b7280;
	cursor: pointer;
	display: grid;
	place-items: center;
	font-family: inherit;
}

.cookie-modal-close:hover {
	background: #e5e7eb;
	color: #111827;
}

.cookie-modal-body {
	padding: 16px 20px 8px;
	font-size: 0.9rem;
	line-height: 1.55;
	color: var(--mb-cookie-muted);
}

.cookie-modal-body p + p { margin-top: 10px; }

.pref-list {
	display: flex;
	flex-direction: column;
	border: 1px solid var(--mb-cookie-line);
	border-radius: 14px;
	overflow: hidden;
	margin: 16px 0 8px;
}

.pref-row {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 14px;
	cursor: pointer;
	border-bottom: 1px solid var(--mb-cookie-line);
	background: #fff;
	user-select: none;
}

.pref-row:last-child { border-bottom: 0; }

.pref-row:hover { background: #fafbfc; }

.pref-row.is-locked { cursor: default; }

.pref-row.is-locked:hover { background: #fff; }

.pref-row input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
	width: 0;
	height: 0;
}

.pref-info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 3px;
}

.pref-name {
	font-size: 0.92rem;
	font-weight: 700;
	color: var(--mb-cookie-ink);
}

.pref-desc {
	font-size: 0.8rem;
	line-height: 1.4;
	color: var(--mb-cookie-muted);
}

.pref-toggle {
	width: 44px;
	height: 26px;
	border-radius: 999px;
	background: #e5e7eb;
	position: relative;
	flex: 0 0 auto;
	transition: background 0.15s ease;
}

.pref-toggle span {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0,0,0,0.15);
	transition: transform 0.15s ease;
}

.pref-toggle.is-on { background: #16a34a; }

.pref-toggle.is-on span { transform: translateX(18px); }

.pref-toggle.is-locked {
	background: #86efac;
	opacity: 0.85;
	cursor: default;
}

.pref-toggle.is-locked span { transform: translateX(18px); }

.cookie-modal-actions {
	display: flex;
	justify-content: flex-end;
	gap: 8px;
	padding: 12px 20px 18px;
	border-top: 1px solid var(--mb-cookie-line);
	flex: 0 0 auto;
}

@media (max-width: 560px) {
	.cookie-card {
		flex-direction: column;
		align-items: stretch;
		gap: 14px;
	}
	.cookie-foot-btns { width: 100%; }
	.cookie-foot-btns .cookie-reject,
	.cookie-foot-btns .cookie-accept { flex: 1; }
}

@media (max-width: 600px) {
	.cookie-modal-actions { flex-direction: column-reverse; }
	.cookie-modal-actions .cookie-reject,
	.cookie-modal-actions .cookie-accept { width: 100%; }
}
