/* MSO Flight Display
 * .mso-fd--tabs : dark tabbed widget (Arrivals / Departures / Weather)
 * .mso-fd--list : white list for the Flight Status page (one per column)
 */

.mso-fd {
	--mso-active: #0269ac;
	--mso-tab: #013976;
	--mso-tab-hover: #024f93;
	--mso-body: #102a43;
	--mso-line: rgba(255, 255, 255, 0.92);
	--mso-alert: #ff4545;
	--mso-early: #7ee2a3;
	--mso-radius: 10px;
	/* Sizes scale with the widget's own width (cqi = 1% of it). */
	--mso-pad: clamp(12px, 3.4cqi, 24px);
	--mso-gap: clamp(8px, 2.2cqi, 16px);

	container-type: inline-size;
	container-name: msofd;
	width: 100%;
	margin: 0 auto;
	color: #fff;
	font-family: inherit;
	font-size: 20px;
	line-height: 1.25;
	text-align: left;
	/* Divi sets break-word on text, which splits words like "STATUS" in two. */
	overflow-wrap: normal;
	word-wrap: normal;
	word-break: normal;
	-webkit-hyphens: manual;
	hyphens: manual;
}

.mso-fd *,
.mso-fd *::before,
.mso-fd *::after {
	box-sizing: border-box;
	overflow-wrap: inherit;
	word-break: inherit;
}

/* ===== Shared: columns ===== */

.mso-fd .mso-fd__grid {
	display: grid;
	/* Flight column sized to a flight name so the logo sits right next to it */
	grid-template-columns: minmax(0, 9.6em) 6.2em minmax(5.6em, 1fr) 5em;
	grid-template-areas: "flight logo status time";
	column-gap: var(--mso-gap);
	align-items: end;
}

.mso-fd .mso-fd__flight,
.mso-fd .mso-fd__h-flight { grid-area: flight; min-width: 0; }
.mso-fd .mso-fd__airline,
.mso-fd .mso-fd__h-logo { grid-area: logo; min-width: 0; }
.mso-fd .mso-fd__status,
.mso-fd .mso-fd__h-status { grid-area: status; }
.mso-fd .mso-fd__time,
.mso-fd .mso-fd__h-time { grid-area: time; }

/* Status sits right beside the time instead of drifting in a wide column */
.mso-fd .mso-fd__status,
.mso-fd .mso-fd__h-status {
	justify-self: end;
	width: 5.6em;
}

/* List header text is 0.8em, so 7em here equals 5.6em of row text */
.mso-fd--list .mso-fd__h-status {
	width: 7em;
}

.mso-fd .mso-fd__head {
	white-space: nowrap;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.mso-fd .mso-fd__h-time {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.3em;
}

/* ===== Shared: rows ===== */

.mso-fd .mso-fd__row {
	padding: 0.7em 0;
	border-bottom: 1.5px solid var(--mso-line);
}

.mso-fd .mso-fd__row:last-child {
	border-bottom: 0;
}

.mso-fd .mso-fd__name {
	display: block;
	font-size: 0.95em;
	font-weight: 700;
	letter-spacing: 0.02em;
	text-transform: uppercase;
}

.mso-fd .mso-fd__city {
	display: block;
	overflow: hidden;
	font-weight: 300;
	white-space: nowrap;
	text-overflow: ellipsis;
}

.mso-fd .mso-fd__status,
.mso-fd .mso-fd__time {
	font-weight: 300;
	white-space: nowrap;
}

.mso-fd .mso-fd__status.is-early {
	color: var(--mso-early);
	font-weight: 400;
}

.mso-fd .mso-fd__status.is-delayed,
.mso-fd .mso-fd__status.is-cancelled,
.mso-fd .mso-fd__status.is-diverted {
	color: var(--mso-alert);
	font-weight: 600;
}

/* Airline logo */
.mso-fd .mso-fd__airline {
	display: flex;
	align-self: center;
	justify-content: flex-start;
}

.mso-fd .mso-fd__logo {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	max-width: 100%;
	height: 1.6em;
}

.mso-fd .mso-fd__logo img {
	display: block;
	width: auto;
	max-width: 5.4em;
	height: 1.05em;
	margin: 0;
	object-fit: contain;
}

/* Messages and loading */
.mso-fd .mso-fd__msg {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	padding: 1.5em 0;
	font-size: 0.9em;
	font-weight: 300;
	text-align: center;
	white-space: normal;
}

.mso-fd .mso-fd__spinner {
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border: 2px solid rgba(255, 255, 255, 0.3);
	border-top-color: #fff;
	border-radius: 50%;
	animation: mso-fd-spin 0.8s linear infinite;
}

@keyframes mso-fd-spin {
	to {
		transform: rotate(360deg);
	}
}

/* Refresh icon (spins while loading) */
.mso-fd .mso-fd__refresh {
	-webkit-appearance: none;
	appearance: none;
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 1.5em;
	height: 1.5em;
	margin: -0.25em 0;
	padding: 0.2em;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: inherit;
	box-shadow: none;
	cursor: pointer;
}

.mso-fd .mso-fd__refresh svg {
	display: block;
	width: 100%;
	height: 100%;
}

.mso-fd .mso-fd__refresh:hover {
	background: rgba(0, 0, 0, 0.06);
}

.mso-fd .mso-fd__refresh:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 1px;
}

.mso-fd .mso-fd__refresh.is-loading svg {
	animation: mso-fd-spin 0.9s linear infinite;
}

/* ===== Tabbed widget (dark) ===== */

.mso-fd--tabs {
	max-width: var(--mso-width, 760px);
}

@media (max-width: 767px) {
	.mso-fd--tabs {
		max-width: 100%;
	}
}

.mso-fd .mso-fd__tablist {
	display: flex;
	gap: clamp(4px, 1.2cqi, 8px);
	margin: 0;
	padding: 0;
}

.mso-fd .mso-fd__tab {
	-webkit-appearance: none;
	appearance: none;
	flex: 0 1 auto;
	min-width: 0;
	margin: 0;
	padding: clamp(10px, 2.6cqi, 18px) clamp(4px, 2.9cqi, 22px) clamp(9px, 2.3cqi, 16px);
	overflow: hidden;
	border: 0;
	border-radius: var(--mso-radius) var(--mso-radius) 0 0;
	background: var(--mso-tab);
	color: #fff;
	font-family: inherit;
	font-size: clamp(11px, 3.2cqi + 1px, 22px);
	font-weight: 700;
	line-height: 1;
	letter-spacing: 0.06em;
	text-overflow: ellipsis;
	text-transform: uppercase;
	white-space: nowrap;
	box-shadow: none;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.mso-fd .mso-fd__tab[aria-selected="true"] {
	background: var(--mso-active);
	cursor: default;
}

.mso-fd .mso-fd__tab[aria-selected="false"]:hover {
	background: var(--mso-tab-hover);
}

.mso-fd .mso-fd__tab:focus {
	outline: none;
}

.mso-fd .mso-fd__tab:focus-visible {
	outline: 2px solid #fff;
	outline-offset: -5px;
}

.mso-fd .mso-fd__box {
	overflow: hidden;
	background: var(--mso-body);
	border-radius: 0 var(--mso-radius) var(--mso-radius) var(--mso-radius);
	font-size: clamp(13px, 2.2cqi + 5.5px, 20px);
}

.mso-fd .mso-fd__panel[hidden] {
	display: none !important;
}

.mso-fd--tabs .mso-fd__head {
	padding: 0.7em var(--mso-pad);
	background: var(--mso-active);
	color: #fff;
}

.mso-fd--tabs .mso-fd__list {
	padding: 0.2em var(--mso-pad);
}

/* White tile so full-colour logos stay readable on the dark panel */
.mso-fd--tabs .mso-fd__logo {
	padding: 0 0.4em;
	border-radius: 0.35em;
	background: #fff;
}

/* Weather */
.mso-fd .mso-fd__wx {
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 1.7em var(--mso-pad) 1.8em;
}

.mso-fd .mso-fd__wx-now {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 1.4em;
}

.mso-fd .mso-fd__wx-temp {
	font-size: 3.6em;
	font-weight: 300;
	line-height: 1;
}

.mso-fd .mso-fd__wx-icon {
	display: block;
	width: 4.8em;
	height: 4.8em;
	color: #fff;
}

.mso-fd .mso-fd__wx-icon svg {
	display: block;
	width: 100%;
	height: 100%;
	overflow: visible;
}

.mso-fd .mso-fd__mask {
	fill: var(--mso-body);
}

.mso-fd .mso-fd__wx-rule {
	width: min(350px, 90%);
	height: 0;
	margin: 1.3em 0 1.1em;
	border-top: 1.5px solid var(--mso-line);
}

.mso-fd .mso-fd__wx-stats {
	display: grid;
	grid-template-columns: 1fr auto;
	row-gap: 0.7em;
	width: min(350px, 90%);
}

.mso-fd .mso-fd__wx-k {
	font-weight: 700;
	text-transform: uppercase;
	white-space: nowrap;
}

.mso-fd .mso-fd__wx-v {
	font-weight: 300;
	text-align: right;
	white-space: nowrap;
}

/* Footer link */
.mso-fd .mso-fd__more,
.mso-fd .mso-fd__more:visited {
	display: block;
	padding: 0.7em var(--mso-pad);
	background: var(--mso-active);
	color: #fff;
	font-size: 1em;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	transition: background-color 0.2s ease;
}

.mso-fd .mso-fd__more:hover,
.mso-fd .mso-fd__more:focus-visible {
	background: #0a78c1;
	color: #fff;
}

/* ===== White list (Flight Status page) ===== */

.mso-fd--list {
	--mso-line: #dfe3e6;
	--mso-alert: #e3000f;
	--mso-early: #1f9d55;
	--mso-number: #0c71c3;
	--mso-gap: clamp(8px, 2.6cqi, 16px);

	color: #333;
}

.mso-fd--list .mso-fd__inner {
	font-size: clamp(12px, 2.4cqi + 5px, 18px);
}

.mso-fd--departures {
	--mso-number: #e02b20;
}

.mso-fd--list .mso-fd__head {
	padding: 0 0 0.45em;
	border-bottom: 2px solid #c1c6c8;
	color: #555;
	letter-spacing: 0.06em;
}

/* Smaller header text, but the grid itself stays at row size so columns line up */
.mso-fd--list .mso-fd__head > span {
	font-size: 0.8em;
}

.mso-fd--list .mso-fd__name {
	color: var(--mso-number);
}

.mso-fd--list .mso-fd__city {
	color: #666;
	font-weight: 600;
}

.mso-fd--list .mso-fd__status,
.mso-fd--list .mso-fd__time {
	color: #333;
	font-weight: 400;
}

.mso-fd--list .mso-fd__status.is-early {
	color: var(--mso-early);
	font-weight: 600;
}

.mso-fd--list .mso-fd__status.is-delayed,
.mso-fd--list .mso-fd__status.is-cancelled,
.mso-fd--list .mso-fd__status.is-diverted {
	color: var(--mso-alert);
	font-weight: 700;
}

.mso-fd--list .mso-fd__logo img {
	object-position: left center;
}

.mso-fd--list .mso-fd__spinner {
	border-color: rgba(0, 0, 0, 0.15);
	border-top-color: #0c71c3;
}

.mso-fd--list .mso-fd__refresh {
	color: #e02b20;
}

/* ===== Width breakpoints (based on the widget's own width) ===== */

/* Phones and narrow columns: no room beside the flight number, so the logo sits above the status */
@container msofd (max-width: 470px) {
	.mso-fd--tabs .mso-fd__grid {
		grid-template-columns: minmax(0, 1fr) 5em 4.8em;
		grid-template-areas: "flight status time";
	}

	.mso-fd--tabs .mso-fd__row {
		grid-template-areas:
			"flight logo logo"
			"flight status time";
		row-gap: 0.15em;
	}

	.mso-fd--tabs .mso-fd__h-logo {
		display: none;
	}

	.mso-fd--tabs .mso-fd__airline {
		align-self: end;
	}

	.mso-fd--tabs .mso-fd__status,
	.mso-fd--tabs .mso-fd__h-status {
		justify-self: stretch;
		width: auto;
	}

	.mso-fd .mso-fd__tab {
		letter-spacing: 0.03em;
	}
}

@container msofd (max-width: 430px) {
	.mso-fd--list .mso-fd__grid {
		grid-template-columns: minmax(0, 1fr) 5em 4.8em;
		grid-template-areas: "flight status time";
	}

	.mso-fd--list .mso-fd__row {
		grid-template-areas:
			"flight logo logo"
			"flight status time";
		row-gap: 0.15em;
	}

	.mso-fd--list .mso-fd__h-logo {
		display: none;
	}

	.mso-fd--list .mso-fd__airline {
		align-self: end;
	}

	.mso-fd--list .mso-fd__status,
	.mso-fd--list .mso-fd__h-status {
		justify-self: stretch;
		width: auto;
	}
}

@container msofd (max-width: 560px) {
	.mso-fd .mso-fd__tab {
		flex: 1 1 auto;
		text-align: center;
	}
}

/* Very narrow: stack status and time under the flight */
@container msofd (max-width: 290px) {
	.mso-fd .mso-fd__grid,
	.mso-fd .mso-fd__row {
		grid-template-columns: minmax(0, 1fr) auto;
		grid-template-areas:
			"flight logo"
			"status time";
		row-gap: 0.25em;
	}

	.mso-fd .mso-fd__head {
		grid-template-areas: "flight time";
	}

	.mso-fd .mso-fd__h-status {
		display: none;
	}

	.mso-fd .mso-fd__airline {
		align-self: start;
		justify-content: flex-end;
	}

	.mso-fd .mso-fd__time {
		text-align: right;
	}
}

@media (prefers-reduced-motion: reduce) {
	.mso-fd .mso-fd__spinner,
	.mso-fd .mso-fd__refresh.is-loading svg {
		animation-duration: 2s;
	}

	.mso-fd .mso-fd__tab,
	.mso-fd .mso-fd__more {
		transition: none;
	}
}
