/**
 * Stay Prime Health: competitor comparison pages (/vs-alloy/, /vs-evernow/, /vs-hers/, /vs-hims/).
 * Uses theme.json tokens only, so it follows the light and dark palettes and the men's accent.
 *
 * @package StayPrime
 */

.sp-compare__stamp {
	display: inline-block;
	margin-top: 1rem;
	padding: 0.35rem 0.75rem;
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 999px;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-muted);
	background: var(--wp--preset--color--surface);
}

/* Who each option suits */
.sp-compare__fit {
	display: grid;
	gap: 1.25rem;
	grid-template-columns: 1fr;
}

@media (min-width: 782px) {
	.sp-compare__fit {
		grid-template-columns: 1fr 1fr;
	}
}

.sp-compare__fit > .wp-block-group {
	background: var(--wp--preset--color--surface);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--line) 40%, transparent);
	border-radius: var(--sp-radius, 18px);
	padding: 1.5rem;
}

.sp-compare__fit h3 {
	margin-top: 0;
}

/* Comparison table */
.sp-compare-table {
	margin: 1.5rem 0 0;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border-radius: var(--sp-radius, 18px);
	background: var(--wp--preset--color--surface);
	border: 1px solid color-mix(in srgb, var(--wp--preset--color--line) 40%, transparent);
}

.sp-compare-table:focus-visible {
	outline: 3px solid var(--sp-focus, var(--wp--preset--color--accent));
	outline-offset: 2px;
}

.sp-compare-table table {
	width: 100%;
	min-width: 36rem;
	border-collapse: collapse;
	font-size: 1rem;
	color: var(--wp--preset--color--ink);
}

.sp-compare-table caption {
	caption-side: top;
	text-align: left;
	padding: 1rem 1.25rem 0.5rem;
	font-weight: 700;
	color: var(--wp--preset--color--ink);
}

.sp-compare-table caption span {
	display: block;
	font-weight: 400;
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-muted);
}

.sp-compare-table th,
.sp-compare-table td {
	text-align: left;
	vertical-align: top;
	padding: 0.85rem 1.25rem;
	border-bottom: 1px solid color-mix(in srgb, var(--wp--preset--color--line) 35%, transparent);
}

.sp-compare-table thead th {
	font-weight: 700;
	border-bottom: 2px solid var(--wp--preset--color--ink);
	white-space: nowrap;
}

.sp-compare-table tbody th {
	font-weight: 700;
	width: 22%;
}

.sp-compare-table tbody tr:last-child th,
.sp-compare-table tbody tr:last-child td {
	border-bottom: 0;
}

.sp-compare-table .sp-compare__us {
	background: color-mix(in srgb, var(--wp--preset--color--accent) 6%, transparent);
}

/* Footnote markers and source list */
.sp-cite {
	font-size: 0.7em;
	line-height: 0;
	margin-left: 0.1em;
}

.sp-cite a {
	text-decoration: none;
	padding: 0 0.15em;
}

.sp-cite a:focus-visible,
.sp-cite a:hover {
	text-decoration: underline;
}

.sp-compare__sources {
	font-size: var(--wp--preset--font-size--small);
	color: var(--wp--preset--color--ink-muted);
}

.sp-compare__sources ol {
	padding-left: 1.25rem;
}

.sp-compare__sources li {
	margin-bottom: 0.35rem;
	overflow-wrap: anywhere;
}

.sp-compare__sources li:target {
	color: var(--wp--preset--color--ink);
	font-weight: 700;
}

/* Links to the other comparisons */
.sp-compare__more {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem 1rem;
	padding-left: 0;
	list-style: none;
}

@media (prefers-reduced-motion: no-preference) {
	html:has(.sp-compare-table) {
		scroll-behavior: smooth;
	}
}
