/* Desktop sidebar (≥721px): one shared sliding pill behind the nav items
   (nav-glide-v1.js; port of the SlidingNavPill component). Its look is the
   active pill nav-calm-v1.css used to paint on each item: quiet cyan tint,
   hairline ring, 10px radius, plus a 3px accent bar on the left. */

:root {
  --cs-nav-pill-tint: rgba(111, 230, 255, .09);
  --cs-nav-pill-ring: rgba(111, 230, 255, .22);
  --cs-nav-pill-accent: var(--cs-nav-active, #6fe6ff);
}

@media (min-width: 721px) {
  body .sidebar #mainNavigation .nav-primary.nav-pill-on {
    position: relative;
  }

  #mainNavigation .nav-glide {
    position: absolute;
    z-index: 0;
    top: 0;
    left: 0;
    border-radius: 10px;
    background: var(--cs-nav-pill-tint);
    box-shadow: inset 0 0 0 1px var(--cs-nav-pill-ring);
    pointer-events: none;
  }

  #mainNavigation .nav-glide[hidden] {
    display: none;
  }

  #mainNavigation .nav-glide.nav-pill--animate {
    transition:
      transform 320ms cubic-bezier(.34, 1.25, .64, 1),
      width 220ms ease,
      height 220ms ease;
  }

  #mainNavigation .nav-glide-bar {
    position: absolute;
    left: 0;
    top: 8px;
    bottom: 8px;
    width: 3px;
    border-radius: 3px;
    background: var(--cs-nav-pill-accent);
  }

  /* Icons-only rail: the pill is a square around the icon; no side bar. */
  body[data-nav-collapsed="true"] #mainNavigation .nav-glide-bar {
    display: none;
  }

  /* Items sit above the pill; the active one drops its own fill and ring. */
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item] {
    position: relative;
    z-index: 1;
  }

  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item][data-active="true"],
  body[data-theme] .sidebar #mainNavigation .nav-pill-on > [data-nav-item][data-active="true"] {
    background: transparent !important;
    border-color: transparent !important;
    box-shadow: none !important;
  }

  /* Colour (no background transition: it left a stuck tint on the moved
     Budget / Recurring buttons). Leaving is immediate; arriving lights up as
     the pill lands. */
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item],
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item] .nav-item-icon {
    transition: color 150ms ease-out;
  }

  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item][data-active="true"],
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item][data-active="true"] .nav-item-icon {
    transition-delay: 120ms;
  }

  /* Hover on other items: a faint tint only, never the selection look. */
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item]:not([data-active="true"]):not([aria-expanded="true"]):hover {
    background: rgba(255, 255, 255, .04);
    box-shadow: none;
  }

  #mainNavigation .nav-pill-on .nav-item-icon.is-glide-pop {
    animation: cs-nav-glide-pop 300ms cubic-bezier(.34, 1.56, .64, 1) 120ms both;
  }

  /* Keyboard focus: its own ring, separate from the pill. */
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item]:focus-visible {
    outline: 2px solid var(--cs-nav-pill-accent);
    outline-offset: 2px;
  }
}

@keyframes cs-nav-glide-pop {
  from { transform: scale(.85); }
  to { transform: scale(1); }
}

@media (prefers-reduced-motion: reduce) {
  #mainNavigation .nav-glide.nav-pill--animate {
    transition: none;
  }

  #mainNavigation .nav-pill-on .nav-item-icon.is-glide-pop {
    animation: none;
  }

  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item],
  body .sidebar #mainNavigation .nav-pill-on > [data-nav-item] .nav-item-icon {
    transition: none !important;
  }
}
