/*
 * July 18, 2020
 * (c) Fernando J. Leal, fjleal@easr.pt
 * Last change: Jan 05, 2021
 */

* {
	margin: 0;
	padding: 0;
	border: 0;
	box-sizing: border-box;
}

:root {
	--site-width: 1024px;
	--site-bg-color: #f0f0f0;
	--site-main-bg-color: #fff;
	--site-h1-color: #000;
	--site-h2-color: #101010;
	--site-h3-color: #606060;
	--site-footnote-color: #606060;
	--site-a-color: #606060;
	--site-a-hover-color: #909090;
	--site-h1-a-color: #303030;
	--site-h1-a-hover-color: #606060;
	--site-h2-a-color: #404040;
	--site-h2-a-hover-color: #707070;
	--site-h3-a-color: #909090;
	--site-h3-a-hover-color: #c0c0c0;
	--site-text-color: #303030;
	--site-grey-backgrounds: #fafafa;
	--site-grey-borders: #d0d0d0;
	--header-bg-color: rgba(240, 240, 240, .95);
	--footer-color: #606060;
	--pre-note-color: #909090;
	--figcaption-color: #404040;
}

@media (prefers-color-scheme: dark) {
	
	:root {
		--site-bg-color: #33302f;
		--site-main-bg-color: #38444b;
		--site-h1-color: #f0f4f7;
		--site-h2-color: #f0f4f7;
		--site-h3-color: #f0f4f7;
		--site-footnote-color: #f0f4f7;
		--site-a-color: #f0f4f7;
		--site-a-hover-color: #fff;
		--site-h1-a-color: #f0f4f7;
		--site-h1-a-hover-color: #fff;
		--site-h2-a-color: #f0f4f7;
		--site-h2-a-hover-color: #fff;
		--site-h3-a-color: #f0f4f7;
		--site-h3-a-hover-color: #fff;
		--site-text-color: #f4f7f9;
		--site-grey-backgrounds: #484547;
		--site-grey-borders: #787577;
		--header-bg-color: rgba(51, 48, 47, .95);
		--footer-color: #d4d7d9;
		--pre-note-color: #d4d7d9;
		--figcaption-color: #d4d7d9;
	}
	
}

body {
	background-color: var(--site-bg-color);
}

header, footer, main {
	width: 100%;
}

header {
	position: sticky;
	top: 0;
	background-color: var(--header-bg-color);
	z-index: 100;
}

header > div,
footer > div {
	justify-content: space-between;
}

header img {
	width: 130px;
	height: auto;
}

main {
	background-color: var(--site-main-bg-color);
}

footer div, footer p {
	font-family: sans-serif;
	font-size: 8pt;
	color: var(--footer-color);
}

section,
.content {
	width: 100%;
	max-width: var(--site-width);
	margin: 0 auto;
	padding: 20px;
}

h1 {
	font-family: serif;
	font-size: 24pt;
	font-weight: bold;
	line-height: 1.5;
	color: var(--site-h1-color);
	margin: 1em 0;
	scroll-margin-top: 110px;
}

h2 {
	font-family: serif;
	font-size: 20pt;
	font-weight: normal;
	line-height: 1.5;
	color: var(--site-h2-color);
	margin: 1em 0;
	scroll-margin-top: 110px;
}

h3 {
	font-family: serif;
	font-size: 16pt;
	font-weight: normal;
	line-height: 1.5;
	color: var(--site-h3-color);
	margin: 1em 0;
	scroll-margin-top: 110px;
}

body, p, li, dt, dd {
	font-family: serif;
	font-size: 14pt;
	font-weight: normal;
	line-height: 1.5;
	color: var(--site-text-color);
}

p, li, dt, dd {
	margin-bottom: 1em;
}

dt {
	font-weight: bold;
}

dd {
	margin-left: 5ex;
}

.footnote {
	font-size: 9pt;
	color:  var(--site-footnote-color);
}

section > ul {
	margin-left: 20px;
}

a,
a:link,
a:active,
a:visited {
	text-decoration: none;
	color: var(--site-a-color);
	border-bottom: 1px dashed;
}
a:hover {
	color: var(--site-a-hover-color);
	border-bottom-style: solid;
}

h1 a,
h1 a:link,
h1 a:active,
h1 a:visited {
	color: var(--site-h1-a-color);
}
h1 a:hover {
	color: var(--site-h1-a-hover-color);
}

h2 a,
h2 a:link,
h2 a:active,
h2 a:visited {
	color: var(--site-h2-a-color);
}
h2 a:hover {
	color: var(--site-h2-a-hover-color);
}

h3 a,
h3 a:link,
h3 a:active,
h3 a:visited {
	color: var(--site-h3-a-color);
}
h3 a:hover {
	color: var(--site-h3-a-hover-color);
}

pre {
	display: block;
	background-color: var(--site-grey-backgrounds);
	border: 1px solid var(--site-grey-borders);
	padding: 30px;
	margin-bottom: 1em;
}

pre, code {
	font-family: monospace;
	font-size: 10pt;
	white-space: pre-wrap;
	tab-size: 3;
}

pre .note {
	font-style: italic;
	color: var(--pre-note-color);
}

table {
	border-collapse: collapse;
	margin-bottom: 1em;
}

thead {
	border-bottom: 1px solid var(--site-grey-borders);
}

th {
	text-transform: uppercase;
}

th, td {
	font-family: serif;
	font-size: 13pt;
	font-weight: normal;
	line-height: 1.5;
	color: var(--site-text-color);
	padding: 3px;
}

tr:nth-of-type(even) {
	background-color: var(--site-grey-backgrounds);
}

figure {
	margin-bottom: 1em;
}
figure > img {
	width: 100%;
	height: auto;
}
figure > figcaption {
	font-family: serif;
	font-size: 11pt;
	text-align:  center;
	color: var(--figcaption-color);
}

#index ul li {
	margin-left:  20px;
	margin-bottom:  0;
	line-height:  1.6;
}

#index h1 {
	margin-top: 0;
}

/*
 * Burger menu styles
 */

#burger {
	width: 48px;
	height: 48px;
	position: relative;
	display: none;
}

#burger:hover {
	cursor: pointer;
}

#burger div {
	position: absolute;
	border-radius: 3px;
	width: 40px;
	height: 6px;
	background-color: var(--site-a-color);
	left: 4px;
	transition: rotate .5s, opacity .5s ease-in-out;
}

#burger div:first-of-type {
	top: 10px;
	transform-origin: left top;
}

#burger div:nth-of-type(2) {
	top: 21px;
}

#burger div:last-of-type {
	bottom: 10px;
	transform-origin: left bottom;
	
}

/*
 * NAV styles
 */

nav {
	display: flex;
	align-items: flex-end;
}

nav ul {
	list-style-type: none;
	display: flex;
}

nav ul li {
	margin: 0;
}

nav ul li a,
nav ul li a:link,
nav ul li a:active,
nav ul li a:visited {
	font-family: sans-serif;
	font-size: 12pt;
	text-transform: uppercase;
	display: block;
	white-space: nowrap;
	padding: 5px 20px;
	line-height: 1.5;
	color: var(--site-text-color);
	text-decoration: none;
	border: 0;
	position: relative;
}

nav ul li a:hover {
	color: var(--site-main-bg-color);
}

nav ul li a div {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0;
	background-color: var(--site-text-color);
	transition: width .1s;
	z-index: -1;
}

nav ul li a:hover div {
	width: 100%;
}

@media (max-width: 600px) {
	
	nav {
		align-items: center;
	}
	nav ul {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 0;
		overflow:  hidden;
		background-color: var(--header-bg-color);
		flex-direction: column;
		align-items: center;
		z-index: 100;
		transition: height .5s;
	}
	
	nav ul li:first-of-type {
		padding-top:  70px;
	}
	
	nav ul li {
		width: 80%;
	}
	
	nav ul li a,
	nav ul li a:link,
	nav ul li a:visited,
	nav ul li a:active,
	nav ul li a:hover {
		padding-top: 20px;
		padding-bottom: 20px;
		font-size: 16pt;
		text-align: center;
	}
	
	#burger {
		display: block;
	}
	
}

/*
 * ASIDE and "#exXXX" styles
 */

aside {
	width: 80%;
	margin: 2em auto;
	background-color: #c0c0c0;
	border: 1px solid #c0c0c0;
}

aside h1 {
	font-family: sans-serif;
	font-size: 16pt;
}

aside h2 {
	font-family: sans-serif;
	font-size: 14pt;
}

aside h3 {
	font-family: sans-serif;
	font-size: 12pt;
}

aside p,
aside li {
	font-family: sans-serif;
	font-size: 10pt;
}

aside #ex001 {
	width: 100%;
	max-width: 600px;
	margin: 10px auto;
	background-color: var(--site-main-bg-color);
	padding: 40px 10px;
	min-height: 50vh;
}

aside #ex001 h1 {
	text-align: center;
	margin-bottom: 2ex;
	color: var(--site-h1-color);
}

aside #ex001 h2 {
	text-align: center;
	margin-bottom: 2ex;
	color: var(--site-h2-color);
}

aside #ex001 p {
	text-align: center;
	color: var(--site-text-color);
}

aside #ex002 .main {
  width: 100%;
}

aside #ex002 .main:nth-of-type(even) {
  background-color: #fff;
}

aside #ex002 .main:nth-of-type(odd) {
  background-color: lime;
}

aside #ex002 .main > .centered {
  max-width: 600px;
  margin: 0 auto;
  padding: 40px 10px;
  border: 1px dashed grey;
}

aside #ex002 h1 {
  text-align: center;
  margin-bottom: 2ex;
  color: #000;
}

aside #ex002 h2 {
  text-align: center;
  margin-bottom: 2ex;
  color: #202020;
}

aside #ex002 p {
  text-align: center;
  color: #303030;
}

#ex003 > div > div > div,
#ex004 > div > div > div {
	border: 1px solid var(--site-grey-borders);
	width: 100%;
	margin-bottom: 20px;
	padding: 50px;
}

#ex003 .um,
#ex004 .um {
	background-color: cyan;
	color: var(--site-main-bg-color);
}

#ex003 .dois,
#ex004 .dois {
	background-color: yellow;
	color: var(--site-main-bg-color);
}

#ex003 .tres,
#ex004 .tres {
	background-color: orange;
	color: var(--site-main-bg-color);
}

#ex004 .dois {
	position: relative;
	top: 20px;
	left: 20px;
}

#ex005 > div > div {
	position: relative;
}

#ex005 > div > div >img {
	width: 100%;
	height: auto;
	display: block;
}

#ex005 > div > div > h1 {
	font-family: sans-serif;
	font-size: 24pt;
	color: #fff;
	font-weight: bold;
	display: block;
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	z-index: 10;
	white-space: nowrap;
	margin: 0;
	text-shadow: 2px 2px #000;
}

#ex006 {
	width: 100%;
	background-color: yellow;
	color: var(--site-bg-color);
	padding: 1ex;
	margin-bottom: 1em;
}

#ex006 > div {
	background-color: #606060;
	color: var(--site-bg-color);
	padding: 1ex;
}

#ex006 > div > div {
	background-color: cyan;
	color: var(--site-bg-color);
	padding: 1ex;
}

#ex006 > div > div > div {
	background-color: #fff;
	color: var(--site-bg-color);
	padding: 1ex;
}

#ex007 {
	display: flex;
	border: 1px solid #ccc;
	padding: 10px;
	background-color: yellow;
	justify-content: space-around;
}

#ex007 > div {
	border: 1px solid #ccc;
	padding: 20px;
	font-family: sans-serif;
	background-color: white;
}

#ex008 {
	display: grid;
	border: 1px solid #ccc;
	grid-template-rows: 50px auto 50px;
	grid-template-columns: auto 100px;
	min-height: 220px;
	grid-gap: 5px;
}

#ex008 > div {
	box-sizing: border-box;
	font-family: sans-serif;
	font-size: 12pt;
	padding: 1ex;
}

#ex008 > div:first-of-type {
	border: 1px solid #ccc;
	background-color: cyan;
	grid-row: 1;
	grid-column: 1/span 2;
}

#ex008 > div:nth-of-type(2) {
	border: 1px solid #ccc;
	background-color: yellow;
	grid-row: 2;
	grid-column: 1;
}

#ex008 > div:nth-of-type(3) {
	border: 1px solid #ccc;
	background-color: orange;
	grid-row: 2;
	grid-column: 2;
}

#ex008 > div:last-of-type {
	border: 1px solid #ccc;
	background-color: cyan;
	grid-row: 3;
	grid-column: 1/span 2;
}

#ex009 {
	width: 200px;
	height: 100px;
	border: 1px solid black;
	background-color: cyan;
	transition: width 1s;
}
#ex009:hover {
	width: 300px;
}

@keyframes example {
	0% { transform: rotate(0); }
	25% { transform: rotate(90deg); }
	50% {transform: rotate(180deg); }
	75% { transform: rotate(270deg); }
	100% { transform: rotate(360deg); }
}
#ex010 {
	width: 100px;
	height: 100px;
	border: 1px solid black;
	background-color: yellow;
}
#ex010:hover {
	animation-name: example;
	animation-duration: 2s;
	animation-iteration-count: infinite;
}

#svg1_14_0 {
	display: block;
	margin: 2em auto;
}

svg text {
	fill: var(--site-text-color);
}

/*
 * Convenience styles
 */

.typography {
	width: 100%;
	height: 520px;
}

/* Generic flex class */
.flex {
	display: flex;
}

/* Flex class for 2 objects with 49% width each, space-between and responsive. */
.flex2 {
	display: flex;
	justify-content: space-between;
}

.flex2 > * {
	width: 49%;
}

.flex2 > img,
.flex2 > * > img {
	width: 100%;
	height: auto;
}

@media (max-width: 800px) {
	
	.flex2 {
		flex-wrap: wrap;
	}
	
	.flex2 > * {
		width: 100%;
	}
	
}

.vertical-align-top {
	vertical-align: top;
}

.vertical-align-top-table th,
.vertical-align-top-table td {
	vertical-align: top;
}

.centered {
	display: block;
	margin-left: auto;
	margin-right: auto;
}

.centered-text {
	text-align: center;
}
