/**
 * Aviatrix Parking Availability: public widget.
 *
 * Values come from the ILM homepage design (Figma node 509:13843). A theme
 * can restyle the widget by setting the custom properties below.
 *
 * One deliberate change from the design: the "Full" pill uses navy text.
 * White on #fa8072 is 2.5:1 and fails WCAG AA; navy on #fa8072 is 5.8:1.
 */

.avx-parking,
.avx-parking-status,
.avx-parking-scope {
	--avx-parking-ink: #002855;
	--avx-parking-surface: #fefefe;
	--avx-parking-open-bg: #9cdbd9;
	--avx-parking-open-ink: #002855;
	--avx-parking-full-bg: #fa8072;
	--avx-parking-full-ink: #002855;
	--avx-parking-limited-bg: #e7ceb5;
	--avx-parking-limited-ink: #002855;
	--avx-parking-closed-bg: #002855;
	--avx-parking-closed-ink: #ffffff;
	--avx-parking-notice-bg: #e6ebf1;
	--avx-parking-notice-ink: #002855;
	--avx-parking-muted: #44546a;
	/* The empty pill shown for the moment before the first reading arrives. */
	--avx-parking-ghost: #e9edf2;
	--avx-parking-link-bg: #002855;
	--avx-parking-link-bg-hover: #0b3a70;
	--avx-parking-link-ink: #ffffff;
	/* One width for the standard status pills, from the longest label (set by the
	   widget). A theme can set its own length, or 0 to let each pill hug its text. */
	--avx-parking-pill-min: calc(var(--avx-parking-pill-chars, 7) * 0.7em + 2rem + 2px);
}

.avx-parking {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 0.625rem;
	box-sizing: border-box;
	padding: 1.5rem 0.9375rem 1.5rem 1.75rem;
	border-radius: 8px;
	background: var(--avx-parking-surface);
	color: var(--avx-parking-ink);
	box-shadow: 0 0 12.5px rgba(0, 0, 0, 0.15);
	/* The card always takes its width from the box it sits in, so it can lay
	   itself out by that width (see "A wider card" below). */
	container-type: inline-size;
}

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

.avx-parking__heading {
	margin: 0;
	color: inherit;
	font-size: 1.5rem;
	font-weight: 600;
	line-height: 1.3334;
}

/*
 * Names take the room they need. When a card is too narrow for a name and its
 * status side by side, the name wraps between words; a status word is never
 * split. A theme with room to spare can keep names on one line with
 * `.avx-parking__name { white-space: nowrap; }` and the card then asks for the
 * width it needs.
 */
.avx-parking__lots {
	display: grid;
	grid-template-columns: minmax(min-content, max-content) minmax(min-content, 1fr);
	column-gap: 1.3125rem;
	row-gap: 0.625rem;
	width: 100%;
	margin: 0;
	padding: 0;
	list-style: none;
}

.avx-parking__lot {
	display: flex;
	align-items: center;
	gap: 1.3125rem;
	grid-column: 1 / -1;
	min-height: 2.5rem;
	margin: 0;
	padding: 0.3125rem 0;
}

/* Line the pills up in one column whatever the lot names are. */
@supports (grid-template-columns: subgrid) {
	.avx-parking__lot {
		display: grid;
		grid-template-columns: subgrid;
	}
}

.avx-parking__name {
	font-size: 1rem;
	font-weight: 600;
	line-height: 1.5;
	text-transform: uppercase;
	overflow-wrap: anywhere;
}

.avx-parking__pill {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	justify-self: start;
	min-height: 1.875rem;
	/* 5px + an 18px line + 5px + the 1px border top and bottom = the design's 30px pill.
	   14px text since 2026-11-16 (the design's 12px was too hard to read, Kyle's call). */
	padding: 0.3125rem 1rem;
	border: 1px solid transparent;
	border-radius: 1.25rem;
	font-size: 0.875rem;
	font-weight: 800;
	line-height: 1.2858;
	text-align: center;
	text-transform: uppercase;
	/* Wrap between words only. "anywhere" would let a narrow column split a word. */
	overflow-wrap: break-word;
}

/* Same width for every standard status, so the column is tidy and nothing moves when a status changes. */
.avx-parking__lots .avx-parking__pill--open,
.avx-parking__lots .avx-parking__pill--limited,
.avx-parking__lots .avx-parking__pill--full,
.avx-parking__lots .avx-parking__pill--closed {
	min-width: var(--avx-parking-pill-min);
}

.avx-parking__pill--open {
	background: var(--avx-parking-open-bg);
	color: var(--avx-parking-open-ink);
}

/* Still open, nearly full. Sand, not a warning color: it steers drivers, it does not turn them away. */
.avx-parking__pill--limited {
	background: var(--avx-parking-limited-bg);
	color: var(--avx-parking-limited-ink);
}

.avx-parking__pill--full {
	background: var(--avx-parking-full-bg);
	color: var(--avx-parking-full-ink);
}

.avx-parking__pill--closed {
	background: var(--avx-parking-closed-bg);
	color: var(--avx-parking-closed-ink);
}

/* A message staff typed: keep their capitalisation. */
.avx-parking__pill--notice {
	background: var(--avx-parking-notice-bg);
	color: var(--avx-parking-notice-ink);
	text-transform: none;
}

/* The moment before the first reading: an empty pill the width of a real one, so
   nothing moves when the status arrives. Its words are for screen readers only. */
.avx-parking__pill--pending {
	min-width: var(--avx-parking-pill-min);
	background: var(--avx-parking-ghost);
}

.avx-parking__pill--unknown {
	padding-inline: 0;
	background: none;
	color: var(--avx-parking-muted);
	font-weight: 600;
	text-align: left;
	text-transform: none;
}

/* 16px Medium: Kyle's rule of 2026-11-16, nothing smaller than 16 for reading text. */
.avx-parking__note {
	margin: 0;
	color: var(--avx-parking-muted);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1.375;
}

.avx-parking__note[hidden] {
	display: none;
}

/* Screen-reader-only live region and words. */
.avx-parking__live,
.avx-parking__sr {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	clip-path: inset(50%);
	white-space: nowrap;
	border: 0;
}

/* In a stretched card (a theme that makes neighbouring cards the same height)
   the button sits at the bottom, so spare height falls above it. */
.avx-parking__link {
	margin-top: auto;
	/* The card has more padding on the left (28px) than the right (15px), which
	   suits the pills. The button spans the card with the same space either side,
	   as in the design: 28px left, 15px + 13px right. */
	align-self: stretch;
	margin-inline-end: 0.8125rem;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.625rem;
	min-height: 2.125rem;
	/* The button spans the card and centres its label, so the side padding is
	   only a minimum. 16px text since 2026-11-16 (was 14); the label is checked
	   on one line in the home page's 235px card, where the button is 179px wide. */
	padding: 0.5rem 0.75rem;
	border-radius: 2.25rem;
	background: var(--avx-parking-link-bg);
	color: var(--avx-parking-link-ink);
	font-size: 1rem;
	font-weight: 800;
	line-height: 1.125;
	text-decoration: none;
}

.avx-parking__link:hover,
.avx-parking__link:focus {
	background: var(--avx-parking-link-bg-hover);
	color: var(--avx-parking-link-ink);
	text-decoration: none;
}

/* One ring, 2px off the button, as on the rest of the site. It takes the card's
   ink, not the page's ring colour: the ring lies on the card, which is always
   the light surface above, even when the page behind the card is dark. */
.avx-parking__link:focus-visible {
	outline: 2px solid var(--avx-parking-ink);
	outline-offset: 2px;
}

.avx-parking__arrow {
	flex: none;
	width: 12px;
	height: 12px;
}

/* Larger touch target on phones and tablets, as in the mobile design. */
/*
 * A wider card (a phone, where the card spans the screen). With names and
 * pills side by side on the left, about 100px stood empty on the right and the
 * card looked lopsided (Kyle, 2026-11-17). Here the pills line up on the right,
 * 28px in from the edge like the names and the button on the left, so both
 * sides match, and they line up with the flight card's pills above. The width
 * here is inside the card's padding: 200px and up, so every phone and the
 * parking page's card (219 to 264px inside) get it, and only the home page's
 * narrow desktop card (192px inside, already full) keeps the design's layout.
 */
@container (min-width: 12.5rem) {
	.avx-parking__lots {
		padding-right: 0.8125rem;
	}

	.avx-parking__lot {
		justify-content: space-between;
	}

	.avx-parking__pill {
		justify-self: end;
	}
}

@media (pointer: coarse) {
	.avx-parking__link {
		min-height: 2.75rem;
	}
}

/* One lot's status dropped into a sentence or table cell. */
.avx-parking-status {
	display: inline-block;
	vertical-align: middle;
}

@media (prefers-reduced-motion: no-preference) {
	.avx-parking__pill {
		transition: background-color 200ms ease, color 200ms ease;
	}

	.avx-parking__pill.is-changed {
		animation: avx-parking-changed 450ms ease-out;
	}

	/* The first reading settles into the empty pill: its colour and words fade in. */
	.avx-parking__pill.is-arriving {
		animation: avx-parking-arrive 180ms ease-out;
	}

	.avx-parking__arrow {
		transition: transform 150ms ease-out;
	}

	.avx-parking__link:hover .avx-parking__arrow,
	.avx-parking__link:focus-visible .avx-parking__arrow {
		transform: translate(2px, -2px);
	}
}

/* Only a starting point: it eases into whatever the pill's own colours are. */
@keyframes avx-parking-arrive {
	from {
		background-color: var(--avx-parking-ghost);
		color: transparent;
	}
}

@keyframes avx-parking-changed {
	from {
		opacity: 0.35;
		transform: scale(0.94);
	}

	to {
		opacity: 1;
		transform: scale(1);
	}
}

@media (forced-colors: active) {
	.avx-parking__pill,
	.avx-parking__link {
		border: 1px solid currentColor;
	}
}
