/**
 * SAVAGEARS cookie consent — dark + gold, RTL, self-contained.
 *
 * Ships with the PLUGIN, so it must not depend on the theme's CSS variables:
 * every colour is declared locally with the brand values as the fallback.
 */

.sg-consent {
	--sgc-bg: #ffffff;
	--sgc-surface: #ffffff;
	--sgc-line: rgba(28, 23, 12, .14);
	--sgc-text: #1b1a15;
	--sgc-dim: #5e5b52;
	--sgc-accent: #e6b24c;
	--sgc-accent-ink: #7a5713;
	--sgc-on-accent: #17150f;
	font-family: "Heebo", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	direction: rtl;
}

/*
 * A class selector beats the UA's `[hidden] { display: none }`, so the rules
 * below (display:flex / display:grid) would keep a "hidden" element laid out —
 * an invisible full-screen panel that still swallowed every click on the bar.
 * Restore the intent explicitly.
 */
.sg-consent[hidden],
.sg-consent-bar[hidden],
.sg-consent-panel[hidden] { display: none !important; }

/* ---------- bottom bar ---------- */

.sg-consent-bar {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 99995;
	display: flex;
	flex-wrap: wrap;
	gap: 16px 24px;
	align-items: center;
	justify-content: space-between;
	padding: 16px clamp(16px, 4vw, 34px);
	background: var(--sgc-bg);
	border-top: 1px solid var(--sgc-line);
	box-shadow: 0 -16px 40px -26px rgba(56, 46, 22, .38);
	animation: sgc-rise .28s ease-out both;
}

@keyframes sgc-rise {
	from { transform: translateY(100%); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

.sg-consent-copy { flex: 1 1 380px; min-width: 0; }

.sg-consent-title {
	margin: 0 0 4px;
	font-size: 15px;
	font-weight: 800;
	color: var(--sgc-text);
	line-height: 1.3;
}

.sg-consent-desc {
	margin: 0;
	font-size: 13px;
	line-height: 1.6;
	color: var(--sgc-dim);
	max-width: 68ch;
}

.sg-consent-desc a { color: var(--sgc-accent-ink); text-decoration: underline; }

.sg-consent-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	flex: 0 0 auto;
}

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

.sg-consent-btn {
	appearance: none;
	border-radius: 9999px;
	padding: 11px 20px;
	font: inherit;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
	transition: transform .12s ease, background-color .18s ease, border-color .18s ease;
}

.sg-consent-btn:active { transform: scale(.97); }

.sg-consent-primary {
	background: var(--sgc-accent);
	color: var(--sgc-on-accent);
	border: 1px solid var(--sgc-accent);
	box-shadow: 0 12px 30px -16px var(--sgc-accent);
}

.sg-consent-primary:hover { background: #f0c25c; }

.sg-consent-ghost {
	background: transparent;
	color: var(--sgc-text);
	border: 1px solid var(--sgc-line);
}

.sg-consent-ghost:hover { border-color: rgba(28, 23, 12, .34); }

.sg-consent :focus-visible {
	outline: 2px solid var(--sgc-accent);
	outline-offset: 2px;
	border-radius: 6px;
}

/* ---------- preferences dialog ---------- */

.sg-consent-panel {
	position: fixed;
	inset: 0;
	z-index: 99996;
	display: grid;
	place-items: center;
	padding: 20px;
	background: rgba(30, 25, 14, .5);
	backdrop-filter: blur(3px);
}

.sg-consent-panel-inner {
	width: min(560px, 100%);
	max-height: min(86vh, 720px);
	overflow-y: auto;
	background: var(--sgc-surface);
	border: 1px solid var(--sgc-line);
	border-radius: 18px;
	padding: 22px clamp(18px, 3vw, 26px);
	color: var(--sgc-text);
	box-shadow: 0 40px 90px -44px rgba(56, 46, 22, .5);
}

.sg-consent-panel-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.sg-consent-panel-head h2 {
	margin: 0;
	font-size: 19px;
	font-weight: 800;
	color: var(--sgc-text);
}

.sg-consent-close {
	appearance: none;
	background: transparent;
	border: 1px solid var(--sgc-line);
	color: var(--sgc-dim);
	border-radius: 9999px;
	width: 32px;
	height: 32px;
	font-size: 14px;
	line-height: 1;
	cursor: pointer;
	flex: none;
}

.sg-consent-close:hover { color: var(--sgc-text); border-color: rgba(28, 23, 12, .34); }

/* ---------- categories ---------- */

.sg-consent-cat {
	border-top: 1px solid var(--sgc-line);
	padding: 16px 0 4px;
}

.sg-consent-cat-top {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 6px;
}

.sg-consent-cat-name {
	font-size: 15px;
	font-weight: 700;
	color: var(--sgc-text);
	cursor: pointer;
}

.sg-consent-cat p {
	margin: 0;
	font-size: 13px;
	line-height: 1.6;
	color: var(--sgc-dim);
}

.sg-consent-always {
	font-size: 12px;
	font-weight: 700;
	color: var(--sgc-accent-ink);
	background: rgba(230, 178, 76, .2);
	border-radius: 9999px;
	padding: 3px 10px;
	flex: none;
}

/* toggle */

.sg-consent-switch { position: relative; flex: none; display: inline-flex; cursor: pointer; }
.sg-consent-switch input { position: absolute; opacity: 0; width: 44px; height: 24px; margin: 0; cursor: pointer; }

.sg-consent-slider {
	width: 44px;
	height: 24px;
	border-radius: 9999px;
	background: rgba(28, 23, 12, .2);
	border: 1px solid var(--sgc-line);
	position: relative;
	transition: background-color .2s ease;
}

.sg-consent-slider::after {
	content: "";
	position: absolute;
	top: 2px;
	inset-inline-start: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: #fff;
	transition: transform .2s ease;
}

.sg-consent-switch input:checked + .sg-consent-slider { background: var(--sgc-accent); border-color: var(--sgc-accent); }
/* RTL: the knob travels toward the inline-end, i.e. leftwards */
.sg-consent-switch input:checked + .sg-consent-slider::after { transform: translateX(-20px); }
.sg-consent-switch input:focus-visible + .sg-consent-slider { outline: 2px solid var(--sgc-accent); outline-offset: 2px; }

.sg-consent-panel-actions {
	display: flex;
	gap: 8px;
	justify-content: flex-end;
	flex-wrap: wrap;
	border-top: 1px solid var(--sgc-line);
	margin-top: 16px;
	padding-top: 16px;
}

/* ---------- reopen link ---------- */

.sg-consent-reopen {
	appearance: none;
	background: none;
	border: none;
	padding: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	cursor: pointer;
	opacity: .8;
}

.sg-consent-reopen:hover { opacity: 1; }

/* ---------- keep clear of the accessibility button ---------- */
/* #sg-a11y is fixed at bottom:18px on the inline-start side (z-index 99990).
   While the bar is up it would sit underneath, so lift it above the bar. */
html.sg-consent-open #sg-a11y { bottom: 128px; transition: bottom .28s ease; }

@media (max-width: 760px) {
	.sg-consent-bar { gap: 12px; padding: 14px 16px; }
	.sg-consent-actions { width: 100%; }
	.sg-consent-btn { flex: 1 1 auto; padding: 11px 14px; }
	html.sg-consent-open #sg-a11y { bottom: 190px; }
}

@media (prefers-reduced-motion: reduce) {
	.sg-consent-bar { animation: none; }
	.sg-consent-btn,
	.sg-consent-slider,
	.sg-consent-slider::after,
	html.sg-consent-open #sg-a11y { transition: none; }
}
