@import url('https://fonts.googleapis.com/css?family=Libre+Franklin:400,700');

:root {

	/* Colors */
	--color-primary: #c62828;
	--color-gray: #4a4a4a;
	--color-reggray: #777;
	--color-medgray: #ccc;
	--color-lightgray: #e9e9e9;

	--color-map-base: rgb(250,250,248); /* This is the base color of Carto's `light_all` map tiles. */

	/* Number of legend divisions */
	--num-legend-items: 6;

	/* YlOrRd */
	--legend-color-0: rgb(255,255,178);  /* yellow 1 */
	--legend-color-1: rgb(254,217,118); /* yellow 2 */
	--legend-color-2: rgb(254,178,76); /* orange 1 */
	--legend-color-3: rgb(253,141,60); /* orange 2 */
	--legend-color-4: rgb(240,59,32); /* red 1 */
	--legend-color-5: rgb(189,0,38); /* red 2 */

	/* viridis */
	--legend-color-0: rgb(253, 231, 37);  /* yellow 1 */
	--legend-color-1: rgb(122, 209, 81); /* yellow 2 */
	--legend-color-2: rgb(34, 168, 132); /* orange 1 */
	--legend-color-3: rgb(42, 120, 142); /* orange 2 */
	--legend-color-4: rgb(65, 68, 135); /* red 1 */
	--legend-color-5: rgb(68, 1, 84); /* red 2 */


	/* Number of views */
	--num-views: 1;

	/* Fonts */
	--font-primary: 'Libre Franklin', sans-serif;
	/*--font-secondary: 'Lato', sans-serif;
	--font-tertiary: 'Montserrat', sans-serif;*/

	--letter-spacing: 0.5px;
	--border-radius: 3px;
}

html {
	padding: 0;
	margin: 0;
	font-size: 100%;
	box-sizing: border-box;
}
*, *:before, *:after {
	box-sizing: inherit;
}

body {
	margin: 0;
	padding: 0;
	font-family: var(--font-primary);
}

a {
	color: var(--color-primary);
	text-decoration: none;
}


/*-------------
GRID
--------------- */

.wrapper {
	/*max-width: 700px;*/
	width: 100%;
	position: relative;
	margin: 0;
	padding: 0;
}


/*-------------
MAP
--------------- */

/* Needed for the map to appear */
#map {
	height: 600px;
}

.map__info {
	margin: 0 auto;
	/*padding: 24px;*/
}


.map__headline,
.map__date,
.map__subheadline,
.map__source {
	font-family: var(--font-primary);
}

.map__headline {
	font-size: 1.25rem;
	margin: 0;
	font-weight: 700;
	color: var(--color-gray);
	/*margin-top: 24px;*/
}

.map__date {
	margin-top: 4px;
}

.map__subheadline {
	font-size: 1rem;
}

.map__date,
.map__note,
.map__credit,
.map__source {
	font-size: 0.875rem;
}

.map__credit {
	text-align: right;
}

.map__source {
	font-style: italic;
}

/* Displays information when a polygon is clicked */
.map__sentence {
	font-family: var(--font-primary);
	font-size: 1rem;
	margin-top: 0;
	/*margin-top: 32px;*/
	/*margin-bottom: 32px;*/
}

.map__sentence span {
	font-weight: 700;
}

.prompt {
	font-family: var(--font-primary);
	/*font-weight: 700;*/
	color: var(--color-gray);
	margin: 4px 0px 8px 0px;
	/*margin-top: 32px;*/
	/*margin-bottom: 8px;*/
}


/*-------------
CONTROLS (above map)
--------------- */

.map__toggles {
	overflow: hidden;
	display: -ms-flexbox;
	display: flex;
	max-width: 450px;
	margin: 1rem auto 1.5rem auto;
}


.map__toggles button {
	background-color: var(--color-lightgray);
	padding: 0.5rem 0.75rem;
	width: 7rem;
	border: 1px solid var(--color-medgray);
	display: inline;
	-ms-flex: 1;
	flex: 1;
	outline: none;
	color: var(--color-reggray);
	border-right: none;
	line-height: 1;
	vertical-align: middle;
	margin: 0;
	cursor: pointer;
	font-size: 0.75rem;
	text-transform: uppercase;
	font-family: var(--font-primary);
}

.map__toggles button.active {
	font-weight: 700;
	background-color: white;
	box-shadow: inset 0px 0px 2px rgba(0,0,0,0.2);
	color: var(--color-darkgray);
}
.map__toggles button:first-of-type {
	border-top-left-radius: 0.25rem;
	border-bottom-left-radius: 0.25rem;
}
.map__toggles button:last-of-type {
	border-top-right-radius: 0.25rem;
	border-bottom-right-radius: 0.25rem;
	border-right: 1px solid var(--color-medgray);
}

/*-------------
LEGEND (above map)
--------------- */

/* At desktop widths, hide this line break. We'll use it on mobile. */
.party__label br {
	display: none;
}


.map__legend {
	width: 100%;
	max-width: 500px;
	margin: 0 auto 0.5rem auto;
	/* Use these next two styles only when you have a diverging legend that needs two labels */
	/* display: grid; */
	/* grid-template-rows: repeat(2, 1fr); */
}

.legend__row {
	display: grid;
	grid-template-columns: repeat(var(--num-legend-items), 1fr);
	align-items: baseline;
	/* margin-bottom: 0.5rem; */
}

/* Position the breakpoints and hashes at the borders between the legend rectangles */
.legend__row.legend__breakpoints {
	position: relative;
}
.view-0 .legend__row.legend__breakpoints,
.view-1 .legend__row.legend__breakpoints {
	left: calc(100% / (var(--num-legend-items)*2));
}

.legend__row.legend__ticks,
.legend__tick {
	height: 6px;
}

.party__label, .candidate__label {
	text-transform: uppercase;
	font-size: 0.875rem;
	font-weight: 700;
	line-height: 1;
	color: var(--color-gray);
	padding: 0;
	grid-column: 1 / calc( var(--num-legend-items) + 1);
}
.party__label {
	text-align: center;
}
.candidate__label {
	text-align: left;
}


.legend__group {
	text-align: center;
	line-height: 1;
/*	display: grid;
	grid-template-columns: 26px 1fr;
	align-content: center;
	align-items: center;
*/}

.legend__square, .legend__value {
	display: inline-block;
	margin: 0px;
	padding: 0px;
	line-height: 0.875rem;
	height: 0.875rem;
	vertical-align: middle;
}


.legend__square {
	background: #aaa;
	height: 0.875rem;
	margin-right: 6px;
	opacity: 1;
}

.legend__tick,
.legend__square {
	width: 100%;
}

.legend__group .legend__tick,
.legend__group .legend__square {
	border-right: 1px solid #000;
}

.legend__group:last-of-type .legend__tick,
.legend__group:last-of-type .legend__square {
	width: 100%;
	border-right: none;
}

.square-0, .bucket-0  { opacity: var(--layer-opacity); background: var(--legend-color-0) }
.square-1, .bucket-1  { opacity: var(--layer-opacity); background: var(--legend-color-1) }
.square-2, .bucket-2  { opacity: var(--layer-opacity); background: var(--legend-color-2) }
.square-3, .bucket-3  { opacity: var(--layer-opacity); background: var(--legend-color-3) }
.square-4, .bucket-4  { opacity: var(--layer-opacity); background: var(--legend-color-4) }
.square-5, .bucket-5  { opacity: var(--layer-opacity); background: var(--legend-color-5) }


.legend-color-0  { fill: var(--legend-color-0) }
.legend-color-1  { fill: var(--legend-color-1) }
.legend-color-2  { fill: var(--legend-color-2) }
.legend-color-3  { fill: var(--legend-color-3) }
.legend-color-4  { fill: var(--legend-color-4) }
.legend-color-5  { fill: var(--legend-color-5) }

/* Only show the legend that matches the current view */
.view-0 .legend-1 { display: none; }

/* Dynamically change the number of grid columns between views */
.view-0 .legend__row { grid-template-columns: repeat(var(--num-legend-items), 1fr); }


.legend__value {
	margin: 0;
	font-size: 0.875rem;
}


/*-------------
OTHER
--------------- */

.info {
	background: white;
	font-family: var(--font-secondary);
	font-size: 1rem;
	line-height: 1.8;
	border-radius: var(--border-radius);
	color: black;
	border: 3px solid black;
	max-width: 275px;
	box-shadow: 0.25rem 0.25rem 0.875rem 0px rgba(0,0,0,0.3333);
}

.legend {
	padding: 0.5rem;
	font-family: var(--font-primary);
}

.legend h3 {
	margin: 0px;
	font-size: 1rem;
	font-weight: 700;
	color: var(--color-gray);
	text-transform: uppercase;
}

.legend ul {
	margin: 0px 0px;
	padding-left: 0px;
	list-style-type: none;
}
.legend ul li {
	margin-left: 0px;
	padding-left: 0px;
	font-size: 0.8rem;
}


.legend i {
	width: 0.8rem;
	height: 0.8rem;
	border: 1px solid black;
	margin-right: 10px;
	display: inline-block;
}

.bubble-legend h3 {
	color: black;
	text-align: center;
	line-height: 1.1;
}

.bubble-legend .map__legend {
	position: relative;
	display: table;
/*	display: grid;
	grid-template-rows: repeat(4, 1fr);
	grid-template-rows: 1fr 1.5fr 2fr; */
	margin: 0 auto;
}

.bubble-legend .legend__row {
	display: table-row;
/*	display: grid;
	grid-template-columns: repeat(2, 1fr);
	align-items: center;
	padding: 0.125rem 0;*/
}

.bubble-legend .legend__cell {
	vertical-align: middle;
	text-align: center;
	line-height: 1;
}

.bubble-legend .map__legend .legend__circle {
	border-radius: 50%;
	background: rgba(50,50,50,1);
	margin: auto;
}
.bubble-legend .legend__value {
	font-size: 0.75rem;
}



.popup {
	font-family: var(--font-primary);
	background: white;
	padding: 1rem;
}

.popup__county,
.popup__pct-wrapper {
	border-bottom: 1px solid black;
}

.popup__name {
	font-weight: 900;
	text-transform: uppercase;
	margin: 0px;
}

.popup__text {
	line-height: 1;
}

.popup__county {
	margin: 0px 0px 1rem 0px;
	padding-bottom: 0.5rem;
}

.popup__margin {
	margin: 0.25rem 0px 0px;
	font-weight: 700;
}

.popup > .popup__turnout {
	border-top: 1px solid black;
	padding-top: 0.5rem;
	margin: 0.5rem 0px 0px;
}

.popup > .popup__turnout ~ .popup__turnout {
	border: none;
	padding-top: 0px;
	margin: 0.125rem 0px 0px;
}

.popup {
	/*border: 2px solid #000;*/
	padding: 1rem;
}


.popup table {
	border-collapse: collapse;
}

.popup table tr:nth-child(even) {
	background-color: var(--color-lightgray);
}

.popup table tr td,
.popup table tr th {
	text-align: left;
}
.popup table tr td.data, 
.popup table tr th.data {
	text-align: right;
	padding-left: 0.75rem;
}



.leaflet-interactive.no-pointer {
	cursor: default;
}

.text-labels {
	text-align: center;
	font-family: var(--font-primary);
	font-size: 0.875rem;
	font-weight: 900;
	color: var(--color-reggray);
}


i.fa-check-circle,
i.fa-times-circle {
	margin-right: 6px;
}


.leaflet-multiply {
	opacity: var(--layer-opacity) !important;
	mix-blend-mode: multiply;
}

/* Let's make the Stamen tiles a little bit lighter */
.leaflet-container { background: #fff; }
.leaflet-tile-container {
	opacity: 0.333;
}


/* Large devices */
@media (max-width: 1200px) {
}

/* Large devices */
@media (max-width: 1024px) {
}

/* Medium devices */
@media (max-width: 640px) {
	.party__label br {
		display: block;
	}
	.popup, .desktop-text {
		display: none;
	}
}

/* Medium devices */
@media (max-width: 768px) {
	#map {
		height: 500px;
	}
}

/* Small devices */
@media (max-width: 480px) {
	#map {
		height: 400px;
	}
}

/* Small devices */
@media (max-width: 320px) {
}