/* Persistent route shell */
#content-inner {
  position: relative;
  isolation: isolate;
}

#route-state {
  display: none !important;
}

#route-content {
  min-width: 0;
}

#route-content > :first-child {
  width: 100%;
}

/* Keep non-article cards opaque and inexpensive to composite. */
#body-wrap.page #route-content:not(.nc),
#body-wrap.page #aside-content .card-widget,
#body-wrap.page #recent-posts .recent-post-item {
  background: var(--card-bg);
  -webkit-backdrop-filter: none;
  backdrop-filter: none;
}

/* Article covers remain available elsewhere, while the global background
   shows through the article header. */
#page-header.post-bg {
  background-color: transparent !important;
  background-image: none !important;
}

#page-header.post-bg::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: linear-gradient(
    180deg,
    rgba(6, 14, 11, .04) 0%,
    rgba(6, 14, 11, .68) 42%,
    rgba(6, 14, 11, .80) 100%
  ) !important;
  content: '';
  pointer-events: none;
}

#page-header.post-bg #post-info {
  z-index: 1;
}

#page-header.post-bg .post-title {
  color: #fff;
  font-weight: 700;
  letter-spacing: .01em;
  text-shadow: 0 1px 2px rgba(0, 0, 0, .92),
    0 4px 18px rgba(0, 0, 0, .68);
}

#page-header.post-bg #post-meta,
#page-header.post-bg #post-meta a {
  color: rgba(255, 255, 255, .88);
  text-shadow: 0 1px 3px rgba(0, 0, 0, .62);
}

/* Active route feedback for the persistent desktop and mobile menus. */
#nav .site-page.is-active::after {
  width: 100%;
}

#sidebar-menus .site-page.is-active {
  color: var(--theme-color, var(--btn-bg));
}

/* A slim progress cue covers network latency without masking the page. */
html::after {
  position: fixed;
  top: 0;
  left: 0;
  z-index: 10000;
  width: 100%;
  height: 2px;
  border-radius: 0 999px 999px 0;
  background: var(--btn-bg);
  box-shadow: 0 0 10px rgba(47, 106, 83, .28);
  content: '';
  opacity: 0;
  transform-origin: left center;
  transform: scaleX(0);
  pointer-events: none;
}

html.is-route-loading::after {
  opacity: 1;
  animation: route-progress 1.2s cubic-bezier(.32, .72, 0, 1) both;
}

html.is-route-complete::after {
  opacity: 0;
  transform: scaleX(1);
  transition: opacity .16s ease .08s, transform .2s cubic-bezier(.32, .72, 0, 1);
}

@keyframes route-progress {
  from {
    opacity: .35;
    transform: scaleX(.08);
  }

  55% {
    opacity: .9;
    transform: scaleX(.72);
  }

  to {
    opacity: 1;
    transform: scaleX(.76);
  }
}

/* Let the mobile drawer clear the viewport before the incoming route fades
   in. Direct menu dismissals keep the normal spring duration. */
@media screen and (max-width: 768px) {
  html.is-route-loading #sidebar-menus {
    transition-duration: .16s;
  }

  html.is-route-loading #menu-mask {
    transition-duration: .12s;
  }
}

/* Respect the operating system accessibility preference across legacy theme
   effects as well as the new route transitions. */
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto !important;
  }

  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    transition-delay: 0ms !important;
  }
}
