/* Names Memorial — black and white only. */
.nm-hero {
	--nm-h: 90vh;
	--nm-font: inherit;
	position: relative;
	box-sizing: border-box;
	height: var(--nm-h);
	min-height: 520px;
	overflow: hidden;
	background: #000;
	color: #fff;
	font-family: var(--nm-font);
	isolation: isolate;
	touch-action: pan-y;
	-webkit-tap-highlight-color: transparent;
	cursor: crosshair;
}
.nm-hero *, .nm-hero *::before, .nm-hero *::after { box-sizing: border-box; }
.nm-hero.nm-full {
	width: 100vw;
	max-width: 100vw !important;
	margin-inline: calc(50% - 50vw) !important;
}
body:has(.nm-full) { overflow-x: clip; }

.nm-dots, .nm-words {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	display: block;
}
.nm-dots { image-rendering: pixelated; opacity: 0; transition: opacity 1.2s ease; }
.nm-hero.is-ready .nm-dots { opacity: 1; }
.nm-words { pointer-events: none; }

/* Soft vignette so the texts stay readable. */
.nm-hero::after {
	content: "";
	position: absolute;
	inset: 0;
	pointer-events: none;
	background:
		radial-gradient(ellipse 120% 90% at 50% 50%, transparent 55%, rgba(0, 0, 0, .65) 100%),
		linear-gradient(to top, rgba(0, 0, 0, .92) 0%, rgba(0, 0, 0, .55) 22%, transparent 48%);
	z-index: 1;
}

/* ---------- Hover ring + label ---------- */
.nm-ring {
	position: absolute;
	top: 0;
	left: 0;
	width: 26px;
	height: 26px;
	margin: -13px 0 0 -13px;
	border: 1px solid #fff;
	border-radius: 0;
	pointer-events: none;
	opacity: 0;
	transform: scale(.4) rotate(0deg);
	transition: opacity .2s ease, transform .25s cubic-bezier(.2, .8, .2, 1);
	z-index: 3;
	will-change: translate;
}
.nm-ring::after {
	content: "";
	position: absolute;
	inset: 9px;
	border-radius: 0;
	background: #fff;
	box-shadow: 0 0 12px 3px rgba(255, 255, 255, .8);
}
.nm-ring.is-on { opacity: 1; transform: scale(1); }
.nm-ring.is-pinned { animation: nm-pulse 2.4s ease-out infinite; }
@keyframes nm-pulse {
	0% { box-shadow: 0 0 0 0 rgba(255, 255, 255, .45); }
	70% { box-shadow: 0 0 0 18px rgba(255, 255, 255, 0); }
	100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0); }
}

.nm-tip {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 4;
	pointer-events: none;
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	max-width: min(80vw, 520px);
	padding: 8px 14px;
	text-align: center;
	white-space: nowrap;
	opacity: 0;
	filter: blur(6px);
	transform: translate(-50%, calc(-100% - 22px)) scale(.92);
	transition: opacity .22s ease, filter .3s ease, transform .3s cubic-bezier(.2, .8, .2, 1);
	will-change: translate;
}
.nm-tip.is-below { transform: translate(-50%, 22px) scale(.92); }
.nm-tip.is-on { opacity: 1; filter: none; transform: translate(-50%, calc(-100% - 22px)) scale(1); }
.nm-tip.is-below.is-on { transform: translate(-50%, 22px) scale(1); }
.nm-tip b {
	font-weight: 600;
	font-size: clamp(22px, 2.6vw, 34px);
	line-height: 1.2;
	letter-spacing: .01em;
	text-shadow: 0 0 18px #000, 0 0 4px #000;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 100%;
}
.nm-tip small {
	font-size: 13px;
	color: rgba(255, 255, 255, .62);
	letter-spacing: .04em;
	text-shadow: 0 0 10px #000;
}
.nm-tip small:empty { display: none; }

/* ---------- Title, counter, search ---------- */
.nm-overlay {
	position: absolute;
	inset-inline: 0;
	bottom: 0;
	z-index: 5;
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 28px;
	padding: 0 clamp(18px, 5vw, 72px) clamp(26px, 5vh, 56px);
	pointer-events: none;
}
.nm-head { max-width: 640px; text-align: start; }
.nm-count {
	margin: 0 0 6px;
	display: flex;
	align-items: baseline;
	gap: 12px;
	font-weight: 300;
	line-height: 1;
}
.nm-count-num {
	font-size: clamp(54px, 8vw, 112px);
	font-weight: 200;
	letter-spacing: -.03em;
	font-variant-numeric: tabular-nums;
	direction: ltr;
	unicode-bidi: isolate;
}
.nm-count-label { font-size: clamp(18px, 2vw, 26px); color: rgba(255, 255, 255, .7); }
.nm-title {
	margin: 0 0 10px;
	color: #fff;
	font-family: inherit;
	font-size: clamp(30px, 4.2vw, 56px);
	font-weight: 700;
	line-height: 1.12;
}
.nm-sub {
	margin: 0;
	color: rgba(255, 255, 255, .72);
	font-size: clamp(14px, 1.3vw, 18px);
	line-height: 1.7;
	max-width: 520px;
}

.nm-search {
	position: relative;
	flex: 0 1 380px;
	pointer-events: auto;
	cursor: auto;
}
.nm-search-icon {
	position: absolute;
	inset-inline-start: 18px;
	top: 50%;
	width: 20px;
	height: 20px;
	transform: translateY(-50%);
	color: rgba(255, 255, 255, .7);
	pointer-events: none;
}
.nm-hero .nm-search-input {
	width: 100%;
	height: 54px;
	margin: 0;
	padding: 0 50px !important;
	padding-inline-end: 18px !important;
	border: 1px solid rgba(255, 255, 255, .28) !important;
	border-radius: 999px !important;
	background: rgba(0, 0, 0, .55) !important;
	-webkit-backdrop-filter: blur(10px);
	backdrop-filter: blur(10px);
	color: #fff !important;
	font: inherit;
	font-size: 16px;
	box-shadow: none !important;
	outline: none !important;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .2s, background .2s, box-shadow .2s;
}
.nm-search-input::placeholder { color: rgba(255, 255, 255, .5); opacity: 1; }
.nm-search-input::-webkit-search-cancel-button { filter: invert(1); }
.nm-hero .nm-search-input:focus {
	border-color: #fff !important;
	background: rgba(0, 0, 0, .8) !important;
	box-shadow: 0 0 0 4px rgba(255, 255, 255, .12), 0 0 30px rgba(255, 255, 255, .12) !important;
}
.nm-suggest {
	position: absolute;
	inset-inline: 0;
	bottom: calc(100% + 10px);
	margin: 0;
	padding: 6px;
	list-style: none;
	max-height: min(50vh, 360px);
	overflow-y: auto;
	border: 1px solid rgba(255, 255, 255, .2);
	border-radius: 18px;
	background: rgba(0, 0, 0, .88);
	-webkit-backdrop-filter: blur(14px);
	backdrop-filter: blur(14px);
	scrollbar-width: thin;
}
.nm-suggest[hidden] { display: none; }
.nm-suggest li {
	margin: 0;
	padding: 9px 14px;
	border-radius: 12px;
	cursor: pointer;
	display: flex;
	flex-direction: column;
	gap: 1px;
	font-size: 15px;
	line-height: 1.4;
}
.nm-suggest li small { color: rgba(255, 255, 255, .5); font-size: 12px; }
.nm-suggest li[aria-selected="true"], .nm-suggest li:hover { background: rgba(255, 255, 255, .12); }
.nm-suggest li.is-none { color: rgba(255, 255, 255, .55); cursor: default; background: none; }
.nm-suggest mark { background: none; color: #fff; text-decoration: underline; text-underline-offset: 3px; }

/* ---------- Opened name ---------- */
.nm-card {
	position: absolute;
	top: clamp(20px, 7vh, 70px);
	inset-inline-end: clamp(18px, 5vw, 72px);
	z-index: 6;
	width: min(420px, calc(100% - 36px));
	padding: 26px 28px 24px;
	border: 1px solid rgba(255, 255, 255, .3);
	border-radius: 22px;
	background: rgba(0, 0, 0, .72);
	-webkit-backdrop-filter: blur(16px);
	backdrop-filter: blur(16px);
	text-align: start;
	cursor: auto;
	animation: nm-in .45s cubic-bezier(.2, .8, .2, 1);
}
.nm-card[hidden] { display: none; }
.nm-card.is-flip { inset-inline-end: auto; inset-inline-start: clamp(18px, 5vw, 72px); }
@keyframes nm-in { from { opacity: 0; transform: translateY(10px) scale(.97); filter: blur(6px); } }
.nm-card p { margin: 0; }
.nm-card-name { font-size: clamp(26px, 3vw, 38px); font-weight: 700; line-height: 1.25; padding-inline-end: 34px; }
.nm-card-second { margin-top: 6px !important; color: rgba(255, 255, 255, .65); font-size: 15px; letter-spacing: .02em; }
.nm-card-age { margin-top: 14px !important; padding-top: 14px; border-top: 1px solid rgba(255, 255, 255, .16); color: rgba(255, 255, 255, .8); font-size: 15px; }
.nm-card-second:empty, .nm-card-age:empty { display: none; }
.nm-card-close {
	position: absolute;
	top: 14px;
	inset-inline-end: 14px;
	width: 34px;
	height: 34px;
	padding: 6px;
	border: 1px solid rgba(255, 255, 255, .25);
	border-radius: 50%;
	background: transparent;
	color: #fff;
	cursor: pointer;
	transition: background .15s;
}
.nm-card-close:hover { background: rgba(255, 255, 255, .12); }
.nm-card-close svg { width: 100%; height: 100%; display: block; }

.nm-empty { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; z-index: 7; margin: 0; }
.nm-empty a { color: #fff; border: 1px solid #fff; padding: 10px 18px; border-radius: 999px; text-decoration: none; }

.nm-hero :focus-visible { outline: 2px solid #fff; outline-offset: 3px; }

/* ---------- Phones ---------- */
@media (max-width: 720px) {
	.nm-hero { min-height: 560px; cursor: default; }
	.nm-overlay { flex-direction: column; align-items: stretch; gap: 18px; padding: 0 16px 22px; }
	.nm-count { margin-bottom: 4px; }
	.nm-count-num { font-size: 56px; }
	.nm-title { font-size: 30px; margin-bottom: 6px; }
	.nm-sub { font-size: 14px; }
	.nm-search { flex: 0 0 auto; }
	.nm-hero .nm-search-input { height: 50px; }
	.nm-card { top: 16px; inset-inline: 16px; width: auto; padding: 22px 22px 20px; }
	.nm-tip b { font-size: 22px; }
}

@media (prefers-reduced-motion: reduce) {
	.nm-ring.is-pinned { animation: none; }
	.nm-tip, .nm-ring, .nm-card { transition: none; animation: none; }
}
