/**
 * "How are we related?" calculator -- [nfv_how_related].
 *
 * EVERY COLOUR HERE IS A TOKEN. The palette is defined in exactly one place, the :root{} block in
 * inc/chrome.php's nfv_shell_css() (NFV-071), and both applications read it: the webtrees export
 * hands those same inline rules to modules_v4/nfv-chrome, so /tree/ resolves the same custom
 * properties with no second copy to drift.
 *
 * inc/entry-point.php -- which is where this calculator used to live -- states its colours as raw
 * hex inside a heredoc <style> block. That is the thing this file deliberately does not do, and
 * the reason the markup ships with a real stylesheet instead of inline CSS.
 *
 * The 375 px bar is not decorative. verify/verify-tree.mjs asserts no horizontal overflow and a
 * 24 px minimum tap target on one page of each shape; controls here are 44 px so they clear it
 * with room rather than sitting on the line.
 */

.nfv-related {
	background: var(--nfv-surface);
	border: 1px solid var(--nfv-line);
	border-radius: 8px;
	padding: 1.5rem;
	margin: 2rem 0;
	font-family: var(--nfv-font-ui);
	color: var(--nfv-body);
}

.nfv-related-heading {
	font-family: var(--nfv-font-display);
	color: var(--nfv-ink);
	margin: 0 0 .35rem;
}

.nfv-related-intro {
	color: var(--nfv-muted);
	margin: 0 0 1.25rem;
}

/* Wraps rather than scrolls: at 375 px the three fields stack, which is what keeps the page free
   of horizontal overflow without a media query. */
.nfv-related-row {
	display: flex;
	flex-wrap: wrap;
	gap: 1rem;
	align-items: flex-end;
}

.nfv-related-field {
	flex: 1 1 220px;
	min-width: 0; /* Without this a flex item refuses to shrink below its content and overflows. */
	position: relative;
}

.nfv-related-field-action {
	flex: 0 0 auto;
}

.nfv-related-label {
	display: block;
	margin-bottom: .35rem;
	font-weight: 600;
	color: var(--nfv-ink);
}

.nfv-related-input {
	width: 100%;
	min-height: 44px;
	padding: .5rem .75rem;
	border: 1px solid var(--nfv-line);
	border-radius: 6px;
	background: var(--nfv-bg);
	color: var(--nfv-body);
	font: inherit;
}

.nfv-related-input:focus {
	outline: 2px solid var(--nfv-accent);
	outline-offset: 1px;
	border-color: var(--nfv-accent);
}

/* The listbox. Absolute so it overlays what follows instead of shoving the page down on every
   keystroke, which at 375 px reads as the layout jumping. */
.nfv-related-list {
	position: absolute;
	z-index: 20;
	left: 0;
	right: 0;
	top: 100%;
	margin: .25rem 0 0;
	padding: 0;
	list-style: none;
	max-height: 16rem;
	overflow-y: auto;
	background: var(--nfv-surface);
	border: 1px solid var(--nfv-line);
	border-radius: 6px;
	box-shadow: 0 4px 14px rgba(var(--nfv-accent-rgb), .12);
}

.nfv-related-option {
	min-height: 44px;
	display: flex;
	align-items: center;
	padding: .5rem .75rem;
	cursor: pointer;
	border-bottom: 1px solid var(--nfv-line-softest);
}

.nfv-related-option:last-child {
	border-bottom: 0;
}

.nfv-related-option:hover,
.nfv-related-option.is-active {
	background: var(--nfv-accent-tint);
	color: var(--nfv-ink);
}

.nfv-related-go {
	min-height: 44px;
	padding: .6rem 1.2rem;
	border: 0;
	border-radius: 6px;
	background: var(--nfv-accent);
	color: var(--nfv-surface);
	font: inherit;
	font-weight: 600;
	cursor: pointer;
}

.nfv-related-go:hover:not( :disabled ) {
	background: var(--nfv-accent-deep);
}

.nfv-related-go:disabled {
	background: var(--nfv-line);
	color: var(--nfv-muted);
	cursor: not-allowed;
}

.nfv-related-status,
.nfv-related-note {
	font-size: .85rem;
	color: var(--nfv-muted);
	margin: .5rem 0 0;
	min-height: 1.2em; /* Reserved so status text appearing does not nudge the row. */
}

.nfv-related-note:empty {
	display: none;
}
