:root {
  --neutral-50: oklch(98.5% 0 0);
  --neutral-100: oklch(97% 0 0);
  --neutral-200: oklch(92.2% 0 0);
  --neutral-300: oklch(87% 0 0);
  --neutral-400: oklch(70.8% 0 0);
  --neutral-500: oklch(55.6% 0 0);
  --neutral-600: oklch(43.9% 0 0);
  --neutral-700: oklch(37.1% 0 0);
  --neutral-800: oklch(26.9% 0 0);
  --neutral-900: oklch(20.5% 0 0);
  --neutral-950: oklch(14.5% 0 0);

  --font-size-1: 3rem;
  --font-size-2: 2.25rem;
  --font-size-3: 1.5rem;
  --font-size-4: 1.25rem;
  --font-size-5: 1rem;
  --font-size-6: 0.875rem;

  --spacing-none: 0;
  --spacing-extra-small: .25rem;
  --spacing-small: .5rem;
  --spacing-medium: 1rem;
  --spacing-large: 2rem;
  --spacing-extra-large: 4rem;
  --spacing-extra-extra-large: 8rem;
  --spacing-extra-extra-extra-large: 16rem;

  --content-width: 55%;
  --indented-content-width: 52.5%;
  --nav-gap: var(--spacing-medium);

  --h1-font-size: var(--font-size-1);
  --h2-font-size: var(--font-size-2);
  --h3-font-size: var(--font-size-3);

  --header-font-size: var(--font-size-1);
  --nav-font-size: var(--font-size-4);
  --nav-gap: var(--spacing-medium);
}

@media (max-width: 650px) {
  :root {
    --header-font-size: var(--font-size-2);
    --nav-font-size: var(--font-size-5);
    --nav-gap: var(--spacing-medium);

    --content-width: 100%;
    --indented-content-width: 97%;

    --h1-font-size: var(--font-size-2);
    --h2-font-size: var(--font-size-3);
    --h3-font-size: var(--font-size-4);
  }

  article {
    aside {
      display: none;
    }
  }
}


@media (prefers-color-scheme: dark) {
  :root {
    --neutral-950: oklch(98.5% 0 0);
    --neutral-900: oklch(97% 0 0);
    --neutral-800: oklch(92.2% 0 0);
    --neutral-700: oklch(87% 0 0);
    --neutral-600: oklch(70.8% 0 0);
    --neutral-500: oklch(55.6% 0 0);
    --neutral-400: oklch(43.9% 0 0);
    --neutral-300: oklch(37.1% 0 0);
    --neutral-200: oklch(26.9% 0 0);
    --neutral-100: oklch(20.5% 0 0);
    --neutral-50: oklch(14.5% 0 0);

  }

}

@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot");
  src: url("/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.eot?#iefix") format("embedded-opentype"), url("/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.woff") format("woff"), url("/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.ttf") format("truetype"), url("/fonts/et-book/et-book-roman-line-figures/et-book-roman-line-figures.svg#etbookromanosf") format("svg");
  font-weight: normal;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot");
  src: url("/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.eot?#iefix") format("embedded-opentype"), url("/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.woff") format("woff"), url("/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.ttf") format("truetype"), url("/fonts/et-book/et-book-display-italic-old-style-figures/et-book-display-italic-old-style-figures.svg#etbookromanosf") format("svg");
  font-weight: normal;
  font-style: italic;
  font-display: swap;
}

@font-face {
  font-family: "et-book";
  src: url("/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot");
  src: url("/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.eot?#iefix") format("embedded-opentype"), url("/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.woff") format("woff"), url("/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.ttf") format("truetype"), url("/fonts/et-book/et-book-bold-line-figures/et-book-bold-line-figures.svg#etbookromanosf") format("svg");
  font-weight: bold;
  font-style: normal;
  font-display: swap;
}

.et-book {
  font-family: "et-book";
}

@font-face {
  font-family: "carrois";
  src: url("/fonts/carrois-gothic/CarroisGothicSC-Regular.ttf") format("truetype");
}

.carrois {
  font-family: "carrois";
}

@font-face {
  font-family: "italianno";
  src: url("/fonts/italianno/Italianno-Regular-OTF.otf") format("opentype");
}

.italianno {
  font-family: "italianno";
}

@font-face {
  font-family: "fira";
  src: url("/fonts/fira-code/FiraCode-Regular.otf") format("opentype");
}

@font-face {
  font-family: "fira";
  src: url("/fonts/fira-code/FiraCode-Bold.otf") format("opentype");
  font-weight: bold;
}

.fira {
  font-family: "fira";
}

@view-transition {
  navigation: auto;
}

html {
  font-size: 20px;
  scroll-behavior: smooth;
}

body {
  font-family: et-book, Palatino, "Palatino Linotype", "Palatino LT STD", "Book Antiqua", Georgia, serif;
  background-color: var(--neutral-50);
  color: var(--neutral-900);
  counter-reset: sidenote-counter;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

main {
  view-transition-name: content;
}

@media (prefers-reduced-motion: reduce) {
  @view-transition {
    animation: none;
  }
}

h1 {
  font-weight: normal;
  margin-top: var(--spacing-extra-large);
  margin-bottom: var(--spacing-large);
  font-size: var(--h1-font-size);
  line-height: 1;
}

h2 {
  font-style: italic;
  font-weight: normal;
  margin-top: var(--spacing-large);
  margin-bottom: var(--spacing-medium);
  font-size: var(--h2-font-size);
  line-height: 1;
}

h3 {
  font-style: italic;
  font-weight: normal;
  font-size: var(--h3-font-size);
  margin-top: var(--spacing-large);
  margin-bottom: var(--spacing-medium);
  line-height: 1;
}

hr {
  display: block;
  height: 1px;
  width: 100%;
  border: 0;
  border-top: 1px solid #ccc;
  margin: 1em 0;
  padding: 0;
}


/* Nav */
header {
  font-family: "italianno";
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: var(--spacing-2);
  font-size: var(--header-font-size);

  .hackeryarn {
    mask: url("/imgs/hackeryarn.svg") 0 0/cover;
    display: inline-block;
    width: var(--header-font-size);
    height: var(--header-font-size);
    border-radius: 100%;
    background-color: var(--neutral-900);
    margin-right: var(--spacing-small);
  }

  a {
    display: flex;
    align-items: center;
  }

  a:link,
  a:visited {
    text-decoration: none;
  }

  a:hover {
    color: var(--neutral-900);
  }
}

nav {
  font-family: "carrois";
  font-size: var(--nav-font-size);
  text-decoration: none;

  a:link,
  a:visited {
    text-decoration: none;
    color: var(--neutral-500);
  }

  a:hover {
    color: var(--neutral-900);
  }

  ul {
    padding: 0;
    display: flex;
    list-style: none;
    gap: var(--nav-gap);
  }

  li {
    position: relative;
  }

  li:not(:first-child) {
    margin-top: 0;
  }


  li::before {
    background-color: var(--neutral-900);
    content: '';
    position: absolute;
    z-index: -1;
    height: 4px;
    bottom: 0;
    left: 51%;
    right: 51%;
    transition-duration: .2s;
    transition-property: right, left;
    transition-timing-function: ease-out;
  }

  li:hover::before {
    right: 0;
    left: 0;
  }
}

/* Content */

article {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  padding: var(--spacing-extra-large) 0;
  margin: auto;
  width: 100%;
  max-width: 130ch;

  aside {
    position: sticky;
    top: var(--spacing-small);
    align-self: start;
    margin: 0;
    margin-left: var(--spacing-large);
    font-size: inherit;
    overflow-y: auto;
    scroll-target-group: auto;

    ul {
      color: var(--neutral-500);
      position: relative;
      padding-left: var(--spacing-medium);
      display: block;
      list-style: none;
      gap: var(--nav-gap);

      li {
        line-height: 1rem;

        a {
          margin-top: var(--spacing-medium);
          text-decoration: none;
          display: block
        }

        a:hover {
          color: var(--neutral-900);
        }

        a:target-current {
          color: var(--neutral-900);
        }
      }
    }
  }

  aside::before,
  aside::after {
    content: "";
    position: absolute;
    top: 0;
    bottom: 0;
    left: 0;
    width: 1px;
  }

  aside::before {
    background-color: var(--neutral-300);
  }

  aside::after {
    background-color: var(--neutral-900);
    display: none;
  }


  .content {
    width: var(--article-width);
  }
}

@keyframes toc-border-progress {
  from {
    transform: scaleY(0);
  }

  to {
    transform: scaleY(1);
  }
}

@supports (animation-timeline: scroll(root block)) {
  article {
    aside::after {
      display: block;
      transform: scaleY(0);
      transform-origin: top;
      animation: toc-border-progress linear both;
      animation-timeline: scroll(root block);
    }
  }
}

section {
  padding-top: var(--spacing-medium);
  padding-bottom: var(--spacing-medium);

  h3 {
    margin-bottom: var(--spacing-extra-small);

    a {
      text-decoration: none;
    }
  }

  footer {
    text-align: left;
    font-style: italic;
    color: var(--neutral-600);
    font-size: var(--font-size-6);
    margin: inherit;
  }

}

section:not(article *) {
  max-width: 65ch;
  margin: auto;
}

section>dl,
section>ol,
section>ul {
  width: 90%;
}

p,
dl,
ol,
ul {
  line-height: 1.5;
}

p {
  margin-top: var(--spacing-medium);
  margin-bottom: var(--spacing-medium);
  padding-right: 0;
  vertical-align: baseline;
}

blockquote p {
  margin-right: 40px;
}

blockquote footer {
  font-size: var(--font-size-6);
  text-align: right;
  margin: inherit;
}

dt:not(:first-child),
li:not(:first-child) {
  margin-top: var(--spacing-extra-small);
}

figure {
  padding: 0;
  border: 0;
  font-size: 100%;
  font: inherit;
  vertical-align: baseline;
  max-width: 90%;
  -webkit-margin-start: 0;
  -webkit-margin-end: 0;
  margin: 0 0 3em 0;
}

figcaption {
  float: right;
  clear: right;
  margin-top: 0;
  margin-bottom: 0;
  font-size: var(--font-size-6);
  line-height: 1.6;
  vertical-align: baseline;
  position: relative;
  max-width: 90%;
}

a:link,
a:visited {
  color: inherit;
  text-underline-offset: 0.1em;
  text-decoration-thickness: 0.05em;
}

a:hover {
  color: var(--neutral-600);
}

img {
  max-width: 100%;
}

/* Tables */
table {
  font-size: var(--font-size-6);
  table-layout: auto;
  margin-top: 2em;
  margin-bottom: 2em;
  margin-left: 2.5%;
  width: 97%;
  text-indent: 0;
  border-collapse: collapse;
}

td,
th {
  text-align: left;
  font-weight: normal;
  border-style: solid;
  border-width: 1px;
  border-color: var(--neutral-300);
  padding: var(--spacing-small);
}

th {
  background-color: var(--neutral-100);
}

details {
  color: var(--neutral-600);

  .content {
    border-left: 1px solid var(--neutral-300);
    padding: var(--spacing-small);
    padding-right: 0;
    margin-left: 4px;

  }

  summary {
    cursor: pointer;

    &:hover {
      color: var(--neutral-900);
    }
  }

}

details::details-content {
  opacity: 0;
  transition: opacity 0.3s ease-in;
}

details[open]::details-content {
  opacity: 1;
}

/* Code */

code,
pre>code {
  font-family: "fira", Consolas, "Liberation Mono", Menlo, Courier, monospace;
  font-size: 0.75rem;
  line-height: 1.42;
  -webkit-text-size-adjust: 100%;
}

code::before {
  content: "`";
}

code::after {
  content: "`";
}

pre>code::before {
  content: none;
}

pre>code::after {
  content: none;
}

h1>code,
h2>code,
h3>code {
  font-size: var(--font-size-6);
}

pre>code {
  width: 97%;
  margin-left: 2.5%;
  overflow-x: auto;
  display: block;
}

.z-function:not(.z-decorator).z-name {
  font-weight: bold;
}

.z-variable:not(.z-type) {
  font-style: italic;
}

.z-arguments,
.z-parameter {
  font-weight: bold;
}

.z-string,
.z-numeric:not(.z-type),
.z-escape {
  font-style: italic;
}

.z-comment,
.z-punctuation:not(.z-definition) {
  color: var(--neutral-400);
}

/* Footer */

footer {
  text-align: center;
  margin-top: var(--spacing-extra-extra-large);

  p {
    color: var(--neutral-600);
  }

  div {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--spacing-medium);
  }

  a:link,
  a:visited {
    display: flex;
    text-decoration: none;
    font-size: var(--font-size-2);
    color: var(--neutral-500);

    :hover {
      color: var(--neutral-900);
    }

  }

  ul {
    display: flex;
    justify-content: space-between;
    list-style: none;
    gap: var(--spacing-medium);
  }

  li {
    position: relative;
  }

  li:not(:first-child) {
    margin-top: 0;
  }

  .codeberg {
    mask: url("/imgs/codeberg.svg") 0 0/cover;
    display: inline-block;
    width: var(--font-size-2);
    height: var(--font-size-2);
    background-color: var(--neutral-500);
  }

  .codeberg:hover {
    background-color: var(--neutral-900);
  }
}

/* Scroll bar */

html {
  --scrollbar-bg: var(--color-neutral-100);
  --scrollbar-thumb: var(--color-neutral-300);
  --scrollbar-thumb-hover: var(--color-neutral-500);
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-bg);
}

/* WebKit */
::-webkit-scrollbar {
  width: 12px;
  height: 12px;
}

::-webkit-scrollbar-track {
  background: var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb {
  background-color: var(--scrollbar-thumb);
  border-radius: 6px;
  border: 3px solid var(--scrollbar-bg);
}

::-webkit-scrollbar-thumb:hover {
  background-color: var(--scrollbar-thumb-hover);
}

/* Custom elements */

.tags {
  display: flex;
  color: var(--neutral-600);
  list-style: none;
  gap: var(--spacing-medium);
  margin: 0;
  padding: 0;
  font-size: var(--font-size-6);

  li:not(:first-child) {
    margin-top: 0;
  }

  a:hover {
    color: var(--neutral-900);
  }
}

.subtitle {
  font-style: italic;
  color: var(--neutral-600);
  font-size: var(--font-size-6);
  margin-top: -1.5rem;
}

.me {
  width: 40%;
  margin: auto;
  margin-bottom: var(--spacing-large);
  margin-top: var(--spacing-extra-extra-large);
  filter: grayscale(100%);

  img {
    border-radius: 100%;
  }
}