/* ==========================================================================
   Cookie-samtykke
   ========================================================================== */

body.cookie-open {
	overflow: hidden;
}

.cookie-modal {
	position: fixed;
	inset: 0;
	z-index: 400;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.cookie-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(9, 32, 23, 0.72);
	-webkit-backdrop-filter: blur(7px);
	backdrop-filter: blur(7px);
}

.cookie-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: min(820px, 100%);
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	border: 1px solid rgba(255, 253, 248, 0.4);
	border-radius: 28px;
	background: var(--paper);
	box-shadow: 0 40px 100px -24px rgba(0, 0, 0, 0.55);
	opacity: 0;
	transform: translateY(14px) scale(0.985);
	transition: opacity 0.3s var(--ease), transform 0.3s var(--ease);
	outline: none;
	overflow: hidden;
}

.cookie-modal.is-open .cookie-modal__dialog {
	opacity: 1;
	transform: translateY(0) scale(1);
}

.cookie-modal__body {
	padding: 32px 34px 6px;
	overflow-y: auto;
	overscroll-behavior: contain;
}

.cookie-modal__kicker {
	margin: 0 0 8px;
	font-family: var(--font-mono);
	font-size: 0.64rem;
	font-weight: 500;
	letter-spacing: 0.14em;
	text-transform: uppercase;
	color: var(--green);
}

.cookie-modal__head h2 {
	margin: 0 0 14px;
	font-size: clamp(1.8rem, 3vw, 2.45rem);
	line-height: 1.02;
	letter-spacing: -0.045em;
	color: var(--ink);
}

.cookie-modal__head > p:last-child {
	margin: 0 0 16px;
	font-size: 0.93rem;
	line-height: 1.65;
	color: var(--muted);
}

.cookie-modal__text p {
	margin: 0 0 1em;
	font-size: 0.88rem;
	line-height: 1.68;
	color: var(--muted);
}

.cookie-links {
	display: grid;
	gap: 9px;
	margin: 18px 0 12px;
	padding-top: 16px;
	border-top: 1px solid var(--line);
}

.cookie-links a {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	font-size: 0.84rem;
	font-weight: 700;
	color: var(--green);
	text-decoration: underline;
	text-decoration-color: rgba(40, 93, 63, 0.32);
	text-underline-offset: 3px;
	transition: color 0.2s var(--ease), text-decoration-color 0.2s var(--ease);
}

.cookie-links a:hover {
	color: var(--forest);
	text-decoration-color: currentColor;
}

.cookie-links svg {
	flex: 0 0 auto;
}

/* Detaljer og kategorier */
.cookie-categories {
	margin: 18px 0 10px;
	padding-top: 18px;
	border-top: 1px solid var(--line);
	animation: cookie-details-in 0.25s var(--ease);
}

@keyframes cookie-details-in {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.cookie-categories__head {
	margin-bottom: 12px;
}

.cookie-categories__head p {
	margin: 5px 0 0;
	font-size: 0.76rem;
	line-height: 1.5;
	color: var(--muted);
}

.cookie-category-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 9px;
}

.cookie-category {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 14px;
	border: 1px solid var(--line);
	border-radius: 14px;
	background: var(--cream);
}

.cookie-category strong {
	display: block;
	font-size: 0.86rem;
	font-weight: 750;
	letter-spacing: -0.01em;
	color: var(--ink);
}

.cookie-category p {
	margin: 4px 0 0;
	font-size: 0.72rem;
	line-height: 1.45;
	color: var(--muted);
}

.cookie-switch {
	position: relative;
	display: inline-flex;
	flex: 0 0 48px;
	width: 48px;
	height: 28px;
	cursor: pointer;
}

.cookie-switch input {
	position: absolute;
	inset: 0;
	z-index: 2;
	width: 100%;
	height: 100%;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.cookie-switch__track {
	position: absolute;
	inset: 0;
	border-radius: 999px;
	background: #d5d0c3;
	transition: background 0.2s var(--ease), opacity 0.2s var(--ease);
}

.cookie-switch__track::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 2px 5px rgba(13, 36, 25, 0.22);
	transition: transform 0.2s var(--ease);
}

.cookie-switch input:checked + .cookie-switch__track {
	background: var(--green);
}

.cookie-switch input:checked + .cookie-switch__track::after {
	transform: translateX(20px);
}

.cookie-switch input:disabled + .cookie-switch__track {
	background: var(--green);
	opacity: 0.6;
}

.cookie-switch input:disabled,
.cookie-switch input:disabled + .cookie-switch__track {
	cursor: not-allowed;
}

.cookie-switch input:focus-visible + .cookie-switch__track {
	outline: 2px solid var(--lime-2);
	outline-offset: 3px;
}

/* Footer */
.cookie-modal__footer {
	flex: 0 0 auto;
	padding: 18px 34px 22px;
	border-top: 1px solid var(--line);
	background: var(--paper);
}

.cookie-modal__buttons {
	display: flex;
	align-items: center;
	gap: 12px;
}

.cookie-modal__buttons .btn {
	flex: 1;
}

.cookie-modal__buttons .btn--outline {
	background: var(--cream);
}

.cookie-modal__buttons .btn--dark {
	background: var(--forest);
}

.cookie-details-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	margin: 14px auto 0;
	padding: 2px;
	border: 0;
	background: transparent;
	font-family: var(--font-sans);
	font-size: 0.82rem;
	font-weight: 700;
	color: var(--ink);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
}

.cookie-details-toggle:hover {
	color: var(--green);
}

.cookie-details-toggle svg {
	transition: transform 0.2s var(--ease);
}

.cookie-details-toggle[aria-expanded="true"] svg {
	transform: rotate(180deg);
}

.cookie-save {
	margin-top: 12px;
}

/* Footer-link til at genåbne samtykket */
.site-footer__legal .link-button {
	padding: 0;
	border: 0;
	background: transparent;
	font-family: inherit;
	font-size: inherit;
	line-height: inherit;
	color: rgba(255, 253, 248, 0.56);
	cursor: pointer;
	transition: color 0.2s var(--ease);
}

.site-footer__legal .link-button:hover {
	color: var(--lime);
}

/* Mobil */
@media (max-width: 760px) {
	.cookie-modal {
		align-items: flex-end;
		padding: 10px;
	}

	.cookie-modal__dialog {
		max-height: calc(100vh - 20px);
		max-height: calc(100dvh - 20px);
		border-radius: 22px;
	}

	.cookie-modal__body {
		padding: 24px 20px 4px;
	}

	.cookie-modal__head h2 {
		font-size: 1.85rem;
	}

	.cookie-modal__head > p:last-child,
	.cookie-modal__text p {
		font-size: 0.86rem;
	}

	.cookie-modal__footer {
		padding: 15px 20px 18px;
	}

	.cookie-category-grid {
		grid-template-columns: 1fr;
	}

	.cookie-category {
		padding: 12px;
	}
}

@media (max-width: 430px) {
	.cookie-modal__buttons {
		flex-direction: column;
	}

	.cookie-modal__buttons .btn {
		width: 100%;
	}

	.cookie-details-toggle {
		margin-top: 12px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cookie-modal__dialog,
	.cookie-categories {
		animation: none;
		transition: none;
	}
}
