/* -------------------------------------------------- */

:root {
	/* Sidebar width experimentally set.
	 * Might need to change if content changes */
	--sidebar-width: 16em;
	--sidebar-margin: 1ex;

	--sidebar-animation-time: 0.3s;
	--sidebar-border-width: 3px;

	--sidebar-toggle-button-size: 2em;
}

body {
	font-family: monospace;
	margin: 0;
}

p {
	font-family: arial;
}

h1, h2, h3, h4, h5, h6 {
	font-family: monospace;
}

/* ------- General design --------------------------- */

.card {
	margin: 1em;
}

section .card {
	max-width: 80ch;
}

.card h1,
.card h3 {
	background-color: black;
	color: yellow;
	margin-top: 0;
	padding: 1ex;
	border-radius: 1ex;
}

section h2 {
	background-color: black;
	color: yellow;
	text-align: center;
	width: 100%;
}

#content section {
	display: flex;
	flex-direction: column;
	align-items: center;
}

#footer {
	padding: 1em;
}

#footer > div {
	padding-top: 1em;
	padding-left: 1em;
	padding-right: 1em;
	border-top: 1px solid gray;
}

/* ------- Language flag stuff ---------------------- */

#header-top {
	position: absolute;
	right: 0;
	top: 0;
	padding: 0.5em;
}

.flag img {
	max-height: 1.3em;
}

/* ------ Print changes ----------------------------- */

@media print {
	.noprint {
		display: none;
	}

	/* These href matches in order, with later taking prcedence.
	 * So the "raw" href MUST be first */

	#main a[href]::after {
		content: " (lysator.liu.se/" attr(href) ")";
	}

	#main a[href^="/"]::after {
		content: " (lysator.liu.se" attr(href) ")";
	}

	/* Display links when printing */
	#main a[href^="http"]::after {
		content: " (" attr(href) ")";
	}

}


/* ------ Sidebar ----------------------------------- */

/* Outerermost container for sidebar. Ensures that it's the
 * full height of the screen, and that it has a proper
 * background
 *
 * The sidebar is designed to stay put when the rest of the
 * page is scrolled, but allow internal scrolling.
 *
 * It also jumps between being the leftmost part of the
 * page, and being a slide-over sidebar, depending on the
 * page width.
 * */
#sidebar {
	background-color: black;
	text-align: center;
	min-height: 100vh;
	transition-property: left;
	transition-duration: var(--sidebar-animation-time);
}

/* Div helping the sidebar scroll correctly */
.scroll-helper {
	position: relative;
	height: auto;
	padding: 0;
	margin: 0;
	width: var(--sidebar-width);
}

/* The actuall contents of the sidebar */
#sidebar-content {
	position: fixed;
	overflow-y: auto;
	height: 100%;
	width: calc(var(--sidebar-width) - 2 * var(--sidebar-margin));
	margin: var(--sidebar-margin)
}

/* General styling for items in the sidebar follows 
 * */

#sidebar img {
	width: 80%;
}

#sidebar a {
	color: yellow;
}

#sidebar li a:hover {
	background-color: brown;
}

#sidebar ul {
	text-align: left;
	list-style: none;
	font-weight: bold;
	padding-left: 0;
}

#sidebar ul ul {
	padding-left: 1.5em;
}

#sidebar a {
	text-decoration: none;
}

.sidebar-toggle {
	position: absolute;
	right: calc(-1 * var(--sidebar-toggle-button-size));
	width:  var(--sidebar-toggle-button-size);
	height: var(--sidebar-toggle-button-size);
	display: block;
	border-radius: 0 0 1ex 0;
	border: none;
	background-color: black;
	color: white;
	font-size: 150%;
	border-right:  var(--sidebar-border-width) solid white;
	border-bottom: var(--sidebar-border-width) solid white;
}

.sidebar-toggle:active {
	color: yellow;
}

/* ------- Page layout ------------------------------ */

/*
See base.xml (just before the definition of `lyspage`) for a
general explanation.
*/

/* Main exists as a barries between the template, and our
 * content. Hence the display: contents.
 * (The navbar is in the template, while the columns are in
 * the page, and the need to share a grid)
 */
 
#main {
	display: contents;
}

#content {
	display: grid;
	grid-template-columns: auto 1fr 1fr;
	grid-template-rows:    auto 1fr auto;
}

#sidebar {
	grid-column: 1;
	grid-row: 1 / span 3;
}

#main .intro {
	grid-column: 2 / span 2;
	grid-row: 1;
}

#main .feed {
	/* background-color: pink; */
	grid-column: 3;
	grid-row: 2;
}

#main .static {
	/* background-color: lightblue; */
	grid-column: 2;
	grid-row: 2;
}

#footer {
	grod-row: 3;
	grid-column: 2 / span 2;
}

@media (min-width: 1000px) {
	.sidebar-toggle {
		display: none;
	}
}

@media (max-width: 1000px) {
	#sidebar {
		position: fixed;
		left: 0px;
		border-right: var(--sidebar-border-width) solid white;
	}

	#content {
		grid-template-columns: 1fr 1fr;
	}

	#main .intro {
		grid-column: 1 / span 2;
	}

	#main .feed {
		grid-column: 2;
	}

	#main .static {
		grid-column: 1;
	}

	#footer {
		grid-column: 1 / span 2;
	}
}

@media (max-width: 650px) {

	#content {
		grid-template-columns: 1fr;
		grid-template-rows: auto 1fr 1fr;
	}

	#main .feed {
		grid-column: 1;
		grid-row: 2;
	}

	#main .static {
		grid-column: 1;
		grid-row: 3;
	}

	#main .intro {
		grid-column: 1;
	}

	#footer {
		grid-row: 4;
		grid-column: 1;
	}
}

/* ------ Rijandel Easteregg ------------------------ */

.lock {
	display: block;
	position: fixed;
	right: 1ex;
	bottom: 1ex;
	background-color: beige;
	padding: 1ex;
	border-radius: 1ex;
}

.lock .hoverdata {
	display: none;
	font-size: 8pt;
}

.lock:hover .hoverdata {
	display: inline;
}

/* ------ Debugging items --------------------------- */

/*
#main > * {
	background-color: pink;
}

#footer {
	background-color: lightblue;
}
*/
