/* @import url('https://fonts.googleapis.com/css2?family=Mulish:wght@900&family=Roboto:ital,wght@0,300;0,400;0,700;1,400;1,300&display=swap'); */

* { 
	padding: 0;
	margin: 0; 
	box-sizing: border-box;
}

:root {
	--colorBG: #f0f0f0;
	--colorText: #303030;
	--colorActive: blue;
}

body { 
	font-family: 'Roboto', sans-serif; 
	color: var(--colorText);
	background-color: var(--colorBG);
}

a { color: #94a19e; }
a:visited { color: #94a19e; }
a:hover { color: #aaaad5; }

.hidden { display: none; }

.wrapper { width: 100%; }

header {
	margin: 0 auto;
}
h2 {
	font-size: 40px;
	line-height: 62px;
	font-weight: 400;
}
header h2 { 
	display: flex;
	justify-content: space-between;
	align-items: start;
	gap: 25px;
}
header h2 span { pointer-events: none; }
/* #header-text * { display: inline; } */
#h2-region, #h2-season { white-space: nowrap; }
header h2 .highlighted {
	padding: 0 20px 6px 15px;
	margin: 0 -3px;
	background: #dcdcf1;
	/* border: 1px solid #b4b4f4; */
	border-radius: 5px;
	position: relative;
	pointer-events: all;
	cursor: pointer;
	white-space: nowrap;
}
header h2 .highlighted:hover { background: #c8c8f3; }
header h2 .highlighted::after {
	content: "×";
	opacity: .6;
	position: absolute;
	top: -20px;
	right: 3px;
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50px;
	font-size: 16px;
	font-weight: normal;
	font-style: normal;
}
#reset {
	font-size: 16px;
	line-height: 20px;
	font-weight: normal;
	cursor: pointer;
	padding: 3px 10px 4px;
	background: #606060;
	color: var(--colorBG);
	border-radius: 3px;
	width: 125px;
}
#reset:hover { background: #404040; }
h3 {
	font-family: 'Roboto', sans-serif; 
	font-size: 32px;
	line-height: 36px;
	color: #94a19e;
	font-weight: 900;
	/* padding-bottom: 5px; */
}
h4 {
	font-family: 'Roboto', sans-serif; 
	font-size: 14px;
	line-height: 16px;
	font-weight: 300;
	font-style: italic;
	margin-bottom: 5px;
	color: white;
	opacity: .7;
}
section, main {
	width: 100%;
	max-width: 1400px;
	margin: 20px auto 0;
}

#viz-header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 30px;
	margin-bottom: 30px;
}
.toggler span.button { cursor: pointer; }
#class-type span.button {
	padding: 3px 7px 4px;
	background: #e0e0e0;
	border-radius: 3px;
	display: inline-flex;
	gap: 5px;
	align-items: center;
}
#class-type span.button::after {
	content: "×";
	display: block;
	width: 10px; height: 10px;
	border-radius: 10px;
	/* position: relative; */
	/* right: 0; */
	background: #c0c0c0;
	line-height: 8px;
	text-align: center;
}
#class-type span.button[data-id="Class A"]::after { background: blue; color: blue; }
#class-type span.button[data-id="Class B"]::after { background: purple; color: purple; }
#class-type span.button[data-id="Class C"]::after { background: red; color: red; }

#class-type span.button.active { color: white; }
#class-type span.button.active::after { background: none; color: white; }
#class-type span.button[data-id="Class A"].active { background: blue; }
#class-type span.button[data-id="Class B"].active { background: purple; }
#class-type span.button[data-id="Class C"].active { background: red; }

#class-type span.button:hover { background: #d0d0d0; }

#content {
	display: flex;
	justify-content: space-between;
	gap: 20px;
}

#us-map {
	width: 100%;
	max-width: 800px;
	position: relative;
	z-index: 50;
}
#map-type {
	display: flex;
	gap: 15px;
	position: absolute;
	top: 5px;
	right: 120px;
	font-size: 14px;
}
#map-type span { text-decoration: none; cursor: pointer; }
#map-type span:hover { color: var(--colorActive); }
#map-type span.active { 
	color: var(--colorActive); 
	border-bottom: 1px var(--colorActive) solid; 
	padding-bottom: 2px; 
	pointer-events: none;
}

#us-map svg #us {
	fill: #e0e0e0;
}
#us-map svg .county, #us-map svg .state {
	fill: #e0e0e0;
	stroke: #f0f0f0;
	stroke-width: .5;
	cursor: pointer;
}
#us-map svg .county:hover, #us-map svg .state:hover { fill: #0000bf!important; }
#us-map svg .county.active, #us-map svg .state.active { fill: gold!important; }
#us-map svg .county.active, #us-map svg .state.active:hover { fill: GoldenRod!important; }
#us-map svg .county.blocked, #us-map svg .state.blocked {
	pointer-events: none;
}
#us-map svg #states-border path {
	fill: none;
	stroke: #fff;
	stroke-linejoin: round;
	pointer-events: none;
}
#us-map svg #points circle {
	fill: blue;
	fill-opacity: .4;
}

#sidebar,
#scatterplot {
	width: 100%;
	max-width: 580px;
	position: relative;
}
#sp-na-message {
	position: absolute;
	z-index: 100;
	background: var(--colorBG);
	font-size: 14px;
	line-height: 20px;
	font-style: italic;
	color: #808080;
	width: 100%;
	max-width: 170px;
	text-align: center;
	padding: 10px 20px;
}
#sidebar {
	display: flex;
	flex-direction: column;
	justify-content: space-between;
}
#scatterplot .axis .domain { display: none; }
#scatterplot .axis .axis-name { 
	font-size: 12px;
	font-style: italic;
	fill: #404040;
}
#scatterplot .y.axis .axis-name { text-anchor: start; }
#scatterplot .x.axis .axis-name { text-anchor: end; }
#scatterplot .axis .tick text {
	font-size: 10px;
	fill: #808080;
}
#scatterplot .axis .tick line {
	stroke: #d0d0d0;
}
#scatterplot .refline { pointer-events: none; }
#scatterplot .refline line {
	fill: none;
	stroke: #000;
	stroke-opacity: .8;
}
#scatterplot .refline text {
	fill: #404040;
	stroke: var(--colorBG);
    paint-order: stroke;
    stroke-width: 3px;
    stroke-opacity: .8;
    stroke-linecap: round;
    stroke-linejoin: round;
	font-size: 12px;
	font-style: italic;
}
#scatterplot .refline.y text { text-anchor: end; }
#scatterplot #plot circle {
	fill: #303030;
	fill-opacity: .2;
	stroke: #303030;
	stroke-opacity: .3;
}

#measures {
	display: flex;
	flex-wrap: wrap;
	gap: 4px;
	margin-bottom: 10px;
}
#measures .measure {
	width: 100%;
	max-width: 142px;
	background: #e0e0e0;
	padding: 7px 5px 8px;
	border-radius: 2px;
	cursor: pointer;
	position: relative;
}
#measures .measure .value {
	font-weight: bold;
	font-size: 14px;
	line-height: 14px;
	margin-bottom: 2px;
}
#measures .measure .name {
	font-size: 12px;
	line-height: 14px;
}
#measures .measure:hover { background: #d0d0d0; }
#measures .measure.active {
	background: var(--colorActive);
	color: white;
	pointer-events: none;
}
#measures .measure::after {
	position: absolute;
	top: 0; right: 3px;
	text-align: right;
	font-size: 11px;
	font-style: italic;
	opacity: .8;
}
#measures .measure.axis-x::after { content: "↔ x"; }
#measures .measure.active:not(.axis-x)::after { content: "↕ y"; }
#measures .measure.nodata { pointer-events: none; }
#measures .measure.nodata .name, #measures .measure.nodata .value { opacity: .4; }
#measures .measure.nodata .unit { display: none; }

#timeseries { 
	position: relative;
}
#seasons {
	position: absolute;
	top: 15px; left: -1px;
	width: 100%;
	display: flex;
	/* gap: 4px; */
}
#seasons .season {
	width: 100%;
	max-width: 80px;
	background: #e0e0e0;
	padding: 5px 7px 8px;
	border-radius: 5px;
	border: 2px solid var(--colorBG);
	cursor: pointer;
}
#seasons .season .value {
	font-weight: bold;
	font-size: 14px;
	line-height: 14px;
	margin-bottom: 2px;
}
#seasons .season .name {
	font-size: 12px;
	line-height: 14px;
}
#seasons .season:hover {
	background: #d0d0d0;
}
#seasons .season.active {
	background: var(--colorActive);
	color: white;
	position: relative;
}
#seasons .season.active::after {
	content: "×";
	position: absolute;
	top: -3px;
	right: 3px;
	display: block;
	width: 10px;
	height: 10px;
	border-radius: 50px;
}
#seasons .season.nodata { pointer-events: none; }
#seasons .season.nodata .name, #seasons .season.nodata .value { opacity: .4; }
#seasons .season.nodata .unit { display: none; }

#ts-refline {
	fill: none;
	stroke: black;
	stroke-opacity: .8;
}
#ts-chart path.area {
	fill: #d0d0d0;
}
#ts-chart path.area.custom {
	fill: var(--colorActive);
}
#ts-chart .baseline {
	fill: none;
	stroke: #202020;
	shape-rendering: crispEdges;
}
#ts-overlay {
	fill: var(--colorBG);
	fill-opacity: 0;
	cursor: help;
}
#ts-axis .domain { display: none; }
#ts-axis text {
	font-size: 10px;
	fill: #808080;
	text-anchor: start;
}

footer {
	margin-top: 30px;
	padding-top: 10px;
	margin-bottom: 20px;
	font-size: 12px;
	line-height: 18px;
	font-weight: 300;
	color: #858e8c;
}
footer a, footer a:visited { color: #858e8c; }
footer a:hover { color: #595fb2; }

#tooltip {
	position: absolute;
	/* display: none; */
	top: 0; left: 0;
	width: 100%;
	max-width: 150px;
	background: rgba(0,0,0,.8);
	border: 1px solid black;
	border-radius: 3px;
	color: white;
	padding: 8px 15px 12px;
	pointer-events: none;
	z-index: 1000;
	box-sizing: border-box;
	font-size: 14px;
	line-height: 16px;
	opacity: 0;
	transition: opacity .25s;
}
#tooltip .tt-desc {
	font-size: 12px;
	font-style: italic;
}
#tooltip .tt-name { font-weight: bold; }
#tooltip .tt-value { font-size: 12px; font-style: italic; }

#us-map svg, #scatterplot svg, #timeseries svg {
	box-sizing: initial;
}

@media screen and (max-width:1460px) {
	section { padding: 0 20px; }
}

@media screen and (max-width:1240px) {
	section { max-width: 840px; }
	header h2 { flex-direction: column; gap: 15px; }
	#viz-header { margin-bottom: 10px; }
	#class-desc { display: block; margin-bottom: 5px; }
	#content { flex-direction: column; }
	#map-type { right: 0; top: 0; }
	#sidebar { flex-direction: row-reverse; max-width: unset; gap: 30px; }
	#scatterplot { max-width: unset; }
	#measures { width: 100%; max-width: 142px; }
}

@media screen and (max-width:660px) {
	body { min-width: 450px; }
	section { padding: 0 10px; }
	h2 { font-size: 28px; line-height: 36px; }
	header h2 .highlighted { padding: 0px 15px 0px 10px; }
	header h2 .highlighted::after { top: -10px; }
	#viz-header { flex-direction: column; gap: 5px; }
	#class-desc { display: none; }
	#content { gap: 30px; }
	#sidebar { flex-direction: column; gap: 10px; }
	#measures { max-width: unset; justify-content: center; }
	#timeseries { margin-top: 15px; }
	#seasons { top: -5px; }
}