/*
This is the CSS for a Wikimedia page stats webapp.
*/

@import url('https://cdnjs.cloudflare.com/ajax/libs/normalize/8.0.0/normalize.min.css');

body {
	background: #f5f5f5;
	font-family: "Arial", sans-serif;
	margin: 0;
	padding: 1em;
}

.loading {
	cursor: progress;
}

h1, h2 {
	border-bottom: 2px solid #ccc;
}

h1 {
	margin-top: 0;
}

#controls-container {
	display: flex;
	flex-wrap: wrap;
	justify-content: space-around;
}

#controls button {
	display: block;
	margin: 1em auto;
}

#controls fieldset {
	border: 2px solid #ccc;
	width: 45%;
	margin: 0;
	box-sizing: border-box;
}

#controls input {
	width: 100%;
}

#stats {
	text-align: center;
}

#chart {
	background: #f0f0f0;
	height: 50vh;
	max-width: 100%;
	display: inline-flex;
	align-items: flex-end;
	justify-content: center;
	position: relative;
}

.bar {
	background: #333;
	width: 1px;
}

.bar:hover {
	background: crimson;
	box-shadow: 0 0 0 1px crimson;
	position: relative;
}

.bar:hover:after, .bar:first-of-type:before, .bar:last-of-type:before {
	background: rgba(255, 255, 255, .85);
	color: crimson;
	position: absolute;
	/* do not wrap text */
	white-space: nowrap;
}

.bar:hover:after {
	/* date + views */
	content: attr(data-date) ": " attr(data-views) " views";
	/* position above bar */
	top: -1.5em;
}

.bar:first-of-type:before, .bar:last-of-type:before {
	/* date */
	content: attr(data-date);
	/* position below bar / chart */
	bottom: -1.5em;
}

.bar:hover:after, .bar:first-of-type:before, .bar:last-of-type:before {
	/* center text to bar */
	transform: translateX(-50%);
}

.bar-min {
	background: deeppink;
}

.bar-max {
	background: deeppink;
}

input {
	border: 1px solid #aaa;
}

input:invalid {
	border: 1px solid crimson;
	outline: 1px solid crimson;
	cursor: help;
	/* disable Firefox default box-shadow */
	box-shadow: none;
}

input:focus {
	/* disable Chrome default outline or something */
	/* https://stackoverflow.com/a/28918408 */
	outline-offset: 0;
}

a {
	color: dodgerblue;
}

footer {
	margin-top: 2em;
}

footer p {
	font-size: 75%;
	text-align: center;
}
