/*
 * Mahyar Molavi — Global Ambient Liquid Glass (homepage only).
 * Glows are pre-softened radial gradients; only transform/opacity animate.
 * The glass glaze is static: no expensive full-viewport backdrop-filter.
 * Existing section/card typography and interactions remain untouched.
 */
.mm-ambient-home {
  isolation: isolate;
}

.mm-ambient {
  --mm-ambient-gold: rgba(201, 161, 90, .35);
  --mm-ambient-gold-edge: rgba(201, 161, 90, .12);
  --mm-ambient-white: rgba(255, 255, 255, .24);
  --mm-ambient-white-edge: rgba(255, 255, 255, .055);
  position: fixed;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
  user-select: none;
  contain: layout style paint;
  background:
    radial-gradient(ellipse 90% 70% at 50% -18%, rgba(255, 255, 255, .055), transparent 80%),
    linear-gradient(160deg, var(--color-navy, #0d1b2a), #0a1421 57%, #102134);
}

.mm-ambient-home #main-content {
  position: relative;
  z-index: 1;
}

/* Only the full-width section canvases become transparent. Existing cards,
 * media, overlays, section text colors and CMS-generated content are preserved.
 * This also avoids opaque Portfolio/Reviews/Blog bands that interrupt light. */
.mm-ambient-home #main-content > section {
  background: transparent !important;
}

.mm-ambient-home .site-footer {
  z-index: 1;
  background: transparent !important;
}

.mm-ambient__field {
  position: absolute;
  inset: -8%;
  transform: translate3d(0, 0, 0);
}

.mm-ambient__glow {
  position: absolute;
  display: block;
  aspect-ratio: 1;
  border-radius: 50%;
  pointer-events: none;
  will-change: transform;
}

.mm-ambient__glow--gold {
  top: -25%;
  left: -20%;
  width: min(84vmax, 1020px);
  background: radial-gradient(circle at 50% 50%,
    var(--mm-ambient-gold) 0%,
    var(--mm-ambient-gold-edge) 39%,
    transparent 74%);
  animation: mm-ambient-drift-gold 37s ease-in-out infinite;
}

.mm-ambient__glow--white {
  top: -5%;
  right: -21%;
  width: min(72vmax, 910px);
  background: radial-gradient(circle at 50% 50%,
    var(--mm-ambient-white) 0%,
    var(--mm-ambient-white-edge) 38%,
    transparent 76%);
  animation: mm-ambient-drift-white 31s ease-in-out infinite;
}

.mm-ambient__glow--echo {
  bottom: -32%;
  left: 16%;
  width: min(70vmax, 840px);
  opacity: .7;
  background: radial-gradient(circle at 50% 50%,
    var(--mm-ambient-gold-edge) 0%,
    rgba(255, 255, 255, .045) 38%,
    transparent 76%);
  animation: mm-ambient-drift-echo 43s ease-in-out infinite;
}

/* A stationary, subtle curved reflection visually bonds the three lights.
 * It is not an overlay on content or controls, and needs no backdrop blur. */
.mm-ambient__glass {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(116deg,
      transparent 13%,
      rgba(255, 255, 255, .022) 28%,
      transparent 44%,
      rgba(255, 255, 255, .03) 55%,
      transparent 71%),
    radial-gradient(ellipse 130% 95% at 50% 120%,
      transparent 53%,
      rgba(255, 255, 255, .04) 76%,
      transparent 98%);
  opacity: .8;
}

/* The theme is selected in the head before CSS paints, preventing a
 * dark-to-light flash. The same fixed layer survives through the footer. */
html[data-theme="light"] .mm-ambient {
  --mm-ambient-gold: rgba(201, 161, 90, .22);
  --mm-ambient-gold-edge: rgba(201, 161, 90, .085);
  --mm-ambient-white: rgba(255, 255, 255, .84);
  --mm-ambient-white-edge: rgba(255, 255, 255, .13);
  background:
    radial-gradient(ellipse 120% 64% at 55% -19%, rgba(255, 255, 255, .72), transparent 84%),
    linear-gradient(158deg, var(--color-cream, #f7f4ee), #f3eee6 55%, #faf8f3);
}

html[data-theme="light"] .mm-ambient__glow--echo {
  opacity: .55;
}

html[data-theme="light"] .mm-ambient__glass {
  background:
    linear-gradient(112deg, transparent 20%, rgba(255, 255, 255, .32) 37%, transparent 52%),
    radial-gradient(ellipse 130% 95% at 50% 120%,
      transparent 55%, rgba(255, 255, 255, .33) 76%, transparent 97%);
  opacity: .55;
}

@keyframes mm-ambient-drift-gold {
  0%, 100% { transform: translate3d(-3%, -2%, 0) scale(1); }
  33% { transform: translate3d(18%, 12%, 0) scale(1.07); }
  67% { transform: translate3d(8%, 24%, 0) scale(.94); }
}

@keyframes mm-ambient-drift-white {
  0%, 100% { transform: translate3d(5%, 6%, 0) scale(1); }
  35% { transform: translate3d(-23%, 12%, 0) scale(.94); }
  70% { transform: translate3d(-9%, -13%, 0) scale(1.1); }
}

@keyframes mm-ambient-drift-echo {
  0%, 100% { transform: translate3d(-8%, 0, 0) scale(.96); }
  45% { transform: translate3d(18%, -18%, 0) scale(1.12); }
  75% { transform: translate3d(-2%, -8%, 0) scale(1.02); }
}

.mm-ambient.is-paused .mm-ambient__glow {
  animation-play-state: paused;
}

@media (max-width: 760px) {
  .mm-ambient__field {
    inset: -5%;
  }
  .mm-ambient__glow--gold {
    top: -8%;
    left: -42%;
    width: 110vw;
    animation-duration: 48s;
  }
  .mm-ambient__glow--white {
    top: 27%;
    right: -52%;
    width: 100vw;
    animation-duration: 54s;
  }
  .mm-ambient__glow--echo {
    display: none;
  }
  .mm-ambient__glass {
    opacity: .45;
  }
}

@media (prefers-reduced-motion: reduce) {
  .mm-ambient__field {
    transform: none !important;
  }
  .mm-ambient__glow {
    animation: none !important;
    transform: none !important;
    will-change: auto;
  }
}

.mm-ambient[data-ambient-static="true"] .mm-ambient__field {
  transform: none !important;
}
.mm-ambient[data-ambient-static="true"] .mm-ambient__glow {
  animation: none !important;
  transform: none !important;
  will-change: auto;
}
