/**
 * Subpage section: Tabs with a comparison table (template-parts/sections/subpage/section-tabs_compare.php).
 *
 * Measured from design/pages/fuel-monitoring-top-accordions-section-design-section.png at 1918
 * (TODO: verify in Figma): a pale-blue section; the heading (.t-h2) and a 20px intro in the start
 * half; tabs (~17px Montserrat) ~40px apart, the selected one orange with a 2px orange underline over
 * a 1px #ebebeb hairline; ~45px below, the panel: a ~492px start column (the title, ~20px; grey
 * text; a 4:3 illustration) and, ~108px after it, a ~544px table (a green Pros and a grey Cons
 * header ~64px tall, tinted cells, 14px text, #ebebeb row lines). Mobile (TODO, no frame): the tab
 * row scrolls sideways; text, media, then Pros and Cons as two lists. Tokens are local to the
 * section. Logical properties only.
 *
 * @package cartrack
 */

.sp-section--tabs_compare.sp-section--bg-none {
	background-color: var(--tc-bg);
}

.sp-section--tabs_compare {
	--tc-bg: #f6f9fe;            /* Sampled #f6f9fe to #edf5ff. TODO: verify in Figma. */
	--tc-hairline: #ebebeb;
	--tc-tab-text: #666666;      /* Unselected tab label. TODO: verify in Figma. */
	--tc-pros-head: #81c784;
	--tc-pros-cell: #edf7ed;
	--tc-cons-head: #dbdddf;
	--tc-cons-cell: #f9f9f9;
	--tc-cell-text: #212121;
	--tc-text: #666666;          /* Panel text. TODO: verify in Figma. */
	--tc-tab-gap: var(--space-lg);
	--tc-column-gap: var(--space-xl);
}

.tabs-compare {
	display: flex;
	flex-direction: column;
	gap: var(--space-lg);
}

.tabs-compare__header {
	max-width: 47.5rem;         /* ~760px, the frame's heading and intro width. */
}

.tabs-compare__intro {
	margin: var(--space-sm) 0 0;
	font-size: 1.125rem;           /* ~18px on phones (proposal). TODO: verify in Figma. */
	line-height: var(--t-subtitle-line-height);
}

/* Heading options (2026-11-16, Industry Solutions; post-1012039.css): Center centres the heading and intro; Accent
   sets the intro in orange (the orange-text decision, CLAUDE.md 4.11), Roboto 20 / 28, at most 70% wide from
   --bp-md. TODO: verify in Figma. */
.tabs-compare--head-center .tabs-compare__header {
	align-self: center;
	text-align: center;
}

.tabs-compare--intro-accent .tabs-compare__intro {
	color: var(--color-text-accent);
	font-family: var(--font-body);
	font-size: var(--t-subtitle-size);
	font-weight: var(--font-weight-regular);
	line-height: var(--t-subtitle-line-height);
}

@media (min-width: 48em) { /* --bp-md */
	.tabs-compare--head-center .tabs-compare__header {
		max-width: 64rem;
	}

	.tabs-compare--head-center.tabs-compare--intro-accent .tabs-compare__intro {
		max-width: 70%;
		margin-inline: auto;
	}
}

/* ---------- Tabs ---------- */

.tabs-compare__tablist {
	display: flex;
	gap: var(--tc-tab-gap);
	overflow-x: auto;
	scrollbar-width: none;
	border-block-end: 1px solid var(--tc-hairline);
}

.tabs-compare__tablist::-webkit-scrollbar {
	display: none;
}

.tabs-compare__tab {
	flex: none;
	margin: 0 0 -1px;
	padding: var(--space-xs) 0 var(--space-sm);
	border: 0;
	border-block-end: 2px solid transparent;
	background: none;
	color: var(--tc-tab-text);
	font-family: var(--font-heading);
	font-size: var(--t-nav-size);
	font-weight: 500;
	line-height: 1.3;
	cursor: pointer;
	overflow-wrap: anywhere;
}

.tabs-compare__tab[aria-selected="true"] {
	border-block-end-color: var(--color-primary);
	color: var(--color-text-accent);
}

.tabs-compare__tab:focus-visible {
	outline: 2px solid var(--color-focus-dark);
	outline-offset: 2px;
}

@media (hover: hover) {
	.tabs-compare__tab:hover {
		color: var(--color-text-accent);
	}
}

/* No JS: no tab row; every panel is shown, stacked, under its title. With JS, before the script runs,
   only the first panel shows, so nothing jumps. */
@media (scripting: none) {
	.tabs-compare__tablist {
		display: none;
	}

	.tabs-compare__panels {
		display: flex;
		flex-direction: column;
		gap: var(--space-2xl);
	}
}

@media (scripting: enabled) {
	.tabs-compare:not(.is-enhanced) .tabs-compare__panel + .tabs-compare__panel {
		display: none;
	}
}

.tabs-compare__panel[hidden] {
	display: none;
}

.tabs-compare__panel:focus-visible {
	outline: 2px solid var(--color-focus-dark);
	outline-offset: 4px;
}

/* ---------- Panel ---------- */

.tabs-compare__panel {
	display: grid;
	gap: var(--space-lg);
}

.tabs-compare__title {
	margin: 0;
	font-family: var(--font-body);
	font-size: 1.25rem;          /* ~20px. TODO: verify in Figma. */
	font-weight: 500;
	line-height: 1.4;
}

.tabs-compare__text {
	margin: var(--space-xs) 0 0;
	color: var(--tc-text);
}

/* The optional tab link (the shared .link-arrow, its CSS enqueued only when a tab has a link page). */
.tabs-compare__link {
	margin: var(--space-sm) 0 0;  /* TODO: verify in Figma (no frame shows a tab link). */
}

.tabs-compare__media {
	margin-block-start: var(--space-md);
}

.tabs-compare__media .media__image {
	object-fit: contain;         /* Illustrations: never cropped. */
}

/* The table (larger screens) and the two lists (phones) hold the same rows; only one is shown. */
.tabs-compare__table {
	display: none;
}

.tabs-compare__lists {
	display: grid;
	gap: var(--space-md);
}

.tabs-compare__list {
	border: 1px solid var(--tc-hairline);
}

.tabs-compare__list-heading {
	margin: 0;
	padding: var(--space-sm);
	font-family: var(--font-body);
	font-size: 1.0625rem;
	font-weight: 500;
	background-color: var(--tc-pros-head);
	color: var(--tc-cell-text);
}

.tabs-compare__list--cons .tabs-compare__list-heading {
	background-color: var(--tc-cons-head);
}

.tabs-compare__list ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tabs-compare__list li {
	padding: var(--space-sm);
	border-block-start: 1px solid var(--tc-hairline);
	background-color: var(--tc-pros-cell);
	color: var(--tc-cell-text);
	font-size: var(--font-size-sm);
	line-height: 1.43;
	overflow-wrap: anywhere;
}

.tabs-compare__list--cons li {
	background-color: var(--tc-cons-cell);
}

@media (min-width: 48em) { /* --bp-md */
	.tabs-compare__table {
		display: table;
		width: 100%;
		border-collapse: collapse;
		border: 1px solid var(--tc-hairline);
		table-layout: fixed;
	}

	.tabs-compare__lists {
		display: none;
	}

	.tabs-compare__head {
		padding: 1.375rem var(--space-sm);  /* ~64px tall. */
		font-family: var(--font-body);
		font-size: 1.0625rem;
		font-weight: 500;
		text-align: start;
		color: var(--tc-cell-text);
	}

	.tabs-compare__head--pros {
		background-color: var(--tc-pros-head);
	}

	.tabs-compare__head--cons {
		background-color: var(--tc-cons-head);
	}

	.tabs-compare__cell {
		padding: var(--space-sm);
		border-block-start: 1px solid var(--tc-hairline);
		vertical-align: top;
		color: var(--tc-cell-text);
		font-size: var(--font-size-sm);
		line-height: 1.43;
		overflow-wrap: anywhere;
	}

	.tabs-compare__cell--pros {
		background-color: var(--tc-pros-cell);
	}

	.tabs-compare__cell--cons {
		background-color: var(--tc-cons-cell);
	}
}

@media (min-width: 64em) { /* --bp-lg */
	.sp-section--tabs_compare {
		--tc-tab-gap: 2.5rem;    /* ~40px. */
		--tc-column-gap: 6.75rem; /* ~108px. */
	}

	.tabs-compare {
		gap: var(--space-xl);
	}

	.tabs-compare__intro {
		font-size: var(--t-subtitle-size);
	}

	.tabs-compare__panel {
		grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr); /* ~492 : ~544. */
		column-gap: var(--tc-column-gap);
		align-items: start;
	}

	/* No table (the table is optional): the title and text at the start, the media at the end, in the same
	   columns as a panel with a table. Proposal, no frame (IoT Sensors). TODO: verify in Figma. */
	.tabs-compare__panel--no-table {
		grid-template-columns: minmax(0, 1fr);
	}

	.tabs-compare__panel--no-table .tabs-compare__main {
		display: grid;
		grid-template-columns: minmax(0, 0.9fr) minmax(0, 1fr);
		grid-auto-rows: min-content;
		column-gap: var(--tc-column-gap);
	}

	.tabs-compare__panel--no-table .tabs-compare__main > :not(.tabs-compare__media) {
		grid-column: 1;
	}

	.tabs-compare__panel--no-table .tabs-compare__media {
		grid-column: 2;
		grid-row: 1 / span 3;
		margin-block-start: 0;
	}

	/* With a tab link: a fourth row takes the media's extra height, so the title, text and link stay together at the
	   top (a panel without a link is unchanged). */
	.tabs-compare__panel--no-table .tabs-compare__main:has(> .tabs-compare__link) {
		grid-template-rows: min-content min-content min-content 1fr;
	}

	.tabs-compare__panel--no-table .tabs-compare__main:has(> .tabs-compare__link) .tabs-compare__media {
		grid-row: 1 / span 4;
	}
}

/* ==========================================================================
   Tab style "Boxed" and Media layout "Full width" (2026-11-16; Industry Solutions as on cartrack.id)
   A centred, wrapping row of boxed tabs (1px #dbdddf, an icon and a 14px title; orange with white text when
   selected), a peach panel (#fff6f1, 40px padding) with the title in the h4 style, the text and a filled
   "Continue reading" button at 45% beside the media at 55% (6px radius). Media layout Full width: the media
   under the text across the panel. Every value TODO: verify in Figma (no frame; read from the source CSS).
   Phones (proposal, TODO): the boxed tabs wrap above the panel (cartrack.id shows an accordion there).
   ========================================================================== */

.tabs-compare--boxed {
	--tc-box-border: #dbdddf;
	--tc-box-text: rgba(0, 0, 0, 0.87);
	--tc-box-panel: #fff6f1;
	--tc-box-gap: 0.75rem;
	--tc-box-icon: 1.5rem;
	--tc-box-radius: 0.375rem;
	--media-ratio: 16 / 9;                     /* The source panels hold 16:9 videos. */
	--media-ratio-number: 1.7778;
}

.tabs-compare--boxed .tabs-compare__tablist {
	flex-wrap: wrap;
	justify-content: center;
	gap: var(--tc-box-gap);
	overflow: visible;
	border-block-end: 0;
}

.tabs-compare--boxed .tabs-compare__tab {
	display: inline-flex;
	align-items: center;
	gap: var(--space-xs);
	min-block-size: 3.5rem;
	margin: 0;
	padding: var(--space-xs) var(--space-md);
	border: 1px solid var(--tc-box-border);
	border-radius: var(--radius-sm);
	background: var(--color-bg, #ffffff);
	color: var(--tc-box-text);
	font-family: var(--font-body);
	font-size: var(--t-small-size);
	font-weight: 400;
	line-height: var(--t-small-line-height);
	text-align: start;
}

.tabs-compare--boxed .tabs-compare__tab[aria-selected="true"] {
	border-color: var(--color-primary);
	background: var(--color-primary);
	color: var(--color-text-inverse);
}

.tabs-compare__tab-icon {
	flex: none;
	inline-size: var(--tc-box-icon);
	block-size: var(--tc-box-icon);
	object-fit: contain;
}

/* The orange industry icons turn white on the selected (orange) tab. */
.tabs-compare--boxed .tabs-compare__tab[aria-selected="true"] .tabs-compare__tab-icon {
	filter: brightness(0) invert(1);
}

@media (hover: hover) {
	.tabs-compare--boxed .tabs-compare__tab:not([aria-selected="true"]):hover {
		border-color: var(--color-primary);
		color: var(--tc-box-text);
	}
}

.tabs-compare--boxed .tabs-compare__panel {
	padding: var(--space-lg);
	background: var(--tc-box-panel);
}

.tabs-compare--boxed .tabs-compare__title {
	font-family: var(--t-h4-family);
	font-size: var(--t-h4-size);
	font-weight: var(--t-h4-weight);
	line-height: var(--t-h4-line-height);
}

.tabs-compare--boxed .tabs-compare__media .media {
	border-radius: var(--tc-box-radius);
}

.tabs-compare__link--button {
	margin-block-start: var(--space-md);
}

@media (min-width: 64em) { /* --bp-lg */
	.tabs-compare--boxed .tabs-compare__panel {
		padding: 2.5rem;
	}

	.tabs-compare--boxed .tabs-compare__panel--no-table .tabs-compare__main {
		grid-template-columns: minmax(0, 45fr) minmax(0, 55fr);
		column-gap: 1.25rem;
		align-items: center;
	}

	/* Media layout "Full width": one column, the media under the text across the panel. */
	.tabs-compare--media-full .tabs-compare__panel--no-table .tabs-compare__main {
		grid-template-columns: minmax(0, 1fr);
	}

	.tabs-compare--media-full .tabs-compare__panel--no-table .tabs-compare__media,
	.tabs-compare--media-full .tabs-compare__panel--no-table .tabs-compare__main:has(> .tabs-compare__link) .tabs-compare__media {
		grid-column: 1;
		grid-row: auto;
		margin-block-start: var(--space-lg);
	}

	.tabs-compare--media-full .tabs-compare__panel--no-table .tabs-compare__main:has(> .tabs-compare__link) {
		grid-template-rows: none;
	}
}
