/* Naglee Park Flood Monitor. Everything is scoped under .npfm (SPEC §8.4). */

.npfm {
	--npfm-bg: #ffffff;
	--npfm-fg: #1d2327;
	--npfm-muted: #50575e;
	--npfm-border: #dcdcde;
	--npfm-link: #135e96;
	--npfm-preview-bg: #fcf0d6;
	--npfm-preview-fg: #6b4300;

	position: relative; /* Anchors the sparkline hover readout. */
	box-sizing: border-box;
	container-type: inline-size;
	margin: 1.5rem 0;
	padding: 1rem;
	border: 1px solid var(--npfm-border);
	border-radius: 8px;
	background: var(--npfm-bg);
	color: var(--npfm-fg);
	font-family: inherit;
	line-height: 1.5;
}

@media (prefers-color-scheme: dark) {
	.npfm {
		--npfm-bg: #1d2327;
		--npfm-fg: #f0f0f1;
		--npfm-muted: #c3c4c7;
		--npfm-border: #3c434a;
		--npfm-link: #72aee6;
		--npfm-preview-bg: #4a3400;
		--npfm-preview-fg: #fcf0d6;
	}
}

.npfm *,
.npfm *::before,
.npfm *::after {
	box-sizing: inherit;
}

.npfm .npfm-preview-ribbon {
	margin: 0 0 0.75rem;
	padding: 0.25rem 0.5rem;
	border-radius: 4px;
	background: var(--npfm-preview-bg);
	color: var(--npfm-preview-fg);
	font-size: 0.8125rem;
	font-weight: 600;
	letter-spacing: 0.02em;
}

/* Admin-only test scenario (SPEC §13.3): loud on purpose, same in light and dark. */
.npfm .npfm-scenario-ribbon {
	margin: 0 0 0.75rem;
	padding: 0.375rem 0.5rem;
	border: 2px dashed #1d2327;
	border-radius: 4px;
	background: #ffe14d;
	color: #1d2327;
	font-size: 0.875rem;
	font-weight: 700;
	letter-spacing: 0.02em;
}

.npfm .npfm-title {
	margin: 0 0 0.25rem;
	font-size: 1.25rem;
	line-height: 1.3;
	color: inherit;
}

.npfm .npfm-disclaimer-short,
.npfm .npfm-placeholder {
	margin: 0 0 0.75rem;
	color: var(--npfm-muted);
	font-size: 0.9375rem;
}

.npfm .npfm-links ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

/* Every link uses our color, never the theme's (which can fail contrast in dark mode). */
.npfm a {
	color: var(--npfm-link);
}

.npfm .npfm-links a {
	color: var(--npfm-link);
	text-decoration: underline;
}

.npfm .npfm-links a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* Status colors (SPEC §10.5). Always paired with an icon and text. */
.npfm {
	--npfm-l0: #2b7bb9;
	--npfm-l1: #f2c200;
	--npfm-l2: #e8710a;
	--npfm-l3: #c5221f;
	--npfm-l4: #7b1113;
	--npfm-unusual: #6b4fbb;
	--npfm-stale: #8a8f98;
	--npfm-card-bg: #f6f7f7;
	--npfm-banner-bg: #fcf0f1;
	--npfm-banner-fg: #8a2424;
}

@media (prefers-color-scheme: dark) {
	.npfm {
		--npfm-l0: #72aee6;
		--npfm-unusual: #b9a4f0;
		--npfm-card-bg: #2c3338;
		--npfm-banner-bg: #4a1f1f;
		--npfm-banner-fg: #fcf0f1;
	}
}

.npfm .npfm-sr {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

.npfm .npfm-banner {
	margin: 0 0 0.75rem;
	padding: 0.5rem 0.75rem;
	border-radius: 4px;
	background: var(--npfm-banner-bg);
	color: var(--npfm-banner-fg);
	font-weight: 600;
}

.npfm .npfm-banner a {
	color: inherit;
}

.npfm .npfm-headline {
	margin: 0.25rem 0;
	padding-left: 0.75rem;
	border-left: 6px solid var(--npfm-l0);
	font-size: 1.125rem;
	font-weight: 600;
	line-height: 1.4;
}

.npfm .npfm-headline.npfm-level-1 { border-color: var(--npfm-l1); }
.npfm .npfm-headline.npfm-level-2 { border-color: var(--npfm-l2); }
.npfm .npfm-headline.npfm-level-3 { border-color: var(--npfm-l3); }
.npfm .npfm-headline.npfm-level-4 { border-color: var(--npfm-l4); }
.npfm .npfm-headline.npfm-headline-stale { border-color: var(--npfm-stale); }

.npfm .npfm-asof,
.npfm .npfm-card-time,
.npfm .npfm-footer {
	margin: 0 0 0.75rem;
	color: var(--npfm-muted);
	font-size: 0.875rem;
}

/* Which release is running, for bug reports. */
.npfm .npfm-version {
	white-space: nowrap;
}

.npfm .npfm-disclaimer {
	margin: 0 0 0.75rem;
	font-size: 0.9375rem;
}

.npfm .npfm-disclaimer > p {
	margin: 0;
}

.npfm details > summary {
	cursor: pointer;
	color: var(--npfm-link);
}

.npfm details > summary:focus-visible,
.npfm a:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

.npfm .npfm-section {
	margin: 1.25rem 0 0;
}

.npfm .npfm-section h3 {
	margin: 0 0 0.5rem;
	font-size: 1rem;
	color: inherit;
}

.npfm .npfm-cards {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(100%, 13rem), 1fr));
	gap: 0.75rem;
}

.npfm .npfm-card {
	position: relative;
	padding: 0.75rem;
	border: 1px solid var(--npfm-border);
	border-top: 4px solid var(--npfm-l0);
	border-radius: 6px;
	background: var(--npfm-card-bg);
	font-size: 0.9375rem;
}

.npfm .npfm-card.npfm-level-1 { border-top-color: var(--npfm-l1); }
.npfm .npfm-card.npfm-level-2 { border-top-color: var(--npfm-l2); }
.npfm .npfm-card.npfm-level-3 { border-top-color: var(--npfm-l3); }
.npfm .npfm-card.npfm-level-4 { border-top-color: var(--npfm-l4); }

.npfm .npfm-card.npfm-stale {
	border-style: dashed;
	border-top-color: var(--npfm-stale);
	color: var(--npfm-muted);
}

.npfm .npfm-card.npfm-featured {
	grid-column: 1 / -1;
	border-width: 2px;
	border-top-width: 6px;
}

.npfm .npfm-card.npfm-role-inflow {
	font-size: 0.875rem;
}

.npfm .npfm-card-title {
	margin: 0 0 0.25rem;
	font-size: 0.9375rem;
	color: inherit;
}

.npfm .npfm-card-value {
	margin: 0 0 0.25rem;
}

.npfm .npfm-primary {
	font-size: 1.25rem;
	font-weight: 700;
}

.npfm .npfm-featured .npfm-primary {
	font-size: 1.75rem;
}

.npfm .npfm-secondary {
	color: var(--npfm-muted);
}

.npfm .npfm-trend {
	font-weight: 700;
}

.npfm .npfm-chip {
	display: inline-block;
	margin: 0 0 0.25rem;
	padding: 0.0625rem 0.5rem;
	border-radius: 999px;
	background: var(--npfm-bg);
	border: 1px solid var(--npfm-border);
	font-size: 0.8125rem;
}

.npfm .npfm-unverified,
.npfm .npfm-note,
.npfm .npfm-gauge-notes {
	margin: 0.25rem 0;
	font-size: 0.8125rem;
	color: var(--npfm-muted);
}

.npfm .npfm-card-details {
	margin-top: 0.25rem;
	font-size: 0.875rem;
}

.npfm .npfm-card-details ul {
	margin: 0.25rem 0;
	padding-left: 1.25rem;
}

.npfm .npfm-more {
	margin-top: 0.75rem;
}

.npfm .npfm-more > .npfm-cards {
	margin-top: 0.5rem;
}

.npfm .npfm-rain-zone {
	margin: 0 0 0.25rem;
}

.npfm .npfm-table-wrap {
	margin-top: 1.25rem;
}

.npfm .npfm-table-scroll {
	overflow-x: auto;
}

.npfm .npfm-table {
	width: 100%;
	border-collapse: collapse;
	font-size: 0.875rem;
}

.npfm .npfm-table caption {
	text-align: left;
	color: var(--npfm-muted);
}

.npfm .npfm-table th,
.npfm .npfm-table td {
	padding: 0.25rem 0.5rem;
	border-bottom: 1px solid var(--npfm-border);
	text-align: left;
	vertical-align: top;
}

/* ---------- Diagram (browser-rendered, SPEC §8; design: docs/mockups/mobile-approved.png) ---------- */

.npfm {
	container-name: npfm;
	--npfm-r0: #c4d9f2;
	--npfm-r1: #f6dc7d;
	--npfm-r2: #f2b27a;
	--npfm-r3: #e48d89;
	--npfm-r4: #b9696b;
	--npfm-rstale: #d5d8dc;
	--npfm-none: #8a8f98;
	--npfm-node-bg: #ffffff;
	/* Card colors: creeks are water, so side-creek cards are blue; Coyote Creek
	   gauge cards (measuring stations on the blue creek line) are a light
	   neutral; rain is slate (below). */
	--npfm-gauge-bg: #f5f6f7;
	--npfm-gauge-border: #cdd2d8;
	--npfm-creek-bg: #e2edfa;
	--npfm-creek-border: #b9d0ea;
	--npfm-line: #a7aaad;
	--npfm-band: #f2f2f3;
	--npfm-diagram-bg: #ffffff;
	/* Storm drain info box: pale warm cream, well short of the Watch yellow. */
	--npfm-info-bg: #fbf6ec;
	--npfm-info-border: #e7d9bd;
	/* Width shared by the rain strip and the two tanks, so rain sits right above the reservoirs. */
	--npfm-sky: 28rem;
}

@media (prefers-color-scheme: dark) {
	.npfm {
		--npfm-r0: #2f5277;
		--npfm-r1: #7a6416;
		--npfm-r2: #7d4518;
		--npfm-r3: #7a2a28;
		--npfm-r4: #5c1d1f;
		--npfm-rstale: #4b5157;
		--npfm-node-bg: #23282d;
		--npfm-gauge-bg: #262b30;
		--npfm-gauge-border: #454c54;
		--npfm-creek-bg: #1f3550;
		--npfm-creek-border: #34557d;
		--npfm-line: #646970;
		--npfm-band: #14171a;
		--npfm-diagram-bg: #1d2327;
		--npfm-info-bg: #2a2620;
		--npfm-info-border: #4d4535;
	}
}

.npfm.npfm-js .npfm-sections {
	display: none;
}

.npfm .npfm-flow[hidden] {
	display: none;
}

/* The diagram: a white rounded card, centered on a light grey band (approved design). */
.npfm .npfm-flow {
	margin: 1.25rem 0;
	padding: 1.25rem;
	border-radius: 16px;
	background: var(--npfm-band);
}

.npfm .npfm-diagram {
	max-width: 44rem;
	margin: 0 auto;
	padding: 1.5rem 1.25rem 1rem;
	border-radius: 24px;
	background: var(--npfm-diagram-bg);
}

/* Phones: keep the frame but give the cards the width. */
@container npfm (max-width: 560px) {
	.npfm .npfm-flow {
		/* Bleed into the dashboard's side padding. */
		margin-inline: -0.75rem;
		padding: 0.375rem;
		border-radius: 12px;
	}

	.npfm .npfm-diagram {
		padding: 1rem 0.375rem 0.75rem;
		border-radius: 16px;
	}
}

.npfm .npfm-flow-body {
	--npfm-orient: v;
	position: relative;
	max-width: 40rem;
	margin: 1rem auto 0;
	padding: 0.5rem 0 2.75rem;
}

.npfm .npfm-wires {
	position: absolute;
	inset: 0;
	z-index: 0;
	overflow: visible;
	pointer-events: none;
}

.npfm .npfm-flow-body > :not(.npfm-wires) {
	position: relative;
	z-index: 1;
}

/* Tanks */
.npfm .npfm-tanks {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 0.25rem;
	width: min(100%, var(--npfm-sky));
	margin: 0 auto;
}

/* Phones: room on the right for Coyote Creek leaving Anderson. */
@container npfm (max-width: 560px) {
	.npfm .npfm-tanks,
	.npfm .npfm-feeders {
		width: auto;
		margin-right: 2.25rem;
	}
}

.npfm .npfm-tank {
	width: 44%;
	margin: 0;
	text-align: center;
}

.npfm .npfm-tank-name {
	font-weight: 600;
}

.npfm .npfm-tank-name span {
	padding: 0 0.25rem;
	border-radius: 4px;
	background: var(--npfm-diagram-bg);
	-webkit-box-decoration-break: clone;
	box-decoration-break: clone;
}

.npfm .npfm-tank-svg {
	display: block;
	width: 100%;
	height: auto;
}

.npfm .npfm-tank-shell {
	fill: var(--npfm-node-bg);
	stroke: var(--npfm-line);
	stroke-width: 1.5;
}

.npfm .npfm-tank-water {
	fill: var(--npfm-r0);
}

.npfm .npfm-tank-spill {
	stroke: var(--npfm-l3);
	stroke-width: 1.2;
	stroke-dasharray: 4 3;
}

.npfm .npfm-tank-link {
	position: relative;
	flex: 1;
	align-self: stretch;
	min-width: 2.5rem;
	color: var(--npfm-muted);
	font-size: 0.8125rem;
	line-height: 1.2;
	text-align: center;
}

/* Placed by drawWires just above the creek along the tanks' bottom. */
.npfm .npfm-tank-link-flow {
	position: absolute;
	top: 2.5rem;
	right: 0;
	left: 0;
}

.npfm .npfm-tank-link.npfm-is-stale {
	font-style: italic;
}

.npfm .npfm-tank-reading {
	margin: 0.125rem 0 0;
	font-size: 0.9375rem;
}

/* 12-hour level line under each tank (scale at least 1 ft, so drift stays flat). */
.npfm .npfm-tank-trend {
	margin: 0.375rem auto 0;
	max-width: 9rem;
	color: var(--npfm-muted);
	font-size: 0.8125rem;
	line-height: 1.3;
}

.npfm .npfm-tank-trend-cap,
.npfm .npfm-tank-trend-total {
	display: block;
}

.npfm .npfm-tank-trend .npfm-spark {
	display: block;
	width: 100%;
	margin: 0.125rem 0;
}

.npfm .npfm-tank.npfm-st-stale .npfm-tank-trend .npfm-spark {
	opacity: 0.5;
}

.npfm .npfm-tank-note {
	font-size: 0.875rem;
	color: var(--npfm-muted);
}

.npfm .npfm-tank-note p {
	margin: 0.25rem 0;
	text-align: left;
}

/* Dam outlet gauge (Below Anderson): in the vertical layout it hangs under
   Anderson, in that tank's column, its dot on the outflow beside the dam
   (drawWires). Its copy in the creek column shows only in the wide layout. */
.npfm .npfm-outlet {
	display: flex;
	justify-content: flex-end;
	width: min(100%, var(--npfm-sky));
	margin: 0.75rem auto 0;
}

.npfm .npfm-outlet > .npfm-node {
	width: 44%;
}

.npfm .npfm-reach > .npfm-node-outlet {
	display: none;
}

/* Keep Anderson's 12-hour line clear of the outlet's leader on its right. */
.npfm .npfm-reservoirs:has(.npfm-outlet) .npfm-tank:last-of-type .npfm-tank-trend {
	padding-right: 1rem;
}

/* Phones: same room on the right as the tanks, for the outflow line. */
@container npfm (max-width: 560px) {
	.npfm .npfm-outlet {
		width: auto;
		margin-right: 2.25rem;
	}
}

/* "Show all": creeks into the reservoirs, above the tank each one feeds. */
.npfm .npfm-feeders {
	width: min(100%, var(--npfm-sky));
	margin: 0 auto 1.75rem;
}

.npfm .npfm-feeder-row {
	display: flex;
	justify-content: space-between;
	align-items: flex-end;
}

.npfm .npfm-feeder {
	display: flex;
	flex-direction: column;
	gap: 0.5rem;
	width: 44%;
}

/* Reaches: tributaries | creek lane | main stem */
.npfm .npfm-reach {
	--npfm-orient: v;
	display: grid;
	grid-template-columns: minmax(0, 1fr) 3.5rem minmax(0, 1fr);
	row-gap: 0.875rem;
	margin: 3.5rem 0 1.25rem;
}

.npfm .npfm-downstream {
	margin: 1.75rem 0 0;
}

.npfm .npfm-lane {
	grid-column: 2;
	grid-row: 1;
	min-height: 1px;
}

.npfm .npfm-reach > .npfm-node {
	grid-row: var(--i);
	align-self: start;
}

.npfm .npfm-reach > .npfm-node-main {
	grid-column: 3;
}

.npfm .npfm-reach > .npfm-node-trib {
	grid-column: 1;
}

/* Gauge cards */
.npfm .npfm-node {
	border: 1px solid var(--npfm-gauge-border);
	border-radius: 10px;
	background: var(--npfm-gauge-bg);
	font-size: 0.9375rem;
	/* Narrow phone columns: hyphenate long names ("Peni-tencia") instead of the theme's mid-word breaks. */
	overflow-wrap: normal;
	word-break: normal;
	hyphens: auto;
}

.npfm .npfm-node-trib {
	border-color: transparent;
	background: var(--npfm-creek-bg);
}

.npfm .npfm-node.npfm-is-stale {
	border: 1px dashed var(--npfm-stale);
	color: var(--npfm-muted);
}

.npfm .npfm-node > summary {
	display: block;
	padding: 0.5rem 0.625rem;
	list-style: none;
	color: inherit;
	border-radius: 10px;
}

.npfm .npfm-node > summary::-webkit-details-marker {
	display: none;
}

.npfm .npfm-node > summary:focus-visible {
	outline: 2px solid var(--npfm-link);
	outline-offset: 2px;
}

.npfm .npfm-node-name {
	display: flex;
	align-items: center;
	gap: 0.375rem;
	font-weight: 600;
	line-height: 1.3;
}

.npfm .npfm-node-main .npfm-node-name .npfm-dot {
	display: none;
}

.npfm .npfm-node-main {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.25rem 0.5rem;
}

.npfm .npfm-node-primary {
	white-space: nowrap;
}

.npfm .npfm-node-vals {
	display: flex;
	flex-direction: column;
	min-width: 0;
	line-height: 1.35;
}

.npfm .npfm-node-secondary {
	color: var(--npfm-muted);
	font-size: 0.875rem;
}

.npfm .npfm-trend {
	font-weight: 700;
}

.npfm .npfm-spark {
	flex: none;
	max-width: 100%; /* Narrow phone cards: shrink rather than spill out. */
	height: auto;
	overflow: visible;
}

.npfm .npfm-spark path {
	fill: none;
	stroke: var(--npfm-l0);
	stroke-width: 1.6;
	stroke-linejoin: round;
}

.npfm .npfm-spark circle {
	fill: var(--npfm-l0);
}

/* Bridge line: the level 12 hours ago and now, bracketed and labeled with the change. */
.npfm .npfm-spark .npfm-spark-guide {
	stroke: var(--npfm-line);
	stroke-width: 1;
	stroke-dasharray: 1 3;
	stroke-linecap: round;
}

.npfm .npfm-spark path.npfm-spark-bracket {
	fill: none;
	stroke: var(--npfm-muted);
	stroke-width: 1;
	stroke-linejoin: miter;
}

.npfm .npfm-spark-delta {
	fill: var(--npfm-fg);
	font-size: 12.5px;
	font-weight: 600;
}

.npfm .npfm-spark-delta.npfm-is-steady {
	fill: var(--npfm-muted);
	font-weight: 400;
}

.npfm .npfm-node-trib .npfm-spark path,
.npfm .npfm-nested .npfm-spark path {
	stroke: var(--npfm-none);
}

.npfm .npfm-node-trib .npfm-spark circle,
.npfm .npfm-nested .npfm-spark circle {
	fill: var(--npfm-none);
}

/* Net change over 12 hours on cards: only when the dashboard is wide enough
   (desktop), since phone cards are tight. The bridge labels its change
   beside the line instead (.npfm-spark-delta); its sentence is sr-only. */
.npfm .npfm-node-change {
	display: none;
	color: var(--npfm-muted);
	font-size: 0.8125rem;
}

@container npfm (min-width: 720px) {
	.npfm .npfm-node-change {
		display: block;
	}
}

/* Hover readout (mouse and pen only). */
@media (hover: hover) {
	.npfm .npfm-spark {
		cursor: crosshair;
	}
}

.npfm .npfm-spark-hover {
	fill: var(--npfm-bg);
	stroke: var(--npfm-fg);
	stroke-width: 1.5;
	pointer-events: none;
}

.npfm .npfm-tip {
	position: absolute;
	z-index: 5;
	transform: translate(-50%, -100%);
	padding: 0.1875rem 0.5rem;
	border-radius: 4px;
	background: var(--npfm-fg);
	color: var(--npfm-bg);
	font-size: 0.8125rem;
	line-height: 1.3;
	/* One line when it fits; long notes wrap rather than leave a narrow screen. */
	width: max-content;
	max-width: min(20rem, calc(100% - 8px));
	pointer-events: none;
}

.npfm .npfm-tip[hidden] {
	display: none;
}

.npfm .npfm-spark-th {
	stroke-width: 1;
	stroke-dasharray: 3 2;
}

.npfm .npfm-spark-none {
	display: inline-flex;
	flex-direction: column;
	align-items: center;
	color: var(--npfm-muted);
	font-size: 0.8125rem;
}

.npfm .npfm-spark-none line {
	stroke: var(--npfm-line);
	stroke-dasharray: 4 3;
}

.npfm .npfm-nested {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-end;
	justify-content: space-between;
	gap: 0.25rem 0.5rem;
	margin-top: 0.375rem;
	font-size: 0.875rem;
	color: var(--npfm-muted);
}

.npfm .npfm-nested-note {
	display: block;
}

.npfm .npfm-node-flag,
.npfm .npfm-badge {
	display: block;
	margin-top: 0.25rem;
	font-size: 0.8125rem;
	color: var(--npfm-muted);
}

.npfm .npfm-badge {
	display: inline-block;
	padding: 0 0.375rem;
	border: 1.5px dashed var(--npfm-unusual);
	border-radius: 999px;
	color: var(--npfm-unusual);
}

/* Badges in the diagram explain themselves on hover or tap (hover.js). */
.npfm .npfm-badge[data-tip] {
	cursor: help;
}

/* In narrow cards a badge is a small tag on its own line, so a wrapped label stays readable. */
.npfm .npfm-node .npfm-badge {
	display: block;
	width: fit-content;
	max-width: 100%;
	padding: 0.0625rem 0.375rem;
	border-radius: 6px;
	font-size: 0.75rem;
	line-height: 1.3;
}

/* Unofficial badges: purple and dashed, never an official level color (SPEC §6.5, §10.5). */
.npfm .npfm-node.npfm-badged {
	outline: 2px dashed var(--npfm-unusual);
	outline-offset: 2px;
}

.npfm .npfm-headline.npfm-unusual {
	border-left-color: var(--npfm-unusual);
	border-left-style: dashed;
}

.npfm .npfm-headline.npfm-unusual .npfm-icon,
.npfm .npfm-badge-note {
	color: var(--npfm-unusual);
}

/* Legend key for unusual readings: a small copy of the badge itself. */
.npfm .npfm-badge-key {
	flex: none;
	font-size: 0.6875rem;
	line-height: 1.35;
}

.npfm .npfm-w-badge {
	fill: none;
	stroke: var(--npfm-unusual);
	stroke-width: 19;
	stroke-dasharray: 6 5;
	stroke-linecap: butt;
}

.npfm .npfm-w-badge-trib {
	stroke-width: 13;
}

.npfm .npfm-node-details {
	padding: 0 0.625rem 0.5rem;
	font-size: 0.875rem;
}

.npfm .npfm-node-details p {
	margin: 0.25rem 0;
}

.npfm .npfm-node-details ul {
	margin: 0.25rem 0;
	padding-left: 1.25rem;
}

/* Status dots (legend, tributary cards, ribbon) */
.npfm .npfm-dot {
	display: inline-block;
	flex: none;
	width: 0.75rem;
	height: 0.75rem;
	border-radius: 50%;
	background: var(--npfm-l0);
}

.npfm .npfm-st-l1 > summary .npfm-dot, .npfm .npfm-dot.npfm-st-l1 { background: var(--npfm-l1); }
.npfm .npfm-st-l2 > summary .npfm-dot, .npfm .npfm-dot.npfm-st-l2 { background: var(--npfm-l2); }
.npfm .npfm-st-l3 > summary .npfm-dot, .npfm .npfm-dot.npfm-st-l3 { background: var(--npfm-l3); }
.npfm .npfm-st-l4 > summary .npfm-dot, .npfm .npfm-dot.npfm-st-l4 { background: var(--npfm-l4); }
.npfm .npfm-st-none > summary .npfm-dot, .npfm .npfm-dot.npfm-st-none { background: transparent; border: 2px solid var(--npfm-none); } /* Hollow: no official flood levels. */
.npfm .npfm-st-stale > summary .npfm-dot, .npfm .npfm-dot.npfm-st-stale { background: transparent; border: 2px dashed var(--npfm-stale); }

/* Bridge (William St) */
.npfm .npfm-bridge {
	width: min(100%, 26rem);
	margin: 0 auto;
	text-align: left;
}

.npfm .npfm-bridge-title {
	width: 58%;
	white-space: nowrap;
	font-weight: 700;
	font-size: 1.0625rem;
	text-align: center;
}

.npfm .npfm-bridge-id {
	display: block;
	color: var(--npfm-muted);
	font-size: 0.8125rem;
	font-weight: 400;
}

/* A label with an explanation: dotted underline, readout on hover or tap (hover.js). */
.npfm .npfm-has-note {
	text-decoration: underline dotted;
	text-underline-offset: 2px;
	cursor: help;
}

.npfm .npfm-bridge-svg {
	display: block;
	width: 100%;
	height: auto;
	overflow: visible;
}

.npfm .npfm-deck {
	fill: #bdbdbd;
}

.npfm .npfm-channel {
	fill: none;
	stroke: #6e6e6e;
	stroke-width: 2;
	stroke-linejoin: round;
}

.npfm .npfm-water {
	fill: #96bce6;
}

.npfm .npfm-water.npfm-st-l1 { fill: var(--npfm-r1); }
.npfm .npfm-water.npfm-st-l2 { fill: var(--npfm-r2); }
.npfm .npfm-water.npfm-st-l3 { fill: var(--npfm-r3); }
.npfm .npfm-water.npfm-st-l4 { fill: var(--npfm-r4); }
.npfm .npfm-water.npfm-st-stale { fill: var(--npfm-rstale); }

.npfm .npfm-th {
	stroke-width: 2;
	stroke-dasharray: 5 3;
}

.npfm .npfm-th-l1, .npfm .npfm-spark-th.npfm-th-l1 { stroke: var(--npfm-l1); }
.npfm .npfm-th-l2, .npfm .npfm-spark-th.npfm-th-l2 { stroke: var(--npfm-l2); }
.npfm .npfm-th-l3, .npfm .npfm-spark-th.npfm-th-l3 { stroke: var(--npfm-l3); }
.npfm .npfm-th-l4, .npfm .npfm-spark-th.npfm-th-l4 { stroke: var(--npfm-l4); }

.npfm .npfm-th.npfm-season {
	stroke: var(--npfm-l0);
	stroke-width: 1.5;
	stroke-dasharray: 1 3;
	stroke-linecap: round;
}

.npfm .npfm-blabel.npfm-season {
	fill: var(--npfm-muted);
}

.npfm .npfm-th.npfm-record {
	stroke: var(--npfm-muted);
	stroke-width: 1.5;
	stroke-dasharray: 1 3;
	stroke-linecap: round;
}

.npfm .npfm-leader {
	fill: none;
	stroke: var(--npfm-line);
	stroke-width: 1;
}

.npfm .npfm-blabel {
	fill: currentColor;
	stroke: none;
	font-size: 12.5px;
}

.npfm .npfm-blabel.npfm-record {
	fill: var(--npfm-muted);
	font-style: italic;
}

.npfm .npfm-blabel.npfm-now tspan:first-child {
	font-size: 14.5px;
	font-weight: 700;
}

.npfm .npfm-bridge-spark {
	display: flex;
	flex-direction: column;
	align-items: center;
	width: 58%;
	/* Up into the space under the channel floor, so it reads as part of the bridge. */
	margin-top: -1.25rem;
	margin-bottom: 0.5rem; /* Room under the change bracket before "Details". */
	color: var(--npfm-muted);
	font-size: 0.875rem;
}

.npfm .npfm-bridge .npfm-node-details-wrap {
	width: 58%;
	text-align: center;
	font-size: 0.875rem;
}

.npfm .npfm-bridge .npfm-node-details {
	text-align: left;
}

/* Storm drain explainer: an info box. A "Why?" under the bridge on phones;
   open beside it (placed by drawWires) where there's room. */
.npfm .npfm-drains {
	margin: 0.75rem 0 0;
	padding: 0.75rem 0.875rem;
	border: 1px solid var(--npfm-info-border);
	border-radius: 12px;
	background: var(--npfm-info-bg);
	font-size: 0.875rem;
	line-height: 1.45;
}

.npfm .npfm-drains > summary {
	/* Icon on the left; the heading stays in its own column to its right. */
	display: flex;
	align-items: flex-start;
	gap: 0.5rem;
	list-style: none;
	color: inherit;
	font-weight: 700;
	line-height: 1.35;
}

.npfm .npfm-drains > summary::-webkit-details-marker {
	display: none;
}

.npfm .npfm-drains-head {
	flex: 1;
	min-width: 0;
}

/* Centered on the heading's first line. */
.npfm .npfm-drains-icon {
	flex: none;
	width: 1.375rem;
	height: 1.375rem;
	margin-top: calc((1.35em - 1.375rem) / 2);
}

.npfm .npfm-drains-icon circle {
	fill: var(--npfm-link);
}

.npfm .npfm-drains-icon path {
	fill: none;
	stroke: var(--npfm-diagram-bg);
	stroke-width: 2.4;
	stroke-linecap: round;
	stroke-linejoin: round;
}

.npfm .npfm-drains-icon .npfm-drains-icon-dot {
	fill: var(--npfm-diagram-bg);
}

.npfm .npfm-drains-why {
	margin-left: 0.25rem;
	color: var(--npfm-link);
	font-weight: 400;
	text-decoration: underline;
	white-space: nowrap;
}

.npfm .npfm-drains[open] .npfm-drains-why {
	display: none;
}

.npfm .npfm-drains p {
	margin: 0.5rem 0 0;
}

.npfm .npfm-drains a[href^="tel:"] {
	white-space: nowrap;
}

.npfm .npfm-drains-stage {
	color: var(--npfm-muted);
	font-style: italic;
}

.npfm .npfm-drains-beside {
	position: absolute;
	margin: 0;
}

/* Beside the bridge it's always open, so the heading isn't a control. */
.npfm .npfm-drains-beside > summary {
	cursor: default;
	pointer-events: none;
	font-size: 0.9375rem;
}

/* "Read more": the full explanation replaces the short lead. */
.npfm .npfm-drains-more > summary {
	display: inline-block;
	margin-top: 0.5rem;
	color: var(--npfm-link);
	text-decoration: underline;
	cursor: pointer;
	list-style: none;
}

.npfm .npfm-drains-more > summary::-webkit-details-marker {
	display: none;
}

.npfm .npfm-drains-more[open] > summary {
	margin-top: 0.25rem;
}

.npfm .npfm-drains-more-close,
.npfm .npfm-drains-more[open] .npfm-drains-more-open,
.npfm .npfm-drains:has(.npfm-drains-more[open]) .npfm-drains-lead {
	display: none;
}

.npfm .npfm-drains-more[open] .npfm-drains-more-close {
	display: inline;
}

/* Wires */
.npfm .npfm-w-ribbon,
.npfm .npfm-w-trib {
	fill: none;
	stroke: var(--npfm-r0);
	stroke-linecap: round;
	stroke-linejoin: round;
}

.npfm .npfm-w-ribbon {
	stroke-width: 13;
}

.npfm .npfm-w-trib {
	stroke-width: 8;
}

.npfm .npfm-w-ribbon.npfm-w-link {
	stroke-width: 9;
}

.npfm .npfm-w-link-flow,
.npfm .npfm-w-trib-flow {
	stroke-width: 2;
	stroke-dasharray: 5 10;
}

.npfm .npfm-rib-l1 { stroke: var(--npfm-r1); }
.npfm .npfm-rib-l2 { stroke: var(--npfm-r2); }
.npfm .npfm-rib-l3 { stroke: var(--npfm-r3); }
.npfm .npfm-rib-l4 { stroke: var(--npfm-r4); }
.npfm .npfm-rib-stale { stroke: var(--npfm-rstale); }

.npfm .npfm-w-flow {
	fill: none;
	stroke: #ffffff;
	stroke-opacity: 0.8;
	stroke-width: 3;
	stroke-linecap: round;
	stroke-dasharray: 7 13;
	animation: npfm-flow 4s linear infinite;
}

@keyframes npfm-flow {
	to {
		stroke-dashoffset: -40;
	}
}

.npfm .npfm-w-leader {
	stroke: var(--npfm-line);
	stroke-width: 1;
}

.npfm .npfm-w-dot {
	fill: var(--npfm-l0);
	stroke: var(--npfm-bg);
	stroke-width: 2;
	pointer-events: auto; /* Found by hover.js (elementsFromPoint); the rest of the drawing ignores the pointer. */
}

@media (hover: hover) {
	.npfm.npfm-over-dot,
	.npfm.npfm-over-dot *,
	.npfm .npfm-node .npfm-dot {
		cursor: help;
	}
}

.npfm .npfm-w-dot.npfm-st-l1 { fill: var(--npfm-l1); }
.npfm .npfm-w-dot.npfm-st-l2 { fill: var(--npfm-l2); }
.npfm .npfm-w-dot.npfm-st-l3 { fill: var(--npfm-l3); }
.npfm .npfm-w-dot.npfm-st-l4 { fill: var(--npfm-l4); }
.npfm .npfm-w-dot.npfm-st-none { fill: var(--npfm-diagram-bg); stroke: var(--npfm-none); stroke-width: 2.5; }
.npfm .npfm-w-dot.npfm-st-stale { fill: var(--npfm-bg); stroke: var(--npfm-stale); stroke-dasharray: 3 2; }

.npfm .npfm-w-bay {
	fill: var(--npfm-muted);
	font-size: 14px;
}

/* Legend and controls */
.npfm .npfm-flow-foot {
	margin-top: 0.5rem;
}

.npfm .npfm-showall {
	margin: 0 0 0.75rem;
	padding: 0.375rem 0.875rem;
	border: 1px solid var(--npfm-border);
	border-radius: 999px;
	background: var(--npfm-node-bg);
	color: var(--npfm-link);
	font: inherit;
	font-size: 0.9375rem;
	cursor: pointer;
}

.npfm .npfm-showall:focus-visible {
	outline: 2px solid var(--npfm-link);
	outline-offset: 2px;
}

.npfm .npfm-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem 1rem;
	margin: 0 0 0.5rem;
	padding: 0;
	list-style: none;
	font-size: 0.875rem;
}

.npfm .npfm-legend li {
	display: flex;
	align-items: center;
	gap: 0.375rem;
}

/* Card-type swatches in the legend. */
.npfm .npfm-swatch {
	display: inline-block;
	flex: none;
	width: 1.5rem;
	height: 0.875rem;
	border: 1px solid transparent;
	border-radius: 4px;
}

.npfm .npfm-swatch-main {
	border-color: var(--npfm-gauge-border);
	background: var(--npfm-gauge-bg);
}

.npfm .npfm-swatch-side {
	border-color: var(--npfm-creek-border);
	background: var(--npfm-creek-bg);
}

.npfm .npfm-swatch-rain {
	border-color: var(--npfm-rain-border);
	background: var(--npfm-rain-bg);
}

.npfm .npfm-readings {
	margin: 0;
	color: var(--npfm-muted);
	font-size: 0.875rem;
}

/* ---------- Site message (SPEC §9) ---------- */

.npfm .npfm-message {
	margin: 0.75rem 0;
	padding: 0.75rem 1rem;
	border-left: 6px solid var(--npfm-link);
	border-radius: 4px;
	background: var(--npfm-card-bg);
	font-size: 1.0625rem;
	font-weight: 500;
}

/* "Hide" mode: only the title, the message, the disclaimer and the official links remain. */
.npfm.npfm-mode-hide > :not(.npfm-preview-ribbon, .npfm-scenario-ribbon, .npfm-title, .npfm-message-slot, .npfm-disclaimer, .npfm-links) {
	display: none !important;
}

/* ---------- Rain (SPEC §8.3; design: docs/mockups/mobile-rain.png) ---------- */

/* Rain totals are cloud slate, so they never read as creek cards (blue). */
.npfm {
	--npfm-rain: #5b93dd;
	--npfm-streak: #7aa7e6;
	--npfm-rain-bg: #e3e7ee;
	--npfm-rain-border: #c5ccd6;
}

@media (prefers-color-scheme: dark) {
	.npfm {
		--npfm-rain-bg: #2e343d;
		--npfm-rain-border: #454d58;
	}
}

/* Strip on top, pills stacked under it (as designed), at every width. */
.npfm .npfm-rain-panel {
	display: grid;
	gap: 0.875rem;
	width: min(100%, var(--npfm-sky));
	margin: 0 auto 0.5rem;
}

.npfm .npfm-rain-head {
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	justify-content: space-between;
	gap: 0 0.75rem;
	margin: 0 0 0.5rem;
}

.npfm .npfm-rain-title {
	font-size: 1.0625rem;
	font-weight: 500;
}

.npfm .npfm-rain-summary {
	color: var(--npfm-muted);
	font-size: 0.9375rem;
}

/* 24 hourly bars; deeper blue for a higher chance. */
.npfm .npfm-pop {
	display: flex;
	align-items: flex-end;
	gap: 3px;
	height: 3.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.npfm .npfm-pop-bar {
	flex: 1 1 0;
	height: max(2px, calc(var(--p, 0) * 1%));
	margin: 0;
	border-radius: 3px 3px 0 0;
	background: var(--npfm-rain);
	opacity: calc(0.4 + var(--p, 0) / 166);
}

@media (hover: hover) {
	.npfm .npfm-pop {
		cursor: crosshair;
	}
}

.npfm .npfm-pop-bar.npfm-pop-hover {
	opacity: 1;
	outline: 2px solid var(--npfm-fg);
	outline-offset: 1px;
}

.npfm .npfm-pop-none {
	height: 2px;
	background: var(--npfm-rstale);
	opacity: 1;
}

.npfm .npfm-pop-hours {
	display: flex;
	justify-content: space-between;
	margin: 0.25rem 0 0;
	color: var(--npfm-muted);
	font-size: 0.9375rem;
}

.npfm .npfm-rain-pills {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 0.5rem;
}

.npfm .npfm-rain-pill {
	margin: 0;
	padding: 0.4375rem 1rem;
	border: 1px solid var(--npfm-rain-border);
	border-radius: 999px;
	background: var(--npfm-rain-bg);
	font-size: 0.9375rem;
	line-height: 1.35;
}

.npfm .npfm-rain-pill strong {
	font-weight: 500;
}

.npfm .npfm-muted {
	color: var(--npfm-muted);
}

.npfm .npfm-rain-pill .npfm-muted {
	font-size: 0.875rem;
	white-space: nowrap;
}

/* Valley Water's icon as the link to the source of the rain totals. */
.npfm .npfm-rain-source {
	display: inline-block;
	vertical-align: -0.2em;
	line-height: 1;
	border-radius: 3px;
}

.npfm .npfm-vw-icon {
	display: block;
	width: 1.125em;
	height: 1.125em;
}

/* "Raining now at …": its own line under the totals, so the pill rounds less. */
.npfm .npfm-rain-pill.npfm-is-raining {
	border-radius: 1.125rem;
}

.npfm .npfm-rain-where {
	display: block;
	margin-top: 0.125rem;
	font-size: 0.8125rem;
	line-height: 1.35;
}

/* Valley appears as a pill only in the horizontal layout; otherwise as a card beside the creek. */
.npfm .npfm-valley-pill {
	display: none;
}

.npfm .npfm-reach > .npfm-rain-card {
	position: relative;
	grid-column: 1;
	grid-row: var(--i);
	align-self: start;
	padding: 0.5rem 1.25rem;
	border: 1px solid var(--npfm-rain-border);
	border-radius: 14px;
	background: var(--npfm-rain-bg);
}

.npfm .npfm-rain-card p {
	margin: 0;
}

.npfm .npfm-rain-card-source {
	margin-top: 0.125rem;
	font-size: 0.8125rem;
}

.npfm .npfm-rain-card-name {
	font-weight: 500;
}

.npfm .npfm-rain-card-vals {
	display: flex;
	flex-direction: column;
	font-size: 0.9375rem;
	line-height: 1.35;
}

/* Falling rain over the tanks (hills) or the Valley card while it's raining. */
.npfm .npfm-tanks {
	position: relative;
}

.npfm .npfm-streaks {
	position: absolute;
	inset: -0.75rem 0 auto;
	height: 3.5rem;
	overflow: hidden;
	pointer-events: none;
}

.npfm .npfm-rain-card .npfm-streaks {
	inset: -0.5rem 0 auto;
	height: 2.5rem;
}

.npfm .npfm-streaks i {
	position: absolute;
	top: 0;
	left: calc(var(--x) * 1%);
	width: 1.5px;
	height: 0.875rem;
	border-radius: 1px;
	background: var(--npfm-streak);
	opacity: 0;
	transform: rotate(18deg);
	animation: npfm-rain 1.1s linear infinite;
	animation-delay: calc(var(--d) * 1s);
}

@keyframes npfm-rain {
	0% { transform: translate(0, -0.75rem) rotate(18deg); opacity: 0; }
	20% { opacity: 0.9; }
	100% { transform: translate(-0.5rem, 2.5rem) rotate(18deg); opacity: 0; }
}

@container npfm (min-width: 1200px) {
	.npfm .npfm-flow[data-fit="h"] .npfm-valley-pill {
		display: block;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-reach > .npfm-rain-card {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	.npfm .npfm-w-flow {
		animation: none;
	}

	.npfm .npfm-streaks {
		display: none;
	}
}

/* Horizontal creek flow for wide containers (SPEC §8.2), used only when the upstream reach fits (data-fit="h"). */
@container npfm (min-width: 1200px) {
	.npfm .npfm-flow[data-fit="h"] .npfm-flow-body {
		--npfm-orient: h;
		display: grid;
		grid-template-columns: 9rem minmax(0, 1fr) minmax(19rem, 22rem) 11rem;
		column-gap: 1.5rem;
		align-items: start;
		max-width: none;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-diagram {
		max-width: none;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-reservoirs {
		grid-column: 1;
		grid-row: 1;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-tanks {
		width: auto;
		flex-direction: column;
		align-items: center;
	}


	.npfm .npfm-flow[data-fit="h"] .npfm-tank {
		width: 100%;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-tank-link {
		padding: 0.5rem 0;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-tank-link-flow {
		position: static;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-upstream {
		--npfm-orient: h;
		grid-column: 2;
		grid-row: 1;
		grid-template-columns: repeat(var(--cols), minmax(0, 1fr));
		grid-template-rows: minmax(5.5rem, auto) 3.5rem auto;
		column-gap: 0.75rem;
		row-gap: 0;
		margin: 6rem 0 0;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-upstream > .npfm-lane {
		grid-column: 1 / -1;
		grid-row: 2;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-outlet {
		display: none;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-reservoirs .npfm-tank:last-of-type .npfm-tank-trend {
		padding-right: 0;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-upstream > .npfm-node-outlet {
		display: block;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-upstream > .npfm-node {
		grid-column: var(--c);
		grid-row: 3;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-upstream > .npfm-node-trib {
		grid-column: var(--c);
		grid-row: 1;
		align-self: end;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-bridge {
		grid-column: 3;
		grid-row: 1;
		width: 100%;
		margin-top: 1.5rem;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-downstream {
		--npfm-orient: v;
		grid-column: 4;
		grid-row: 1;
		grid-template-columns: 2.5rem minmax(0, 1fr);
		margin: 13rem 0 0;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-downstream > .npfm-lane {
		grid-column: 1;
	}

	.npfm .npfm-flow[data-fit="h"] .npfm-downstream > .npfm-node,
	.npfm .npfm-flow[data-fit="h"] .npfm-downstream > .npfm-node-trib,
	.npfm .npfm-flow[data-fit="h"] .npfm-downstream > .npfm-node-main {
		grid-column: 2;
	}
}

.npfm .npfm-nested-name {
	white-space: nowrap;
}
