/* Theme of the livemap: colours, radius, shadow and font as CSS variables, light (default) and dark ([data-theme="dark"] on <html>, set by
   the inline script in the <head> of index.php and js/theme.js). Loaded after foundation.css, livemap.css and leaflet.css, so that it
   overrides them step by step (controls, dropdowns, side menu, station card). Look after the better_forecast viewer: translucent rounded
   panels and pills, system font, soft shadows, blue accent. */
:root {
	--font: Inter, system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	--bg: #eef0f3;
	--surface: #ffffff;
	--surface-2: #f1f3f6;
	--surface-hover: #e6e9ee;
	--text: #1c2128;
	--muted: #66707d;
	--border: #d5d9e0;
	--accent: #1769e0;
	--accent-soft: #e3eefc;
	--accent-contrast: #ffffff;
	--warn: #ffb400;
	--warn-text: #3a2a00;
	--danger: #c62828;
	--radius: 10px;
	--radius-sm: 6px;
	--shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	--shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.25);
	--glass: rgba(255, 255, 255, 0.88);
	--icon-invert: 0;
	--hot: #e53935;
	--cold: #1e88e5;
	--ok: #1f9d55;
	--geo-line: #000000;   /* coastlines, borders, regions on the map (js/geo.js) */
	color-scheme: light;
}
[data-theme="dark"] {
	--geo-line: #ffffff;
	--bg: #14171c;
	--surface: #1e2228;
	--surface-2: #2a2f37;
	--surface-hover: #343a44;
	--text: #e8eaed;
	--muted: #9aa3ae;
	--border: #3a414c;
	--accent: #8ab4f8;
	--accent-soft: #28364d;
	--accent-contrast: #0b1626;
	--warn: #ffb400;
	--warn-text: #2a1d00;
	--danger: #ff8a80;
	--shadow: 0 2px 12px rgba(0, 0, 0, 0.6);
	--shadow-sm: 0 1px 4px rgba(0, 0, 0, 0.6);
	--glass: rgba(30, 34, 40, 0.88);
	--icon-invert: 1;
	--hot: #ff6b6b;
	--cold: #5ab0ff;
	--ok: #3ecf8e;
	color-scheme: dark;
}

body {
	font-family: var(--font);
	background: var(--bg);
	color: var(--text);
}
/* no white flash while tiles load, in dark mode */
.leaflet-container {
	background: var(--bg);
	font-family: var(--font);
}

/* ---------- Step 2: map controls, dropdowns, buttons, pills ---------- */

/* the control column: one rounded card, icon buttons separated by hairlines. `on` = a switch that is active; the funnel turns amber
   while a value filter is on (js/filter.js) */
.leaflet-bar {
	border: 0;
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	background: var(--surface);
	overflow: hidden;
}
.leaflet-bar a,
.leaflet-bar a.has-tip,
.leaflet-touch .leaflet-bar a {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	line-height: 38px;
	padding: 0;
	margin: 0;
	background-color: var(--surface);
	color: var(--text);
	border: 0;
	border-bottom: 1px solid var(--border);
	border-radius: 0;
	font: 400 22px/1 var(--font);
	cursor: pointer;
	transition: background-color 0.12s, color 0.12s;
}
.leaflet-bar a:last-child,
.leaflet-touch .leaflet-bar a:last-child { border-bottom: 0; }
.leaflet-bar a:hover,
.leaflet-bar a.has-tip:hover { background-color: var(--surface-hover); color: var(--text); }
.leaflet-bar a.on,
.leaflet-bar a.on:hover { background-color: var(--accent-soft); color: var(--accent); }
.leaflet-bar a.ctl-filter.filter-on,
.leaflet-bar a.ctl-filter.filter-on:hover { background-color: var(--warn); color: var(--warn-text); }
.leaflet-bar a.preloader,
.leaflet-bar a.preloader:hover { height: 38px; padding: 0; cursor: default; background-color: var(--surface); }
.leaflet-bar a.preloader .mnw-spinner { width: 18px; height: 18px; border-width: 2px; }
.ctl-ico {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
}
#theme-toggle svg { width: 18px; height: 18px; }

/* attribution: a small glass tag */
.leaflet-container .leaflet-control-attribution {
	background: var(--glass);
	color: var(--muted);
	font: 10px/1.5 var(--font);
	padding: 1px 8px;
	border-radius: var(--radius-sm) 0 0 0;
}
.leaflet-container .leaflet-control-attribution a { color: var(--accent); }

/* Foundation buttons: filled accent, rounded */
.button,
.button.tiny,
.button.small {
	background-color: var(--accent);
	border-color: var(--accent);
	color: var(--accent-contrast);
	border-radius: var(--radius-sm);
	font-family: var(--font);
	font-weight: 600;
	transition: filter 0.12s;
}
.button:hover,
.button:focus { background-color: var(--accent); filter: brightness(1.1); color: var(--accent-contrast); }

/* dropdown cards (search, filter): no arrow, rounded, themed */
.f-dropdown,
.f-dropdown.drop-right {   /* .drop-right: Foundation sets a white background there, which beat the theme in dark mode */
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	overflow: hidden;
	font-family: var(--font);
}
.f-dropdown:before,
.f-dropdown:after { display: none; }
/* value filter (js/filter.js): a small card, two fields side by side */
#filter-settings.f-dropdown { width: 236px; max-width: calc(100vw - 64px); padding: 12px 12px 10px; }
#filter-settings form { margin: 0; }
#filter-settings .flt-title { font-size: 0.85rem; font-weight: 600; margin: 0 0 8px; }
#filter-settings .flt-fields { display: flex; align-items: flex-end; gap: 6px; }
#filter-settings label { flex: 1; min-width: 0; margin: 0; color: var(--muted); font-size: 0.7rem; font-weight: 600; letter-spacing: 0.02em; }
#filter-settings .flt-dash { color: var(--muted); padding-bottom: 7px; }
#filter-settings input[type="text"] { width: 100%; height: 2rem; margin: 3px 0 0; padding: 0 8px; font-size: 0.9rem; }
#filter-settings small { display: block; margin: 8px 0 0; padding: 0; font-size: 0.72rem; font-style: normal; line-height: 1.3; }
#filter-settings small.error { margin-top: 6px; }
#filter-settings .flt-reset { display: inline-block; margin-top: 8px; font-size: 0.8rem; font-weight: 600; color: var(--accent); }
#filter-settings .flt-reset:hover { text-decoration: underline; }
.f-dropdown small { color: var(--muted); }
.f-dropdown small.error { background: transparent; color: var(--danger); }
.f-dropdown input[type="text"],
.f-dropdown input[type="search"] {
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: none;
	font-family: var(--font);
	height: 2.4rem;
}
.f-dropdown input[type="text"]:focus {
	background: var(--surface);
	border-color: var(--accent);
	box-shadow: 0 0 0 2px var(--accent-soft);
}
.f-dropdown input::placeholder { color: var(--muted); }
.f-dropdown .prefix {
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid var(--border);
	font-size: 0.8rem;
}
#locateform .row.collapse { margin: 0; }
#locateform input#find { border-radius: 0; border-width: 0 0 1px 0; background: var(--surface); }
#locateform .button.postfix { border-radius: 0; margin: 0; }
#find-clear { color: var(--muted); }
#find-clear:hover { color: var(--text); }
#find-results { background: var(--surface); border-top: 0; }
#find-results li { border-bottom: 1px solid var(--border); }
#find-results .find-active { background: var(--accent-soft); }
#find-results .find-title { color: var(--text); }
#find-results .find-detail,
#find-results .find-msg { color: var(--muted); }
.leaflet-tooltip.find-tip {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: var(--shadow-sm);
	font-family: var(--font);
}
.leaflet-tooltip-top.find-tip:before { border-top-color: var(--surface); }

/* top-right pills: station count and the active value filter */
.legenda,
.legenda2 {
	right: 10px;
	font: 600 12px/1.4 var(--font);
	border-radius: 999px;
	box-shadow: var(--shadow-sm);
}
.legenda {
	top: calc(var(--top-h) + 10px);
	padding: 2px 12px;
	background: var(--glass);
	color: var(--text);
	-webkit-backdrop-filter: blur(6px);
	backdrop-filter: blur(6px);
}
.legenda2 { top: calc(var(--top-h) + 40px); }
.legenda2.filter-pill {
	background: var(--warn);
	color: var(--warn-text);
	padding: 2px 6px 2px 12px;
	border-radius: 999px;
}
.legenda2 .fp-x { color: var(--warn-text); }
.legenda2 .fp-x:hover { color: var(--danger); }

/* Foundation tooltips (data-tooltip) */
.tooltip {
	background: var(--text);
	color: var(--bg);
	border-radius: var(--radius-sm);
	font: 500 12px/1.3 var(--font);
	box-shadow: var(--shadow-sm);
}
.tooltip > .nub { border-color: transparent transparent var(--text) transparent; }

/* jQuery UI datepicker ("Estremi del ...") */
.ui-datepicker {
	background: var(--surface);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	box-shadow: var(--shadow);
	padding: 8px;
	font-family: var(--font);
}
.ui-datepicker .ui-datepicker-header { background: transparent; border: 0; color: var(--text); }
.ui-datepicker .ui-datepicker-title { font-weight: 600; }
.ui-datepicker .ui-icon { filter: invert(var(--icon-invert)); }
.ui-datepicker th { color: var(--muted); font-weight: 500; }
.ui-datepicker td a,
.ui-datepicker td span {
	background: transparent;
	border: 0;
	border-radius: var(--radius-sm);
	color: var(--text);
	text-align: center;
	padding: 0.3em;
}
.ui-datepicker td a:hover { background: var(--surface-hover); }
.ui-datepicker td a.ui-state-highlight { background: var(--surface-2); font-weight: 700; }
.ui-datepicker td a.ui-state-active { background: var(--accent); color: var(--accent-contrast); }
.ui-datepicker .ui-state-disabled { opacity: 0.35; }

/* ---------- Step 3: top bar and side menu ---------- */

/* top bar (index.php, header.mnw-top): the meteonetwork.eu wordmark (Space Grotesk, light italic, yellow square) and the site links, on the
   theme surface. --top-h is its height: the map, the side menu and the pills are placed under it (0 when embedded, ?m=1: js/map.js) */
:root {
	--top-h: 40px;
	--brand: #2a2549;
	--brand-sq: #fed97c;
	--brand-font: "Space Grotesk", var(--font);
	--top-bg: #d3d5e0;        /* the nav bar of meteonetwork.eu */
	--top-hover: rgba(42, 37, 73, 0.08);
	--top-on: rgba(42, 37, 73, 0.12);
	--chev: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
}
[data-theme="dark"] { --brand: #eceaf6; --top-bg: #24222f; --top-hover: rgba(255, 255, 255, 0.07); --top-on: rgba(255, 255, 255, 0.11); }
.mnw-top {
	position: fixed;
	top: 0;
	left: 0;
	right: 0;
	z-index: 1150;
	height: var(--top-h);
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 0 12px 0 16px;
	background: var(--top-bg);
	box-shadow: 0 1px 0 rgba(0, 0, 0, 0.06);
	font-family: var(--brand-font);
}
.mnw-wordmark,
.mnw-brand {
	font-family: var(--brand-font);
	font-style: italic;
	font-weight: 300;
	letter-spacing: 0.5px;
	color: var(--brand);
	white-space: nowrap;
	line-height: 1;
}
.mnw-brand { font-size: 22px; flex: none; }
.mnw-brand:hover,
.mnw-brand:focus { color: var(--brand); }
.mnw-wordmark .sq,
.mnw-brand .sq { color: var(--brand-sq); }
.mnw-links { display: flex; align-items: center; gap: 2px; margin-left: auto; min-width: 0; }
.mnw-links a {
	padding: 6px 10px;
	border-radius: var(--radius-sm);
	color: var(--brand);
	font-size: 15px;
	font-weight: 400;
	letter-spacing: 0.5px;
	white-space: nowrap;
	transition: background-color 0.12s, color 0.12s;
}
.mnw-links a:hover { background: var(--top-hover); color: var(--brand); }
.mnw-links a.on { background: var(--top-on); font-weight: 500; }
/* like the "Diventa Socio" button of the home (Bootstrap btn-warning) */
.mnw-links a.cta { margin-left: 8px; padding: 5px 12px; border-radius: 4px; background: #ffc107; color: #000; font-size: 14px; }
.mnw-links a.cta:hover { background: #ffca2c; color: #000; }
.mnw-more {
	display: none;
	margin: 0 0 0 auto;
	padding: 0;
	width: 34px;
	height: 34px;
	align-items: center;
	justify-content: center;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	color: var(--text);
	fill: currentColor;
}
.mnw-more { color: var(--brand); }
.mnw-more:hover,
.mnw-more:focus,
.mnw-more[aria-expanded="true"] { background: var(--top-hover); color: var(--brand); }
/* narrow screens: the links fold into a list under the ⋯ button */
@media (max-width: 980px) {
	.mnw-more { display: flex; }
	.mnw-links {
		display: none;
		position: fixed;
		top: calc(var(--top-h) + 4px);
		right: 8px;
		flex-direction: column;
		align-items: stretch;
		gap: 0;
		min-width: 190px;
		padding: 6px;
		background: var(--top-bg);
		border: 1px solid var(--border);
		border-radius: var(--radius);
		box-shadow: var(--shadow);
	}
	.mnw-links.open { display: flex; }
	.mnw-links a { padding: 9px 12px; }
	.mnw-links a.cta { margin: 6px 0 0; text-align: center; }
}
.mnw-embed-logo { position: absolute; z-index: 2; bottom: 18px; right: 10px; font-size: 16px; padding: 3px 8px; border-radius: var(--radius-sm); background: var(--glass); }
#map,
.off-canvas-menu { top: var(--top-h); }

/* side menu: a themed list. Each row is the whole <a> (icon + label), so the hit area, hover and current state cover the row; sections are
   small uppercase headings with a chevron. The width is --menu-w (also in map.min.js, toggleCanvas(), as "252px"). */
:root { --menu-w: 252px; }
.off-canvas-menu {
	width: var(--menu-w);
	background: var(--surface);
	color: var(--text);
	font-family: var(--font);
	border-right: 1px solid var(--border);
	box-shadow: 2px 0 10px rgba(0, 0, 0, 0.10);
	scrollbar-width: thin;
	scrollbar-color: var(--border) transparent;
}
#map { margin-left: var(--menu-w); }
.calendar { left: var(--menu-w); }
.off-canvas-menu ul {
	margin: 0;
	padding: 2px 10px 6px;
}
.off-canvas-menu ul li { margin: 0; }
.off-canvas-menu li.clearfix {
	display: block;
	margin: 0;
	padding: 2px 0;
}
/* dividers: a faint hairline between the rows of a section (inset by the list padding), a thicker faint line between sections */
:root { --divider: var(--border); }
@supports (color: color-mix(in srgb, red, blue)) {
	:root { --divider: color-mix(in srgb, var(--border) 60%, transparent); }
}
.off-canvas-menu ul > li.clearfix:nth-child(n+3) { border-top: 1px solid var(--divider); }
.off-canvas-menu ul.global-menu ~ li > ul:first-child,
.off-canvas-menu li > ul ~ ul { border-top: 2px solid var(--divider); }
.off-canvas-menu ul li > a,
.off-canvas-menu .estremi {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 6px 10px;
	border: 0;
	border-radius: var(--radius-sm);
	background: transparent;
	box-shadow: none;
	color: var(--text);
	font: 500 13.5px/1.25 var(--font);
	transition: background-color 0.12s, color 0.12s;
}
.off-canvas-menu ul li > a:hover { background: var(--surface-hover); color: var(--text); }
.off-canvas-menu i.left {
	float: none;
	flex: none;
	display: flex;
	margin: 0;
	color: var(--muted);
	transition: color 0.12s;
}
.off-canvas-menu a:hover > i.left { color: var(--text); }
svg.mi {
	width: 20px;
	height: 20px;
	fill: none;
	stroke: currentColor;
	stroke-width: 1.8;
	stroke-linecap: round;
	stroke-linejoin: round;
}
.off-canvas-menu .lbl {
	flex: 1;
	min-width: 0;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.off-canvas-menu ul li > a.var-active,
.off-canvas-menu ul li > a.global-active {
	background: var(--accent-soft) !important;
	color: var(--accent) !important;
	font-weight: 600;
}
.off-canvas-menu a.var-active > i.left,
.off-canvas-menu a.global-active > i.left { color: var(--accent); }
.off-canvas-menu li label,
.off-canvas-menu ul.off-canvas-list li label {
	display: flex;
	align-items: center;
	justify-content: space-between;
	height: auto !important;
	margin: 0;
	padding: 10px 10px 3px;
	background: transparent !important;
	color: var(--muted);
	font: 600 11px/1.4 var(--font);
	letter-spacing: 0.08em;
	text-transform: uppercase;
	cursor: pointer;
}
.off-canvas-menu li label::after {
	content: "";
	width: 14px;
	height: 14px;
	background: currentColor;
	-webkit-mask: var(--chev) center / contain no-repeat;
	mask: var(--chev) center / contain no-repeat;
	transition: transform 0.15s;
}
.off-canvas-menu li label.menuclose::after { transform: rotate(180deg); }   /* open section: chevron up */
.off-canvas-menu .estremi {
	background: var(--accent);
	color: var(--accent-contrast);
	font-weight: 600;
	cursor: pointer;
}
.off-canvas-menu .estremi:hover { filter: brightness(1.1); }
.off-canvas-menu .estremi i.left { color: inherit; }

/* ---------- Step 4: station card (popup.php, popwness.php: Foundation reveal modal) ---------- */
.reveal-modal-bg {
	background: rgba(8, 10, 14, 0.5);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}
.reveal-modal {
	background: var(--surface);
	color: var(--text);
	font-family: var(--font);
	border: 1px solid var(--border);
	border-radius: 16px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.35);
}
#popup { padding-bottom: 14px; }
.reveal-modal .close-reveal-modal {
	top: 12px;
	right: 14px;
	width: 32px;
	height: 32px;
	line-height: 30px;
	text-align: center;
	border-radius: 50%;
	color: var(--muted);
	font: 400 24px/30px var(--font);
}
.reveal-modal .close-reveal-modal:hover { background: var(--surface-hover); color: var(--text); }
.reveal-modal h3,
.reveal-modal h4,
.reveal-modal h5,
.reveal-modal h6 { color: var(--text); font-family: var(--font); }
.top_modal h3 { margin-top: 18px; font-size: 1.5rem; font-weight: 700; letter-spacing: -0.01em; }
.top_modal hr,
#popup hr { border: 0; border-top: 1px solid var(--divider); margin: 8px 0; }
.comunedescr { color: var(--muted); font-size: 0.85rem; padding-left: 0; }
.comunedescr strong { color: var(--text); }
.reveal-modal a { color: var(--accent); }
.menupopup { font-size: 0; }
.menupopup a { display: inline-block; margin-left: 6px; cursor: pointer; }
.menupopup img { width: 28px; height: 28px; border-radius: 8px; }
.reveal-modal .label.success { background: var(--ok); color: #fff; border-radius: 999px; font-size: 0.65rem; padding: 0.25rem 0.6rem; }

/* tabs: pills instead of folder tabs */
.tabrow {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 6px;
	height: auto;
	overflow: visible;
	margin: 12px 0 6px;
	line-height: 1;
	font-family: var(--font);
}
.tabrow:before,
.tabrow li:before,
.tabrow li:after { display: none; }
.tabrow li {
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: var(--surface-2);
	box-shadow: none;
	text-shadow: none;
	color: var(--text);
	transition: background-color 0.12s;
}
.tabrow li:hover { background: var(--surface-hover); }
.tabrow li a { display: block; padding: 7px 13px; color: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.tabrow li.selected { background: var(--accent); color: var(--accent-contrast); z-index: auto; }

/* home slide: big reading, extremes in the hot/cold colours, the other values as divided rows */
.live_temp { font-size: 3.8rem; font-weight: 600; line-height: 1.1; letter-spacing: -0.03em; font-feature-settings: "tnum"; }
.live_temp small { font-size: 0.4em; color: var(--muted); font-weight: 500; }
.red { color: var(--hot); }
.blue { color: var(--cold); }
.lefthome { margin-top: 12px; }
.top_modal .columns { padding-left: 0; }
.top_modal .row { margin-left: 0; margin-right: 0; }
.tabella .row {
	display: flex;
	align-items: center;
	gap: 8px;
	max-width: none;
	margin: 0;
	padding: 5px 0;
	border-bottom: 1px solid var(--divider);
}
.tabella .row:last-child { border-bottom: 0; }
.tabella .columns {
	float: none;
	width: auto;
	padding: 0;
}
.tabella .row > .columns:first-child { flex: 0 0 42%; padding-right: 6px; }
.tabella .row > .columns:nth-child(2) { flex: 1; }
.tabella h5 { margin: 0; line-height: 1.2; }
.tabella h5 small { color: var(--muted); font-size: 0.8rem; }
.tabella .row > .columns:nth-child(2) h5 small { color: var(--text); font-weight: 600; font-size: 0.85rem; }
.tabella .row .row { display: block; border-bottom: 0; padding: 0; margin: 0; }
.tabella .row .row:after { content: ""; display: table; clear: both; }
/* "Rateo" stars: five SVG stars used as a mask (the old GIFs had a white fringe, ugly on dark); grey track, amber fill as wide as the % */
:root { --star: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath d='M12 2.5l2.9 6.1 6.6.8-4.9 4.6 1.3 6.6L12 17.3l-5.9 3.3 1.3-6.6-4.9-4.6 6.6-.8z'/%3E%3C/svg%3E"); --star-off: #c9ced6; --star-on: #f5a623; }
[data-theme="dark"] { --star-off: #4a525e; --star-on: #ffbf47; }
.tabella .rating_bar,
.rating_bar {
	width: 65px;
	height: 13px;
	margin-bottom: 2px;
	background: var(--star-off);
	-webkit-mask: var(--star) 0 0 / 13px 13px repeat-x;
	mask: var(--star) 0 0 / 13px 13px repeat-x;
}
.rating_bar div { height: 13px; background: var(--star-on); }
.titlerating h5 small { color: var(--text) !important; }
[data-theme="dark"] #popup a[target="_blank"] img[src^="logo/"] { background: #fff; border-radius: 8px; padding: 4px 8px; box-sizing: content-box; }
.bottom-line { color: var(--muted); }

/* ---------- Step 4c: station markers are drawn on a canvas now (js/markers.js): no CSS here ---------- */

/* ---------- Step 4d: compact station card (less height, fits phones) ---------- */
#popup,
#segnala { max-width: 100%; }
#popup { padding: 0 16px 10px; }
.top_modal h3 { margin: 12px 44px 2px 0; font-size: 1.3rem; }
.top_modal hr,
#popup hr { display: none; }
.comunedescr { display: block; font-size: 0.8rem; line-height: 1.3; }
/* the close button (it is inside this span in the loaded card) at the top right */
.menupopup { position: absolute; top: 12px; right: 10px; display: flex; align-items: center; gap: 4px; z-index: 2; }
.menupopup a { margin-left: 0; }
.menupopup .close-reveal-modal { position: static; flex: none; }
.menupopup img { width: 24px; height: 24px; }
/* tabs: one row (scrolls sideways on narrow screens) */
.tabrow {
	flex-wrap: nowrap;
	overflow-x: auto;
	justify-content: space-between;
	gap: 3px;
	margin: 8px 0 2px;
	padding-bottom: 2px;
	scrollbar-width: none;
}
.tabrow::-webkit-scrollbar { display: none; }
.tabrow li { flex: none; }
.tabrow li a { padding: 5px 7px; font-size: 11.5px; }
/* home: the big reading on top, the other values in two columns below, a small logo */
.homepop { display: block; margin: 0; }
.homepop > .columns { float: none; width: 100%; padding: 0; }
.lefthome { margin-top: 4px; }
.lefthome .row:first-child { display: flex; align-items: center; gap: 14px; margin: 0; max-width: none; }
.lefthome .row:first-child > .columns { float: none; width: auto; padding: 0; }
.lefthome .row:first-child .text-right { margin-left: auto; text-align: right; line-height: 1.25; font-weight: 600; font-size: 1.05rem; }
.lefthome .row:first-child .text-right > div:nth-child(2) { display: none; }
.live_temp { font-size: 3rem; }
.big_arrow { font-size: 2.6em; padding-top: 0; line-height: 1; }
.medium_arrow { font-size: 2em; padding-top: 0; line-height: 1; }
.lefthome .row:nth-child(2) > .columns { margin-top: 2px !important; }
.top_modal > .columns:first-child { float: none; width: 100%; }
.top_modal > .columns:nth-child(2) { position: static; float: none; width: 0; height: 0; padding: 0; }   /* holds only .menupopup, anchored to the card */
/* the small MNW logo shares the line of the "Dati ore ... ONLINE" text, on the right */
.poplogo { margin: -22px 0 0; text-align: right !important; pointer-events: none; }
.poplogo .mnw-wordmark { font-size: 15px; }
.tabella.columns {
	display: grid;
	grid-template-columns: 1fr 1fr;
	column-gap: 24px;
	margin-top: 6px;
}
.tabella .row { padding: 4px 0; }
@media (max-width: 440px) {
	#popup { padding: 0 12px 8px; }
	.tabella.columns { grid-template-columns: 1fr; }
	.live_temp { font-size: 2.6rem; }
}
.tabella > .row:last-child { grid-column: 1 / -1; }
.tabella > .row:last-child > .columns:first-child { flex: 0 0 calc((100% - 24px) / 2 * 0.42); }   /* label as wide as in the rows above */
.tabella > .row:last-child .row { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 6px; }
.tabella > .row:last-child .row:after { display: none; }
.tabella > .row:last-child .rating_bar { clear: none; float: none; flex: none; }
.tabella > .row:last-child .titlerating { float: none; margin-left: 0; }
.tabella > .row:last-child .titlerating + .rating_bar { margin-left: 16px; }
.tabella > .row:last-child .titlerating h5 { line-height: 1.2; }
.tabella .rating_bar + .titlerating h5 small { font-size: 0.8rem; }

/* ---------- Step 5: phones ---------- */
@media (max-width: 650px) {
	/* the menu covers the map instead of pushing it aside (js/mobile.js closes it again); the inline margin set by toggleCanvas() is overridden */
	#map { margin-left: 0 !important; }
	.off-canvas-menu { width: min(var(--menu-w), 86vw); z-index: 1100; box-shadow: 4px 0 18px rgba(0, 0, 0, 0.3); }
	/* station count: right of the control column, on two lines; the filter pill under it */
	.legenda {
		left: 56px;
		right: 8px;
		top: calc(var(--top-h) + 8px);
		padding: 3px 10px;
		border-radius: 14px;
		text-align: center;
		font-size: 11px;
		line-height: 1.25;
	}
	/* menu open: the control column moves to its right, so the burger (to close it) and the other buttons stay usable */
	.leaflet-top.leaflet-left { transition: transform 0.15s ease; }
	body.menu-open .leaflet-top.leaflet-left { transform: translateX(min(var(--menu-w), 86vw)); }
	body.menu-open .legenda,
	body.menu-open .legenda2 { display: none; }
	.legenda .sep { display: none; }
	.legenda .upd { display: block; font-size: 10px; font-weight: 500; color: var(--muted); }
	.legenda2 { top: calc(var(--top-h) + 50px); right: 8px; }
	/* place search: a small card at the top, beside the control column (Foundation put it as wide as the screen at the height of the button,
	   so the keyboard covered the results); the list is capped so that it stays above the keyboard */
	/* only while it is open (Foundation adds .open): its closed state is left: -9999px and must stay */
	#locateform.open { position: fixed !important; top: calc(var(--top-h) + 14px) !important; left: 56px !important; width: min(280px, calc(100vw - 64px)) !important; max-width: none !important; }
	#locateform input#find { font-size: 16px; height: 2.4rem; }   /* 16px: iOS zooms the page in on smaller inputs */
	#find-results { max-height: min(15rem, 34vh); }
	/* calendar of "Estremi": within the screen, above the menu */
	.calendar { left: 8px; right: 8px; z-index: 1200; }
	.calendar .ui-datepicker { width: auto; }
	.leaflet-container .leaflet-control-attribution { font-size: 9px; max-width: 78vw; }
}
/* low screens (phone in landscape): the control column in two columns so that it fits */
@media (max-height: 520px) {
	.leaflet-control-zoom.leaflet-bar { display: grid; grid-template-columns: 38px 38px; }
	.leaflet-control-zoom.leaflet-bar a { border-right: 1px solid var(--border); }
}

/* ---- spinners: station card loading (on the map) and chart loading (inside the card) ---- */
@keyframes mnw-spin { to { transform: rotate(360deg); } }
.mnw-spinner { width: 28px; height: 28px; box-sizing: border-box; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: mnw-spin 0.7s linear infinite; }
#card-spinner { display: none; position: fixed; left: 0; top: 0; right: 0; bottom: 0; z-index: 9999; align-items: center; justify-content: center; pointer-events: none; }
#card-spinner.on { display: flex; }
#card-spinner .mnw-spinner { width: 44px; height: 44px; border-width: 4px; background: var(--glass); box-shadow: var(--shadow); padding: 0; outline: 10px solid var(--glass); }
#popupslide li.chart-loading::after { content: ""; position: absolute; left: 50%; top: 50%; width: 28px; height: 28px; margin: -14px 0 0 -14px; box-sizing: border-box; border-radius: 50%; border: 3px solid var(--border); border-top-color: var(--accent); animation: mnw-spin 0.7s linear infinite; }
#popupslide li.chart-error::after { content: "Nessun dato nelle ultime 24 ore"; position: absolute; left: 0; right: 0; top: 50%; text-align: center; color: var(--muted); font-size: 14px; }
.highcharts-loading { display: none !important; }

/* Vector overlay of js/geo.js: black (light) / white (dark) via --geo-line; regions > borders > coastlines */
.geo-line { stroke: var(--geo-line); fill: none; pointer-events: none; }
.geo-region { stroke-opacity: 0.85; }
.geo-border { stroke-opacity: 0.55; stroke-dasharray: 4 3; }
.geo-coast { stroke-opacity: 0.4; }

/* ---- meteonetwork.eu identity: its font (Space Grotesk) on the menu, the card headings, tabs and buttons; values keep --font ---- */
.off-canvas-menu ul li > a,
.off-canvas-menu .estremi,
.off-canvas-menu li label,
.off-canvas-menu ul.off-canvas-list li label,
.top_modal h3,
.tabrow li a,
.button,
#filter-settings .flt-title,
.report-form h4 { font-family: var(--brand-font); }
.top_modal h3 { font-weight: 600; letter-spacing: 0; }

/* ---- station card: size and layout (popup.php / popwness.php in the #popup reveal; the report form in #segnala) ---- */
/* above the phone side menu (1100) and the top bar (1150) */
.reveal-modal-bg { z-index: 1190; }
.reveal-modal { z-index: 1200; }
/* desktop: fixed width and a fixed height for the slides, so switching between the home and the charts does not resize the card
   (the charts are drawn 400 px high, popup.php) */
@media (min-width: 641px) {
	#popup.reveal-modal { width: 680px; max-width: calc(100vw - 32px); }
	#popup #popupslide { height: 410px !important; }
	#popup .orbit-container { height: 410px; }
	#segnala.reveal-modal { width: 440px; max-width: calc(100vw - 32px); }
}
/* phones: a bottom sheet. Title, close and tabs stay on top (sticky) while the rest scrolls; a shadow at the bottom edge shows that there
   is more below (it disappears at the end: the "local" cover scrolls over it) */
@media (max-width: 640px) {
	#popup.reveal-modal,
	#segnala.reveal-modal {
		position: fixed !important;
		top: auto !important;
		bottom: 0 !important;
		left: 0 !important;
		right: 0 !important;
		width: 100% !important;
		min-height: 0 !important;
		max-height: calc(100% - 48px);
		overflow-x: hidden;
		overflow-y: auto;
		overscroll-behavior: contain;
		-webkit-overflow-scrolling: touch;
		border-radius: 18px 18px 0 0;
		border-width: 1px 0 0;
		box-shadow: 0 -8px 30px rgba(0, 0, 0, 0.3);
		background:
			linear-gradient(rgba(0, 0, 0, 0), var(--surface) 70%) 0 100% / 100% 36px no-repeat local,
			linear-gradient(rgba(0, 0, 0, 0), rgba(0, 0, 0, 0.22)) 0 100% / 100% 16px no-repeat scroll,
			var(--surface);
		padding-bottom: calc(10px + env(safe-area-inset-bottom));
	}
	#popup .top_modal {
		position: sticky;
		top: 0;
		z-index: 5;
		margin: 0 -12px;
		padding: 14px 12px 4px;
		background: var(--surface);
		border-bottom: 1px solid var(--divider);
	}
	/* grab handle */
	#popup .top_modal::before,
	#segnala .report-form::before { content: ""; position: absolute; top: 5px; left: 50%; width: 38px; height: 4px; margin-left: -19px; border-radius: 2px; background: var(--border); }
	#popup .top_modal h3 { margin-top: 6px; }
	#popup .menupopup { top: 10px; }
	#popup #popupslide,
	#popup .orbit-container { height: auto; }
}

/* footer of the card: report button left, partner networks right (only when there are any) */
.card-foot { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 8px 16px; margin-top: 10px; padding-top: 10px; border-top: 1px solid var(--divider); }
.report-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 11px 5px 9px;
	border: 1px solid var(--border);
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--muted) !important;
	font: 600 12px/1.2 var(--brand-font);
	cursor: pointer;
	transition: background-color 0.12s, color 0.12s, border-color 0.12s;
}
.report-btn svg,
.report-ico svg { fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.report-btn:hover { background: var(--surface-hover); color: var(--danger) !important; border-color: var(--danger); }
.card-foot .partners { display: flex; align-items: center; flex-wrap: wrap; justify-content: flex-end; gap: 6px 10px; margin-left: auto; }
.card-foot .partners small { color: var(--muted); font-size: 11px; }
.card-foot .partners img { max-height: 40px; width: auto; }

/* report form (guasto.php) */
#segnala { padding: 18px 18px 16px; }
.report-form { position: relative; margin: 0; }
.report-head { display: flex; align-items: center; gap: 12px; margin: 0 40px 14px 0; }
.report-ico { flex: none; display: flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 50%; background: var(--surface-2); color: var(--danger); }
.report-form h4 { margin: 0; font-size: 1.1rem; font-weight: 600; line-height: 1.2; }
.report-sub { color: var(--muted); font-size: 0.82rem; }
.report-sub strong { color: var(--text); }
.report-form label { display: block; margin: 0 0 10px; color: var(--muted); font-size: 0.78rem; font-weight: 600; }
.report-form input,
.report-form textarea {
	display: block;
	width: 100%;
	margin: 4px 0 0;
	padding: 8px 10px;
	height: auto;
	background: var(--surface-2);
	color: var(--text);
	border: 1px solid var(--border);
	border-radius: var(--radius-sm);
	box-shadow: none;
	font: 400 15px/1.35 var(--font);
}
.report-form textarea { min-height: 96px; resize: vertical; }
.report-form input:focus,
.report-form textarea:focus { background: var(--surface); border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-soft); outline: 0; }
.report-form input::placeholder,
.report-form textarea::placeholder { color: var(--muted); opacity: 0.8; }
.report-form .has-error input,
.report-form .has-error textarea { border-color: var(--danger); }
.report-form .field-error { display: block; margin-top: 3px; color: var(--danger); font-size: 0.75rem; font-weight: 500; }
.report-note { margin: 2px 0 12px; color: var(--muted); font-size: 0.75rem; line-height: 1.35; }
.report-form .button { width: 100%; margin: 0; padding: 10px 14px; font-size: 0.9rem; }
.report-form .button[disabled] { opacity: 0.6; }
.report-msg { margin-top: 10px; padding: 10px 12px; border-radius: var(--radius-sm); font-size: 0.85rem; }
.report-msg.ok { background: color-mix(in srgb, var(--ok) 16%, transparent); color: var(--text); }
.report-msg.err { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--text); }
/* narrow phones (one column of values): "Rateo" as two lines, stars + month / stars + year */
@media (max-width: 440px) {
	.tabella > .row:last-child > .columns:first-child { flex: 0 0 42%; }
	.tabella > .row:last-child .row { display: grid; grid-template-columns: auto 1fr; align-items: center; gap: 3px 8px; }
	.tabella > .row:last-child .titlerating + .rating_bar { margin-left: 0; }
}
/* the slides are Foundation .row: its .row:after is display: table (shrinks to the text), so the message was not centred */
#popupslide li.chart-error::after,
#popupslide li.chart-loading::after { display: block; }
#segnala .close-reveal-modal { position: absolute; top: 12px; right: 12px; z-index: 2; cursor: pointer; }
.report-form .field-error { text-transform: none; }

/* desktop: the card and the report window in the middle of the screen (Foundation put them 1rem from the top); taller than the
   screen -> they scroll inside */
@media (min-width: 641px) {
	#popup.reveal-modal,
	#segnala.reveal-modal {
		position: fixed !important;
		top: 50% !important;
		left: 0 !important;
		right: 0 !important;
		margin: 0 auto !important;
		transform: translateY(-50%);
		max-height: calc(100vh - 24px);
		overflow-y: auto;
	}
}
/* the report form inside the card (js/map.js segnala(code, true)): the card content is only hidden, "Torna alla stazione" shows it again */
#popup.reporting > :not(.report-pane) { display: none !important; }
#popup .report-pane { position: relative; padding: 14px 0 4px; min-height: 120px; }
#popup .report-pane > .mnw-spinner { margin: 40px auto; }
.report-back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	margin: 0 0 12px;
	padding: 5px 11px;
	border-radius: 999px;
	background: var(--surface-2);
	color: var(--text) !important;
	font: 600 12.5px/1.2 var(--brand-font);
	cursor: pointer;
}
.report-back:hover { background: var(--surface-hover); }
@media (min-width: 641px) {
	#popup.reporting { width: 480px; }
}
