/**
 * Award-style scroll effects — progress, reveals, parallax, nav morph
 */

:root {
  --scroll-ease: cubic-bezier(0.22, 1, 0.36, 1);
  --scroll-duration: 1.05s;
}

/* —— Scroll progress —— */
.scroll-progress {
  position: fixed;
  top: 0;
  left: 0;
  height: 2px;
  width: 0%;
  z-index: 2000;
  pointer-events: none;
  background: linear-gradient(90deg, #1e293b 0%, #64748b 55%, #94a3b8 100%);
  transform-origin: left center;
  will-change: width;
}

/* —— Nav morph on scroll —— */
.story-nav {
  transition:
    background 0.45s var(--scroll-ease),
    border-color 0.45s var(--scroll-ease),
    box-shadow 0.45s var(--scroll-ease),
    padding 0.45s var(--scroll-ease),
    backdrop-filter 0.45s ease;
}

.story-nav.is-scrolled {
  background: rgba(255, 255, 255, 0.82);
  border-bottom-color: rgba(226, 232, 240, 0.85);
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.06);
  backdrop-filter: blur(16px) saturate(1.15);
  -webkit-backdrop-filter: blur(16px) saturate(1.15);
}

/* —— Hero scroll cue —— */
.hero-scroll-cue {
  position: absolute;
  right: clamp(1.25rem, 4vw, 3rem);
  bottom: clamp(1.5rem, 4vh, 2.75rem);
  z-index: 4;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.65rem;
  text-decoration: none;
  color: var(--color-text-light, #64748b);
  opacity: 0;
  animation: hero-cue-fade 0.9s var(--scroll-ease) 1.35s forwards;
}

.hero-scroll-cue-line {
  display: block;
  width: 1px;
  height: 52px;
  background: linear-gradient(180deg, transparent, currentColor);
  transform-origin: top center;
  animation: hero-cue-pulse 2.2s var(--scroll-ease) infinite;
}

.hero-scroll-cue-label {
  font-family: var(--font-sans);
  font-size: 0.65rem;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  font-weight: 500;
}

@keyframes hero-cue-fade {
  from { opacity: 0; transform: translate3d(0, 10px, 0); }
  to { opacity: 0.72; transform: translate3d(0, 0, 0); }
}

@keyframes hero-cue-pulse {
  0%, 100% { transform: scaleY(1); opacity: 0.55; }
  50% { transform: scaleY(0.55); opacity: 1; }
}

.story-hero--editorial.is-leaving .hero-scroll-cue,
.story-hero--home.is-leaving .hero-scroll-cue,
body.page-about .about-top.is-leaving .about-scroll-cue {
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.35s ease;
  animation: none;
}

@media (max-width: 640px) {
  .hero-scroll-cue {
    left: 50%;
    right: auto;
    bottom: 1.25rem;
    transform: translateX(-50%);
  }

  @keyframes hero-cue-fade {
    from { opacity: 0; transform: translateX(-50%) translate3d(0, 10px, 0); }
    to { opacity: 0.72; transform: translateX(-50%) translate3d(0, 0, 0); }
  }
}

/* —— Hero scroll layers —— */
.story-hero--editorial .story-hero-editorial-bg,
.story-hero--home .story-hero-mesh-bg {
  will-change: transform;
  transform: translate3d(0, 0, 0) scale(1.08);
  transform-origin: center center;
}

.story-hero--editorial .story-hero-content,
.story-hero--home .story-hero-content {
  will-change: transform, opacity;
  transition: none;
}

body.page-home .story-hero--editorial.is-leaving .btn-hero-cta,
body.page-home .story-hero--home.is-leaving .btn-hero-cta {
  pointer-events: none;
}

/* —— Generic reveal system (only when JS is ready) —— */
body.js-scroll-fx [data-reveal] {
  opacity: 0;
  transform: translate3d(0, 48px, 0);
  filter: blur(6px);
  transition:
    opacity var(--scroll-duration) var(--scroll-ease),
    transform var(--scroll-duration) var(--scroll-ease),
    filter calc(var(--scroll-duration) * 0.85) var(--scroll-ease);
  transition-delay: var(--reveal-delay, 0ms);
  will-change: opacity, transform, filter;
}

body.js-scroll-fx [data-reveal].is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  filter: blur(0);
}

body.js-scroll-fx [data-reveal="up"] {
  transform: translate3d(0, 56px, 0);
}

body.js-scroll-fx [data-reveal="left"] {
  transform: translate3d(-48px, 0, 0);
}

body.js-scroll-fx [data-reveal="right"] {
  transform: translate3d(48px, 0, 0);
}

body.js-scroll-fx [data-reveal="scale"] {
  transform: translate3d(0, 28px, 0) scale(0.94);
}

body.js-scroll-fx [data-reveal="left"].is-inview,
body.js-scroll-fx [data-reveal="right"].is-inview,
body.js-scroll-fx [data-reveal="up"].is-inview,
body.js-scroll-fx [data-reveal="scale"].is-inview {
  transform: translate3d(0, 0, 0) scale(1);
}

/* Clip reveal for headings / lines */
body.js-scroll-fx [data-reveal="clip"] {
  opacity: 1;
  filter: none;
  transform: none;
  clip-path: inset(0 0 100% 0);
  transition: clip-path 1.15s var(--scroll-ease);
  transition-delay: var(--reveal-delay, 0ms);
}

body.js-scroll-fx [data-reveal="clip"].is-inview {
  clip-path: inset(0 0 0 0);
}

/* Stagger children */
body.js-scroll-fx [data-stagger] > * {
  opacity: 0;
  transform: translate3d(0, 36px, 0);
  transition:
    opacity 0.9s var(--scroll-ease),
    transform 0.9s var(--scroll-ease);
  transition-delay: calc(var(--stagger-base, 80ms) * var(--i, 0));
}

body.js-scroll-fx [data-stagger].is-inview > * {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* —— Home brand paths: entrance handled in story-home.css —— */

/* —— Image parallax frames —— */
.parallax-frame {
  position: relative;
  overflow: hidden;
  isolation: isolate;
}

.parallax-frame .about-image,
.parallax-frame img {
  display: block;
  width: 100%;
  height: 115%;
  object-fit: cover;
  transform: translate3d(0, 0, 0) scale(1.08);
  will-change: transform;
  transition: none;
}

body.js-scroll-fx .about-image-wrapper.parallax-frame:not(.visible):not(.is-inview) {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  transition:
    opacity 1.1s var(--scroll-ease),
    transform 1.1s var(--scroll-ease);
}

body.js-scroll-fx .about-image-wrapper.parallax-frame.visible,
body.js-scroll-fx .about-image-wrapper.parallax-frame.is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0);
  transition:
    opacity 1.1s var(--scroll-ease),
    transform 1.1s var(--scroll-ease);
}

/* Gallery items scroll-in */
body.js-scroll-fx .about-story-gallery {
  opacity: 0;
  transform: translate3d(0, 48px, 0);
  transition:
    opacity 1.15s var(--scroll-ease),
    transform 1.15s var(--scroll-ease);
}

body.js-scroll-fx .about-story-gallery.visible,
body.js-scroll-fx .about-story-gallery.is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

body.js-scroll-fx .about-story-gallery.visible .about-story-gallery-item,
body.js-scroll-fx .about-story-gallery.is-inview .about-story-gallery-item {
  animation: gallery-item-rise 0.95s var(--scroll-ease) both;
}

body.js-scroll-fx .about-story-gallery.visible .about-story-gallery-item:nth-child(1),
body.js-scroll-fx .about-story-gallery.is-inview .about-story-gallery-item:nth-child(1) {
  animation-delay: 0.05s;
}

body.js-scroll-fx .about-story-gallery.visible .about-story-gallery-item:nth-child(2),
body.js-scroll-fx .about-story-gallery.is-inview .about-story-gallery-item:nth-child(2) {
  animation-delay: 0.18s;
}

body.js-scroll-fx .about-story-gallery.visible .about-story-gallery-item:nth-child(3),
body.js-scroll-fx .about-story-gallery.is-inview .about-story-gallery-item:nth-child(3) {
  animation-delay: 0.3s;
}

@keyframes gallery-item-rise {
  from {
    opacity: 0;
    transform: translate3d(0, 32px, 0) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translate3d(0, 0, 0) scale(1);
  }
}

/* —— Testimonials: softer scroll-linked entrance —— */
.testimonials-section {
  --testimonial-progress: 0;
}

body.js-scroll-fx.page-home .testimonials-slideshow {
  opacity: 0;
  transform: translate3d(0, 56px, 0) scale(0.97);
  filter: blur(6px);
  transition:
    opacity 1.2s var(--scroll-ease),
    transform 1.25s var(--scroll-ease),
    filter 1s var(--scroll-ease);
}

body.js-scroll-fx.page-home .testimonials-section.is-inview .testimonials-slideshow,
body.js-scroll-fx.page-home .home-testimonials.is-inview .testimonials-slideshow {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
  transition-delay: 0.18s;
}

body.js-scroll-fx.page-home .home-testimonials-frame {
  opacity: 0;
  transform: translate3d(0, 40px, 0);
  clip-path: inset(10% 12% 10% 12%);
  transition:
    opacity 1.15s var(--scroll-ease),
    transform 1.2s var(--scroll-ease),
    clip-path 1.25s var(--scroll-ease);
}

body.js-scroll-fx.page-home .home-testimonials-frame.is-inview,
body.js-scroll-fx.page-home .home-testimonials.is-inview .home-testimonials-frame {
  opacity: 1;
  transform: none;
  clip-path: inset(0 0 0 0);
}

body.js-scroll-fx.page-home .home-testimonials-footer {
  opacity: 0;
  transform: translate3d(0, 16px, 0);
  transition:
    opacity 0.9s var(--scroll-ease),
    transform 0.9s var(--scroll-ease);
  transition-delay: 0.35s;
}

body.js-scroll-fx.page-home .home-testimonials.is-inview .home-testimonials-footer {
  opacity: 1;
  transform: none;
}

/* Soft scrub: testimonials lift slightly with scroll progress */
body.page-home.has-awwward-scroll .home-testimonials.is-inview .home-testimonial-quote {
  transform: translate3d(0, calc((1 - var(--testimonial-p, 1)) * 24px), 0);
  transition: none;
}

/* —— Brand / services sections —— */
body.js-scroll-fx .brand-hero .brand-logo-wrap,
body.js-scroll-fx .brand-hero .brand-hero-title,
body.js-scroll-fx .brand-hero .brand-hero-subtitle,
body.js-scroll-fx .brand-hero .brand-hero-desc {
  opacity: 0;
  transform: translate3d(0, 28px, 0);
  transition:
    opacity 0.95s var(--scroll-ease),
    transform 0.95s var(--scroll-ease);
}

body.js-scroll-fx .brand-hero.is-inview .brand-logo-wrap {
  opacity: 1;
  transform: none;
  transition-delay: 0.05s;
}

body.js-scroll-fx .brand-hero.is-inview .brand-hero-title {
  opacity: 1;
  transform: none;
  transition-delay: 0.16s;
}

body.js-scroll-fx .brand-hero.is-inview .brand-hero-subtitle {
  opacity: 1;
  transform: none;
  transition-delay: 0.28s;
}

body.js-scroll-fx .brand-hero.is-inview .brand-hero-desc {
  opacity: 1;
  transform: none;
  transition-delay: 0.4s;
}

body.js-scroll-fx .brand-category-block {
  opacity: 0;
  transform: translate3d(0, 48px, 0);
  transition:
    opacity 1s var(--scroll-ease),
    transform 1s var(--scroll-ease);
}

body.js-scroll-fx .brand-category-block.is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* —— Footer rise —— */
body.js-scroll-fx .story-footer {
  opacity: 0;
  transform: translate3d(0, 32px, 0);
  transition:
    opacity 1s var(--scroll-ease),
    transform 1s var(--scroll-ease);
}

body.js-scroll-fx .story-footer.is-inview {
  opacity: 1;
  transform: translate3d(0, 0, 0);
}

/* —— Horizontal hint line under section headings —— */
.section-title,
.services-heading,
.brand-categories-heading,
.testimonials-heading-serif {
  position: relative;
}

.section-title::after,
.services-heading::after,
.brand-categories-heading::after {
  content: '';
  display: block;
  width: 0;
  height: 1px;
  margin-top: 0.75rem;
  background: currentColor;
  opacity: 0.28;
  transition: width 1.1s var(--scroll-ease);
  transition-delay: 0.2s;
}

.story-section.visible .section-title::after,
.services-section.in-view .services-heading::after,
.brand-categories-section.is-inview .brand-categories-heading::after,
[data-reveal].is-inview.section-title::after {
  width: min(72px, 18%);
}

/* —— Smooth page feel —— */
@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: auto;
  }

  body.has-smooth-scroll {
    overflow-x: hidden;
  }
}

/* —— Reduced motion —— */
@media (prefers-reduced-motion: reduce) {
  .scroll-progress,
  .hero-scroll-cue {
    display: none;
  }

  body.js-scroll-fx [data-reveal],
  body.js-scroll-fx [data-reveal].is-inview,
  body.js-scroll-fx [data-stagger] > *,
  body.js-scroll-fx [data-stagger].is-inview > *,
  body.js-scroll-fx.page-home .home-brand-path,
  body.js-scroll-fx.page-home .home-brand-path .home-brand-path-desc,
  body.js-scroll-fx.page-home .home-brand-path .home-brand-path-tagline,
  body.js-scroll-fx .about-image-wrapper.parallax-frame,
  body.js-scroll-fx .about-story-gallery,
  body.js-scroll-fx .brand-hero .brand-logo-wrap,
  body.js-scroll-fx .brand-hero .brand-hero-title,
  body.js-scroll-fx .brand-hero .brand-hero-subtitle,
  body.js-scroll-fx .brand-hero .brand-hero-desc,
  body.js-scroll-fx .brand-category-block,
  body.js-scroll-fx .story-footer,
  body.js-scroll-fx.page-home .testimonials-slideshow,
  body.js-scroll-fx.page-home .home-testimonials-frame,
  body.js-scroll-fx.page-home .home-testimonials-footer,
  body.js-scroll-fx.page-home .home-brand-path {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    clip-path: none !important;
    transition: none !important;
    animation: none !important;
  }

  .story-hero--editorial .story-hero-editorial-bg,
  .story-hero--home .story-hero-mesh-bg,
  .parallax-frame .about-image,
  .parallax-frame img {
    transform: none !important;
  }

  .section-title::after,
  .services-heading::after,
  .brand-categories-heading::after {
    width: min(72px, 18%);
    transition: none;
  }
}
