/* =========================================================
   ForGrowth Academy — launch.css
   ISOLATED. Scoped to .fg-launch / .fg-cheer / .fg-bit.
   Shown only after a successful enquiry submission.
   ========================================================= */

/* =========================================================
   ROCKET
   Motion is split across nested layers. The horizontal layer decelerates
   while the vertical layer accelerates; combined they trace a genuine arc.
   Doing it this way (rather than offset-path) keeps the curve identical at
   every viewport size, because every distance is in vw/vh.
   ========================================================= */
.fg-launch {
  position: fixed;
  left: 38vw;
  bottom: -170px;
  z-index: 1200;
  pointer-events: none;
}

/* --- layer 1: across the screen, easing out --- */
.fg-launch-x { display: block; }
.fg-launch.fly .fg-launch-x {
  animation: fgArcX 1.9s cubic-bezier(0.6, 0, 0.75, 0.8) forwards;
}
@keyframes fgArcX {
  from { transform: translateX(0); }
  to   { transform: translateX(20vw); }
}

/* --- layer 2: up the screen, easing in --- */
.fg-launch-y { display: block; }
.fg-launch.ignite .fg-launch-y {
  animation: fgLift 0.7s cubic-bezier(0.33, 1.2, 0.62, 1) forwards;
}
@keyframes fgLift {
  from { transform: translateY(0); }
  to   { transform: translateY(-215px); }
}
.fg-launch.fly .fg-launch-y {
  animation: fgArcY 1.9s cubic-bezier(0.4, 0.05, 0.7, 0.7) forwards;
}
@keyframes fgArcY {
  from { transform: translateY(-215px); }
  to   { transform: translateY(-125vh); }
}

/* --- layer 3: banking along the path, receding into the distance --- */
.fg-launch-rot {
  display: block;
  position: relative;
  transform: rotate(0deg);
}
.fg-launch.ignite .fg-launch-rot {
  animation: fgRumble 0.075s linear 0.34s 5;
}
@keyframes fgRumble {
  0%, 100% { margin-left: 0; }
  50%      { margin-left: 1.6px; }
}
.fg-launch.fly .fg-launch-rot {
  animation: fgBank 1.9s cubic-bezier(0.5, 0, 0.7, 1) forwards;
}
@keyframes fgBank {
  0%   { transform: rotate(5deg)  scale(1); }
  30%  { transform: rotate(13deg) scale(1.06); }
  60%  { transform: rotate(21deg) scale(1.02); }
  85%  { transform: rotate(23deg) scale(0.94); }
  100% { transform: rotate(19deg) scale(0.82); }
}

.fg-launch-rocket {
  position: relative;
  z-index: 3;
  display: block;
  /* The viewBox is 120x340, so this width sets the body size; the exhaust
     occupies the lower two-thirds and extends well below it. */
  width: clamp(110px, 13vw, 168px);
  filter: drop-shadow(0 20px 34px rgba(28, 24, 22, 0.45))
          drop-shadow(0 0 46px rgba(240, 86, 31, 0.4));
}
.fg-launch-rocket svg { width: 100%; height: auto; display: block; }

/* --- exhaust flame --- */
.fg-launch .fg-fl {
  transform-box: fill-box;
  transform-origin: top center;
  opacity: 0;
}
.fg-launch.ignite .fg-fl {
  opacity: 1;
  animation: fgFlame 0.08s ease-in-out infinite alternate;
}
@keyframes fgFlame {
  from { transform: scaleY(0.72) scaleX(0.88); }
  to   { transform: scaleY(1.3)  scaleX(1.12); }
}
.fg-launch.fly .fg-fl { animation: fgFlameBig 0.07s ease-in-out infinite alternate; }
@keyframes fgFlameBig {
  from { transform: scaleY(1.55) scaleX(1.04); opacity: 0.95; }
  to   { transform: scaleY(2.5)  scaleX(1.28); opacity: 1; }
}

/* --- trail, anchored to the rocket so it follows the bank --- */
.fg-launch-trail {
  position: absolute;
  left: 50%;
  top: 88%;
  z-index: 1;
  width: 34px;
  height: 0;
  transform: translateX(-50%);
  border-radius: 999px;
  background: linear-gradient(to bottom,
    rgba(255, 243, 196, 0.95) 0%,
    rgba(255, 193, 77, 0.8) 26%,
    rgba(240, 86, 31, 0.42) 62%,
    rgba(240, 86, 31, 0) 100%);
  filter: blur(8px);
  opacity: 0;
}
.fg-launch.fly .fg-launch-trail {
  animation: fgTrail 1.9s cubic-bezier(0.4, 0.05, 0.7, 0.7) forwards;
}
@keyframes fgTrail {
  0%   { height: 80px;  opacity: 0.95; }
  45%  { height: 560px; opacity: 0.9; }
  100% { height: 200px; opacity: 0; }
}

/* --- sparks shed along the flight --- */
.fg-launch-sparks { position: absolute; left: 50%; top: 86%; z-index: 2; }
.fg-launch-sparks i {
  position: absolute;
  width: 9px; height: 9px;
  margin-left: -4.5px;
  border-radius: 50%;
  background: #FFD98A;
  box-shadow: 0 0 12px 3px rgba(255, 193, 77, 0.85);
  opacity: 0;
}
.fg-launch.fly .fg-launch-sparks i {
  animation: fgSpark 1s ease-out infinite;
  animation-delay: calc(var(--k) * 0.06s);
}
@keyframes fgSpark {
  0%   { opacity: 0;   transform: translate(0, 0) scale(1.3); }
  12%  { opacity: 1; }
  100% { opacity: 0;
         transform: translate(calc((var(--k) - 7.5) * 22px), 260px) scale(0.25); }
}

/* --- ground smoke at ignition --- */
.fg-launch-smoke { position: absolute; left: 0; bottom: 10px; z-index: 0; }
.fg-launch-smoke i {
  position: absolute;
  left: 37px; bottom: 0;
  width: 44px; height: 44px;
  margin-left: -22px;
  border-radius: 50%;
  background: rgba(214, 208, 198, 0.75);
  opacity: 0;
  filter: blur(6px);
}
.fg-launch.ignite .fg-launch-smoke i {
  animation: fgSmoke 1.7s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  animation-delay: calc(0.3s + var(--p) * 0.055s);
}
@keyframes fgSmoke {
  0%   { opacity: 0;    transform: translate(0, 0) scale(0.4); }
  25%  { opacity: 0.85; }
  100% { opacity: 0;
         transform: translate(calc((var(--p) - 5) * 46px), -22px) scale(3.4); }
}

/* =========================================================
   CELEBRATION
   ========================================================= */
.fg-cheer {
  position: fixed;
  inset: 0;
  z-index: 1300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(24, 20, 18, 0.5);
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
  opacity: 0;
  transition: opacity 0.35s ease;
  overflow: hidden;
}
.fg-cheer.show { opacity: 1; }

/* --- confetti --- */
.fg-confetti { position: absolute; inset: 0; pointer-events: none; }
.fg-bit {
  position: absolute;
  top: -8%;
  left: var(--x);
  width: 9px;
  height: 14px;
  border-radius: 1px;
  opacity: 0;
  animation: fgFall 2.6s cubic-bezier(0.3, 0.6, 0.5, 1) var(--d) forwards;
}
.fg-bit--round { border-radius: 50%; width: 8px; height: 8px; }
@keyframes fgFall {
  0%   { opacity: 0; transform: translateY(0) rotate(var(--r)) scale(var(--s)); }
  8%   { opacity: 1; }
  80%  { opacity: 1; }
  100% { opacity: 0;
         transform: translateY(94vh) rotate(calc(var(--r) + 540deg)) scale(var(--s)); }
}

/* --- card --- */
.fg-cheer-card {
  position: relative;
  z-index: 1;
  width: min(460px, 100%);
  padding: clamp(38px, 5vw, 52px) clamp(28px, 4vw, 40px) clamp(30px, 4vw, 38px);
  text-align: center;
  background:
    radial-gradient(130% 80% at 50% 0%, rgba(217, 64, 11, 0.12), transparent 60%),
    linear-gradient(160deg, #FDFBF7 0%, #F3EDE3 100%);
  border-radius: 8px;
  box-shadow: 0 50px 100px -30px rgba(24, 20, 18, 0.6);
  transform: translateY(24px) scale(0.9);
  opacity: 0;
  overflow: hidden;
}
.fg-cheer.show .fg-cheer-card {
  animation: fgCardIn 0.75s cubic-bezier(0.3, 1.5, 0.5, 1) 0.08s forwards;
}
@keyframes fgCardIn {
  to { transform: none; opacity: 1; }
}
.fg-cheer-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, #D9400B, #F0561F, #FFC14D);
}

/* --- rings pulsing out behind the badge --- */
.fg-cheer-rings {
  position: absolute;
  top: clamp(38px, 5vw, 52px);
  left: 50%;
  width: 66px; height: 66px;
  transform: translateX(-50%);
  pointer-events: none;
}
.fg-cheer-rings i {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  border: 2px solid var(--accent, #D9400B);
  opacity: 0;
  animation: fgRing 1.9s cubic-bezier(0.16, 1, 0.3, 1) infinite;
}
.fg-cheer-rings i:nth-child(2) { animation-delay: 0.45s; }
.fg-cheer-rings i:nth-child(3) { animation-delay: 0.9s; }
@keyframes fgRing {
  0%   { opacity: 0.5; transform: scale(1); }
  70%  { opacity: 0;   transform: scale(2.3); }
  100% { opacity: 0;   transform: scale(2.3); }
}

/* --- badge with a tick that draws itself --- */
.fg-cheer-badge {
  position: relative;
  z-index: 1;
  width: 66px; height: 66px;
  margin: 0 auto 20px;
  border-radius: 50%;
  background: linear-gradient(150deg, #F0561F, #D9400B);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 16px 30px -14px rgba(217, 64, 11, 0.8);
  animation: fgBadge 0.7s cubic-bezier(0.3, 1.6, 0.5, 1) 0.25s backwards;
}
@keyframes fgBadge {
  from { transform: scale(0.3) rotate(-25deg); opacity: 0; }
  to   { transform: none; opacity: 1; }
}
.fg-cheer-badge svg { width: 34px; height: 34px; }
.fg-cheer-badge .fg-tick {
  stroke-dasharray: 34;
  animation: fgTickDraw 0.5s cubic-bezier(0.16, 1, 0.3, 1) 0.6s backwards;
}
@keyframes fgTickDraw {
  from { stroke-dashoffset: 34; }
  to   { stroke-dashoffset: 0; }
}

/* --- copy --- */
.fg-cheer-card h3 {
  font-family: var(--font-display, sans-serif);
  font-size: clamp(24px, 3.2vw, 32px);
  font-weight: 700;
  letter-spacing: -0.025em;
  color: var(--black, #121214);
  margin: 0 0 10px;
}
.fg-cheer-lead {
  font-size: clamp(15px, 1.7vw, 17px) !important;
  font-weight: 600;
  color: var(--accent, #D9400B) !important;
  margin-bottom: 12px !important;
}
.fg-cheer-card p {
  font-size: 14.8px;
  line-height: 1.6;
  color: var(--grey, #6B6B6E);
  margin: 0 0 10px;
}
.fg-cheer-sub {
  font-size: 13.2px !important;
  color: var(--grey-light, #9A9A9D) !important;
  margin-top: 16px !important;
  padding-top: 14px;
  border-top: 1px solid rgba(28, 28, 30, 0.09);
}
.fg-cheer-sub strong { color: var(--ink, #1C1C1E); white-space: nowrap; }
.fg-cheer-card em { font-style: normal; font-weight: 700; color: var(--accent, #D9400B); }

.fg-cheer-close {
  margin-top: 20px;
  border: 0;
  background: var(--accent, #D9400B);
  color: #fff;
  font-family: var(--font-body, sans-serif);
  font-size: 14.5px;
  font-weight: 600;
  padding: 14px 34px;
  border-radius: 4px;
  cursor: pointer;
  box-shadow: 0 12px 24px -12px rgba(217, 64, 11, 0.9);
  transition: background-color 0.25s ease, transform 0.25s ease;
}
.fg-cheer-close:hover { background: var(--accent-deep, #A83008); transform: translateY(-2px); }
.fg-cheer-close:focus-visible { outline: 2px solid var(--accent, #D9400B); outline-offset: 3px; }

/* --- responsive --- */
@media (max-width: 480px) {
  .fg-launch-rocket { width: clamp(96px, 26vw, 120px); }
  .fg-launch { left: 30vw; }
  @keyframes fgArcX { from { transform: translateX(0); } to { transform: translateX(26vw); } }
  .fg-cheer-card { padding: 32px 22px 28px; }
  .fg-cheer-badge { width: 58px; height: 58px; }
  .fg-cheer-rings { width: 58px; height: 58px; top: 32px; }
  .fg-bit { width: 7px; height: 11px; }
}

/* --- reduced motion: message only, nothing moving --- */
@media (prefers-reduced-motion: reduce) {
  .fg-confetti, .fg-cheer-rings { display: none; }
  .fg-cheer, .fg-cheer-card { transition: none; }
  .fg-cheer-card { opacity: 1; transform: none; animation: none; }
  .fg-cheer-badge { animation: none; }
  .fg-cheer-badge .fg-tick { animation: none; stroke-dashoffset: 0; }
}

/* =========================================================
   DEPTH OF FIELD
   The page softens while the rocket is in flight, then settles as it clears.
   `backdrop-filter` blurs what is behind this layer rather than filtering the
   page, so nothing that is position:fixed gets displaced.
   ========================================================= */
.fg-blur {
  position: fixed;
  inset: 0;
  z-index: 1150;              /* under the rocket (1200), over the page */
  pointer-events: none;
  opacity: 0;
  backdrop-filter: blur(0px);
  -webkit-backdrop-filter: blur(0px);
  transition:
    opacity 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    backdrop-filter 0.55s cubic-bezier(0.16, 1, 0.3, 1),
    -webkit-backdrop-filter 0.55s cubic-bezier(0.16, 1, 0.3, 1);
}

.fg-blur.on {
  opacity: 1;
  backdrop-filter: blur(3.5px) saturate(0.94);
  -webkit-backdrop-filter: blur(3.5px) saturate(0.94);
  /* A trace of warmth, so the page reads as lit by the exhaust. */
  background: radial-gradient(60% 70% at 50% 100%, rgba(217, 64, 11, 0.06), transparent 70%);
}

@media (max-width: 620px) {
  .fg-blur.on {
    backdrop-filter: blur(2.5px) saturate(0.96);
    -webkit-backdrop-filter: blur(2.5px) saturate(0.96);
  }
}

@media (prefers-reduced-motion: reduce) {
  .fg-blur { display: none; }
}
