/* Reset a couple of things for the sake of ease */
* {
  padding: 0;
  margin: 0;
}

/* Variables */
/* Dark by default */
:root {
  --color-background: #151515;
  --color-background-alternative: #4f4f4f;
  --color-text-default: #f0f0f0;
  --color-text-alternative: #808080;
  --color-accent-1: #f1c40f;
  --color-accent-2: #9b59b6;
  --color-accent-3: #1abc9c;
}

/* If the user has set a preference, respect it */
@media (prefers-color-scheme: light) {
  :root {
    --color-background: #f0f0f0;
    --color-background-alternative: #afafaf;
    --color-text-default: #0e0e0e;
    --color-text-alternative: #4f4f4f;
    --color-accent-1: #3498db;
    --color-accent-2: #2ecc71;
    --color-accent-3: #e74c3c;
  }
}

/* Class-based switching for overriding the system preference */
.light {
  --color-background: #f0f0f0;
  --color-background-alternative: #afafaf;
  --color-text-default: #0e0e0e;
  --color-text-alternative: #4f4f4f;
  --color-accent-1: #3498db;
  --color-accent-2: #2ecc71;
  --color-accent-3: #e74c3c;
}

.dark {
  --color-background: #151515;
  --color-background-alternative: #4f4f4f;
  --color-text-default: #f0f0f0;
  --color-text-alternative: #808080;
  --color-accent-1: #f1c40f;
  --color-accent-2: #9b59b6;
  --color-accent-3: #1abc9c;
}
/* End variables */

/* General styles */
body {
  transition: color 0.5s, background-color 0.5s;
  background-color: var(--color-background);
  color: var(--color-text-default);
  line-height: 1.6em;
  letter-spacing: 0.025em;
  font-family: "Noto sans", sans-serif;
  font-weight: 300;
}

main {
  max-width: 50vw;
  margin: 3em auto;
  overflow: hidden;
  clear: both;
  display: block;
}

section {
  margin: 1rem;
}

code {
  font-size: 1em;
  padding: 0 0.2em;
  margin: 1em auto 2em auto;
  font-family: "Hack", monospace;
  background-color: var(--color-background-alternative);
}

article {
  display: flex;
  flex-flow: row;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: stretch;
  background-color: var(--color-background-alternative);
  padding: 1em;
  margin: 1rem;
}

article h2 {
  font-family: "NotoSerif", serif;
  margin: 0;
  flex: 1;
}

article p {
  flex: 1;
  margin: 0;
  font-size: 0.8em;
}

section img {
  display: block;
  margin: 2em auto 0.2em auto;
  max-width: 100%;
}

section img + em {
  font-family: "NotoSerif", serif;
  font-size: 0.8em;
  text-align: center;
  display: block;
}

h1 {
  display: inline-block;
  font-family: "NotoSerif", serif;
  font-size: 2.4em;
  letter-spacing: 0.05em;
  line-height: 1.6em;
}

h2 {
  color: var(--color-text-alternative);
  font-family: "NotoSans", sans-serif;
  font-weight: 400;
  font-size: 1.2em;
  margin: 2em 0 1em 0;
}

h3 {
  display: block;
  margin: 1.6em 0 1em 0;
  font-family: "NotoSans", sans-serif;
  font-weight: bold;
  font-weight: 400;
  letter-spacing: 0.025em;
  font-size: 1em;
  line-height: 1.6em;
}

a,
a:active,
a:visited {
  background-color: var(--color-accent-1);
  color: var(--color-background);
  text-decoration: none;
  padding: 0 0.2em;
}

ul li {
  margin: 0.2em 0.2em 0.2em 2em;
  padding-left: 0.4em;
}

p {
  line-height: 1.75em;
  margin: 2em 0;
}

/* Footer */
footer {
  margin-top: 6em;
  padding: 2em 0;
  color: var(--color-text-default);
  display: flex;
  margin: 3em auto 3.5em auto;
  max-width: 82vw;
  display: flex;
  flex-flow: row;
  flex-wrap: wrap;
  align-items: stretch;
  justify-content: stretch;
}

footer p {
  display: inline-block;
  flex: 1;
  padding: 1em 0 0.5em 0;
  font-size: 0.75em;
  text-align: center;
  color: var(--color-text-alternative);
}

/* Styles for pseudo-button links */
.blocklink,
.blocklink:active,
.blocklink:visited {
  margin: 0.4em;
  border: 0.4em solid;
  border-color: var(--color-accent-3);
  background-color: var(--color-background);
  text-decoration: none;
  padding: 0.2em 0.5em;
  text-transform: uppercase;
  float: right;
  color: var(--color-text-default);
  font-weight: bold;
}

/* Header */
header {
  margin: 3vw auto 2vw auto;
  display: flex;
  flex-flow: row;
  max-width: 80vw;
  padding: 1em;
  flex-wrap: wrap;
}

.breadcrumb {
  font-size: 0;
  font-family: "Hack", monospace;
  flex: 8;
  list-style-type: none;
  display: flex;
  flex-direction: row;
  align-items: center;
  flex-wrap: wrap;
  margin-bottom: 1vw;
}

.breadcrumb li {
  padding: 0;
  margin: 0;
}

.breadcrumb a {
  flex: 1;
  padding: 0;
  padding-left: 1em;
  padding-right: 2em;
  margin: 0;
  position: relative;
  line-height: 2rem;
  font-size: 1rem;
  color: var(--color-background);
}

.breadcrumb a:after {
  content: "";
  display: inline-block;
  width: 0;
  height: 0;
  position: absolute;
  right: 0;
  top: 0;
}

.breadcrumb a:nth-child(1n + 1) {
  background-color: var(--color-accent-1);
}

.breadcrumb a:nth-child(2n + 1) {
  background-color: var(--color-accent-2);
}

.breadcrumb a:nth-child(3n + 1) {
  background-color: var(--color-accent-3);
}

.breadcrumb a:nth-child(1n + 1):after {
  border-top: 1rem solid var(--color-accent-2);
  border-bottom: 1rem solid var(--color-accent-2);
  border-left: 1rem solid transparent;
}

.breadcrumb a:nth-child(2n + 1):after {
  border-top: 1rem solid var(--color-accent-3);
  border-bottom: 1rem solid var(--color-accent-3);
  border-left: 1rem solid transparent;
}

.breadcrumb a:nth-child(3n + 1):after {
  border-top: 1rem solid var(--color-accent-1);
  border-bottom: 1rem solid var(--color-accent-1);
  border-left: 1rem solid transparent;
}

.breadcrumb a:last-child {
  border: none;
  padding-right: 1rem;
}

.breadcrumb a:last-child:after {
  border: none;
  display: none;
}

/* Dark/light mode switches */
.switches {
  display: flex;
  align-content: space-around;
  align-items: flex-start;
  justify-content: flex-start;
  flex: 1;
  margin-bottom: 1vw;
}

.switches svg {
  height: 1.4em;
  width: 1.4em;
}

.lightswitch,
.darkswitch {
  display: flex;
  align-content: space-around;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 0;
  color: var(--color-background);
  height: 2em;
  width: 2em;
}
.lightswitch {
  background-color: var(--color-background-alternative);
  color: var(--color-text-default);
}
.darkswitch {
  background-color: var(--color-accent-3);
}

@media (prefers-color-scheme: light) {
  .darkswitch {
    background-color: var(--color-background);
    background-color: var(--color-background-alternative);
    color: var(--color-text-default);
  }
  .lightswitch {
    background-color: var(--color-accent-3);
  }
}
.light .darkswitch {
  background-color: var(--color-background-alternative);
  color: var(--color-text-default);
}
.light .lightswitch {
  background-color: var(--color-accent-3);
}

/* To display uls as a file tree-like list */

.filetree {
  margin-bottom: 3em;
}

.filetree,
.filetree ul,
.filetree li {
  position: relative;
}

.filetree li {
  margin: 0.6em 0;
}

.filetree ul {
  list-style: none;
  padding-left: 3.2em;
}
.filetree li::before,
.filetree li::after {
  content: "";
  position: absolute;
  left: -1.2em;
}
.filetree li::before {
  border-top: 0.1em solid var(--color-text-default);
  top: 0.8em;
  width: 0.8em;
  height: 0;
}
.filetree li::after {
  border-left: 0.1em solid var(--color-text-default);
  height: 2.6em;
  width: 0;
  top: 0.2em;
}
.filetree ul > li:last-child::after {
  height: 0.7em;
}

/* Contact card */
.contact-card li {
  display: inline;
  margin: 0 1em 1em 0;
  padding-left: 0;
}

.contact-card svg {
  height: 1.4em;
  width: 1.4em;
  margin-right: 0.4em;
}

.contact-card a {
  display: inline-flex;
  flex-direction: row;
  align-content: space-around;
  align-items: center;
  justify-content: flex-start;
  text-decoration: none;
}

.article-meta {
  display: flex;
  padding-top: 4em;
  font-size: 0.8em;
  flex-direction: column;
}

.article-meta span {
  display: inline-block;
  flex: 1;
}

.no-margin {
  margin: 0;
}

/* Smaller screen tweaks */
@media screen and (max-width: 940px) {
  body {
    font-size: 22px;
  }

  .switches button {
    font-size: 22px;
  }

  main {
    max-width: 90vw;
    margin: 2em auto;
  }

  article {
    flex-flow: column;
  }

  article p {
    margin-top: 1em;
  }

  header {
    max-width: 90vw;
    margin-bottom: 2em;
    flex-flow: column;
  }

  footer {
    flex-flow: column;
    max-width: 90vw;
  }
  footer p {
    border-bottom: none;
  }
}

/* Fonts */
@font-face {
  font-family: "Noto sans";
  src: local("Noto Sans Regular"), local("Noto Sans"),
    url("/fonts/notosans-regular.woff2") format("woff2"),
    url("/fonts/notosans-regular.woff") format("woff"),
    url("/fonts/notosans-regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hack";
  src: local("Hack Regular"), local("Hack"),
    url("/fonts/hack-regular.woff2") format("woff2"),
    url("/fonts/hack-regular.woff") format("woff"),
    url("/fonts/hack-regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Hack";
  src: local("Hack Italic"), local("Hack-Italic"),
    url("/fonts/hack-italic.woff2") format("woff2"),
    url("/fonts/hack-italic.woff") format("woff"),
    url("/fonts/hack-italic.ttf") format("truetype");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "Hack";
  src: local("Hack Bold"), local("Hack-Bold"),
    url("/fonts/hack-bold.woff2") format("woff2"),
    url("/fonts/hack-bold.woff") format("woff"),
    url("/fonts/hack-bold.ttf") format("truetype");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "NotoSerif";
  src: local("NotoSerif Regular"), local("NotoSerif"),
    url("/fonts/notoserif-regular.woff2") format("woff2"),
    url("/fonts/notoserif-regular.woff") format("woff"),
    url("/fonts/notoserif-regular.ttf") format("truetype");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

/* Arta HighlightJS theme */
.hljs {
  display: block;
  overflow-x: auto;
  padding: 0.5em;
  background: #222;
}
.hljs,
.hljs-subst {
  color: #aaa;
}
.hljs-section {
  color: #fff;
}
.hljs-comment,
.hljs-quote,
.hljs-meta {
  color: #444;
}
.hljs-string,
.hljs-symbol,
.hljs-bullet,
.hljs-regexp {
  color: #ffcc33;
}
.hljs-number,
.hljs-addition {
  color: #00cc66;
}
.hljs-built_in,
.hljs-builtin-name,
.hljs-literal,
.hljs-type,
.hljs-template-variable,
.hljs-attribute,
.hljs-link {
  color: #32aaee;
}
.hljs-keyword,
.hljs-selector-tag,
.hljs-name,
.hljs-selector-id,
.hljs-selector-class {
  color: #6644aa;
}
.hljs-title,
.hljs-variable,
.hljs-deletion,
.hljs-template-tag {
  color: #bb1166;
}
.hljs-section,
.hljs-doctag,
.hljs-strong {
  font-weight: bold;
}
.hljs-emphasis {
  font-style: italic;
}
