/*
 * Opening screens that are a whole scene (opening-scenes.js): kente, lantern and crescent, fireworks, clouds and light, rain of
 * gold, circuit of light. Everything is drawn here, with gradients, small SVG tiles and a little markup: no picture is downloaded.
 *   .sc-art    the scene, full screen, behind everything
 *   .sc-flash  the burst of light the scene opens into
 *   .sc-panel  the frosted panel: occasion, names, date, greeting, "Toucher pour ouvrir"; it appears after a moment
 * The names are written in the font of the invitation (invitation-opening-fonts.css).
 */
.invitation .invite-opening.invite-opening-scene {
  --sc-glass: rgb(8 10 22 / 54%);
  --sc-ink: #fff;
  --sc-soft: rgb(255 255 255 / 80%);
  --sc-line: rgb(255 255 255 / 22%);
  display: block;
  padding: 0;
  overflow: hidden;
  background: #0b0d14;
  transition: opacity 0.9s ease 0.4s;
}
/* Light scenes carry a light panel with dark writing. */
.invitation .invite-opening.invite-opening-lantern,
.invitation .invite-opening.invite-opening-clouds {
  --sc-glass: rgb(255 251 243 / 66%);
  --sc-ink: #2c2415;
  --sc-soft: rgb(44 36 21 / 78%);
  --sc-line: rgb(60 42 12 / 24%);
}
.sc-art,
.sc-art > * {
  position: absolute;
}
.sc-art {
  inset: 0;
  overflow: hidden;
  transform-origin: 50% 45%;
}
.invitation .invite-opening-scene.is-leaving .sc-art {
  transform: scale(1.45);
  filter: brightness(1.7) saturate(1.15);
  transition:
    transform 1.3s cubic-bezier(0.45, 0, 0.9, 0.6),
    filter 1.1s ease;
}
.sc-flash {
  position: absolute;
  inset: 0;
  background: radial-gradient(
    circle at 50% 45%,
    #fff 0,
    rgb(255 255 255 / 78%) 38%,
    rgb(255 255 255 / 0%) 78%
  );
  opacity: 0;
  pointer-events: none;
}
.invitation .invite-opening-scene.is-leaving .sc-flash {
  opacity: 1;
  transition: opacity 0.8s ease 0.3s;
}

/* --- The panel -------------------------------------------------------------------------------------------------------- */
.sc-panel {
  position: absolute;
  left: 50%;
  top: 50%;
  translate: -50% -50%;
  display: grid;
  justify-items: center;
  gap: 8px;
  width: min(340px, calc(100% - 36px));
  max-height: calc(100% - 28px);
  overflow-y: auto;
  scrollbar-width: none;
  padding: 26px 22px 18px;
  border: 1px solid var(--sc-line);
  border-radius: 18px;
  background: var(--sc-glass);
  backdrop-filter: blur(12px) saturate(1.2);
  -webkit-backdrop-filter: blur(12px) saturate(1.2);
  box-shadow: 0 18px 50px rgb(0 0 0 / 28%);
  color: var(--sc-ink);
  text-align: center;
  opacity: 0;
  animation: sc-panel-in 1s ease 1.7s forwards;
}
.sc-panel::-webkit-scrollbar {
  display: none;
}
.invitation .invite-opening-scene.is-leaving .sc-panel {
  opacity: 0;
  animation: none;
  transition: opacity 0.3s ease;
}
.sc-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--sc-soft);
}
.invitation .invite-opening-scene h2 {
  margin: 2px 0 0;
  color: var(--sc-ink);
  font-size: 34px;
  line-height: 1.12;
}
.invitation .invite-opening-scene .invite-opening-date {
  margin: 0;
  color: var(--sc-ink);
  font-size: 16px;
  font-style: italic;
  letter-spacing: 0.02em;
}
.invitation .invite-opening-scene .sc-greeting {
  margin: 0;
  color: var(--sc-soft);
  font-size: 14px;
}
.invitation .invite-opening-scene .sc-tap {
  min-height: 46px;
  margin: 8px 0 0;
  padding: 0 12px;
  border: 0;
  background: transparent;
  color: var(--sc-ink);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.26em;
  text-transform: uppercase;
  box-shadow: none;
  animation: sc-tap 2.4s ease-in-out infinite;
}
.invitation .invite-opening-scene .sc-tap:focus-visible {
  outline: 2px solid var(--sc-ink);
  outline-offset: 2px;
  border-radius: 8px;
}
@keyframes sc-panel-in {
  from {
    opacity: 0;
    filter: blur(6px);
  }
  to {
    opacity: 1;
    filter: none;
  }
}
@keyframes sc-tap {
  0%,
  100% {
    opacity: 0.55;
  }
  50% {
    opacity: 1;
  }
}

/* --- Kente: a woven cloth that drifts slowly ---------------------------------------------------------------------------- */
.sc-kente-cloth {
  inset: -35%;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='160' height='160'%3E%3Crect width='160' height='160' fill='%23e8b02a'/%3E%3Crect width='160' height='11' fill='%23161616'/%3E%3Crect y='11' width='160' height='5' fill='%23c63b22'/%3E%3Crect y='16' width='160' height='5' fill='%232f7d3b'/%3E%3Cpolygon points='0,26 76,26 0,102' fill='%23c63b22'/%3E%3Cpolygon points='84,26 160,26 160,102' fill='%232f7d3b'/%3E%3Cpolygon points='76,102 0,102 76,26' fill='%23161616'/%3E%3Cpolygon points='160,102 84,102 84,26' fill='%23c63b22'/%3E%3Cpolygon points='20,82 20,102 0,102' fill='%23e8b02a'/%3E%3Cpolygon points='140,82 160,102 140,102' fill='%23e8b02a'/%3E%3Crect y='112' width='160' height='6' fill='%23161616'/%3E%3Crect y='118' width='160' height='4' fill='%232f7d3b'/%3E%3Crect y='122' width='160' height='4' fill='%23c63b22'/%3E%3Cg fill='%23161616'%3E%3Crect x='0' y='132' width='20' height='8'/%3E%3Crect x='40' y='132' width='20' height='8'/%3E%3Crect x='80' y='132' width='20' height='8'/%3E%3Crect x='120' y='132' width='20' height='8'/%3E%3C/g%3E%3Cg fill='%232f7d3b'%3E%3Crect x='20' y='140' width='20' height='8'/%3E%3Crect x='60' y='140' width='20' height='8'/%3E%3Crect x='100' y='140' width='20' height='8'/%3E%3Crect x='140' y='140' width='20' height='8'/%3E%3C/g%3E%3Crect y='152' width='160' height='8' fill='%23c63b22'/%3E%3C/svg%3E");
  background-size: 130px 130px;
  transform: rotate(-26deg);
  animation: sc-drift 46s linear infinite;
}
.sc-kente::after,
.invite-opening-kente .sc-art::after {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgb(0 0 0 / 0%) 35%, rgb(0 0 0 / 38%) 100%);
}
@keyframes sc-drift {
  to {
    background-position: 260px 130px;
  }
}

/* The lantern hangs from the top: the panel sits lower so that it does not hide it. */
.invite-opening-lantern .sc-panel {
  top: auto;
  bottom: 18px;
  translate: -50% 0;
  max-height: calc(100% - 190px);
}

/* --- Lantern and crescent: warm light through a pierced lantern ------------------------------------------------------- */
.invite-opening-lantern .sc-art {
  background: radial-gradient(circle at 50% 42%, #fff1c9 0, #f2cf8b 42%, #b98443 100%);
}
.sc-glow {
  inset: 0;
  background: radial-gradient(circle at 50% 44%, rgb(255 244 200 / 90%), rgb(255 200 110 / 0%) 62%);
  animation: sc-breathe 3.6s ease-in-out infinite alternate;
}
.sc-lattice {
  inset: 0;
  opacity: 0.5;
  background:
    radial-gradient(circle at 50% 50%, rgb(110 70 20 / 38%) 0 7px, transparent 8px) 0 0 / 46px 46px,
    radial-gradient(circle at 0 0, transparent 0 15px, rgb(110 70 20 / 30%) 16px 18px, transparent 19px) 0 0 /
      46px 46px,
    radial-gradient(circle at 100% 100%, transparent 0 15px, rgb(110 70 20 / 30%) 16px 18px, transparent 19px)
      0 0 / 46px 46px;
  -webkit-mask-image: radial-gradient(ellipse at 50% 44%, transparent 8%, #000 70%);
  mask-image: radial-gradient(ellipse at 50% 44%, transparent 8%, #000 70%);
}
.sc-lantern {
  left: 50%;
  top: 0;
  width: min(44vw, 170px);
  height: auto;
  translate: -50% 0;
  transform-origin: 50% 0;
  filter: drop-shadow(0 12px 18px rgb(80 45 5 / 35%));
  animation: sc-sway 6s ease-in-out infinite alternate;
}
.sc-lantern-glass {
  animation: sc-flicker 2.8s ease-in-out infinite alternate;
}
.sc-crescent {
  right: 9%;
  top: 11%;
  width: 62px;
  height: 62px;
  animation: sc-breathe 4.4s ease-in-out infinite alternate;
}
@keyframes sc-sway {
  from {
    rotate: -1.6deg;
  }
  to {
    rotate: 1.6deg;
  }
}
@keyframes sc-flicker {
  from {
    opacity: 0.82;
  }
  to {
    opacity: 1;
  }
}
@keyframes sc-breathe {
  from {
    opacity: 0.72;
  }
  to {
    opacity: 1;
  }
}

/* --- Fireworks: bursts of golden rays in a night sky ---------------------------------------------------------------------- */
.invite-opening-fireworks .sc-art {
  background: radial-gradient(circle at 50% 30%, #17203d 0, #090c1b 55%, #03040a 100%);
}
.sc-fw {
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  margin: calc(var(--s) / -2) 0 0 calc(var(--s) / -2);
  border-radius: 50%;
  background: repeating-conic-gradient(from 7deg, var(--c) 0 1.6deg, transparent 1.6deg 12deg);
  -webkit-mask-image: radial-gradient(circle, transparent 10%, #000 14%, #000 46%, transparent 70%);
  mask-image: radial-gradient(circle, transparent 10%, #000 14%, #000 46%, transparent 70%);
  filter: drop-shadow(0 0 5px var(--c));
  opacity: 0;
  scale: 0.1;
  animation: sc-burst 4.2s ease-out var(--d) infinite;
}
@keyframes sc-burst {
  0% {
    opacity: 0;
    scale: 0.1;
  }
  8% {
    opacity: 1;
  }
  55% {
    opacity: 0.9;
    scale: 1;
  }
  100% {
    opacity: 0;
    scale: 1.12;
  }
}

/* --- Clouds and light: a soft sky, rays that turn slowly -------------------------------------------------------------------- */
.invite-opening-clouds .sc-art {
  background: linear-gradient(180deg, #a9d3f0 0%, #d6ebf8 48%, #fdf6e9 100%);
}
.sc-rays {
  left: 50%;
  top: -30%;
  width: 160%;
  height: 160%;
  translate: -50% 0;
  background: repeating-conic-gradient(
    from 0deg at 50% 0%,
    rgb(255 255 255 / 45%) 0 5deg,
    transparent 5deg 17deg
  );
  -webkit-mask-image: linear-gradient(180deg, #000 0, transparent 70%);
  mask-image: linear-gradient(180deg, #000 0, transparent 70%);
  transform-origin: 50% 0;
  animation: sc-rays 30s ease-in-out infinite alternate;
}
@keyframes sc-rays {
  from {
    rotate: -7deg;
  }
  to {
    rotate: 7deg;
  }
}
.sc-cloud {
  top: var(--y);
  left: -40%;
  width: var(--w);
  height: calc(var(--w) * 0.34);
  border-radius: 50%;
  background: radial-gradient(
    ellipse at 50% 55%,
    #fff 0,
    rgb(255 255 255 / 85%) 45%,
    rgb(255 255 255 / 0%) 72%
  );
  filter: blur(5px);
  animation: sc-cloud var(--d) linear var(--t) infinite;
}
@keyframes sc-cloud {
  from {
    translate: 0 0;
  }
  to {
    translate: 190vw 0;
  }
}
.sc-spark {
  left: var(--x);
  top: var(--y);
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 0 10px 3px rgb(255 255 255 / 80%);
  animation: sc-twinkle 3s ease-in-out var(--t) infinite;
}
@keyframes sc-twinkle {
  0%,
  100% {
    opacity: 0.15;
    scale: 0.6;
  }
  50% {
    opacity: 1;
    scale: 1;
  }
}

/* --- Rain of gold: soft golden lights and falling confetti ----------------------------------------------------------------- */
.invite-opening-gold .sc-art {
  background: radial-gradient(circle at 50% 38%, #1c1710 0, #0a0907 62%, #040403 100%);
}
.sc-bk {
  left: var(--x);
  top: var(--y);
  width: var(--s);
  height: var(--s);
  border-radius: 50%;
  background: radial-gradient(circle, var(--c), transparent 70%);
  opacity: 0.55;
  filter: blur(1.5px);
  animation: sc-float var(--d) ease-in-out var(--t) infinite alternate;
}
@keyframes sc-float {
  from {
    translate: 0 8px;
    opacity: 0.25;
  }
  to {
    translate: 0 -18px;
    opacity: 0.7;
  }
}
.sc-conf {
  left: var(--x);
  top: -6%;
  width: var(--w);
  height: calc(var(--w) * 1.8);
  background: var(--c);
  border-radius: 1px;
  opacity: 0.9;
  rotate: var(--r);
  animation: sc-fall var(--d) linear var(--t) infinite;
}
@keyframes sc-fall {
  from {
    translate: 0 0;
    rotate: var(--r);
  }
  to {
    translate: 26px 116vh;
    rotate: calc(var(--r) + 540deg);
  }
}

/* --- Circuit of light: traces with pulses running along them -------------------------------------------------------------- */
.invite-opening-circuit .sc-art {
  background: linear-gradient(180deg, #06142d 0%, #0a2a5c 55%, #0b1b3c 100%);
}
.sc-haze {
  inset: 0;
  background: radial-gradient(circle at 50% 36%, rgb(70 160 255 / 35%), transparent 62%);
}
.sc-circuit {
  inset: 0;
  width: 100%;
  height: 100%;
}
.sc-trace,
.sc-pulse {
  fill: none;
  stroke-linejoin: round;
}
.sc-trace {
  stroke: rgb(120 190 255 / 38%);
  stroke-width: 1.2;
}
.sc-pulse {
  stroke: #9fe0ff;
  stroke-width: 2.2;
  stroke-linecap: round;
  stroke-dasharray: 46 900;
  filter: drop-shadow(0 0 4px #5cc8ff);
  animation: sc-run var(--d) linear var(--t) infinite;
}
@keyframes sc-run {
  from {
    stroke-dashoffset: 60;
  }
  to {
    stroke-dashoffset: -960;
  }
}
.sc-node {
  fill: #bfeaff;
  filter: drop-shadow(0 0 5px #5cc8ff);
  animation: sc-twinkle 2.6s ease-in-out var(--t) infinite;
}

/* --- Calm for visitors who ask for it: the scene stays still, the panel is there at once ----------------------------------- */
@media (prefers-reduced-motion: reduce) {
  .sc-kente-cloth,
  .sc-glow,
  .sc-lantern,
  .sc-lantern-glass,
  .sc-crescent,
  .sc-fw,
  .sc-rays,
  .sc-cloud,
  .sc-spark,
  .sc-bk,
  .sc-conf,
  .sc-pulse,
  .sc-node,
  .sc-tap {
    animation: none;
  }
  .sc-fw {
    opacity: 0.85;
    scale: 1;
  }
  .sc-cloud {
    left: 20%;
  }
  .sc-panel {
    opacity: 1;
    animation: none;
  }
  .invitation .invite-opening-scene.is-leaving .sc-art {
    transform: none;
    transition: none;
  }
}

/* --- Small pictures for the choice of opening screen (style panel and template editor) -------------------------------------- */
.fx-opening .fx-op-scene {
  position: absolute;
  inset: 0;
  overflow: hidden;
  border-radius: inherit;
}
.fx-op-scene i {
  position: absolute;
  left: 20%;
  right: 20%;
  top: 38%;
  height: 26%;
  border: 1px solid rgb(255 255 255 / 35%);
  border-radius: 4px;
  background: rgb(8 10 22 / 55%);
}
.fx-opening-lantern .fx-op-scene i,
.fx-opening-clouds .fx-op-scene i {
  background: rgb(255 251 243 / 70%);
  border-color: rgb(60 42 12 / 30%);
}
.fx-op-scene b {
  position: absolute;
  border-radius: 50%;
}
.fx-opening-kente .fx-op-scene {
  background:
    linear-gradient(135deg, #c63b22 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(225deg, #2f7d3b 25%, transparent 25%) 0 0 / 14px 14px,
    linear-gradient(45deg, #161616 25%, transparent 25%) 0 0 / 14px 14px,
    #e8b02a;
}
.fx-opening-lantern .fx-op-scene {
  background: radial-gradient(circle at 50% 40%, #fff1c9, #f2cf8b 45%, #b98443);
}
.fx-opening-fireworks .fx-op-scene {
  background: radial-gradient(circle at 50% 30%, #17203d, #03040a);
}
.fx-opening-fireworks .fx-op-scene b {
  width: 16px;
  height: 16px;
  background: radial-gradient(circle, transparent 28%, #ffd36a 30%, transparent 66%);
}
.fx-opening-fireworks .fx-op-scene b:first-child {
  left: 12%;
  top: 8%;
}
.fx-opening-fireworks .fx-op-scene b:nth-child(2) {
  right: 12%;
  top: 14%;
  background: radial-gradient(circle, transparent 28%, #ff9e5e 30%, transparent 66%);
}
.fx-opening-clouds .fx-op-scene {
  background: linear-gradient(180deg, #a9d3f0, #fdf6e9);
}
.fx-opening-clouds .fx-op-scene b {
  width: 26px;
  height: 10px;
  background: #fff;
  filter: blur(2px);
}
.fx-opening-clouds .fx-op-scene b:first-child {
  left: 6%;
  top: 14%;
}
.fx-opening-clouds .fx-op-scene b:nth-child(2) {
  right: 4%;
  bottom: 12%;
}
.fx-opening-gold .fx-op-scene {
  background: radial-gradient(circle at 50% 38%, #1c1710, #040403);
}
.fx-opening-gold .fx-op-scene b {
  width: 10px;
  height: 10px;
  background: radial-gradient(circle, #f6d36b, transparent 70%);
}
.fx-opening-gold .fx-op-scene b:first-child {
  left: 10%;
  top: 12%;
}
.fx-opening-gold .fx-op-scene b:nth-child(2) {
  right: 12%;
  top: 22%;
}
.fx-opening-gold .fx-op-scene b:nth-child(3) {
  left: 24%;
  bottom: 10%;
}
.fx-opening-circuit .fx-op-scene {
  background:
    repeating-linear-gradient(90deg, transparent 0 9px, rgb(120 190 255 / 45%) 9px 10px),
    linear-gradient(180deg, #06142d, #0a2a5c);
}
