#underconstruction {

  &.early {
    & { display: none }
    body:has(&)>:not(main) {
      opacity: 0;
      pointer-events: none;
    }
  }

  &:not(.early) {
    font-family: "Silkscreen";
    position: fixed;
    z-index: 1000;
    inset: 0;

    display: grid;
    align-items: center;
    justify-content: center;

    body:has(&)>:not(&) {
      filter: blur(7px);
    }
    p {
      display: inline-block;
      font-size: min(4vw, 4vh);
      color: var(--header-color);
      rotate: 30deg;
      background-color: #000c;
      font-weight: bold;
      padding: 1em;
    }

  }

}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;  padding: 0;
}

:root {
  scroll-behavior: smooth;
  scrollbar-gutter: stable;
  justify-items: center;

  body {
    max-width: 1280px;
    margin: 0 auto;

    --main-min-width: 300px;

    display: grid;
    grid-template-columns: auto minmax(var(--main-min-width), 1fr) auto;

    position: relative;
    :is(#nav, #side) {
      transition: margin 150ms ease-in-out;
      width: 256px;
      position: sticky;
      top: 0;
      height: 100vh;
      overflow: auto;
    }

    &::after {
      opacity: 0;
      content: '';
      z-index: 99;
      pointer-events: none;
      background-color: #0009;
      position: fixed;
      transition: opacity 150ms ease-in-out;
      inset: 0;
    }
    &:is(.navmenu1, .navmenu2)::after {
      opacity: 1;
      pointer-events: unset;
    }

    @media (width < 1024px) {
      grid-template-columns: auto minmax(var(--main-min-width), 1fr);
      #side { position: fixed; z-index: 100; right: 0; margin-right: -256px; }
      &.navmenu2 #side, #side:focus-within { margin-right: 0; }
      #mobileheader span:last-child { display: unset; }
      #mobileheader .sitelogo { display: none; }
    }

    @media (width < 768px) {
      grid-template-columns: minmax(var(--main-min-width), 1fr);
      #nav { position: fixed; z-index: 100; left: 0; margin-left: -256px; }
      &.navmenu1 #nav, #nav:focus-within { margin-left: 0; }
      #mobileheader span:first-child { display: unset; }
      #mobileheader .sitelogo { display: unset; }
    }
  }
}

:root {
  color-scheme: light dark;

  --nav-bgcolor: light-dark(#12171e, #12171e);
  --nav-linkcolor: light-dark(#555, #777);

  --header-color: light-dark(#986407, #cbb284);

  --mobileheader-height: 40px;
  --link-color: light-dark(#19f, #19f);
  --outline-color: currentColor;

  background-color: light-dark(#000, #000);
  color: light-dark(#959595, #ccc);
  font-optical-sizing: auto;
  font-family: "Oxanium Variable", sans-serif;

  &.light { color-scheme: light }
  &.dark  { color-scheme: dark  }

  &.light {
    filter: invert(1) hue-rotate(180deg);
    iframe { filter: invert(1) hue-rotate(180deg); }    
  }

  @media (prefers-color-scheme: light) {
    &:not(.dark) {
      filter: invert(1) hue-rotate(180deg);
      iframe { filter: invert(1) hue-rotate(180deg); }    
    }
  }

}

body {
  > :nth-child(1) { background-color: var(--nav-bgcolor); }
  > :nth-child(2) { background-color: light-dark(#222, #222); }
  > :nth-child(3) { background-color: var(--nav-bgcolor); }
}

::selection {
  background-color: light-dark(#5a194e, #5a194e);
}

.sitelogo {
  text-decoration: none;

  --red:  light-dark(#891818cc, #900c);
  --blue: light-dark(#3636a5cc, #00fc);

  font-weight: bold;
  font-family: "Silkscreen", sans-serif;
  color: light-dark(#8a5a00, #d6a752aa);
  text-shadow:
    -8px -4px 0px color(from var(--blue) srgb r g b / .3),
     8px  4px 0px color(from var(--red)  srgb r g b / .3);

  transition:
    color       200ms ease-in-out,
    text-shadow 200ms ease-in-out;

  &:hover {
    text-shadow:
      -3px -0px 0px var(--blue),
       3px  0px 0px var(--red);
    text-decoration: none;
  }
}

#mobileheader {
  position: sticky;
  top: 0;
  margin: 0;
  height: var(--mobileheader-height);

  background-color: var(--nav-bgcolor);
  box-shadow: 0px 1px 1px #0007;
  z-index: 99;

  display: flex;
  justify-content: center;
  align-items: center;
  @media (width >= 1024px) { display: none; }

  span {
    cursor: pointer;
    border-radius: 7px;
    white-space: nowrap;
    display: none;
    position: absolute;
    text-shadow: 0px 1px 1px #0009;
    line-height: 2em;
    padding: 0 1em;
    font-family: "Silkscreen";
    opacity: 0.5;
    text-align: center;
    transition: background-color 150ms ease-in-out;
    &:hover { background-color: #fff1; }
  }

  span:first-child { left:  0.25em; }
  span:last-child  { right: 0.25em; }
}

:is(h1,h2,h3,h4) {
  color: var(--header-color);
  font-optical-sizing: auto;
  font-family: "Gemunu Libre Variable", sans-serif;
  scroll-margin-top: 5px;
  @media (width < 1024px) { scroll-margin-top: calc(5px + var(--mobileheader-height)); }
}

.navbar {
  .sitelogo { font-size: 150%; }
  :is(ul,ol) { list-style-type: none; }

  > * { margin: 2rem }

  &#nav>p:first-child { margin-top: 0; }
  &#nav { padding-top: 1em; }
  &#side h3+* { margin-top: .25em; }

  #toggledarkmode { display: flex; gap: .25em }

  #toc a { margin: .33rem 0 }
  #toc li li ul { margin-left: 1em; }

  h3 {
    font-weight: normal;
    margin-top: 2rem;
    margin-bottom: 0;
  }

  li { margin: .1rem 0; }
  ul { margin-top: 0;}

  a:not(.sitelogo) {
    color: var(--nav-linkcolor);
    text-decoration: none;
    display: inline-block;
    font-family: "Gemunu Libre Variable", sans-serif;

    transition: all 120ms ease-in-out;

    #toc & {
      text-indent: -1em;
      padding-left: 1em;
    }

    &:is(.current, :hover) {
      color: var(--link-color);
      border-color: currentColor;
    }
  }
}

main {

  :is(p, table, iframe, :not(li)>ul,ol, h1,h2,h3,h4, hr) {
    margin: 1rem 2rem;
  }

  hr {
    border: none;
    border-bottom: 1px solid currentColor;
    opacity: 0.25;
  }

  table {
    border-collapse: collapse;

    td, th {
      border: 1px solid #fff2;
      padding: .4em .7em;
      background-color: #0003;
    }
  }

  :is(ul, ol) {
    padding-left: 2rem;
    li p { margin: 0.5rem 0; }
  }

  :is(h1,h2,h3,h4) {
    && {
      margin: 1em 0 0;
      padding: 1rem 2rem;
      z-index: 1;
    }

    &:has(>.header-anchor) {
      position: relative;
      overflow: visible !important;

      &:not(:hover, :focus) > .header-anchor:not(:focus) {
        opacity: 0;
      }

      > .header-anchor {
        transition: opacity 120ms ease-in-out;
        position: absolute;
        right: calc(100% - 1.65rem);
        color: inherit;
        text-decoration: none;
      }
    }
  }

  > footer {
    padding: 3rem 2rem;
    justify-self: center;
    font-size: 80%;
    opacity: .5;
    transition: opacity 150ms ease-in-out;
  }

}

a {
  color: var(--link-color);
}


iframe {
  background-color: #0003;
  border: none;
  max-width: 100%;
  main>& { max-width: calc(100% - 2 * 2rem); }
}


.runcode {
  > * { margin: 0; }
  margin: 1rem 2rem;

  display: flex;
  flex-wrap: wrap;
  gap: 1em;
  justify-content: center;
  align-items: start;
  > pre {
    flex: 1 1 0;
    min-width: 300px;
  }
}

pre:has(>code) {
  margin: 1rem 2rem;
  background-color: #0004 !important;
  --outline-color: rgb(141, 73, 210);
  border-radius: 7px;

  position: relative;
  .monaco-editor {
    position: absolute;
    top: 1rem;
    left: 1rem;
  }

  .runcode & code { overflow: hidden; }
  &:has(.monaco-editor) {
    overflow: visible;
    >code { visibility: hidden;  }
  }

  overflow: auto;
  > code {
    font-family: "Fira Code Variable";
    font-size: 12px;
    margin: 1rem;
    display: block;
  }
}

:not(pre) > code {
  font-family: "Fira Code Variable";
  font-size: 85%;
  background-color: #0005;
  padding: 1px 2px;
  border-radius: 3px;
}

section.box {
  > h3:first-child { margin-top: 0; }
  padding: 0.5rem 0;
  margin: 2rem 0;
}

section.box.note { background-color: #0a375a77; }
section.box.info { background-color: #164a3277; }
section.box.warning { background-color: #4a162f77; }

section.features {
  /* background-color: #0003; */
  padding: 1rem 0;

  h3 { padding: 0; }

  .header-anchor {
    display: none;
  }

  ul {
    padding-left: 0;
    list-style-type: none;
    display: grid;
    gap: 2em;
  }

  li {
    > * { margin:0 }

    display: grid;
    justify-content: start;
    align-items: center;
    gap: 3px 1rem;
    grid-template-areas:
      'a b'
      'a c';

    > :nth-child(1) { grid-area: a; }
    > :nth-child(2) { grid-area: b; }
    > :nth-child(3) { grid-area: c; }
  }
} 

section.homebuttons ul {
  max-width: 640px;
  padding-left: 0;
  list-style-type: none;
  flex-wrap: wrap;
  display: flex;
  gap: 0 1em;
  justify-content: space-evenly;
  font-family: "Gemunu Libre Variable";
  font-size: 120%;
}


:focus {
  background-color: color(from var(--outline-color) srgb r g b / .07 ) !important;
  outline: 3px solid color(from var(--outline-color) srgb r g b / .33 );
  outline-offset: 3px;
}

blockquote {
  background-color: #3d2138;
  overflow: hidden;

  position: relative;
  &::before, &::after { position: absolute; font-size: 200%; }
  &::before { content: '“'; top: 0.125em; left: 0.125em }
  &::after  { content: '”'; right: 0.125em; bottom: -0.25em }
}
