/* Shared navigation transition for the stadium, shirt room and shop. */
.page-transition {
  position: fixed;
  inset: 0;
  z-index: 10000;
  pointer-events: none;
}

/* Home enters through the official intro; the mosaic is only for leaving it. */
html[data-page-entry="intro"]:not(.is-page-leaving) .page-transition {
  visibility: hidden;
}

.page-transition__tiles {
  position: absolute;
  inset: 0;
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  grid-template-rows: repeat(4, minmax(0, 1fr));
}

.page-transition__tile {
  position: relative;
  border: 1px solid #dce5f012;
  background: #151c28;
  opacity: 0;
  transform: scaleY(0);
  transform-origin: top;
  transition:
    transform 380ms cubic-bezier(.2, .8, .2, 1) var(--tile-delay, 0ms),
    opacity 220ms ease var(--tile-delay, 0ms);
}

.page-transition__tile:nth-child(3n) { background: #192231; }
.page-transition__tile.is-accent-green { background: #245544; }
.page-transition__tile.is-accent-gold { background: #dec78d; }

.page-transition__tile:nth-child(1) { --tile-delay: 0ms; }
.page-transition__tile:nth-child(2),
.page-transition__tile:nth-child(6) { --tile-delay: 35ms; }
.page-transition__tile:nth-child(3),
.page-transition__tile:nth-child(7),
.page-transition__tile:nth-child(11) { --tile-delay: 70ms; }
.page-transition__tile:nth-child(4),
.page-transition__tile:nth-child(8),
.page-transition__tile:nth-child(12),
.page-transition__tile:nth-child(16) { --tile-delay: 105ms; }
.page-transition__tile:nth-child(5),
.page-transition__tile:nth-child(9),
.page-transition__tile:nth-child(13),
.page-transition__tile:nth-child(17) { --tile-delay: 140ms; }
.page-transition__tile:nth-child(10),
.page-transition__tile:nth-child(14),
.page-transition__tile:nth-child(18) { --tile-delay: 175ms; }
.page-transition__tile:nth-child(15),
.page-transition__tile:nth-child(19) { --tile-delay: 210ms; }
.page-transition__tile:nth-child(20) { --tile-delay: 245ms; }

.page-transition__identity {
  position: absolute;
  inset: 0;
  z-index: 1;
  display: none;
  place-items: center;
  opacity: 0;
  transform: translateY(10px);
  transition: opacity 180ms ease 170ms, transform 260ms ease 150ms;
}
.page-transition__tile > .page-transition__identity { display: grid; }
.page-transition__identity img {
  width: 84px;
  height: 84px;
  border: 1px solid #f4f5f7aa;
  border-radius: 50%;
  background: #f3f0e6;
  box-shadow: 0 12px 32px #0007;
  object-fit: cover;
}

html.is-page-entering .page-transition__tile,
html.is-page-leaving .page-transition__tile {
  opacity: 1;
  transform: scaleY(1.02);
  transform-origin: bottom;
}
html.is-page-entering .page-transition__identity,
html.is-page-leaving .page-transition__identity {
  opacity: 1;
  transform: translateY(0);
}
html.is-page-leaving .page-transition { pointer-events: all; }

@media (max-width: 680px) {
  .page-transition__tiles {
    grid-template-columns: repeat(4, minmax(0, 1fr));
    grid-template-rows: repeat(5, minmax(0, 1fr));
  }
  .page-transition__identity img { width: 62px; height: 62px; }
}
@media (prefers-reduced-motion: reduce) {
  .page-transition { display: none; }
}
