/* Page motion: scroll reveal, heading bar draw-in, active menu underline, smooth scroll.
   Classes are only applied when JavaScript runs (html.motion), so content stays visible without JS. */

html.motion {
  scroll-behavior: smooth;
}

/* 1. Fade-in on scroll */
html.motion .rv {
  opacity: 0;
  transform: translateY(18px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

html.motion .rv.in {
  opacity: 1;
  transform: none;
}

/* 2. Heading bar draws in */
html.motion section h2 {
  position: relative;
  border-left-color: transparent !important;
}

html.motion section h2::before {
  content: "";
  position: absolute;
  left: -5px;
  top: 0;
  width: 5px;
  height: 0;
  background: currentColor;
  transition: height 0.6s cubic-bezier(0.2, 0.8, 0.2, 1);
}

html.motion section h2.in::before {
  height: 100%;
}

/* 4. Active menu underline */
html.motion .topnav a.normal {
  position: relative;
}

html.motion .topnav a.normal::after {
  content: "";
  position: absolute;
  left: 20%;
  right: 20%;
  bottom: 6px;
  height: 2px;
  background: #fff;
  transform: scaleX(0);
  transition: transform 0.3s ease;
}

html.motion .topnav a.normal.active::after,
html.motion .topnav a.normal:hover::after {
  transform: scaleX(1);
}

@media (prefers-reduced-motion: reduce) {
  html.motion {
    scroll-behavior: auto;
  }

  html.motion .rv {
    opacity: 1;
    transform: none;
    transition: none;
  }

  html.motion section h2::before {
    height: 100%;
    transition: none;
  }

  html.motion .topnav a.normal::after {
    transition: none;
  }
}
