/* ==========================================================================
   Scroll-driven neuromarketing hero (canvas image-sequence + text slides)
   ========================================================================== */

.nm-hero {
  position: relative;
  width: 100%;
  background: var(--navy-950);
  /* JS sets the real height (100vh + scroll-track). This is just a safe
     fallback so there is no layout jump before JS runs. */
  height: 700vh;
}

.nm-hero-sticky {
  position: sticky;
  top: 0;
  left: 0;
  height: 100vh;
  width: 100%;
  overflow: hidden;
  background: var(--navy-950);
}

.nm-hero-canvas-wrap {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

#nm-hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: block;
  opacity: 0;
  transition: opacity 0.5s ease;
}

#nm-hero-canvas.is-ready {
  opacity: 1;
}

.nm-hero-loader {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 3;
  background: radial-gradient(ellipse at center, var(--navy-900) 0%, var(--navy-950) 100%);
  transition: opacity 0.5s ease;
}

.nm-hero-loader.is-hidden {
  opacity: 0;
  pointer-events: none;
}

.nm-hero-loader .nm-pulse {
  width: 54px;
  height: 54px;
  border-radius: 50%;
  border: 2px solid rgba(212, 168, 87, 0.35);
  position: relative;
}

.nm-hero-loader .nm-pulse::before {
  content: "";
  position: absolute;
  inset: -10px;
  border-radius: 50%;
  border: 1px solid rgba(212, 168, 87, 0.5);
  animation: nm-pulse-ring 1.8s ease-out infinite;
}

@keyframes nm-pulse-ring {
  0% { transform: scale(0.6); opacity: 0.9; }
  100% { transform: scale(1.6); opacity: 0; }
}

/* Soft global grade — mostly top/bottom, so the image itself stays bright
   and readable. Local contrast for the text is handled per-slide by the
   frosted panel behind each headline (see .nm-slide-inner below). */
.nm-hero-gradient {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  background:
    linear-gradient(180deg, rgba(4, 7, 13, 0.55) 0%, rgba(4, 7, 13, 0.02) 22%, rgba(4, 7, 13, 0.02) 60%, rgba(4, 7, 13, 0.68) 100%);
}

.nm-hero-vignette {
  position: absolute;
  inset: 0;
  z-index: 4;
  pointer-events: none;
  box-shadow: inset 0 0 180px 50px rgba(0, 0, 0, 0.45);
}

.nm-hero-text-layer {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
}

.nm-hero-text-layer .container {
  width: 100%;
  height: 100%;
}

.nm-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  flex-direction: column;
  justify-content: center;
  padding: 0 6%;
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

.nm-slide.is-interactive {
  pointer-events: auto;
}

/* The frosted panel is what actually guarantees text contrast, regardless
   of what is happening in the footage behind it — a face, a brain, a
   sunset. It hugs the text instead of spanning the whole image. */
.nm-slide-inner {
  width: fit-content;
  max-width: min(540px, 88vw);
  transform: translateY(18px);
  background: linear-gradient(150deg, rgba(5, 9, 16, 0.6), rgba(5, 9, 16, 0.32));
  backdrop-filter: blur(14px) saturate(1.15);
  -webkit-backdrop-filter: blur(14px) saturate(1.15);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: 26px;
  padding: 34px 40px;
  box-shadow: 0 30px 70px -25px rgba(0, 0, 0, 0.55);
}

.nm-slide .nm-eyebrow {
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.24em;
  text-transform: uppercase;
  color: var(--gold-400);
  margin-bottom: 16px;
  display: inline-block;
}

.nm-slide h1 {
  font-family: var(--font-display);
  font-size: clamp(1.7rem, 3.4vw, 2.7rem);
  color: #ffffff;
  margin-bottom: 18px;
  text-shadow: 0 6px 30px rgba(0, 0, 0, 0.45);
}

.nm-slide p {
  font-family: var(--font-body);
  font-size: clamp(0.98rem, 1.35vw, 1.1rem);
  color: rgba(238, 241, 247, 0.9);
  text-shadow: 0 2px 14px rgba(0, 0, 0, 0.4);
}

.nm-slide .btn {
  margin-top: 28px;
}

.nm-scroll-hint {
  position: absolute;
  left: 50%;
  bottom: 34px;
  transform: translateX(-50%);
  z-index: 6;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  font-size: 0.68rem;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(246, 242, 233, 0.75);
}

.nm-scroll-hint .nm-chevron {
  width: 14px;
  height: 14px;
  border-right: 1.5px solid var(--gold-400);
  border-bottom: 1.5px solid var(--gold-400);
  transform: rotate(45deg);
  animation: nm-chevron-bounce 1.8s ease-in-out infinite;
}

@keyframes nm-chevron-bounce {
  0%, 100% { transform: rotate(45deg) translate(0, 0); }
  50% { transform: rotate(45deg) translate(4px, 4px); }
}

/* ---- Desktop: each slide is explicitly anchored left / right / center,
   so the panel never sits on top of the frame's main subject (face,
   brain, neuron). Only the final slide is centered. ---- */
@media (min-width: 761px) {
  .nm-slide[data-pos="left"]   { align-items: flex-start; }
  .nm-slide[data-pos="right"]  { align-items: flex-end; }
  .nm-slide[data-pos="center"] { align-items: center; }

  /* Final slide only: the closing line is the call-to-action, so its panel
     spans the page width instead of staying frosted-card-narrow like the
     other slides. */
  .nm-slide[data-pos="center"] .nm-slide-inner {
    text-align: center;
    width: 100%;
    max-width: min(1100px, 92vw);
  }
  .nm-slide[data-pos="center"] .nm-slide-inner p {
    margin-left: auto;
    margin-right: auto;
  }
}

/* ---- Mobile: every slide anchors toward the bottom, full-width-ish and
   centered, which naturally clears the vertical/horizontal centre where
   faces and brains tend to sit once the image is cover-cropped tall. ---- */
@media (max-width: 760px) {
  .nm-slide {
    justify-content: flex-end;
    align-items: center;
    padding: 0 5% 80px;
  }
  .nm-slide-inner {
    max-width: 100%;
    width: 100%;
    text-align: center;
    padding: 26px 24px;
  }
  .nm-slide-inner p { margin-left: auto; margin-right: auto; }
  .nm-slide h1 {
    font-size: clamp(1.5rem, 6.2vw, 2.1rem);
  }
  .nm-slide p {
    font-size: 0.95rem;
  }
  .nm-hero-gradient {
    background:
      linear-gradient(180deg, rgba(4, 7, 13, 0.4) 0%, rgba(4, 7, 13, 0.02) 20%, rgba(4, 7, 13, 0.1) 50%, rgba(4, 7, 13, 0.82) 100%);
  }
}
