/* Reset */
*, *::before, *::after {
  box-sizing: border-box;
}

*:not(dialog) {
  margin: 0;
}

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

p {
  text-wrap: pretty;
  hyphens: auto;
  hyphenate-limit-chars: 7
}

input, button, textarea, select {
  font: inherit;
}

/* Vars */
:root {
  color-scheme: light dark;
  --white: #faf8f5;
  --black: #1c1b18;
  --colour: #7c3aed;
  --bg: light-dark(var(--white), var(--black));
  --fg: light-dark(var(--black), var(--white));
  --highlight: light-dark(
      var(--colour),
      oklch(from var(--colour) calc(l + 0.20) c h)
  );
  --dots: light-dark(
      oklch(from var(--highlight) calc(l + 0.36) 0.1 h),
      oklch(from var(--highlight) calc(l - 0.60) 0.1 h)
  );
  --links: light-dark(
      oklch(from var(--highlight) calc(l - 0.15) c h),
      oklch(from var(--highlight) calc(l + 0.15) c h)
  );
}

/* Styling */
html {
  color: var(--fg);
  background-color: var(--bg);
}

html::before {
  content: '';
  position: fixed;
  inset: 0;
  z-index: -1;
  background: var(--dots);
  mask-image: linear-gradient(135deg, white 0%, rgba(255, 255, 255, 0.2) 15%, rgba(255, 255, 255, 0.2) 85%, white 100%),
  url('/static/dots-c978f9f7.svg');
  mask-composite: intersect;
}

html:has(article)::before {
  mask-image: linear-gradient(135deg, white 0%, rgba(255, 255, 255, 0.0) 15%, rgba(255, 255, 255, 0.0) 85%, white 100%),
  url('/static/dots-c978f9f7.svg');
}

body {
  line-height: 1.5;
  display: grid;
  width: 100vw;
  height: 100vh;
}

h1 {
  color: var(--highlight);
}

a {
  color: var(--links);
}

main {
  display: flex;
  flex-direction: column;
  align-items: center;

  p {
    padding-bottom: 1rem;
  }

  &:has(article) {
    padding-top: 2rem;

    ul {
      padding-bottom: 1rem;
    }

    nav {
      a {
        align-self: flex-start;
      }

      width: 70vw;
    }

    article {
      justify-self: flex-start;
      width: 70vw;
      padding-bottom: 2rem;
    }
  }

  &:not(:has(article)) {
    justify-content: center;

    ul {
      list-style: none;
      padding: 0;

      li {
        display: inline;

        &:not(:first-child)::before {
          content: " | "
        }
      }
    }
  }
}

nav[aria-label="breadcrumbs"] {
  font-size: 0.85rem;
  padding-bottom: 1rem;

  ol {
    list-style: none;
    padding-left: 0;

    li {
      display: inline-block;

      &:not(:last-child):after {
        content: "›";
        display: inline-block;
        padding: 0 .5ch;
        speak: never;
      }
    }
  }
}

main:has(nav[aria-label="subpages"]) nav[aria-label="breadcrumbs"] {
  padding-bottom: 0;
}

nav[aria-label="subpages"] {
  font-size: 0.85rem;
  padding-bottom: 1rem;

  ul {
    list-style: none;
    padding-left: 0;

    &::before {
      content: "→";
      padding-right: .5ch;
      speak: never;
    }

    li {
      display: inline-block;
      padding-right: 0;

      &:not(:first-child):before {
        content: "·";
        display: inline-block;
        padding: 0 .5ch;
        speak: never;
      }
    }
  }
}

a:not(
	[href^="#"],
	[href^="/"]
)::after {
  content: "↗";
  vertical-align: super;
  font-size: 0.5em;
  display: inline-block;
  bottom: 0.5em;
  padding-left: 1ch;
  position: relative;
}

pre {
  font: inherit;
  white-space: pre-line;
  text-wrap: pretty;
  overflow-wrap: break-word;
}

/* Mobile adjustments */
@media (max-width: 768px) {
  body {
    font-size: 1.1rem;
  }
  main:has(article) {
    padding-top: 3rem;

    nav, article {
      width: 90vw;
      max-width: 70ch;
    }
  }
}

table {
  width: 100%;
  border-collapse: collapse;
  tr {
    border-bottom: 1px solid oklch(from var(--fg) calc(l - 0.50) c h);
  }
  th {
    text-align: left;
  }
}
