/* ------------------------------------------------------------------
   meteo v2 - white theme, shared by meteoStatusv2.php + meteoChartv2.php
   ------------------------------------------------------------------ */

:root {
	color-scheme: light;

	--bg:          #f4f6f9;
	--card:        #ffffff;
	--line:        #e3e7ee;
	--line-soft:   #eef1f6;
	--ink:         #10151c;
	--ink-2:       #414b59;
	--muted:       #7b869a;
	--accent:      #2563eb;

	--wind:        #2563eb;
	--gust:        #f59e0b;
	--dir:         #0891b2;
	--temp:        #dc2626;
	--pressure:    #7c3aed;
	--battery:     #059669;
	--solar:       #d97706;

	/* wind severity: green under 3 m/s, orange under 5, red at 5 and above */
	--lvl-ok:      #15803d;
	--lvl-warn:    #c2410c;
	--lvl-high:    #b91c1c;

	--radius:      14px;
	--shadow:      0 1px 2px rgba(16, 24, 40, .05), 0 6px 20px rgba(16, 24, 40, .05);
	--shadow-hi:   0 2px 6px rgba(16, 24, 40, .07), 0 14px 34px rgba(16, 24, 40, .10);
}

* { box-sizing: border-box; }

html, body {
	margin: 0;
	padding: 0;
}

body {
	background: var(--bg);
	color: var(--ink);
	font: 14px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	-webkit-font-smoothing: antialiased;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.lvl-ok   { color: var(--lvl-ok); }
.lvl-warn { color: var(--lvl-warn); }
.lvl-high { color: var(--lvl-high); }

.wrap {
	max-width: 1680px;
	margin: 0 auto;
	padding: 0 20px 48px;
}

/* embedded in a narrow iframe: every pixel of padding costs a column */
@media (max-width: 820px) {
	.wrap { padding: 0 10px 20px; }
	.topbar-in { padding: 9px 10px; gap: 10px; }
	.topbar { margin-bottom: 12px; }
}

/* ---------------------------------------------------------------- header */

.topbar {
	position: sticky;
	top: 0;
	z-index: 20;
	background: rgba(255, 255, 255, .88);
	backdrop-filter: saturate(180%) blur(10px);
	border-bottom: 1px solid var(--line);
	margin-bottom: 20px;
}

.topbar-in {
	max-width: 1680px;
	margin: 0 auto;
	padding: 12px 20px;
	display: flex;
	align-items: center;
	gap: 16px;
	flex-wrap: wrap;
}

.brand {
	display: flex;
	align-items: baseline;
	gap: 10px;
	margin-right: auto;
	min-width: 0;
}

.brand h1 {
	font-size: 17px;
	font-weight: 650;
	letter-spacing: -.01em;
	margin: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.brand .sub {
	font-size: 12px;
	color: var(--muted);
	white-space: nowrap;
}

.field {
	display: flex;
	align-items: center;
	gap: 7px;
	font-size: 12px;
	color: var(--muted);
}

select.ctl {
	appearance: none;
	background: #fff url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='none' stroke='%237b869a' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M2.5 4.5 6 8l3.5-3.5'/%3E%3C/svg%3E") no-repeat right 9px center;
	border: 1px solid var(--line);
	border-radius: 9px;
	color: var(--ink);
	font: inherit;
	font-size: 13px;
	padding: 7px 30px 7px 11px;
	max-width: 280px;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
}

select.ctl:hover { border-color: #cdd4e0; }

select.ctl:focus-visible {
	outline: none;
	border-color: var(--accent);
	box-shadow: 0 0 0 3px rgba(37, 99, 235, .16);
}

.backlink {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	font-size: 13px;
	color: var(--ink-2);
	padding: 6px 10px;
	border-radius: 9px;
	border: 1px solid var(--line);
	background: #fff;
}
.backlink:hover { text-decoration: none; border-color: #cdd4e0; color: var(--ink); }

.dot {
	width: 7px;
	height: 7px;
	border-radius: 50%;
	background: #22c55e;
	flex: 0 0 auto;
}
.dot.stale { background: #f59e0b; }
.dot.off   { background: #cbd5e1; }

/* ------------------------------------------------------------ status grid */

/* The page is embedded in a ~730px iframe on elspeedo.cz (626px at a 1024
   viewport), so the track minimum is what decides "three in a row" there -
   not the desktop width. min() keeps it from overflowing a phone. */
.tiles {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(min(186px, 100%), 1fr));
	gap: 12px;
}

.tile {
	position: relative;
	display: flex;
	flex-direction: column;
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	transition: box-shadow .18s, transform .18s, border-color .18s;
}

.tile:hover {
	box-shadow: var(--shadow-hi);
	border-color: #d3dae6;
	transform: translateY(-1px);
}

.tile.inactive { opacity: .5; }

.tile-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px 2px;
}

.tile-head .name {
	font-weight: 620;
	font-size: 12.5px;
	letter-spacing: -.01em;
	color: var(--ink);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	flex: 1 1 auto;
	min-width: 0;
}

.tile-head .when {
	font-size: 10px;
	color: var(--muted);
	white-space: nowrap;
	font-variant-numeric: tabular-nums;
}

.tile-body { padding: 0 8px 4px; }

/* the rose itself - the chart mounts here, needs an explicit size. Keep it
   square: in a wider-than-tall box the chart centres the disc but throws the
   compass labels out to the far edges. */
.rose {
	position: relative;
	width: 124px;
	height: 124px;
	max-width: 100%;
	margin: 0 auto;
}

.rose-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--muted);
	font-size: 12px;
}

.readout {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 1px;
	background: var(--line-soft);
	border-top: 1px solid var(--line-soft);
	margin-top: 4px;
}

.readout .row {
	background: #fff;
	padding: 5px 10px;
	min-width: 0;
}

/* label over value: at ~190px a cell cannot fit both on one line */
.readout .k {
	display: block;
	font-size: 9px;
	line-height: 1.3;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--muted);
}

.readout .v {
	display: block;
	font-size: 13.5px;
	line-height: 1.35;
	font-weight: 600;
	color: var(--ink);
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* the unit is a separate span, so it needs its own breathing room */
.readout .v .u {
	font-size: 10px;
	font-weight: 500;
	color: var(--muted);
	margin-left: 3px;
}

.readout .v .gust { margin-left: 5px; }

.tile-foot {
	display: flex;
	align-items: center;
	gap: 4px;
	padding: 4px 8px;
	border-top: 1px solid var(--line-soft);
}

.tile-foot .copy {
	margin-right: auto;
	font-size: 10px;
	color: var(--muted);
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.iconbtn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 8px;
	border: 1px solid var(--line);
	background: #fff;
	color: var(--ink-2);
	cursor: pointer;
	padding: 0;
	transition: background .15s, border-color .15s, color .15s;
}
.iconbtn:hover { background: #f6f8fb; border-color: #cdd4e0; color: var(--ink); text-decoration: none; }
.iconbtn[aria-disabled="true"] { opacity: .32; pointer-events: none; }
.iconbtn svg { width: 14px; height: 14px; display: block; }

/* the whole tile is a link target; keep the footer buttons clickable above it */
.tile-link {
	position: absolute;
	inset: 0;
	z-index: 1;
}
.tile-foot, .tile-head .when { position: relative; z-index: 2; }

/* -------------------------------------------------------------- chart page */

.summary {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	overflow: hidden;
	box-shadow: var(--shadow);
	margin-bottom: 18px;
}

/* dividers as shadows, not grid gaps: a half-empty last row then stays white
   instead of showing a block of gap colour */
.summary .cell {
	padding: 12px 14px;
	box-shadow: -1px 0 0 var(--line);
}

.summary .k {
	font-size: 10px;
	letter-spacing: .05em;
	text-transform: uppercase;
	color: var(--muted);
	margin-bottom: 2px;
}

.summary .v {
	font-size: 19px;
	font-weight: 620;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.summary .v .u {
	font-size: 12px;
	font-weight: 500;
	color: var(--muted);
	margin-left: 3px;
}

.charts {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(420px, 1fr));
	gap: 16px;
}

@media (max-width: 560px) {
	.charts { grid-template-columns: 1fr; }
}

.card {
	background: var(--card);
	border: 1px solid var(--line);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 14px 14px 10px;
	min-width: 0;
}

.card.wide { grid-column: 1 / -1; }

.card-head {
	display: flex;
	align-items: baseline;
	gap: 10px;
	flex-wrap: wrap;
	margin-bottom: 4px;
}

.card-head h2 {
	font-size: 13px;
	font-weight: 640;
	letter-spacing: -.01em;
	margin: 0;
	color: var(--ink);
}

.card-head .unit {
	font-size: 11px;
	color: var(--muted);
	margin-right: auto;
}

.legend {
	display: flex;
	align-items: center;
	gap: 12px;
	flex-wrap: wrap;
	font-size: 11px;
	color: var(--ink-2);
}

.legend i {
	display: inline-block;
	width: 9px;
	height: 9px;
	border-radius: 50%;
	margin-right: 5px;
	vertical-align: -1px;
}

/* every chart host needs an explicit height */
.plot { position: relative; height: 320px; }
.plot.tall { height: 380px; }

.msg {
	display: flex;
	align-items: center;
	justify-content: center;
	height: 100%;
	color: var(--muted);
	font-size: 12px;
	text-align: center;
	padding: 0 16px;
}

.banner {
	background: #fff7ed;
	border: 1px solid #fed7aa;
	color: #9a3412;
	border-radius: 10px;
	padding: 10px 14px;
	font-size: 13px;
	margin-bottom: 16px;
}

.foot {
	margin-top: 28px;
	font-size: 11px;
	color: var(--muted);
	text-align: center;
}

.skeleton {
	background: linear-gradient(90deg, #f1f4f8 25%, #e8ecf3 37%, #f1f4f8 63%);
	background-size: 400% 100%;
	animation: shimmer 1.3s ease-in-out infinite;
	border-radius: 8px;
}

@keyframes shimmer {
	0%   { background-position: 100% 50%; }
	100% { background-position: 0 50%; }
}

@media (prefers-reduced-motion: reduce) {
	.skeleton { animation: none; }
	.tile { transition: none; }
}
