/* rsmc/radar-map — rain radar + lightning + satellite map block.
 * Basemap, zoom/fullscreen controls, popups and the "i" credits come from frontend-map.css (shared). */

.rsmc-radar-map-wrap {
	margin: 1em 0;
}

.rsmc-radar-map-title {
	margin: 0 0 .5em;
}

.rsmc-radar-map {
	width: 100%;
	min-height: 260px;
	border-radius: 8px;
	overflow: hidden;
	background: #e9eef2;
	position: relative;
}

.rsmc-radar-map-loading {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--rsmc-muted, #646970);
	font-size: .9rem;
	z-index: 2;
	pointer-events: none;
}

/* Layer toggles — top bar, same look as the other maps' display buttons. */
.rsmc-radar-layers {
	position: absolute;
	top: 10px;
	left: 52px;
	z-index: 1000;
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	max-width: calc(100% - 120px);
}

.rsmc-radar-layer {
	display: inline-flex;
	align-items: center;
	gap: .35em;
	height: 34px;
	padding: 0 .75em;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 8px;
	background: rgba(255, 255, 255, .96);
	box-shadow: 0 1px 5px rgba(0, 0, 0, .3);
	color: #1d2327;
	font-size: .85rem;
	font-weight: 600;
	cursor: pointer;
}

.rsmc-radar-layer.is-active {
	background: var(--rsmc-primary, #2271b1);
	border-color: var(--rsmc-primary, #2271b1);
	color: #fff;
}

.rsmc-radar-layer:focus-visible,
.rsmc-radar-play:focus-visible {
	outline: 2px solid var(--rsmc-primary, #2271b1);
	outline-offset: 2px;
}

/* Timeline — bottom bar: play/pause, frame slider, local time of the shown frame. */
.rsmc-radar-timeline {
	position: absolute;
	left: 10px;
	right: 56px; /* leave room for the fullscreen button (bottom-right) */
	bottom: 10px;
	z-index: 1000;
	display: flex;
	align-items: center;
	gap: .6em;
	padding: .35em .6em;
	border-radius: 8px;
	background: rgba(255, 255, 255, .94);
	box-shadow: 0 1px 5px rgba(0, 0, 0, .3);
}

.rsmc-radar-play {
	flex: 0 0 auto;
	width: 34px;
	height: 34px;
	border: 0;
	border-radius: 50%;
	background: var(--rsmc-primary, #2271b1);
	color: #fff;
	font-size: .95rem;
	line-height: 1;
	cursor: pointer;
}

.rsmc-radar-slider {
	flex: 1 1 auto;
	min-width: 60px;
	accent-color: var(--rsmc-primary, #2271b1);
}

.rsmc-radar-time {
	flex: 0 0 auto;
	min-width: 5.5em;
	text-align: right;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
	color: #1d2327;
}

/* Timeline auto-hide (playing OR paused): shown only when the pointer reaches the bottom band of the map (JS adds
 * .is-tl-visible), on KEYBOARD focus (:focus-visible — a mouse click on play/pause must not pin it), and always
 * on touch screens (hover: none). */
.rsmc-radar-autohide .rsmc-radar-timeline {
	opacity: 0;
	transform: translateY(12px);
	pointer-events: none;
	transition: opacity .2s ease, transform .2s ease;
}

.rsmc-radar-autohide.is-tl-visible .rsmc-radar-timeline,
.rsmc-radar-autohide .rsmc-radar-timeline:has(:focus-visible) {
	opacity: 1;
	transform: none;
	pointer-events: auto;
}

@media (hover: none) {
	.rsmc-radar-autohide .rsmc-radar-timeline {
		opacity: 1;
		transform: none;
		pointer-events: auto;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rsmc-radar-autohide .rsmc-radar-timeline,
	.rsmc-radar-legend {
		transition: none;
	}
}

/* Rain legend — small, discreet, bottom-left corner, with the time of the shown image. It moves above the
 * timeline whenever the timeline is visible. Same palette as the radar ramps (no blue: not water). */
.rsmc-radar-legend {
	position: absolute;
	left: 10px;
	bottom: 10px;
	z-index: 999;
	width: 128px;
	padding: .25em .45em .3em;
	border-radius: 6px;
	background: rgba(255, 255, 255, .82);
	box-shadow: 0 1px 3px rgba(0, 0, 0, .2);
	font-size: .68rem;
	line-height: 1.25;
	color: #1d2327;
	pointer-events: none;
	transition: bottom .2s ease;
}

.rsmc-radar-autohide.is-tl-visible .rsmc-radar-legend,
.rsmc-radar-autohide:has(.rsmc-radar-timeline :focus-visible) .rsmc-radar-legend {
	bottom: 62px;
}

@media (hover: none) {
	.rsmc-radar-autohide .rsmc-radar-legend {
		bottom: 62px;
	}
}

/* Chip layout: play button on the left, label + scale on the right. */
.rsmc-radar-legend {
	display: flex;
	align-items: center;
	gap: .45em;
	width: auto;
	min-width: 128px;
}

.rsmc-radar-legend[hidden] {
	display: none;
}

.rsmc-radar-legend__body {
	display: block;
	flex: 1 1 auto;
	min-width: 104px;
}

.rsmc-radar-legend__ramp-wrap {
	display: block;
}

.rsmc-radar-legend__ramp-wrap[hidden] {
	display: none;
}

.rsmc-radar-chip-play {
	flex: 0 0 auto;
	width: 26px;
	height: 26px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--rsmc-primary, #2271b1);
	color: #fff;
	font-size: .7rem;
	line-height: 1;
	cursor: pointer;
	pointer-events: auto; /* the chip itself lets clicks through to the map */
}

.rsmc-radar-chip-play:focus-visible {
	outline: 2px solid var(--rsmc-primary, #2271b1);
	outline-offset: 2px;
}

/* One play button at a time: the chip's hides while the full timeline is shown (hover, keyboard, touch). */
.rsmc-radar-autohide.is-tl-visible .rsmc-radar-chip-play,
.rsmc-radar-autohide:has(.rsmc-radar-timeline :focus-visible) .rsmc-radar-chip-play {
	display: none;
}

@media (hover: none) {
	.rsmc-radar-autohide .rsmc-radar-chip-play {
		display: none;
	}
}

.rsmc-radar-legend__time {
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.rsmc-radar-legend[hidden] {
	display: none;
}

.rsmc-radar-legend__label {
	font-weight: 700;
}

.rsmc-radar-legend__ramp {
	display: block;
	height: 6px;
	margin: 2px 0 1px;
	border-radius: 4px;
	background: linear-gradient(90deg, #ffffff 0%, #ff78be 18%, #9628c8 36%, #1eb446 54%, #f0e628 70%, #f58c1e 85%, #0a0a0a 100%);
	box-shadow: inset 0 0 0 1px rgba(0, 0, 0, .15);
}

.rsmc-radar-legend__ends {
	display: flex;
	justify-content: space-between;
	color: #50575e;
}

.rsmc-radar-popup .maplibregl-popup-content {
	padding: 4px 8px;
	font-weight: 600;
}

@media (max-width: 600px) {
	.rsmc-radar-layers {
		left: 46px;
		max-width: calc(100% - 56px);
	}
	.rsmc-radar-layer {
		height: 30px;
		padding: 0 .5em;
		font-size: .78rem;
	}
	.rsmc-radar-legend {
		width: 112px;
	}
}

.rsmc-radar-error {
	position: absolute;
	left: 50%;
	top: 56px;
	transform: translateX(-50%);
	z-index: 1001;
	max-width: calc(100% - 40px);
	padding: .4em .8em;
	border-radius: 6px;
	background: #fcf0f1;
	border: 1px solid #d63638;
	color: #8a2424;
	font-size: .82rem;
	font-weight: 600;
	text-align: center;
}

/* Members' animated export panel (under the map) */
.rsmc-radar-export {
	margin-top: 10px;
	padding: 8px 12px;
	border: 1px solid rgba(0, 0, 0, .12);
	border-radius: 8px;
	background: rgba(255, 255, 255, .7);
	font-size: 14px;
}
.rsmc-radar-export summary {
	cursor: pointer;
	font-weight: 700;
}
.rsmc-radar-export__row {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 16px;
	align-items: center;
	margin: 8px 0;
}
.rsmc-radar-export__row label {
	display: inline-flex;
	gap: 6px;
	align-items: center;
}
.rsmc-radar-export__help {
	margin: 4px 0;
	font-size: 12px;
	opacity: .8;
}
.rsmc-radar-export__status {
	margin: 6px 0 0;
	font-weight: 600;
}
.rsmc-radar-export__link {
	font-weight: 700;
}

/* Animation preparation (all images downloaded + decoded before playback): a small status pill, top centre. */
.rsmc-radar-buffer {
	position: absolute;
	top: 54px;
	left: 50%;
	transform: translateX(-50%);
	z-index: 1001;
	display: flex;
	flex-direction: column;
	gap: 5px;
	min-width: 13em;
	padding: .45em .8em .55em;
	border-radius: 8px;
	background: rgba(255, 255, 255, .96);
	box-shadow: 0 1px 5px rgba(0, 0, 0, .3);
	color: #1d2327;
	font-size: .82rem;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
	text-align: center;
	pointer-events: none;
}

.rsmc-radar-buffer[hidden] {
	display: none;
}

.rsmc-radar-buffer__bar {
	display: block;
	height: 4px;
	border-radius: 2px;
	background: rgba(34, 113, 177, .18);
	overflow: hidden;
}

.rsmc-radar-buffer__bar i {
	display: block;
	height: 100%;
	width: 0;
	background: var(--rsmc-primary, #2271b1);
	transition: width .15s linear;
}

@media (prefers-reduced-motion: reduce) {
	.rsmc-radar-buffer__bar i { transition: none; }
}
