/**
 * TrackLogy for WooCommerce — customer tracking page.
 *
 * Every rule is scoped under `.tlg-tp` and every value comes from a token
 * defined on that same scope, because this stylesheet lands inside somebody
 * else's theme: nothing may leak out, and a theme's own cascade must not be
 * able to reach in and recolour a status. Fonts are deliberately inherited, so
 * the page reads as part of the store rather than as an embedded widget.
 *
 * Contents
 *   1. Tokens
 *   2. Card and header
 *   3. Progress rail, note
 *   4. Facts
 *   5. Tracking history
 *   6. Order items
 *   7. Lookup form
 *   8. Responsive
 */

/* ==========================================================================
   1. Tokens
   ========================================================================== */

.tlg-tp {
	--tlg-tp-surface: #ffffff;
	--tlg-tp-sunken: #f7f9f9;
	--tlg-tp-line: #e4eaea;
	--tlg-tp-line-soft: #eef2f2;
	--tlg-tp-head: #16212a;
	--tlg-tp-body: #41505c;
	--tlg-tp-muted: #8494a0;
	--tlg-tp-accent: #0b7d76;
	--tlg-tp-radius: 12px;

	/* Overridden per card from the status palette. */
	--tlg-tp-ink: #3f4b54;
	--tlg-tp-bg: #eef1f3;
	--tlg-tp-dot: #64748b;

	max-width: 760px;
	margin: 0 auto 1.5em;
	color: var( --tlg-tp-body );
	font-size: 15px;
	line-height: 1.55;
	text-align: left;
}

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

@media ( prefers-color-scheme: dark ) {
	.tlg-tp {
		--tlg-tp-surface: #161d23;
		--tlg-tp-sunken: #1c252c;
		--tlg-tp-line: #2b363f;
		--tlg-tp-line-soft: #232d35;
		--tlg-tp-head: #eef2f4;
		--tlg-tp-body: #c2ccd3;
		--tlg-tp-muted: #8a99a4;
		--tlg-tp-accent: #2cb3aa;
	}
}

.tlg-tp-order {
	margin: 0 0 0.85em;
	color: var( --tlg-tp-muted );
	font-size: 13.5px;
}

.tlg-tp-order strong {
	color: var( --tlg-tp-head );
}

.tlg-tp-order-count::before {
	content: "·";
	margin: 0 0.5em;
}

.tlg-tp-message {
	margin: 0 0 1em;
	padding: 12px 15px;
	border: 1px solid var( --tlg-tp-line );
	border-left: 3px solid var( --tlg-tp-dot );
	border-radius: 8px;
	background: var( --tlg-tp-sunken );
	font-size: 14px;
}

/* ==========================================================================
   2. Card and header
   ========================================================================== */

.tlg-tp-card {
	margin: 0 0 1em;
	padding: 18px 20px 20px;
	border: 1px solid var( --tlg-tp-line );
	border-radius: var( --tlg-tp-radius );
	background: var( --tlg-tp-surface );
}

.tlg-tp-head {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
	align-items: flex-start;
}

.tlg-tp-tile {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 42px;
	height: 42px;
	border-radius: 9px;
	background: var( --tlg-tp-bg );
	color: var( --tlg-tp-ink );
	font-size: 13px;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.tlg-tp-tile--quiet {
	background: var( --tlg-tp-sunken );
	color: var( --tlg-tp-muted );
}

.tlg-tp-tile svg {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.7;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.tlg-tp-head-main {
	flex: 1 1 180px;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}

.tlg-tp-parcel {
	color: var( --tlg-tp-muted );
	font-size: 11.5px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tlg-tp-carrier {
	color: var( --tlg-tp-head );
	font-size: 16px;
	font-weight: 650;
	line-height: 1.3;
}

.tlg-tp-number {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	align-items: baseline;
	font-family: ui-monospace, "Cascadia Mono", Consolas, monospace;
	font-size: 13px;
	word-break: break-all;
}

.tlg-tp-number a {
	color: var( --tlg-tp-accent );
	text-decoration: none;
}

.tlg-tp-number a:hover,
.tlg-tp-number a:focus {
	text-decoration: underline;
}

.tlg-tp-copy {
	padding: 0;
	border: 0;
	background: none;
	color: var( --tlg-tp-muted );
	font-family: inherit;
	font-size: 11.5px;
	cursor: pointer;
}

.tlg-tp-copy:hover,
.tlg-tp-copy:focus {
	color: var( --tlg-tp-accent );
	text-decoration: underline;
}

.tlg-tp-status {
	flex: 0 0 auto;
	display: inline-flex;
	gap: 7px;
	align-items: center;
	padding: 6px 13px;
	border-radius: 999px;
	background: var( --tlg-tp-bg );
	color: var( --tlg-tp-ink );
	font-size: 12.5px;
	font-weight: 700;
	white-space: nowrap;
}

.tlg-tp-status-dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: var( --tlg-tp-dot );
}

/* ==========================================================================
   3. Progress rail, note
   ========================================================================== */

.tlg-tp-rail {
	margin: 22px 0 4px;
}

.tlg-tp-rail-steps {
	display: flex;
	margin: 0;
	padding: 0;
	list-style: none;
	counter-reset: none;
}

.tlg-tp-rail-steps li {
	flex: 1 1 0;
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	align-items: center;
	margin: 0;
	padding: 0;
	color: var( --tlg-tp-muted );
	font-size: 11.5px;
	line-height: 1.3;
	text-align: center;
}

/* The connector sits behind the marks, drawn from each step to the next. */
.tlg-tp-rail-steps li::before {
	content: "";
	position: absolute;
	top: 5px;
	right: 50%;
	left: -50%;
	height: 2px;
	background: var( --tlg-tp-line );
}

.tlg-tp-rail-steps li:first-child::before {
	display: none;
}

.tlg-tp-rail-steps li.is-done::before {
	background: var( --tlg-tp-accent );
}

.tlg-tp-rail-mark {
	position: relative;
	z-index: 1;
	width: 12px;
	height: 12px;
	border: 2px solid var( --tlg-tp-line );
	border-radius: 50%;
	background: var( --tlg-tp-surface );
}

.tlg-tp-rail-steps li.is-done .tlg-tp-rail-mark {
	border-color: var( --tlg-tp-accent );
	background: var( --tlg-tp-accent );
}

.tlg-tp-rail-steps li.is-done .tlg-tp-rail-label {
	color: var( --tlg-tp-head );
	font-weight: 650;
}

.tlg-tp-note {
	margin: 18px 0 0;
	padding: 13px 15px;
	border-radius: 8px;
	background: var( --tlg-tp-bg );
	color: var( --tlg-tp-ink );
	font-size: 13px;
	line-height: 1.6;
}

/* The "gone quiet" note is information, not a status, so it stays neutral
   rather than borrowing the status colour the card is carrying. */
.tlg-tp-note--quiet {
	background: var( --tlg-tp-sunken );
	border: 1px solid var( --tlg-tp-line );
	color: var( --tlg-tp-body );
}

.tlg-tp-note strong {
	display: block;
	margin-bottom: 2px;
}

/* ==========================================================================
   4. Facts
   ========================================================================== */

.tlg-tp-facts {
	display: grid;
	grid-template-columns: repeat( auto-fit, minmax( 150px, 1fr ) );
	gap: 14px 20px;
	margin: 20px 0 0;
	padding: 16px 0 0;
	border-top: 1px solid var( --tlg-tp-line-soft );
}

.tlg-tp-facts div {
	min-width: 0;
}

.tlg-tp-facts dt {
	margin: 0 0 2px;
	color: var( --tlg-tp-muted );
	font-size: 11.5px;
	font-weight: 400;
}

.tlg-tp-facts dd {
	margin: 0;
	color: var( --tlg-tp-head );
	font-size: 13.5px;
	font-weight: 600;
	overflow-wrap: break-word;
}

/* ==========================================================================
   5. Tracking history
   ========================================================================== */

.tlg-tp-events {
	margin: 18px 0 0;
	padding: 16px 0 0;
	border-top: 1px solid var( --tlg-tp-line-soft );
}

.tlg-tp-events > summary {
	display: flex;
	flex-wrap: wrap;
	gap: 10px;
	align-items: baseline;
	color: var( --tlg-tp-head );
	font-size: 13px;
	font-weight: 650;
	cursor: pointer;
	list-style: none;
}

.tlg-tp-events > summary::-webkit-details-marker {
	display: none;
}

.tlg-tp-events > summary::after {
	content: "";
	width: 7px;
	height: 7px;
	margin-left: auto;
	border-right: 2px solid var( --tlg-tp-muted );
	border-bottom: 2px solid var( --tlg-tp-muted );
	transform: rotate( 45deg );
	transition: transform 0.15s ease;
}

.tlg-tp-events[open] > summary::after {
	transform: rotate( -135deg );
}

.tlg-tp-updated {
	color: var( --tlg-tp-muted );
	font-size: 11.5px;
	font-weight: 400;
}

.tlg-tp-events-heading {
	margin: 18px 0 0;
	color: var( --tlg-tp-muted );
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

/*
 * The rail runs down the whole history, not down each day. It used to be a
 * border-left on every <ul>, which restarted at every date heading and left
 * the line visibly chopped into segments. One pseudo-element on the wrapper
 * draws it once, and the dates sit to its left where it cannot strike through
 * their text.
 */
/*
 * The gap sits on the wrapper rather than on the first date heading, so the
 * space before the first date and the space between later ones both come out
 * at 16px. Margin, not padding: the rail below is positioned against this
 * box, and padding would push it out of line with the dots.
 */
.tlg-tp-days {
	position: relative;
	margin-top: 16px;
	padding-left: 20px;
}

.tlg-tp-days::before {
	content: "";
	position: absolute;
	top: 10px;
	bottom: 10px;
	left: 5px;
	width: 2px;
	background: var( --tlg-tp-line-soft );
}

/*
 * The dates line up with the event text rather than sitting flush with the
 * card. Pulling them out to the left put them on top of the rail, which struck
 * a line through the first letter of every date. Masking the rail behind them
 * would only have reinstated the gap this wrapper exists to remove, so the
 * headings move right of it instead and the rail stays one unbroken line down
 * the side of the whole history.
 */
.tlg-tp-day {
	margin: 16px 0 8px;
	color: var( --tlg-tp-head );
	font-size: 12.5px;
	font-weight: 650;
}

.tlg-tp-days > .tlg-tp-day:first-child {
	margin-top: 0;
}

.tlg-tp-timeline {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tlg-tp-timeline li {
	position: relative;
	display: flex;
	gap: 10px;
	margin: 0;
	padding: 0 0 12px;
}

.tlg-tp-timeline li:last-child {
	padding-bottom: 0;
}

/*
 * Centred on the rail: the wrapper's 20px padding puts list content at x=20,
 * the rail's centre is at x=6, and the dot is 8px wide with box-sizing on,
 * so its left edge sits at 6 - 4 - 20 = -18px.
 */
.tlg-tp-event-mark {
	position: absolute;
	top: 6px;
	left: -18px;
	width: 8px;
	height: 8px;
	border: 2px solid var( --tlg-tp-surface );
	border-radius: 50%;
	background: var( --tlg-tp-line );
}

/*
 * Only the newest event gets the accent dot. Keyed off the wrapper, because
 * li:first-child on its own matched the first event of *every* day and lit up
 * a dot per date heading.
 */
.tlg-tp-days .tlg-tp-timeline:first-of-type li:first-child .tlg-tp-event-mark {
	background: var( --tlg-tp-dot );
}

.tlg-tp-event-body {
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}

.tlg-tp-event-msg {
	color: var( --tlg-tp-body );
	font-size: 13.5px;
}

/* Likewise bold: the newest event only, not one per day. */
.tlg-tp-days .tlg-tp-timeline:first-of-type li:first-child .tlg-tp-event-msg {
	color: var( --tlg-tp-head );
	font-weight: 600;
}

.tlg-tp-event-meta {
	color: var( --tlg-tp-muted );
	font-size: 11.5px;
}

.tlg-tp-last-event {
	margin: 16px 0 0;
	padding: 14px 0 0;
	border-top: 1px solid var( --tlg-tp-line-soft );
	color: var( --tlg-tp-body );
	font-size: 13.5px;
}

.tlg-tp-card--plain .tlg-tp-last-event {
	color: var( --tlg-tp-muted );
}

/* ==========================================================================
   6. Order items
   ========================================================================== */

.tlg-tp-items {
	margin: 1.4em 0 0;
}

.tlg-tp-items h3 {
	margin: 0 0 0.6em;
	color: var( --tlg-tp-muted );
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.tlg-tp-items ul {
	margin: 0;
	padding: 0;
	list-style: none;
}

.tlg-tp-items li {
	display: flex;
	gap: 12px;
	align-items: center;
	margin: 0;
	padding: 9px 0;
	border-bottom: 1px solid var( --tlg-tp-line-soft );
}

.tlg-tp-items li:last-child {
	border-bottom: 0;
}

.tlg-tp-items img,
.tlg-tp-item-blank {
	flex: 0 0 auto;
	width: 44px;
	height: 44px;
	border-radius: 7px;
	background: var( --tlg-tp-sunken );
	object-fit: cover;
}

.tlg-tp-item-name {
	flex: 1 1 auto;
	min-width: 0;
	color: var( --tlg-tp-head );
	font-size: 13.5px;
}

.tlg-tp-item-qty {
	flex: 0 0 auto;
	color: var( --tlg-tp-muted );
	font-size: 12.5px;
}

/* ==========================================================================
   6b. The merchant's own content
   ========================================================================== */

.tlg-tp-custom--top {
	margin-bottom: 1.2em;
}

.tlg-tp-custom--bottom {
	margin-top: 1.4em;
}

.tlg-tp-custom-text {
	margin: 0 0 0.6em;
	color: var( --tlg-tp-body );
	font-size: 14px;
	line-height: 1.6;
	white-space: pre-line;
}

.tlg-tp-custom > :last-child {
	margin-bottom: 0;
}

/* ==========================================================================
   7. Lookup form
   ========================================================================== */

.tlg-tp-form {
	margin: 0;
	padding: 0;
	border: 1px solid var( --tlg-tp-line );
	border-radius: var( --tlg-tp-radius );
	background: var( --tlg-tp-surface );
}

.tlg-tp-tabs {
	display: flex;
	border-bottom: 1px solid var( --tlg-tp-line );
}

.tlg-tp-tab {
	flex: 1 1 auto;
	padding: 14px 10px;
	border: 0;
	border-bottom: 3px solid transparent;
	background: none;
	color: var( --tlg-tp-muted );
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	cursor: pointer;
}

.tlg-tp-tab.is-active {
	border-bottom-color: var( --tlg-tp-accent );
	color: var( --tlg-tp-head );
}

.tlg-tp-panel {
	display: none;
	padding: 20px 20px 4px;
}

.tlg-tp-panel.is-active {
	display: block;
}

.tlg-tp-form-intro {
	margin: 0 0 1em;
	color: var( --tlg-tp-muted );
	font-size: 13px;
}

.tlg-tp-field {
	margin: 0 0 1em;
}

.tlg-tp-field label {
	display: block;
	margin-bottom: 5px;
	color: var( --tlg-tp-head );
	font-size: 12.5px;
	font-weight: 600;
}

.tlg-tp-field input {
	width: 100%;
	padding: 11px 13px;
	border: 1px solid var( --tlg-tp-line );
	border-radius: 8px;
	background: var( --tlg-tp-surface );
	color: var( --tlg-tp-head );
	font-family: inherit;
	font-size: 14px;
}

.tlg-tp-field input:focus {
	border-color: var( --tlg-tp-accent );
	outline: 2px solid transparent;
	box-shadow: 0 0 0 3px rgba( 11, 125, 118, 0.16 );
}

.tlg-tp-submit {
	margin: 0;
	padding: 4px 20px 20px;
}

.tlg-tp-btn {
	padding: 12px 30px;
	border: 0;
	border-radius: 9px;
	background: var( --tlg-tp-accent );
	color: #fff;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
}

.tlg-tp-btn:hover,
.tlg-tp-btn:focus {
	filter: brightness( 0.93 );
}

.tlg-tp-btn[disabled] {
	opacity: 0.6;
	cursor: default;
	filter: none;
}

.tlg-tp-form-msg {
	margin: 0;
	padding: 0 20px;
	font-size: 13px;
}

.tlg-tp-form-msg:not( :empty ) {
	padding-bottom: 18px;
}

.tlg-tp-form-msg.is-error {
	color: #b3300c;
}

@media ( prefers-color-scheme: dark ) {
	.tlg-tp-form-msg.is-error {
		color: #f1805c;
	}
}

.tlg-tp-result:not( :empty ) {
	margin-top: 1.2em;
}

/* The result replaces the form, so nested token scopes do not compound. */
.tlg-tp-result .tlg-tp {
	max-width: none;
	margin: 0;
}

/* ==========================================================================
   8. Responsive
   ========================================================================== */

@media ( max-width: 600px ) {
	.tlg-tp-card {
		padding: 16px;
	}

	.tlg-tp-status {
		order: 3;
	}

	/* Four stage names across a phone leaves each about 70px, so they wrap
	   rather than hide: a rail missing its labels stops being a rail. */
	.tlg-tp-rail-steps li {
		font-size: 10.5px;
	}

	.tlg-tp-rail-label {
		padding: 0 2px;
	}

	.tlg-tp-facts {
		grid-template-columns: repeat( auto-fit, minmax( 120px, 1fr ) );
	}
}

@media ( prefers-reduced-motion: reduce ) {
	.tlg-tp-events > summary::after {
		transition: none;
	}
}
