/* ═══════════════════════════════════════════════════════════════════════════
   COOKIE CONSENT — portable version
   Corner card, bottom-left. Becomes a bottom sheet under 640px.
   Self-contained: buttons, switches and colours are all in this file, and every
   class is prefixed .ce-cc so nothing clashes with the host site's styles.
   ═══════════════════════════════════════════════════════════════════════════ */

/* Sizes are in px, not rem: the live theme sets the root font size to 10px
   (62.5%), which shrank a rem-based banner on most pages. */

/* ── Colours and font: KPC brand (kpc-theme base/variables.css and the home
   page USP cards) ── */
.ce-cc {
	--cc-font:        'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Arial, sans-serif;
	--cc-bg:          #eef7f0;   /* KPC mint card */
	--cc-edge:        #d2eed4;   /* card border and dividers */
	--cc-heading:     #000000;   /* titles, outline buttons */
	--cc-text:        #000000;
	--cc-muted:       #6b6b6c;
	--cc-link:        #2e8c26;
	--cc-primary:     #3fa535;   /* KPC green: Accept all, Save */
	--cc-primary-dk:  #2e8c26;
	--cc-icon:        #2e8c26;
	--cc-switch-on:   #3fa535;
	--cc-switch-off:  #c9d3ca;
	--cc-focus:       #2e8c26;
	--cc-z:           1000002;   /* above a fixed header and the WP admin bar */
}

.ce-cc {
	position: fixed;
	z-index: var(--cc-z);
	left: 24px;
	bottom: 24px;
	width: min(400px, calc(100vw - 48px));
	box-sizing: border-box;
	background: var(--cc-bg);
	border: 1px solid var(--cc-edge);
	border-radius: 16px;
	padding: 21.6px 24px 24px;
	overflow: hidden;
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.65), 0 12px 40px rgba(0, 0, 0, 0.14);
	font-family: var(--cc-font);
	text-align: left;
}

.ce-cc *, .ce-cc *::before, .ce-cc *::after { box-sizing: border-box; }

.ce-cc[hidden] { display: none; }

/* Header: a green cookie the height of the title's line, beside it. */
.ce-cc__head {
	display: flex;
	align-items: center;
	gap: 8px;
	margin: 0 0 13.6px;
}

.ce-cc__icon {
	display: inline-flex;
	flex: 0 0 auto;
	color: var(--cc-icon);
}

.ce-cc__icon svg { width: 22px; height: 22px; }

.ce-cc > * { position: relative; z-index: 1; }

.ce-cc__title {
	font-size: 17px;
	font-weight: 700;
	letter-spacing: -0.01em;
	line-height: 1.3;
	margin: 0;
	color: var(--cc-heading);
}

.ce-cc__text {
	font-size: 15px;
	line-height: 1.6;
	color: var(--cc-text);
	margin: 0;
}

.ce-cc__text a { color: var(--cc-link); }

/* Visually hidden label for the switches (screen readers still read it). */
.ce-cc__sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ── Buttons ──
   Accept spans the full width on its own row; Reject and Customise share the
   row beneath. Both lower labels stay on one line, or the pills end up
   different heights. */
.ce-cc__actions {
	margin-top: 18.4px;
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 8.8px;
}

.ce-cc__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	margin: 0;
	font-family: var(--cc-font);
	font-size: 16px;
	font-weight: 400;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	white-space: nowrap;
	border: 2px solid transparent;
	border-radius: 9999px;
	box-shadow: none;
	padding: calc(12.8px - 2px) calc(16px - 2px);
	cursor: pointer;
	touch-action: manipulation;
	-webkit-tap-highlight-color: transparent;
	transition: background-color 0.18s ease, color 0.18s ease;
}

.ce-cc__btn:focus-visible {
	outline: 2px solid var(--cc-focus);
	outline-offset: 2px;
}

.ce-cc__btn--solid {
	background-color: var(--cc-primary);
	color: #fff;
}

.ce-cc__btn--ghost {
	background-color: transparent;
	color: var(--cc-heading);
	border-color: var(--cc-heading);
}

.ce-cc__btn--save {
	background-color: var(--cc-primary);
	color: #fff;
	padding-left: calc(25.6px - 2px);
	padding-right: calc(25.6px - 2px);
}

.ce-cc__accept {
	grid-column: 1 / -1;
	padding-left: calc(25.6px - 2px);
	padding-right: calc(25.6px - 2px);
}

/* Press feedback — colour change only. :active fires on touch too. */
.ce-cc__btn--solid:active { background-color: var(--cc-primary-dk); color: #fff; }
.ce-cc__btn--ghost:active { background-color: var(--cc-heading); color: #fff; }
.ce-cc__btn--save:active  { background-color: var(--cc-primary-dk); color: #fff; }

@media (hover: hover) and (pointer: fine) {
	.ce-cc__btn--solid:hover { background-color: var(--cc-primary-dk); color: #fff; }
	.ce-cc__btn--ghost:hover { background-color: var(--cc-heading); color: #fff; }
	.ce-cc__btn--save:hover  { background-color: var(--cc-primary-dk); color: #fff; }
}

/* ── Preferences panel ── */
.ce-cc__prefs {
	margin-top: 16.8px;
	border-top: 1px solid var(--cc-edge);
	padding-top: 14.4px;
	max-height: min(44vh, 380px);
	overflow: auto;
}

.ce-cc__prefs[hidden] { display: none; }

.ce-cc__row {
	display: flex;
	gap: 16px;
	align-items: flex-start;
	padding: 12.8px 0;
	border-bottom: 1px solid var(--cc-edge);
}

.ce-cc__row:last-child { border-bottom: 0; }
.ce-cc__row-body { flex: 1; min-width: 0; }

.ce-cc__row-name {
	font-size: 15.2px;
	font-weight: 700;
	line-height: 1.4;
	margin: 0 0 2.88px;
	color: var(--cc-heading);
}

.ce-cc__row-desc {
	font-size: 13.44px;
	line-height: 1.5;
	color: var(--cc-muted);
	margin: 0;
}

.ce-cc__prefs-note {
	font-size: 13.44px;
	line-height: 1.5;
	color: var(--cc-muted);
	margin: 14.4px 0 0;
}

.ce-cc__prefs-note a { color: var(--cc-link); }

.ce-cc__prefs-save { margin-top: 14.4px; }

/* ── Switch ── */
.ce-cc__sw {
	position: relative;
	flex: 0 0 auto;
	width: 44px;
	height: 25px;
	margin: 0;
}

.ce-cc__sw input {
	position: absolute;
	inset: 0;
	opacity: 0;
	width: 100%;
	height: 100%;
	margin: 0;
	cursor: pointer;
}

.ce-cc__sw-track {
	position: absolute;
	inset: 0;
	background: var(--cc-switch-off);
	border-radius: 9999px;
	transition: background-color 0.18s ease;
	pointer-events: none;
}

.ce-cc__sw-thumb {
	position: absolute;
	top: 3px;
	left: 3px;
	width: 19px;
	height: 19px;
	background: #fff;
	border-radius: 50%;
	transition: transform 0.18s ease;
	pointer-events: none;
	box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

.ce-cc__sw input:checked ~ .ce-cc__sw-track { background: var(--cc-switch-on); }
.ce-cc__sw input:checked ~ .ce-cc__sw-thumb { transform: translateX(19px); }
.ce-cc__sw input:focus-visible ~ .ce-cc__sw-track {
	outline: 2px solid var(--cc-focus);
	outline-offset: 2px;
}

/* Locked = on but not changeable; it has to look different from a switch the
   visitor controls. Carries :checked so it outranks the rule above. */
.ce-cc__sw--locked input:checked ~ .ce-cc__sw-track { background: #c3ccd2; }
.ce-cc__sw--locked .ce-cc__sw-thumb { background: #f2f5f6; }
.ce-cc__sw--locked input { cursor: not-allowed; }

/* ── Mobile: bottom sheet ── */
@media (max-width: 640px) {
	.ce-cc {
		left: 0;
		right: 0;
		bottom: 0;
		width: auto;
		border-width: 1px 0 0;
		border-radius: 16px 16px 0 0;
		padding: 20px 16px 24px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ce-cc__btn,
	.ce-cc__sw-track,
	.ce-cc__sw-thumb { transition: none; }
}
