@import url("https://fonts.googleapis.com/css2?family=PT+Serif:ital,wght@0,400;0,700;1,400;1,700&display=swap");

:root {
	--font-serif: "PT Serif", serif;
	/* --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; */
	--background: #fefefe;
	--foreground-1: #212121;
	--foreground-2: #3d3d3d;
	--accent: #0d47a1;
}

@media (prefers-color-scheme: dark) {
	:root {
		color-scheme: dark;
		--background: #111;
		--foreground-1: #f9f9f9;
		--foreground-2: #cccccc;
		--accent: #ffb300;
	}
	img.icon {
		filter: invert(1);
	}
}

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

html {
	font-family: var(--font-serif);
	scroll-behavior: smooth;
}

/* LISTS */

ul,
ol {
	list-style-position: inside;
}

/* LINKS */

a {
	color: var(--accent);
}
a:visited, a:hover {
	opacity: 0.8;
}
a:visited {
	text-decoration-style: dashed;
}

/* HEADINGS */

h1,
h2,
h3,
h4,
h5,
h6 {
	position: relative;
	line-height: 1.1;
}

h1::before,
h2::before,
h3::before,
h4::before,
h5::before,
h6::before {
	content: "#";
	position: absolute;
	left: -0.75em;
	color: var(--accent);
}

@media only screen and (max-width: 720px) {
	h1::before,
	h2::before,
	h3::before,
	h4::before,
	h5::before,
	h6::before {
		display: none;
	}
}

/* TEXTS */

hr {
	border: none;
	height: 3px;
	width: 20rem;
	margin: 1.5rem auto;
	background: var(--accent);
}

p {
	margin: 1rem 0;
}

h1,
h2,
h3,
h4,
h5,
h6 {
	color: var(--foreground-1);
	margin-top: 2rem;
	margin-bottom: 1.5rem;
}

h1 {
  font-size: 2.8rem;
}

h2 {
  font-size: 2.4rem;
}

h3 {
  font-size: 1.8rem;
}

h4 {
  font-size: 1.24rem;
}

h5 {
  font-size: 0.95rem;
}

h6 {
  font-size: 0.76rem;
}

@media only screen and (max-width: 720px) {
  h1 {
    font-size: 2.5rem;
  }

  h2 {
    font-size: 2.1rem;
  }

  h3 {
    font-size: 1.75rem;
  }

  h4 {
    font-size: 1.25rem;
  }
}

p,
h1,
h2,
h3,
h4,
h5,
h6 {
	overflow-wrap: break-word;
}

h1 {
	margin-top: 0;
}

/* LAYOUT */

body {
	font-size: 1.15rem;
	line-height: 1.5;
	color: var(--foreground-2);
	background-color: var(--background);
	display: grid;
	grid-template-columns: 1fr min(45rem, 90%) 1fr;
}

body > * {
	grid-column: 2;
}

@media print {
	body {
		display: block;
	}
}

/* HEADER & FOOTER */

body > header,
body > footer {
	padding: 2rem 0;
}
body > header {
	padding-bottom: 3rem;
}

body > footer p {
	line-height: 1.1;
}

body > header {
	display: flex;
	align-items: flex-end;
	justify-content: space-between;
	gap: 1.5rem;
}
body > header > nav > ul {
	list-style: none;
	margin: 0;
	display: flex;
}
body > header > nav > ul > li:not(:last-child) {
	margin-right: 0.75rem;
}
body > header > nav > ul > li > a {
	color: var(--foreground-1);
	font-weight: bold;
	text-decoration-thickness: 2px;
	text-decoration-color: var(--accent);
}

body > footer {
	text-align: center;
	font-size: smaller;
}

body > main::after,
body > main::before {
	content: "";
	left: 0;
	right: 0;
	margin: auto;
	display: block;
	width: 5rem;
	border-bottom: var(--accent) solid 0.5rem;
}
body > main::after {
	margin-top: 3rem;
}
body > main::before {
	margin-bottom: 3rem;
}

/* HEADER TITLE */

body > header > h1 {
	position: relative;
	display: inline-block;
	margin-bottom: 0;
	letter-spacing: -0.1rem;
	color: var(--foreground-1);
	cursor: pointer;
	font-style: italic;
}
body > header > h1::before {
	content: none;
}

body > header > h1 {
	--a: -45deg; /* angle */
	--t: 0.2em; /* thickness */
	--c: var(--accent); /* color */
	transition: .3s;
}
body > header > h1 > span {
	transition: .3s;
	--s: calc(var(--t) * cos(var(--a)));
	background: linear-gradient(
			var(--a),
			#0000 var(--s),
			var(--c) 0 calc(100% - var(--s)),
			#0000 0
		)
		bottom / var(--i, 85%) var(--t) no-repeat;
	padding: 0.3rem 0;
	box-decoration-break: clone;
	-webkit-box-decoration-break: clone;
}
body > header > h1:hover > span {
	--i: 100%;
}
