/*
 * Extreme Custom Tracking — public tracking page.
 *
 * Tokens come first; every rule below uses them. The brand colour and the
 * colours derived from it (text on it, a readable shade, a tint) are set
 * inline on .ect by PHP from Settings. Fonts are inherited from the theme.
 * Selectors are one level more specific than typical theme rules
 * (.ect .ect-…) because themes like to restyle every button and heading.
 */

.ect {
	--ect-primary: #0073aa;
	--ect-on-primary: #ffffff;
	--ect-primary-ink: #0073aa;
	--ect-primary-tint: #e6f1f7;

	--ect-ink: #101828;
	--ect-body: #344054;
	--ect-muted: #667085;
	--ect-line: #eaecf0;
	--ect-surface: #ffffff;
	--ect-subtle: #f9fafb;
	--ect-danger: #b42318;
	--ect-danger-tint: #fef3f2;
	--ect-warning: #b54708;

	--ect-radius: 14px;
	--ect-radius-sm: 10px;
	--ect-gap: 16px;
	--ect-pad: clamp(18px, 3.2cqi, 28px);
	--ect-title-size: clamp(22px, 3.4cqi, 30px);
	--ect-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;
	--ect-shadow: 0 1px 2px rgba(16, 24, 40, 0.05);
	--ect-focus: 0 0 0 3px color-mix(in srgb, var(--ect-primary) 35%, transparent);

	container-type: inline-size;
	display: grid;
	gap: var(--ect-gap);
	color: var(--ect-body);
	font-family: inherit;
	font-size: 16px;
	line-height: 1.55;
	text-align: left;
	margin-block: 8px 24px;
}

.ect *,
.ect *::before,
.ect *::after { box-sizing: border-box; }

.ect p,
.ect h2,
.ect h3,
.ect h4,
.ect ol,
.ect ul,
.ect dl,
.ect dd { margin: 0; padding: 0; }
.ect ol,
.ect ul { list-style: none; }

.ect .ect-icon { width: 1.25em; height: 1.25em; flex: none; display: block; }
.ect .ect-mono { font-family: var(--ect-mono); letter-spacing: 0.02em; font-size: 0.95em; }
.ect .ect-eyebrow {
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: var(--ect-muted);
}

/* ── Cards ─────────────────────────────────────────────────────────────── */

.ect .ect-card {
	background: var(--ect-surface);
	border: 1px solid var(--ect-line);
	border-radius: var(--ect-radius);
	box-shadow: var(--ect-shadow);
	padding: var(--ect-pad);
	min-width: 0;
}

.ect .ect-heading {
	display: flex;
	align-items: center;
	gap: 10px;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--ect-ink);
	text-transform: none;
	letter-spacing: normal;
	margin-bottom: 18px;
}
.ect .ect-heading .ect-icon { color: var(--ect-primary-ink); }

/* ── Search ────────────────────────────────────────────────────────────── */

.ect .ect-search {
	background: var(--ect-surface);
	border: 1px solid var(--ect-line);
	border-radius: var(--ect-radius);
	box-shadow: var(--ect-shadow);
	padding: var(--ect-pad);
	display: grid;
	gap: 10px;
}

.ect .ect-search__label {
	font-size: var(--ect-title-size);
	font-weight: 700;
	line-height: 1.2;
	color: var(--ect-ink);
	letter-spacing: -0.01em;
	text-wrap: balance;
}

.ect .ect-search__row { display: flex; gap: 10px; flex-wrap: wrap; }

.ect input.ect-input {
	flex: 1 1 240px;
	min-width: 0;
	height: 52px;
	margin: 0;
	padding: 0 16px;
	border: 1px solid #d0d5dd;
	border-radius: var(--ect-radius-sm);
	background: var(--ect-surface);
	color: var(--ect-ink);
	font-family: var(--ect-mono);
	font-size: 17px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	box-shadow: none;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ect input.ect-input::placeholder { color: #98a2b3; text-transform: none; letter-spacing: normal; font-family: inherit; }
.ect input.ect-input:focus { border-color: var(--ect-primary); box-shadow: var(--ect-focus); }

.ect button.ect-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 52px;
	min-width: 120px;
	margin: 0;
	padding: 0 22px;
	border: 0;
	border-radius: var(--ect-radius-sm);
	background: var(--ect-primary);
	color: var(--ect-on-primary);
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	transition: filter 0.15s ease, box-shadow 0.15s ease;
}
.ect button.ect-button:hover { filter: brightness(0.94); background: var(--ect-primary); color: var(--ect-on-primary); }
.ect button.ect-button:focus-visible { outline: none; box-shadow: var(--ect-focus); }

.ect .ect-search__hint { font-size: 14px; color: var(--ect-muted); }

/* ── Notices ───────────────────────────────────────────────────────────── */

.ect .ect-notice {
	display: flex;
	gap: 12px;
	align-items: flex-start;
	padding: 16px 18px;
	border-radius: var(--ect-radius-sm);
	font-size: 15px;
	border: 1px solid transparent;
}
.ect .ect-notice > .ect-icon { margin-top: 2px; }
.ect .ect-notice__title { font-weight: 700; color: inherit; margin-bottom: 2px; }
.ect .ect-notice--error { background: var(--ect-danger-tint); color: var(--ect-danger); border-color: #fecdca; }
.ect .ect-notice--error p:not(.ect-notice__title) { color: #7a271a; }
.ect .ect-notice--exception {
	background: var(--ect-status-tint);
	color: var(--ect-status-ink);
	border-color: color-mix(in srgb, var(--ect-status-dot) 30%, transparent);
}

/* ── Summary ───────────────────────────────────────────────────────────── */

.ect .ect-summary { display: grid; gap: 22px; border-top: 4px solid var(--ect-status-dot); }

.ect .ect-summary__head { display: flex; gap: 16px; align-items: center; }
.ect .ect-summary__icon {
	display: grid;
	place-items: center;
	width: 56px;
	height: 56px;
	flex: none;
	border-radius: 50%;
	background: var(--ect-status-tint);
	color: var(--ect-status-ink);
}
.ect .ect-summary__icon .ect-icon { width: 28px; height: 28px; }
.ect .ect-summary__text { min-width: 0; }
.ect h2.ect-title {
	font-size: var(--ect-title-size);
	font-weight: 800;
	line-height: 1.15;
	color: var(--ect-ink);
	letter-spacing: -0.015em;
	text-transform: none;
	margin: 2px 0 4px;
}
.ect .ect-summary__meta { font-size: 14px; color: var(--ect-muted); }

.ect .ect-facts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	border: 1px solid var(--ect-line);
	border-radius: var(--ect-radius-sm);
	overflow: hidden;
}
.ect .ect-fact { padding: 14px 16px; min-width: 0; border-right: 1px solid var(--ect-line); background: var(--ect-subtle); }
.ect .ect-fact:last-child { border-right: 0; }
.ect .ect-fact dt { font-size: 13px; color: var(--ect-muted); margin-bottom: 4px; }
.ect .ect-fact dd { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 16px; font-weight: 700; color: var(--ect-ink); overflow-wrap: anywhere; }
.ect .ect-fact__sub { font-size: 13px; font-weight: 500; color: var(--ect-muted); }
.ect .ect-fact__sub.is-late { color: var(--ect-warning); font-weight: 600; }
.ect .ect-fact__none { font-weight: 500; color: var(--ect-muted); }

.ect button.ect-copy {
	display: inline-grid;
	place-items: center;
	width: 32px;
	height: 32px;
	margin: 0;
	padding: 0;
	border: 1px solid var(--ect-line);
	border-radius: 8px;
	background: var(--ect-surface);
	color: var(--ect-muted);
	cursor: pointer;
	box-shadow: none;
	transition: color 0.15s ease, border-color 0.15s ease;
}
.ect button.ect-copy:hover { color: var(--ect-primary-ink); border-color: var(--ect-primary); background: var(--ect-surface); }
.ect button.ect-copy:focus-visible { outline: none; box-shadow: var(--ect-focus); }
.ect button.ect-copy .ect-icon { width: 16px; height: 16px; }
.ect button.ect-copy.is-copied { color: #15803d; border-color: #86efac; }

.ect .ect-summary__note {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	font-size: 15px;
	color: var(--ect-body);
	background: var(--ect-primary-tint);
	border-radius: var(--ect-radius-sm);
	padding: 12px 14px;
}
.ect .ect-summary__note .ect-icon { color: var(--ect-primary-ink); margin-top: 2px; }

/* ── Progress ──────────────────────────────────────────────────────────── */

.ect .ect-steps {
	display: grid;
	grid-template-columns: repeat(5, minmax(0, 1fr));
	background: var(--ect-surface);
	border: 1px solid var(--ect-line);
	border-radius: var(--ect-radius);
	box-shadow: var(--ect-shadow);
	padding: 22px 12px 18px;
}
.ect .ect-step {
	position: relative;
	display: grid;
	justify-items: center;
	gap: 8px;
	text-align: center;
	min-width: 0;
}
.ect .ect-step::before {
	content: "";
	position: absolute;
	top: 19px;
	right: 50%;
	width: 100%;
	height: 3px;
	background: var(--ect-line);
	z-index: 0;
}
.ect .ect-step:first-child::before { display: none; }
.ect .ect-step.is-done::before,
.ect .ect-step.is-current::before,
.ect .ect-step.is-complete::before { background: var(--ect-primary); }

.ect .ect-step__dot {
	position: relative;
	z-index: 1;
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background: var(--ect-subtle);
	border: 2px solid var(--ect-line);
	color: #98a2b3;
}
.ect .ect-step__dot .ect-icon { width: 18px; height: 18px; }
.ect .ect-step__label { font-size: 13px; line-height: 1.3; color: var(--ect-muted); font-weight: 500; overflow-wrap: anywhere; }

.ect .ect-step.is-done .ect-step__dot { background: var(--ect-primary); border-color: var(--ect-primary); color: var(--ect-on-primary); }
.ect .ect-step.is-done .ect-step__label { color: var(--ect-body); }
.ect .ect-step.is-current .ect-step__dot,
.ect .ect-step.is-complete .ect-step__dot {
	background: var(--ect-primary);
	border-color: var(--ect-primary);
	color: var(--ect-on-primary);
	box-shadow: 0 0 0 6px var(--ect-primary-tint);
}
.ect .ect-step.is-complete .ect-step__dot { background: #16a34a; border-color: #16a34a; color: #fff; box-shadow: 0 0 0 6px #dcfce7; }
.ect .ect-step.is-current .ect-step__label,
.ect .ect-step.is-complete .ect-step__label { color: var(--ect-ink); font-weight: 700; }
.ect .ect-step.is-exception .ect-step__dot { background: var(--ect-status-tint, #fffbeb); border-color: var(--ect-status-dot, #d97706); color: var(--ect-status-ink, #92400e); box-shadow: 0 0 0 6px var(--ect-status-tint, #fffbeb); }
.ect .ect-step.is-exception .ect-step__label { color: var(--ect-status-ink, #92400e); font-weight: 700; }

/* Where the parcel is now: the step pulses like the vehicle on the map, and
   the line leading to it shimmers forward. */
.ect .ect-step.is-current .ect-step__dot::after,
.ect .ect-step.is-exception .ect-step__dot::after {
	content: "";
	position: absolute;
	inset: -2px;
	border-radius: 50%;
	background: var(--ect-primary);
	z-index: -1;
	animation: ect-pulse 2.2s ease-out infinite;
}
.ect .ect-step.is-exception .ect-step__dot::after { background: var(--ect-status-dot, #d97706); }
.ect .ect-step.is-current::before {
	background: linear-gradient(90deg, var(--ect-primary) 0%, var(--ect-primary) 35%, color-mix(in srgb, var(--ect-primary) 35%, #ffffff) 50%, var(--ect-primary) 65%, var(--ect-primary) 100%);
	background-size: 200% 100%;
	animation: ect-flow 1.8s linear infinite;
}
@keyframes ect-pulse {
	0% { transform: scale(1); opacity: 0.55; }
	100% { transform: scale(1.9); opacity: 0; }
}
@keyframes ect-flow {
	from { background-position: 100% 0; }
	to { background-position: -100% 0; }
}
@media (prefers-reduced-motion: reduce) {
	.ect .ect-step__dot::after,
	.ect .ect-step.is-current::before { animation: none; }
}

/* ── Current location ──────────────────────────────────────────────────── */

.ect .ect-location {
	display: flex;
	gap: 10px;
	align-items: flex-start;
	padding: 14px 18px;
	border-radius: var(--ect-radius-sm);
	background: var(--ect-primary-tint);
	color: var(--ect-ink);
	font-size: 15px;
	overflow-wrap: anywhere;
}
.ect .ect-location .ect-icon { color: var(--ect-primary-ink); margin-top: 2px; }
.ect .ect-location__label { font-weight: 700; }

/* ── Timeline + map ────────────────────────────────────────────────────── */

.ect .ect-split { display: grid; gap: var(--ect-gap); grid-template-columns: minmax(0, 1fr); }

.ect .ect-events { display: grid; gap: 0; }
.ect .ect-event {
	position: relative;
	display: grid;
	grid-template-columns: 22px minmax(0, 1fr);
	gap: 12px;
	padding-bottom: 20px;
}
.ect .ect-event:last-child { padding-bottom: 0; }
.ect .ect-event::before {
	content: "";
	position: absolute;
	left: 10px;
	top: 20px;
	bottom: 0;
	width: 2px;
	background: var(--ect-line);
}
.ect .ect-event:last-child::before { display: none; }
.ect .ect-event__dot {
	position: relative;
	z-index: 1;
	width: 12px;
	height: 12px;
	margin: 6px 0 0 5px;
	border-radius: 50%;
	background: var(--ect-surface);
	border: 3px solid var(--ect-status-dot);
}
.ect .ect-event.is-latest .ect-event__dot {
	width: 16px;
	height: 16px;
	margin: 4px 0 0 3px;
	background: var(--ect-status-dot);
	box-shadow: 0 0 0 4px color-mix(in srgb, var(--ect-status-dot) 18%, transparent);
}
.ect .ect-event__title { font-weight: 700; color: var(--ect-ink); font-size: 15px; }
.ect .ect-event.is-latest .ect-event__title { font-size: 16px; }
.ect .ect-event__meta { font-size: 13px; color: var(--ect-muted); }
.ect .ect-event__note { font-size: 14px; color: var(--ect-body); margin-top: 4px; }

.ect .ect-mapcard { display: grid; align-content: start; }
.ect .ect-map {
	height: 400px;
	border-radius: var(--ect-radius-sm);
	border: 1px solid var(--ect-line);
	z-index: 0;
}
.ect .ect-legend { display: grid; gap: 6px; margin-top: 14px; font-size: 14px; }
.ect .ect-legend__item { display: flex; gap: 10px; align-items: baseline; min-width: 0; overflow-wrap: anywhere; }
.ect .ect-legend__item strong { color: var(--ect-ink); font-weight: 600; margin-right: 4px; }
.ect .ect-legend__swatch { width: 10px; height: 10px; border-radius: 50%; flex: none; transform: translateY(1px); }
.ect .ect-legend__item.is-pickup .ect-legend__swatch { background: #475569; }
.ect .ect-legend__item.is-current .ect-legend__swatch { background: var(--ect-primary); }
.ect .ect-legend__item.is-delivery .ect-legend__swatch { background: #16a34a; }
.ect .ect-legend__item.is-stop .ect-legend__swatch { background: var(--ect-surface); border: 3px solid var(--ect-primary); }

/* ── Details ───────────────────────────────────────────────────────────── */

.ect .ect-parties { display: grid; gap: 14px; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.ect .ect-party {
	border: 1px solid var(--ect-line);
	border-radius: var(--ect-radius-sm);
	padding: 16px;
	min-width: 0;
	background: var(--ect-subtle);
}
.ect h4.ect-party__title {
	display: flex;
	align-items: center;
	gap: 8px;
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--ect-muted);
	margin-bottom: 12px;
}
.ect .ect-party__title .ect-icon { width: 16px; height: 16px; }
.ect .ect-rows { display: grid; gap: 10px; }
.ect .ect-row { display: grid; gap: 1px; min-width: 0; }
.ect .ect-row dt { font-size: 12px; color: var(--ect-muted); }
.ect .ect-row dd { font-size: 15px; color: var(--ect-ink); overflow-wrap: anywhere; }
.ect .ect-items { display: grid; gap: 2px; }

.ect .ect-empty { color: var(--ect-muted); font-size: 14px; }

/* ── Wider containers ──────────────────────────────────────────────────── */

@container (min-width: 760px) {
	.ect .ect-split { grid-template-columns: minmax(0, 1fr) minmax(0, 1.1fr); align-items: start; }
	.ect .ect-map { height: 460px; }
}

@container (max-width: 480px) {
	.ect .ect-steps { padding-inline: 4px; }
	.ect .ect-step__dot { width: 32px; height: 32px; }
	.ect .ect-step::before { top: 15px; }
	.ect .ect-step__label { font-size: 12px; }
	.ect .ect-fact { border-right: 0; border-bottom: 1px solid var(--ect-line); }
	.ect .ect-fact:last-child { border-bottom: 0; }
	.ect button.ect-button { flex: 1 1 100%; }
	.ect .ect-summary__icon { width: 48px; height: 48px; }
}

/* ── [ect_tracking_form]: the stand-alone search box ─────────────────────── */

.ect-mini {
	--ect-primary: #0073aa;
	--ect-on-primary: #ffffff;
	display: flex;
	flex-wrap: wrap;
	align-items: stretch;
	gap: 12px;
	width: 100%;
	margin: 0;
	padding-block: 14px; /* Breathing room when a builder column has no padding of its own. */
	font-family: inherit;
}
.ect-mini .ect-mini__label {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}
.ect-mini .ect-mini__label.is-visible {
	position: static;
	width: 100%;
	height: auto;
	clip: auto;
	font-weight: 700;
	font-size: 15px;
}
.ect-mini input.ect-mini__input {
	flex: 1 1 260px;
	min-width: 0;
	height: 56px;
	margin: 0;
	padding: 0 18px;
	border: 1px solid rgba(16, 24, 40, 0.18);
	border-radius: 10px;
	background: #ffffff;
	color: #101828;
	font-family: inherit;
	font-size: 17px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	box-shadow: none;
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.ect-mini input.ect-mini__input::placeholder { color: #667085; text-transform: none; letter-spacing: normal; opacity: 1; }
.ect-mini input.ect-mini__input:focus { border-color: var(--ect-primary); box-shadow: 0 0 0 3px color-mix(in srgb, var(--ect-primary) 35%, transparent); }
.ect-mini--dark input.ect-mini__input { background: rgba(255, 255, 255, 0.1); border-color: rgba(255, 255, 255, 0.45); color: #ffffff; }
.ect-mini--dark input.ect-mini__input::placeholder { color: rgba(255, 255, 255, 0.82); }
.ect-mini--dark .ect-mini__label.is-visible { color: #ffffff; }
.ect-mini button.ect-mini__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	height: 56px;
	margin: 0;
	padding: 0 26px;
	border: 0;
	border-radius: 10px;
	background: var(--ect-primary);
	color: var(--ect-on-primary);
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: normal;
	text-transform: none;
	box-shadow: none;
	cursor: pointer;
	transition: filter 0.15s ease;
}
.ect-mini button.ect-mini__button:hover { filter: brightness(0.93); background: var(--ect-primary); color: var(--ect-on-primary); }
.ect-mini button.ect-mini__button:focus-visible { outline: 3px solid #ffffff; outline-offset: 2px; }
.ect-mini button.ect-mini__button .ect-icon { width: 18px; height: 18px; }
@media (max-width: 480px) {
	.ect-mini button.ect-mini__button { flex: 1 1 100%; }
}

@media (prefers-reduced-motion: reduce) {
	.ect *,
	.ect *::before { transition: none !important; }
}
