/* KORZH v469 — case route history + collection/favorites reflow hard fix. 2040 only. */

/* Never let a stale measured max-height own catalogue geometry. The grid row is the
   animation, so the document flow always equals the real shelf height after filtering. */
:root[data-visual-style="2040"][data-theme="hub"] .page-cases .collapsible-collection > .collection-fold{
  max-height:none!important;
}

/* Some OSCAR/CHICK PICK rules intentionally use overflow:visible for large art. During
   collapse that must be overridden or the art paints over the next collection. */
:root[data-visual-style="2040"][data-theme="hub"] .page-cases .collapsible-collection.is-collapsed > .collection-fold,
:root[data-visual-style="2040"][data-theme="hub"] .page-cases .collapsible-collection.is-collapsed > .collection-fold > .collection-fold-inner{
  overflow:hidden!important;
}
:root[data-visual-style="2040"][data-theme="hub"] .page-cases .collapsible-collection.is-collapsed > .collection-fold{
  grid-template-rows:0fr!important;
  opacity:0!important;
  pointer-events:none!important;
}
:root[data-visual-style="2040"][data-theme="hub"] .page-cases .collapsible-collection:not(.is-collapsed) > .collection-fold{
  grid-template-rows:1fr!important;
  opacity:1!important;
}

/* Favorite-only mode may temporarily remove whole shelves. Do not preserve intrinsic
   layout placeholders for hidden shelves; on restore they reflow from their real content. */
:root[data-visual-style="2040"][data-theme="hub"] body.k277-favorites-only .page-cases [data-collection-section].k277-empty-favorite-collection{
  display:none!important;
  contain:none!important;
  content-visibility:visible!important;
}

/* Returning from a case/favorites transition must not reuse lazy intrinsic shelf sizes. */
:root[data-visual-style="2040"][data-theme="hub"] .page-cases :is(.hub-showcase-collection,.k221-oscar-section,.k449-chick-pick-section){
  content-visibility:visible!important;
  contain:none!important;
}
