/*
 * nutriscrolls/settings-menu — the gear button and its panel in the site header. Tokens only, so light and dark mode
 * follow the theme. Where the block sits in the header (popover on desktop, full-width sheet under the header inside
 * .ns-header-actions) is decided in the theme's base.css; here is the popover default.
 *
 * Controls are native radio buttons (arrow keys, form semantics): the input is visually hidden, the "face" next to it
 * shows the pressed state from :checked and the focus ring from :focus-visible. Public Sans only; numbers tabular.
 */
.wp-block-nutriscrolls-settings-menu {
	flex: none;
	position: relative;
}

/* ---------- Button: 44 x 44, hover like the search icon button ---------- */
.ns-settings__button {
	align-items: center;
	background: transparent;
	border: 0;
	border-radius: var(--wp--custom--radius--md);
	box-sizing: border-box;
	color: var(--wp--preset--color--ink);
	cursor: pointer;
	display: inline-flex;
	height: 44px;
	justify-content: center;
	margin: 0;
	min-height: 44px;
	min-width: 44px;
	padding: 0;
	width: 44px;
}
.ns-settings__button:hover,
.ns-settings__button[aria-expanded="true"] {
	background: var(--wp--preset--color--surface-strong);
}
.ns-settings__button:focus-visible {
	outline: var(--wp--custom--border--focus) solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}
.ns-settings__icon {
	display: block;
	flex: none;
	height: 20px;
	width: 20px;
}

/* ---------- Panel ---------- */
.ns-settings__panel {
	background: var(--wp--preset--color--surface-raised);
	border: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
	border-radius: var(--wp--custom--radius--lg);
	box-shadow: var(--wp--preset--shadow--md);
	box-sizing: border-box;
	color: var(--wp--preset--color--ink);
	display: flex;
	flex-direction: column;
	font-family: var(--wp--preset--font-family--body);
	gap: var(--wp--preset--spacing--40);
	left: 0;
	max-height: calc(100vh - 96px);
	overflow-y: auto;
	padding: var(--wp--preset--spacing--40);
	position: absolute;
	top: calc(100% + 8px);
	width: min(320px, calc(100vw - 32px));
	z-index: 60;
}
.ns-settings__panel[hidden] {
	display: none;
}
/* Set by script when the panel would run past the right edge of the viewport. */
.ns-settings__panel.is-end {
	left: auto;
	right: 0;
}

.ns-settings__group {
	border: 0;
	margin: 0;
	min-width: 0;
	padding: 0;
}
.ns-settings__legend {
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--caption);
	font-weight: 600;
	line-height: var(--wp--custom--line-height--caption);
	margin: 0 0 var(--wp--preset--spacing--10);
	padding: 0;
}

/* ---------- Segmented radio group ---------- */
.ns-settings__seg {
	background: var(--wp--preset--color--surface-strong);
	border-radius: var(--wp--custom--radius--md);
	box-sizing: border-box;
	display: flex;
	gap: 2px;
	padding: var(--wp--preset--spacing--10);
}
.ns-settings__opt {
	cursor: pointer;
	display: block;
	flex: 1 1 0;
	margin: 0;
	min-width: 0;
	position: relative;
}
.ns-settings__face {
	align-items: center;
	border: var(--wp--custom--border--hairline) solid transparent;
	border-radius: var(--wp--custom--radius--sm);
	box-sizing: border-box;
	color: var(--wp--preset--color--ink-muted);
	display: flex;
	font-size: var(--wp--preset--font-size--label-small);
	font-weight: 600;
	gap: var(--wp--preset--spacing--10);
	height: 36px;
	justify-content: center;
	line-height: 1;
	padding: 0 var(--wp--preset--spacing--20);
	white-space: nowrap;
}
.ns-settings__opt:hover .ns-settings__face {
	color: var(--wp--preset--color--ink);
}
.ns-settings__input:checked + .ns-settings__face {
	background: var(--wp--preset--color--surface-raised);
	border-color: var(--wp--preset--color--line-strong);
	box-shadow: var(--wp--preset--shadow--sm);
	color: var(--wp--preset--color--ink);
}
.ns-settings__input:focus-visible + .ns-settings__face {
	outline: var(--wp--custom--border--focus) solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}
/* Gender symbols: 20 px, stroke in the sex-female / sex-male token (light values keep 3:1 on the menu surfaces); the label
   next to the symbol keeps the face's ink colour. */
.ns-settings__symbol {
	display: block;
	flex: none;
	height: 20px;
	width: 20px;
}
.ns-settings__symbol--female {
	color: var(--wp--preset--color--sex-female);
}
.ns-settings__symbol--male {
	color: var(--wp--preset--color--sex-male);
}
.ns-settings__hint {
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--caption);
	margin: var(--wp--preset--spacing--10) 0 0;
}

/* ---------- Age slider ---------- */
.ns-settings__age {
	align-items: center;
	display: flex;
	gap: var(--wp--preset--spacing--30);
}
.ns-settings__range {
	accent-color: var(--wp--preset--color--action);
	background: transparent;
	cursor: pointer;
	flex: 1 1 auto;
	height: 44px;
	margin: 0;
	min-width: 0;
}
.ns-settings__range:focus-visible {
	outline: var(--wp--custom--border--focus) solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}
.ns-settings__range.is-unset {
	opacity: 0.55;
}
/* No age chosen yet: hide the thumb so the slider does not look set at its starting value; a tap on the track sets it. */
.ns-settings__range.is-unset::-webkit-slider-thumb {
	opacity: 0;
}
.ns-settings__range.is-unset::-moz-range-thumb {
	opacity: 0;
}
.ns-settings__age-value {
	color: var(--wp--preset--color--ink);
	flex: none;
	font-variant-numeric: tabular-nums;
	font-weight: 600;
	min-width: 5.5em;
	text-align: end;
}
.ns-settings__range.is-unset + .ns-settings__age-value {
	color: var(--wp--preset--color--ink-muted);
	font-weight: 500;
}

/* ---------- Note, reset, privacy ---------- */
.ns-settings__note,
.ns-settings__privacy {
	color: var(--wp--preset--color--ink-muted);
	font-size: var(--wp--preset--font-size--caption);
	line-height: var(--wp--custom--line-height--caption);
	margin: 0;
}
.ns-settings__reset {
	align-items: center;
	align-self: flex-start;
	background: none;
	border: 0;
	border-radius: var(--wp--custom--radius--sm);
	color: var(--wp--preset--color--link-default);
	cursor: pointer;
	display: inline-flex;
	font-family: inherit;
	font-size: var(--wp--preset--font-size--label-small);
	font-weight: 600;
	margin: 0;
	min-height: 32px;
	padding: 0;
	text-decoration: underline;
	text-underline-offset: 0.2em;
}
.ns-settings__reset:hover {
	color: var(--wp--preset--color--link-hover);
}
.ns-settings__reset:focus-visible {
	outline: var(--wp--custom--border--focus) solid var(--wp--preset--color--focus);
	outline-offset: 2px;
}
.ns-settings__foot {
	border-top: var(--wp--custom--border--hairline) solid var(--wp--preset--color--line);
	display: flex;
	flex-direction: column;
	gap: var(--wp--preset--spacing--20);
	padding-top: var(--wp--preset--spacing--30);
}

@media (forced-colors: active) {
	.ns-settings__symbol {
		color: CanvasText;
	}
	.ns-settings__input:checked + .ns-settings__face {
		border-color: Highlight;
		outline: 2px solid Highlight;
	}
	.ns-settings__button:hover,
	.ns-settings__button[aria-expanded="true"] {
		outline: 2px solid Highlight;
	}
}
