/* Cookie banner and preferences dialog. Uses the tokens of app.css; works without Tailwind. */

.cc-banner {
	position: fixed;
	z-index: 90;
	left: 50%;
	bottom: 1rem;
	transform: translateX(-50%);
	width: min(60rem, calc(100% - 2rem));
	padding: 1.1rem 1.25rem;
	display: grid;
	gap: 0.35rem 1.5rem;
	grid-template-columns: 1fr auto;
	align-items: center;
	background: var(--surface);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 12px 40px rgb(15 23 42 / 0.25);
}

.cc-banner .cc-title { grid-column: 1; }
.cc-banner .cc-text { grid-column: 1; }
.cc-banner .cc-actions { grid-column: 2; grid-row: 1 / span 2; }

.cc-title { margin: 0; font-size: 1rem; font-weight: 700; }
.cc-text { margin: 0; color: var(--ink-2); font-size: 0.9rem; line-height: 1.5; }
.cc-text a { color: var(--brand); }

.cc-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

.cc-btn {
	padding: 0.55rem 0.95rem;
	border: 1px solid var(--line);
	border-radius: 0.6rem;
	background: var(--surface-2);
	color: var(--ink);
	font: inherit;
	font-size: 0.9rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
}

.cc-btn:hover { background: var(--line); }
.cc-btn-primary { background: var(--brand); border-color: var(--brand); color: var(--brand-ink); }
.cc-btn-primary:hover { background: var(--brand-hover); border-color: var(--brand-hover); }

.cc-overlay {
	position: fixed;
	inset: 0;
	z-index: 95;
	display: grid;
	place-items: center;
	padding: 1rem;
	background: rgb(2 6 23 / 0.6);
}

.cc-panel {
	position: relative;
	width: min(34rem, 100%);
	max-height: calc(100vh - 2rem);
	overflow-y: auto;
	display: grid;
	gap: 0.85rem;
	padding: 1.5rem;
	background: var(--surface);
	color: var(--ink);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: 0 20px 60px rgb(0 0 0 / 0.4);
}

.cc-close {
	position: absolute;
	top: 0.6rem;
	right: 0.75rem;
	width: 2rem;
	height: 2rem;
	border: 0;
	border-radius: 0.5rem;
	background: none;
	color: var(--muted);
	font-size: 1.5rem;
	line-height: 1;
	cursor: pointer;
}

.cc-close:hover { background: var(--surface-2); color: var(--ink); }

.cc-list { display: grid; gap: 0.6rem; }

.cc-item {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 1rem;
	padding: 0.85rem 1rem;
	border: 1px solid var(--line);
	border-radius: 0.7rem;
	background: var(--surface-2);
}

.cc-item-title { font-weight: 600; font-size: 0.95rem; cursor: pointer; }
.cc-item-desc { margin: 0.2rem 0 0; color: var(--muted); font-size: 0.85rem; line-height: 1.45; }

/* A native checkbox drawn as a switch. */
.cc-switch {
	appearance: none;
	flex: none;
	position: relative;
	width: 2.6rem;
	height: 1.5rem;
	margin: 0;
	border-radius: 999px;
	background: var(--line);
	cursor: pointer;
	transition: background-color 140ms;
}

.cc-switch::after {
	content: '';
	position: absolute;
	top: 0.2rem;
	left: 0.2rem;
	width: 1.1rem;
	height: 1.1rem;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 2px rgb(0 0 0 / 0.3);
	transition: transform 140ms;
}

.cc-switch:checked { background: var(--brand); }
.cc-switch:checked::after { transform: translateX(1.1rem); }
.cc-switch:disabled { opacity: 0.6; cursor: not-allowed; }
.cc-switch:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }

@media (max-width: 40rem) {
	.cc-banner { grid-template-columns: 1fr; bottom: 0.5rem; }
	.cc-banner .cc-actions { grid-column: 1; grid-row: auto; }
	.cc-banner .cc-btn { flex: 1 1 auto; }
}

@media (prefers-reduced-motion: reduce) {
	.cc-switch, .cc-switch::after { transition: none; }
}
