/* What You Get, and What You Own: The Reveal.

   How to mount it: load this after styles.css. It changes no size, gap or colour of the approved section. It adds
     1. one entrance, played once as each panel comes into view (only when offer-show.js has run and movement is allowed);
     2. a soft light inside the glass and along its edge that follows a mouse, and a very small tilt toward it.
   Everything that moves is a transform or an opacity. Tokens come from styles.css (--accent, --r-2, the spacing scale). */

[data-show-offer] { --of-ease: cubic-bezier(0.16, 1, 0.3, 1); --of-d: 0ms; }
[data-show-offer] .offer__part { transform-origin: 50% 60%; }

/* The large figure rises from behind its own foot. The outer span is the mask and never moves; the inner one does. */
.of-fig { display: inline-block; clip-path: inset(-0.3em -0.3em 0 -0.3em); }
.of-up { display: inline-block; }

/* The light. Two empty layers in each panel, both clipped to the panel's corners.
   .of-light is a wide soft glow under the words. .of-edge shows only on the panel's 1 pixel edge (its middle is masked away). */
.of-light, .of-edge { position: absolute; inset: 0; border-radius: inherit; overflow: hidden; pointer-events: none; }
.of-light { z-index: -1; }
.of-edge {
  padding: 1px;
  -webkit-mask: linear-gradient(#000 0 0) content-box, linear-gradient(#000 0 0); -webkit-mask-composite: xor;
  mask: linear-gradient(#000 0 0) content-box exclude, linear-gradient(#000 0 0);
}
.of-light i, .of-edge i { position: absolute; left: 0; top: 0; border-radius: 50%; opacity: 0; transition: opacity 0.45s ease; will-change: transform, opacity; }
.of-light i { width: 880px; height: 880px; margin: -440px 0 0 -440px; background: radial-gradient(closest-side, rgba(47, 75, 255, 0.11) 0%, rgba(47, 75, 255, 0.101) 10%, rgba(47, 75, 255, 0.084) 20%, rgba(47, 75, 255, 0.065) 30%, rgba(47, 75, 255, 0.047) 40%, rgba(47, 75, 255, 0.032) 50%, rgba(47, 75, 255, 0.02) 60%, rgba(47, 75, 255, 0.011) 70%, rgba(47, 75, 255, 0.005) 80%, rgba(47, 75, 255, 0.001) 90%, rgba(47, 75, 255, 0) 100%); }
.of-edge i { width: 560px; height: 560px; margin: -280px 0 0 -280px; background: radial-gradient(closest-side, rgba(47, 75, 255, 1), rgba(47, 75, 255, 0.5) 40%, rgba(47, 75, 255, 0) 100%); }
.is-lit > .of-light i, .is-lit > .of-edge i { opacity: 1; transition-duration: 0.25s; }
/* the one pass of light along the edge as the figure lands: a band half the panel wide, waiting off the left side */
.of-edge::before { content: ""; position: absolute; inset-block: 0; left: 0; width: 50%; transform: translateX(-101%); background: linear-gradient(90deg, rgba(47, 75, 255, 0), rgba(47, 75, 255, 0.9) 50%, rgba(47, 75, 255, 0)); }

/* The entrance. Nothing here applies unless offer-show.js has put .of-ready on <html>, which it does only when movement is allowed. */
@media (prefers-reduced-motion: no-preference) {
  .of-ready [data-show-offer] .offer__part:not(.is-in),
  .of-ready [data-show-offer] .of-item:not(.is-in) { opacity: 0; }
  .of-ready [data-show-offer] .of-up:not(.is-in) { opacity: 1; transform: translateY(112%); }
  .of-ready [data-show-offer] .rows--marked li:not(.is-in)::before { transform: scale(0); }

  [data-show-offer] .is-in { animation-duration: 0.7s; animation-timing-function: var(--of-ease); animation-fill-mode: both; animation-delay: var(--of-d); }
  [data-show-offer] .offer__part.is-in { animation-name: of-panel; animation-duration: 0.9s; }
  [data-show-offer] h3.is-in { animation-name: of-rise; }
  [data-show-offer] .of-up.is-in { animation-name: of-up; animation-duration: 1.05s; }
  [data-show-offer] .price__term.is-in { animation-name: of-slide; animation-duration: 0.6s; }
  [data-show-offer] li.is-in { animation-name: of-rise; animation-duration: 0.6s; }
  [data-show-offer] .rows--marked li.is-in::before { animation: of-dot 0.5s cubic-bezier(0.3, 1.6, 0.5, 1) both; animation-delay: calc(var(--of-d) + 160ms); }
  [data-show-offer] .offer__part.is-in > .of-edge::before { animation: of-sweep 1.3s cubic-bezier(0.45, 0, 0.2, 1) both; animation-delay: calc(var(--of-d) + 380ms); }
  /* once an entrance has finished it is taken off, so the panel is free to tilt and the words are drawn plain */
  [data-show-offer] .is-in.is-done, [data-show-offer] li.is-in.is-done::before, [data-show-offer] .of-edge.is-swept::before { animation: none; }

  @keyframes of-panel { from { opacity: 0; transform: translateY(32px); } to { opacity: 1; transform: none; } }
  @keyframes of-rise { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: none; } }
  @keyframes of-slide { from { opacity: 0; transform: translateX(-14px); } to { opacity: 1; transform: none; } }
  @keyframes of-up { from { transform: translateY(112%); } to { transform: none; } }
  @keyframes of-dot { from { transform: scale(0); } to { transform: none; } }
  @keyframes of-sweep { from { transform: translateX(-101%); } to { transform: translateX(201%); } }
}
