/*
 * Cookie CMP — banner + settings dialog (template-parts/global/cookie-consent.php).
 * Industrial Premium / Dark Enterprise: no bright colors, no glassmorphism,
 * no glow, hover only changes border/background (DESIGN.md).
 */

.cookie-consent__banner {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 60;
	background: var(--ark-surface-700);
	border-top: 1px solid var(--ark-border-medium);
	box-shadow: 0 -10px 30px rgba(0, 0, 0, 0.28);
}

.cookie-consent__banner[hidden] {
	display: none;
}

.cookie-consent__banner-inner {
	max-width: var(--ark-container-max);
	margin-inline: auto;
	padding: 20px var(--ark-container-pad) calc(20px + env(safe-area-inset-bottom, 0px));
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px 24px;
}

.cookie-consent__text {
	flex: 1 1 420px;
	margin: 0;
	color: var(--ark-text-secondary);
	font-size: 0.92rem;
	line-height: 1.55;
}

.cookie-consent__text a {
	color: var(--ark-text-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cookie-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
}

.cookie-consent__action {
	height: 42px;
	padding-inline: 18px;
	font-size: 0.88rem;
	white-space: nowrap;
}

.cookie-consent__backdrop {
	position: fixed;
	inset: 0;
	z-index: 70;
	background: rgba(5, 12, 18, 0.72);
}

.cookie-consent__backdrop[hidden] {
	display: none;
}

.cookie-consent__dialog {
	position: fixed;
	z-index: 80;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: min(520px, calc(100vw - 32px));
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	background: var(--ark-surface-700);
	border: 1px solid var(--ark-border-medium);
	border-radius: var(--ark-radius-lg);
	padding: 32px 28px;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.4);
}

.cookie-consent__dialog[hidden] {
	display: none;
}

.cookie-consent__dialog-close {
	position: absolute;
	top: 18px;
	right: 18px;
	width: 32px;
	height: 32px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: 1px solid var(--ark-border-soft);
	border-radius: var(--ark-radius-sm);
	color: var(--ark-text-secondary);
	cursor: pointer;
}

.cookie-consent__dialog-close:hover,
.cookie-consent__dialog-close:focus-visible {
	border-color: var(--ark-border-titanium);
	color: var(--ark-text-primary);
}

.cookie-consent__dialog-title {
	margin: 0 0 10px;
	font-size: 1.3rem;
	padding-right: 40px;
}

.cookie-consent__dialog-lead {
	margin: 0 0 24px;
	color: var(--ark-text-secondary);
	font-size: 0.92rem;
	line-height: 1.55;
}

.cookie-consent__dialog-lead a {
	color: var(--ark-text-primary);
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cookie-consent__category {
	padding: 16px 0;
	border-top: 1px solid var(--ark-border-soft);
}

.cookie-consent__category:last-of-type {
	border-bottom: 1px solid var(--ark-border-soft);
}

.cookie-consent__category-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
}

.cookie-consent__category-title {
	font-size: 0.98rem;
	font-weight: 600;
	color: var(--ark-text-primary);
}

.cookie-consent__category-state {
	font-size: 0.8rem;
	color: var(--ark-text-muted);
	white-space: nowrap;
}

.cookie-consent__category-text {
	margin: 8px 0 0;
	color: var(--ark-text-secondary);
	font-size: 0.85rem;
	line-height: 1.5;
}

/* Minimal accessible toggle — a real checkbox, visually styled; the input
   itself stays in the accessibility tree and keyboard-operable, never
   display:none. */
.cookie-consent__switch {
	position: relative;
	display: inline-flex;
	flex-shrink: 0;
	width: 42px;
	height: 24px;
}

.cookie-consent__switch input {
	position: absolute;
	inset: 0;
	margin: 0;
	opacity: 0;
	cursor: pointer;
}

.cookie-consent__switch-track {
	position: absolute;
	inset: 0;
	pointer-events: none; /* let every click reach the real checkbox beneath it */
	border-radius: 999px;
	background: var(--ark-bg-800);
	border: 1px solid var(--ark-border-medium);
	transition: background-color 150ms var(--ark-ease), border-color 150ms var(--ark-ease);
}

.cookie-consent__switch-track::before {
	content: "";
	position: absolute;
	top: 2px;
	left: 2px;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--ark-text-secondary);
	transition: transform 150ms var(--ark-ease), background-color 150ms var(--ark-ease);
}

.cookie-consent__switch input:checked + .cookie-consent__switch-track {
	border-color: var(--ark-border-titanium);
}

.cookie-consent__switch input:checked + .cookie-consent__switch-track::before {
	transform: translateX(18px);
	background: var(--ark-text-primary);
}

.cookie-consent__switch input:focus-visible + .cookie-consent__switch-track {
	outline: 2px solid var(--ark-border-titanium);
	outline-offset: 2px;
}

.cookie-consent__dialog-actions {
	margin-top: 24px;
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 10px;
}

/* Footer "Настройки cookie" — a plain-text button matching the existing
   .site-footer__legal link style, no redesign of the row it sits in. */
.site-footer__legal-button {
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	font: inherit;
	color: inherit;
	text-decoration: underline;
	text-underline-offset: 2px;
	cursor: pointer;
}

@media (max-width: 640px) {
	.cookie-consent__banner-inner {
		flex-direction: column;
		align-items: stretch;
	}

	.cookie-consent__actions {
		flex-direction: column;
	}

	.cookie-consent__action {
		width: 100%;
	}

	.cookie-consent__dialog {
		padding: 24px 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.cookie-consent__switch-track,
	.cookie-consent__switch-track::before {
		transition: none;
	}
}
