/* Shared layout: one scroll root only.
   Important: overflow-x:hidden on body makes overflow-y compute to auto (CSS quirk),
   which stacks a second scrollbar beside html. Use clip for the x-axis instead. */
html {
  overflow-x: clip;
  overflow-y: auto;
  max-width: 100%;
}

body {
  overflow-x: clip;
  overflow-y: visible;
  max-width: 100%;
  min-height: 100%;
}

/* Lenis smooth scroll — html is the only scrollport */
html.lenis {
  height: auto;
  overflow: hidden;
}

html.lenis body {
  height: auto;
  overflow-x: clip;
  overflow-y: visible;
}

html.lenis.lenis-smooth {
  scroll-behavior: auto !important;
}

img,
video,
svg {
  max-width: 100%;
  height: auto;
}

body.mobile-nav-open {
  overflow: hidden;
}

/* Shared section reveal — keep footer/content visible even if page JS skipped */
.motion-section .motion-item {
  opacity: 0;
  filter: blur(3px);
  will-change: opacity, transform, filter;
  transition:
    opacity 0.78s cubic-bezier(0.22, 1, 0.36, 1),
    transform 0.92s cubic-bezier(0.22, 1, 0.36, 1),
    filter 0.78s ease;
  transition-delay: var(--motion-delay, 0ms);
}

.motion-section .motion-soft-up {
  transform: translate3d(0, 22px, 0);
}

.motion-section .motion-from-left {
  transform: translate3d(-46px, 0, 0);
}

.motion-section .motion-from-right {
  transform: translate3d(46px, 0, 0);
}

.motion-section .motion-pop {
  transform: translate3d(0, 20px, 0) scale(0.96);
}

.motion-section.is-visible .motion-item {
  opacity: 1;
  transform: translate3d(0, 0, 0) scale(1);
  filter: blur(0);
}

@media (prefers-reduced-motion: reduce) {
  .motion-section .motion-item {
    opacity: 1 !important;
    transform: none !important;
    filter: none !important;
    transition: none !important;
  }
}

/* One header chrome for every page — solid dark bar, same buttons, same scroll state */
#siteHeader {
  isolation: isolate;
  padding: 0.9rem 0;
  background: rgba(25, 22, 21, 0.94) !important;
  backdrop-filter: blur(18px);
  -webkit-backdrop-filter: blur(18px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
  transition:
    padding 0.28s ease,
    background 0.28s ease,
    box-shadow 0.28s ease;
}

#siteHeader > div {
  position: relative;
  z-index: 2;
}

#siteHeader .site-header__nav {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.18);
}

#siteHeader .nav-action {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(0, 0, 0, 0.28);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}

#siteHeader .nav-action:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.55);
}

#siteHeader .nav-action--primary,
#siteHeader .header-join-btn {
  border-color: transparent;
  background: #da020c;
  box-shadow: 0 4px 18px rgba(218, 2, 12, 0.35);
}

#siteHeader .nav-action--primary:hover,
#siteHeader .header-join-btn:hover {
  background: #bf020a;
  border-color: transparent;
  transform: translateY(-1px);
}

#siteHeader.nav-scrolled {
  padding-top: 0.5rem !important;
  padding-bottom: 0.5rem !important;
  background: #191615 !important;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.28);
}

#siteHeader.nav-scrolled .site-header__logo {
  height: 2.15rem !important;
}

#siteHeader.nav-scrolled .nav-action {
  transform: scale(0.96);
  transform-origin: center;
}

#siteHeader.nav-scrolled .nav-action--primary:hover,
#siteHeader.nav-scrolled .header-join-btn:hover {
  transform: scale(0.96) translateY(-1px);
}

/* Keep nav pills on one line and tighten spacing when the bar gets crowded */
#siteHeader nav ul > li > a,
#siteHeader nav ul .nav-dropdown__trigger {
  white-space: nowrap;
}

@media (min-width: 1024px) and (max-width: 1279px) {
  #siteHeader nav ul {
    font-size: 11px;
  }

  #siteHeader nav ul > li > a,
  #siteHeader nav ul .nav-dropdown__trigger {
    padding-left: 9px;
    padding-right: 9px;
  }

  #siteHeader .nav-action {
    padding-left: 14px;
    padding-right: 14px;
  }
}

/* Keep auth buttons from colliding with the centered pill on mid-size desktops */
@media (min-width: 1024px) {
  #siteHeader .site-header__inner {
    min-height: 2.75rem;
  }
}

@media (max-width: 1023px) {
  #siteHeader.nav-scrolled .site-header__logo {
    height: 2rem !important;
  }
}

/* Header dropdown (Coach Portal) */
.nav-dropdown {
  position: relative;
}

.nav-dropdown__trigger {
  display: inline-flex !important;
  align-items: center;
  gap: 5px;
  border: 0;
  background: transparent;
  font: inherit;
  cursor: pointer;
  white-space: nowrap;
}

.nav-dropdown__caret {
  width: 12px;
  height: 12px;
  transition: transform 0.22s ease;
}

.nav-dropdown:hover .nav-dropdown__caret,
.nav-dropdown:focus-within .nav-dropdown__caret {
  transform: rotate(180deg);
}

.nav-dropdown__menu {
  position: absolute;
  top: calc(100% + 12px);
  left: 50%;
  transform: translate(-50%, 6px);
  min-width: 190px;
  padding: 6px;
  border-radius: 14px;
  background: #191615;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.4);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
}

/* Invisible bridge so the pointer can travel from the trigger to the menu. */
.nav-dropdown__menu::before {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  top: -14px;
  height: 14px;
}

.nav-dropdown:hover .nav-dropdown__menu,
.nav-dropdown:focus-within .nav-dropdown__menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translate(-50%, 0);
}

.nav-dropdown__item {
  display: block;
  padding: 9px 14px;
  border-radius: 9px;
  font-size: 12px;
  font-weight: 500;
  color: #d4d4d8;
  white-space: nowrap;
  transition: background 0.18s ease, color 0.18s ease;
}

.nav-dropdown__item:hover {
  background: rgba(255, 255, 255, 0.09);
  color: #fff;
}

.nav-dropdown__item.is-active {
  background: #da020c;
  color: #fff;
}

#mobileMenuBtn {
  position: relative;
  z-index: 3;
  cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  touch-action: manipulation;
}

#mobileMenuBtn.is-active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
}

#mobileMenuBtn.is-active span:nth-child(2) {
  opacity: 0;
}

#mobileMenuBtn.is-active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
}

#mobileMenuDrawer {
  position: relative;
  z-index: 1;
}

#mobileMenuDrawer.is-open {
  max-height: calc(100vh - 72px);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  animation: mobileMenuIn 0.22s ease-out;
}

@keyframes mobileMenuIn {
  from {
    opacity: 0;
    transform: translateY(-8px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@media (max-width: 1023px) {
  #siteHeader:has(#mobileMenuDrawer.is-open) {
    background: #191615 !important;
  }
}

@media (max-width: 639px) {
  #siteHeader .header-join-btn {
    padding-left: 0.875rem;
    padding-right: 0.875rem;
    font-size: 0.7rem;
  }
}

@media (prefers-reduced-motion: reduce) {
  #mobileMenuDrawer.is-open {
    animation: none;
  }
}
