.nt-alerts-widget {
	--nt-alert-font-family: inherit;
	--nt-alert-text: #1a1a1a;
	--nt-alert-muted: #5a5a5a;
	--nt-alert-surface: #ffffff;
	--nt-alert-surface-alt: #f6f4ee;
	--nt-alert-border: #d8d2c4;

	--nt-alert-bg-info: #eff5fb;
	--nt-alert-border-info: #2c6aa0;
	--nt-alert-text-info: #1a3d66;

	--nt-alert-bg-warning: #fdf5e2;
	--nt-alert-border-warning: #a4731b;
	--nt-alert-text-warning: #5c3f0b;

	--nt-alert-bg-critical: #fbeae8;
	--nt-alert-border-critical: #a12117;
	--nt-alert-text-critical: #6d1410;

	font-family: var(--nt-alert-font-family);
	color: var(--nt-alert-text);
	display: block;
	box-sizing: border-box;
}

.nt-alerts-widget *,
.nt-alerts-widget *::before,
.nt-alerts-widget *::after {
	box-sizing: inherit;
}

/* Page-level header above the filter chips and alert list. */
.nt-alerts-widget__page-header {
	margin: 0 0 1.25rem;
}

.nt-alerts-widget__page-title {
	margin: 0 0 0.3rem;
	font-size: 1.5rem;
	line-height: 1.2;
	font-weight: 700;
	color: var(--nt-alert-text);
}

.nt-alerts-widget__page-subtitle {
	margin: 0;
	font-size: 0.95rem;
	line-height: 1.4;
	color: var(--nt-alert-muted);
}

.nt-alerts-widget__list {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(440px, 100%), 1fr));
	gap: 0.85rem;
	align-items: start;
	/* Cap card width so a single-card section doesn't stretch full container width. */
	justify-content: start;
}

.nt-alerts-widget__list > * {
	max-width: 600px;
}

/* Filter chip rows above the alert list. Two rows when both city and
 * route filtering apply — city above, route below. Each row only appears
 * when 2+ distinct values are represented in the (cascading) pool. */
.nt-alerts-widget__filter-label {
	margin: 0 0 0.3rem;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	color: var(--nt-alert-muted);
}

.nt-alerts-widget__filter-label + .nt-alerts-widget__filter + .nt-alerts-widget__filter-label {
	margin-top: 0.65rem;
}

.nt-alerts-widget__filter {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0 0 0.55rem;
}

.nt-alerts-widget__filter:last-of-type {
	margin-bottom: 1rem;
}

.nt-alerts-widget__filter-chip {
	display: inline-flex;
	align-items: center;
	gap: 0.3rem;
	padding: 0.35rem 0.85rem;
	border: 1px solid var(--nt-alert-border);
	border-radius: 999px;
	background: var(--nt-alert-surface);
	color: var(--nt-alert-text);
	font-family: inherit;
	font-size: 0.85rem;
	font-weight: 600;
	line-height: 1.3;
	cursor: pointer;
	transition: background-color 0.15s ease, border-color 0.15s ease;
}

.nt-alerts-widget__filter-chip:hover {
	background: var(--nt-alert-surface-alt);
}

.nt-alerts-widget__filter-chip:focus-visible {
	outline: 2px solid #2c6aa0;
	outline-offset: 2px;
}

.nt-alerts-widget__filter-chip--active {
	background: #1a1a1a;
	color: #ffffff;
	border-color: #1a1a1a;
}

.nt-alerts-widget__filter-chip--active:hover {
	background: #1a1a1a;
}

.nt-alerts-widget__filter-chip-count {
	opacity: 0.7;
	font-weight: 700;
}

.nt-alerts-widget__filter-chip--active .nt-alerts-widget__filter-chip-count {
	opacity: 0.9;
}

/* Route filter chip — small GTFS-coloured dot inside the chip so the
 * filter chip visually links to the same-numbered route chip on the cards. */
.nt-alerts-widget__filter-chip-dot {
	display: inline-block;
	width: 0.6rem;
	height: 0.6rem;
	border-radius: 999px;
	background: currentColor;
	flex: none;
}

.nt-alerts-widget__section {
	margin-bottom: 1.75rem;
}

.nt-alerts-widget__section:last-child {
	margin-bottom: 0;
}

.nt-alerts-widget__section-title {
	display: flex;
	align-items: center;
	gap: 0.55rem;
	font-size: 1.1rem;
	font-weight: 700;
	margin: 0 0 1rem;
	padding-bottom: 0.6rem;
	color: var(--nt-alert-text);
	border-bottom: 2px solid var(--nt-alert-border);
}

.nt-alerts-widget__section--short .nt-alerts-widget__section-title {
	border-bottom-color: var(--nt-alert-border-warning);
}

.nt-alerts-widget__section--long .nt-alerts-widget__section-title {
	border-bottom-color: var(--nt-alert-border-info);
}

.nt-alerts-widget__section-count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5rem;
	height: 1.5rem;
	padding: 0 0.4rem;
	border-radius: 999px;
	background: var(--nt-alert-muted);
	font-size: 0.78rem;
	font-weight: 700;
	color: #ffffff;
	line-height: 1;
}

.nt-alerts-widget__section--short .nt-alerts-widget__section-count {
	background: var(--nt-alert-border-warning);
}

.nt-alerts-widget__section--long .nt-alerts-widget__section-count {
	background: var(--nt-alert-border-info);
}

/*
 * Card surface: neutral, soft shadow for elevation, large rounded corners.
 * Severity moved to a soft pastel pill at top-left — no left border anymore.
 * `min-width: 0` so the card never overflows its grid cell when content
 * has long unbreakable strings.
 */
.nt-alerts-widget__alert {
	background: var(--nt-alert-surface);
	border: 1px solid var(--nt-alert-border);
	padding: 1.1rem 1.15rem 1rem;
	border-radius: 14px;
	color: var(--nt-alert-text);
	min-width: 0;
	box-shadow:
		0 1px 2px rgba(0, 0, 0, 0.04),
		0 2px 10px rgba(0, 0, 0, 0.04);
}

/* Top row: reason pill (left), upcoming-pill + posted timestamp (right) */
.nt-alerts-widget__top-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
	margin: 0 0 0.6rem;
	flex-wrap: wrap;
}

/* Upcoming pill — distinct green so it doesn't read as the same colour as
 * the Construction reason pill. Saturated enough to differ from the pale
 * Parade green. */
.nt-alerts-widget__upcoming-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.22rem 0.6rem;
	border-radius: 999px;
	background: #dceee0;
	color: #1d5d3a;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	line-height: 1.4;
	white-space: nowrap;
}

/*
 * Reason pill: colour-coded by why the alert exists, not how severe it is.
 * Falls back to a neutral gray "default" when only the category is known.
 */
.nt-alerts-widget__reason-pill {
	display: inline-flex;
	align-items: center;
	padding: 0.22rem 0.65rem;
	border-radius: 999px;
	font-size: 0.72rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	white-space: nowrap;
}

.nt-alerts-widget__reason-pill--default          { background: #ecedef; color: #374151; }
.nt-alerts-widget__reason-pill--construction     { background: #fdf2dc; color: #5c3f0b; }
.nt-alerts-widget__reason-pill--street-closure   { background: #fbe8e6; color: #6d1410; }
.nt-alerts-widget__reason-pill--weather          { background: #dfedf8; color: #1a3d66; }
.nt-alerts-widget__reason-pill--maintenance      { background: #ecedef; color: #374151; }
.nt-alerts-widget__reason-pill--police-activity  { background: #e1e4f5; color: #1e2a5e; }
.nt-alerts-widget__reason-pill--fire             { background: #fce0d4; color: #6e2a08; }
.nt-alerts-widget__reason-pill--evacuation       { background: #faddd9; color: #5c1410; }
.nt-alerts-widget__reason-pill--terminal-closure { background: #efe1f3; color: #4a1c5a; }
.nt-alerts-widget__reason-pill--collision        { background: #fdd9d4; color: #6c1c10; }
.nt-alerts-widget__reason-pill--parade           { background: #e3f1e6; color: #1a5032; }

.nt-alerts-widget__title {
	font-size: 1.22rem;
	line-height: 1.3;
	margin: 0 0 0.85rem;
	color: var(--nt-alert-text);
	font-weight: 700;
}

.nt-alerts-widget__description {
	margin: 0.85rem 0 0.4rem;
	line-height: 1.5;
}

/* Tinted info area: cities + routes + active dates, separated by hairlines. */
.nt-alerts-widget__info-area {
	background: var(--nt-alert-surface-alt);
	border-radius: 10px;
	padding: 0.15rem 0.85rem;
	margin: 0 0 0.85rem;
}

.nt-alerts-widget__info-row {
	display: flex;
	align-items: flex-start;
	gap: 0.7rem;
	padding: 0.7rem 0;
	border-top: 1px solid var(--nt-alert-border);
}

.nt-alerts-widget__info-row:first-child {
	border-top: 0;
}

.nt-alerts-widget__info-icon {
	width: 1.05rem;
	height: 1.05rem;
	flex: none;
	margin-top: 0.1rem;
	color: var(--nt-alert-muted);
}

.nt-alerts-widget__info-content {
	flex: 1 1 auto;
	min-width: 0;
}

.nt-alerts-widget__info-label {
	margin: 0 0 0.15rem;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--nt-alert-muted);
}

.nt-alerts-widget__info-value {
	margin: 0;
	font-size: 0.98rem;
	font-weight: 600;
	line-height: 1.35;
	color: var(--nt-alert-text);
}

/* Two equal-width Start | End cells inside the dates row. */
.nt-alerts-widget__date-grid {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 0.75rem;
}

.nt-alerts-widget__date-cell {
	min-width: 0;
}

.nt-alerts-widget__info-relative {
	margin: 0.2rem 0 0;
	font-size: 0.78rem;
	font-weight: 600;
	color: #8c5a00;
}

.nt-alerts-widget__route-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nt-alerts-widget__route-chip-item {
	margin: 0;
	padding: 0;
}

.nt-alerts-widget__route-chip {
	display: inline-block;
	min-width: 2.4rem;
	padding: 0.22rem 0.6rem;
	border: 2px solid var(--nt-alert-border);
	border-radius: 6px;
	background: var(--nt-alert-surface);
	font-size: 0.85rem;
	font-weight: 700;
	text-align: center;
	line-height: 1.2;
}

.nt-alerts-widget__stops {
	margin: 0 0 0.7rem;
}

.nt-alerts-widget__stops-label {
	display: block;
	margin: 0 0 0.35rem;
	font-size: 0.7rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.nt-alerts-widget__stops--closed    .nt-alerts-widget__stops-label { color: var(--nt-alert-border-critical); }
.nt-alerts-widget__stops--alternate .nt-alerts-widget__stops-label { color: var(--nt-alert-border-info); }

.nt-alerts-widget__stop-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 0.3rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.nt-alerts-widget__stop-chip-item {
	margin: 0;
	padding: 0;
}

.nt-alerts-widget__stop-chip {
	display: inline-block;
	padding: 0.18rem 0.5rem;
	border-radius: 4px;
	font-size: 0.78rem;
	font-weight: 600;
	line-height: 1.3;
	border: 1px solid;
}

.nt-alerts-widget__stop-code {
	font-weight: 700;
	opacity: 0.75;
}

.nt-alerts-widget__stops--closed .nt-alerts-widget__stop-chip {
	border-color: var(--nt-alert-border-critical);
	background: var(--nt-alert-bg-critical);
	color: var(--nt-alert-text-critical);
}

.nt-alerts-widget__stops--alternate .nt-alerts-widget__stop-chip {
	border-color: var(--nt-alert-border-info);
	background: var(--nt-alert-bg-info);
	color: var(--nt-alert-text-info);
}

.nt-alerts-widget__images {
	display: flex;
	flex-wrap: wrap;
	gap: 0.4rem;
	margin: 0.5rem 0 0.35rem;
}

.nt-alerts-widget__image {
	display: block;
	width: 96px;
	height: 96px;
	border-radius: 3px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.05);
	border: 1px solid currentColor;
	box-shadow: 0 1px 2px rgba(0,0,0,0.08);
}

.nt-alerts-widget__image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.nt-alerts-widget__details {
	display: inline-block;
	margin-top: 0.5rem;
	color: inherit;
	text-decoration: underline;
}

.nt-alerts-widget__details:focus-visible,
.nt-alerts-widget__error a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
	border-radius: 2px;
}

.nt-alerts-widget a:focus,
.nt-alerts-widget a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.nt-alerts-widget__empty {
	margin: 0;
	padding: 0.75rem 1rem;
	background: var(--nt-alert-surface-alt);
	border: 1px dashed var(--nt-alert-border);
	color: var(--nt-alert-muted);
	font-size: 0.95rem;
}

.nt-alerts-widget__updated {
	margin: 0.5rem 0 0;
	font-size: 0.75rem;
	color: var(--nt-alert-muted);
}

.nt-alerts-widget__error {
	margin: 0;
	padding: 0.75rem 1rem;
	background: var(--nt-alert-bg-warning);
	border-left: 4px solid var(--nt-alert-border-warning);
	color: var(--nt-alert-text-warning);
}

.nt-alerts-widget__error a {
	color: inherit;
	text-decoration: underline;
}

@media (prefers-reduced-motion: reduce) {
	.nt-alerts-widget,
	.nt-alerts-widget *,
	.nt-alerts-widget *::before,
	.nt-alerts-widget *::after {
		animation-duration: 0.001ms !important;
		animation-iteration-count: 1 !important;
		transition-duration: 0.001ms !important;
	}
}
