:root {
  --bg-color: #000000;
  --text-color: hsl(225, 16%, 70%);
  --link-color: hsl(225, 16%, 85%);
  --link-hover-color: hsl(225, 16%, 90%);
  --particle-color: 120, 120, 120;
}

@media (prefers-color-scheme: light) {
  :root {
    --bg-color: #f0f0f0;
    --text-color: hsl(225, 16%, 30%);
    --link-color: hsl(225, 16%, 20%);
    --link-hover-color: hsl(225, 16%, 0%);
    --particle-color: 60, 60, 60;
  }
}

@media (prefers-color-scheme: light) {
  meta[name="theme-color"] {
    content: "#f0f0f0";
  }
}

@media screen and (max-width: 480px) {
  body {
    font-size: 16px !important;
  }
  main {
    padding: 10px 40px !important;
    max-width: 480px;
    margin: 0 auto;
  }
}

@media screen and (min-width: 481px) and (max-width: 768px) {
  body {
    font-size: 16px;
    overflow: hidden;
    height: 100vh;
  }
  main {
    max-width: 600px;
    padding: 20px;
    margin: 0 auto;
    height: 100vh;
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
  p {
    padding: 8px;
  }
  h1 {
    padding: 8px;
    font-size: 1em;
  }
}

@media screen and (min-width: 769px) {
  main {
    max-width: 600px;
    padding: 40px 20px;
    margin: 0 auto;
  }
}

html,
body {
  min-height: 100%;
  margin: 0;
}

canvas {
  background: var(--bg-color);
}

body {
  font-family: Courier, Serif;
  font-size: 16px;
  color: var(--text-color);
  display: flex;
  justify-content: center;
  line-height: 1.5;
  min-height: 100vh;
}

@media (prefers-reduced-motion: reduce) {
  #particles {
    display: none;
  }
}

@media print {
  #particles {
    display: none;
  }
  body {
    color: #000;
    background: #fff;
  }
  a {
    color: #000;
    text-decoration: underline;
  }
  a[href]::after {
    content: " (" attr(href) ")";
    font-size: 0.85em;
    word-break: break-all;
  }
  a[href^="mailto:"]::after {
    content: none;
  }
}

span,
a {
  color: var(--link-color);
  text-decoration: none;
}

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

a:focus-visible {
  outline: 2px solid var(--link-color);
  outline-offset: 2px;
}

.skip-link {
  position: absolute;
  top: -40px;
  left: 0;
  background: var(--link-color);
  color: var(--bg-color);
  padding: 8px;
  text-decoration: none;
  z-index: 100;
}

.skip-link:focus {
  top: 0;
}

p {
  padding: 10px;
}

main {
  padding: 40px;
  position: relative;
  z-index: 1;
  text-align: left;
}

h1 {
  font-weight: normal;
  font-size: 1.1em;
  padding: 10px;
}

.cursor {
  display: inline-block;
  width: 0.6em;
  height: 2px;
  background: var(--link-color);
  margin-left: 2px;
  animation: blink 1s step-end infinite;
  vertical-align: baseline;
}

@keyframes blink {
  50% {
    opacity: 0;
  }
}

.grain-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
  z-index: 2;
  opacity: 0;
  display: none;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 200 200' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='noise'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.8' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23noise)'/%3E%3C/svg%3E");
}

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition:
    opacity 0.6s ease-out,
    transform 0.6s ease-out;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

.fade-in:nth-child(1) {
  transition-delay: 0.1s;
}

.fade-in:nth-child(2) {
  transition-delay: 0.25s;
}

.fade-in:nth-child(3) {
  transition-delay: 0.4s;
}

.fade-in:nth-child(4) {
  transition-delay: 0.55s;
}

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

noscript #particles {
  display: none;
}
