/*
 * JOULS web experience layer.
 * Progressive enhancement only: essential copy, links, headings and structured
 * content must remain visible and usable without this stylesheet or JavaScript.
 * Source of truth: website/design-system/MOTION.md.
 */

:root {
  --jouls-ease-out: cubic-bezier(.16, 1, .3, 1);
  --jouls-motion-fast: 160ms;
  --jouls-motion-base: 260ms;
  --jouls-motion-focal: 680ms;
}

/* Browser surfaces are part of the product finish. */
body.jouls-site {
  caret-color: var(--jouls-ink);
  scrollbar-color: var(--jouls-graphite) var(--jouls-white);
  scrollbar-width: thin;
}

body.jouls-site::-webkit-scrollbar,
.jouls-table-wrap::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

body.jouls-site::-webkit-scrollbar-track,
.jouls-table-wrap::-webkit-scrollbar-track {
  background: var(--jouls-white);
}

body.jouls-site::-webkit-scrollbar-thumb,
.jouls-table-wrap::-webkit-scrollbar-thumb {
  border: 3px solid var(--jouls-white);
  border-radius: 999px;
  background: var(--jouls-graphite);
}

body.jouls-site :where(input, textarea, [contenteditable="true"]) {
  caret-color: var(--jouls-ink);
}

/* Keep long page headings in normal document flow. Sticky headings caused
 * content from adjacent sections to visually overlap while scrolling desktop. */
.jouls-section-heading {
  position: static;
  top: auto;
}

.jouls-content-section {
  position: relative;
  isolation: isolate;
}

/* Keep large display type forceful without over-tightening it. */
.jouls-hero h1,
.jouls-page-hero h1,
.jouls-content-header h1 {
  letter-spacing: -.04em;
}

.jouls-hero h1,
.jouls-page-hero h1 {
  font-size: clamp(3rem, 7vw, 6rem);
}

/* Navigation: a deliberate Volt trace rather than a browser-default underline. */
.jouls-nav-list a {
  position: relative;
}

.jouls-nav-list a::after {
  content: "";
  position: absolute;
  right: 0;
  bottom: 6px;
  left: 0;
  height: 2px;
  background: var(--jouls-volt);
  transform: scaleX(0);
  transform-origin: left center;
  transition: transform var(--jouls-motion-base) var(--jouls-ease-out);
}

body.jouls-site .jouls-nav-list a:hover,
body.jouls-site .jouls-nav-list a:focus-visible {
  text-decoration: none;
}

.jouls-nav-list a:hover::after,
.jouls-nav-list a:focus-visible::after,
.jouls-nav-list .current-menu-item > a::after,
.jouls-nav-list .current-menu-ancestor > a::after {
  transform: scaleX(1);
}

/* CTA feedback: retain depth, remove the old hard-offset block shadow. */
.jouls-button {
  box-shadow: 0 0 0 rgba(16, 20, 17, 0);
  transition:
    transform var(--jouls-motion-fast) var(--jouls-ease-out),
    box-shadow var(--jouls-motion-fast) var(--jouls-ease-out),
    background-color var(--jouls-motion-fast) ease,
    border-color var(--jouls-motion-fast) ease,
    color var(--jouls-motion-fast) ease;
}

.jouls-button:hover {
  border-color: var(--jouls-ink);
  background: var(--jouls-ink);
  color: var(--jouls-white) !important;
  box-shadow: 0 10px 28px rgba(16, 20, 17, .14);
  transform: translateY(-2px);
}

.jouls-button:active {
  box-shadow: 0 4px 12px rgba(16, 20, 17, .12);
  transform: translateY(0) scale(.985);
}

.jouls-coach-band .jouls-button-secondary:hover {
  border-color: var(--jouls-ink);
  background: var(--jouls-white);
  color: var(--jouls-ink) !important;
}

.jouls-text-link > [aria-hidden="true"],
.jouls-feature-lines a > [aria-hidden="true"] {
  display: inline-block;
  transition: transform var(--jouls-motion-base) var(--jouls-ease-out);
}

.jouls-text-link:hover > [aria-hidden="true"],
.jouls-text-link:focus-visible > [aria-hidden="true"],
.jouls-feature-lines a:hover > [aria-hidden="true"],
.jouls-feature-lines a:focus-visible > [aria-hidden="true"] {
  transform: translateX(4px);
}

.jouls-anchor-index-arrow {
  display: inline-block;
  transition: transform var(--jouls-motion-base) var(--jouls-ease-out);
}

.jouls-anchor-index a:hover .jouls-anchor-index-arrow,
.jouls-anchor-index a:focus-visible .jouls-anchor-index-arrow {
  transform: translateY(3px);
}

/*
 * Signature entrance: the JOULS rail mark charges and a Volt signal passes
 * across the hero system. The actual product copy never starts hidden.
 */
.jouls-hero-system {
  isolation: isolate;
  overflow: clip;
}

.jouls-hero-system::before {
  content: "";
  position: absolute;
  z-index: 3;
  top: 0;
  left: 0;
  width: 30%;
  height: 3px;
  background: var(--jouls-volt);
  pointer-events: none;
  transform: translateX(-120%);
  animation: jouls-signal-sweep 760ms var(--jouls-ease-out) 120ms both;
}

.jouls-rail-mark span {
  clip-path: inset(100% 0 0 0);
  animation: jouls-rail-charge 560ms var(--jouls-ease-out) both;
}

.jouls-rail-mark span:nth-child(1) { animation-delay: 80ms; }
.jouls-rail-mark span:nth-child(2) { animation-delay: 150ms; }
.jouls-rail-mark span:nth-child(3) { animation-delay: 220ms; }

.jouls-system-row {
  animation: jouls-row-signal 460ms var(--jouls-ease-out) both;
}

.jouls-system-row:nth-child(2) { animation-delay: 250ms; }
.jouls-system-row:nth-child(3) { animation-delay: 330ms; }
.jouls-system-row:nth-child(4) { animation-delay: 410ms; }
.jouls-system-row:nth-child(5) { animation-delay: 490ms; }

@keyframes jouls-signal-sweep {
  from { transform: translateX(-120%); }
  to { transform: translateX(435%); }
}

@keyframes jouls-rail-charge {
  from { clip-path: inset(100% 0 0 0); }
  to { clip-path: inset(0 0 0 0); }
}

@keyframes jouls-row-signal {
  0%, 100% { background-color: transparent; }
  45% { background-color: rgba(184, 237, 61, .12); }
}

/* Mobile menu continuity without a JavaScript animation dependency. */
.jouls-mobile-menu[open] .jouls-mobile-panel {
  transform-origin: top right;
  animation: jouls-menu-enter var(--jouls-motion-base) var(--jouls-ease-out) both;
}

@keyframes jouls-menu-enter {
  from {
    opacity: .88;
    clip-path: inset(0 0 10% 0 round 8px);
    transform: translateY(-5px);
  }
  to {
    opacity: 1;
    clip-path: inset(0 0 0 0 round 8px);
    transform: translateY(0);
  }
}

/* Progressive scroll feedback on browsers that support CSS scroll timelines. */
@supports (animation-timeline: scroll()) {
  body.jouls-site::before {
    content: "";
    position: fixed;
    z-index: 1001;
    top: 0;
    right: 0;
    left: 0;
    height: 2px;
    background: var(--jouls-volt);
    pointer-events: none;
    transform: scaleX(0);
    transform-origin: left center;
    animation: jouls-scroll-progress linear both;
    animation-timeline: scroll(root block);
  }

  @keyframes jouls-scroll-progress {
    to { transform: scaleX(1); }
  }
}

@media (prefers-reduced-motion: reduce) {
  .jouls-hero-system::before {
    display: none;
  }

  .jouls-system-row {
    animation: none;
  }

  .jouls-rail-mark span {
    clip-path: none;
    animation: none;
  }

  .jouls-mobile-menu[open] .jouls-mobile-panel {
    animation: none;
  }

  .jouls-button,
  .jouls-nav-list a::after,
  .jouls-text-link > [aria-hidden="true"],
  .jouls-feature-lines a > [aria-hidden="true"],
  .jouls-anchor-index-arrow {
    transition-duration: 80ms;
  }

  .jouls-button:hover,
  .jouls-button:active,
  .jouls-text-link:hover > [aria-hidden="true"],
  .jouls-text-link:focus-visible > [aria-hidden="true"],
  .jouls-feature-lines a:hover > [aria-hidden="true"],
  .jouls-feature-lines a:focus-visible > [aria-hidden="true"],
  .jouls-anchor-index a:hover .jouls-anchor-index-arrow,
  .jouls-anchor-index a:focus-visible .jouls-anchor-index-arrow {
    transform: none;
  }

  @supports (animation-timeline: scroll()) {
    body.jouls-site::before {
      display: none;
    }
  }
}
