/* The footer is the ground: the home meets its upper edge and its lit windows
   sit in the quiet space below the heading. */
.closing-section {
  --faq-home-width: clamp(280px, 27vw, 380px);
  --faq-ground-color: #0f1622;
  gap: 0;
  justify-content: space-between;
  padding-bottom: 0;
}

.closing-section .faq-section {
  position: relative;
  z-index: 1;
  margin-block: 0;
  align-items: start;
}

.faq-ground {
  position: relative;
  flex-shrink: 0;
  width: 100%;
  margin-top: clamp(36px, 5vh, 64px);
  background: var(--faq-ground-color);
}

.faq-ground__scene {
  position: absolute;
  z-index: 0;
  inset: auto 0 100%;
  height: 0;
  margin-inline: auto;
  pointer-events: none;
}

.closing-section .faq-ground > .footer {
  position: relative;
  z-index: 2;
  margin-top: 0;
  border-top: 0;
  background: transparent;
}

.faq-home {
  --home-ground-offset: 8%;
  position: absolute;
  left: 0;
  bottom: 0;
  isolation: isolate;
  container-type: inline-size;
  width: min(var(--faq-home-width), 42%);
  aspect-ratio: 3 / 2;
  margin: 0;
  transform: translateY(var(--home-ground-offset));
  pointer-events: none;
  user-select: none;
}

.faq-home > img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.faq-home__smoke {
  position: absolute;
  z-index: 1;
  left: 35.8%;
  top: 32.4%;
  width: 0;
  height: 0;
  color: #eee5d7;
}

.faq-home__smoke > i {
  --drift: 1;
  position: absolute;
  bottom: 0;
  left: -2.5cqw;
  width: 5cqw;
  height: 10cqw;
  opacity: 0;
  filter: blur(1.8px);
  transform-origin: 50% 100%;
  animation: faq-home-smoke 7.2s linear infinite;
  animation-play-state: paused;
}

/* Two open curves form a thin wisp, rather than a chain of round puffs. */
.faq-home__smoke > i::before,
.faq-home__smoke > i::after {
  content: '';
  position: absolute;
  width: 72%;
  height: 62%;
  border-radius: 50%;
  border: 0 solid currentColor;
}
.faq-home__smoke > i::before {
  left: 0;
  bottom: 0;
  border-left-width: 1cqw;
}
.faq-home__smoke > i::after {
  right: 0;
  top: 0;
  border-right-width: .8cqw;
}
.faq-home__smoke > i:nth-child(2) { animation-delay: -1.8s; --drift: .6; }
.faq-home__smoke > i:nth-child(3) { animation-delay: -3.6s; --drift: 1.2; }
.faq-home__smoke > i:nth-child(4) { animation-delay: -5.4s; --drift: .8; }
.faq-home.is-visible .faq-home__smoke > i { animation-play-state: running; }

@keyframes faq-home-smoke {
  0% {
    opacity: 0;
    transform: translate(0, 1cqw) scale(.36, .45) rotate(-8deg);
  }
  18% {
    opacity: .25;
    transform: translate(calc(1cqw * var(--drift)), -1cqw) scale(.55, .65) rotate(2deg);
  }
  45% {
    opacity: .19;
    transform: translate(calc(2.5cqw * var(--drift)), -5cqw) scale(.8, .85) rotate(8deg);
  }
  74% {
    opacity: .09;
    transform: translate(calc(4cqw * var(--drift)), -10cqw) scale(1.05, 1) rotate(3deg);
  }
  100% {
    opacity: 0;
    transform: translate(calc(5.5cqw * var(--drift)), -15cqw) scale(1.3, 1.1) rotate(-6deg);
  }
}

@media (max-width: 760px) {
  .closing-section {
    --faq-home-width: min(340px, calc(100vw - 32px));
  }
  .closing-section .faq-ground {
    /* The questions stack above the scene on narrow screens. Reserve room for
       the whole illustration, including the wisps, before the ground begins. */
    margin-top: calc(var(--faq-home-width) * 2 / 3 + 24px);
  }
  .faq-home {
    width: var(--faq-home-width);
  }
}

@media (prefers-reduced-motion: reduce) {
  .faq-home__smoke { display: none; }
  .faq-home__smoke > i { animation: none; }
}
