/* Cookie consent — banner, preferences dialog, click-to-load embeds.
 * Markup: includes/class-cookie-consent.php. Colours follow the theme's --nhl-* tokens. */

.nhl-consent,
.nhl-consent-prefs,
.nhl-consent-embed,
.nhl-consent__btn {
	--nhl-cc-primary: var(--nhl-primary, #005670);
	--nhl-cc-primary-dark: var(--nhl-primary-dark, #003d52);
	--nhl-cc-primary-light: var(--nhl-primary-light, #e6f3f7);
	--nhl-cc-text: var(--nhl-text, #1a1e26);
	--nhl-cc-muted: var(--nhl-text-muted, #5a6474);
	--nhl-cc-border: var(--nhl-border, #d0d8e4);
	--nhl-cc-bg: #ffffff;
	font-family: inherit;
	color: var(--nhl-cc-text);
	box-sizing: border-box;
}

.nhl-consent *,
.nhl-consent-prefs *,
.nhl-consent-embed * {
	box-sizing: inherit;
}

/* ---------- Buttons ---------- */

.nhl-consent__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 10px 20px;
	border: 2px solid var(--nhl-cc-primary);
	border-radius: 8px;
	background: var(--nhl-cc-bg);
	color: var(--nhl-cc-primary);
	font: inherit;
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	text-transform: none;
	letter-spacing: normal;
	box-shadow: none;
	cursor: pointer;
	transition: background-color .15s, color .15s, border-color .15s;
}

.nhl-consent__btn:hover {
	background: var(--nhl-cc-primary-light);
	color: var(--nhl-cc-primary-dark);
}

.nhl-consent__btn--primary {
	background: var(--nhl-cc-primary);
	color: #fff;
}

.nhl-consent__btn--primary:hover,
a.nhl-consent__btn--primary:hover {
	background: var(--nhl-cc-primary-dark);
	border-color: var(--nhl-cc-primary-dark);
	color: #fff;
}

.nhl-consent__btn--link,
.nhl-consent__btn--link:hover {
	border-color: transparent;
	background: transparent;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.nhl-consent__btn:focus-visible,
.nhl-consent a:focus-visible,
.nhl-consent-prefs a:focus-visible,
.nhl-consent-prefs summary:focus-visible,
.nhl-consent-switch:focus-visible,
.nhl-consent-embed a:focus-visible {
	outline: 3px solid #f2a900;
	outline-offset: 2px;
}

/* ---------- Banner ---------- */

.nhl-consent[hidden] {
	display: none !important;
}

.nhl-consent {
	position: fixed;
	right: 16px;
	bottom: 16px;
	left: 16px;
	z-index: 2147483000;
	max-width: 1180px;
	margin: 0 auto;
	padding: 20px 24px;
	border: 1px solid var(--nhl-cc-border);
	border-radius: 12px;
	background: var(--nhl-cc-bg);
	box-shadow: 0 10px 40px rgba(0, 30, 50, .22);
}

.nhl-consent__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 16px 32px;
}

.nhl-consent__text {
	flex: 1 1 420px;
	min-width: 0;
}

.nhl-consent__title {
	margin: 0 0 6px;
	color: var(--nhl-cc-primary);
	font-size: 18px;
	font-weight: 700;
	line-height: 1.3;
}

.nhl-consent__text p {
	margin: 0;
	font-size: 14px;
	line-height: 1.55;
}

.nhl-consent a {
	color: var(--nhl-cc-primary);
	font-weight: 600;
	text-decoration: underline;
}

.nhl-consent__actions {
	display: flex;
	flex: 0 1 auto;
	flex-wrap: wrap;
	gap: 10px;
}

@media (max-width: 640px) {
	.nhl-consent {
		right: 8px;
		bottom: 8px;
		left: 8px;
		max-height: calc(100vh - 16px);
		overflow-y: auto;
		padding: 16px;
	}

	.nhl-consent__actions {
		flex-direction: column;
		width: 100%;
	}

	.nhl-consent__actions .nhl-consent__btn {
		width: 100%;
	}

	/* Accept first, reject right under it, settings last. */
	.nhl-consent__actions [data-nhl-consent-action="accept"] { order: 1; }
	.nhl-consent__actions [data-nhl-consent-action="reject"] { order: 2; }
	.nhl-consent__actions [data-nhl-consent-action="manage"] { order: 3; }
}

/* ---------- Preferences dialog ---------- */

.nhl-consent-prefs {
	width: min(640px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	padding: 0;
	border: 0;
	border-radius: 12px;
	background: var(--nhl-cc-bg);
	box-shadow: 0 20px 60px rgba(0, 30, 50, .3);
}

.nhl-consent-prefs::backdrop {
	background: rgba(10, 25, 35, .55);
}

.nhl-consent-prefs[open] {
	display: flex;
	flex-direction: column;
}

.nhl-consent-prefs__form {
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 24px);
	margin: 0;
}

.nhl-consent-prefs__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 24px;
	border-bottom: 1px solid var(--nhl-cc-border);
}

.nhl-consent-prefs__head h2 {
	margin: 0;
	color: var(--nhl-cc-primary);
	font-size: 20px;
	line-height: 1.3;
}

.nhl-consent-prefs__close {
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: var(--nhl-cc-muted);
	font-size: 28px;
	line-height: 1;
	cursor: pointer;
}

.nhl-consent-prefs__close:hover {
	background: var(--nhl-cc-primary-light);
	color: var(--nhl-cc-text);
}

.nhl-consent-prefs__body {
	overflow-y: auto;
	padding: 16px 24px;
	font-size: 14px;
	line-height: 1.55;
}

.nhl-consent-prefs__body > p {
	margin: 0 0 12px;
}

.nhl-consent-prefs a {
	color: var(--nhl-cc-primary);
	font-weight: 600;
}

.nhl-consent-cat {
	padding: 14px 0;
	border-top: 1px solid var(--nhl-cc-border);
}

.nhl-consent-cat__head {
	display: flex;
	align-items: center;
	gap: 12px;
}

.nhl-consent-cat__label {
	flex: 1;
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
}

.nhl-consent-cat__always {
	color: var(--nhl-cc-muted);
	font-size: 13px;
	font-weight: 600;
}

.nhl-consent-cat__desc {
	margin: 6px 0 0;
	color: var(--nhl-cc-muted);
}

.nhl-consent-cat__details {
	margin-top: 8px;
}

.nhl-consent-cat__details summary {
	color: var(--nhl-cc-primary);
	font-weight: 600;
	cursor: pointer;
}

/* Toggle switch on a native checkbox (keyboard + screen-reader behaviour kept). */
.nhl-consent-switch {
	position: relative;
	flex: 0 0 auto;
	width: 46px;
	height: 26px;
	margin: 0;
	border-radius: 13px;
	background: #8a96a8;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
	transition: background-color .15s;
}

.nhl-consent-switch::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(0, 0, 0, .3);
	transition: transform .15s;
}

.nhl-consent-switch:checked {
	background: var(--nhl-cc-primary);
}

.nhl-consent-switch:checked::after {
	transform: translateX(20px);
}

.nhl-consent-switch:disabled {
	opacity: .55;
	cursor: not-allowed;
}

.nhl-consent-prefs__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
	padding: 16px 24px;
	border-top: 1px solid var(--nhl-cc-border);
}

@media (max-width: 520px) {
	.nhl-consent-prefs__actions .nhl-consent__btn {
		flex: 1 1 100%;
	}
}

/* ---------- Cookie tables (dialog + Cookie Policy page) ---------- */

.nhl-cookie-table-wrap {
	overflow-x: auto;
	margin: 8px 0 16px;
}

.nhl-cookie-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 13px;
	line-height: 1.45;
}

.nhl-cookie-table th,
.nhl-cookie-table td {
	padding: 8px 10px;
	border: 1px solid var(--nhl-border, #d0d8e4);
	text-align: left;
	vertical-align: top;
}

.nhl-cookie-table th {
	background: var(--nhl-primary-light, #e6f3f7);
	font-weight: 700;
}

.nhl-cookie-table code {
	font-size: 12px;
	word-break: break-word;
	white-space: normal;
}

/* ---------- Click-to-load embeds ---------- */

.nhl-consent-embed {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 300px;
	padding: 24px;
	border-radius: 12px;
	background: var(--nhl-cc-primary-light);
	text-align: center;
}

.nhl-consent-embed--video {
	min-height: 220px;
}

.nhl-consent-embed__notice {
	max-width: 460px;
}

.nhl-consent-embed__notice p {
	margin: 0 0 12px;
	font-size: 15px;
	line-height: 1.5;
}

.nhl-consent-embed__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 8px 16px;
}

.nhl-consent-embed a {
	color: var(--nhl-cc-primary);
	font-weight: 600;
}

.nhl-consent-embed__hint {
	font-size: 13px !important;
}

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

@media print {
	.nhl-consent,
	.nhl-consent-prefs {
		display: none !important;
	}
}
