/**
 * Customer facing tracker.
 *
 * Everything is scoped to .ako-ecu-tracker and inherits the theme's font, so
 * the widget sits inside any page without fighting it. The timeline borrows
 * the ECU's own vocabulary: a copper trace with solder pads, filled where the
 * job is done and lit where the ECU is right now.
 */

.ako-ecu-tracker {
	--ako-ink: #16211d;
	--ako-muted: #6b7671;
	--ako-line: #e2e7e3;
	--ako-surface: #ffffff;
	--ako-tint: #f6f8f6;
	--ako-copper: #b4762c;
	--ako-copper-soft: #f6ecdc;
	--ako-copper-ink: #7a4f14;
	--ako-green: #1f7a4c;
	--ako-mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;

	direction: rtl;
	text-align: right;
	max-width: 42rem;
	margin: 0 auto;
	color: var(--ako-ink);
	line-height: 1.7;
}

.ako-ecu-tracker *,
.ako-ecu-tracker *::before,
.ako-ecu-tracker *::after {
	box-sizing: border-box;
}

.ako-ecu-tracker__title {
	font-size: 1.25rem;
	margin: 0 0 1rem;
	color: inherit;
}

.ako-ecu-mono {
	font-family: var(--ako-mono);
	font-variant-numeric: tabular-nums;
	letter-spacing: .02em;
}

/* --- Lookup form -------------------------------------------------------- */

.ako-ecu-tracker__form {
	margin: 0 0 1.25rem;
}

.ako-ecu-tracker__label {
	display: block;
	font-size: .875rem;
	color: var(--ako-muted);
	margin-bottom: .4rem;
}

.ako-ecu-tracker__row {
	display: flex;
	gap: .5rem;
	flex-wrap: wrap;
}

.ako-ecu-tracker__row input[type="text"] {
	flex: 1 1 14rem;
	min-width: 0;
	font-family: var(--ako-mono);
	font-variant-numeric: tabular-nums;
	font-size: 1rem;
	padding: .6rem .8rem;
	color: var(--ako-ink);
	background: var(--ako-surface);
	border: 1px solid var(--ako-line);
	border-radius: 8px;
}

.ako-ecu-tracker__row input[type="text"]:focus {
	outline: 2px solid var(--ako-copper);
	outline-offset: 1px;
	border-color: var(--ako-copper);
}

.ako-ecu-tracker__button {
	flex: 0 0 auto;
	padding: .6rem 1.6rem;
	font: inherit;
	font-weight: 600;
	color: #fff;
	background: var(--ako-ink);
	border: 1px solid var(--ako-ink);
	border-radius: 8px;
	cursor: pointer;
	transition: background .15s ease;
}

.ako-ecu-tracker__button:hover {
	background: #24352e;
}

.ako-ecu-tracker__button:focus-visible {
	outline: 2px solid var(--ako-copper);
	outline-offset: 2px;
}

/* --- Result card -------------------------------------------------------- */

.ako-ecu-result {
	background: var(--ako-surface);
	border: 1px solid var(--ako-line);
	border-radius: 12px;
	overflow: hidden;
}

.ako-ecu-result__head {
	background: var(--ako-tint);
	border-bottom: 1px solid var(--ako-line);
	padding: .9rem 1.25rem;
}

.ako-ecu-result__caption {
	display: block;
	font-size: .75rem;
	letter-spacing: .08em;
	color: var(--ako-muted);
}

.ako-ecu-result__serial {
	display: inline-block;
	margin-top: .15rem;
	font-family: var(--ako-mono);
	font-variant-numeric: tabular-nums;
	font-size: 1.35rem;
	font-weight: 700;
	letter-spacing: .04em;
	color: var(--ako-ink);
}

/* --- Facts -------------------------------------------------------------- */

.ako-ecu-facts {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 1rem;
	margin: 0;
	padding: 1rem 1.25rem;
	border-bottom: 1px solid var(--ako-line);
}

.ako-ecu-facts__item {
	min-width: 0;
}

.ako-ecu-facts dt {
	font-size: .75rem;
	letter-spacing: .08em;
	color: var(--ako-muted);
	margin: 0;
}

.ako-ecu-facts dd {
	margin: .15rem 0 0;
	font-weight: 600;
	overflow-wrap: anywhere;
}

/* --- Timeline ----------------------------------------------------------- */

.ako-ecu-timeline {
	list-style: none;
	margin: 0;
	padding: 1.25rem 1.25rem .5rem;
}

.ako-ecu-timeline__step {
	position: relative;
	padding: 0 2rem .95rem 0;
	margin: 0;
	list-style: none;
}

/* The trace running between pads. */
.ako-ecu-timeline__step::before {
	content: "";
	position: absolute;
	top: 1.15rem;
	bottom: -.15rem;
	right: .43rem;
	width: 2px;
	background: var(--ako-line);
}

.ako-ecu-timeline__step:last-child {
	padding-bottom: .5rem;
}

.ako-ecu-timeline__step:last-child::before {
	display: none;
}

.ako-ecu-timeline__step.is-done::before {
	background: var(--ako-green);
}

/* A solder pad, filled once that step has happened. */
.ako-ecu-timeline__pad {
	position: absolute;
	top: .3rem;
	right: 0;
	width: .95rem;
	height: .95rem;
	border: 2px solid var(--ako-line);
	border-radius: 3px;
	background: var(--ako-surface);
}

.ako-ecu-timeline__step.is-done .ako-ecu-timeline__pad {
	background: var(--ako-green);
	border-color: var(--ako-green);
}

/* The via in the middle of a finished pad. */
.ako-ecu-timeline__step.is-done .ako-ecu-timeline__pad::after {
	content: "";
	position: absolute;
	top: 50%;
	right: 50%;
	transform: translate(50%, -50%);
	width: .3rem;
	height: .3rem;
	border-radius: 50%;
	background: var(--ako-surface);
}

.ako-ecu-timeline__step.is-current .ako-ecu-timeline__pad {
	background: var(--ako-copper);
	border-color: var(--ako-copper);
	box-shadow: 0 0 0 4px rgba(180, 118, 44, .16);
	animation: ako-ecu-live 2.4s ease-in-out infinite;
}

@keyframes ako-ecu-live {
	0%, 100% {
		box-shadow: 0 0 0 3px rgba(180, 118, 44, .12);
	}
	50% {
		box-shadow: 0 0 0 7px rgba(180, 118, 44, .04);
	}
}

.ako-ecu-timeline__body {
	min-width: 0;
}

.ako-ecu-timeline__label {
	display: block;
	font-weight: 600;
	line-height: 1.5;
}

.ako-ecu-timeline__step.is-upcoming .ako-ecu-timeline__label {
	color: var(--ako-muted);
	font-weight: 400;
}

.ako-ecu-timeline__step.is-current .ako-ecu-timeline__label {
	color: var(--ako-copper-ink);
}

.ako-ecu-timeline__date {
	display: block;
	font-size: .8rem;
	color: var(--ako-muted);
	font-variant-numeric: tabular-nums;
}

.ako-ecu-timeline__note {
	margin: .3rem 0 0;
	font-size: .875rem;
	color: var(--ako-muted);
}

.ako-ecu-timeline__tracking {
	display: inline-flex;
	align-items: center;
	gap: .4rem;
	margin-top: .45rem;
	font-size: .8rem;
	color: var(--ako-copper-ink);
}

.ako-ecu-timeline__tracking code {
	background: var(--ako-copper-soft);
	border: 1px solid #e6d3b4;
	border-radius: 4px;
	padding: .1rem .5rem;
	font-size: .85rem;
	color: var(--ako-copper-ink);
}

/* --- Messages ----------------------------------------------------------- */

.ako-ecu-message {
	margin: 0;
	padding: .85rem 1rem;
	border: 1px solid var(--ako-line);
	border-inline-start: 3px solid var(--ako-muted);
	border-radius: 8px;
	background: var(--ako-tint);
	font-size: .95rem;
}

.ako-ecu-message--empty {
	border-inline-start-color: var(--ako-copper);
}

.ako-ecu-message--warning {
	border-inline-start-color: #c2410c;
}

/* --- Small screens ------------------------------------------------------ */

@media (max-width: 30rem) {
	.ako-ecu-facts {
		grid-template-columns: 1fr;
		gap: .75rem;
	}

	.ako-ecu-tracker__button {
		flex: 1 1 100%;
	}
}

@media (prefers-reduced-motion: reduce) {
	.ako-ecu-timeline__step.is-current .ako-ecu-timeline__pad {
		animation: none;
	}

	.ako-ecu-tracker__button {
		transition: none;
	}
}

/* --- Authenticity check ([ako_ecu_verify]) ------------------------------- */

.ako-ecu-verify__result {
	border-top: 3px solid #1a7f37;
}

.ako-ecu-verify__verdict {
	display: flex;
	align-items: baseline;
	gap: .5em;
	margin: 0 0 1em;
	font-size: 1.02em;
}

.ako-ecu-verify__tick {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 1.5em;
	height: 1.5em;
	border-radius: 50%;
	background: #1a7f37;
	color: #fff;
	font-size: .8em;
}

.ako-ecu-verify__note {
	margin: 1.2em 0 0;
	padding-top: .8em;
	border-top: 1px solid #e5e7eb;
	color: #6b7280;
	font-size: .85em;
}
