@font-face {
  font-family: "Iosevka Gothic";
  src: url(../fonts/iosevka-gothic-regular.woff2);
  font-weight: normal;
}

body {
  position: absolute;
  display: flex;
  left: 50%;
  -webkit-transform: translate(-50%, 0);
  transform: translate(-50%, 0);

  padding-top: 2em;
  padding-bottom: 2em;
}

/* headers */

#mainheader {
  font-size: 2.6em;
}

#mainheader::first-letter {
  font-size: 1.2em;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  color: var(--accent);
  font-family: "Cinzel Decorative";
  font-weight: normal;
  line-height: 1;
}

h1 {
  font-size: 35px;
}

h1::first-letter {
  font-size: 40px;
}

h2 {
  font-size: 25px;
}

h3 {
  font-size: 20px;
}

/* common text */

p,
ul,
ol,
table {
  color: var(--text);
  font-family: "Crimson", serif;
  font-size: 1.2rem;
  max-width: 1000px;
}

strong {
  font-weight: bolder;
  text-shadow: 0 0.5px;
}

/* why'd you leave the keys upon the table */

table {
  border-collapse: collapse;
  max-width: 700px;
  padding: 5px;
  border: 2px solid var(--border);
}

td {
  border: 2px solid var(--border);
  padding: 0 5px;
}

/* code blocks */

code * {
  font-size: 1rem;
  font-family: "Iosevka Gothic";
}

:not(pre) > code {
  padding: 2px;
  border-radius: 3px;
  font-family: "Iosevka Gothic";
}

img {
  display: block;
  margin: 5px auto;
  border-radius: 2px;
  border: 15px solid var(--bg-code);
  filter: drop-shadow(0 0 5px var(--bg));
}

pre {
  overflow-x: auto;
}

.lineno {
  user-select: none;
  -webkit-user-select: none;
}

.highlight {
  padding: 0 5px;
  border-radius: 5px;
  background-color: var(--bg-code);
}

.nolinenum .lineno,
.nolinenum .rouge-gutter {
  visibility: hidden;
  width: 0;
  padding: 0;
}

/* breaks */
hr {
  color: var(--accent);
  margin: 20px 2% 0 2%;
  text-align: center;
  border: none;
  border-top: 1px solid;
  overflow: visible;
  counter-increment: item-counter;
}

hr:after {
  content: counter(item-counter, upper-roman);
  padding: 0 4px;
  position: relative;
  top: -13px;
  font-size: 10px;
  background: var(--bg);
}

/* header anchors */

a[class="anchor"]::before {
  display: none;
}

a[class="anchor"] span {
  content: url(../assets/anchor.svg);
  margin-right: 5px;
  margin-left: -25px;
  margin-bottom: 2px;
  opacity: 0%;
  transition: opacity 0.2s ease-in-out;
  user-select: none;
  -webkit-user-select: none;
}

@media (prefers-color-scheme: light) {
  a[class="anchor"] span {
    content: url(../assets/anchor-light.svg);
  }
}

:is(h1, h2, h3, h4, h5, h6):hover a[class="anchor"] span {
  opacity: 80%;
  transition: opacity 0.2s ease-in-out;
}

a {
  font-family: "Crimson";
  font-weight: normal;
  text-decoration: none;

  color: var(--url);
}

.contents a::before {
  content: "◆";
  font-size: 0.5em;
  padding-right: 3px;
  position: relative;
  bottom: 4px;
}

a:hover {
  animation: glow 0.2s ease-in-out both;
}

/* animations */

@keyframes glow {
  from {
    font-weight: normal;
  }

  to {
    filter: drop-shadow(0.5px 0.5px 2px);
  }
}

/* sidebar */

.side p {
  font-size: 1.5em;
  margin-bottom: 0;
}

.side a,
footer a {
  color: var(--text);
  filter: brightness(90%);
  text-decoration: none;
}

.side a:hover {
  animation: none;
  text-decoration: underline;
}

.side ul {
  padding-left: 18px;
  margin-top: 6px;
}

.side li {
  list-style: none;
}

#toc {
  padding-bottom: 20px;
  width: 85%;
  border-bottom: 1px solid var(--text);
}

.contents {
  min-height: calc(100vh - 230px);
}

footer {
  display: flex;
  justify-content: space-between;
  width: 100%;
  margin-top: 2em;
  padding-top: 0.5em;
  border-top: 1px solid var(--text);
}

footer > * {
  font-size: 1.2em;
  margin-top: 1em;
}

footer div {
  display: grid;
  height: min-content;
}

/* large screens */

@media (min-width: 1330px) {
  .contents {
    max-width: 700px;
  }

  img {
    max-width: 95%;
  }

  .side {
    left: 100%;
    margin-left: 2em;
    margin-top: 100px;
    position: absolute;
    width: 270px;
  }
}

/* small screens */

@media (max-width: 1330px) {
  body {
    display: unset;
    max-width: 800px;
  }

  img {
    width: 90%;
  }

  footer {
    display: none;
  }
}

/* smaller screens */

@media (max-width: 830px) {
  body {
    width: 90%;
  }

  .side {
    height: auto;
    margin: auto;
    position: relative;
    width: 90%;
  }

  a[class="anchor"] {
    float: right;
    margin-left: 21px;
  }
}
