@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/AtkinsonHyperlegible-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Atkinson Hyperlegible';
  src: url('/fonts/AtkinsonHyperlegible-Bold.ttf') format('truetype');
  font-weight: bold;
}

@font-face {
  font-family: 'Tilt Warp';
  src: url('/fonts/TiltWarp-Regular-VariableFont_XROT\,YROT.ttf') format('truetype');
}

@font-face {
  font-family: 'Finger Paint';
  src: url('/fonts/FingerPaint-Regular.ttf') format('truetype');
}

@font-face {
  font-family: 'Jaro';
  src: url('/fonts/Jaro-Regular.ttf') format('truetype');
}

:root {
  --program-colour: rgb(250, 240, 231);
  --font: 'Atkinson Hyperlegible', Helvetica, Arial, sans-serif;
  --project-height: 30em;
}

/* Adapted from https://dev.to/whitep4nth3r/the-best-lightdark-mode-theme-toggle-in-javascript-368f?comments_sort=latest */
[data-theme="light"] {
  --bg-colour: #ffffff;
  --bg-colour-secondary: #555555;
  --text-colour: #000000;
  --text-colour-secondary: #3b3b3b;
  --code-bg-colour: #f3f3f3;
  --games-colour: rgb(76, 159, 248);
  --img-invert: invert(0%);
}

[data-theme="dark"] {
  --bg-colour: #2c2c2c;
  --bg-colour-secondary: #000000;
  --text-colour: #ffffff;
  --text-colour-secondary: #afafaf;
  --code-bg-colour: #1a1b26;
  --games-colour: rgb(179, 96, 7);
  --img-invert: invert(100%);
}

body {
  color: var(--text-colour);
  background-color: var(--bg-colour);
  font-family: var(--font);
  min-height: 100%;
  margin: 0;
}

a {
  text-decoration: none;
  cursor: pointer;
}

.programs a {
  color: var(--text-colour);
  background-color: var(--program-colour);
  border-radius: 1em;
  height: 15em;
  width: 15em;
  padding: 10px;
  display: flex;
  justify-content: center;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  box-shadow: 5px 7px 10px rgb(158, 158, 158);
  transition: 0.2s ease-out;
}

.program {
  align-self: center;
}

.programs {
  display: flex;
  gap: 2em;
  margin-top: 30vh;
  height: 20em;
  padding-left: 10px;
}

.container {
  width: 90%;
  margin: 0 auto;
}

h1 {
  font-size: 25px;
}

.header {
  height: 50%;
}

header.base, footer {
  background-color: var(--bg-colour-secondary);
}

.programs > div > .programs-hover {
  margin: -5px;
  border: 5px solid var(--games-colour);
  transition: 0.2s ease-in;
  transform: translateY(-10px);
}

.program > h1 {
  color: white;
  -webkit-user-select: none;
  user-select: none;
}

.centered {
  align-items: center;
  justify-content: center;
  text-align: center;
  margin-left: auto;
  margin-right: auto;
}

.icon > img {
  width: 2em;
  height: 2em;
  margin: 1em;
  transition: all 0.2s ease-in;
}

.icon > img:hover {
  transform: scale(1.2);
  transition: all 0.25s ease-out;
  cursor: pointer;
}

.games-hotbar {
  margin: 0.5em;
  display: flex;
  gap: 4em;
  -webkit-user-select: none;
  user-select: none;
}

.games-hotbar a {
  position: relative;
  display: flex;
  justify-content: center;
  width: 2em;
}

.hotbar-icon {
  padding: 0.6em;
  border: 2px solid black;
  border-radius: 100%;
  background-color: #efefef;
  transition: 0.1s ease-out;
}

.hotbar-name {
  visibility: hidden;
  text-decoration: none;
  color: var(--games-colour);
  position: absolute;
  width: max-content;
  top: 2em;
}

.hotbar-icon:hover {
  margin: -5px;
  border: 5px solid var(--games-colour);
  transition: 0.2s ease-in;
}

.hotbar-icon:hover + .hotbar-name {
  visibility: visible;
}

#mii {
  height: 8vh;
  border-radius: 100%;
  display: block;
  margin-left: auto;
  margin-right: auto;

}

main {
  display: flex;
  flex: 1;
  background-color: var(--bg-colour);
}

main > div {
  width: 100%;
  color: var(--text-colour);
  padding-top: 0.5em;
  padding-bottom: 1em;
}

#games-sep {
  width: 95%;
  margin-top: 2em;
  color: black;
}

#menu-controls {
  display: flex;
  gap: 0.5em;
  visibility: hidden;
  justify-content: flex-end;
}

#play {
  filter: var(--img-invert);
}

header.base {
  display: flex;
  position: sticky;
  top: 0;
  z-index: 1;
  height: 3em;
}

#home-nav {
  margin-left: auto;
  align-content: center;
}

#home-nav a {
  color: white;
  display: inline-block;
  width: 4em;
  text-align: center;
  padding: 1em;
  clip-path: polygon(20% 0%, 100% 0%, 80% 100%, 0% 100%);
  position: relative;
}

.navbar-selected {
  background-color: var(--bg-colour);
  color: var(--text-colour);
}

#home-nav a:last-child {
  clip-path: polygon(20% 0%, 100% 0%, 100% 100%, 0% 100%);
}

ul#projects-list > li {
  background-color: var(--bg-colour);
  list-style-type: none;
  text-align: left;
  padding: 1em;
  margin-top: 1em;
  margin-bottom: 1em;
  margin-left: 3em;
  margin-right: 3em;
  border: 2px solid var(--text-colour);
  border-radius: 10px;
}

li > h2 {
  margin: 0;
}

button {
  background-color: white;
  color: black;
  border: 2px solid grey;
  border-radius: 4px;
  font-family: var(--font);
  font-weight: bolder;
  height: 2em;
  width: 8em;
  cursor: pointer;
  transition: 0.25s ease-out;
}

button:hover {
  transform: scale(1.01);
  filter: brightness(90%);
}

.buttons {
  display: flex;
  gap: 1em;
}

.post-entry {
  display: block;
  color: var(--text-colour);
  margin: 1em;
  margin-left: 2em;
  text-align: left;
  width: fit-content;
}

.post-entry:hover {
  text-decoration: underline;
}

article {
  width: 70%;
  overflow-x: auto;
}

.post {
  text-align: left;
}

code, pre {
  white-space: pre-wrap;
}

.hljs {
  color: var(--text-colour) !important;
  background-color: var(--code-bg-colour) !important;
  border: 2px solid var(--bg-colour-secondary) !important;
  border-radius: 5px !important;
}

.toc {
  height: fit-content;
  margin-top: 6em;
  margin-right: 3em;
  position: sticky;
  top: 3.5em;
  z-index: 1;
}

.toc li {
  list-style-type: none;
  width: fit-content;
}

.toc a {
  color: var(--text-colour-secondary);
  padding-left: 10px;
  border: 2px solid transparent;
}

.toc a:hover {
  color: var(--text-colour);
  border-left: 2px solid var(--text-colour);
}

.post-with-toc {
  display: flex; 
  flex-direction: row;
}

h1[id]::before, h2[id]::before, h3[id]::before, h4[id]::before, h5[id]::before, h6[id]::before { /* Adapted from https://stackoverflow.com/questions/10732690/offsetting-an-html-anchor-to-adjust-for-fixed-header */
  content: '';
  display: block;
  height:      3em;
  margin-top: -3em;
  visibility: hidden;
}

@media screen and (max-width: 500px) {
  #home-nav {
    font-size: 10px;
  }

  #home-nav a {
    vertical-align: middle;
    padding: 1.8em;
  }

  article {
    width: 90%;
  }

  .post-with-toc {
    margin: 0em;
  }
}

@media screen and (max-width: 700px) {
  .toc {
    display: none;
  }

  .post-with-toc {
    display: block;
  }
}