/* Seven books, one continuous row. Native horizontal overflow is the baseline. */
.stanag-viewport-probe { position: fixed; top: 0; left: 0; width: 0; height: 100vh; height: 100svh; visibility: hidden; pointer-events: none; contain: strict; }
.editorial-books.h9-catalog {
  --h9-book-height: clamp(260px, 40vh, 420px);
  padding: 0;
  margin-top: 40px;
  position: relative;
}
.h9-catalog .h9-pin { position: relative; padding: 18px 0 16px; background: var(--paper); }
.h9-catalog .editorial-section-heading { border-top: 0; padding: 0 0 24px; gap: 5%; }
.h9-catalog .editorial-section-heading h2 { font-size: clamp(38px, 4.2vw, 54px); line-height: .98; }
.h9-catalog .editorial-section-heading p { font-size: 18px; line-height: 1.35; margin: 0; }
.h9-viewport {
  position: relative;
  width: 100%;
  overflow-x: auto;
  overflow-y: hidden;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior-x: contain;
  scrollbar-width: thin;
  scrollbar-color: var(--olive, #474c42) transparent;
  border-top: 1px solid var(--black);
  border-bottom: 1px solid var(--line);
  scroll-padding-inline: 12px;
}
.h9-track { position: relative; display: flex; align-items: stretch; width: max-content; min-width: 100%; }
.h9-catalog .h9-track > .book-item {
  --book-height: var(--h9-book-height);
  flex: 0 0 auto;
  width: calc(var(--h9-book-height) * .98 + 72px);
  min-width: 265px;
  padding: 20px 24px 18px;
  border: 0;
  border-right: 1px solid var(--line);
  box-sizing: border-box;
}
.h9-catalog .h9-track > .book-item:last-child { border-right: 0; }
.h9-catalog .h9-track > .h9-set,
.h9-catalog .h9-track > .book-32264 { width: calc(var(--h9-book-height) * 1.65 + 72px); }
.h9-catalog .h9-track > .book-39040 { width: calc(var(--h9-book-height) * 2.3 + 72px); }
.h9-catalog .book-art { height: calc(var(--h9-book-height) + 12px); min-height: 0; max-height: none; }
.h9-catalog .book-art img {
  height: calc(var(--h9-book-height) * var(--cut-h));
  width: calc(var(--h9-book-height) * var(--cut-w));
  bottom: calc(var(--h9-book-height) * var(--cut-bottom));
  transform: translateX(var(--cut-x));
  transition: filter 200ms ease;
}
.h9-catalog .book-info { grid-template-columns: minmax(0, 1fr) auto; gap: 6px 12px; padding-top: 13px; }
.h9-catalog .book-info p { grid-column: 1 / -1; font-size: 15px; }
.h9-catalog .book-info h4 { font-size: clamp(30px, 3.1vw, 44px); }
.h9-catalog .book-buy { font-size: 14px; margin: 0; justify-self: end; }
.h9-catalog .collection-shop { font-size: 15px; line-height: 1.4; padding: 10px 0 0; margin: 0; }
.h9-catalog .collection-shop .text-link { font-size: inherit; }
.h9-progress { height: 2px; background: var(--line); margin-top: 16px; overflow: hidden; }
.h9-progress > span { display: block; width: 100%; height: 100%; background: var(--black); transform: scaleX(var(--h9-progress, 0)); transform-origin: left center; }

/* Height is measured from actual content. Sticky is enabled only when the pin
   fits the viewport; its end releases naturally into the following section. */
.h9-catalog.h9-is-pinned { height: var(--h9-scroll-height); }
.h9-catalog.h9-is-pinned .h9-pin { position: sticky; top: 0; }
.h9-catalog.h9-is-pinned .h9-viewport { overflow: hidden; scrollbar-width: none; }
.h9-catalog.h9-is-pinned .h9-viewport { touch-action: pan-y pinch-zoom; }
.h9-catalog.h9-is-pinned .h9-track { will-change: transform; backface-visibility: hidden; transition: none; }

@media (max-width: 899px) {
  .editorial-books.h9-catalog { margin-top: 30px; }
  .h9-catalog .h9-pin { padding: 10px 0; }
  .h9-catalog .editorial-section-heading { grid-template-columns: 1fr; gap: 12px; padding-bottom: 16px; }
  .h9-catalog .editorial-section-heading h2 { font-size: clamp(36px, 7vw, 50px); }
  .h9-catalog .editorial-section-heading p { font-size: 16px; }
  .h9-catalog .h9-track > .book-item { min-width: 0; width: min(82vw, 360px); padding: 16px 20px 14px; }
  .h9-catalog .h9-track > .h9-set,
  .h9-catalog .h9-track > .book-32264 { width: calc(var(--h9-book-height) * 1.65 + 48px); }
  .h9-catalog .h9-track > .book-39040 { width: calc(var(--h9-book-height) * 2.3 + 48px); }
  .h9-catalog .book-info h4 { font-size: 36px; }
  .h9-catalog .collection-shop { font-size: 14px; }
}
/* This class uses the stable measured viewport, so opening/closing a mobile
   browser bar cannot repeatedly switch the gallery's layout mid-scroll. */
.h9-catalog.h9-is-short .h9-pin { padding: 6px 0; }
.h9-catalog.h9-is-short .editorial-section-heading { grid-template-columns: 1fr 1fr; gap: 16px; padding-bottom: 12px; }
.h9-catalog.h9-is-short .editorial-section-heading h2 { font-size: 30px; }
.h9-catalog.h9-is-short .editorial-section-heading p { font-size: 14px; }
.h9-catalog.h9-is-short .h9-track > .book-item { padding: 10px 14px 12px; }
.h9-catalog.h9-is-short .book-art { height: calc(var(--h9-book-height) + 6px); }
.h9-catalog.h9-is-short .book-info { padding-top: 8px; gap: 4px 10px; }
.h9-catalog.h9-is-short .book-info h4 { font-size: 30px; }
.h9-catalog.h9-is-short .book-info p,
.h9-catalog.h9-is-short .book-buy,
.h9-catalog.h9-is-short .collection-shop { font-size: 13px; }
.h9-catalog.h9-is-short .h9-progress { margin-top: 10px; }
@media (prefers-reduced-motion: reduce) {
  .h9-catalog.h9-is-pinned { height: auto !important; }
  .h9-catalog.h9-is-pinned .h9-pin { position: relative !important; }
  .h9-catalog .h9-viewport { overflow-x: auto !important; }
  .h9-catalog .h9-track { transform: none !important; will-change: auto !important; }
  .h9-catalog .book-art img { transform: translateX(var(--cut-x)) !important; }
}
@media print {
  .h9-catalog.h9-is-pinned { height: auto !important; }
  .h9-catalog .h9-pin { position: relative !important; }
  .h9-catalog .h9-viewport { overflow: visible !important; }
  .h9-catalog .h9-track { width: 100%; flex-wrap: wrap; transform: none !important; }
  .h9-progress { display: none; }
}
