/* Tessera page head: a mosaic. A tessera is one small tile of a mosaic, and the
   page's own line is "Individual stories. A larger picture." The tiles are set
   one at a time from the left until they show a brass sun low over the sea;
   then its light moves a little on the water. Under reduced motion the mosaic
   is finished and still.

   The tiles are vector shapes in the page, written by
   source/make-tessera-mosaic.js. They are hard edged on purpose: cut stone,
   not wash. Loaded after paint.css. */
.mosaic {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  overflow: visible;
  fill: var(--ivory);
}
.mosaic .is-brass { fill: url(#mosaic-foil); }

@keyframes tessera-set { from { opacity: 0; transform: translateY(-8px) scale(0.8); } }
/* Opacity, not fill opacity: the two look the same on a filled tile, and a
   browser can fade opacity without repainting the mosaic on every frame. */
@keyframes tessera-glint { to { opacity: 0.22; } }

@media (prefers-reduced-motion: no-preference) {
  /* The mosaic builds itself, so the scene is not painted in first. */
  .tessera-paint { animation: none; }
  .tile {
    transform-box: fill-box;
    transform-origin: center;
    animation: tessera-set 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d) both;
  }
  .tile.is-glint {
    animation:
      tessera-set 0.5s cubic-bezier(0.2, 0.7, 0.2, 1) var(--d) both,
      tessera-glint 2.8s ease-in-out calc(var(--d) * 2 + 2s) infinite alternate;
  }
}

/* Behind the copy on a phone, the brass tiles are held back further than a
   wash is, so the words over them stay easy to read. */
@container (max-width: 719px) {
  .tessera-paint { opacity: 0.4; }
}
