/* =====================================================================
   WCI 1.9.0 – scroll smoothness (always on) + theme bridge (scoped)
   Loaded AFTER style.css / wci-ux-2026.css / wci-original-layouts.css
   ===================================================================== */

/* ---------- A. Scroll smoothness ------------------------------------ */

/* A1. The filter sidebar is sticky by CSS only (no JS fixed/absolute switching any more). */
@media (min-width: 901px){
  html body .wci-album-wrap .wci-album-sidebar,
  html body .wci-album-box .wci-album-sidebar,
  html body .wci-showroom-box .wci-album-sidebar{
    position: sticky !important;
    top: var(--wci-sticky-top, 96px) !important;
    align-self: start !important;
    height: fit-content;
    z-index: 3;
    transform: none !important;
  }
  /* the inner box must not be a second sticky layer */
  html body .wci-album-box .wci-album-sidebar .wci-filter-menu-details,
  html body .wci-showroom-box .wci-album-sidebar .wci-filter-menu-details{
    position: relative !important;
    top: auto !important;
  }
  html body .wci-album-sidebar .wci-filter-menu-body{
    max-height: calc(100vh - var(--wci-sticky-top, 96px) - 72px);
    max-height: calc(100dvh - var(--wci-sticky-top, 96px) - 72px);
    overflow: auto;
    overscroll-behavior: contain;
  }
}
@media (max-width: 900px){
  html body .wci-album-wrap .wci-album-sidebar,
  html body .wci-album-box .wci-album-sidebar{ position: static !important; top: auto !important; }
}
/* legacy classes from the old JS (cached scripts) can no longer move the sidebar */
html body .wci-album-sidebar.wci-is-fixed,
html body .wci-album-sidebar.wci-is-bottom{ position: sticky !important; right: auto !important; left: auto !important; width: auto !important; bottom: auto !important; }
.wci-sidebar-placeholder{ display: none !important; }
/* pagination is now made of real links */
html body .wci-pagination a.page-numbers{ text-decoration: none !important; }

/* A2. position:sticky only works when no ancestor is a scroll container -> clip instead of hidden. */
html body .wci-album-outer,
html body .wci-album-box,
html body .wci-album-wrap,
html body .wci-showroom-box{
  overflow: visible !important;
  overflow: clip !important;
}

/* A3. Nothing in the scrolling area may force a compositing/blur re-paint on every frame. */
html body .wci-album-outer :is(.wci-card,.wci-item,.wci-thumb,.wci-body,.wci-album-sidebar,.wci-filter-menu-details,.wci-filter-menu-body,.wci-pagination,.wci-pagination .page-numbers,.wci-back-to-filters,.wci-filter){
  -webkit-backdrop-filter: none !important;
  backdrop-filter: none !important;
  will-change: auto !important;
}

/* A4. Anchors stay below the sticky header (thumbnails already carry width/height, so their space is reserved). */
html body .wci-album-outer .wci-item,
html body .wci-album-outer .wci-empty{ scroll-margin-top: calc(var(--wci-sticky-top, 96px) + 8px); }
html body .wci-album-outer{ overflow-anchor: auto; }

/* A5. While the next page is loading, keep the box height (no collapse -> no page jump). */
html body .wci-album-wrap.wci-loading .wci-album-main{ min-height: 40vh; }

/* A6. Respect reduced motion. */
@media (prefers-reduced-motion: reduce){
  html body .wci-album-outer,
  html body .wci-album-outer *,
  html body .wci-album-outer *::before,
  html body .wci-album-outer *::after{
    scroll-behavior: auto !important;
    transition-duration: .01ms !important;
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* ---------- B. Theme bridge (body.wci-bridge-on = setting is not "off") */

/* B1. Typography follows the theme. */
html body.wci-bridge-on .wci-album-outer :is(a,div,p,span,button,summary,nav,li,strong,small,label,input,select){
  font-family: inherit;
}

/* B2. Theme content-link styles (underline/colour) must not leak into cards and pagination. */
html body.wci-bridge-on .wci-album-outer :is(a.wci-card,a.wci-filter,a.page-numbers,.wci-card *){
  text-decoration: none !important;
}

/* B3. Accessible focus ring in the theme's primary colour. */
html body.wci-bridge-on .wci-album-outer :is(a,button,summary,input,select):focus-visible{
  outline: 2px solid var(--wci-t-primary, #2563eb);
  outline-offset: 2px;
}

/* B4. Spacing around the block follows the theme rhythm. */
html body.wci-bridge-on .wci-album-outer{
  margin-block: var(--wci-t-gap, 1.6em);
  max-width: 100%;
  box-sizing: border-box;
}

/* B5. Full harmony: theme primary colour, radius and lines. */
@supports (color: color-mix(in srgb, red, blue)){
  html body.wci-bridge-full .wci-album-outer,
  html body.wci-bridge-full .wci-album-box,
  html body.wci-bridge-full .wci-album-wrap{
    --wci-theme-main: var(--wci-t-primary) !important;
    --wci-theme-dark: color-mix(in srgb, var(--wci-t-primary) 72%, #000) !important;
    --wci-theme-light: color-mix(in srgb, var(--wci-t-primary) 70%, #fff) !important;
    --wci-theme-soft: color-mix(in srgb, var(--wci-t-primary) 10%, transparent) !important;
    --wci-theme-border: color-mix(in srgb, var(--wci-t-primary) 30%, transparent) !important;
    --wci-theme-shadow: color-mix(in srgb, var(--wci-t-primary) 18%, transparent) !important;
    --wci-theme-contrast: var(--wci-t-on-primary) !important;
  }
}
html body.wci-bridge-full .wci-album-box .wci-card{ border-radius: var(--wci-t-radius, 14px) !important; }
html body.wci-bridge-full .wci-album-box .wci-filter-menu-details{
  border-radius: var(--wci-t-radius-lg, 18px) !important;
  border-color: var(--wci-t-line, rgba(15,23,42,.14)) !important;
}
html body.wci-bridge-full .wci-album-box .wci-pagination .page-numbers{ border-radius: 999px !important; }
