/**
 * Image Galaxy widget.
 *
 * A scroll-driven 3D field of floating images behind an animated heading and
 * pill button. Motion is applied per-particle by assets/js/widgets/image-galaxy.js;
 * this file owns layout, the depth wash, the heading word-reveal and the button.
 * All selectors are scoped under .skyweb-galaxy so multiple instances and other
 * page styles never collide.
 */

.skyweb-galaxy {
  /* Matches the page background so the hero blends seamlessly and inverts with
     dark mode automatically (falls back to the surface colour, then white, when
     the toolkit runs under a non-Skyweb theme). Overridden by the Background
     control when set. */
  --sg-bg: var(--skyweb-page-bg-color, var(--skyweb-surface-color, #fff));
  position: relative;
  min-height: 100vh;
  overflow: hidden;
  isolation: isolate;
  display: grid;
  place-items: center;
  background: var(--sg-bg);
  perspective: 800px;
}

.skyweb-galaxy__layer {
  position: absolute;
  top: -25%;
  left: 0;
  z-index: 0;
  width: 100%;
  height: 150%;
  perspective: 800px;
  transform-style: preserve-3d;
  pointer-events: none;
}

.skyweb-galaxy__fade {
  position: absolute;
  left: -10%;
  z-index: 1;
  width: 120%;
  height: 190px;
  pointer-events: none;
}

/* Each fade defaults to the section background, or its own colour control. */
.skyweb-galaxy__fade--top {
  top: 0;
  background: linear-gradient(to bottom, var(--sg-fade-top, var(--sg-bg)) 0%, transparent 100%);
}

.skyweb-galaxy__fade--bottom {
  bottom: 0;
  background: linear-gradient(to top, var(--sg-fade-bottom, var(--sg-bg)) 0%, transparent 100%);
}

.skyweb-galaxy__particle {
  position: absolute;
  aspect-ratio: 1;
  width: clamp(50px, 6vw, 108px);
  transform-style: preserve-3d;
  will-change: transform;
}

.skyweb-galaxy__particle-inner {
  position: absolute;
  inset: 0;
  overflow: hidden;
  background: color-mix(in srgb, var(--skyweb-dark-color, #111) 8%, var(--sg-bg));
}

.skyweb-galaxy__particle img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0;
  transform: scale(1.04);
  transition: opacity .45s ease, transform .9s ease;
}

.skyweb-galaxy__particle img.is-loaded {
  opacity: 1;
  transform: scale(1);
}

.skyweb-galaxy__wash {
  position: absolute;
  inset: 0;
  background: var(--sg-bg);
  pointer-events: none;
}

.skyweb-galaxy__content {
  position: relative;
  z-index: 2;
  width: min(100%, 1180px);
  padding: 0 20px;
  text-align: center;
}

.skyweb-galaxy__heading {
  margin: 0;
  color: var(--skyweb-dark-color, #111);
  font-size: clamp(58px, 10vw, 168px);
  font-weight: 500;
  line-height: .92;
  letter-spacing: -.045em;
}

.skyweb-galaxy__line {
  display: block;
}

.skyweb-galaxy__word {
  position: relative;
  display: inline-block;
  opacity: 0;
  transform: translate3d(var(--tx, 0), var(--ty, 0), 0);
  animation: skyweb-galaxy-word-in .9s cubic-bezier(.22, 1, .36, 1) forwards;
  animation-delay: var(--delay, 0s);
}

.skyweb-galaxy__button {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 14px;
  min-height: 52px;
  margin-top: 48px;
  padding: 15px 22px;
  border-radius: 999px;
  background: var(--skyweb-dark-color, #111);
  color: var(--skyweb-surface-color, #fff);
  text-decoration: none;
  font-size: 15px;
  line-height: 1;
  transition: transform .25s ease, background .25s ease;
}

.skyweb-galaxy__button:hover {
  transform: translateY(-2px);
  background: color-mix(in srgb, var(--skyweb-dark-color, #111) 85%, var(--skyweb-surface-color, #fff));
}

/* Editor placeholder (no images uploaded yet). */
.skyweb-galaxy--empty {
  min-height: 320px;
  color: #777;
  font-size: 16px;
  background: #f5f5f3;
}

@keyframes skyweb-galaxy-word-in {
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0);
  }
}

@media (max-width: 699px) {
  .skyweb-galaxy__fade {
    height: 160px;
  }

  .skyweb-galaxy__heading {
    font-size: clamp(58px, 17vw, 82px);
    line-height: .98;
    letter-spacing: -.035em;
  }
}

@media (prefers-reduced-motion: reduce) {
  .skyweb-galaxy__word {
    opacity: 1;
    transform: none;
    animation: none;
  }

  .skyweb-galaxy__particle {
    transform: none !important;
  }
}
