/**
 * Cookie consent banner.
 *
 * Centred modal with a dark scrim. On first visit the page cannot scroll
 * until the user picks an option. Reopening via footer «Cookie-indstillinger»
 * uses the same centred UI but without scroll lock.
 */

html.stowly-cookie-locked,
html.stowly-cookie-locked body {
	overflow: hidden;
}

html.stowly-cookie-locked body {
	touch-action: none;
}

.stowly-cookie-scrim {
	position: fixed;
	inset: 0;
	/* Over page-loader popover (2147483000) when consent gate is active. */
	z-index: 2147483646;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	pointer-events: none;
	opacity: 0;
	transition: opacity .28s ease;
}

.stowly-cookie-scrim[data-stowly-cookie-open="1"] {
	opacity: 1;
	pointer-events: auto;
}

.stowly-cookie-scrim[hidden] {
	display: none !important;
}

.stowly-cookie-scrim__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(17, 17, 17, 0.62);
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

.stowly-cookie-scrim:not([data-stowly-cookie-blocking="1"]) .stowly-cookie-scrim__backdrop {
	background: rgba(17, 17, 17, 0.35);
}

.stowly-cookie {
	position: relative;
	z-index: 1;
	width: min(420px, calc(100vw - 32px));
	max-width: 420px;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow-y: auto;
	color: var(--stowly-color-ink);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	opacity: 0;
	transition: opacity .28s ease;
}

.stowly-cookie-scrim[data-stowly-cookie-open="1"] .stowly-cookie,
.stowly-cookie[data-stowly-cookie-open="1"] {
	opacity: 1;
}

.stowly-cookie__inner {
	background: #ffffff;
	border: 1px solid rgba(17, 17, 17, 0.08);
	border-radius: 18px;
	box-shadow: 0 24px 64px -28px rgba(17, 17, 17, 0.35), 0 8px 20px -16px rgba(17, 17, 17, 0.25);
	padding: 22px 22px 20px;
	backdrop-filter: blur(14px);
	-webkit-backdrop-filter: blur(14px);
}

.stowly-cookie__view[hidden] {
	display: none !important;
}

.stowly-cookie__title {
	margin: 0 0 8px;
	font-size: 17px;
	line-height: 1.3;
	font-weight: 700;
	letter-spacing: -0.015em;
	color: var(--stowly-color-ink, #111);
}

.stowly-cookie__text {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.55;
	color: var(--stowly-color-ink-soft, #555);
}

.stowly-cookie__text--muted {
	color: #777;
	margin-top: 4px;
}

.stowly-cookie__text a {
	color: var(--stowly-color-primary);
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 2px;
}

.stowly-cookie__text a:hover,
.stowly-cookie__text a:focus-visible {
	color: var(--stowly-color-primary-hover, #e61e4d);
	text-decoration-thickness: 2px;
}

.stowly-cookie__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 18px;
	justify-content: flex-end;
}

.stowly-cookie__btn {
	appearance: none;
	font: inherit;
	font-weight: 600;
	font-size: 13.5px;
	padding: 10px 16px;
	border-radius: 999px;
	cursor: pointer;
	transition: transform .15s ease, background-color .15s ease, box-shadow .2s ease, color .15s ease, border-color .15s ease;
	border: 1px solid transparent;
	line-height: 1;
}

.stowly-cookie__btn:focus-visible {
	outline: 2px solid var(--stowly-color-primary);
	outline-offset: 2px;
}

/* Lås tekstfarve — Astra's button:hover { color:#fff } gør ellers
   «Kun nødvendige», «Tilpas» og «Afvis valgfrie» usynlige. */
#stowly-cookie-scrim button.stowly-cookie__btn--ghost,
#stowly-cookie-scrim button.stowly-cookie__btn--ghost:hover,
#stowly-cookie-scrim button.stowly-cookie__btn--ghost:focus,
#stowly-cookie-scrim button.stowly-cookie__btn--ghost:focus-visible,
#stowly-cookie-scrim button.stowly-cookie__btn--ghost:active {
	color: var(--stowly-color-ink, #111) !important;
}

.stowly-cookie__btn--ghost {
	background: transparent;
	border-color: rgba(17, 17, 17, 0.14);
}

.stowly-cookie__btn--ghost:hover,
.stowly-cookie__btn--ghost:focus-visible {
	border-color: rgba(17, 17, 17, 0.28);
	background: rgba(17, 17, 17, 0.04);
}

.stowly-cookie__btn--primary {
	background: var(--stowly-color-primary);
	color: #fff;
	box-shadow: 0 10px 20px -10px rgba(var(--stowly-color-primary-rgb), 0.55);
}

.stowly-cookie__btn--primary:hover {
	color: #fff !important;
	transform: translateY(-1px);
	box-shadow: 0 14px 26px -10px rgba(var(--stowly-color-primary-rgb), 0.6);
	background: var(--stowly-color-primary-hover);
}

.stowly-cookie__back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin-bottom: 10px;
	background: none;
	border: 0;
	padding: 0;
	color: var(--stowly-color-ink-soft, #555);
	font: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
}

.stowly-cookie__back:hover {
	color: var(--stowly-color-primary);
}

.stowly-cookie__prefs {
	list-style: none;
	margin: 18px 0 0;
	padding: 0;
	display: grid;
	gap: 12px;
	max-height: min(50vh, 380px);
	overflow-y: auto;
	padding-right: 4px;
}

.stowly-cookie__pref {
	background: #fbfaf7;
	border: 1px solid rgba(17, 17, 17, 0.06);
	border-radius: 12px;
	padding: 12px 14px;
}

.stowly-cookie__pref-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.stowly-cookie__pref-title {
	font-size: 14px;
	font-weight: 700;
	color: var(--stowly-color-ink);
}

.stowly-cookie__pref-lock {
	font-size: 11.5px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.06em;
	color: #8a8a8a;
	background: rgba(17, 17, 17, 0.05);
	padding: 3px 8px;
	border-radius: 999px;
}

.stowly-cookie__pref-desc {
	margin: 6px 0 0;
	font-size: 12.5px;
	line-height: 1.5;
	color: #666;
}

/* Toggle switch */
.stowly-cookie__switch {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	cursor: pointer;
	user-select: none;
}

.stowly-cookie__switch input {
	position: absolute;
	opacity: 0;
	width: 1px;
	height: 1px;
	pointer-events: none;
}

.stowly-cookie__track {
	position: relative;
	width: 36px;
	height: 20px;
	border-radius: 999px;
	background: #dcdad5;
	transition: background-color .2s ease;
	flex-shrink: 0;
}

.stowly-cookie__thumb {
	position: absolute;
	top: 2px;
	left: 2px;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	background: #ffffff;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
	transition: transform .2s ease;
}

.stowly-cookie__switch input:checked ~ .stowly-cookie__track {
	background: var(--stowly-color-primary);
}

.stowly-cookie__switch input:checked ~ .stowly-cookie__track .stowly-cookie__thumb {
	transform: translateX(16px);
}

.stowly-cookie__switch input:focus-visible ~ .stowly-cookie__track {
	box-shadow: 0 0 0 3px rgba(var(--stowly-color-primary-rgb), 0.25);
}

/* Inline reopen trigger used on /cookies/ page */
.stowly-cookie-inline {
	margin: 24px 0;
}

/* Narrow viewports — stacked buttons */
@media (max-width: 560px) {
	.stowly-cookie-scrim {
		padding: 12px;
	}

	.stowly-cookie {
		width: 100%;
		max-width: none;
	}

	.stowly-cookie__inner {
		padding: 18px 18px 16px;
		border-radius: 16px;
	}

	.stowly-cookie__actions {
		justify-content: stretch;
	}

	.stowly-cookie__btn {
		flex: 1 1 auto;
		padding: 11px 14px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.stowly-cookie-scrim,
	.stowly-cookie,
	.stowly-cookie__btn,
	.stowly-cookie__thumb,
	.stowly-cookie__track {
		transition: none;
	}
}
