/**
 * Warp Scan — [warp_scan_recent] looping strip of recent scans.
 *
 * px units on purpose: the site theme sets a 10px root font size.
 * Palette from warpperformance.com. Score colour is always paired with the
 * number and the grade letter.
 */

.wsrs {
	--wsrs-ink: #0f0f0f;
	--wsrs-ink-2: #6d6d6d;
	--wsrs-surface: #ffffff;
	--wsrs-line: #e6e6e6;
	--wsrs-track: #e6e6e6;
	--wsrs-good: #15803d;
	--wsrs-avg: #a15c07;
	--wsrs-poor: #b91c1c;
	--wsrs-hover: #3b82f6;
	--wsrs-warp-ink: #1d4ed8;
	--wsrs-warp-bg: rgba(59, 130, 246, 0.12);
	--wsrs-gap: 16px;

	box-sizing: border-box;
	width: 100%;
	color: var(--wsrs-ink);
	font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 15px;
	line-height: 1.4;
}

.wsrs--dark {
	--wsrs-ink: #f6f8fc;
	--wsrs-ink-2: #a3a3a3;
	--wsrs-surface: #1a1a1a;
	--wsrs-line: #2e2e2e;
	--wsrs-track: #2e2e2e;
	--wsrs-good: #6ee7a0;
	--wsrs-avg: #f5b942;
	--wsrs-poor: #ff8a7a;
	--wsrs-hover: #93c5fd;
	--wsrs-warp-ink: #93c5fd;
	--wsrs-warp-bg: rgba(59, 130, 246, 0.18);
}

.wsrs *,
.wsrs *::before,
.wsrs *::after {
	box-sizing: border-box;
}

.wsrs__head {
	padding-left: 24px;
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 8px 16px;
	margin: 0 0 12px;
}

.wsrs .wsrs__heading {
	margin: 0;
	color: var(--wsrs-ink-2);
	font-family: "DM Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
	font-size: 13px;
	font-weight: 600;
	letter-spacing: 0.08em;
	line-height: 1.3;
	text-transform: uppercase;
}

.wsrs__card:focus-visible {
	outline: 2px solid var(--wsrs-hover);
	outline-offset: 2px;
}

/* Viewport: fades the edges of the loop. */
.wsrs__viewport {
	overflow: hidden;
	padding: 4px 0;
	-webkit-mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent);
	mask-image: linear-gradient(90deg, transparent, #000 48px, #000 calc(100% - 48px), transparent);
}

.wsrs__track {
	display: flex;
	width: max-content;
	max-width: none;
}

.wsrs__group {
	display: flex;
	flex: none;
	gap: var(--wsrs-gap);
	margin: 0;
	padding: 0 var(--wsrs-gap) 0 0;
	list-style: none;
}

.wsrs__item {
	flex: none;
	margin: 0;
	padding: 0;
}

/* Static layout when there are too few cards to loop. */
.wsrs:not(.wsrs--loop) .wsrs__track {
	width: auto;
}

.wsrs:not(.wsrs--loop) .wsrs__group {
	flex-wrap: wrap;
	justify-content: center;
	padding: 0;
}

.wsrs:not(.wsrs--loop) .wsrs__viewport {
	-webkit-mask-image: none;
	mask-image: none;
}

.wsrs--loop .wsrs__track {
	animation: wsrs-scroll var(--wsrs-duration, 60s) linear infinite;
}

.wsrs--loop:hover .wsrs__track,
.wsrs--loop:focus-within .wsrs__track,
.wsrs--loop.is-paused .wsrs__track {
	animation-play-state: paused;
}

@keyframes wsrs-scroll {
	to {
		transform: translateX(-50%);
	}
}

.wsrs__card {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 292px;
	padding: 12px 16px;
	color: inherit;
	text-decoration: none;
	background: var(--wsrs-surface);
	border: 1px solid var(--wsrs-line);
	border-radius: 14px;
	transition: border-color 0.15s ease-out, transform 0.15s ease-out;
}

.wsrs__card:hover {
	border-color: var(--wsrs-hover);
	transform: translateY(-2px);
}

.wsrs__ring {
	position: relative;
	display: block;
	flex: none;
	width: 48px;
	height: 48px;
}

.wsrs__ring svg {
	display: block;
	transform: rotate(-90deg);
}

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

.wsrs__ring .wsrs__bg {
	stroke: var(--wsrs-track);
}

.wsrs__ring .wsrs__arc {
	stroke: var(--wsrs-good);
	stroke-linecap: round;
}

.wsrs__card--average .wsrs__arc {
	stroke: var(--wsrs-avg);
}

.wsrs__card--poor .wsrs__arc {
	stroke: var(--wsrs-poor);
}

.wsrs__score {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: "Plus Jakarta Sans", "DM Sans", ui-sans-serif, system-ui, sans-serif;
	font-size: 16px;
	font-weight: 800;
}

.wsrs__text {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-width: 0;
}

.wsrs__domain {
	overflow: hidden;
	font-weight: 700;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.wsrs__meta {
	overflow: hidden;
	color: var(--wsrs-ink-2);
	font-size: 13px;
	text-overflow: ellipsis;
	white-space: nowrap;
}

/* "Warp" badge: brand-tinted pill in the meta line, same height as the text. */
.wsrs__warp {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	padding: 0 7px 0 6px;
	color: var(--wsrs-warp-ink);
	font-size: 12px;
	font-weight: 700;
	line-height: 18px;
	vertical-align: 1px;
	background: var(--wsrs-warp-bg);
	border-radius: 999px;
}

.wsrs-warp-icon {
	display: block;
	flex: none;
}

.wsrs__grade {
	flex: none;
	min-width: 30px;
	padding: 2px 8px;
	color: var(--wsrs-good);
	font-size: 13px;
	font-weight: 700;
	text-align: center;
	border: 1px solid currentcolor;
	border-radius: 8px;
}

.wsrs__card--average .wsrs__grade {
	color: var(--wsrs-avg);
}

.wsrs__card--poor .wsrs__grade {
	color: var(--wsrs-poor);
}

@media (max-width: 480px) {
	.wsrs__card {
		width: 236px;
		padding: 10px 12px;
	}
}

/* Motion off: a plain scrollable row, no clone. */
@media (prefers-reduced-motion: reduce) {
	.wsrs--loop .wsrs__track {
		animation: none;
	}

	.wsrs--loop .wsrs__viewport {
		overflow-x: auto;
		-webkit-mask-image: none;
		mask-image: none;
	}

	.wsrs--loop .wsrs__group[aria-hidden="true"] {
		display: none;
	}
}
