/**
 * Samtykkebanner — «Lun & leken».
 *
 * Tokens come from the child theme with literal fallbacks, so the banner still
 * looks right if it is ever rendered under a different theme.
 */

/* Must come first and must be !important: the display rules below are class
   selectors, which outrank the user-agent stylesheet's [hidden]{display:none}.
   Without this the banner is visible to everyone regardless of consent. */
.fb-cc[hidden],
.fb-cc-bar[hidden],
.fb-cc-panel[hidden],
.fb-cc-scrim[hidden],
.fb-cc-toast[hidden] {
	display: none !important;
}

.fb-cc-bar,
.fb-cc-panel {
	position: fixed;
	z-index: 99999;
	box-sizing: border-box;
	background: var(--fb-card, #FFFFFF);
	border: 1px solid var(--fb-line, #EDE3D1);
	border-radius: 16px;
	box-shadow: 0 14px 36px rgba(42, 35, 24, .15);
	font-family: "Nunito Sans", system-ui, sans-serif;
	color: var(--fb-body, #57503F);
}

.fb-cc-scrim {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(42, 35, 24, .34);
}

/* ---------- layer 1: the bar ---------- */

.fb-cc-bar {
	left: 24px;
	right: 24px;
	bottom: 24px;
	max-width: 1120px;
	margin: 0 auto;
	padding: 15px 22px;
	display: flex;
	align-items: center;
	gap: 20px;
}

.fb-cc-icon {
	width: 36px;
	height: 36px;
	flex: none;
	border-radius: 99px;
	background: var(--fb-selected, #EAF2ED);
	color: var(--fb-brand, #1F5B45);
	display: flex;
	align-items: center;
	justify-content: center;
}

.fb-cc-text { flex-grow: 1; min-width: 0; }

.fb-cc-text h2 {
	margin: 0 0 3px;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 17px;
	font-weight: 800;
	line-height: 1.25;
	letter-spacing: -.01em;
	color: var(--fb-brand-dark, #174434);
}

.fb-cc-text p {
	margin: 0;
	font-size: 13.5px;
	line-height: 1.5;
	color: var(--fb-body, #57503F);
}

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

.fb-cc-btn {
	flex: none;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 40px;
	padding: 0 20px;
	border-radius: 99px;
	border: 1.5px solid transparent;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 800;
	line-height: 1;
	cursor: pointer;
	white-space: nowrap;
	transition: background .15s;
}

.fb-cc-accept { background: var(--fb-brand, #1F5B45); color: #FFFDF6; }
.fb-cc-accept:hover { background: var(--fb-brand-dark, #174434); }

/* Reject is deliberately the same height, weight and footprint as accept —
   saying no has to be exactly as easy as saying yes. */
.fb-cc-reject { background: var(--fb-sand, #F3EBDC); border-color: #DFD2BA; color: var(--fb-brand-dark, #174434); }
.fb-cc-reject:hover { background: #EADFC9; }

.fb-cc-textbtn,
.fb-cc-reopen {
	background: none;
	border: 0;
	padding: 0;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 800;
	color: var(--fb-brand, #1F5B45);
	text-decoration: underline;
	text-underline-offset: 3px;
	cursor: pointer;
	white-space: nowrap;
}

.fb-cc-textbtn { flex: none; }
.fb-cc-textbtn:hover,
.fb-cc-reopen:hover { color: var(--fb-brand-dark, #174434); }

.fb-cc-reopen { color: inherit; font-size: inherit; }

.fb-cc-bar a,
.fb-cc-panel a {
	color: var(--fb-brand, #1F5B45);
	font-weight: 800;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* Flatsome ships svg { width: auto }, and an auto-width flex child is free to
   shrink — on production the close icon came out 0px wide and the back chevron
   6px. Pin every icon so no theme rule can squeeze it. */
.fb-cc svg,
.fb-cc-toast svg { flex: none; }
.fb-cc-icon svg { width: 19px; height: 19px; }
.fb-cc-back svg,
.fb-cc-x svg { width: 16px; height: 16px; }
.fb-cc-toast-icon svg { width: 20px; height: 20px; }

.fb-cc :focus-visible,
.fb-cc-reopen:focus-visible {
	outline: 2px solid var(--fb-brand, #1F5B45);
	outline-offset: 3px;
	border-radius: 4px;
}

.fb-cc h2:focus { outline: none; }

/* ---------- layer 2: the panel ---------- */

.fb-cc-panel {
	left: 24px;
	right: 24px;
	bottom: 24px;
	max-width: 1120px;
	margin: 0 auto;
	padding: 16px 24px 18px;
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 48px);
}

.fb-cc-panel-head {
	display: flex;
	align-items: center;
	gap: 14px;
	padding-bottom: 13px;
}

.fb-cc-panel-head h2 {
	margin: 0;
	font-family: "Bricolage Grotesque", system-ui, sans-serif;
	font-size: 18px;
	font-weight: 800;
	letter-spacing: -.01em;
	color: var(--fb-brand-dark, #174434);
}

.fb-cc-back {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: none;
	border: 0;
	padding: 0;
	font-family: inherit;
	font-size: 13px;
	font-weight: 800;
	color: var(--fb-brand, #1F5B45);
	cursor: pointer;
}

.fb-cc-x {
	width: 34px;
	height: 34px;
	margin-left: auto;
	border-radius: 99px;
	border: 1px solid var(--fb-line, #EDE3D1);
	background: #fff;
	color: var(--fb-body, #57503F);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
}

.fb-cc-x:hover { background: var(--fb-bg, #FBF7F1); color: var(--fb-ink, #2A2318); }

.fb-cc-rows { overflow-y: auto; }

.fb-cc-row {
	display: flex;
	align-items: center;
	gap: 24px;
	padding: 13px 0;
	border-top: 1px solid var(--fb-line, #EDE3D1);
}

.fb-cc-row-text { flex-grow: 1; }

.fb-cc-row-title {
	display: flex;
	align-items: center;
	gap: 9px;
	flex-wrap: wrap;
	margin-bottom: 5px;
}

.fb-cc-row-title label {
	font-size: 14.5px;
	font-weight: 800;
	color: var(--fb-ink, #2A2318);
	cursor: pointer;
	margin: 0;
}

.fb-cc-row-text p {
	margin: 0;
	font-size: 13px;
	line-height: 1.5;
	max-width: 720px;
	color: var(--fb-body, #57503F);
}

.fb-cc-chip {
	display: inline-block;
	background: var(--fb-bg, #FBF7F1);
	border: 1px solid var(--fb-line, #EDE3D1);
	border-radius: 7px;
	padding: 2px 8px;
	font-size: 11px;
	font-weight: 700;
	color: var(--fb-body, #57503F);
}

.fb-cc-row-ctl {
	flex: none;
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 10px;
	width: 118px;
}

.fb-cc-state {
	font-size: 11.5px;
	font-weight: 800;
	color: var(--fb-body, #57503F);
	white-space: nowrap;
}

/* ---------- the switch ---------- */

.fb-cc-sw {
	position: relative;
	display: inline-block;
	width: 48px;
	height: 28px;
	flex: none;
}

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

.fb-cc-sw i {
	position: absolute;
	inset: 0;
	border-radius: 99px;
	background: #DFD2BA;
	transition: background .15s;
	pointer-events: none;
}

.fb-cc-sw i::after {
	content: "";
	position: absolute;
	top: 3px;
	left: 3px;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: #fff;
	box-shadow: 0 1px 3px rgba(42, 35, 24, .28);
	transition: transform .15s;
}

.fb-cc-sw input:checked + i { background: var(--fb-brand, #1F5B45); }
.fb-cc-sw input:checked + i::after { transform: translateX(20px); }
.fb-cc-sw input:focus-visible + i { outline: 2px solid var(--fb-brand, #1F5B45); outline-offset: 3px; }
.fb-cc-sw input:disabled { cursor: default; }
.fb-cc-sw input:disabled + i { background: #7FA394; }

/* ---------- panel footer ---------- */

.fb-cc-panel-foot {
	display: flex;
	align-items: center;
	gap: 12px;
	padding-top: 15px;
	border-top: 1px solid var(--fb-line, #EDE3D1);
}

.fb-cc-policy { font-size: 13px; }
.fb-cc-spacer { flex-grow: 1; }

/* ---------- toast ---------- */

.fb-cc-toast {
	position: fixed;
	left: 24px;
	bottom: 24px;
	z-index: 99999;
	max-width: 420px;
	background: var(--fb-card, #FFFFFF);
	border: 1px solid var(--fb-line, #EDE3D1);
	border-radius: 16px;
	box-shadow: 0 12px 30px rgba(42, 35, 24, .13);
	padding: 14px 18px;
	display: flex;
	align-items: center;
	gap: 14px;
	font-family: "Nunito Sans", system-ui, sans-serif;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity .2s, transform .2s;
}

.fb-cc-toast.is-on { opacity: 1; transform: none; }

.fb-cc-toast-icon {
	width: 38px;
	height: 38px;
	flex: none;
	border-radius: 99px;
	background: var(--fb-selected, #EAF2ED);
	color: var(--fb-success, #2E9464);
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.fb-cc-toast-text { display: flex; flex-direction: column; gap: 3px; }
.fb-cc-toast-text strong { font-size: 14.5px; font-weight: 800; color: var(--fb-ink, #2A2318); }
.fb-cc-toast-text span { font-size: 13px; color: var(--fb-body, #57503F); }

/* ---------- mobile ---------- */

@media (max-width: 849px) {

	/* 78px clears .fb-bottom-nav, measured at 65px on production, with 13px of air;
	   keeps it off the home indicator on iPhone. */
	/* Wrapping flex, not grid: a two-column grid sized the two buttons from
	   their own columns (auto vs 1fr), which made «Kun nødvendige» roughly half
	   the width of «Godta alle». They have to be identical — saying no must be
	   exactly as easy as saying yes. flex-basis:0 on both is what guarantees it.
	   display:contents on .fb-cc-text lets the heading sit beside the paw while
	   the body text still takes a full line of its own. */
	.fb-cc-bar {
		left: 10px;
		right: 10px;
		bottom: calc(78px + env(safe-area-inset-bottom, 0px));
		padding: 14px 14px 10px;
		border-radius: 18px;
		display: flex;
		flex-wrap: wrap;
		align-items: center;
		gap: 10px;
	}

	.fb-cc-icon { width: 32px; height: 32px; }

	.fb-cc-text { display: contents; }
	/* basis 0, not auto: flex-basis:auto defers to the width property, and the
	   theme's h2 is full-width — so the heading claimed the whole line and the
	   paw was pushed onto a line of its own. */
	.fb-cc-text h2 { flex: 1 1 0; min-width: 0; width: auto; margin: 0; }
	.fb-cc-text p { flex: 1 0 100%; }

	.fb-cc-bar .fb-cc-btn {
		flex: 1 1 0;
		height: 46px;
		font-size: 14px;
		padding: 0;
	}

	.fb-cc-textbtn {
		order: 1;                 /* after the buttons, though it precedes them in the DOM */
		flex: 1 0 100%;
		min-height: 44px;
		display: inline-flex;
		align-items: center;
		font-size: 13px;
	}

	.fb-cc-panel {
		left: 0;
		right: 0;
		bottom: 0;
		top: auto;
		max-width: none;
		max-height: 78vh;
		border-radius: 20px 20px 0 0;
		border-left: 0;
		border-right: 0;
		border-bottom: 0;
		padding: 12px 14px calc(16px + env(safe-area-inset-bottom, 0px));
	}

	.fb-cc-row { gap: 12px; }
	.fb-cc-row-ctl { width: auto; flex-direction: column; gap: 4px; }
	.fb-cc-state { font-size: 10.5px; }
	.fb-cc-chip { display: none; }

	.fb-cc-panel-foot {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 9px;
	}

	.fb-cc-policy { grid-column: 1 / -1; min-height: 44px; display: inline-flex; align-items: center; }
	.fb-cc-spacer { display: none; }
	.fb-cc-panel-foot .fb-cc-btn { height: 46px; font-size: 14px; padding: 0; }
	.fb-cc-panel-foot .fb-cc-accept { grid-column: 1 / -1; }

	.fb-cc-toast { left: 10px; right: 10px; max-width: none; bottom: calc(78px + env(safe-area-inset-bottom, 0px)); }
}

@media (prefers-reduced-motion: reduce) {
	.fb-cc-btn, .fb-cc-sw i, .fb-cc-sw i::after, .fb-cc-toast { transition: none; }
}
