/* ==========================================================
   hero.css
   The top-of-page hero: campus photograph, headline, and the
   graduate + globe scene.

   Layers, back to front:
     .hero-backdrop  campus photo, colour grade, sunlight, mist, particles
     .px-globe       the rotating globe (drawn by js/globe/globe.js)
     .scene-ground   soft light and shadow on the ground
     .px-grad        the graduate (cut out from her own photo)
   Mouse movement shifts each layer by a different amount (parallax),
   set by js/hero/scene.js through --px and --py.
   ========================================================== */

.hero {
  --px: 0;
  --py: 0;
  position: relative;
  isolation: isolate;
  overflow: hidden;
  min-height: clamp(700px, calc(100vh - 116px), 900px);
  display: flex;
  align-items: stretch;
  background: #0b1024;
}

/* ---------- Backdrop: campus photograph ---------- */
.hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
}
.px-campus {
  position: absolute;
  inset: -5%;
  transform: translate3d(calc(var(--px) * -12px), calc(var(--py) * -7px), 0);
  will-change: transform;
}
.hero-campus {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: 60% 58%;
  filter: saturate(1.02) contrast(1.05) brightness(0.98);
  transform-origin: 60% 60%;
  animation: campus-drift 46s ease-in-out infinite alternate;
}
@keyframes campus-drift {
  from {
    transform: scale(1.04) translate3d(0, 0, 0);
  }
  to {
    transform: scale(1.14) translate3d(-1.6%, -1.2%, 0);
  }
}

/* Navy-to-purple grade: keeps the headline readable on the left and lets the
   campus show through on the right. */
.hero-grade {
  position: absolute;
  inset: 0;
  background:
    linear-gradient(
      90deg,
      rgba(8, 12, 30, 0.94) 0%,
      rgba(8, 12, 30, 0.84) 24%,
      rgba(11, 16, 36, 0.5) 42%,
      rgba(11, 16, 36, 0.1) 66%,
      rgba(11, 16, 36, 0.18) 100%
    ),
    linear-gradient(
      180deg,
      rgba(11, 16, 36, 0.5) 0%,
      transparent 22%,
      transparent 68%,
      #0e152d 100%
    ),
    radial-gradient(
      56% 60% at 72% 52%,
      rgba(105, 70, 180, 0.22),
      transparent 72%
    );
}

/* Warm sunlight from the upper right, slowly breathing */
.hero-sunlight {
  position: absolute;
  inset: -14%;
  mix-blend-mode: screen;
  pointer-events: none;
  background:
    radial-gradient(
      46% 40% at 80% 10%,
      rgba(255, 226, 168, 0.34),
      transparent 70%
    ),
    repeating-linear-gradient(
      112deg,
      rgba(255, 236, 196, 0.08) 0 40px,
      transparent 40px 160px
    );
  filter: blur(10px);
  -webkit-mask-image: radial-gradient(
    60% 55% at 80% 10%,
    #000 0%,
    transparent 78%
  );
  mask-image: radial-gradient(60% 55% at 80% 10%, #000 0%, transparent 78%);
  animation: sun-breathe 12s ease-in-out infinite;
}
@keyframes sun-breathe {
  0%,
  100% {
    opacity: 0.55;
    transform: translate3d(0, 0, 0);
  }
  50% {
    opacity: 1;
    transform: translate3d(-2%, 1%, 0);
  }
}

/* Drifting haze, like thin cloud passing across the campus */
.hero-mist {
  position: absolute;
  width: 90%;
  height: 46%;
  border-radius: 50%;
  filter: blur(60px);
  opacity: 0.5;
  pointer-events: none;
}
.mist-a {
  left: -20%;
  top: 38%;
  background: radial-gradient(
    closest-side,
    rgba(150, 130, 220, 0.3),
    transparent
  );
  animation: mist-a 38s ease-in-out infinite alternate;
}
.mist-b {
  right: -25%;
  top: 8%;
  background: radial-gradient(
    closest-side,
    rgba(255, 220, 170, 0.16),
    transparent
  );
  animation: mist-b 52s ease-in-out infinite alternate;
}
@keyframes mist-a {
  to {
    transform: translate3d(22%, -4%, 0);
  }
}
@keyframes mist-b {
  to {
    transform: translate3d(-26%, 6%, 0);
  }
}

.hero-particles {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* ---------- Content grid ---------- */
.hero-inner {
  position: relative;
  z-index: 2;
  width: min(1340px, 100%);
  margin: 0 auto;
  padding: 0 6%;
  display: grid;
  grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr);
  align-items: end;
  gap: 2%;
  padding-bottom: 40px;
}

/* ---------- Headline column ---------- */
.hero-copy {
  align-self: center;
  max-width: 560px;
  padding: 70px 0 90px;
  animation: rise 0.9s cubic-bezier(0.2, 0.7, 0.2, 1) both;
}
@keyframes rise {
  from {
    opacity: 0;
    transform: translate3d(0, 18px, 0);
  }
}
.hero-copy h1 {
  font-size: clamp(42px, 4.9vw, 74px);
  line-height: 1.06;
  margin: 24px 0 22px;
  text-shadow: 0 2px 30px rgba(5, 8, 22, 0.5);
}
.hero-lede {
  max-width: 480px;
  color: #cfd4e4;
  font-size: 15px;
  line-height: 1.85;
  margin-bottom: 0;
}
.hero-actions {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 18px 28px;
  margin-top: 34px;
}
.button-lg {
  padding: 18px 26px;
  font-size: 12px;
  gap: 32px;
}

.hero-trust {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-top: 46px;
  padding-top: 24px;
  border-top: 1px solid var(--line);
  max-width: 470px;
}
.trust-icon {
  flex: none;
  width: 40px;
  height: 40px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  color: var(--gold2);
  background: rgba(199, 169, 106, 0.12);
  border: 1px solid rgba(199, 169, 106, 0.4);
}
.hero-trust p {
  margin: 0;
  font-size: 12px;
  line-height: 1.7;
  color: #a9b0c5;
}
.hero-trust b {
  color: #efe6cf;
  font-weight: 600;
}

/* ---------- Scene: globe + graduate ---------- */
.hero-scene {
  position: relative;
  align-self: end;
  width: 100%;
  aspect-ratio: 1 / 1.08;
  max-height: 760px;
}
.scene-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
  will-change: transform;
}
.px-globe {
  z-index: 2;
  transform: translate3d(calc(var(--px) * 9px), calc(var(--py) * 5px), 0);
}
.px-grad {
  z-index: 4;
  transform: translate3d(calc(var(--px) * 18px), calc(var(--py) * 8px), 0);
}

/* Violet glow that ties the globe and the campus together */
.scene-glow {
  position: absolute;
  z-index: 1;
  width: 86%;
  aspect-ratio: 1;
  right: -14%;
  top: 8%;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(120, 84, 205, 0.34),
    transparent 72%
  );
  animation: glow-pulse 7s ease-in-out infinite;
}
@keyframes glow-pulse {
  50% {
    opacity: 0.65;
    transform: scale(1.06);
  }
}

/* The globe: the stage is bigger than the globe so the orbit rings have room. */

.globe-wrap {
  position: absolute;
  width: 112%;
  aspect-ratio: 1;
  right: -19%;
  top: 52%;
  margin-top: -56%;
  animation: none;
}

@keyframes globe-bob {
  50% {
    transform: translate3d(0, -10px, 0);
  }
}
.globe-stage {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 1.4s ease;
}
.globe-stage.is-ready {
  opacity: 1;
}
.globe-stage .rings-back,
.globe-stage .rings-front {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}
.globe-stage .globe-gl {
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% / 1.3 * 1.28);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
}

/* Shown only when WebGL is unavailable */
.globe-fallback {
  display: none;
  position: absolute;
  left: 50%;
  top: 50%;
  width: calc(100% / 1.3);
  aspect-ratio: 1;
  transform: translate(-50%, -50%);
  border-radius: 50%;
  background: radial-gradient(
    circle at 31% 26%,
    #8f7ac9 0,
    #55458e 18%,
    #222c60 48%,
    #101a3b 72%,
    #090f25 100%
  );
  box-shadow:
    inset -30px -20px 60px #050a1b,
    inset 15px 10px 35px #b2a5e455,
    0 0 80px #7258c45c;
}
.globe-stage.no-webgl .globe-gl {
  display: none;
}
.globe-stage.no-webgl .globe-fallback {
  display: block;
}

/* Ground: a pool of light under the globe and a contact shadow for the graduate */

.scene-ground {
  position: absolute;
  z-index: 3;
  left: -6%;
  right: -22%;
  bottom: -3%;
  height: 16%;
  background:
    radial-gradient(
      ellipse 30% 18% at 64% 82%,
      rgba(3, 5, 16, 0.68) 0%,
      rgba(3, 5, 16, 0.32) 45%,
      transparent 76%
    ),
    radial-gradient(
      ellipse 52% 50% at 60% 50%,
      rgba(120, 90, 210, 0.16),
      transparent 70%
    );
  pointer-events: none;
}


/* ---------- The graduate ---------- */
.graduate {
  position: absolute;
  margin: 0;
  left: 13%;
  bottom: 0;
  height: 62%;
  aspect-ratio: 386 / 914;
}
.grad-shadow {
  position: absolute;
  left: 20%;
  bottom: -1%;
  width: 52%;
  height: 4.2%;
  border-radius: 50%;
  background: radial-gradient(
    closest-side,
    rgba(3, 5, 16, 0.85),
    rgba(3, 5, 16, 0.4) 60%,
    transparent
  );
  filter: blur(4px);
}
.grad-figure {
  position: absolute;
  inset: 0;
  transform-origin: 42% 100%;
  animation: grad-sway 7.5s ease-in-out infinite;
  /* Matches her photo to the campus light and lifts her off the background. */
  filter: saturate(1.04) contrast(1.04) brightness(0.98)
    drop-shadow(0 0 1.5px rgba(255, 233, 196, 0.4))
    drop-shadow(0 22px 28px rgba(4, 6, 18, 0.5));
}
@keyframes grad-sway {
  0%,
  100% {
    transform: rotate(-0.45deg) translate3d(0, 0, 0);
  }
  50% {
    transform: rotate(0.4deg) translate3d(0.5px, -3px, 0);
  }
}
.grad-figure img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  user-select: none;
  -webkit-user-drag: none;
}

/* Violet rim light on the side that faces the globe, so she shares its glow.
   (A tinted copy of the photo, blended softly and faded in from the right.) */
.grad-rim {
  filter: sepia(1) hue-rotate(215deg) saturate(3.2) brightness(1.15);
  mix-blend-mode: screen;
  opacity: 0.5;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 52%, #000 100%);
  mask-image: linear-gradient(90deg, transparent 52%, #000 100%);
}

/* Two copies of the same photo:
   - .grad-base is fixed (her face, cap, arms and shoes never move);
   - .grad-flow sits on top, rippling only where the gown and hair are.
   The base layer stays opaque wherever the ripple layer is not fully solid, so there is no seam. */
.grad-base {
  /* Hidden only where .grad-flow is fully solid, so the blend zone never goes see-through. */
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      #000 0,
      #000 49%,
      transparent 51%,
      transparent 77%,
      #000 79%,
      #000 100%
    ),
    radial-gradient(ellipse 17% 12% at 11% 14%, transparent 55%, #000 58%);
  -webkit-mask-composite: source-in;
  mask-image:
    linear-gradient(
      to bottom,
      #000 0,
      #000 49%,
      transparent 51%,
      transparent 77%,
      #000 79%,
      #000 100%
    ),
    radial-gradient(ellipse 17% 12% at 11% 14%, transparent 55%, #000 58%);
  mask-composite: intersect;
}
.grad-flow {
  filter: url(#cloth-flow);
  -webkit-mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      transparent 40%,
      #000 49%,
      #000 77%,
      transparent 85%,
      transparent 100%
    ),
    radial-gradient(ellipse 17% 12% at 11% 14%, #000 55%, transparent 100%);
  -webkit-mask-composite: source-over;
  mask-image:
    linear-gradient(
      to bottom,
      transparent 0,
      transparent 40%,
      #000 49%,
      #000 77%,
      transparent 85%,
      transparent 100%
    ),
    radial-gradient(ellipse 17% 12% at 11% 14%, #000 55%, transparent 100%);
  mask-composite: add;
}

/* If the ripple filter is unsupported, show the plain photo */
@supports not (mask-image: linear-gradient(#000, #000)) and not
  (-webkit-mask-image: linear-gradient(#000, #000)) {
  .grad-figure .grad-flow {
    display: none;
  }

  .grad-base {
    mask-image: none;
    -webkit-mask-image: none;
  }
}

/* ---------- Reduced motion: still image, no ripple ---------- */
@media (prefers-reduced-motion: reduce) {
  .hero-campus,
  .hero-sunlight,
  .hero-mist,
  .scene-glow,
  .globe-wrap,
  .grad-figure,
  .hero-copy {
    animation: none !important;
  }
  .grad-figure .grad-flow,
  .grad-figure .grad-rim {
    display: none;
  }
  .grad-base {
    -webkit-mask-image: none;
    mask-image: none;
  }
  .px-campus,
  .px-globe,
  .px-grad {
    transform: none !important;
  }
}
