/**
 * tnm-loop.css
 * assets/css/tnm-loop.css
 *
 * Product archive / loop — design tokens + layout helpers.
 * Mirrors tnm-single.css tokens so archive matches single product.
 */


/* ─── Loading skeletons — shown while a filter/sort/scroll fetch is in
 * flight, in place of a bare spinner. Shape matches the real card for
 * whichever density is active (JS picks the variant class):
 *   --grid  (default) media + eyebrow + name + price, like the real
 *           Grid/Wide-mobile card
 *   --dense media + a single price-only line, like the stripped-down
 *           Dense card
 *   --wide  image-left/text-right split at lg+, matching the real Wide
 *           split card; stacks like --grid below lg
 * ──────────────────────────────────────────────────────────── */
.skeleton-card {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding-bottom: 4px;
}
.skeleton-media {
  aspect-ratio: 1 / 1;
  width: 100%;
}
.skeleton-line {
  height: 12px;
}
.skeleton-shimmer {
  background: linear-gradient(90deg, var(--p-line) 25%, #f3f2f7 37%, var(--p-line) 63%);
  background-size: 400% 100%;
  animation: opc-shimmer 1.4s ease infinite;
}
@keyframes opc-shimmer {
  0%   { background-position: 100% 50%; }
  100% { background-position: 0 50%; }
}
@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer { animation: none; }
}

.skeleton-card--dense .skeleton-line {
  height: 9px;
}

.skeleton-card--wide .skeleton-card__body {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
@media (min-width: 1024px) {
  .skeleton-card--wide {
    flex-direction: row;
    align-items: stretch;
    gap: 14px;
  }
  .skeleton-card--wide .skeleton-media {
    flex: 1;
    aspect-ratio: auto;
  }
  .skeleton-card--wide .skeleton-card__body {
    flex: 1;
    justify-content: center;
  }
}

/* ─── Wishlist icon toggling ────────────────────────────────── */
.my-wishlist-overlay .icon-solid  { display: none; }
.my-wishlist-overlay .icon-light  { display: inline-flex; }
.my-wishlist-overlay.is-solid .icon-solid { display: inline-flex; }
.my-wishlist-overlay.is-solid .icon-light { display: none; }
.my-yith-holder { position: absolute; opacity: 0; pointer-events: none; }

/* ─── Editorial Rail — shop control selectors ──────────────────
 * Underline-nav category tabs, dot-toggle flags/attrs, word-toggle
 * layout switch, borderless serif sort. Matches font-display /
 * font-mono / --p-ink /--p-primary language used site-wide.
 * ──────────────────────────────────────────────────────────── */

/* Category tabs (shop page) + subcategory rail (category page) */
.shop-tab,
.opc-subcat {
  font-family: var(--font-display);
  font-size: 17px;
  color: var(--p-inkMut);
  background: transparent !important;
  border: none !important;
  padding: 0 0 10px !important;
  position: relative;
  cursor: pointer;
  transition: color .15s;
}
.shop-tab:hover,
.opc-subcat:hover {
  color: var(--p-ink);
}
.shop-tab.active,
.opc-subcat.selected {
  color: var(--p-ink) !important;
}
/* Underline: full + solid on active, faint preview on hover of an inactive tab */
.shop-tab::after,
.opc-subcat::after {
  content: '';
  position: absolute;
  left: 0; right: 0; bottom: -1px;
  height: 2px;
  background: var(--p-primary);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity .15s, transform .15s;
}
.shop-tab:hover::after,
.opc-subcat:hover::after {
  opacity: .35;
  transform: scaleX(1);
}
.shop-tab.active::after,
.opc-subcat.selected::after {
  opacity: 1;
  transform: scaleX(1);
}
.shop-tab span,
.opc-subcat .opc-subcat-count {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--p-inkMut);
  vertical-align: super;
  margin-left: 3px;
  text-transform: none !important;
}
#shop-category-tabs .flex-wrap,
#shop-category-tabs .flex { gap: 28px !important; border-bottom: 1px solid var(--p-line); }

/* Availability flags + attribute rows — dot toggle, no checkbox square.
 * Hover/active feedback matches the rest of the page: an underline
 * reveal (same pattern as .shop-tab/.opc-subcat), not a background
 * fill — sitting right on the row's own separator line. */
.opc-flag,
.opc-attr-checkbox {
  position: relative;
  border-bottom: 1px solid var(--p-line) !important;
  margin: 0 !important;
  border-radius: 0 !important;
  transition: color .15s;
}
.opc-flag::after,
.opc-attr-checkbox::after {
  content: '';
  position: absolute;
  left: 12px; right: 12px; bottom: -1px;
  height: 2px;
  background: var(--p-primary);
  opacity: 0;
  transform: scaleX(0);
  transform-origin: left;
  transition: opacity .15s, transform .15s;
}
.opc-flag:hover::after,
.opc-attr-checkbox:hover::after {
  opacity: .35;
  transform: scaleX(1);
}
.opc-flag.selected::after,
.opc-attr-checkbox.selected::after {
  opacity: 1;
  transform: scaleX(1);
}
.opc-flag .filter-check,
.opc-attr-checkbox .filter-check {
  width: 6px !important;
  height: 6px !important;
  border-radius: 50%;
  border: 1.5px solid var(--p-inkMut) !important;
  background: transparent !important;
}
.opc-flag.selected .filter-check,
.opc-attr-checkbox.selected .filter-check {
  background: var(--p-primary) !important;
  border-color: var(--p-primary) !important;
}
.opc-flag:hover span,
.opc-attr-checkbox:hover span,
.opc-flag.selected span,
.opc-attr-checkbox.selected span {
  color: var(--p-ink);
}

/* Layout switch — word toggle, underline active */
.btn-layout {
  width: auto !important;
  height: auto !important;
  padding: 4px 0 !important;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: .05em;
  color: var(--p-inkMut) !important;
  background: transparent !important;
}
.btn-layout.active,
.btn-layout[data-layout].active {
  color: var(--p-ink) !important;
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--p-primary);
  text-decoration-thickness: 2px;
}
.btn-layout svg { display: none; }
.btn-layout { white-space: nowrap; }

/* Sort — borderless, serif, bottom rule only */
#opc-sort {
  border: none !important;
  border-bottom: 1px solid var(--p-ink) !important;
  background: transparent !important;
  font-family: var(--font-display) !important;
  font-size: 16px !important;
  padding-left: 0 !important;
}

/* ─── Filter pills + popovers — replaces the old sidebar/drawer. Each
 * pill sits in a .opc-filter-group with its .opc-panel as a sibling;
 * the panel anchors directly under its own pill (position:absolute),
 * so no JS positioning math is needed. ──────────────────────────── */
.opc-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--p-inkMut);
  background: transparent;
  border: none;
  border-bottom: 1px solid var(--p-ink);
  padding: 8px 1px;
  cursor: pointer;
  transition: color .15s;
}
.opc-pill:hover,
.opc-pill.open,
.opc-pill.has-value {
  color: var(--p-ink);
}
.opc-pill .car {
  font-size: 8px;
  transition: transform .15s;
}
.opc-pill.open .car {
  transform: rotate(180deg);
}
.opc-panel {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 50;
  min-width: 230px;
  background: var(--p-surface);
  border: 1px solid var(--p-ink);
  padding: 16px;
}
/* Price panel needs more room than the default 230px — two side-by-side
 * number inputs were cramped enough that a 5-digit value overflowed. */
.opc-filter-group[data-kind="price"] .opc-panel {
  min-width: 280px;
}
/* Hide native number-input spinner arrows in Chrome/Safari — they were
 * eating ~20px of an already-narrow input, clipping typed digits.
 * (Firefox's own spinner was already hidden via the inline
 * -moz-appearance:textfield style on these inputs.) */
#filter-price-min::-webkit-outer-spin-button,
#filter-price-min::-webkit-inner-spin-button,
#filter-price-max::-webkit-outer-spin-button,
#filter-price-max::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
/* Per-filter Clear, inside each panel's own header — alongside (not
 * instead of) the toolbar-level Clear that resets everything at once. */
.opc-panel-clear {
  font-family: var(--font-mono);
  font-size: 9px;
  letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--p-inkMut);
  background: none;
  border: none;
  text-decoration: underline;
  cursor: pointer;
  white-space: nowrap;
}
.opc-panel-clear:hover {
  color: var(--p-ink);
}
@media (max-width: 640px) {
  .opc-panel {
    position: fixed;
    left: 1rem;
    right: 1rem;
    top: auto;
    bottom: 1rem;
    max-height: 70vh;
    overflow-y: auto;
    z-index: 70;
    min-width: 0;
  }
}

/* ─── WooCommerce price HTML overrides ──────────────────────── */
.card-price del { opacity: 0.45; font-size: 0.75rem; }
.card-price ins { text-decoration: none; }
.card-price .woocommerce-Price-amount { font-family: inherit; }

/* ─── Product grid — column count per density, per viewport tier ────
 * Explicit target counts on desktop (Wide 2 / Grid 3 / Dense 5), with
 * lower tiers at narrower viewports so no density ever feels congested
 * on a phone. Text itself is sized via container queries below (not
 * these breakpoints) so it scales to the card's real rendered width
 * regardless of which tier is active — nothing truncates.
 * ──────────────────────────────────────────────────────────── */
#product-grid {
  display: grid !important;
  grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
  /* No card border/shadow any more (flat, editorial — matches the mega
   * menu / shop tabs / sort select) — gap alone separates cards, so it
   * needs to be generous enough to read as separation, not crowding. */
  gap: 40px 24px !important;
}
#product-grid[data-density="4-col"] {
  gap: 32px 18px !important;
}

/* Wide — stacked single column on phones, 2-up above; the image/text
 * split layout only kicks in at lg (see .product-card rules below). */
#product-grid[data-density="2-col"] {
  grid-template-columns: 1fr !important;
}
@media (min-width: 640px) {
  #product-grid[data-density="2-col"] { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
}

/* Grid — target 3 columns at desktop */
@media (min-width: 768px) {
  #product-grid[data-density="3-col"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}

/* Dense — target 5 columns at desktop, ramping up through the tiers
 * below it so it never jumps straight from 2 to 5. */
@media (min-width: 640px) {
  #product-grid[data-density="4-col"] { grid-template-columns: repeat(3, minmax(0, 1fr)) !important; }
}
@media (min-width: 768px) {
  #product-grid[data-density="4-col"] { grid-template-columns: repeat(4, minmax(0, 1fr)) !important; }
}
@media (min-width: 1024px) {
  #product-grid[data-density="4-col"] { grid-template-columns: repeat(5, minmax(0, 1fr)) !important; }
}

/* ─── Card content scales with density — each is a genuinely
 * different card, not just a shrunk one:
 *   Wide (2-col)   — everything, and shown in FULL: eyebrow, name
 *                     (no clamp — wraps as many lines as it needs),
 *                     full description, price, actions. Laid out
 *                     image-left/text-right at lg+. This is the
 *                     showcase density — most generous type scale.
 *   Grid (3-col)   — drops the description; name clamps to 2 lines
 *   Dense (4-col)  — name + price only; no eyebrow, no wishlist/cart
 *                     buttons (the card's own full-bleed link is the
 *                     click target instead); name clamps to 1 line
 * ──────────────────────────────────────────────────────────── */
.card-desc { display: block; }
.product-card .card-body h3 {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
  overflow: hidden;
}
#product-grid[data-density="4-col"] .product-card .card-body h3 {
  -webkit-line-clamp: 1;
}
#product-grid[data-density="2-col"] .product-card .card-body h3 {
  -webkit-line-clamp: unset;
  overflow: visible;
}

#product-grid[data-density="3-col"] .product-card .card-desc,
#product-grid[data-density="4-col"] .product-card .card-desc {
  display: none;
}
#product-grid[data-density="4-col"] .product-card .tromboo-eyebrow {
  display: none !important;
}
/* .card-wish / .add_to_cart_button carry Tailwind CDN's `!`-prefixed
 * utilities (e.g. `!grid`), which the CDN's JIT compiler injects inside
 * a CSS cascade layer — a layered !important rule always beats an
 * unlayered !important rule regardless of selector specificity, so
 * `display: none !important` here can never win that fight. Collapse
 * via visibility/size instead — nothing else contests those. */
#product-grid[data-density="4-col"] .product-card .card-wish,
#product-grid[data-density="4-col"] .product-card .add_to_cart_button {
  visibility: hidden !important;
  position: absolute !important;
  width: 0 !important;
  height: 0 !important;
  padding: 0 !important;
  margin: 0 !important;
  overflow: hidden !important;
  pointer-events: none !important;
}

/* Wide, desktop only — image-left / text-right split card instead of
 * stacked. Markup order is unchanged (.card-media then .card-body);
 * grid auto-placement alone turns them into two side-by-side columns. */
@media (min-width: 1024px) {
  #product-grid[data-density="2-col"] .product-card {
    display: grid;
    grid-template-columns: 1fr 1fr;
    column-gap: clamp(1.5rem, 3cqi, 3rem);
  }
  /* .card-media keeps its default aspect-square (Tailwind class in the
   * template) — that square sets the row height; text column stretches
   * to match and centers its content within it. */
  #product-grid[data-density="2-col"] .product-card .card-body {
    display: flex;
    flex-direction: column;
    justify-content: center;
  }
}

/* ─── Fluid card typography — container queries, not viewport
 * breakpoints, so title/price scale to the card's OWN rendered width.
 * A Dense card and a narrow-viewport Grid card that happen to land at
 * the same pixel width get the same text size; nothing is tied to a
 * fixed density tier, and nothing needs `.truncate` to avoid overflow.
 * Wide gets its own, larger ceiling — it's the showcase density, with
 * a whole half-card of width to spend on type. ─────────────────────── */
.product-card { container-type: inline-size; }
.product-card .card-body h3 {
  font-size: clamp(13px, 6.5cqi, 22px) !important;
  line-height: 1.2 !important;
}
.product-card .card-price {
  font-size: clamp(12px, 5.5cqi, 20px) !important;
}
.product-card .tromboo-eyebrow {
  font-size: clamp(8px, 3cqi, 10px);
}
.product-card .card-body {
  padding: clamp(0.5rem, 4cqi, 1.25rem) !important;
}
.product-card .card-desc {
  font-size: clamp(12px, 3cqi, 15px);
}
@media (min-width: 1024px) {
  #product-grid[data-density="2-col"] .product-card .card-body h3 {
    font-size: clamp(20px, 3.2cqi, 32px) !important;
    line-height: 1.15 !important;
  }
  #product-grid[data-density="2-col"] .product-card .card-price {
    font-size: clamp(16px, 2.6cqi, 24px) !important;
  }
  #product-grid[data-density="2-col"] .product-card .card-desc {
    font-size: clamp(13px, 1.8cqi, 16px);
  }
  #product-grid[data-density="2-col"] .product-card .card-body {
    padding: clamp(1rem, 3cqi, 2.5rem) !important;
  }
}
