/* QwjGRmo visual reference: eight photographic echoes behind the real subject. */
.amia-echoes { display: none; }
@media (prefers-reduced-motion: no-preference) {
  html.amia-layered .amia-echoes {
    display: block;
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    border-radius: inherit;
    transform: translate3d(0, var(--amia-back-y, 0px), 0) scale(calc(1.10 - var(--amia-depth-progress, 0) * .025));
  }
  .amia-echo {
    position: absolute;
    inset: 0;
    pointer-events: none;
    transform: translate3d(calc(var(--echo-x, 0px) * var(--echo-depth)), calc(var(--echo-y, 0px) * var(--echo-depth)), 0);
  }
  .amia-echo::before {
    content: '';
    position: absolute;
    inset: 0;
    background: url('/assets/hero-layers/background-v1.webp') 83.3% 26.1% / cover no-repeat;
    border: 1px solid rgb(241 229 207 / .14);
    border-radius: 12px;
    box-shadow: 0 4px 22px rgb(28 24 20 / .16);
    transform-origin: 55% 48%;
    transform: scale(var(--echo-scale));
    opacity: .85;
    animation: amia-echo-open 1600ms cubic-bezier(.22, 1, .36, 1) var(--echo-delay) backwards;
  }
  @keyframes amia-echo-open {
    from { transform: scale(1); opacity: 0; }
    to { transform: scale(var(--echo-scale)); opacity: .85; }
  }

  /* All layers align at full size, hold briefly, then return to their depth. */
  .amia-echoes:is(.echo-cycle-a, .echo-cycle-b) .amia-echo,
  .amia-echoes:is(.echo-cycle-a, .echo-cycle-b) .amia-echo::before {
    animation-duration: 2200ms;
    animation-timing-function: cubic-bezier(.45, 0, .2, 1);
    animation-delay: 0ms;
    animation-fill-mode: backwards;
  }

  .echo-cycle-a .amia-echo { animation-name: amia-gather-a; }
  .echo-cycle-a .amia-echo::before { animation-name: amia-fold-a; }
  @keyframes amia-fold-a {
    0%, 100% { transform: scale(var(--echo-scale)); opacity: .85; }
    38%, 52% { transform: scale(1); opacity: .85; }
  }
  @keyframes amia-gather-a {
    0%, 100% { transform: translate3d(calc(var(--echo-x, 0px) * var(--echo-depth)), calc(var(--echo-y, 0px) * var(--echo-depth)), 0); }
    38%, 52% { transform: translate3d(0, 0, 0); }
  }

  .echo-cycle-b .amia-echo { animation-name: amia-gather-b; }
  .echo-cycle-b .amia-echo::before { animation-name: amia-fold-b; }
  @keyframes amia-fold-b {
    0%, 100% { transform: scale(var(--echo-scale)); opacity: .85; }
    38%, 52% { transform: scale(1); opacity: .85; }
  }
  @keyframes amia-gather-b {
    0%, 100% { transform: translate3d(calc(var(--echo-x, 0px) * var(--echo-depth)), calc(var(--echo-y, 0px) * var(--echo-depth)), 0); }
    38%, 52% { transform: translate3d(0, 0, 0); }
  }
}

/* Three quiet layers on touch devices: entry + tap, no continuous movement. */
@media (max-width: 809px), (hover: none), (pointer: coarse) {
  html.amia-layered .amia-echoes { transform: none; }
  /* Avoid persistent 3D wrappers and completed animation layers on Safari. */
  .amia-echo { transform: none; animation: none !important; }
  .amia-echo::before {
    box-shadow: none;
    animation-duration: 1200ms;
    animation-fill-mode: backwards !important;
  }
  .amia-echoes:is(.echo-cycle-a, .echo-cycle-b) .amia-echo,
  .amia-echoes:is(.echo-cycle-a, .echo-cycle-b) .amia-echo::before { animation-duration: 1800ms; }
}

@media (max-width: 809px) and (prefers-reduced-motion: no-preference) {
  .amia-echo::before {
    background-position: 14% 26.1%;
    border-color: rgb(241 229 207 / .26);
    animation-duration: 1700ms;
  }
  .amia-echoes:is(.echo-cycle-a, .echo-cycle-b) .amia-echo,
  .amia-echoes:is(.echo-cycle-a, .echo-cycle-b) .amia-echo::before { animation-duration: 2100ms; }
}
