/* GEAR consent (WP-6): bottom-sheet banner, category switches, gated ad boxes,
   click-to-load embeds. Theme tokens only, so every style variation works. */

/* ---------- Footer link + ad boxes ---------- */
.gear-consent--off .gear-cookie-settings { display: none; }
/* Collapsed until advertising is granted. html.gear-consent-ads-ok is set by the
   inline head script from the cookie, so returning visitors see no layout jump. */
html:not(.gear-consent-ads-ok) .gear-consent--ads-pending .gear-ad:not(.gear-ad--placeholder) { display: none; }

/* ---------- Bottom sheet ---------- */
.gear-consent {
	position: fixed;
	inset-inline: 0;
	inset-block-end: 0;
	z-index: 9990;
	padding: 0 16px max(16px, env(safe-area-inset-bottom));
	pointer-events: none;
}
.gear-consent[hidden] { display: none; }

.gear-consent__card {
	pointer-events: auto;
	box-sizing: border-box;
	max-width: 720px;
	margin-inline: auto;
	padding: 24px 28px;
	background: var(--wp--preset--color--base);
	color: var(--wp--preset--color--body-text);
	border: 1px solid var(--wp--preset--color--border-color);
	border-radius: var(--gear-radius-lg, 16px);
	box-shadow: var(--gear-shadow-hover, 0 14px 32px rgb(0 0 0 / 15%));
	font-family: var(--wp--preset--font-family--inter, inherit);
	font-size: 0.9375rem;
	line-height: 1.5;
	max-height: calc(100vh - 32px);
	max-height: calc(100dvh - 32px);
	overflow: auto;
	animation: gear-consent-in .35s var(--gear-ease, ease) both;
}
@keyframes gear-consent-in {
	from { transform: translateY(24px); opacity: 0; }
	to   { transform: none; opacity: 1; }
}
@media (prefers-reduced-motion: reduce) {
	.gear-consent__card { animation: none; }
}

.gear-consent__title {
	margin: 0 0 .5rem;
	font-family: var(--wp--preset--font-family--barlow-condensed, inherit);
	font-weight: 700;
	font-size: 1.625rem;
	line-height: 1.1;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--wp--preset--color--heading);
}
/* The heading receives programmatic focus (tabindex=-1) so screen readers start
   there; it is not a control, so it needs no focus ring. */
.gear-consent__title:focus { outline: none; }
.gear-consent__text { margin: 0; }
.gear-consent__text p { margin: 0; }
.gear-consent__text a {
	color: var(--wp--preset--color--heading);
	text-decoration: underline;
	text-underline-offset: 3px;
	text-decoration-thickness: 1px;
}
.gear-consent__text a:hover { color: var(--wp--preset--color--primary); }

/* ---------- Actions ---------- */
.gear-consent__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	margin-block-start: 1.125rem;
}
.gear-consent__btn {
	flex: 1 1 140px;
	min-height: 44px;
	padding: 10px 16px;
	border: 1.5px solid var(--wp--preset--color--heading);
	border-radius: var(--gear-radius, 10px);
	background: transparent;
	color: var(--wp--preset--color--heading);
	font: inherit;
	font-weight: 600;
	letter-spacing: .2px;
	cursor: pointer;
	transition: background-color .2s var(--gear-ease, ease), color .2s var(--gear-ease, ease), border-color .2s var(--gear-ease, ease);
}
.gear-consent__btn:hover {
	background: var(--wp--preset--color--heading);
	color: var(--wp--preset--color--base);
}
.gear-consent__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}
.gear-consent__btn[hidden] { display: none; }
.gear-consent.is-expanded .gear-consent__btn--save { flex-basis: 100%; }
/* Expanded settings can outgrow short screens: keep the actions in view. */
.gear-consent.is-expanded .gear-consent__actions {
	position: sticky;
	inset-block-end: -24px;
	margin-block-end: -24px;
	padding-block: 12px 24px;
	background: var(--wp--preset--color--base);
	border-top: 1px solid var(--wp--preset--color--border-color);
}

/* ---------- Settings ---------- */
.gear-consent__settings {
	margin-block-start: 1.125rem;
	padding-block-start: 1rem;
	border-top: 1px solid var(--wp--preset--color--border-color);
}
.gear-consent__settings[hidden] { display: none; }
.gear-consent__categories {
	list-style: none;
	margin: 0;
	padding: 0;
}
.gear-consent__category + .gear-consent__category {
	border-top: 1px solid var(--wp--preset--color--border-color);
}
.gear-consent__toggle {
	display: flex;
	align-items: flex-start;
	gap: 14px;
	min-height: 44px;
	padding: 10px 0;
	cursor: pointer;
}
.gear-consent__toggle-text { flex: 1 1 auto; min-width: 0; }
.gear-consent__label {
	display: block;
	font-weight: 600;
	color: var(--wp--preset--color--heading);
}
.gear-consent__locked {
	display: inline-block;
	margin-inline-start: 6px;
	padding: 1px 8px;
	border-radius: var(--gear-radius-pill, 999px);
	background: var(--wp--preset--color--section-bg);
	font-size: .75rem;
	font-weight: 500;
	letter-spacing: .5px;
	text-transform: uppercase;
	color: var(--wp--preset--color--body-text);
}
.gear-consent__desc {
	display: block;
	font-size: .875rem;
	opacity: .85;
}
.gear-consent__note {
	margin: .75rem 0 0;
	font-size: .875rem;
	opacity: .85;
}

/* Switch: a plain checkbox drawn as a 44×24 track. */
.gear-consent__switch {
	appearance: none;
	-webkit-appearance: none;
	flex: 0 0 auto;
	position: relative;
	width: 44px;
	height: 24px;
	margin: 10px 0 0;
	border: 1.5px solid var(--wp--preset--color--border-color);
	border-radius: var(--gear-radius-pill, 999px);
	background: var(--wp--preset--color--section-bg);
	cursor: pointer;
	transition: background-color .2s var(--gear-ease, ease), border-color .2s var(--gear-ease, ease);
}
.gear-consent__switch::before {
	content: "";
	position: absolute;
	inset-block-start: 2px;
	inset-inline-start: 2px;
	width: 17px;
	height: 17px;
	border-radius: 50%;
	background: var(--wp--preset--color--heading);
	opacity: .55;
	transition: transform .2s var(--gear-ease, ease), opacity .2s var(--gear-ease, ease);
}
.gear-consent__switch:checked {
	background: var(--wp--preset--color--primary);
	border-color: var(--wp--preset--color--primary);
}
.gear-consent__switch:checked::before {
	transform: translateX(20px);
	background: var(--wp--preset--color--base);
	opacity: 1;
}
.gear-consent__switch:disabled {
	cursor: not-allowed;
	opacity: .6;
}
.gear-consent__switch:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}
@media (prefers-reduced-motion: reduce) {
	.gear-consent__switch,
	.gear-consent__switch::before,
	.gear-consent__btn { transition: none; }
}

@media (max-width: 600px) {
	.gear-consent { padding-inline: 8px; }
	.gear-consent__card { padding: 20px 18px; }
	.gear-consent__btn { flex-basis: 100%; }
	.gear-consent.is-expanded .gear-consent__actions { inset-block-end: -20px; margin-block-end: -20px; padding-block-end: 20px; }
	/* Expanded on a phone: Accept / Reject / Save side by side keeps the row short. */
	.gear-consent.is-expanded .gear-consent__btn { flex-basis: calc(50% - 5px); }
	.gear-consent.is-expanded .gear-consent__btn[data-gear-consent-action="settings"] { display: none; }
}

/* ---------- Click-to-load embeds ---------- */
.gear-embed-gate {
	box-sizing: border-box;
	display: grid;
	place-items: center;
	width: 100%;
	aspect-ratio: 16 / 9;
	padding: 24px;
	background: var(--wp--preset--color--section-bg);
	border: 1px solid var(--wp--preset--color--border-color);
	border-radius: var(--gear-radius-lg, 16px);
	color: var(--wp--preset--color--body-text);
	text-align: center;
}
/* Core's responsive-embed wrapper reserves 16:9 with a ::before spacer for the
   absolutely positioned iframe; the gate sizes itself, so drop the spacer. */
.wp-block-embed__wrapper:has(> .gear-embed-gate)::before { display: none; }
.gear-embed-gate__inner { max-width: 44ch; }
.gear-embed-gate__provider {
	margin: 0 0 .25rem;
	font-family: var(--wp--preset--font-family--barlow-condensed, inherit);
	font-weight: 700;
	font-size: 1.375rem;
	letter-spacing: 1px;
	text-transform: uppercase;
	color: var(--wp--preset--color--heading);
}
.gear-embed-gate__title {
	margin: 0 0 .5rem;
	font-weight: 600;
	color: var(--wp--preset--color--heading);
}
.gear-embed-gate__text {
	margin: 0 0 1rem;
	font-size: .9375rem;
}
.gear-embed-gate__btn {
	display: inline-block;
	min-height: 44px;
	padding: 10px 22px;
	border: 0;
	border-radius: var(--gear-radius, 10px);
	background: var(--wp--preset--color--primary);
	color: var(--wp--preset--color--base);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}
.gear-embed-gate__btn:hover { filter: brightness(1.08); }
.gear-embed-gate__btn:focus-visible {
	outline: 2px solid var(--wp--preset--color--primary);
	outline-offset: 3px;
}
.gear-embed-gate__link {
	display: inline-block;
	margin-inline-start: 12px;
	font-size: .9375rem;
	color: var(--wp--preset--color--heading);
}
@media (max-width: 600px) {
	.gear-embed-gate { padding: 16px; }
	.gear-embed-gate__text { font-size: .875rem; }
	.gear-embed-gate__link { display: block; margin: 10px 0 0; }
}

@media print {
	.gear-consent,
	.gear-embed-gate__btn,
	.gear-embed-gate__link { display: none !important; }
}
