/**
 * Section: Goals table
 *
 * Mobile-first, following the mobile frame: centred header, full-width CTA,
 * column labels hidden, each goal stacked (badge + title, then solutions),
 * plain warm background. From --bp-md: column labels, and the labels and
 * every row share one 2-column grid (solutions start at about the middle),
 * with the soft blue background glows. All values come from tokens.css.
 *
 * @package cartrack
 */

.goals {
	position: relative;
	isolation: isolate;
	overflow: hidden;
	padding-block: var(--goals-padding-y);
	background-color: var(--section-warm-bg);
	color: var(--color-text);
}

/* Not in the mobile frame. */
.goals__bg {
	display: none;
}

.goals__inner {
	max-width: calc(var(--goals-max) + 2 * var(--container-gutter));
	margin-inline: auto;
	padding-inline: var(--container-gutter);
}

/* ---------- Header ---------- */

.goals__header {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--goals-heading-gap);
	text-align: center;
}

.goals__heading {
	margin: 0;
	color: inherit;
	font-family: var(--t-h2-family);
	font-size: var(--t-h2-size);
	font-weight: var(--t-h2-weight);
	line-height: var(--t-h2-line-height);
	letter-spacing: var(--t-h2-tracking);
}

.goals__intro {
	max-width: var(--goals-intro-max);
	margin: 0;
	color: var(--color-text-muted);
	font-family: var(--t-body-family);
	font-size: var(--t-body-size);
	font-weight: var(--t-body-weight);
	line-height: var(--t-body-line-height);
	letter-spacing: var(--t-body-tracking);
}

/* Shared .cta-bar with the dark variant. */
.goals__cta {
	margin-top: var(--goals-cta-gap);
}

/* ---------- Table ---------- */

.goals__table {
	margin-top: var(--goals-table-gap);
}

.goals__header + .goals__table {
	margin-top: var(--goals-cta-gap);
}

.goals__labels {
	display: none;
}

.goals__list {
	margin: 0;
	padding: 0;
	list-style: none;
}

.goals__row {
	display: flex;
	flex-direction: column;
	gap: var(--space-md);
	padding-block: var(--goals-row-padding-mobile);
	border-bottom: 1px solid var(--goals-divider);
}

.goals__row:first-child {
	padding-top: 0;
}

/* Baseline alignment keeps the badge number level with the title's first line. */
.goals__title {
	display: flex;
	align-items: baseline;
	gap: var(--goals-badge-gap);
	margin: 0;
	color: var(--color-text);
	font-family: var(--font-body);
	font-size: var(--goals-title-size);
	font-weight: var(--font-weight-medium);
	line-height: var(--line-height-snug);
}

.goals__badge {
	display: inline-grid;
	flex: none;
	place-items: center;
	width: var(--goals-badge-size);
	height: var(--goals-badge-size);
	border-radius: var(--radius-sm);
	background-color: var(--goals-badge-bg);
	color: var(--color-text);
	font-size: var(--font-size-sm);
	font-weight: var(--font-weight-regular);
	line-height: 1;
}

/* ---------- Solutions (sanitised WYSIWYG) ---------- */

.goals__solutions {
	color: var(--color-text-muted);
	font-family: var(--font-body);
	font-size: var(--goals-solution-size);
	line-height: var(--line-height-body);
}

.goals__solutions ul {
	display: flex;
	flex-direction: column;
	gap: var(--goals-solution-gap);
	margin: 0;
	padding: 0;
	list-style: none;
}

.goals__solutions li {
	position: relative;
	padding-inline-start: calc(var(--goals-bullet-size) + var(--space-sm));
}

/* Small dot bullet, centred on the first line. */
.goals__solutions li::before {
	content: "";
	position: absolute;
	top: calc(0.775em - var(--goals-bullet-size) / 2); /* Fallback without the lh unit (line-height 1.55). */
	top: calc(0.5lh - var(--goals-bullet-size) / 2);
	left: 0;
	width: var(--goals-bullet-size);
	height: var(--goals-bullet-size);
	border-radius: 50%;
	background-color: var(--color-text);
}

.goals__solutions a {
	color: var(--color-text);
	text-decoration: underline;
	text-underline-offset: 0.2em;
	text-decoration-thickness: 1px;
}

/* TODO: verify hover state in Figma (no hover frame supplied). */
.goals__solutions a:hover {
	color: var(--color-primary);
}

.goals__solutions a:focus-visible {
	outline: 2px solid var(--color-focus-dark);
	outline-offset: 2px;
	border-radius: var(--radius-sm);
}

.goals__solutions strong {
	color: var(--color-text);
	font-weight: var(--font-weight-medium);
}

/* ==========================================================================
   From --bp-md: shared 2-column grid, labels, background glows
   ========================================================================== */

@media (min-width: 48em) { /* --bp-md */
	.goals__bg {
		position: absolute;
		inset: 0;
		z-index: -1;
		display: block;
		width: 100%;
		height: 100%;
		object-fit: cover;
		pointer-events: none;
	}

	.goals__labels,
	.goals__row {
		display: grid;
		grid-template-columns: repeat(2, minmax(0, 1fr));
		column-gap: var(--goals-col-gap);
	}

	.goals__labels {
		padding-bottom: var(--goals-label-gap);
		border-bottom: 1px solid var(--goals-divider);
	}

	.goals__label {
		font-family: var(--font-heading);
		font-size: var(--goals-label-size);
		font-weight: var(--font-weight-semibold);
		letter-spacing: var(--letter-spacing-eyebrow);
		text-transform: uppercase;
	}

	.goals__row,
	.goals__row:first-child {
		padding-block: var(--goals-row-padding-top) var(--goals-row-padding-bottom);
	}

	.goals__table {
		margin-top: var(--goals-table-gap);
	}
}

/* ---------- Desktop ---------- */

@media (min-width: 64em) { /* --bp-lg */
	.goals {
		padding-block: var(--goals-padding-y-desktop);
	}

	.goals__cta {
		margin-top: var(--goals-cta-gap-desktop);
	}
}
