:root {
  --hero-bg: #06070b;
  --hero-text: #f5f7ff;
  --hero-text-muted: rgba(245, 247, 255, 0.62);
  --hero-glow: rgba(118, 175, 255, 0.3);
}

#page-header.hero-scroll-shell {
  position: relative;
  height: 450vh;
  min-height: 400vh;
  background: var(--hero-bg);
  overflow: clip;
  z-index: 3;
}

.hero-scroll {
  position: relative;
  width: 100%;
  height: 100%;
}

.scroll-container {
  --hero-blackout: 0;
  position: sticky;
  top: 0;
  width: 100%;
  height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background:
    radial-gradient(58% 52% at 50% 18%, rgba(96, 147, 255, 0.14) 0%, rgba(12, 16, 28, 0) 70%),
    radial-gradient(40% 32% at 62% 78%, rgba(58, 123, 236, 0.08) 0%, rgba(5, 7, 12, 0) 72%),
    linear-gradient(180deg, #06070b 0%, #05060a 65%, #070912 100%);
  isolation: isolate;
  will-change: transform, opacity;
}

body.tt-smooth-scroll .scroll-container {
  position: relative;
  top: auto;
}

.scroll-container::before,
.scroll-container::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.scroll-container::before {
  background:
    radial-gradient(70% 52% at 50% 50%, rgba(8, 11, 20, 0) 42%, rgba(4, 5, 10, 0.32) 100%),
    linear-gradient(180deg, rgba(1, 2, 5, 0.22) 0%, rgba(4, 6, 12, 0.08) 45%, rgba(2, 3, 8, 0.3) 100%);
  z-index: 2;
}

.scroll-container::after {
  background: rgb(0 0 0 / var(--hero-blackout));
  z-index: 4;
}

#hero-canvas {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
}

.overlay-content {
  position: relative;
  z-index: 3;
  width: min(920px, calc(100% - 64px));
  display: grid;
  align-content: end;
  gap: 24px;
  height: 100%;
  padding-top: clamp(96px, 12vh, 140px);
  padding-bottom: clamp(72px, 12vh, 120px);
  color: var(--hero-text);
}

.hero-label {
  margin: 0;
  font-family: "Syne", sans-serif;
  font-size: clamp(12px, 1.1vw, 16px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: var(--hero-text-muted);
  text-shadow: 0 0 22px rgba(255, 255, 255, 0.2);
}

.hero-message, .hero-initial-msg {
  position: absolute;
  left: 50%;
  bottom: clamp(68px, 11vh, 116px);
  margin: 0;
  max-width: 100%;
  font-family: "Syne", sans-serif;
  font-weight: 700;
  font-size: clamp(2rem, 5.6vw, 6.1rem);
  line-height: 0.95;
  letter-spacing: -0.03em;
  color: var(--hero-text);
  text-align: center;
  text-wrap: balance;
  opacity: 0;
  transform: translate3d(-50%, 50px, 0); /* Center transform added */
  text-shadow:
    0 0 14px rgba(255, 255, 255, 0.13),
    0 0 36px var(--hero-glow);
  will-change: opacity, transform;
}

/* Base styles for the initial left/right messages */
.hero-initial-msg {
  opacity: 1; /* Starts visible */
  transition: opacity 0.5s ease;
}

.hero-initial-msg.hero-msg-left,
.hero-initial-msg.hero-msg-right {
  bottom: clamp(68px, 11vh, 116px);
  text-align: left;
  max-width: none;
  font-size: clamp(1.5rem, 3vw, 4rem);
  transform: translate3d(0, 0, 0); /* Remove centering transform */
}

.hero-initial-msg.hero-msg-left {
  left: clamp(32px, 4.2vw, 72px);
  right: auto;
}

.hero-initial-msg.hero-msg-right {
  right: clamp(32px, 4.2vw, 72px);
  left: auto;
  text-align: right;
}

/* Scroll indicator styling */
.scroll-indicator {
  position: absolute;
  left: 50%;
  bottom: clamp(30px, 7vh, 50px);
  transform: translateX(-50%);
  font-family: "Syne", sans-serif;
  font-size: clamp(10px, 1.1vw, 12px);
  letter-spacing: 0.28em;
  text-transform: uppercase;
  color: #fff;
  opacity: 1;
  transition: opacity 0.3s ease;
  z-index: 10;
}

/* Hide initial state elements when scrolling begins */
.scroll-container.is-scrolling .hero-msg-left,
.scroll-container.is-scrolling .hero-msg-right,
.scroll-container.is-scrolling .scroll-indicator {
  opacity: 0 !important;
  pointer-events: none;
}

.hero-loading {
  position: absolute;
  left: 50%;
  bottom: clamp(28px, 5vh, 44px);
  transform: translateX(-50%);
  z-index: 5;
  font-size: 12px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: rgba(255, 255, 255, 0.66);
  opacity: 0;
  transition: opacity 0.28s ease;
}

.hero-loading.is-visible {
  opacity: 1;
}

.hero-loading.is-hidden {
  opacity: 0;
}

@media (max-width: 991px) {
  #page-header.hero-scroll-shell {
    height: 420vh;
  }

  .overlay-content {
    width: calc(100% - 36px);
    padding-top: clamp(84px, 13vh, 112px);
    padding-bottom: clamp(56px, 10vh, 92px);
  }

  .hero-message {
    left: 50%;
    right: auto;
    max-width: 16ch;
    bottom: auto;
    top: 60vh;
    font-size: clamp(1.58rem, 10.4vw, 4rem);
    line-height: 1.02;
    transform: translate3d(-50%, 0, 0);
  }

  .hero-initial-msg.hero-msg-left {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 58vh;
    text-align: center;
    transform: translate3d(-50%, 0, 0);
    width: 100%;
    max-width: 90vw;
  }

  .hero-initial-msg.hero-msg-right {
    left: 50%;
    right: auto;
    bottom: auto;
    top: 66vh;
    text-align: center;
    transform: translate3d(-50%, 0, 0);
    width: 100%;
    max-width: 90vw;
  }
}

@media (max-width: 575px) {
  #page-header.hero-scroll-shell {
    min-height: 400vh;
  }

  .hero-label {
    letter-spacing: 0.19em;
  }

  .hero-message {
    max-width: 100%;
  }
}

@media (prefers-reduced-motion: reduce) {
  .scroll-container,
  .hero-message,
  .hero-loading {
    transition: none;
  }
}
