/* SnowRSPS WO16 — Donate desktop performance / CLS.
   Additive. Does not restyle colours, typography, or the cart.
   Keeps snow-wo11.css and snow-wo12-donate.css untouched.

   Root cause of desktop CLS ~0.52: #mainShopGrid ships all ~76 catalog
   cards in the first HTML payload, then storefront.js hides all but the
   first 15 after DOMContentLoaded. The shop collapses from ~14 000 px
   to ~3 500 px. These rules hide page 2+ before first paint, then
   snow-wo16-donate.js marks the grid ready so "Show more" still works.
*/

/* #shopEmptyState is the first child of #mainShopGrid, then the cards.
   nth-child(n+17) = keep the empty state + first 15 cards, hide the rest
   until Store.filterCards has applied .snow-page-hidden / visible. */
#mainShopGrid:not(.wo16-ready) > .product-card:nth-child(n+17) {
  display: none !important;
}

/* After storefront.js paginates, trust its classes. Revealed cards stay
   flex (same as neon-rgb .product-card); hidden ones stay gone. */
#mainShopGrid.wo16-ready > .product-card:not(.snow-page-hidden) {
  display: flex;
  flex-direction: column;
}
#mainShopGrid.wo16-ready > .product-card.snow-page-hidden {
  display: none !important;
}

/* Reserve the first-page catalog at desktop (3 columns × 5 rows of
   min-height 420 px cards + 22 px gaps). Applied only while the grid
   still has 15 visible children, so a short category page is not left
   with a tall empty hole after JS runs (wo16-ready clears it). */
@media (min-width: 901px) {
  body:not(.snow-mobile) #mainShopGrid:not(.wo16-ready) {
    min-height: 2188px;
  }
  body:not(.snow-mobile) #snowShop .shop-toolbar {
    min-height: 112px;
    box-sizing: border-box;
  }
  body:not(.snow-mobile) #snowShop .featured-row {
    min-height: 480px;
    box-sizing: border-box;
  }
  /* Photo box is already height:300px in neon-rgb; lock the ratio too
     so a late image cannot inflate the card. */
  body:not(.snow-mobile) #snowShop .card-image-box {
    height: 300px !important;
    max-height: 300px !important;
    aspect-ratio: 280 / 300;
    overflow: hidden !important;
    box-sizing: border-box;
  }
  body:not(.snow-mobile) #snowShop .card-image-box img {
    max-width: 92% !important;
    max-height: 92% !important;
    width: auto !important;
    height: auto !important;
    aspect-ratio: 1 / 1;
    object-fit: contain !important;
  }
}

/* Don't let the "Show more" row pop in and shove the FAQ on short
   viewports. The wrap is [hidden] until there are more than 15 matches;
   reserve nothing while hidden, just keep the button box stable after. */
#snowShowMoreWrap:not([hidden]) {
  min-height: 64px;
}

/* Below-fold FAQ / footer logo: no layout jump when the gif arrives. */
img.footer-logo {
  width: 180px;
  height: auto;
  aspect-ratio: 1 / 1;
  max-width: 180px;
}

/* Critical inline CSS used to set padding-top:120px on .main-wrapper, then
   snow-wo4.css applies padding-top:25px !important (nav is sticky, so the
   120px gap is leftover from when the bar was position:fixed). That 95px
   collapse is the remaining desktop CLS on #snowStoreMain (~0.15). Lock it
   early; the visible layout already matches wo4 after CSS arrives. */
body.snow-wo4.wo4-donate .main-wrapper.ui17-wrap,
.main-wrapper.ui17-wrap {
  padding-top: 25px !important;
}


/* snow-wo7.js always does document.documentElement.classList.add('wo7')
   on DOMContentLoaded, even on Donate. That enables:
     html.wo7 body.snow-wo4 > *:not(canvas) { position: relative; z-index: 1 }
   which pulls .skip-link and .top-cart-btn back into document flow and
   shoves #snowStoreMain down ~61 px (the remaining desktop CLS ~0.15).
   Keep those elements out of flow. Visual placement is unchanged. */
html.wo7 body.snow-wo4.wo4-donate > a.skip-link,
body.wo4-donate > a.skip-link {
  position: absolute !important;
  left: -9999px !important;
  top: auto !important;
  width: 1px !important;
  height: 1px !important;
  overflow: hidden !important;
  z-index: 100000;
}
html.wo7 body.snow-wo4.wo4-donate > a.skip-link:focus,
body.wo4-donate > a.skip-link:focus {
  left: 16px !important;
  top: 16px !important;
  width: auto !important;
  height: auto !important;
  padding: 12px 18px !important;
}
html.wo7 body.snow-wo4.wo4-donate > button.top-cart-btn,
body.wo4-donate > button.top-cart-btn {
  position: fixed !important;
  top: 130px;
  right: 18px;
  z-index: 999999;
}
html.wo7 body.snow-wo4.wo4-donate > .northern-lights {
  position: fixed !important;
}
html.wo7 body.snow-wo4.wo4-donate > .cart-modal,
html.wo7 body.snow-wo4.wo4-donate > .modal-overlay,
html.wo7 body.snow-wo4.wo4-donate > .mobile-cart-fab {
  position: fixed !important;
}
