/* SG Expat Desk — ambient background light motion (original teal / cream / gold palette).
   Layers, back to front:
     1. page backdrop   – fixed, slowly drifting warm-gold and teal glows between the panels
     2. panel glows     – soft gold/teal/cream light drifting inside each light panel
     3. hero light      – two slow light rays + a warm horizon glow over the footage
     4. dark bands      – drifting glows + a periodic gold sheen sweep (How it works, footer)
   Transform/opacity only (compositor-friendly, nothing animates filters), always under
   the content, fully off for prefers-reduced-motion. */

:root {
  --glow-gold: rgba(219, 194, 139, 0.6);
  --glow-gold-soft: rgba(219, 194, 139, 0.32);
  --glow-teal: rgba(15, 111, 104, 0.17);
  --glow-cream: rgba(255, 247, 221, 0.95);
  --glow-dark-gold: rgba(225, 195, 123, 0.26);
  --glow-dark-teal: rgba(90, 190, 180, 0.18);
  --sheen-dark: rgba(255, 236, 190, 0.13);
  --sheen-light: rgba(255, 255, 255, 0.55);
}

/* ── 1 · Page backdrop ─────────────────────────────────────────────────
   body becomes its own stacking context so the z:-1 layer sits above the body
   gradient but below every piece of content. */
body {
  isolation: isolate;
}

body::before {
  content: "";
  position: fixed;
  inset: -25vmax;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(closest-side, var(--glow-gold), transparent) 8% 12% / 62vmax 62vmax no-repeat,
    radial-gradient(closest-side, var(--glow-teal), transparent) 92% 46% / 74vmax 74vmax no-repeat,
    radial-gradient(closest-side, var(--glow-cream), transparent) 36% 96% / 58vmax 58vmax no-repeat;
  will-change: transform;
  animation: sgedAmbientBackdrop 34s ease-in-out infinite alternate;
}

/* ── 2 · Light panels ──────────────────────────────────────────────── */
.service-section.section-pad,
.article-section.section-pad,
.match-section.section-pad,
.resource-shell {
  position: relative;
  overflow: hidden;
}

.service-section.section-pad::after,
.article-section.section-pad::after,
.match-section.section-pad::after,
.resource-shell::after {
  content: "";
  position: absolute;
  top: -40%;
  left: -30%;
  width: 160%;
  height: 180%;
  z-index: 0;
  pointer-events: none;
  background:
    radial-gradient(closest-side, var(--glow-gold), transparent) 8% 18% / 46% 46% no-repeat,
    radial-gradient(closest-side, var(--glow-teal), transparent) 92% 82% / 52% 52% no-repeat,
    radial-gradient(closest-side, var(--glow-cream), transparent) 62% 4% / 40% 40% no-repeat,
    radial-gradient(closest-side, var(--glow-gold-soft), transparent) 40% 96% / 34% 34% no-repeat;
  will-change: transform;
  animation: sgedAmbientPanel 26s ease-in-out infinite alternate;
}

.article-section.section-pad::after { animation-duration: 30s; animation-delay: -8s; }
.match-section.section-pad::after { animation-duration: 24s; animation-delay: -14s; }
.resource-shell::after { animation-duration: 32s; animation-delay: -20s; }

.resource-shell > * {
  position: relative;
  z-index: 1;
}

/* ── 3 · Hero light (between the footage and the copy) ─────────────── */
.hero-light {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}

.hero-ray {
  position: absolute;
  top: -40%;
  width: 22%;
  height: 180%;
  background: linear-gradient(90deg, transparent 0%, rgba(255, 238, 200, 0.16) 40%, rgba(255, 246, 225, 0.24) 50%, rgba(255, 238, 200, 0.16) 60%, transparent 100%);
  transform-origin: 50% 0;
  will-change: transform, opacity;
}

.hero-ray-a {
  left: 48%;
  transform: rotate(24deg);
  animation: sgedRayA 18s ease-in-out infinite alternate;
}

.hero-ray-b {
  left: 66%;
  width: 14%;
  transform: rotate(30deg);
  animation: sgedRayB 23s ease-in-out -6s infinite alternate;
}

.hero-glow {
  position: absolute;
  right: -10%;
  bottom: -45%;
  width: 70%;
  height: 110%;
  background: radial-gradient(closest-side, rgba(232, 196, 120, 0.34), rgba(232, 196, 120, 0.12) 55%, transparent);
  will-change: transform, opacity;
  animation: sgedHeroGlow 20s ease-in-out infinite alternate;
}

/* ── 4 · Dark bands ────────────────────────────────────────────────── */
.how-section::before {
  inset: -35% -25%;
  background:
    radial-gradient(closest-side, var(--glow-dark-gold), transparent) 12% 40% / 46% 100% no-repeat,
    radial-gradient(closest-side, var(--glow-dark-teal), transparent) 88% 60% / 46% 100% no-repeat,
    radial-gradient(closest-side, rgba(255, 247, 221, 0.1), transparent) 50% 0 / 40% 70% no-repeat;
  will-change: transform;
  animation: sgedAmbientPanel 22s ease-in-out infinite alternate;
}

.how-section::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: 0;
  width: 34%;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, var(--sheen-dark) 42%, rgba(255, 244, 214, 0.2) 50%, var(--sheen-dark) 58%, transparent 100%);
  transform: translate3d(-130%, 0, 0) skewX(-14deg);
  will-change: transform;
  animation: sgedLightSweep 14s cubic-bezier(0.45, 0, 0.25, 1) 2s infinite;
}

.how-section > .section-pad {
  position: relative;
  z-index: 1;
}

.site-footer {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.site-footer::before {
  content: "";
  position: absolute;
  inset: -45% -25%;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(closest-side, var(--glow-dark-gold), transparent) 8% 20% / 42% 90% no-repeat,
    radial-gradient(closest-side, var(--glow-dark-teal), transparent) 92% 80% / 42% 90% no-repeat;
  will-change: transform;
  animation: sgedAmbientPanel 28s ease-in-out infinite alternate;
}

.site-footer::after {
  content: "";
  position: absolute;
  top: -30%;
  bottom: -30%;
  left: 0;
  width: 26%;
  z-index: -1;
  pointer-events: none;
  background: linear-gradient(100deg, transparent 0%, var(--sheen-dark) 50%, transparent 100%);
  transform: translate3d(-130%, 0, 0) skewX(-14deg);
  will-change: transform;
  animation: sgedLightSweep 18s cubic-bezier(0.45, 0, 0.25, 1) 7s infinite;
}

/* ── Keyframes ─────────────────────────────────────────────────────── */
@keyframes sgedAmbientBackdrop {
  0% { transform: translate3d(0, 0, 0) rotate(0deg) scale(1); }
  50% { transform: translate3d(8vmax, -6vmax, 0) rotate(10deg) scale(1.08); }
  100% { transform: translate3d(-7vmax, 6vmax, 0) rotate(-8deg) scale(0.96); }
}

@keyframes sgedAmbientPanel {
  0% { transform: translate3d(0, 0, 0) scale(1); }
  50% { transform: translate3d(12%, 7%, 0) scale(1.1); }
  100% { transform: translate3d(-10%, -6%, 0) scale(0.94); }
}

@keyframes sgedRayA {
  0% { transform: translate3d(-18%, 0, 0) rotate(24deg); opacity: 0.55; }
  50% { opacity: 1; }
  100% { transform: translate3d(38%, 0, 0) rotate(18deg); opacity: 0.7; }
}

@keyframes sgedRayB {
  0% { transform: translate3d(20%, 0, 0) rotate(30deg); opacity: 0.35; }
  50% { opacity: 0.85; }
  100% { transform: translate3d(-30%, 0, 0) rotate(36deg); opacity: 0.5; }
}

@keyframes sgedHeroGlow {
  0% { transform: translate3d(0, 0, 0) scale(1); opacity: 0.7; }
  100% { transform: translate3d(-14%, -8%, 0) scale(1.12); opacity: 1; }
}

/* One unhurried pass across, then a rest. */
@keyframes sgedLightSweep {
  0% { transform: translate3d(-130%, 0, 0) skewX(-14deg); }
  55% { transform: translate3d(420%, 0, 0) skewX(-14deg); }
  100% { transform: translate3d(420%, 0, 0) skewX(-14deg); }
}

/* Phones: same light, slower; the footer sheen is dropped. */
@media (max-width: 767px) {
  body::before { animation-duration: 46s; }
  .service-section.section-pad::after,
  .article-section.section-pad::after,
  .match-section.section-pad::after,
  .resource-shell::after,
  .how-section::before,
  .site-footer::before { animation-duration: 38s; }
  .hero-ray-a { left: 46%; width: 36%; }
  .hero-ray-b { left: 74%; width: 24%; }
  .hero-glow { width: 120%; right: -40%; }
  .site-footer::after { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  body::before,
  .service-section.section-pad::after,
  .article-section.section-pad::after,
  .match-section.section-pad::after,
  .resource-shell::after,
  .how-section::before,
  .site-footer::before,
  .hero-ray,
  .hero-glow {
    animation: none;
  }
  .how-section::after,
  .site-footer::after {
    display: none;
  }
}
