/* ==========================================================================
   Base — reset, page canvas, typography primitives, motion.
   ========================================================================== */

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

/* Components below set display:flex/grid, which outranks the user-agent
   [hidden] rule. Everything collapsed by JS relies on this. */
[hidden] {
  display: none !important;
}

body {
  margin: 0;
  background: var(--paper);
  background-image: radial-gradient(var(--grain) 1px, transparent 1px);
  background-size: 24px 24px;
  color: var(--ink);
  font-family: var(--font-hand);
  font-size: 18px;
  line-height: 1.5;
  text-wrap: pretty;
}

a {
  color: var(--blue);
  text-decoration: none;
}

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

:focus-visible {
  outline: 3px solid var(--blue);
  outline-offset: 3px;
}

img,
svg,
video {
  max-width: 100%;
}

button {
  font: inherit;
  cursor: pointer;
}

/* --- Hand-lettered headings ---------------------------------------------- */

h1,
h2,
h3,
h4 {
  font-family: var(--font-marker);
  font-weight: 700;
  margin: 0;
}

/* Inline emphasis that reads as if it were circled in marker. */
.marker {
  font-family: var(--font-marker);
  font-weight: 700;
  font-size: 1.06em;
}

/* A link with a hand-drawn dotted underline. */
.link-dotted {
  border-bottom: 2px dotted var(--blue);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* --- Motion --------------------------------------------------------------- */

@keyframes bob {
  0%,
  100% {
    transform: translateY(0) rotate(-6deg);
  }
  50% {
    transform: translateY(-9px) rotate(4deg);
  }
}

@media (prefers-reduced-motion: reduce) {
  :root {
    --tilt: 0;
  }

  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
}

/* --- Decoration, dropped on small screens --------------------------------- */

@media (max-width: 820px) {
  .deco {
    display: none !important;
  }
}
