/* MarketReview Commercial Best Page.
 * Direct MarketReview Main Page derivative. This stylesheet owns only the
 * Commercial Best page shell additions around the protected Commercial
 * Platform components: optional category discovery, simple TOC and advertiser
 * disclosure link. Existing commercial card/table/Compare presentation remains
 * owned by the Theme's approved commercial.css and commercial JS.
 */

/* -------------------------------------------------------------------------
 * Protected primary commercial canvas.
 * Keep this geometry aligned to the approved legacy Comparison Test page:
 * 1260px outer shell with 20px gutters = 1220px usable desktop width.
 * ------------------------------------------------------------------------- */
.mrmain-commercial-best-page .mrmain-commercial-primary {
	padding: var(--mrcl-reading-gap, 22px) 0 0;
	background: #fff;
}

.mrmain-commercial-best-page .mrmain-commercial-primary__shell {
	width: 100%;
	max-width: 1260px;
	margin: 0 auto;
	padding: 0 20px;
	box-sizing: border-box;
}

.mrmain-commercial-best-page .mrmain-commercial-primary__content > :first-child {
	margin-top: 0;
}

/*
 * The protected commercial components keep all of their internal dimensions.
 * Only their final outer bottom margin is suppressed when they are the last
 * item in this dedicated canvas, so the following Main Page TOC begins after
 * exactly the ordinary Main Page reading gap instead of stacking component +
 * section + TOC spacing.
 */
.mrmain-commercial-best-page .mrmain-commercial-primary__content > :last-child {
	margin-bottom: 0 !important;
}

.mrmain-commercial-best-page .mrmain-commercial-primary__content > h2 {
	margin: 0 0 22px;
	color: #172f3e;
	font-family: "Montserrat", "Arial", "Helvetica Neue", Helvetica, sans-serif;
	font-size: 31px;
	font-weight: 700;
	line-height: 1.22;
	letter-spacing: -0.025em;
}

/*
 * Keep the space between the protected Summary Table and the following
 * Card Table/Best List at the exact Main Page reading rhythm. The protected
 * components retain their own internal sizing and presentation; only these
 * outer sibling margins are normalized by the page shell.
 */
.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-best-list-summary {
	margin-bottom: 0;
}

.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-best-list-summary + .mrc-ranking {
	margin-top: var(--mrcl-reading-gap, 22px);
}

.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-best-list-summary,
.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-ranking,
.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-credit-card,
.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-credit-table-wrap,
.mrmain-commercial-best-page .mrmain-commercial-primary__content > .mrc-compare-app {
	max-width: none;
}

@media (max-width: 700px) {
	.mrmain-commercial-best-page .mrmain-commercial-primary__shell {
		padding-right: 20px;
		padding-left: 20px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-primary__content > h2 {
		margin-bottom: 18px;
		font-size: 25px;
		line-height: 1.26;
	}
}

/* -------------------------------------------------------------------------
 * Optional pre-hero commercial category navigation.
 * No heading and no default card chrome: the strip is intentionally just
 * icon + label. Linked items expose one compact light-green hover/focus
 * surface around the combined icon/text target; the current Best item remains
 * a non-link and carries no box/background.
 * ------------------------------------------------------------------------- */
.mrmain-commercial-best-page .mrmain-commercial-category-nav {
	position: relative;
	background: #fff;
}

.mrmain-commercial-best-page .mrmain-commercial-category-nav--top {
	padding: 7px 0 8px;
	border-bottom: 1px solid #e7eee9;
}

.mrmain-commercial-best-page .mrmain-commercial-category-nav--bottom {
	padding: 18px 0 8px;
}

.mrmain-commercial-best-page .mrmain-commercial-category-nav__shell {
	width: 100%;
	max-width: 1260px;
	margin: 0 auto;
	padding: 0 20px;
	box-sizing: border-box;
}

.mrmain-commercial-best-page .mrmain-commercial-category-nav__grid {
	display: flex;
	align-items: stretch;
	justify-content: center;
	/* Center a fitting row, but keep the first tile reachable if labels overflow. */
	justify-content: safe center;
	gap: 4px;
	/* One-line labels remain accessible on narrower desktop/tablet screens. */
	overflow-x: auto;
	overflow-y: hidden;
	scrollbar-width: none;
}

.mrmain-commercial-best-page .mrmain-commercial-category-nav__grid::-webkit-scrollbar {
	display: none;
}

.mrmain-commercial-best-page .mrmain-commercial-category-link,
.mrmain-commercial-best-page .mrmain-commercial-category-link:link,
.mrmain-commercial-best-page .mrmain-commercial-category-link:visited {
	display: flex;
	flex: 1 1 0;
	/* The full label, rather than an arbitrary fixed card width, sets the floor. */
	min-width: max-content;
	max-width: 148px;
	min-height: 56px;
	padding: 5px 4px 6px;
	box-sizing: border-box;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 3px;
	border: 0;
	border-radius: 8px;
	background: transparent;
	box-shadow: none;
	color: #0d6b46 !important;
	font-family: "Montserrat", "Arial", "Helvetica Neue", Helvetica, sans-serif;
	font-size: 13px;
	font-weight: 700;
	line-height: 1.18;
	text-align: center;
	text-decoration: none !important;
	transition: background 120ms ease, color 120ms ease;
}

.mrmain-commercial-best-page a.mrmain-commercial-category-link:hover,
.mrmain-commercial-best-page a.mrmain-commercial-category-link:focus-visible {
	background: #eaf6ef;
	color: #0a5c3c !important;
	outline: none;
	text-decoration: none !important;
}

.mrmain-commercial-best-page .mrmain-commercial-category-link.is-current {
	background: #eaf6ef;
	color: #0a5c3c !important;
	font-weight: 700;
	cursor: default;
}

.mrmain-commercial-best-page .mrmain-commercial-category-link__icon {
	display: grid;
	width: 36px;
	height: 36px;
	place-items: center;
	color: #0d6b46;
	line-height: 0;
}

.mrmain-commercial-best-page .mrmain-commercial-category-link__icon svg {
	display: block;
	width: 34px !important;
	height: 34px !important;
	max-width: 34px;
	max-height: 34px;
	overflow: visible;
	color: inherit;
}

/* Category SVGs are normalized in the Theme to a single outline weight based
 * on the approved on-screen 0% APR reference. Do not refill or restroke them
 * here: keeping presentation in the SVG preserves identical optical weight. */
.mrmain-commercial-best-page .mrmain-commercial-category-link__label {
	display: block;
	min-width: 0;
	/* Preserve Credit Cards' one-line strip height across every Best family. */
	white-space: nowrap;
	color: #0d6b46;
}

/* Bottom discovery reuses the same centered variable-width destination group. */
.mrmain-commercial-best-page .mrmain-commercial-category-nav--bottom .mrmain-commercial-category-nav__grid {
	justify-content: center;
}

/* -------------------------------------------------------------------------
 * Hero advertiser disclosure. It lives inside the dark Main Page hero at the
 * upper-right and opens a small white popup. Default off means zero markup.
 * ------------------------------------------------------------------------- */
.mrmain-commercial-best-page .mrcl-pillar-hero__inner > .mrmain-commercial-advertiser {
	position: absolute;
	top: 0;
	right: 24px;
	z-index: 8;
	font-family: "Montserrat", "Arial", "Helvetica Neue", Helvetica, sans-serif;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__toggle {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	box-shadow: none;
	cursor: pointer;
}

/* Match the existing Main Page Editorial Standards control exactly. */
.mrmain-commercial-best-page .mrmain-commercial-advertiser__toggle .mrcl-hero-meta__label {
	color: #76d6a4;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__toggle:hover .mrcl-hero-meta__label,
.mrmain-commercial-best-page .mrmain-commercial-advertiser__toggle:focus .mrcl-hero-meta__label {
	text-decoration: underline;
	text-decoration-thickness: 1px;
	text-underline-offset: 3px;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__icon {
	display: grid;
	width: 18px;
	height: 18px;
	place-items: center;
	border: 1px solid rgba(118, 214, 164, 0.6);
	border-radius: 50%;
	color: #76d6a4;
	font-family: Arial, sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1;
	transition: transform 120ms ease;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser.is-open .mrmain-commercial-advertiser__icon {
	transform: rotate(45deg);
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel[hidden] {
	display: none !important;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel {
	position: fixed;
	z-index: 10050;
	width: min(480px, calc(100vw - 40px));
	padding: 19px 42px 18px 20px;
	box-sizing: border-box;
	border: 1px solid #cad9d1;
	border-radius: 9px;
	background: #fff;
	box-shadow: 0 14px 34px rgba(6, 23, 34, 0.22);
	color: #3a515b;
	text-align: left;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel h2 {
	margin: 0 0 9px;
	padding: 0;
	color: #173447;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel p {
	margin: 0 0 10px;
	color: #405761;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.55;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel a,
.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel a:link,
.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel a:visited {
	color: #0d6b46 !important;
	font-size: 13px;
	font-weight: 700;
	text-decoration: none !important;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel a:hover,
.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel a:focus {
	color: #095536 !important;
	text-decoration: underline !important;
	text-underline-offset: 3px;
}

.mrmain-commercial-best-page .mrmain-commercial-advertiser__close {
	position: absolute;
	top: 8px;
	right: 10px;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	background: transparent;
	color: #49626c;
	font-family: Arial, sans-serif;
	font-size: 23px;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
}

@media (max-width: 1100px) {
	.mrmain-commercial-best-page .mrcl-pillar-hero__inner > .mrmain-commercial-advertiser {
		position: relative;
		top: auto;
		right: auto;
		display: flex;
		justify-content: flex-end;
		margin: 0 0 8px;
	}
}

@media (max-width: 1000px) {
	.mrmain-commercial-best-page .mrmain-commercial-category-link,
	.mrmain-commercial-best-page .mrmain-commercial-category-link:link,
	.mrmain-commercial-best-page .mrmain-commercial-category-link:visited {
		min-width: max-content;
		max-width: 132px;
	}
}

@media (max-width: 700px) {
	.mrmain-commercial-best-page .mrmain-commercial-category-nav--top {
		padding: 6px 0 7px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-category-nav--bottom {
		padding-top: 14px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-category-nav__shell {
		padding-right: 20px;
		padding-left: 20px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-category-nav__grid,
	.mrmain-commercial-best-page .mrmain-commercial-category-nav--bottom .mrmain-commercial-category-nav__grid {
		display: flex;
		justify-content: flex-start;
		gap: 3px;
		overflow-x: auto;
		padding: 0 0 4px;
		scroll-snap-type: x proximity;
		-webkit-overflow-scrolling: touch;
	}

	.mrmain-commercial-best-page .mrmain-commercial-category-link,
	.mrmain-commercial-best-page .mrmain-commercial-category-link:link,
	.mrmain-commercial-best-page .mrmain-commercial-category-link:visited {
		flex: 0 0 auto;
		min-width: 92px;
		max-width: none;
		width: max-content;
		min-height: 52px;
		padding: 4px 9px 5px;
		font-size: 10.5px;
		scroll-snap-align: start;
	}

	.mrmain-commercial-best-page .mrmain-commercial-category-link__icon {
		width: 31px;
		height: 31px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-category-link__icon svg {
		width: 29px !important;
		height: 29px !important;
		max-width: 29px;
		max-height: 29px;
	}


	.mrmain-commercial-best-page .mrmain-commercial-advertiser__panel {
		width: min(420px, calc(100vw - 28px));
		padding: 17px 39px 16px 18px;
	}
}

/* -------------------------------------------------------------------------
 * Commercial Best reuses the exact Main Page Table of Contents markup,
 * styling and closed-by-default interaction. No parallel TOC styling lives
 * here; pillar.css + marketreview-main-page-manual.css remain authoritative.
 * ------------------------------------------------------------------------- */

/* Generated TOC anchors need only a small non-sticky offset now. */
.mrmain-commercial-best-page .mrmain-page-content h2[id],
.mrmain-commercial-best-page .mrmain-faq-content h2[id] {
	scroll-margin-top: 24px;
}

@media (max-width: 700px) {
	.mrmain-commercial-best-page .mrmain-commercial-toc h2 {
		font-size: 18px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-toc-section {
		padding-top: 24px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-toc {
		max-width: none;
		padding: 17px 18px 16px;
	}

	.mrmain-commercial-best-page .mrmain-commercial-toc li {
		font-size: 13.5px;
	}
}

/* -------------------------------------------------------------------------
 * Commercial Best hero byline.
 * Keep the existing Main Page trust typography and avatar dimensions, while
 * grouping the selected author and assigned fact checker together. The two
 * profile photos overlap slightly to form one compact editorial-team stack;
 * Last updated and Editorial Standards remain separate facts after this group.
 * ------------------------------------------------------------------------- */
.mrmain-commercial-best-page .mrmain-commercial-best-byline {
	gap: 12px;
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__avatars {
	display: flex;
	align-items: center;
	flex: 0 0 auto;
	padding-right: 2px;
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__avatar {
	position: relative;
	z-index: 2;
	margin: 0;
	box-shadow: 0 0 0 1px rgba(7, 43, 61, 0.24);
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__avatar + .mrmain-commercial-best-byline__avatar {
	z-index: 1;
	margin-left: -12px;
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__avatar:hover,
.mrmain-commercial-best-page .mrmain-commercial-best-byline__avatar:focus {
	z-index: 3;
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__text {
	gap: 4px;
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__line {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 0 5px;
	min-width: 0;
	color: #ffffff;
	font-size: 13.5px;
	line-height: 1.35;
}

.mrmain-commercial-best-page .mrmain-commercial-best-byline__line .mrcl-hero-meta__label,
.mrmain-commercial-best-page .mrmain-commercial-best-byline__line .mrcl-hero-author__name,
.mrmain-commercial-best-page .mrmain-commercial-best-byline__line .mrcl-hero-meta__date {
	flex: 0 0 auto;
}

@media (max-width: 700px) {
	.mrmain-commercial-best-page .mrmain-commercial-best-byline__avatar + .mrmain-commercial-best-byline__avatar {
		margin-left: -10px;
	}
}


/* Medigap Best pages suppress the optional summary heading, but retain the
 * shared Best-page reading gap between the hero/byline and Summary Table.
 * Do not collapse .mrmain-commercial-primary padding here. */


/* Medigap Best Summary Table: keep the comparison metrics optically centered
 * under the WHAT TO COMPARE heading. Shared Summary Table CSS carries legacy
 * per-column translate offsets; this page-family override neutralizes them. */
body.mrmain-commercial-best-page.mrcl-medigap-best-page .mrc-best-list-summary__table thead th.mrc-best-list-summary__costs-heading {
	padding-left: 14px;
	padding-right: 14px;
	text-align: center;
}

body.mrmain-commercial-best-page.mrcl-medigap-best-page .mrc-best-list-summary__metrics {
	transform: none;
	text-align: center;
}

body.mrmain-commercial-best-page.mrcl-medigap-best-page .mrc-best-list-summary__metrics .mrc-best-list-summary__metric {
	align-items: center;
	justify-content: center;
	text-align: center;
}
