// This is copied from https://stackoverflow.com/a/19721069.
$tooltip-size: 5em;
$line-height: 1.45;

@import "animations";
@import "asciidoctor";

:root {
  --body-family: "Source Serif Pro", "IBM Plex Serif", "Noto Serif", serif;
  --header-family: "Source Sans Pro", "IBM Plex Sans", "Noto Sans", sans-serif;
  --mono-family: "Source Code Pro", "IBM Plex Mono", "Noto Mono", monospace;

  overflow-wrap: break-word;
}

// Base styles.
table tr td > p {
  margin-top: 1em;
}

a:hover { color: var(--base0B); }

ul,
ol {
  margin: 1em 0 0;
}

pre {
  margin-bottom: 0;
}

button {
  border: var(--border-style);
}

hr {
  border-color: var(--foreground);
}

kbd {
  font-size: 0.9em;
}

main > article {
  line-height: $line-height;
}

// Layouts
.site__socials {
  list-style: none;
  padding-left: 0;
}

.site__social-icon:hover { color: var(--base0B); }

.site__links--content,
.site__socials--content {
  margin: 1em 0 0;
  padding: 0;
  gap: 1em;
  display: flex;
  width: 100%;
  justify-content: space-around;
  flex-flow: row wrap;
}

.site__links--content > * {
  flex-basis: 20;
}

article.post {
  padding: 0.5em;
  background: var(--base01);
}

// Custom layouts
#logo {
  --size: $tooltip-size;
  display: flex;
  align-items: center;
  justify-content: center;
  height: var(--size);
  width: var(--size);

  svg {
    --size: 4em;
    height: var(--size);
    width: var(--size);
    fill: var(--base0C);
    position: relative;
    animation: rainbow 3s infinite, pulse 2s alternate infinite,
      bounce 0.6s ease-in-out alternate infinite;
  }
}

[data-tooltip] {
  &::before {
    --scale: 0;

    background: var(--base01);
    content: attr(data-tooltip);
    font-size: 0.8em;
    padding: 0.5em;
    position: absolute;
    transform: translateY(var(--translate-y, -#{round($tooltip-size / 2)}))
      scale(var(--scale));
    transform-origin: bottom center;
    width: max-content;
    max-width: 100%;
  }

  &:hover::before {
    --scale: 1;
  }
}

// This setup will use asciidoctor-rouge.
.rouge.highlight,
code[data-lang] {
  &::selection,
  ::selection {
    background: var(--selection-color);
    color: unset;
  }
}

// Prefer reduced animations.
@media (prefers-reduced-motion) {
  #logo svg {
    animation: none;
  }
}
