@font-face {
  font-family: "Sneak";
  src: url("fonts/Sneak-Regular.otf") format("opentype");
  font-display: swap;
}

/* Colors live in one place. The dark values swap in automatically
   when the visitor's system is set to dark mode. */
:root {
  color-scheme: light dark; /* also darkens scrollbars */
  --background: #fff;
  --text: #000;
  --muted: rgba(0, 0, 0, 0.4);
  /* crayon darkens the page like a highlighter; text shows through */
  --crayon-blend: multiply;
}

@media (prefers-color-scheme: dark) {
  :root {
    --background: #191919;
    --text: rgba(255, 255, 255, 0.75);
    --muted: rgba(255, 255, 255, 0.4);
    /* multiply is invisible on dark backgrounds, so lighten instead */
    --crayon-blend: screen;
  }
}

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  /* the crayon canvas fills the body, so the body must fill the screen */
  position: relative;
  min-height: 100vh;
  min-height: 100svh; /* avoids a stray scroll on phones; older browsers use the line above */
  padding: 16px;
  background: var(--background);
  color: var(--text);
  font:
    14px/1.4 "Sneak",
    Helvetica,
    Arial,
    sans-serif;
}

/* Same proportions as the Cargo example: the block is 44% of the
   viewport wide, split 4:8 (left column : right column) */
main {
  display: grid;
  grid-template-columns: 1fr 2fr;
  column-gap: 16px;
  max-width: 44%;
}

p,
nav {
  margin-bottom: 1.4em;
}

a {
  color: inherit;
}

nav a {
  display: block;
}

#clock {
  position: fixed;
  top: 16px;
  right: 16px;
  margin: 0;
  text-align: right;
  color: var(--muted);
  /* equal-width digits so the clock doesn't jiggle each second */
  font-variant-numeric: tabular-nums;
}

/* "san diego" sits under the time and only shows on hover */
#place {
  display: none;
}

#clock:hover #place {
  display: block;
}

#hint {
  position: fixed;
  bottom: 16px;
  left: 16px;
  margin: 0;
  color: var(--muted);
}

/* drawing layer over the whole page; clicks pass straight through it */
#crayon {
  position: absolute;
  top: 0;
  left: 0;
  /* without an explicit size, a canvas displays at its pixel size, which is
     2x too big on Retina screens */
  width: 100%;
  height: 100%;
  z-index: 5;
  pointer-events: none;
  mix-blend-mode: var(--crayon-blend);
}

/* on touch screens, press-and-hold draws, so don't select text or
   pop up the link menu instead */
@media (pointer: coarse) {
  body {
    -webkit-user-select: none;
    user-select: none;
    -webkit-touch-callout: none;
  }
}

/* stack the columns on narrow screens */
@media (max-width: 600px) {
  main {
    grid-template-columns: 1fr;
    max-width: 100%;
  }
}
