.fold-light, .flap-lining { display: none }

@media (prefers-reduced-motion: no-preference) {
  .opening .envelope {
    --hinge-duration: 2.56s;
    --hinge-delay: 1.12s;
    --hinge-curve: cubic-bezier(.42,.04,.36,.97);
  }

  /* All three layers hinge on the same fold so the light follows the paper. */
  .opening .envelope :is(.flap, .flap-lining, .fold-light) {
    transform-origin: 50% 0;
    transition: none;
    animation: lift-envelope-flap var(--hinge-duration) var(--hinge-delay) var(--hinge-curve) both;
  }

  .opening .envelope .flap-lining {
    display: block;
    position: absolute;
    inset: 0;
    border-radius: inherit;
    clip-path: polygon(0 0,100% 0,100% 4%,50% 62%,0 4%);
    background: linear-gradient(170deg, #ad837b, #c9a89a 17%, #d9bcac 44%, #b99289 75%);
  }

  .opening .envelope .fold-light {
    display: block;
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    overflow: visible;
    pointer-events: none;
    backface-visibility: hidden;
    filter: drop-shadow(0 0 1.4px #fff) drop-shadow(0 0 4px #fff8eb) drop-shadow(0 0 9px #ffdec4);
    animation-name: lift-envelope-flap, fold-light-intensity;
    animation-duration: var(--hinge-duration), 2.85s;
    animation-delay: var(--hinge-delay), 0s;
    animation-timing-function: var(--hinge-curve), linear;
  }

  .fold-light path {
    stroke-dasharray: 1;
    animation: light-along-fold 2.08s cubic-bezier(.36,.10,.35,.93) both;
  }

  .opening .envelope .flap::after {
    content: "";
    position: absolute;
    inset: 0;
    background: radial-gradient(ellipse at 50% 65%, #fff9e5ba, #ffead640 19%, transparent 52%);
    animation: fold-light-intensity 2.85s linear both;
  }

  .opening .envelope .seal {
    animation: release-envelope-seal 1.02s .62s cubic-bezier(.38,.07,.49,.95) both;
    transition: none;
  }

  .opening .envelope .peek {
    transition: none;
    animation: lift-invitation-paper 2.30s 2.60s cubic-bezier(.40,.06,.25,1) both;
  }

  .opening .envelope .peek::after {
    content: "";
    position: absolute;
    inset: -2px;
    background: radial-gradient(ellipse at 50% 50%, #fffdf6f2, #fff6e27a 40%, transparent 80%);
    animation: light-on-paper 2.15s 1.36s ease-in-out both;
  }

  .opening .cover .cover-heading,
  .opening .cover .prompt {
    animation: quiet-cover-type 1.16s .96s ease both;
  }

  .opening .envelope {
    animation: lower-empty-envelope 2.40s 2.50s cubic-bezier(.42,.07,.26,1) both;
  }

  @keyframes light-along-fold {
    from { stroke-dashoffset: .84 }
    to { stroke-dashoffset: 0 }
  }
  @keyframes fold-light-intensity {
    0% { opacity: .025 }
    18% { opacity: .15 }
    40% { opacity: .42 }
    59% { opacity: .78 }
    72%, 78% { opacity: 1 }
    89% { opacity: .47 }
    100% { opacity: 0 }
  }
  @keyframes release-envelope-seal {
    from { opacity: 1; transform: translate(-50%,-50%) }
    to { opacity: 0; transform: translate(-50%,-80%) scale(.97) }
  }
  @keyframes lift-envelope-flap {
    from { transform: rotateX(0deg) }
    to { transform: rotateX(163deg) }
  }
  @keyframes lift-invitation-paper {
    from { transform: translateY(0) }
    to { transform: translateY(-112%) }
  }
  @keyframes lower-empty-envelope {
    from { transform: var(--envelope-pose, rotate(0deg)) }
    to { transform: translateY(52%) rotate(0deg) }
  }
  @keyframes light-on-paper {
    0%,100% { opacity: 0 }
    23% { opacity: .26 }
    50% { opacity: .90 }
    69% { opacity: .68 }
  }
  @keyframes quiet-cover-type {
    from { opacity: 1 }
    to { opacity: 0 }
  }
}
