/* Colours from atlas/docs/brand/BRAND.md. Never pure white on dark. */
:root {
  color-scheme: light dark;
  --bg: #FFFFFF;
  --fg: #0B0D12;
  --brass: #9A7128;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0B0D12;
    --fg: #ECEDEF;
    --brass: #D1AB62;
  }
}

body {
  margin: 0;
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  place-items: center;
  background: var(--bg);
  color: var(--fg);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
}

main {
  box-sizing: border-box;
  width: 100%;
  max-width: 46rem;
  padding: 3rem 1rem;
  text-align: center;
}

img {
  display: block;
  width: min(280px, 100%);
  height: auto;
  margin: 0 auto 2.5rem;
}

h1 {
  max-width: 40rem;
  margin: 0 auto;
  font-size: 1.0625rem;
  font-weight: 400;
  line-height: 1.6;
}

a {
  color: inherit;
  text-decoration: underline;
}

a:focus-visible {
  outline: 2px solid currentColor;
  outline-offset: 3px;
}

/* One sentence per line when there is room; each wraps evenly on a narrow screen. */
h1 span {
  display: block;
  text-wrap: balance;
}

@media (min-width: 600px) {
  img {
    width: min(400px, 100%);
    margin-bottom: 3rem;
  }

  h1 {
    font-size: 1.25rem;
  }
}

/*
  Entrance (entrance-start.js, entrance.js). Without script nothing below
  applies. If either script fails or is late, it removes `js-entrance`, which
  puts the page back to its normal state. Every animation ends on the
  element's normal state.
*/
.entrance-canvas {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  pointer-events: none;
}

@media (prefers-reduced-motion: no-preference) {
  /* entrance-start.js adds js-entrance before first paint: the logo and text
     wait, invisible. entrance.js adds entrance-run when the dots start, and
     that is when the fades begin, so they stay in step with the canvas. */
  .js-entrance main img,
  .js-entrance h1 span {
    opacity: 0;
  }

  /* The logo scales about the centre of its disc, so the disc stays where the dots gathered. */
  .js-entrance.entrance-run main img {
    opacity: 1;
    transform-origin: 12.834% 55.696%;
    animation: entrance-logo 900ms cubic-bezier(0.23, 1, 0.32, 1) 1400ms backwards;
  }

  .js-entrance.entrance-run h1 span {
    opacity: 1;
    animation: entrance-line 700ms cubic-bezier(0.23, 1, 0.32, 1) 2100ms backwards;
  }

  .js-entrance.entrance-run h1 span + span {
    animation-delay: 2800ms;
  }

  .entrance-paused main img,
  .entrance-paused h1 span {
    animation-play-state: paused;
  }
}

@keyframes entrance-logo {
  from {
    opacity: 0;
    transform: scale(0.97);
  }
}

@keyframes entrance-line {
  from {
    opacity: 0;
    transform: translateY(0.5em);
  }
}
