/* One continuous drawing behind the introduction, fading into the page. */
html {
  background-color: var(--color-bg);
  transition: background-color 0.3s ease;
}

body {
  position: relative;
  isolation: isolate;
  background-color: transparent;
}

.site-background {
  position: absolute;
  top: 0;
  left: 50%;
  width: var(--background-width, 100%);
  height: var(--background-height, 680px);
  transform: translateX(-50%);
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
  opacity: 0;
  transition: opacity 1.4s ease;
  mask-image: radial-gradient(ellipse 75% 62% at 83% 22%,
    #000 18%, #0009 52%, #0002 76%, transparent 100%);
}

.site-background.is-ready {
  opacity: 1;
}

.site-background canvas {
  display: block;
  width: 100%;
  height: 100%;
}

.background-toggle {
  position: absolute;
  top: 50%;
  right: 44px;
  transform: translateY(-50%);
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0.4em;
  color: var(--color-text-secondary);
  background: var(--color-surface);
  border: 1px solid var(--color-border);
  border-radius: var(--radius);
  cursor: pointer;
}

.background-toggle:hover,
.background-toggle:focus-visible {
  background: var(--color-border);
  border-color: var(--color-border-strong);
}

.background-toggle svg {
  width: 18px;
  height: 18px;
}

.background-toggle[hidden],
.background-play-icon,
.background-toggle[data-paused="true"] .background-pause-icon {
  display: none;
}

.background-toggle[data-paused="true"] .background-play-icon {
  display: block;
}

@media (max-width: 768px) {
  .menu-toggle {
    right: 92px;
  }

  .background-toggle {
    top: 0.25rem;
    right: 44px;
    transform: none;
    width: 44px;
    height: 44px;
  }

  .site-background {
    mask-image: radial-gradient(ellipse 100% 58% at 100% 22%,
      #000 5%, #0008 48%, #0002 72%, transparent 100%);
  }

  .site-background.is-ready {
    opacity: 0.65;
  }
}

@media (prefers-reduced-motion: reduce) {
  .site-background {
    transition: none;
  }
}

@media print {
  .site-background,
  .background-toggle {
    display: none !important;
  }
}
