/**
 * 100K Cookie Consent — banner and preference panel.
 *
 * Colours come from the Signal theme's custom properties with hard-coded
 * fallbacks, so the banner matches the site when it is active and is still
 * legible if the plugin is ever used under a different theme.
 *
 * The three action buttons share one class with no variants. "Reject
 * Non-Essential" styled as a weaker option than "Accept All" is the dark
 * pattern the Cookie Policy appendix rules out, so there is deliberately no
 * primary-button style here to reach for.
 */

.k100cc {
	--k100cc-paper: var(--card, #160A28);
	--k100cc-ink: var(--ink, #E9E2F2);
	--k100cc-head: var(--head, #FFFFFF);
	--k100cc-muted: var(--muted, #9C8FB5);
	--k100cc-line: var(--line, #2C1A45);
	--k100cc-control: var(--control-line, #7A6E96);
	--k100cc-accent: var(--accent, #C77DFF);
	--k100cc-field: var(--field, #0D0518);
	--k100cc-radius: var(--r-sm, 14px);
	--k100cc-btn-radius: var(--r-btn, 10px);
	--k100cc-font: var(--body, ui-sans-serif, system-ui, -apple-system, sans-serif);
	--k100cc-mono: var(--mono, ui-monospace, Menlo, monospace);
}

.k100cc[hidden],
.k100cc [hidden] {
	display: none !important;
}

/* ------------------------------------------------------------ first layer */

.k100cc-bar {
	position: fixed;
	z-index: 99999;
	inset: auto 0 0 0;
	background: var(--k100cc-paper);
	border-top: 1px solid var(--k100cc-line);
	box-shadow: 0 -18px 48px rgba(0, 0, 0, .55);
	color: var(--k100cc-ink);
	font-family: var(--k100cc-font);
	font-size: 15px;
	line-height: 1.55;
}

.k100cc-bar-inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 18px 28px;
	max-width: var(--maxw, 1220px);
	margin: 0 auto;
	padding: 20px var(--gut, clamp(18px, 5vw, 56px));
}

.k100cc-copy {
	flex: 1 1 320px;
	min-width: 0;
}

.k100cc-title {
	margin: 0 0 6px;
	font-family: var(--display, var(--k100cc-font));
	font-weight: var(--dw3, 700);
	letter-spacing: var(--dls3, -.018em);
	font-size: 19px;
	line-height: 1.2;
	color: var(--k100cc-head);
}

.k100cc-body {
	margin: 0;
	color: var(--k100cc-ink);
}

.k100cc a {
	color: var(--k100cc-accent);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.k100cc-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	flex: 0 1 auto;
}

/* ------------------------------------------------------------ buttons */

.k100cc-btn {
	appearance: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px; /* Pointer target floor — WCAG 2.5.8. */
	padding: 11px 18px;
	font: inherit;
	font-weight: 600;
	font-size: 14.5px;
	line-height: 1.2;
	color: var(--k100cc-head);
	background: transparent;
	border: 1px solid var(--k100cc-control);
	border-radius: var(--k100cc-btn-radius);
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease, color .15s ease;
}

.k100cc-btn:hover {
	border-color: var(--k100cc-accent);
	color: var(--k100cc-accent);
	background: rgba(199, 125, 255, .08);
}

.k100cc-btn:focus-visible,
.k100cc-switch input:focus-visible + .k100cc-track,
.k100cc-close:focus-visible {
	outline: 2px solid var(--k100cc-accent);
	outline-offset: 2px;
}

/* ------------------------------------------------------------ second layer */

.k100cc-overlay {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: rgba(8, 2, 16, .72);
	overflow-y: auto;
}

.k100cc-panel {
	width: min(560px, 100%);
	max-height: calc(100vh - 40px);
	display: flex;
	flex-direction: column;
	background: var(--k100cc-paper);
	border: 1px solid var(--k100cc-line);
	border-radius: var(--k100cc-radius);
	box-shadow: var(--card-shadow, 0 18px 48px rgba(0, 0, 0, .55));
	color: var(--k100cc-ink);
	font-family: var(--k100cc-font);
	font-size: 15px;
	line-height: 1.55;
}

.k100cc-panel:focus {
	outline: none;
}

.k100cc-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 22px 14px;
	border-bottom: 1px solid var(--k100cc-line);
}

.k100cc-close {
	appearance: none;
	flex: none;
	width: 40px;
	height: 40px;
	font-size: 26px;
	line-height: 1;
	color: var(--k100cc-muted);
	background: transparent;
	border: 0;
	border-radius: var(--k100cc-btn-radius);
	cursor: pointer;
}

.k100cc-close:hover {
	color: var(--k100cc-head);
}

.k100cc-panel-body {
	padding: 6px 22px 18px;
	overflow-y: auto;
}

.k100cc-gpc {
	margin: 14px 0 0;
	padding: 11px 13px;
	font-size: 13.5px;
	color: var(--k100cc-ink);
	background: var(--note-bg, #1C0E30);
	border-left: 3px solid var(--k100cc-accent);
	border-radius: 0 var(--k100cc-btn-radius) var(--k100cc-btn-radius) 0;
}

.k100cc-cat {
	padding: 16px 0;
	border-bottom: 1px solid var(--k100cc-line);
}

.k100cc-cat-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.k100cc-cat-label {
	font-weight: 600;
	color: var(--k100cc-head);
}

.k100cc-always {
	font-family: var(--k100cc-mono);
	font-size: 11.5px;
	font-weight: 500;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--k100cc-muted);
}

.k100cc-cat-desc {
	margin: 6px 0 0;
	font-size: 14px;
	color: var(--k100cc-muted);
}

/* ------------------------------------------------------------ toggles */

.k100cc-switch {
	flex: none;
	position: relative;
	display: inline-flex;
	align-items: center;
	cursor: pointer;
}

/*
 * Kept in the accessibility tree and focusable — only visually replaced. It
 * sits above the drawn track so the pointer target is the control itself
 * rather than a decorative span that happens to be inside the label.
 */
.k100cc-switch input {
	position: absolute;
	z-index: 1;
	width: 44px;
	height: 26px;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.k100cc-track {
	display: block;
	width: 44px;
	height: 26px;
	padding: 3px;
	background: var(--track, #241338);
	border: 1px solid var(--k100cc-control);
	border-radius: 999px;
	transition: background-color .15s ease, border-color .15s ease;
}

.k100cc-thumb {
	display: block;
	width: 18px;
	height: 18px;
	background: var(--k100cc-muted);
	border-radius: 50%;
	transition: transform .15s ease, background-color .15s ease;
}

.k100cc-switch input:checked + .k100cc-track {
	background: var(--k100cc-accent);
	border-color: var(--k100cc-accent);
}

.k100cc-switch input:checked + .k100cc-track .k100cc-thumb {
	background: var(--btn-fg, #12021C);
	transform: translateX(18px);
}

.k100cc-switch input:disabled {
	cursor: not-allowed;
}

.k100cc-switch input:disabled + .k100cc-track {
	opacity: .5;
}

.k100cc-note {
	margin: 16px 0 0;
	font-size: 13px;
	color: var(--k100cc-muted);
}

.k100cc-links {
	display: flex;
	gap: 16px;
	margin: 12px 0 0;
	font-size: 13.5px;
}

.k100cc-panel-foot {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	padding: 16px 22px 20px;
	border-top: 1px solid var(--k100cc-line);
}

.k100cc-panel-foot .k100cc-btn {
	flex: 1 1 auto;
}

/* ------------------------------------------------------------ small screens */

@media (max-width: 782px) {
	.k100cc-bar-inner {
		padding: 18px;
	}

	.k100cc-actions {
		width: 100%;
	}

	.k100cc-actions .k100cc-btn {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.k100cc-btn,
	.k100cc-track,
	.k100cc-thumb {
		transition: none;
	}
}
