/* =========================================================================
   Animated supplier verification.

   The lifecycle's construction: HTML cards over an inline SVG layer that
   carries everything drawn on — connectors, "+" nodes, chevrons and card
   borders — plus the progress panel, whose rows and ring complete in step
   with the cards.

   Positions are in the artwork's own 1020 x 574 units, turned into
   percentages; sizes are container units, where 1cqw is 10.2 artwork units,
   so the whole drawing scales as one piece.
   ========================================================================= */

.nsg {
	container-type: inline-size;
	width: 100%;
}

.nsg__stage {
	position: relative;
	width: 100%;
	aspect-ratio: var(--nsg-w) / var(--nsg-h);
	background: linear-gradient(to bottom, #fff 0%, #fefdfc 40%, #fcfaf7 100%);
	border-radius: 12px;
	overflow: hidden;
	isolation: isolate;
}

/*
 * The ground is a lattice of fine dashed diagonals, not flat: a diamond
 * 146.9 x 31.1 units, measured off the source, fading out towards the top
 * the way the artwork does.
 */
.nsg__stage::before {
	content: "";
	position: absolute;
	inset: 0;
	z-index: -1;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 146.9 31.1'%3E%3Cpath d='M0 0 146.9 31.1M0 31.1 146.9 0' fill='none' stroke='%23d8d2cb' stroke-width='.45' stroke-dasharray='1.6 1.6'/%3E%3C/svg%3E");
	background-size: 14.4cqw 3.05cqw;
	-webkit-mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.35) 30%, #000 70%);
	mask-image: linear-gradient(to bottom, transparent 0%, rgba(0, 0, 0, 0.35) 30%, #000 70%);
}

.nsg__wires,
.nsg__cards {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}

.nsg__cards {
	pointer-events: none;
}

/* ------------------------------------------------------------- The wires */

.nsg__wire {
	fill: none;
	stroke: #c7c1bb;
	stroke-width: 1.06;
	stroke-dasharray: 2.1 2.1;
	stroke-linecap: butt;
	stroke-linejoin: round;
}

/* The blue dashes, uncovered by their mask rather than by a dashoffset. */
.nsg__wire--live {
	stroke: #2a82e1;
}

/* The mask's own stroke: solid, wide enough to cover the dashes, drawn on. */
.nsg__reveal {
	fill: none;
	stroke: #fff;
	stroke-width: 6;
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
}

.nsg__head {
	fill: none;
	stroke: #c7c1bb;
	stroke-width: 1.06;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nsg__head--live {
	stroke: #2a82e1;
	opacity: 0;
}

.nsg__node circle {
	fill: #c7c1bb;
	transition: fill 240ms ease;
}

.nsg__node path {
	fill: none;
	stroke: #fff;
	stroke-width: 1.06;
	stroke-linecap: round;
}

/* Lit the moment the travelling line reaches it. */
.nsg__node.is-lit circle {
	fill: #2a82e1;
}

/* ----------------------------------------------------------- The borders */

/* The base border carries the card's white fill — see the lifecycle for why
   the fill lives here and not on the card element. */
.nsg__border {
	fill: #fff;
	stroke: #e4e4e4;
	stroke-width: 1.06;
}

/* The score card is outlined green from the start: it is the outcome. */
.nsg__border.is-final {
	stroke: #8fdba1;
}

/* No shared class with .nsg__border, or its CSS stroke would beat the
   gradient set as a presentation attribute. */
.nsg__border--live {
	fill: none;
	stroke-width: 1.15;
	stroke-dasharray: 1;
	stroke-dashoffset: 1;
}

/* ------------------------------------------------------------- The cards */

/*
 * Card interior, measured off the source at 3840px:
 *
 *   padding 12.75   icon 21.25 square, radius 4.8   title 8.9, 8.5 off the icon
 *   select  21.8 tall, 6.1 below the icon row, radius 5.9
 *   tag     14.3 tall, 6.4 below the select     badge 10.6 across, inset 8.5
 */
.nsg__card {
	position: absolute;
	left: calc(var(--x) / var(--nsg-w, 1020) * 100%);
	top: calc(var(--y) / var(--nsg-h, 574) * 100%);
	width: calc(159.375 / var(--nsg-w, 1020) * 100%);
	height: calc(95.6 / var(--nsg-h, 574) * 100%);
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	padding: 1.25cqw;
	box-sizing: border-box;
	font-family: "TWK Everett", -apple-system, BlinkMacSystemFont, sans-serif;
}

.nsg__top {
	display: flex;
	align-items: center;
	gap: 0.83cqw;
	width: 100%;
	padding-right: 0.9cqw;
	box-sizing: border-box;
}

.nsg__icon {
	flex: none;
	display: grid;
	place-items: center;
	width: 2.08cqw;
	height: 2.08cqw;
	border-radius: 0.47cqw;
}

.nsg__icon--blue  { background: #5f9beb; }
.nsg__icon--green { background: #77d48c; }

.nsg__glyph {
	width: 64%;
	height: 64%;
	fill: none;
	stroke: #fff;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nsg__title {
	min-width: 0;
	font-size: 0.87cqw;
	font-weight: 500;
	line-height: 1.2;
	letter-spacing: -0.005em;
	color: #13131a;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.nsg__select {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	height: 2.14cqw;
	margin-top: 0.6cqw;
	padding: 0 0.68cqw;
	box-sizing: border-box;
	border: 0.1cqw solid #dbdbdb;
	border-radius: 0.58cqw;
	font-size: 0.72cqw;
	color: #63636b;
	white-space: nowrap;
}

.nsg__select svg {
	flex: none;
	width: 0.9cqw;
	height: 0.9cqw;
	fill: none;
	stroke: #13131a;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* The score card says what it does in place of a dropdown. */
.nsg__body {
	min-height: 2.14cqw;
	margin-top: 0.55cqw;
	font-size: 0.76cqw;
	font-weight: 300;
	line-height: 1.22;
	letter-spacing: -0.005em;
	color: #55555c;
}

.nsg__tag {
	margin-top: 0.63cqw;
	height: 1.4cqw;
	display: inline-flex;
	align-items: center;
	padding: 0 0.42cqw;
	border-radius: 0.31cqw;
	background: #f4f4f5;
	font-size: 0.68cqw;
	line-height: 1;
	color: #6e6e76;
	white-space: nowrap;
}

.nsg__tag.is-caps {
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

/* The badge: a number while pending, a check once the card has verified. */
.nsg__badge {
	position: absolute;
	top: 0.83cqw;
	right: 0.83cqw;
	width: 1.04cqw;
	height: 1.04cqw;
}

.nsg__num {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	border: 0.1cqw solid #cfcfd3;
	border-radius: 50%;
	box-sizing: border-box;
	background: #fff;
	font-size: 0.6cqw;
	line-height: 1;
	color: #8a8a92;
	transition: opacity 160ms ease;
}

.nsg__check {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	border-radius: 50%;
	background: linear-gradient(135deg, #3b82f6, #7c5ce6);
	transform: scale(0);
}

.nsg__card.is-final .nsg__check {
	background: linear-gradient(135deg, #34c759, #1f9d47);
}

.nsg__check svg {
	width: 62%;
	height: 62%;
	fill: none;
	stroke: #fff;
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nsg__check.is-in {
	animation: nsg-badge 300ms cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

.nsg__card.is-done .nsg__num {
	opacity: 0;
}

/* ------------------------------------------------------------ The panel */

/*
 * Measured off the source: 258.5 x 276 at (67.2, 55.8), radius 20; the ring
 * 32.5 across with a 3.2 stroke; rows 29 tall on a 35.1 pitch, 10.4 in from
 * either side.
 */
.nsg__panel {
	position: absolute;
	left: calc(67.2 / var(--nsg-w, 1020) * 100%);
	top: calc(55.8 / var(--nsg-h, 574) * 100%);
	width: calc(258.5 / var(--nsg-w, 1020) * 100%);
	height: calc(276 / var(--nsg-h, 574) * 100%);
	padding: 1.06cqw 1.02cqw 1.13cqw;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	background: #fff;
	border: 0.1cqw solid #e6e6e6;
	border-radius: 1.96cqw;
	box-shadow: 0 0.5cqw 1.4cqw rgba(19, 19, 26, 0.08), 0 0.1cqw 0.3cqw rgba(19, 19, 26, 0.04);
	font-family: "TWK Everett", -apple-system, BlinkMacSystemFont, sans-serif;
}

.nsg__head {
	display: flex;
	align-items: center;
	gap: 0.8cqw;
	padding-right: 0.6cqw;
	margin-bottom: 1.63cqw;
}

.nsg__ring {
	position: relative;
	flex: none;
	width: 3.19cqw;
	height: 3.19cqw;
}

.nsg__ring svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.nsg__ring circle {
	fill: none;
	stroke-width: 3.5;
}

.nsg__ring-track {
	stroke: #f4f4f5;
}

.nsg__ring-bar {
	stroke: #347ee5;
	stroke-linecap: round;
	stroke-dasharray: 100;
	stroke-dashoffset: 100;
}

.nsg__pct {
	position: absolute;
	inset: 0;
	display: grid;
	place-items: center;
	font-size: 0.82cqw;
	font-weight: 500;
	letter-spacing: -0.01em;
	color: #13131a;
	font-variant-numeric: tabular-nums;
}

.nsg__heading {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 0.12cqw;
}

.nsg__heading-title {
	font-size: 1cqw;
	font-weight: 500;
	line-height: 1.2;
	color: #13131a;
	white-space: nowrap;
}

.nsg__heading-sub {
	font-size: 0.84cqw;
	font-weight: 300;
	line-height: 1.2;
	color: #6b6b74;
	white-space: nowrap;
}

/* The state pill swaps in place; both labels share one cell. */
.nsg__state {
	display: grid;
	flex: none;
}

.nsg__state > span {
	grid-area: 1 / 1;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	height: 1.85cqw;
	padding: 0 0.45cqw;
	border-radius: 0.44cqw;
	font-size: 0.84cqw;
	line-height: 1;
	white-space: nowrap;
	transition: opacity 240ms ease;
}

.nsg__state-run {
	background: #b7d4fb;
	color: #1a65cb;
}

.nsg__state-done {
	background: #d4f3dc;
	color: #1b8a3c;
	opacity: 0;
}

.nsg__panel.is-done .nsg__state-run  { opacity: 0; }
.nsg__panel.is-done .nsg__state-done { opacity: 1; }

.nsg__caret {
	flex: none;
	width: 1.2cqw;
	height: 1.2cqw;
	margin-left: 0.6cqw;
	fill: none;
	stroke: #13131a;
	stroke-width: 1.6;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.nsg__rows {
	display: flex;
	flex-direction: column;
	gap: 0.6cqw;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nsg__row {
	display: flex;
	align-items: center;
	height: 2.84cqw;
	padding: 0 0.52cqw 0 0.62cqw;
	box-sizing: border-box;
	border: 0.1cqw solid #dbdbdb;
	border-radius: 0.47cqw;
}

.nsg__tick {
	flex: none;
	width: 1.35cqw;
	height: 1.35cqw;
	margin-right: 0.66cqw;
}

.nsg__tick svg {
	width: 100%;
	height: 100%;
	fill: none;
	stroke: #a1a1aa;
	stroke-width: 1.3;
	stroke-linecap: round;
	stroke-linejoin: round;
	transition: stroke 240ms ease;
}

.nsg__name {
	flex: 1;
	min-width: 0;
	font-size: 0.9cqw;
	font-weight: 400;
	line-height: 1.2;
	color: #74747c;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	transition: color 240ms ease;
}

/* Status: "Incomplete" and the verified label share one cell and cross-fade. */
.nsg__status {
	display: grid;
	justify-items: end;
	flex: none;
}

.nsg__status > span {
	grid-area: 1 / 1;
	transition: opacity 240ms ease, transform 240ms ease;
}

.nsg__todo {
	display: inline-flex;
	align-items: center;
	height: 1.57cqw;
	padding: 0 0.52cqw;
	border-radius: 0.34cqw;
	background: #f5f5f6;
	font-size: 0.75cqw;
	line-height: 1;
	color: #b8b8bc;
	white-space: nowrap;
}

.nsg__done {
	display: inline-flex;
	align-items: center;
	gap: 0.45cqw;
	margin-right: 0.58cqw;
	font-size: 0.84cqw;
	line-height: 1;
	color: #71717a;
	white-space: nowrap;
	opacity: 0;
	transform: translateX(0.4cqw);
}

.nsg__done i {
	width: 0.47cqw;
	height: 0.47cqw;
	border-radius: 50%;
	background: #38ae52;
}

/* A row completes the moment its card's check lands. */
.nsg__row.is-done .nsg__tick svg { stroke: #347ee5; }
.nsg__row.is-done .nsg__name     { color: #13131a; }
.nsg__row.is-done .nsg__todo     { opacity: 0; }
.nsg__row.is-done .nsg__done     { opacity: 1; transform: none; }

.nsg__row.is-done .nsg__tick {
	animation: nsg-pop 300ms cubic-bezier(0.34, 1.45, 0.64, 1) both;
}

@keyframes nsg-badge {
	from { transform: scale(0); }
	to   { transform: scale(1); }
}

@keyframes nsg-pop {
	from { transform: scale(0.4); }
	to   { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
	.nsg__check.is-in,
	.nsg__row.is-done .nsg__tick { animation: none; }
	.nsg__check.is-in { transform: scale(1); }
	.nsg__node circle,
	.nsg__num,
	.nsg__state > span,
	.nsg__tick svg,
	.nsg__name,
	.nsg__status > span { transition: none; }
}
