/* Palletways track & trace - colours from www.palletways.com, layout tokens from palletways.online. */

@font-face {
	font-family: "Montserrat";
	font-style: normal;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/montserrat-latin-ext.woff2") format("woff2");
	unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C4, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
	font-family: "Montserrat";
	font-style: normal;
	font-weight: 400 700;
	font-display: swap;
	src: url("../fonts/montserrat-latin.woff2") format("woff2");
	unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}

:root {
	--navy: #003875;
	--navy-deep: #002A5A;
	--navy-hover: #0067AB;
	--beige: #E9E4DE;
	--beige-dark: #D9D2C8;
	--green: #74BF43;
	--green-hover: #66AD39;
	--green-active: #5A9C31;
	--ink: #003875;
	--text: #1C2340;
	--muted: #5B6280;
	--line: #E3DED7;
	--white: #FFFFFF;
	--danger: #C62828;
	--warning: #E8892B;
	--info: #4F9BE8;
	--radius-sm: 10px;
	--radius-md: 14px;
	--radius-lg: 16px;
	--pill: 999px;
	--shadow: 0 10px 30px rgb(0 56 117 / 0.08);
	--font: "Montserrat", system-ui, sans-serif;
	--mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

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

html { -webkit-text-size-adjust: 100%; }

body {
	margin: 0;
	min-height: 100vh;
	display: flex;
	flex-direction: column;
	font-family: var(--font);
	font-size: 16px;
	line-height: 1.5;
	color: var(--text);
	background: var(--beige);
}

a { color: var(--navy); }
a:hover { color: var(--navy-hover); }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }

/* Header */
.site-header { background: var(--navy); color: var(--white); }
.site-header__inner {
	max-width: 1180px;
	margin: 0 auto;
	padding: 14px 20px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
}
.site-header__logo img { display: block; height: 44px; width: auto; }

.lang-switch { display: flex; align-items: center; gap: 8px; font-size: 0.85rem; }
.lang-switch__label { opacity: 0.8; }
.lang-switch ul { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 4px; }
.lang-switch a {
	display: inline-block;
	min-width: 2.4em;
	padding: 4px 8px;
	border-radius: var(--pill);
	color: var(--white);
	text-align: center;
	text-decoration: none;
	font-weight: 600;
}
.lang-switch a:hover { background: var(--navy-hover); color: var(--white); }
.lang-switch a[aria-current="true"] { background: var(--green); color: var(--navy-deep); }

/* Main */
.site-main {
	flex: 1;
	width: 100%;
	max-width: 1180px;
	margin: 0 auto;
	padding: 32px 20px 48px;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

.card {
	background: var(--white);
	border-radius: var(--radius-lg);
	box-shadow: var(--shadow);
	padding: 24px;
}
.card__title { margin: 0 0 16px; font-size: 1.25rem; font-weight: 700; color: var(--ink); }

/* Search */
.search { max-width: 720px; width: 100%; margin: 24px auto 0; padding: 32px; }
.search--compact { margin-top: 0; padding: 20px 24px; max-width: none; }
.search__title { margin: 0 0 20px; font-size: clamp(1.6rem, 1.2rem + 1.5vw, 2.2rem); font-weight: 700; color: var(--ink); }
.search__label { display: block; margin-bottom: 8px; font-weight: 600; color: var(--ink); }
.search__row { display: flex; gap: 12px; flex-wrap: wrap; }
.search__row .input { flex: 1 1 240px; }

.input {
	font: inherit;
	font-size: 1.05rem;
	padding: 12px 18px;
	border: 2px solid var(--line);
	border-radius: var(--pill);
	background: var(--white);
	color: var(--text);
	min-width: 0;
}
.input:focus { border-color: var(--navy); outline: none; box-shadow: 0 0 0 3px rgb(0 56 117 / 0.15); }

/* Buttons */
.btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	font: inherit;
	font-weight: 700;
	padding: 12px 28px;
	border-radius: var(--pill);
	border: 2px solid transparent;
	cursor: pointer;
	text-decoration: none;
	white-space: nowrap;
	transition: background-color 0.15s, color 0.15s, border-color 0.15s;
}
.btn--primary { background: var(--green); color: var(--navy-deep); }
.btn--primary:hover { background: var(--green-hover); color: var(--navy-deep); }
.btn--primary:active { background: var(--green-active); }
.btn--secondary { background: var(--navy); color: var(--white); }
.btn--secondary:hover { background: var(--navy-hover); color: var(--white); }
.btn--secondary:active { background: var(--navy-deep); }
.btn--ghost { background: transparent; color: var(--navy); border-color: var(--navy); }
.btn--ghost:hover { background: var(--navy); color: var(--white); }
.btn--small { padding: 6px 14px; font-size: 0.85rem; }

/* Alerts */
.alert { margin-top: 20px; padding: 16px 20px; border-radius: var(--radius-md); border-left: 6px solid; }
.alert p { margin: 0; }
.alert p + p { margin-top: 6px; }
.alert__title { margin: 0 0 6px; font-size: 1.1rem; }
.alert--warning { background: #FFF4E8; border-color: var(--warning); }
.alert--danger { background: #FDECEC; border-color: var(--danger); }

/* Facts */
.facts {
	margin: 0;
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
	gap: 14px;
}
.facts__item { background: #F7F5F2; border-radius: var(--radius-sm); padding: 12px 14px; }
.facts__item--wide { grid-column: 1 / -1; }
.facts dt { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); }
.facts dd { margin: 4px 0 0; font-weight: 500; overflow-wrap: anywhere; }

.badge {
	display: inline-block;
	padding: 3px 12px;
	border-radius: var(--pill);
	font-size: 0.85rem;
	font-weight: 700;
	color: var(--white);
	background: var(--muted);
}
.badge--danger { background: var(--danger); }
.badge--warning { background: var(--warning); }
.badge--info { background: var(--navy); }
.badge--success { background: var(--green); color: var(--navy-deep); }

.tag {
	display: inline-block;
	margin: 2px 4px 2px 0;
	padding: 2px 10px;
	border-radius: var(--pill);
	background: var(--beige);
	font-size: 0.85rem;
	font-weight: 600;
}
.tag--green { background: #EAF5E1; color: #3B6E1C; }

.muted { color: var(--muted); }
.small { font-size: 0.85rem; }
.mono { font-family: var(--mono); font-size: 0.92em; }

/* Progress */
.progress {
	list-style: none;
	margin: 24px 0 0;
	padding: 0;
	display: grid;
	grid-template-columns: repeat(5, 1fr);
	counter-reset: step;
}
.progress__step { position: relative; text-align: center; padding-top: 34px; font-size: 0.85rem; color: var(--muted); }
.progress__step::before {
	content: "";
	position: absolute;
	top: 11px;
	left: -50%;
	width: 100%;
	height: 4px;
	background: var(--line);
}
.progress__step:first-child::before { display: none; }
.progress__dot {
	position: absolute;
	top: 0;
	left: 50%;
	transform: translateX(-50%);
	width: 26px;
	height: 26px;
	border-radius: 50%;
	background: var(--white);
	border: 4px solid var(--line);
	z-index: 1;
}
.progress__step.is-done::before, .progress__step.is-current::before { background: var(--green); }
.progress__step.is-done .progress__dot { background: var(--green); border-color: var(--green); }
.progress__step.is-current .progress__dot { background: var(--navy); border-color: var(--green); }
.progress__step.is-current { color: var(--ink); font-weight: 700; }
.progress__label { display: block; padding: 0 4px; overflow-wrap: anywhere; }

/* Unlock form */
.unlock .search__label { margin-bottom: 10px; }

/* Details */
.details-grid { display: grid; grid-template-columns: minmax(260px, 1fr) 2.4fr; gap: 20px; align-items: start; }
.details-grid__side { display: flex; flex-direction: column; gap: 20px; }
.side__block { margin: 0 0 14px; }
.side__label { font-weight: 600; margin-right: 4px; }
.side__block .small { display: block; margin-top: 6px; }

.flags { list-style: none; margin: 0; padding: 0; }
.flags__item { display: flex; justify-content: space-between; gap: 12px; padding: 8px 0; border-top: 1px solid var(--line); }
.flags__item:first-child { border-top: 0; }
.flags__item strong { color: var(--muted); }
.flags__item.is-on strong { color: #3E7A1E; }

.address__title { margin: 0 0 8px; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.address address { font-style: normal; line-height: 1.6; overflow-wrap: anywhere; }

.notes { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.notes th {
	text-align: left;
	font-size: 0.75rem;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	color: var(--muted);
	padding: 8px 10px;
	border-bottom: 2px solid var(--line);
}
.notes td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
.notes tbody tr:nth-child(even) { background: #FAF8F6; }
.notes__row--pod td { color: #3E7A1E; font-weight: 600; }
.notes__row--scan td { color: var(--muted); }
.notes__comment { overflow-wrap: anywhere; }
.notes td:nth-child(5), .notes td:nth-child(6) { white-space: nowrap; }

.pod { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; }
.pod__thumb img { display: block; width: 100px; height: 100px; object-fit: cover; border-radius: var(--radius-sm); border: 1px solid var(--line); background: #F7F5F2; }
.pod__links { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }

.back { margin: 0; text-align: center; }

/* Status card */
.status { padding: 28px; }
.status__main { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; }
.status__icon {
	flex: 0 0 auto;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	display: grid;
	place-items: center;
	background: #EAF0F7;
	color: var(--navy);
}
.status--delivered .status__icon { background: var(--green); color: var(--navy-deep); }
.status--out .status__icon { background: #EAF5E1; color: #3E7A1E; }
.status--problem .status__icon, .status--held .status__icon { background: #FFF4E8; color: #A85A12; }
.status__text { flex: 1 1 280px; min-width: 0; }
.status__eyebrow { margin: 0 0 2px; font-size: 0.85rem; color: var(--muted); }
.status__eyebrow strong { color: var(--text); letter-spacing: 0.02em; }
.status__title { margin: 0; font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.3rem); line-height: 1.15; font-weight: 700; color: var(--ink); }
.status__place { margin: 6px 0 0; font-size: 1.1rem; font-weight: 600; color: var(--text); }
.status__when { margin: 6px 0 0; font-size: 1.05rem; color: var(--text); }
.status__eta {
	flex: 0 1 260px;
	display: flex;
	flex-direction: column;
	gap: 2px;
	padding: 14px 18px;
	border-radius: var(--radius-md);
	background: var(--navy);
	color: var(--white);
}
.status__eta-label { font-size: 0.78rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; opacity: 0.85; }
.status__eta-day { font-size: 1.35rem; font-weight: 700; }
.status__eta-time { font-size: 1.05rem; font-weight: 600; color: var(--green); }
.status__meta {
	margin: 22px 0 0;
	padding-top: 16px;
	border-top: 1px solid var(--line);
	display: flex;
	flex-wrap: wrap;
	gap: 6px 24px;
	font-size: 0.9rem;
	color: var(--muted);
}
.status__meta strong { color: var(--text); }
.progress__date { display: block; font-size: 0.75rem; color: var(--muted); font-weight: 500; }

/* Two-column layout */
.layout { display: grid; grid-template-columns: minmax(0, 1.75fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.layout__main, .layout__side { display: flex; flex-direction: column; gap: 20px; min-width: 0; }

/* Map */
.card--flush { padding: 0; overflow: hidden; }
.map { display: none; height: 340px; background: #DDE3EA; }
.map.is-ready { display: block; }
.map-card:has(.map:not(.is-ready)) { display: none; }
.map-legend { list-style: none; margin: 0; padding: 10px 18px; display: flex; gap: 20px; font-size: 0.8rem; color: var(--muted); }
.map-legend li { display: flex; align-items: center; gap: 8px; }
.map-legend__line { display: inline-block; width: 26px; height: 0; border-top: 4px solid var(--green); }
.map-legend__line--todo { border-top: 4px dashed #8A93A6; }
.leaflet-container { font-family: var(--font); }

/* Timeline */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline__item {
	position: relative;
	display: grid;
	grid-template-columns: 22px 1fr auto;
	gap: 12px;
	padding: 0 0 18px;
}
.timeline__item::before {
	content: "";
	position: absolute;
	left: 9px;
	top: 18px;
	bottom: -2px;
	width: 2px;
	background: var(--line);
}
.timeline__item:last-child { padding-bottom: 0; }
.timeline__item:last-child::before { display: none; }
.timeline__dot { width: 20px; height: 20px; margin-top: 1px; border-radius: 50%; background: var(--white); border: 4px solid var(--line); z-index: 1; }
.timeline__item.is-latest .timeline__dot { border-color: var(--green); background: var(--navy); }
.timeline__title { display: block; font-weight: 600; }
.timeline__item.is-latest .timeline__title { color: var(--ink); font-weight: 700; }
.timeline__place { display: block; font-size: 0.9rem; color: var(--muted); }
.timeline__time { font-size: 0.82rem; color: var(--muted); text-align: right; white-space: nowrap; line-height: 1.35; }

/* Disclosures */
.disclosure { padding: 0; }
.disclosure__summary {
	list-style: none;
	cursor: pointer;
	padding: 18px 24px;
	font-weight: 700;
	color: var(--ink);
	display: flex;
	justify-content: space-between;
	align-items: center;
}
.disclosure__summary::-webkit-details-marker { display: none; }
.disclosure__summary::after { content: "+"; font-size: 1.4rem; line-height: 1; color: var(--navy); }
.disclosure[open] .disclosure__summary::after { content: "\2212"; }
.disclosure[open] .disclosure__summary { border-bottom: 1px solid var(--line); }
.disclosure > :not(summary) { margin: 16px 24px 24px; }
.disclosure .notes { width: calc(100% - 48px); }

.kv { display: grid; grid-template-columns: auto 1fr; gap: 8px 16px; font-size: 0.92rem; }
.kv dt { color: var(--muted); font-weight: 600; }
.kv dd { margin: 0; overflow-wrap: anywhere; }

/* Proof of delivery list */
.pod-list { list-style: none; margin: 12px 0 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }

/* Addresses (full view) */
.address__title--gap { margin-top: 18px; }

/* Help */
.help { background: #EAF0F7; box-shadow: none; }
.help p { margin: 0 0 6px; }
.help__depot { margin-top: 10px !important; }
.help__link { font-weight: 700; font-size: 1.05rem; }

/* Footer */
.site-footer { background: var(--navy-deep); color: rgb(255 255 255 / 0.8); font-size: 0.85rem; }
.site-footer__inner {
	max-width: 1180px;
	margin: 0 auto;
	padding: 18px 20px;
	display: flex;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}
.site-footer a { color: var(--white); }

/* Tablet */
@media (max-width: 900px) {
	.details-grid, .layout { grid-template-columns: 1fr; }
	.status__eta { flex: 1 1 100%; }
}

/* Mobile */
@media (max-width: 640px) {
	.site-header__inner { justify-content: center; }
	.lang-switch__label { display: none; }
	.site-main { padding: 20px 12px 32px; gap: 14px; }
	.card, .search { padding: 18px; }
	.search { margin-top: 8px; }
	.search__row .btn { flex: 1 1 100%; }
	.facts { grid-template-columns: 1fr 1fr; gap: 10px; }

	.progress { grid-template-columns: 1fr; gap: 0; }
	.progress__step { text-align: left; padding: 0 0 18px 40px; min-height: 30px; }
	.progress__step::before { top: -18px; left: 11px; width: 4px; height: calc(100% - 8px); }
	.progress__dot { left: 0; transform: none; }
	.progress__step:last-child { padding-bottom: 0; }
	.progress__label { padding: 2px 0 0; }
	.progress__date { display: inline; margin-left: 6px; }
	.status { padding: 20px; }
	.status__icon { width: 48px; height: 48px; }
	.map { height: 260px; }
	.disclosure > :not(summary) { margin: 12px 14px 16px; }
	.disclosure .notes { width: calc(100% - 28px); }

	/* Notes table becomes stacked cards */
	.notes thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
	.notes, .notes tbody, .notes tr, .notes td { display: block; width: 100%; }
	.notes tr { border: 1px solid var(--line); border-radius: var(--radius-sm); margin-bottom: 10px; padding: 6px 0; background: var(--white); }
	.notes tbody tr:nth-child(even) { background: var(--white); }
	.notes td { border: 0; padding: 4px 12px; display: grid; grid-template-columns: 6.5em 1fr; gap: 8px; }
	.notes td::before { content: attr(data-label); font-size: 0.72rem; font-weight: 600; text-transform: uppercase; color: var(--muted); padding-top: 2px; }
	.notes td:empty { display: none; }
}

@media (prefers-reduced-motion: reduce) {
	.btn { transition: none; }
}
