/*
 * Mobile Comparison - frontend styles (v1.1).
 * Fully scoped: every selector starts from a .mc- class, nothing depends on theme markup.
 * Colours are CSS variables on the two root components, so a site can re-brand with:
 *   .mc-mobile-info, .mc-comparison-wrap { --mc-accent: #0b5; }
 */

.mc-mobile-info,
.mc-comparison-wrap {
	--mc-accent: #24435f;
	--mc-accent-text: #fff;
	--mc-win: #2e7d32;
	--mc-win-bg: rgba(46, 125, 50, 0.13);
	--mc-border: rgba(127, 127, 127, 0.32);
	--mc-muted: rgba(127, 127, 127, 0.1);
	box-sizing: border-box;
	margin: 1.5em 0;
	line-height: 1.5;
}

.mc-mobile-info *,
.mc-comparison-wrap *,
.mc-sticky-head * {
	box-sizing: border-box;
}

.mc-mobile-info [hidden],
.mc-comparison-wrap [hidden] {
	display: none !important;
}

.mc-sr-only {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* =========================================================
 * Mobile information: image + description flow
 * ========================================================= */

.mc-mobile-info .mc-mobile-header {
	display: flow-root; /* contains the floated image */
	margin: 0 0 1.25em;
	overflow-wrap: anywhere;
}

.mc-mobile-info .mc-mobile-image {
	float: left;
	width: 220px;
	max-width: 42%;
	margin: 0 1.5em 0.75em 0;
}

.mc-mobile-info .mc-mobile-image img {
	display: block;
	width: 100%;
	height: auto;
	margin: 0;
	border-radius: 6px;
}

.mc-mobile-info .mc-mobile-summary {
	/* No width/flex: text wraps beside the image, then continues underneath it. */
	min-width: 0;
}

.mc-mobile-info .mc-mobile-name {
	margin: 0 0 0.2em;
}

.mc-mobile-info .mc-mobile-brand,
.mc-mobile-info .mc-mobile-launch,
.mc-mobile-info .mc-mobile-excerpt {
	margin: 0 0 0.5em;
}

.mc-mobile-info .mc-mobile-brand {
	font-weight: 600;
	letter-spacing: 0.03em;
	text-transform: uppercase;
	font-size: 0.85em;
	opacity: 0.8;
}

.mc-mobile-info .mc-mobile-price {
	margin: 0 0 0.5em;
	font-size: 1.3em;
	font-weight: 700;
}

/* =========================================================
 * Specification groups: full-width header strip + rows
 * ========================================================= */

.mc-mobile-info .mc-spec-group {
	clear: both;
	margin: 0 0 1.1em;
	border: 1px solid var(--mc-border);
	border-radius: 6px;
	overflow: hidden;
}

.mc-mobile-info .mc-spec-group .mc-spec-group-title {
	display: block;
	width: 100%;
	margin: 0;
	padding: 0.65em 1em;
	border: 0;
	border-radius: 0;
	background: var(--mc-accent);
	color: var(--mc-accent-text);
	font-size: 0.95em;
	font-weight: 700;
	letter-spacing: 0.07em;
	line-height: 1.3;
	text-transform: uppercase;
}

.mc-mobile-info .mc-spec-list {
	margin: 0;
	padding: 0;
}

.mc-mobile-info .mc-spec-row {
	display: grid;
	grid-template-columns: minmax(110px, 36%) minmax(0, 1fr);
	gap: 0.25em 1em;
	margin: 0;
	padding: 0.6em 1em;
	border-top: 1px solid var(--mc-border);
}

.mc-mobile-info .mc-spec-row:first-child {
	border-top: 0;
}

.mc-mobile-info .mc-spec-row:nth-child(even) {
	background: var(--mc-muted);
}

.mc-mobile-info .mc-spec-name,
.mc-mobile-info .mc-spec-value {
	margin: 0;
	padding: 0;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.mc-mobile-info .mc-spec-name {
	font-weight: 600;
}

/* =========================================================
 * Buttons ("Compare this phone" and friends)
 * ========================================================= */

.mc-button {
	display: inline-block;
	padding: 0.65em 1.25em;
	border: 1px solid var(--mc-accent, #24435f);
	border-radius: 6px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, color 0.15s ease;
}

.mc-button:hover {
	background: var(--mc-muted, rgba(127, 127, 127, 0.1));
}

.mc-button:focus-visible,
.mc-winner-link:focus-visible,
.mc-related-card:focus-visible {
	outline: 3px solid var(--mc-accent, #24435f);
	outline-offset: 2px;
}

.mc-button-primary,
.mc-selector-toggle {
	background: var(--mc-accent, #24435f);
	color: var(--mc-accent-text, #fff);
}

.mc-button-primary:hover,
.mc-selector-toggle:hover {
	background: var(--mc-accent, #24435f);
	filter: brightness(1.15);
}

.mc-button:disabled {
	opacity: 0.5;
	cursor: not-allowed;
}

/* =========================================================
 * Selector ("Compare this phone")
 * ========================================================= */

.mc-selector {
	margin: 1.25em 0 0;
}

.mc-selector > summary {
	list-style: none;
}

.mc-selector > summary::-webkit-details-marker {
	display: none;
}

.mc-selector-form {
	margin-top: 0.75em;
	padding: 1em;
	border: 1px solid var(--mc-border);
	border-radius: 6px;
}

.mc-selector-fieldset {
	min-width: 0;
	margin: 0 0 0.75em;
	padding: 0;
	border: 0;
}

.mc-selector-legend {
	padding: 0;
	margin-bottom: 0.5em;
	font-weight: 600;
}

.mc-selector-current {
	margin: 0 0 0.5em;
}

.mc-selector-list {
	margin: 0;
	padding: 0;
	max-height: 14em;
	overflow-y: auto;
	list-style: none;
}

.mc-selector-item {
	margin: 0;
	padding: 0.2em 0;
}

.mc-selector-status {
	margin: 0 0 0.75em;
	font-size: 0.9em;
}

/* =========================================================
 * Similar mobiles (horizontal cards)
 * ========================================================= */

.mc-mobile-info .mc-related {
	clear: both;
	margin: 1.75em 0 0;
}

.mc-mobile-info .mc-related-title {
	margin: 0 0 0.6em;
	padding: 0 0 0.4em;
	border-bottom: 2px solid var(--mc-border);
}

.mc-mobile-info .mc-related-list {
	display: flex;
	gap: 0.75em;
	margin: 0;
	padding: 0 0 0.5em;
	overflow-x: auto;
	list-style: none;
	scroll-snap-type: x proximity;
	-webkit-overflow-scrolling: touch;
}

.mc-mobile-info .mc-related-item {
	flex: 0 0 clamp(130px, 23%, 210px);
	margin: 0;
	padding: 0;
	scroll-snap-align: start;
}

.mc-mobile-info .mc-related-card {
	display: flex;
	flex-direction: column;
	align-items: center;
	height: 100%;
	padding: 0.75em 0.5em;
	border: 1px solid var(--mc-border);
	border-radius: 8px;
	color: inherit;
	text-align: center;
	text-decoration: none;
}

.mc-mobile-info .mc-related-card:hover {
	border-color: var(--mc-accent);
	background: var(--mc-muted);
}

.mc-mobile-info .mc-related-image {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	height: 120px;
	margin-bottom: 0.5em;
}

.mc-mobile-info .mc-related-img {
	display: block;
	width: auto;
	max-width: 100%;
	height: auto;
	max-height: 120px;
	margin: 0;
	object-fit: contain;
}

.mc-mobile-info .mc-related-name {
	font-size: 0.95em;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: anywhere;
}

/* =========================================================
 * Comparison: layout, filter, table
 * ========================================================= */

.mc-comparison-wrap .mc-notice {
	margin: 0 0 1em;
	padding: 0.75em 1em;
	border-left: 4px solid var(--mc-border);
	background: var(--mc-muted);
}

/* Full-width breakout. --mc-sbw (scrollbar width) is set by JS so the page never gets a sideways scrollbar. */
.mc-comparison-wrap.mc-is-wide {
	width: calc(100vw - var(--mc-sbw, 0px));
	max-width: none;
	margin-left: calc(50% - 50vw + (var(--mc-sbw, 0px) / 2));
	margin-right: 0;
	padding: 0 0.75em;
}

/* Filter */
.mc-filter {
	margin: 0 0 0.75em;
}

.mc-filter-box > summary {
	display: inline-block;
	list-style: none;
}

.mc-filter-box > summary::-webkit-details-marker {
	display: none;
}

.mc-filter-panel {
	max-height: 20em;
	margin-top: 0.5em;
	padding: 0.75em 1em;
	overflow-y: auto;
	border: 1px solid var(--mc-border);
	border-radius: 6px;
}

.mc-filter-actions {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin: 0 0 0.75em;
}

.mc-filter-actions .mc-button {
	padding: 0.4em 0.9em;
	font-size: 0.9em;
}

.mc-filter-group {
	min-width: 0;
	margin: 0 0 0.75em;
	padding: 0;
	border: 0;
}

.mc-filter-group legend {
	padding: 0;
	font-weight: 700;
}

.mc-filter-specs {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em 1.25em;
	margin: 0.25em 0 0 1.4em;
	padding: 0;
	list-style: none;
}

.mc-filter-specs li {
	margin: 0;
	padding: 0;
	font-size: 0.95em;
}

/* Table */
.mc-comparison-wrap .mc-table-wrap {
	max-width: 100%;
	overflow-x: auto;
	-webkit-overflow-scrolling: touch;
	border: 1px solid var(--mc-border);
	border-radius: 6px;
}

.mc-comparison {
	width: 100%;
	min-width: calc(var(--mc-cols, 3) * 150px + 130px);
	margin: 0;
	border: 0;
	border-collapse: collapse;
	table-layout: fixed;
}

.mc-comparison th,
.mc-comparison td {
	padding: 0.6em 0.8em;
	border: 0;
	border-top: 1px solid var(--mc-border);
	border-left: 1px solid var(--mc-border);
	text-align: left;
	vertical-align: top;
	overflow-wrap: anywhere;
	word-break: break-word;
}

.mc-comparison tr > :first-child {
	border-left: 0;
}

.mc-comparison thead th {
	border-top: 0;
	background: var(--mc-muted);
	text-align: center;
	vertical-align: middle;
}

.mc-comparison .mc-spec-name {
	width: 130px;
	font-weight: 600;
}

.mc-comparison .mc-group-row .mc-group-title {
	border-left: 0;
	background: var(--mc-accent);
	color: var(--mc-accent-text);
	font-size: 0.92em;
	letter-spacing: 0.07em;
	text-transform: uppercase;
}

.mc-comparison tbody .mc-spec-row:nth-child(even of .mc-spec-row:not([hidden])) > * {
	background-image: linear-gradient(var(--mc-muted), var(--mc-muted));
}

.mc-comparison [hidden] {
	display: none !important;
}

/* Header cell: small image, readable name */
.mc-comparison .mc-mobile-head > * {
	display: block;
}

.mc-comparison .mc-mobile-head .mc-mobile-image {
	width: 44px;
	margin: 0 auto 0.3em;
}

.mc-comparison .mc-mobile-head .mc-mobile-image img {
	display: block;
	width: 44px;
	height: auto;
	max-height: 60px;
	margin: 0;
	object-fit: contain;
}

.mc-comparison .mc-mobile-brand {
	font-size: 0.78em;
	letter-spacing: 0.05em;
	text-transform: uppercase;
	opacity: 0.75;
}

.mc-comparison .mc-mobile-name {
	font-weight: 700;
	line-height: 1.25;
}

.mc-comparison .mc-na {
	opacity: 0.55;
}

/* Sticky header clone (positioned and synced by JS) */
.mc-sticky-head {
	position: fixed;
	z-index: 99;
	overflow: hidden;
	box-shadow: 0 2px 4px rgba(0, 0, 0, 0.18);
	pointer-events: none;
}

.mc-sticky-head .mc-comparison {
	min-width: 0;
	table-layout: fixed;
}

/* =========================================================
 * Winners
 * ========================================================= */

.mc-comparison .mc-winner {
	background-color: var(--mc-win-bg);
	box-shadow: inset 3px 0 0 var(--mc-win);
	font-weight: 700;
}

.mc-comparison-wrap .mc-winner-card {
	max-width: 600px;
	margin: 1.75em auto;
	padding: 1.5em 1.25em;
	border: 2px solid var(--mc-win);
	border-radius: 12px;
	background: linear-gradient(180deg, var(--mc-win-bg), transparent 70%);
	text-align: center;
}

.mc-winner-card .mc-winner-title {
	margin: 0 0 0.75em;
	font-size: 1.35em;
	letter-spacing: 0.02em;
}

.mc-winner-card .mc-winner-image {
	margin: 0 auto 0.5em;
}

.mc-winner-card .mc-winner-img {
	display: inline-block;
	width: auto;
	max-width: 140px;
	height: auto;
	max-height: 170px;
	margin: 0;
	object-fit: contain;
}

.mc-winner-card .mc-winner-name {
	margin: 0 0 0.25em;
	font-size: 1.6em;
	font-weight: 800;
	line-height: 1.2;
}

.mc-winner-card .mc-score {
	margin: 0 0 0.75em;
	font-size: 1.25em;
	font-weight: 700;
}

.mc-score-label {
	margin-right: 0.35em;
	font-weight: 400;
	opacity: 0.8;
}

.mc-winner-card .mc-winner-reasons-title {
	margin: 0.5em 0 0.2em;
	font-weight: 700;
}

.mc-winner-card .mc-winner-reasons {
	display: inline-block;
	margin: 0 0 0.75em;
	padding: 0 0 0 1.25em;
	text-align: left;
}

.mc-winner-card .mc-winner-summary {
	margin: 0 0 0.5em;
	font-size: 0.95em;
}

.mc-winner-card .mc-winner-action {
	margin: 0.75em 0 0;
}

.mc-winner-card .mc-winner-link {
	display: inline-block;
	padding: 0.75em 1.5em;
	border-radius: 6px;
	background: var(--mc-win);
	color: #fff;
	font-weight: 700;
	text-decoration: none;
}

.mc-winner-card .mc-winner-link:hover {
	filter: brightness(1.12);
	color: #fff;
}

/* =========================================================
 * Small screens
 * ========================================================= */

@media (max-width: 600px) {
	.mc-mobile-info .mc-mobile-image {
		float: none;
		width: 180px;
		max-width: 60%;
		margin: 0 auto 1em;
	}

	.mc-mobile-info .mc-spec-row {
		grid-template-columns: minmax(0, 1fr);
	}

	.mc-mobile-info .mc-related-item {
		flex-basis: 140px;
	}

	.mc-comparison-wrap.mc-is-wide {
		padding: 0 0.4em;
	}

	.mc-comparison {
		min-width: calc(var(--mc-cols, 3) * 130px + 100px);
	}

	.mc-comparison .mc-spec-name {
		width: 100px;
	}

	.mc-comparison th,
	.mc-comparison td {
		padding: 0.5em;
	}
}

@media print {
	.mc-selector,
	.mc-filter,
	.mc-sticky-head {
		display: none !important;
	}
}

/* =========================================================
 * Product type switcher on an empty comparison page (v2)
 * ========================================================= */

.mc-comparison-wrap .mc-type-tabs {
	margin: 0 0 1em;
}

.mc-comparison-wrap .mc-type-tabs-list {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5em;
	margin: 0;
	padding: 0;
	list-style: none;
}

.mc-comparison-wrap .mc-type-tab {
	margin: 0;
	padding: 0;
}

.mc-comparison-wrap .mc-type-link {
	display: inline-block;
	padding: 0.45em 1em;
	border: 1px solid var(--mc-border);
	border-radius: 999px;
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.mc-comparison-wrap .mc-type-tab.is-current .mc-type-link {
	border-color: var(--mc-accent);
	background: var(--mc-accent);
	color: var(--mc-accent-text);
}

.mc-comparison-wrap .mc-type-link:focus-visible {
	outline: 3px solid var(--mc-accent);
	outline-offset: 2px;
}
