/* TRAPARY final candidate: shared chrome + gallery behavior adapted from index2 reference.
   All storefront product gallery rules are intentionally scoped to product detail. */
:root { --trapary-announcement-height:31px; }
.announcement {
  position:sticky; top:0; z-index:41;
  height:var(--trapary-announcement-height); min-height:var(--trapary-announcement-height);
  display:flex; justify-content:space-between; align-items:center;
  padding:0 max(36px,calc((100vw - var(--wide))/2));
  gap:18px; background:#171717; color:#fff;
  font:700 12px/1.3 var(--sans); letter-spacing:.02em;
  white-space:nowrap;
}
.announcement span { display:block; min-width:0; }
.site-header { position:sticky; top:var(--trapary-announcement-height); z-index:40; }
/* The journal and shop must not drift when one of them changes its typography. */
.blog-main { min-width:0; }
.blog-main .blog-breadcrumb { margin-bottom:20px; }

/* Native horizontal, scroll-snapping gallery: arrow buttons and thumbnail strip
   all point to the same current index. Touch swiping works without custom JS. */
.product-page .detail-main-image {
  position:relative; overflow:hidden; cursor:default;
  background:#f1f0ed; contain:layout paint;
}
.product-page .detail-gallery-track {
  position:absolute; inset:0; width:100%; height:100%;
  display:flex; overflow-x:auto; overflow-y:hidden;
  scroll-snap-type:x mandatory; overscroll-behavior-x:contain;
  scroll-behavior:smooth; scrollbar-width:none;
  touch-action:pan-x pan-y;
}
.product-page .detail-gallery-track::-webkit-scrollbar{display:none}
.product-page .detail-gallery-slide {
  flex:0 0 100%; position:relative; display:block;
  height:100%; min-width:0; padding:0; border:0;
  scroll-snap-align:start; scroll-snap-stop:always;
  overflow:hidden; background:#f1f0ed; cursor:zoom-in;
}
.product-page .detail-gallery-slide img {
  display:block; width:100%; height:100%; object-fit:cover;
  pointer-events:none; user-select:none;
}
.product-page .detail-gallery-arrow {
  position:absolute; z-index:5; top:50%; transform:translateY(-50%);
  display:grid;place-items:center;
  width:44px;height:44px;min-width:44px;min-height:44px;
  padding:0; border:1px solid #e5e5e5; border-radius:0;
  background:#fff; color:#161616;
  transition:background-color .2s ease,color .2s ease,border-color .2s ease;
}
.product-page .detail-gallery-arrow svg { display:block; width:19px;height:19px;stroke-width:2; }
.product-page .detail-gallery-arrow:hover,
.product-page .detail-gallery-arrow:focus-visible {
  background:#151515; color:#fff; border-color:#151515;
}
.product-page .detail-gallery-prev{left:12px}
.product-page .detail-gallery-next{right:12px}
.product-page .detail-gallery-arrow[hidden]{display:none!important}
.product-page .detail-gallery-counter{
  position:absolute;z-index:6;right:12px;bottom:12px;
  padding:6px 10px;min-width:48px;text-align:center;
  background:#fff;color:#111;font:800 12px/1.1 var(--sans);
  pointer-events:none;white-space:nowrap;
}
.product-page .detail-thumbs .thumb {
  cursor:pointer; position:relative; overflow:hidden;
  opacity:.63; transition:opacity .2s ease,border-color .2s ease;
}
.product-page .detail-thumbs .thumb.active,
.product-page .detail-thumbs .thumb:hover { opacity:1; border-color:#161616; }
.product-page .detail-thumbs .thumb img{display:block;width:100%;height:100%;object-fit:cover;pointer-events:none}
.product-page .detail-main-image .item-badge,
.product-page .detail-main-image .outofstock-badge{pointer-events:none}

/* The reference's immersive black fullscreen viewer. Click on image to zoom
   into the clicked coordinate; close/arrow/keyboard/swipe return to same image. */
.gallery-reference.gallery-dialog {
  position:fixed;inset:0; margin:0; padding:0;
  width:100vw; max-width:none;height:100dvh;max-height:none;
  border:0; background:#090909; color:#fff;
  overflow:hidden;
}
.gallery-reference.gallery-dialog::backdrop{background:#000}
.gallery-reference .gallery-stage {
  position:relative;display:block;
  width:100%;height:calc(100dvh - 100px);
  min-height:0;max-height:none;
  padding:0;margin:0;overflow:hidden;
  background:#080808;
}
.gallery-reference .gallery-lightbox-viewport {
  position:absolute;inset:0;display:grid;place-items:center;
  width:100%;height:100%;overflow:hidden;
}
.gallery-reference #gallery-full-image {
  display:block!important;
  width:100%!important;height:100%!important;
  max-width:100%!important;max-height:100%!important;
  min-width:0!important;min-height:0!important;
  object-fit:contain!important; cursor:zoom-in;
  transition:transform .22s ease;
  transform:scale(1);touch-action:pan-y;
}
.gallery-reference #gallery-full-image.is-zoomed{transform:scale(2.2);cursor:zoom-out}
.gallery-reference .gallery-control {
  position:absolute!important;z-index:10;
  display:grid!important;place-items:center!important;
  box-sizing:border-box!important;
  width:48px!important;height:48px!important;
  min-width:48px!important;min-height:48px!important;
  max-width:48px!important;max-height:48px!important;
  margin:0!important;padding:0!important;
  border:1px solid transparent!important;border-radius:0!important;
  background:rgba(17,17,17,.48)!important;color:#fff!important;
  cursor:pointer; transition:background .2s ease;
}
.gallery-reference .gallery-control:hover,
.gallery-reference .gallery-control:focus-visible {background:#fff!important;color:#111!important;}
.gallery-reference .gallery-control>span{display:grid;place-items:center;width:100%;height:100%;}
.gallery-reference .gallery-control svg{display:block!important;width:22px!important;height:22px!important;stroke-width:1.9!important;}
.gallery-reference .gallery-previous{left:clamp(12px,2.2vw,32px);top:50%;transform:translateY(-50%)}
.gallery-reference .gallery-next{right:clamp(12px,2.2vw,32px);top:50%;transform:translateY(-50%)}
.gallery-reference .gallery-close{right:clamp(12px,2.2vw,32px);top:clamp(12px,2vw,24px)}
.gallery-reference .gallery-control[hidden]{display:none!important}
.gallery-reference .gallery-modal-counter {
  position:absolute;z-index:10;bottom:15px;left:50%;transform:translateX(-50%);
  padding:6px 11px; font-size:12px;font-weight:700;line-height:1.2;color:#f7f7f7;
  background:rgba(0,0,0,.43);white-space:nowrap;pointer-events:none;
}
.gallery-reference .gallery-thumbs {
  position:relative;z-index:11;
  display:flex;align-items:center;justify-content:center;gap:8px;
  height:100px;min-height:100px;max-height:100px;
  padding:8px 12px; margin:0;
  overflow-x:auto;overflow-y:hidden;
  background:#101010;border-top:1px solid #272727;
}
.gallery-reference .lightbox-thumb{
  display:block;flex:0 0 58px;width:58px;height:78px;
  margin:0;padding:0;background:#222;
  border:2px solid transparent;border-radius:0;
  opacity:.56;cursor:pointer;transition:opacity .2s,border-color .2s;
}
.gallery-reference .lightbox-thumb.active,
.gallery-reference .lightbox-thumb:hover{opacity:1;border-color:#fff}
.gallery-reference .lightbox-thumb img{width:100%;height:100%;object-fit:cover}
@media(max-width:700px){
  .announcement {padding:0 14px;justify-content:center;font-size:12px;gap:10px;}
  /* Older shop CSS hides first and last span, so override all three explicitly. */
  .announcement span:first-child{display:block}
  .announcement span:nth-child(2),.announcement span:nth-child(3){display:none}
  .product-page .detail-gallery-prev{left:9px}
  .product-page .detail-gallery-next{right:9px}
  .product-page .detail-gallery-arrow{width:42px;height:42px;min-width:42px;min-height:42px}
  .gallery-reference .gallery-stage{height:calc(100dvh - 88px)}
  .gallery-reference .gallery-thumbs{height:88px;min-height:88px;max-height:88px;justify-content:flex-start}
  .gallery-reference .lightbox-thumb{flex-basis:48px;width:48px;height:66px}
  .gallery-reference .gallery-control{width:44px!important;height:44px!important;min-width:44px!important;min-height:44px!important;max-width:44px!important;max-height:44px!important}
}
@media(prefers-reduced-motion:reduce){
  .product-page .detail-gallery-track{scroll-behavior:auto}
  .gallery-reference #gallery-full-image{transition:none}
  .product-page .detail-gallery-arrow{transition:none}
}

/* Release: article images always fit completely, regardless of original orientation. */
.journal-article figure.journal-article-image {
  width:100%;max-width:100%;height:auto;aspect-ratio:auto;
  overflow:visible;margin:0 auto 34px;
  display:flex;align-items:center;justify-content:center;background:transparent;
}
.journal-article figure.journal-article-image img {
  display:block;width:auto;max-width:100%;height:auto;
  max-height:min(85vh,960px);object-fit:contain;object-position:center;
}
@media(max-width:600px){
  .journal-article figure.journal-article-image {height:auto;aspect-ratio:auto;margin-bottom:26px;}
  .journal-article figure.journal-article-image img {height:auto;max-height:85svh;object-fit:contain;}
}
