/* Hero Scroll Sequence Styles */

:root {
  /* Scroll distance: 80svh for animation + 80svh for blank hold scroll = 160svh */
  --hero-anim-scroll: 80svh;
  --hero-hold-scroll: 80svh;
  --hero-scroll-length: calc(var(--hero-anim-scroll) + var(--hero-hold-scroll));
}

/* Ensure no ancestor overflow clipping breaks position: sticky */
html,
body {
  overflow-x: clip;
}

/* Tall wrapper defining the full scroll track */
.hero-scroll {
  position: relative;
  width: calc(100% + 2 * var(--spacing-2xl));
  margin-top: calc(-1 * var(--spacing-3xl));
  margin-left: calc(-1 * var(--spacing-2xl));
  margin-right: calc(-1 * var(--spacing-2xl));
  height: calc(calc(100svh - var(--spacing-xl)) + var(--hero-scroll-length));
  margin-bottom: var(--spacing-4xl);
  box-sizing: border-box;
}

/* Pinned sticky viewport stage - matches exact size of background page-frame */
.hero-scroll__stage {
  position: sticky;
  top: 0;
  height: calc(100svh - var(--spacing-xl));
  width: 100%;
  border-radius: 0 0 70px 70px;
  border: none;
  background-color: var(--bg-surface);
  overflow: hidden;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  box-sizing: border-box;
}

/* High-performance canvas */
.hero-scroll__canvas {
  display: block;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

/* Hero Text Overlay (visible before 1st scroll, smoothly vanishes on scroll) */
.hero-overlay {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  pointer-events: none;
  z-index: 5;
  width: 90%;
  max-width: 900px;
  opacity: 1;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1), transform 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: opacity, transform;
}

.hero-overlay__title {
  font-family: var(--font-display, "Space Grotesk", sans-serif);
  font-size: clamp(2.6rem, 7vw, 5.6rem);
  font-weight: 800;
  line-height: 1.05;
  letter-spacing: -0.02em;
  color: #18181b;
  margin: 0 0 14px 0;
  text-shadow: 0 2px 20px rgba(255, 255, 255, 0.85);
}

.hero-overlay__subtitle {
  font-family: var(--font-display, var(--font-body, inherit));
  font-size: clamp(1.05rem, 2.2vw, 1.55rem);
  font-weight: 600;
  line-height: 1.35;
  letter-spacing: 0.02em;
  color: #4b5563;
  margin: 0;
  text-shadow: 0 1px 16px rgba(255, 255, 255, 0.85);
}

@media (max-width: 768px) {
  .hero-overlay__title {
    font-size: clamp(2.2rem, 8vw, 3.4rem);
    margin-bottom: 10px;
  }

  .hero-overlay__subtitle {
    font-size: clamp(0.95rem, 3.8vw, 1.25rem);
  }
}

/* Mobile & Tablet Responsive Adjustments */
@media (max-width: 768px) {
  :root {
    --hero-anim-scroll: 70svh;
    --hero-hold-scroll: 70svh;
    --hero-scroll-length: calc(var(--hero-anim-scroll) + var(--hero-hold-scroll));
  }

  .hero-scroll {
    width: calc(100% + 2 * var(--spacing-lg));
    margin-top: calc(-1 * var(--spacing-2xl));
    margin-left: calc(-1 * var(--spacing-lg));
    margin-right: calc(-1 * var(--spacing-lg));
    height: calc(calc(100svh - var(--spacing-md)) + var(--hero-scroll-length));
  }

  .hero-scroll__stage {
    top: 0;
    height: calc(100svh - var(--spacing-md));
    border-radius: 0 0 56px 56px;
  }
}

@media (max-width: 380px) {
  :root {
    --hero-anim-scroll: 60svh;
    --hero-hold-scroll: 60svh;
    --hero-scroll-length: calc(var(--hero-anim-scroll) + var(--hero-hold-scroll));
  }

  .hero-scroll {
    width: calc(100% + 2 * var(--spacing-lg));
    margin-top: calc(-1 * var(--spacing-2xl));
    margin-left: calc(-1 * var(--spacing-lg));
    margin-right: calc(-1 * var(--spacing-lg));
    height: calc(calc(100svh - var(--spacing-md)) + var(--hero-scroll-length));
  }

  .hero-scroll__stage {
    top: 0;
    height: calc(100svh - var(--spacing-md));
    border-radius: 0 0 44px 44px;
  }
}

/* Accessibility: Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .hero-scroll {
    height: auto !important;
  }

  .hero-scroll__stage {
    position: relative !important;
    top: 0 !important;
    height: calc(100svh - var(--spacing-xl)) !important;
  }
}
