html.blinkendots, div.blinkendots-icon {
  --bgColor: #f1e5fc;
  --accentColor: #e6e632;
  --bgColor: #cfc7fc;
  --textColor: #5a518c;
  --fadeColor: #7166af;
  --strongColor: #312c4c;
}

html.blinkendots {
  body {
    font-family: 'Nunito', sans-serif;
    min-height: 100vh;
    margin: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    background: var(--bgColor);
    color: var(--textColor);
    gap: 5rem;
  }

  canvas#bg {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 1;
  }

  button.change-theme {
    all: unset;
    outline: revert-layer;
    text-transform: lowercase;
    font-size: 1.4rem;
    position: absolute;
    top: 0;
    right: 0;
    box-sizing: border-box;
    padding: 0.5rem 1rem;
    line-height: 2rem;
    height: 3rem;
    margin: 1rem;
    border-radius: 2rem;
    z-index: 3;
    cursor: pointer;
    
    &:before {
      content: '🖉';
      font-family: 'Noto Sans Symbols 2', sans-serif;
      font-size: 1.1rem;
      vertical-align: middle;
      padding-right: 0.5rem;
      color: transparent;
    }
    
    &:hover, &:focus {
      background-color: var(--accentColor);
      
      &:before {
        color: inherit;
      }
    }
  }

  section {
    position: relative;
    z-index: 3;
    width: calc(100% - 2rem);
    max-width: 40rem;

    h1 {
      font-size: 2.1rem;
      color: var(--fadeColor);

      em {
        font-style: normal;
        color: var(--textColor);
      }
    }

    h2 {
      font-size: 1.1rem;
      font-weight: 600;
    }

    p {
      font-size: 1.2rem;
    }

    button#reload-fun-fact {
      font: inherit;
      height: 1.45rem;
      width: 1.45rem;
      margin: 0 0 0 0.3rem;
      padding: 0 0 0 0.05rem;
      line-height: 1.66rem;
      text-align: center;
      background: none;
      border: none;
      border-radius: 50%;
      cursor: pointer;
      font-size: 0.8rem;
      color: inherit;
      font-family: 'Noto Sans Symbols 2', sans-serif;

      &:hover, &:focus {
        background-color: var(--accentColor);
      }
    }

    .links {
      gap: 1rem;
      display: flex;
      font-size: 1.4rem;
      margin: 0;
      padding: 0;
      list-style: none;

      a {
        color: var(--strongColor);
        text-decoration: none;
        background-image: linear-gradient(
          transparent 75%, 
          var(--accentColor) 75%,
          var(--accentColor) 92.5%,
          transparent 92.5%
        );
        text-transform: lowercase;
        margin-right: 1rem;
        position: relative;
        line-height: 1.7rem;
        display: inline-block;

        &:after {
          content: '→';
          position: absolute;
          top: 0;
          right: -1rem;
          width: 1rem;
          height: 1.7rem;
          font-size: 0.8rem;
          width: 1rem;
          text-align: center;
          opacity: 0;
        }

        &:hover:after {
          opacity: 1;
        }


        &:hover, &:hover:after {
          background-image: linear-gradient(
            transparent 0%, 
            var(--accentColor) 0%,
            var(--accentColor) 92.5%,
            transparent 92.5%
          );
        }
      }
    }

    &.sponsors {
      text-align: center;
      --button-padding: 0.5rem;
      max-width: calc((88px * 4) + (var(--button-padding) * 3));

      .buttons a {
        text-decoration: none;
      }

      img {
        image-rendering: pixelated;
      }
    }
  }

  dialog[open] {
    position: fixed;
    top: 0;
    left: 0;
    min-height: 100vh;
    margin: 0;
    width: 20rem;
    max-width: calc(100vw - 2rem);
    box-sizing: border-box;
    border: 0;
    padding: 0.5rem;
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    background-color: var(--fadeColor);
    color: var(--bgColor);
    box-shadow: 0 0 0.25rem rgba(0, 0, 0, 0.3), 0.15rem 0 1rem rgba(0, 0, 0, 0.1);
    z-index: 9999999999;

    button[command="close"] {
      border: 0;
      padding: 0;
      margin: 0;
      font: inherit;
      display: flow;
      height: 2rem;
      line-height: 2rem;
      text-align: center;
      border-radius: 0.2rem;
      cursor: pointer;
      align-self: flex-end;
      background-color: var(--bgColor);
      color: var(--textColor);
      font-size: 1rem;
      padding: 0 0.5rem;
      text-transform: lowercase;

      &:hover, &:focus {
        color: var(--strongColor);
      }
    }

    h3 {
      font-weight: normal;
      font-size: 1.4rem;
      line-height: 1.2;
      margin: 1rem;
    }

    form {
      width: 100%;
    }

    a.change-theme-button {
      display: flex;
      height: 3rem;
      margin: 0.5rem;
      align-items: center;
      color: inherit;
      text-decoration: none;
      font-size: 1.1rem;
      border-radius: 0.2rem;
      
      &:hover:not(.current-theme) {
        background: var(--textColor);
      }
      
      &.current-theme {
        background: var(--strongColor);
      }

      input {
        margin: 0 0.75rem;
      }

      div {
        height: 2rem;
        width: 2rem;
        margin: 0 1rem 0 0.5rem;
      }
    }

    &::backdrop {
      background-color: rgba(0,0,0,0.4);
    }
  }
}

dialog a.change-theme-button div.blinkendots-icon {
  height: 2rem;
  width: 2rem;
  border-radius: 0.2rem;
  background-color: var(--bgColor);
  display: flex;
  justify-content: center;
  align-items: center;

  &:before {
    content: '';
    background-color: rgba(0,0,0,0.15);
    height: 1rem;
    width: 1rem;
    border-radius: 50%;
    /* calibrated against blinkendots in js */
    --blinkendot-duration: 1.683s;
    animation: 
      blinkendot var(--blinkendot-duration) cubic-bezier(0.37, 0, 0.63, 1) infinite,
      move-about calc(var(--blinkendot-duration) * 5) steps(1) infinite;
    position: relative;
  }
}

@keyframes blinkendot {
  0%  { transform: scale(0); }
  9.09% { transform: scale(1); }
  100%  { transform: scale(0); }
}

@keyframes move-about {
  0%   { top:  0;    left:  0;    }
  20%  { top:  0.2rem; left: -0.1rem; }
  40%  { top: -0.2rem; left:  0.1rem; }
  60%  { top:  0.1rem; left:  0.2rem; }
  80%  { top: -0.2rem; left: -0.2rem; }
  100% { top:  0;    left:  0.1rem; }
}

@media(max-width: 500px) {
  html.blinkendots {
    section.intro {
      margin-top: 3rem;
    }
  }
}