/* KICKSTW reskin: the header comes back when the page is scrolled up (site_prototype/DESIGN.md in
   kickstw_stock, the header rule; 21 Nov). Loaded only while the 'sticky' switch lets the visitor
   see it; every selector starts with body.kt-sticky, the class the plugin adds on those requests
   (class-sticky.php). assets/js/header.js adds kt-hdr-up to <body> while the header is back and
   keeps four lengths on <html>: --kt-head-h (the announcement and the bar), --kt-ticker-h (the
   announcement), --kt-bar-h (what is left in view) and --kt-admin (WordPress's admin bar while it
   is fixed, else 0). Without the script nothing here shows: the fallbacks keep the header where
   it was.

   Away is "stuck one whole header above the window", so it is the page's own scroll that takes
   the header away, as before; back moves the sticking point down to the announcement's height,
   which leaves the bar in view. */
body.kt-sticky #kt-header.kt-chrome { position: sticky; top: calc(var(--kt-admin, 0px) - var(--kt-head-h, 400px)); transition: top 0.2s ease; }
body.kt-sticky.kt-hdr-up #kt-header.kt-chrome { top: calc(var(--kt-admin, 0px) - var(--kt-ticker-h, 37px)); }

/* While the header is back, whatever else sticks to the top of the window moves down under it;
   while it is away each piece sticks where its own stylesheet put it. */

/* The product list's filter rail (facets.css: sticky from 721px, 16px under the top). */
@media (min-width: 721px) {
  body.kt-sticky.kt-skin-listing main.kt-list .kt-list__body > .kt-list__filter { transition: top 0.2s ease; }
  body.kt-sticky.kt-hdr-up.kt-skin-listing main.kt-list .kt-list__body > .kt-list__filter { top: calc(16px + var(--kt-bar-h, 89px) + var(--kt-admin, 0px)); }
}
/* The product list's Filter bar on a phone (facets.css: sticky at the top, 720px and under). */
@media (max-width: 720px) {
  body.kt-sticky.kt-skin-listing main.kt-list .kt-facets__bar { transition: top 0.2s ease; }
  body.kt-sticky.kt-hdr-up.kt-skin-listing main.kt-list .kt-facets__bar { top: calc(var(--kt-bar-h, 60px) + var(--kt-admin, 0px)); }
}
/* The product page's pinned column, when it fits the window (product.js marks it .is-fit and has
   the admin bar in --kt-pin already). A column taller than the window is held by its last line
   and stays where it is. */
@media (min-width: 1025px) {
  body.kt-sticky.kt-skin-product #content div.product.is-pinned .kt-product__gallery.is-fit,
  body.kt-sticky.kt-skin-product #content div.product.is-pinned div.kt-product__side.is-fit { transition: top 0.2s ease; }
  body.kt-sticky.kt-hdr-up.kt-skin-product #content div.product.is-pinned .kt-product__gallery.is-fit,
  body.kt-sticky.kt-hdr-up.kt-skin-product #content div.product.is-pinned div.kt-product__side.is-fit { top: calc(var(--kt-pin, 24px) + var(--kt-bar-h, 89px)); }
}

@media (prefers-reduced-motion: reduce) {
  body.kt-sticky #kt-header.kt-chrome,
  body.kt-sticky.kt-skin-listing main.kt-list .kt-list__body > .kt-list__filter,
  body.kt-sticky.kt-skin-listing main.kt-list .kt-facets__bar,
  body.kt-sticky.kt-skin-product #content div.product.is-pinned .kt-product__gallery.is-fit,
  body.kt-sticky.kt-skin-product #content div.product.is-pinned div.kt-product__side.is-fit { transition: none; }
}
