:root {
	--PluralityGray: 89, 89, 89;	/* #cccccc */
	--FairVotePurple: 85, 50, 133; 	/* #553285 */
	--ApprovalGreen: 10, 102, 10; 	/* #1a4345 = 26, 67, 69;	#4e6f70 = 78, 111, 112 */
	--ScoreBlue: 0, 92, 230;		/* #005ce6 */
	--STAR-Red: 204, 0, 0;			/* #cc0000 */
}

/* common and general styles */
body {	background: #fff;	}
hr {		margin-bottom: 0.8em;	}

@media print {			/* displays a link's URL when printed */
	a[href]:after {
		content: " (" attr(href) ") ";
	}
}

h3 {	margin-top: 1em;	}
@media screen and (min-width: 500px) {
	h3 {	margin-top: 0;	}
}

h4 {
	font-family: Arial, sans-serif;
	background-color: rgb(var(--rgb));
	color: #fff;
	padding: 0.15em;
	/* should probably be 1.2em, but 1.25 looks better on chrome, and isn't a noticeable issue on FF */
	line-height: 1.25em;	
	position: relative;
	display: table;
	margin: 0;
}
h4::after {
	content: "";
	display: block;
	position: absolute;
	bottom: 0;
	left: 100%;
	width: 0;
	height: 0;
	border-right: 1em solid transparent;
	border-bottom: 1.5em solid rgb(var(--rgb));	/* #5fce5f */
}

p {		margin-top: 2px;	}
sup {
	font-size: 0.7em;
	line-height: 0;
}

table {
	margin: 0 auto;
	background: rgb(var(--rgb));
	color: #fff;
}
th, td {
	border:	0.5px solid black;
	padding: 5px;
	width: 21px;	/* may want to make this a relative value at some point */
	text-align: center;
}

header :visited, header :link {	color: #000;	}

/* color classes */
/* credit to BoltClock on SO for this usage of css vars */
.plurality {	--rgb: var(--PluralityGray);	}
.approval {	--rgb: var(--ApprovalGreen);	}
.IRV {		--rgb: var(--FairVotePurple);	}
.score {	--rgb: var(--ScoreBlue);		}
.STAR {		--rgb: var(--STAR-Red);			}
/* end color classes */

.stripeOut {	background: repeating-linear-gradient(45deg, #aaaaaa, #aaaaaa 2px, #000 4px, #000 5px);	}

#nav-banner {
	display: flex;
	background: #fff;
	align-items: center;
	flex-direction: column;
}
#nav-banner h3 {
	width: auto;
	margin: 0;
}
#nav-list {
	display: table;
	width: 100%;
}

.horizontal {
	display: flex;
	justify-content: space-evenly;
	flex-wrap: wrap;
}
.horizontal button {	width: 47%;	}

h2 {	text-align: center;	}

header a {
	padding: 4px;
	text-decoration: none;
	font-size: 1.17em;
	display: table-cell;
	text-align: center;
	vertical-align: middle;
	border-radius: 10px;
	background: rgba(var(--rgb), 0.6);
}

#nav-list a:hover, a.active-link {
	background-color: rgba(var(--rgb), 1);
	color: #fff;
}

#simple-plurality-link::after {	content: "FPTP";	}
#approval-link::after {	content: "AV";	}
#IRV-link::after {	content: "IRV / RCV";	}
#score-link::after {	content: "Score / Range";	}

main {
	display: flex;
	flex-direction: column;
	padding: 0 10px;
	justify-content: space-around;
	flex-wrap: nowrap;
}

@media screen and (min-width: 500px) {
	#nav-banner {	flex-direction: row;	}
	#nav-banner h3 {
		width: 30%;
		margin: 0 0 0 8px;
	}
	#nav-list a {	padding: 1em 16px;	}
	#simple-plurality-link::after {	content: "Simple Plurality";	}
	#approval-link::after {	content: "Approval";	}
	#IRV-link::after {	content: "Instant Runoff / Ranked Choice";	}
	main {	flex-direction: row;	}
	h2 {
		margin: 10px 0;
		text-align: unset;
	}
}

main > div {	margin: 0 0 20px 0;	}

@media screen and (min-width: 500px) {
	main > div {	margin: 0 10px 20px 10px;	}
	main {	padding: 0 16px;	}
}

/* Plurality voterInfo / instructions */
#voterInfo {	max-width: 500px;	}
.table-holder {
	max-width: 100%;
	overflow-x: auto;
}

/* ballot table */
/* this section could be better organized... */
table.plurality {	border-collapse: collapse;	}

#scroll-container {
	min-width: 200px;	/* this value prevents the table from being hidden */
	/*padding: 0 10px 0 0;*/
	overflow-y: auto;
	overflow-x: hidden;
	max-height: 65vh;
}

thead, tfoot, tr, th, td {	background: inherit;	}
#ballots {	border-spacing: 0;	}

/* border-spaceing: 0, and border-collapse: separate, is the best I have found that
works on chrome and FF... */
.sticky-table thead, .sticky-table tfoot {	position: sticky;	}
.sticky-table thead {
	top: 0;
	z-index: 2;
}
.sticky-table tfoot {	bottom: 0;	}

/* Styles needed for Chrome: */
.sticky-table thead *, .sticky-table tfoot td { position: sticky}
.sticky-table thead th {	top: 0;	}
.sticky-table thead td {	top: 1.9em;	}	/* this should be the height of the first row... */
.sticky-table tfoot td {	bottom: 0;	}

td > input {	width: 45px;	}
td input[type=number] {	appearance: textfield;	}
thead [onclick] {	cursor: pointer;	}

/* css checkmark */
.checkmark {
	display: inline-block;
	position: relative;
}

.checkmark::after {
	position: absolute;
	display: block;
	content: "";
	height: 11px;
	width: 5px;
	border: solid white;
	border-width: 0 3px 3px 0;
	border-radius: 2px;
	left: calc(50% - 4px);
	top: calc(50% - 8px);
	transform: rotate(40deg);
}

/* 1D spectrum */
.scale {
	display: block;
	margin: 8px auto;
	width: 60%;
}
svg > line {	
	stroke-linecap: round;
	stroke-linejoin: round;
}
svg > polyline {
	fill: transparent;
	stroke: black;
	stroke-linecap: round;
	stroke-linejoin: round;
	stroke-width: 2px;
}

/* candidate settings */
#candidate-settings {
	min-width: auto;
	max-width: 500px;
}
#candidate-settings.plurality {	max-width: 50%;	}
#table-dir::after {    content: "above";  }

@media screen and (min-width: 500px) {
	#table-dir::after {	content: "on the left";	}
	#candidate-settings {	min-width: 340px;	}
}

#cand-key {	margin-bottom: 10px;	}
#cand-key h3 {
	margin: 0;
	border-bottom: 1px solid #000;
}

.c-controls {
	display: grid;
	grid-template: 2.5em auto / 12% auto;
}
.cs-title {
	text-align: center;
	grid-column: 2 / 3;
  grid-row: 1 / 2;
	margin: 0;
}
.cs-buttons {
	grid-column: 1 / 2;
	grid-row: 1 / 3;
  width: 40px;	/* should replace with relative value? */
	display: flex;
	flex-direction: column;
	align-items: center;
}
.cs-buttons input[type="number"] {
	width: 100%;
	min-width: 1.6ch;
	appearance: textfield;
	margin: 0 auto;
	text-align: center;
	font-size: 20px;
	box-sizing: border-box;
}
.circle {
	position: relative;
	flex-shrink: 0;
	width: 100%;
	aspect-ratio: 1/1;
	border-radius: 50%;
	background-color: rgb(var(--rgb));
	cursor: pointer;
}
.hbar:before {
	border-bottom: 3px solid #fff;
	content: "";
	position: absolute;
	display: block;
	width: 75%;
	height: 0;
	left: 12.5%;
	top: calc(50% - 1.5px);
}
.vbar:after {
	border-right: 3px solid #fff;
	content: "";
	position: absolute;
	display: block;
	width: 0;
	height: 75%;
	left: calc(50% - 1.5px);
	top: 12.5%;
}
/*	Candidate Selects	*/
.c-select {
	display: flex;
	flex-direction: column;
	align-items: center;
	position: relative;
	width: 15%;
	/*padding-left: 28px;
	/*margin-bottom: 12px;*/
	cursor: pointer;
	font-size: 22px;
	-webkit-user-select: none;
	-moz-user-select: none;
	user-select: none;
}
#candidate-selects {
	grid-column: 2 / 3;
  grid-row: 2 / 3;
	padding: 0;	
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
}
/*	Custom Checkboxes for the candidates	*/
.c-select input[type="checkbox"]{
	position: absolute;
	opacity: 0;
	left: 0;
}
.checkbox {
	position: relative;
	width: 25px;
	aspect-ratio: 1;
	background-color: #ddd;
	border-radius: 5px;
}
.checkbox:after {
	content: "";
	position: absolute;
	display: none;
}
.c-select .checkbox:after {
	left: 9px;
	top: 5px;
	width: 5px;
	height: 10px;
	border: solid white;
	border-width: 0 3px 3px 0;
	-webkit-transform: rotate(45deg);
	-ms-transform: rotate(45deg);
	transform: rotate(45deg);
}
.c-select input:checked ~ .checkbox {	background-color: rgb(var(--rgb));	}
.c-select input:checked ~ .checkbox:after {	display: block;	}
.c-select p {
	margin: 2px 0 0 5px;
	text-align: center;
	font-size: 1.3em;
}

@media screen and (min-width: 500px){
	.c-controls {	grid-template: auto auto / 30% auto;	}
	.cs-buttons {
		flex-direction: row-reverse;
		width: 100%;
	}
	.circle {
		height: 80%;
		width: unset;
	}
	.c-select {	flex-direction: row;	}
}
button {
	background-color: rgb(var(--rgb));
	border: 2px solid #4d4d4d;
	border-radius: 13px;
	padding: 6px 4%;
	color: #fff;
	font-size: 16px;
	cursor: pointer;
	width: 60%;
	margin: 5px auto;
	display: block;
}
.stretch {
	letter-spacing: 10px;
	font-size: 20px;
}

.centered {	text-align: center;	}
#tally-rounds {	border-collapse: collapse;	}


/* 	information styles 	*/
#information {
	min-width: 50%;
	max-width: 800px;
}

span[onclick]{
	cursor: pointer;
	text-decoration: underline;
}

/*	footer styles	*/
footer {
	margin-top: 10px;
  margin-left: 5%;
}
footer ul {
	padding: 0; 
	margin-top: 8px;
}
footer li {	list-style-type: none;   }
