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

:root {

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

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

	/* From color brewer, color-blind safe for diverging. */
	--color-red: #b2182b;
	--color-blue: #2166ac;


	/* Diverging pink-to-green color scheme */
	--legend-color-0:  rgb(197,27,125);  /* pink 4 */
	--legend-color-1:  rgb(222,119,174); /* pink 3 */
	--legend-color-2:  rgb(241,182,218); /* pink 2 */
	--legend-color-3:  rgb(253,224,239); /* pink 1 */
	--legend-color-4:  rgb(247,247,247); /* white */
	--legend-color-5:  rgb(230,245,208); /* green 1 */
	--legend-color-6:  rgb(184,225,134); /* green 2 */
	--legend-color-7:  rgb(127,188,65);  /* green 3 */
	--legend-color-8:  rgb(77,146,33);   /* green 4 */



	/* 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; */
}

.desktop-text { display: inline; }
.mobile-text, .hidden { display: none; }


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

.interactive__wrapper {
	width: 100%;
	position: relative;
	font-family: var(--font-primary);
}


/*-------------
CHART
--------------- */

.chart {
	width: 100%;
	height: 60px;
	background: white;
	margin-bottom: 8px;
}


.chart__footer table {
	margin: 0px auto;
}

/* Add some separation between the legend items */
.chart__footer table .legendLabel {
	padding-right: 0.5rem;
}


.chart__info ul li {
	font-size: 0.875rem;

}

.chart__headline,
.chart__header,
.chart__date,
.chart__subheadline,
.chart__source {
	font-family: var(--font-primary);
}

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

.chart__header {
	font-size: 0.875rem;
	text-transform: uppercase;
	margin: 1rem 0px 0px 0px;
	font-weight: 700;
	color: var(--color-gray);
	text-align: center;
}


.chart__date {
	margin-top: 4px;
}

.chart__subheadline {
	font-size: 1rem;
	margin-top: 4px;
}

.chart__date,
.chart__note,
.chart__credit,
.chart__source {
	font-size: 0.875rem;
}

.chart__source {
	font-style: italic;
	/*padding-bottom: 1rem;*/
	/*border-bottom: 1px solid #ddd;*/
}

.chart__controls {
    display: flex;
    text-align: center;
    align-items: center;
    justify-content: center;
}

.input__wrapper {
	margin: 0.5rem 1rem;
	display: flex;
    align-items: center;
}

.input__wrapper label {
	margin: 0px 0.25rem;
	font-weight: bold;
}

/*-------------
TABLE
--------------- */

.tables__wrapper {
	margin-top: 1rem;
	display: grid;
	grid-template-columns: 1fr; /* Change this depending on how many side-by-side tables you want to display */
	gap: 1rem;
}
.interactive__wrapper, .table__wrapper {
	position: relative;
	width: 100%;
}

.full-width {
	grid-column: 1 / -1;
}


.table {
	display: table;
	width: 100%;
	margin-bottom: 8px;
    border: none;
    border-collapse: inherit;
    border-spacing: 0;
}

text { font-family: "Libre Franklin", sans-serif; }


.table__footer table {
	margin: 0px auto;
}


.table__info ul li {
	font-size: 0.875rem;

}

.table__headline,
.table__header,
.table__date,
.table__subheadline,
.table__source {
	font-family: var(--font-primary);
}

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

.table__header {
	font-size: 0.875rem;
	text-transform: uppercase;
	margin: 1rem 0px 0px 0px;
	font-weight: 700;
	/*color: var(--color-gray);*/
	text-align: center;
}


.table__date {
	margin-top: 4px;
}

.table__subheadline {
	font-size: 1rem;
	margin-top: 4px;
}

.table__date,
.table__note,
.table__credit,
.table__source {
	font-size: 0.875rem;
}

.table__credit,
.table__source {
	margin: 0.125rem 0px;
	font-size: 0.875rem;
}


.table__credit {
	text-align: right;
}


.table__source {
	font-style: italic;
}


.str-col {
	text-align: left;
}

.num-col {
	text-align: right;
}
.table-header-2 .num-col.scores-curr { text-align: center; }

.bar-col {
	text-align: left;
	position: relative;
	padding: 0.5rem;
	width: 18rem;
}


/* This is to keep "Pct chg" column from breaking over 3 lines on mobile */
.num-col { min-width: 6rem; }

td.bar-col .bar__wrapper {
	display: flex;
	gap: 0.5rem;
}
td.bar-col .bar-label {
	width: 3rem;
	text-align: right;
	height: 1rem;
	line-height: 1;
}

td.bar-col .bar-container {
	background: var(--color-lightgray);
	height: 1rem;
}

td.bar-col.pts-12 .bar-container {
	width: 14rem;
}
td.bar-col.pts-6 .bar-container {
	width: 7rem;
}


td.bar-col .bar-container .bar {
	/*background: var(--color-black);*/
	background: var(--color-blue);
	display: block;
	height: 1rem;
}


.col-category,
.col-value,
.col-emphasize {
	padding: 0.5rem;
	border-bottom: 1px solid black;
}

th.col-value { border-left: 1px solid var(--color-reggray); }
td.col-value { border-left: 1px solid var(--color-medgray); }

td.col-emphasize {
	font-weight: 900;
	background: var(--color-lightgray);
}

th.col-category,
th.col-value,
th.col-emphasize {
	background: var(--color-gray);
	color: white;
}


th.col-value { border-left: 2px solid var(--color-black); }
td.col-value { border-left: 2px solid var(--color-reggray); }

th.col-value.group-boundary {
	border-left: 6px solid var(--color-black);
}

td.col-value.group-boundary {
	border-left: 6px solid var(--color-black);
}

td.col-emphasize {
	font-weight: 900;
	background: var(--color-lightgray);
}

.table-header th {
	background: var(--color-gray);
	color: white;
	text-align: center;
}

.table-header-2 th {
	background: var(--color-reggray);
	color: white;
}



/* FORM CONTROLS */
select {
	font-size: 1rem;
	padding: 0.5rem;
}


/*-------------
LEGEND (above chart)
--------------- */

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

/* CSS calc rounds 0.5 up to next integer. So, we subtract 1 from num-legend-items to ensure */
/* that if it's odd (9), it divides into 4 and 4, but if even (8) it also divides into 4 and 4 */
.party__label {
	grid-column: span calc((var(--num-legend-items) - 1) / 2 );
}

.party__label:first-of-type {
	text-align: left;
}

.party__label:last-of-type {
	text-align: right;
}

/* Haven't yet figured out a pure CSS calc() way to return a 1 for odd and 0 for even. Have to hard-code  */
.party__spacer {
	grid-column: span 1;
}


.score-pct { font-weight: bold; }

.table__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);
}

/* Position the breakpoints and hashes at the borders between the legend rectangles */
.legend__row.legend__breakpoints {
	position: relative;
}
.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;
}
.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;
	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) }
.square-6, .bucket-6  { opacity: var(--layer-opacity); background: var(--legend-color-6) }
.square-7, .bucket-7  { opacity: var(--layer-opacity); background: var(--legend-color-7) }
.square-8, .bucket-8  { opacity: var(--layer-opacity); background: var(--legend-color-8) }


.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) }
.legend-color-6  { fill: var(--legend-color-6) }
.legend-color-7  { fill: var(--legend-color-7) }
.legend-color-8  { fill: var(--legend-color-8) }


/* 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;
}






/* FORM CONTROLS */
select {
	font-size: 1rem;
	padding: 0.5rem;
}


/* RESPONSIVE */

@media (max-width: 1024px) {
	.table-header-2 .num-col.scores-curr { text-align: right; }

	td.bar-col .bar__wrapper {
		display: inline;
	}
	.bar-container {
		display: none;
	}
	td.bar-col .bar-label,
	.bar-col {
		width: unset;
		text-align: right;
	}

}

@media (max-width: 800px) {
}

@media (max-width: 640px) {
	html {
		font-size: 87.5%;
	}

	.table__legend {
		max-width: 100%;
		display: block;
	}

	.table__individual {
		position: relative;
		max-height: 350px;
		overflow: hidden;
		overflow-y: scroll;
	}

	.table__individual table thead {
		top: 0;
		z-index: 2;
		position: sticky;
	}

	h4 {
		margin: 0px 0px 4px 0px;
		padding: 0px;
	}

	/* This is to keep "Pct chg" column from breaking over 3 lines on mobile */
	.num-col { min-width: 5rem; }

	.col-category,
	.col-value,
	.col-emphasize {
		padding: 0.25rem;
	}

	.desktop-only { display: none; }

}

@media (max-width: 480px) {
	.chart__controls {
	    display: grid;
	}
	.input__wrapper { margin: 0.5rem auto 0 auto; }
	.input__wrapper.select__wrapper { flex-flow: column; }
}

@media (max-width: 360px) {
	html {
		font-size: 75%;
	}

	.table__individual {
		overflow-x: scroll;
	}
	.num-col { min-width: unset; }
}