.atlas-bird-plume,
.atlas-eye {
  display: none;
}

@supports (clip-path: polygon(0 0, 100% 0, 100% 100%)) {
  @media (prefers-reduced-motion: no-preference) {
    .atlas-artwork-ready .atlas-bird-base {
      clip-path: polygon(0 0, 55% 0, 55% 24%, 58.5% 24.8%, 61% 26.4%, 63.3% 28.2%, 65% 30.3%, 66.2% 32%, 67.55% 34%, 100% 34%, 100% 100%, 0 100%);
    }

    .atlas-artwork-ready .atlas-bird-plume {
      display: block;
      clip-path: polygon(55% 0, 100% 0, 100% 34%, 67.55% 34%, 66.2% 32%, 65% 30.3%, 63.3% 28.2%, 61% 26.4%, 58.5% 24.8%, 55% 24%);
      transform-origin: 63.4% 27.6%;
      animation: atlas-feathers 5.3s ease-in-out infinite;
    }

    .atlas-artwork-ready .atlas-eye {
      position: absolute;
      display: block;
      top: 46.2%;
      height: 4.55%;
      width: 11.45%;
      pointer-events: none;
    }

    .atlas-artwork-ready .atlas-eye::after {
      position: absolute;
      inset: 0;
      background: linear-gradient(160deg, #342845 5%, #81709c 54%, #574878 86%, #282136 96%);
      content: "";
      transform: scaleY(0);
      transform-origin: bottom;
      animation: atlas-blink 8.1s infinite;
    }

    .atlas-artwork-ready .atlas-eye--left {
      left: 29.5%;
      clip-path: polygon(0 96%, 18% 61%, 49% 20%, 76% 2%, 93% 5%, 97% 37%, 79% 72%, 45% 88%);
    }

    .atlas-artwork-ready .atlas-eye--right {
      left: 52.4%;
      clip-path: polygon(0 57%, 5% 23%, 16% 4%, 40% 4%, 63% 19%, 90% 49%, 98% 96%, 63% 84%, 25% 68%);
    }

    .atlas-logo-wrap::before {
      position: absolute;
      inset: 0;
      pointer-events: none;
      background: radial-gradient(ellipse 50% 25% at 50% 64%, #ffaa3b6b, transparent 87%),
        radial-gradient(ellipse 20% 15% at 43% 89%, #ffad3863, transparent 92%);
      filter: blur(.5rem);
      opacity: .42;
      content: "";
    }

    .atlas-artwork-ready .atlas-logo-wrap::before {
      animation: atlas-logo-glow 6.4s ease-in-out infinite;
    }

    .atlas-artwork-ready .atlas-logo-wrap::after {
      position: absolute;
      z-index: 3;
      inset-block-start: var(--logo-canvas-top);
      inset-inline-start: var(--logo-canvas-left);
      inline-size: var(--logo-canvas-width);
      aspect-ratio: 600 / 559;
      pointer-events: none;
      background: linear-gradient(113deg, transparent 43%, #ffe5a466 48%, #fff6d6c4 50%, #ffd27566 53%, transparent 59%) 115% center / 245% 100% no-repeat;
      mask: url('/static/pirots/atlas/pirots5-poster-600.webp') center / 100% 100% no-repeat;
      clip-path: polygon(16% 61%, 32% 57.5%, 54% 58%, 65% 55%, 81% 56%, 79% 73%, 72% 77%, 54% 77%, 53% 94%, 47% 96%, 38% 95%, 37% 89%, 39% 77%, 26% 75%, 16% 76%);
      mix-blend-mode: screen;
      animation: atlas-logo-light 6.4s ease-in-out infinite;
      content: "";
    }

    .atlas-artwork-ready .atlas-logo-tips {
      z-index: 2;
      display: block;
      aspect-ratio: 600 / 559;
      pointer-events: none;
    }

    .atlas-artwork-ready .atlas-logo-tip {
      position: absolute;
      /* Position and size are fractions of the original logo canvas. */
      inset-inline-start: calc(100% * var(--tip-left));
      inset-block-start: calc(100% * var(--tip-top));
      inline-size: calc(100% * var(--tip-width));
      block-size: calc(100% * var(--tip-height));
      background-image: url('/static/pirots/atlas/pirots5-poster-600.webp');
      background-repeat: no-repeat;
      background-size: calc(100% / var(--tip-width)) calc(100% / var(--tip-height));
      background-position:
        calc(100% * var(--tip-left) / (1 - var(--tip-width)))
        calc(100% * var(--tip-top) / (1 - var(--tip-height)));
      mask-image: radial-gradient(ellipse 50% 50% at center, #000 42%, transparent 100%);
      transform-origin: var(--tip-hinge);
      animation: atlas-logo-tip-sway var(--tip-period) ease-in-out infinite alternate;
      animation-delay: var(--tip-delay, 0s);
    }

    .atlas-logo-tip--upper {
      --tip-left: .397;
      --tip-top: .045;
      --tip-width: .12;
      --tip-height: .18;
      --tip-hinge: 107.5% 76.1%;
      --tip-period: 3s;
      --tip-angle: 2deg;
      --tip-lift: -2.11%;
    }

    .atlas-logo-tip--middle {
      --tip-left: .371;
      --tip-top: .498;
      --tip-width: .14;
      --tip-height: .084;
      --tip-hinge: -.7% 73.8%;
      --tip-period: 3.8s;
      --tip-delay: -.9s;
      --tip-angle: -2.6deg;
      --tip-lift: -4.17%;
    }

    .atlas-logo-tip--lower {
      --tip-left: .498;
      --tip-top: .761;
      --tip-width: .14;
      --tip-height: .088;
      --tip-hinge: 112.1% 89.8%;
      --tip-period: 4.1s;
      --tip-delay: -1.4s;
      --tip-angle: 2.4deg;
      --tip-lift: -5.11%;
    }
  }
}

@keyframes atlas-feathers {
  0%, 100% { transform: rotate(-1.2deg); }
  30% { transform: rotate(2.4deg); }
  58% { transform: rotate(-1.5deg); }
  80% { transform: rotate(.8deg); }
}

@keyframes atlas-blink {
  0%, 28%, 32%, 79%, 83%, 100% { transform: scaleY(0); }
  29.3%, 30%, 80.3%, 81% { transform: scaleY(1); }
}

@keyframes atlas-logo-light {
  0%, 23% { background-position-x: 115%; }
  65%, 100% { background-position-x: -15%; }
}

@keyframes atlas-logo-glow {
  0%, 100% { opacity: .42; }
  52% { opacity: .73; }
}

@keyframes atlas-logo-tip-sway {
  from { transform: none; }
  to { transform: translateY(var(--tip-lift)) rotate(var(--tip-angle)); }
}

.atlas-temple-light {
  position: absolute;
  inset: 0;
  pointer-events: none;
  mix-blend-mode: screen;
}

.atlas-temple-light::before,
.atlas-temple-light::after {
  content: "";
  position: absolute;
  inset: 0;
}

.atlas-temple-light::before {
  background:
    radial-gradient(ellipse 6.5% 11% at 44.7% 26.6%, #fff6d6, #ffc0ffbf 39%, transparent 100%),
    radial-gradient(ellipse 6.3% 11% at 56.8% 28.1%, #fff6d6, #ffc0ffbf 39%, transparent 100%),
    radial-gradient(ellipse 22% 40% at 50.6% 34%, #f17eeeb0, #ba44ef57 56%, transparent 94%);
  opacity: .4;
}

.atlas-temple-light::after {
  clip-path: polygon(37% 4%, 66.3% 7%, 67% 27%, 63.9% 59%, 53.7% 58%, 52.1% 64%, 45.9% 65%, 45.7% 59%, 34.9% 55%, 35.9% 25%);
  background: linear-gradient(112deg, transparent 39%, #ffdb9752 46%, #fff7c4d9 50%, #ffd1fa70 54%, transparent 62%) 0 0 / 220% 100%;
  opacity: 0;
}

.atlas-city-coins { display: block; }

.atlas-city-coins,
.atlas-city-large-coin {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.atlas-city-coin {
  position: absolute;
  inset-inline-start: var(--coin-x, 36%);
  inset-block-start: var(--coin-y, 57%);
  inline-size: 11%;
  block-size: auto;
  translate: -50% -50%;
  filter: drop-shadow(0 0 .3rem #ffbf4e8f);
}

.atlas-city-coins > .atlas-city-coin:nth-child(2) {
  --coin-x: 55.4%;
  --coin-y: 59.5%;
}

.atlas-city-coins > .atlas-city-coin:nth-child(3) {
  --coin-x: 36%;
  --coin-y: 84%;
}

.atlas-city-large-coin {
  display: none;
}

/* Aligned samples from empty grid cells in the same official game image. */
.atlas-city-large-coin::before {
  content: "";
  position: absolute;
  inset-inline-start: var(--coin-x);
  inset-block-start: var(--coin-y);
  inline-size: calc(74 / 603 * 100%);
  block-size: calc(74 / 412 * 100%);
  translate: -50% -50%;
  background-image: url("/static/pirots/atlas/worlds/city-of-gold-coin-game.webp");
  background-size: calc(603 / 74 * 100%) calc(412 / 74 * 100%);
  background-position: var(--tile-sample);
  mask-image: var(--tile-mask);
}

.atlas-city-large-coin--five {
  --coin-x: 44.61%;
  --coin-y: 71.60%;
  --coin-size: 25.5%;
  --tile-sample: 43.856% 60.651%;
  --tile-mask: radial-gradient(ellipse closest-side, #000 86%, transparent 100%);
  --coin-delay: -.85s;
}

.atlas-city-large-coin--two {
  --coin-x: 70.65%;
  --coin-y: 58.74%;
  --coin-size: 26.2%;
  --tile-sample: 53.686% 60.947%;
  --tile-mask: radial-gradient(ellipse 48% 42% at 50% 47%, #000 87%, transparent 100%);
  --coin-delay: -3.25s;
}

.atlas-city-large-coin .atlas-city-coin {
  inset-inline-start: var(--sprite-x, var(--coin-x));
  inset-block-start: var(--sprite-y, var(--coin-y));
  inline-size: var(--coin-size);
  filter: drop-shadow(0 0 .2rem #ffe480a8);
}

/* The transparent padding differs slightly between the two original sprites. */
.atlas-city-large-coin--five .atlas-city-coin {
  --sprite-y: 71.79%;
}

.atlas-city-large-coin--two .atlas-city-coin {
  --sprite-x: 70.56%;
  --sprite-y: 58.93%;
}

@media (prefers-reduced-motion: no-preference) {
  .atlas-temple-light::before {
    animation: atlas-temple-pulse 3.6s ease-in-out infinite;
  }

  .atlas-temple-light::after {
    animation: atlas-temple-glint 4.8s ease-in-out infinite;
  }

  .atlas-city-large-coin.is-ready {
    display: block;
  }

  .atlas-city-coin {
    animation: atlas-coin-turn 7s ease-in-out infinite;
  }

  .atlas-city-coins > .atlas-city-coin:nth-child(2) {
    animation-delay: -2.35s;
  }

  .atlas-city-coins > .atlas-city-coin:nth-child(3) {
    animation-delay: -4.7s;
  }

  .atlas-city-large-coin .atlas-city-coin {
    animation-duration: 5.6s;
    animation-delay: var(--coin-delay);
  }
}

@media (hover: hover) and (prefers-reduced-motion: no-preference) {
  a.atlas-world-card {
    transition: transform .23s ease-out, box-shadow .23s ease-out, border-color .23s ease-out;
  }

  a.atlas-world-card:hover {
    transform: translateY(-.28rem);
  }
}

@keyframes atlas-temple-pulse {
  0%, 100% { opacity: .38; }
  42% { opacity: .96; }
  70% { opacity: .65; }
}

@keyframes atlas-temple-glint {
  0%, 19% { opacity: 0; background-position-x: 0%; }
  39% { opacity: .76; }
  65%, 100% { opacity: 0; background-position-x: 100%; }
}

@keyframes atlas-coin-turn {
  0%, 22% { transform: perspective(10rem) rotateY(0); }
  44%, 100% { transform: perspective(10rem) rotateY(1turn); }
}
