/**
 * MM0ZIF weather history charts.
 * Scoped to .wx-history so it cannot leak into the rest of the site.
 */

/* The theme caps .page-body at 760px; charts need more room. */
.wx-history-page .page-body {
	max-width: 1080px;
}

.wx-history {
	--wx-line: rgba(255, 255, 255, 0.09);
	--wx-text: #e7f4f1;
	--wx-muted: #9fc4bf;
	--wx-faint: #8fb0ac;
	position: relative;
	margin: 8px 0 28px;
	padding: clamp(18px, 3.2vw, 30px);
	border: 1px solid rgba(255, 255, 255, 0.08);
	border-radius: var(--radius-lg, 24px);
	background:
		radial-gradient(120% 90% at 100% 0%, rgba(45, 212, 191, 0.13), rgba(45, 212, 191, 0) 58%),
		linear-gradient(160deg, #0b2b35 0%, #071b22 100%);
	color: var(--wx-text);
	box-shadow: 0 30px 70px -40px rgba(7, 27, 34, 0.75);
}

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

.wx-history h2 {
	color: #fff;
}

.wx-history a {
	color: #9fe3d8;
	text-decoration-color: rgba(159, 227, 216, 0.4);
	text-underline-offset: 3px;
}

.wx-history a:hover {
	color: #fff;
}

/* Meta line ------------------------------------------------------------- */

.wx-history-meta {
	display: flex;
	align-items: center;
	gap: 9px;
	margin: 0 0 18px;
	font-family: var(--font-mono);
	font-size: 10.5px;
	line-height: 1.5;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wx-muted);
}

.wx-dot {
	flex: none;
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: var(--aurora, #2dd4bf);
	box-shadow: 0 0 0 4px rgba(45, 212, 191, 0.16);
}

.wx-history-stale {
	margin: -8px 0 16px;
	padding: 10px 12px;
	border-left: 2px solid #fbbf24;
	border-radius: 4px;
	background: rgba(251, 191, 36, 0.08);
	font-size: 12.5px;
	color: #fde68a;
}

/* Headline stats -------------------------------------------------------- */

.wx-stats {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 10px;
	margin-bottom: 18px;
}

.wx-stat {
	padding: 12px 14px;
	border: 1px solid var(--wx-line);
	border-radius: 14px;
	background: rgba(255, 255, 255, 0.04);
}

.wx-stat-label {
	display: block;
	font-family: var(--font-mono);
	font-size: 9.5px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #8fc7c0;
}

.wx-stat-value {
	display: block;
	margin-top: 4px;
	font-family: var(--font-display);
	font-size: 22px;
	font-weight: 600;
	line-height: 1.2;
	color: #fff;
	font-variant-numeric: tabular-nums;
}

.wx-stat-sub {
	display: block;
	margin-top: 2px;
	font-size: 11.5px;
	line-height: 1.4;
	color: var(--wx-muted);
}

/* Charts ---------------------------------------------------------------- */

.wx-charts {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 14px;
}

.wx-chart-card {
	min-width: 0;
	margin: 0;
	padding: 16px 16px 12px;
	border: 1px solid var(--wx-line);
	border-radius: 18px;
	background: rgba(255, 255, 255, 0.035);
}

.wx-chart-head {
	margin: 0;
}

.wx-chart-head h2 {
	margin: 0;
	font-size: 18px;
	line-height: 1.3;
}

.wx-chart-head p {
	max-width: 62ch;
	margin: 4px 0 0;
	font-size: 13px;
	line-height: 1.55;
	color: var(--wx-muted);
}

.wx-chart-legend {
	display: flex;
	flex-wrap: wrap;
	gap: 6px 16px;
	margin: 11px 0 2px;
	font-family: var(--font-mono);
	font-size: 9.5px;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: var(--wx-muted);
}

.wx-chart-legend span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.wx-chip {
	display: inline-block;
	width: 16px;
	height: 2px;
	border-radius: 2px;
	background: currentColor;
}

.wx-chip--teal {
	color: #2dd4bf;
}

.wx-chip--amber {
	color: #fbbf24;
}

.wx-chip--sky {
	color: #7dd3fc;
}

.wx-chip--slate {
	color: #cbd5e1;
}

.wx-chip.is-dashed {
	background: repeating-linear-gradient(90deg, currentColor 0 4px, transparent 4px 7px);
}

.wx-chart-wrap {
	position: relative;
	margin-top: 4px;
}

.wx-chart-wrap canvas {
	display: block;
	width: 100%;
	height: auto;
	touch-action: pan-y;
}

.wx-chart-wrap canvas:focus {
	outline: none;
}

.wx-chart-wrap canvas:focus-visible {
	outline: 2px solid #2dd4bf;
	outline-offset: 4px;
	border-radius: 8px;
}

/* Tooltip --------------------------------------------------------------- */

.wx-tip {
	position: absolute;
	z-index: 2;
	min-width: 158px;
	padding: 9px 11px;
	border: 1px solid rgba(255, 255, 255, 0.14);
	border-radius: 10px;
	background: rgba(7, 27, 34, 0.97);
	box-shadow: 0 14px 34px -14px rgba(0, 0, 0, 0.8);
	font-family: var(--font-mono);
	font-size: 11px;
	line-height: 1.5;
	color: var(--wx-text);
	pointer-events: none;
}

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

.wx-tip-time {
	display: block;
	margin-bottom: 5px;
	letter-spacing: 0.04em;
	color: #8fc7c0;
}

.wx-tip-row {
	display: flex;
	align-items: center;
	gap: 7px;
	white-space: nowrap;
}

.wx-tip-row b {
	margin-left: auto;
	padding-left: 10px;
	font-weight: 500;
	color: #fff;
	font-variant-numeric: tabular-nums;
}

.wx-tip-chip {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
}

/* Daily table ----------------------------------------------------------- */

.wx-table-block {
	margin-top: 22px;
}

.wx-table-block h2 {
	margin: 0 0 10px;
	font-size: 18px;
}

.wx-table-scroll {
	overflow-x: auto;
	border: 1px solid var(--wx-line);
	border-radius: 14px;
	-webkit-overflow-scrolling: touch;
}

.wx-table {
	width: 100%;
	min-width: 520px;
	border-collapse: collapse;
	font-size: 12.5px;
}

/*
 * The theme paints post-content table headers with --sand. Inside the dark
 * panel that leaves white text on cream, so clear it explicitly.
 */
.wx-history .wx-table thead,
.wx-history .wx-table th,
.wx-history .wx-table td {
	background: transparent;
}

.wx-history .wx-table td {
	color: var(--wx-text);
}

.wx-history .wx-table th,
.wx-history .wx-table td {
	padding: 9px 10px;
	text-align: right;
	white-space: nowrap;
	border-bottom: 1px solid rgba(255, 255, 255, 0.07);
	font-variant-numeric: tabular-nums;
}

.wx-table thead th {
	vertical-align: bottom;
	font-family: var(--font-mono);
	font-size: 9px;
	font-weight: 500;
	letter-spacing: 0.07em;
	text-transform: uppercase;
	color: #8fc7c0;
}

.wx-table thead th span {
	display: block;
	margin-top: 2px;
	font-size: 8px;
	letter-spacing: 0.04em;
	color: #6f9a95;
}

.wx-history .wx-table th[scope='row'] {
	width: 1%;
	padding-right: 18px;
	text-align: left;
	font-weight: 600;
	color: var(--wx-text);
}

.wx-partial {
	display: block;
	margin-top: 1px;
	font-family: var(--font-mono);
	font-size: 8.5px;
	font-weight: 400;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #6f9a95;
}

.wx-table tbody tr:nth-child(even) {
	background: rgba(255, 255, 255, 0.02);
}

.wx-table tbody tr:last-child th,
.wx-table tbody tr:last-child td {
	border-bottom: 0;
}

.wx-table-scroll:focus-visible {
	outline: 2px solid #2dd4bf;
	outline-offset: 3px;
}

/* Footnote and error state ---------------------------------------------- */

.wx-history-note {
	margin: 16px 0 0;
	font-size: 12px;
	line-height: 1.6;
	color: var(--wx-faint);
}

.wx-history-notice {
	padding: 18px 20px;
	border: 1px solid rgba(255, 255, 255, 0.12);
	border-radius: 16px;
	background: rgba(255, 255, 255, 0.04);
}

.wx-history-notice p {
	margin: 0 0 8px;
}

.wx-history-notice p:last-child {
	margin-bottom: 0;
}

/* Wider screens --------------------------------------------------------- */

@media (min-width: 640px) {
	.wx-stats {
		grid-template-columns: repeat(4, minmax(0, 1fr));
	}
}

@media (min-width: 860px) {
	.wx-chart-card {
		padding: 20px 22px 14px;
	}

	.wx-chart-head h2 {
		font-size: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.wx-history * {
		transition: none !important;
		animation: none !important;
	}
}
