/* =====================================================================
   Product card
   ===================================================================== */
.tm-card { position: relative; display: flex; flex-direction: column; min-width: 0; height: 100%; }
.tm-card__media { position: relative; }
.tm-card__img {
  position: relative; display: block;
  aspect-ratio: 1 / 1; overflow: hidden;
  border-radius: var(--r);
  background: var(--soft);
}
.tm-card__pic {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: contain;
  mix-blend-mode: multiply;
  transition: opacity .25s ease, transform .35s ease;
}
.tm-card__pic--alt { opacity: 0; }
@media (hover: hover) {
  .tm-card:hover .tm-card__pic { transform: scale(1.03); }
  .tm-card:hover .tm-card__pic--alt { opacity: 1; }
  .tm-card:hover .tm-card__img:has(.tm-card__pic--alt) .tm-card__pic:not(.tm-card__pic--alt) { opacity: 0; }
}

.tm-card__wish {
  position: absolute; top: 8px; right: 8px; z-index: 2;
  width: 36px; height: 36px;
  border: 0; border-radius: 50%;
  background: #fff; color: var(--ink);
  display: grid; place-items: center;
  box-shadow: var(--sh-1);
  transition: transform .12s ease, color .15s ease;
}
.tm-card__wish:hover { transform: scale(1.06); }
.js-wish.is-on { color: #c8102e; }
.js-wish.is-on svg { fill: currentColor; }

.tm-card__body { display: flex; flex-direction: column; flex: 1; padding: 10px 2px 0; }
.tm-card__price { font-size: 19px; font-weight: 800; color: var(--ink); line-height: 1.2; }
.tm-card__price del { font-size: 14px; font-weight: 500; color: var(--faint); margin-right: 6px; }
.tm-card__price ins { text-decoration: none; }
.tm-card__title {
  margin-top: 4px;
  font-size: 14.5px; font-weight: 500; line-height: 1.38; color: var(--ink-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
  min-height: 2.76em;
}
.tm-card__title a:hover { text-decoration: underline; text-underline-offset: 2px; }
.tm-card__spec { margin-top: 4px; font-size: 13px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tm-card__eta { display: flex; align-items: center; gap: 6px; margin-top: 6px; font-size: 13px; color: var(--ink-2); }
.tm-card__eta .tm-i { color: var(--muted); }
.tm-card__eta.is-out { color: var(--bad); font-weight: 700; }

.tm-card__add {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  margin-top: 12px; height: 38px; padding: 0 16px;
  border-radius: var(--pill); border: 1.5px solid var(--brand);
  background: #fff; color: var(--brand);
  font-size: 14px; font-weight: 700;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}
.tm-card__add:hover { background: var(--brand); border-color: var(--brand); color: #fff; }
.tm-card__add--view { background: #fff; color: var(--ink); border-color: var(--ink); }
.tm-card__add--view:hover { background: var(--ink); color: #fff; }
.tm-card__add.loading { opacity: .65; pointer-events: none; }
.tm-card__add.loading .tm-i { animation: tm-spin .8s linear infinite; }
.tm-card__add.is-added { background: var(--ok); border-color: var(--ok); color: #fff; }
@keyframes tm-spin { to { transform: rotate(360deg); } }
/* WooCommerce appends a "View cart" link after an AJAX add; the flyout covers it. */
.tm-card a.added_to_cart { display: none; }

/* =====================================================================
   Grid + shelf
   ===================================================================== */
.tm-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(208px, 1fr));
  gap: 30px 20px;
}
@media (max-width: 760px) {
  .tm-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 24px 12px; }
  .tm-card__price { font-size: 17px; }
  .tm-card__title { font-size: 14px; }
  .tm-card__add { height: 36px; font-size: 13.5px; padding: 0 10px; }
  .tm-card__add .tm-i { display: none; }
}

.tm-shelf { position: relative; }
.tm-shelf__track {
  display: grid; grid-auto-flow: column;
  grid-auto-columns: calc((100% - 5 * 20px) / 6);
  gap: 20px;
  overflow-x: auto; overscroll-behavior-x: contain;
  scroll-snap-type: x mandatory;
  scrollbar-width: none;
  padding-bottom: 4px;
}
.tm-shelf__track::-webkit-scrollbar { display: none; }
.tm-shelf__cell { scroll-snap-align: start; min-width: 0; }
.tm-shelf__nav {
  position: absolute; top: calc(50% - 90px); z-index: 3;
  width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 50%;
  background: #fff; color: var(--ink); box-shadow: var(--sh-2);
  display: grid; place-items: center;
  transition: transform .12s ease;
}
.tm-shelf__nav:hover { transform: scale(1.06); }
.tm-shelf__nav[hidden] { display: none; }
.tm-shelf__nav--prev { left: -18px; }
.tm-shelf__nav--next { right: -18px; }
@media (max-width: 1200px) { .tm-shelf__track { grid-auto-columns: calc((100% - 4 * 18px) / 5); gap: 18px; } }
@media (max-width: 1000px) { .tm-shelf__track { grid-auto-columns: calc((100% - 3 * 16px) / 4.2); gap: 16px; } }
@media (max-width: 760px) {
  .tm-shelf { margin-right: calc(var(--gut) * -1); }
  .tm-shelf__track { grid-auto-columns: 42%; gap: 12px; padding-right: var(--gut); scroll-padding-left: 0; }
  .tm-shelf__nav { display: none !important; }
}
