/* TMC product gallery — v1.4.0
   Desktop: controlled-height main stage + vertical thumbnail rail on the right.
   Mobile: thumbnails move below the main image. */
.tmc-product-detail__media .tmc-product-gallery{
  --tmc-gallery-bg:#eee7de;
  --tmc-gallery-paper:#fffefa;
  --tmc-gallery-accent:#861b2a;
  display:grid;
  grid-template-columns:minmax(0,1fr) 86px;
  gap:14px;
  padding:18px;
  background:var(--tmc-gallery-bg);
  box-sizing:border-box;
  min-width:0;
}
.tmc-product-detail__media .tmc-product-gallery__stage{
  position:relative;
  background:var(--tmc-gallery-paper);
  height:clamp(520px,68vh,740px);
  min-width:0;
  display:flex;
  align-items:center;
  justify-content:center;
  overflow:hidden;
}
.tmc-product-detail__media .tmc-product-gallery__main{
  display:block!important;
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:100%!important;
  object-fit:contain!important;
  object-position:center center;
  background:var(--tmc-gallery-paper);
}
.tmc-product-detail__media .tmc-product-gallery__thumbs{
  display:flex;
  flex-direction:column;
  gap:9px;
  overflow-y:auto;
  overflow-x:hidden;
  max-height:clamp(520px,68vh,740px);
  padding:0 3px 0 0;
  scrollbar-width:thin;
  scroll-behavior:smooth;
}
.tmc-product-detail__media .tmc-product-gallery__thumb{
  appearance:none;
  border:1px solid rgba(27,26,24,.18);
  background:#fff;
  padding:0;
  width:74px;
  min-width:74px;
  height:98px;
  min-height:98px;
  cursor:pointer;
  overflow:hidden;
  transition:border-color .2s ease,transform .2s ease,box-shadow .2s ease;
}
.tmc-product-detail__media .tmc-product-gallery__thumb:hover{
  transform:translateY(-1px);
  border-color:rgba(134,27,42,.62);
}
.tmc-product-detail__media .tmc-product-gallery__thumb.is-active{
  border-color:var(--tmc-gallery-accent);
  box-shadow:0 0 0 1px var(--tmc-gallery-accent);
}
.tmc-product-detail__media .tmc-product-gallery__thumb img{
  width:100%!important;
  height:100%!important;
  min-height:0!important;
  max-height:none!important;
  object-fit:cover!important;
  display:block!important;
}
.tmc-product-detail__media .tmc-product-gallery__nav{
  position:absolute;
  top:50%;
  transform:translateY(-50%);
  z-index:3;
  width:44px;
  height:44px;
  border:1px solid rgba(27,26,24,.18);
  border-radius:50%;
  background:rgba(255,254,250,.9);
  color:#1b1a18;
  display:flex;
  align-items:center;
  justify-content:center;
  cursor:pointer;
  font-size:20px;
  line-height:1;
  box-shadow:0 6px 20px rgba(27,26,24,.10);
  transition:background .2s ease,color .2s ease,border-color .2s ease,transform .2s ease;
}
.tmc-product-detail__media .tmc-product-gallery__nav:hover{
  background:var(--tmc-gallery-accent);
  color:#fff;
  border-color:var(--tmc-gallery-accent);
  transform:translateY(-50%) scale(1.04);
}
.tmc-product-detail__media .tmc-product-gallery__nav--prev{left:14px}
.tmc-product-detail__media .tmc-product-gallery__nav--next{right:14px}
.tmc-product-detail__media .tmc-product-gallery__counter{
  position:absolute;
  left:50%;
  bottom:14px;
  transform:translateX(-50%);
  z-index:3;
  padding:7px 11px;
  border-radius:999px;
  background:rgba(27,26,24,.72);
  color:#fff;
  font-size:11px;
  font-weight:700;
  letter-spacing:.08em;
}

/* Slightly shorter on laptop-height screens so product details remain visible. */
@media (max-height:820px) and (min-width:761px){
  .tmc-product-detail__media .tmc-product-gallery__stage,
  .tmc-product-detail__media .tmc-product-gallery__thumbs{height:580px;max-height:580px}
}

@media(max-width:900px){
  .tmc-product-detail__media .tmc-product-gallery{
    grid-template-columns:minmax(0,1fr) 76px;
    gap:10px;
    padding:14px;
  }
  .tmc-product-detail__media .tmc-product-gallery__stage,
  .tmc-product-detail__media .tmc-product-gallery__thumbs{height:620px;max-height:620px}
  .tmc-product-detail__media .tmc-product-gallery__thumb{width:66px;min-width:66px;height:88px;min-height:88px}
}

@media(max-width:680px){
  .tmc-product-detail__media .tmc-product-gallery{
    display:block;
    padding:10px;
  }
  .tmc-product-detail__media .tmc-product-gallery__stage{
    height:min(68vh,620px);
    min-height:430px;
  }
  .tmc-product-detail__media .tmc-product-gallery__thumbs{
    flex-direction:row;
    overflow-x:auto;
    overflow-y:hidden;
    height:auto;
    max-height:none;
    padding:10px 0 2px;
  }
  .tmc-product-detail__media .tmc-product-gallery__thumb{
    width:58px;
    min-width:58px;
    height:78px;
    min-height:78px;
  }
  .tmc-product-detail__media .tmc-product-gallery__nav{width:40px;height:40px}
  .tmc-product-detail__media .tmc-product-gallery__nav--prev{left:10px}
  .tmc-product-detail__media .tmc-product-gallery__nav--next{right:10px}
  .tmc-product-detail__media .tmc-product-gallery__counter{bottom:10px}
}
