.cipher { display: block; position: relative }
.cipher-light { display: none }

@media screen and (prefers-reduced-motion: no-preference) {
  .arriving .cipher {
    --foil-time: 4800ms;
    --foil-delay: 140ms;
    --foil-ease: cubic-bezier(.31, .22, .69, .83);
  }

  /* These two masks travel together. Only the moving edge of the existing foil catches light. */
  .arriving .cipher-face,
  .arriving .cipher-light > .monogram {
    -webkit-mask-size: 100% 212%;
    mask-size: 100% 212%;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    animation: rise-through-foil var(--foil-time) var(--foil-ease) var(--foil-delay) both;
  }
  .arriving .cipher-face {
    -webkit-mask-image: linear-gradient(to bottom, transparent 46%, #000 54%);
    mask-image: linear-gradient(to bottom, transparent 46%, #000 54%);
  }
  .arriving .cipher-light {
    display: block;
    position: absolute;
    inset: 0;
    pointer-events: none;
    filter: drop-shadow(0 0 2px #fff0b3) drop-shadow(0 0 5px #e6ab48);
    animation: foil-light-life var(--foil-time) linear var(--foil-delay) both;
  }
  .arriving .cipher-light > .monogram {
    filter: sepia(.65) saturate(1.5) brightness(1.75);
    -webkit-mask-image: linear-gradient(to bottom, transparent 46%, #000 51%, #000a 54%, transparent 61%);
    mask-image: linear-gradient(to bottom, transparent 46%, #000 51%, #000a 54%, transparent 61%);
  }
  @keyframes rise-through-foil {
    from { -webkit-mask-position: 50% 0%; mask-position: 50% 0% }
    to { -webkit-mask-position: 50% 100%; mask-position: 50% 100% }
  }
  @keyframes foil-light-life {
    0%, 100% { opacity: 0 }
    14%, 82% { opacity: .93 }
  }

  /* Reveal whole Arabic phrases, preserving joins, diacritics and the live tilt transform. */
  .arriving :is(#greeting, .hosts > *, .couple, .weekday, .calendars, .guest-notes > li, .venue > *) {
    animation: invitation-line 1250ms cubic-bezier(.3,.14,.25,1) var(--line-delay) backwards;
  }
  .arriving #greeting               { --line-delay: 5060ms }
  .arriving .hosts > :first-child   { --line-delay: 5640ms }
  .arriving .parents                { --line-delay: 6180ms }
  .arriving .hosts > :last-child    { --line-delay: 6860ms }
  .arriving .couple                 { --line-delay: 7500ms }
  .arriving .weekday                { --line-delay: 8270ms }
  .arriving .calendars              { --line-delay: 8750ms }
  .arriving .guest-notes > :nth-child(1) { --line-delay: 9260ms }
  .arriving .guest-notes > :nth-child(2) { --line-delay: 9670ms }
  .arriving .guest-notes > :nth-child(3) { --line-delay: 10050ms }
  .arriving .venue h3               { --line-delay: 10700ms }
  .arriving .venue p                { --line-delay: 11100ms }
  .arriving .venue .map             { --line-delay: 11500ms }
  .arriving .venue .map:focus-visible { animation: none }
  @keyframes invitation-line {
    from { opacity: 0; translate: 0 -15px }
    to { opacity: 1; translate: 0 0 }
  }
}
