/**
 * Shared 2.0 "world" grid — the reference product-grid + filter-sidebar + blog
 * shell used by the category landing pages Apparel (page-mercantile.php),
 * Self-Care (page-apothecary.php), and Daily Essentials
 * (page-daily-essentials.php). Ported verbatim from the reference designs.
 *
 * Everything is scoped under `.ts-world` (added to each page's root wrapper)
 * so these bare reference class names never collide with the older `.merc-*`
 * shell in mercantile.css (still used by Travel) or the blog-archive rules.
 *
 * Per-page accents are driven by three custom properties set on the page
 * wrapper (see each page's own stylesheet):
 *   --wg-cat          product-category eyebrow colour
 *   --wg-accent       hover accent (clear button, dept toggle, blog links)
 *   --wg-search-focus search-field focus border colour
 *
 * Uses the theme's own JS state classes (.is-collapsed / .collapsed / .is-open
 * / .is-active) so the existing mercantile.js / apothecary.js filter behaviour
 * keeps driving the sidebar unchanged.
 */

/* ── LAYOUT ── */
.ts-world .merch-grid-section { background: var(--white); padding: 48px 10% 64px; }
.ts-world .merch-grid-inner {
  max-width: 100%;
  margin: 0;
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 48px;
  align-items: start;
}

/* ── SIDEBAR SHELL ── */
.ts-world .merch-sidebar {
  background: var(--white);
  border: none;
  border-radius: 0;
  overflow: hidden;
  position: sticky;
  top: 120px;
}
.ts-world .sidebar-heading {
  font-family: 'Inter', sans-serif;
  font-size: 26px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.05em;
  line-height: 1.2;
  padding: 22px 20px 18px;
  border-bottom: 1px solid var(--border);
}
.ts-world .sidebar-heading em { font-style: italic; color: var(--wg-cat, var(--terra)); }
.ts-world .sidebar-search { padding: 18px 20px; border-bottom: 1px solid var(--border); margin: 0; }
.ts-world .sidebar-search-wrap {
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 9px 16px;
  transition: border-color 0.2s;
}
.ts-world .sidebar-search-wrap:focus-within { border-color: var(--wg-search-focus, var(--gold)); }
.ts-world .sidebar-search-icon { color: var(--stone); flex-shrink: 0; font-size: 15px; }
.ts-world .sidebar-search-input {
  border: none;
  background: transparent;
  font-family: var(--ff-body);
  font-size: 12px;
  color: var(--charcoal);
  width: 100%;
  outline: none;
}
.ts-world .sidebar-search-input::placeholder { color: var(--dust); }

/* ── FILTER GROUPS ── */
.ts-world .sidebar-filter-group { border-bottom: 1px solid var(--border); }
.ts-world .sidebar-filter-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 20px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--charcoal);
  cursor: pointer;
  user-select: none;
}
.ts-world .sidebar-chevron { color: var(--ink); transition: transform 0.2s; flex-shrink: 0; font-size: 14px; }
.ts-world .sidebar-filter-group.is-collapsed .sidebar-chevron { transform: rotate(-90deg); }
.ts-world .sidebar-filter-group.is-collapsed .sidebar-filter-body { display: none; }
.ts-world .sidebar-filter-body { padding: 4px 20px 16px; display: flex; flex-direction: column; gap: 10px; }
.ts-world .sidebar-check {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  transition: color 0.15s;
  margin: 0;
}
.ts-world .sidebar-check:hover { color: #000; font-weight: 700; }
.ts-world .sidebar-check input[type="checkbox"],
.ts-world .sidebar-check input[type="radio"] {
  accent-color: var(--charcoal);
  width: 14px;
  height: 14px;
  flex-shrink: 0;
  cursor: pointer;
  margin: 0;
}
.ts-world .star-row { display: flex; align-items: center; gap: 6px; color: var(--gold); font-size: 13px; }
.ts-world .star-row em { font-style: normal; color: var(--ink); font-size: 11px; }
.ts-world .sidebar-clear-btn {
  display: block;
  width: 100%;
  padding: 14px 20px;
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  text-align: center;
  background: none;
  border: none;
  cursor: pointer;
  transition: color 0.15s;
}
.ts-world .sidebar-clear-btn:hover { color: var(--wg-accent, var(--terra)); }

/* ── NESTED DEPARTMENT / COLLECTION LIST ── */
.ts-world .dept-all { padding: 10px 0 10px 20px; border-bottom: 1px solid var(--border); }
.ts-world .dept-all.is-active span { color: var(--charcoal); font-weight: 700; }
.ts-world .dept-group { border-bottom: 1px solid rgba(216, 212, 206, 0.6); }
.ts-world .dept-group:last-child { border-bottom: none; }
.ts-world .dept-header { display: flex; align-items: center; justify-content: space-between; padding-right: 12px; }
.ts-world .dept-row { flex: 1; padding: 10px 0 10px 20px; font-size: 13px; font-weight: 500; }
.ts-world .dept-toggle {
  background: none;
  border: none;
  color: var(--ink);
  cursor: pointer;
  padding: 4px;
  display: flex;
  align-items: center;
  transition: color 0.15s, transform 0.2s;
  flex-shrink: 0;
  font-size: 14px;
}
.ts-world .dept-toggle:hover { color: var(--wg-accent, var(--terra)); }
.ts-world .dept-toggle.is-open i { transform: rotate(180deg); }
.ts-world .dept-collections {
  padding: 0 12px 10px 36px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  overflow: hidden;
  max-height: 300px;
  transition: max-height 0.25s var(--ease-out), opacity 0.2s, padding 0.2s;
  opacity: 1;
}
.ts-world .dept-collections.collapsed { max-height: 0; opacity: 0; padding-bottom: 0; }
.ts-world .collection-row { font-size: 12px; color: var(--charcoal); font-weight: 400; }

/* ── GRID CONTENT ── */
.ts-world .merch-grid-content { min-width: 0; position: relative; }
/* Result-count header hidden for now (the 2.0 reference shows no count line). */
.ts-world .merch-grid-header {
  display: none;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 24px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--border);
}
.ts-world .merch-grid-count { font-size: 13px; color: var(--stone); }
.ts-world .merch-grid-count strong { color: var(--charcoal); }
.ts-world .merch-grid-body { transition: opacity 0.2s var(--ease-out); }
.ts-world .merch-grid-body[aria-busy="true"] { opacity: 0.45; pointer-events: none; }
.ts-world .dept-row-label {
  display: flex;
  align-items: baseline;
  gap: 24px;
  font-family: 'Inter', sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.05em;
  margin: 40px 0 16px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
/* Each department row is its own .category-section, so :first-child would resolve
 * per-section and zero out EVERY label's top margin (the exact bug the 2.1 redline
 * calls out). Scope the reset to the first section, and space subsequent ones by
 * the sibling combinator instead of an inline style. */
.ts-world .category-section:first-child .dept-row-label { margin-top: 0; }
.ts-world .category-section + .category-section .dept-row-label { margin-top: 56px; }

/* Quick-filter links inside a department label. Text links, not chips. */
.ts-world .dept-tab-links { display: flex; gap: 16px; font-size: 13px; font-weight: 400; letter-spacing: 0.02em; }
.ts-world .dept-tab-links a { color: var(--ink); text-decoration: underline; text-underline-offset: 3px; transition: color 0.2s; }
.ts-world .dept-tab-links a:hover { color: var(--mascot); }

.ts-world .merch-product-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 24px; }

/* ── PRODUCT CARD (.merch-product-card) ── */
.ts-world .merch-product-card {
  background: var(--white);
  border: 1px solid var(--border);
  border-radius: var(--radius-card);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  transition: transform 0.3s var(--ease-out), box-shadow 0.3s var(--ease-out);
}
.ts-world .merch-product-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); }
.ts-world .merch-product-img { aspect-ratio: 1/1; position: relative; overflow: hidden; }
.ts-world .merch-product-img-link { display: block; width: 100%; height: 100%; }
/* Gallery hover-swap: fade the product's 2nd image in over the featured one. */
.ts-world .merch-product-img-hover {
  position: absolute;
  inset: 0;
  opacity: 0;
  transition: opacity 0.45s var(--ease-out);
}
.ts-world .merch-product-card:hover .merch-product-img-hover { opacity: 1; }
/* Fade the main image out too, so a see-through (PNG) hover picture replaces
   it instead of sitting on top of it (#374). */
.ts-world .merch-product-img-link:has(.merch-product-img-hover) > img:not(.merch-product-img-hover) { transition: opacity 0.45s var(--ease-out); }
.ts-world .merch-product-card:hover .merch-product-img-link:has(.merch-product-img-hover) > img:not(.merch-product-img-hover) { opacity: 0; }
.ts-world .merch-product-overlay {
  position: absolute;
  inset: 0;
  background: rgba(28, 26, 24, 0);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.3s var(--ease-out);
}
.ts-world .merch-product-card:hover .merch-product-overlay { background: rgba(28, 26, 24, 0.28); }
.ts-world .merch-product-overlay span {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--charcoal);
  background: #fff;
  padding: 9px 22px;
  opacity: 0;
  transform: translateY(8px);
  transition: all 0.3s var(--ease-out);
}
.ts-world .merch-product-card:hover .merch-product-overlay span { opacity: 1; transform: translateY(0); }
.ts-world .merch-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  z-index: 3;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 4px 10px;
  border-radius: 4px;
}
.ts-world .merch-badge.new { background: var(--sage); color: #fff; }
.ts-world .merch-badge.bestseller { background: var(--gold); color: #fff; }
.ts-world .merch-badge.sale { background: var(--terra); color: #fff; }
/* Reused shared wishlist button, repositioned to the card corner. */
.ts-world .merch-product-img .shop-product-wishlist {
  position: absolute;
  top: 10px;
  right: 12px;
  z-index: 3;
}
.ts-world .merch-product-body { padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 4px; }
.ts-world .merch-product-cat {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--wg-cat, var(--terra));
}
.ts-world .merch-product-name {
  font-family: 'Inter', sans-serif;
  font-size: 16px;
  font-weight: 700;
  color: var(--charcoal);
  line-height: 1.2;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 2.4em;
}
.ts-world .merch-product-footer { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-top: auto; }
.ts-world .merch-product-price { font-size: 15px; font-weight: 600; color: var(--charcoal); }
.ts-world .merch-product-price del { color: var(--dust); font-weight: 400; margin-right: 4px; }
.ts-world .merch-product-price ins { text-decoration: none; }
.ts-world .merch-add-btn {
  font-family: var(--ff-body);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 6px 14px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.2s var(--ease-out);
}
.ts-world .merch-add-btn:hover { background: var(--charcoal); color: #fff; border-color: var(--charcoal); }

/* ── BLOG SECTION (.blog-section) ── */
.ts-world .blog-section {
  background: var(--white);
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 96px 40px;
}
.ts-world .blog-inner { max-width: 1260px; margin: 0 auto; }
.ts-world .blog-header {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  margin-bottom: 56px;
  padding-bottom: 40px;
  border-bottom: 1px solid var(--border);
  gap: 24px;
}
.ts-world .blog-eyebrow {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--ink);
  margin-bottom: 12px;
}
.ts-world .blog-title {
  font-family: 'Inter', sans-serif;
  font-size: 32px;
  font-weight: 700;
  color: var(--charcoal);
  letter-spacing: -0.05em;
  line-height: 1.1;
}
.ts-world .blog-title em { font-style: italic; color: var(--charcoal); }
.ts-world .blog-browse {
  font-size: 13px;
  font-weight: 600;
  color: var(--charcoal);
  text-decoration: underline;
  text-underline-offset: 4px;
  transition: color 0.15s;
  white-space: nowrap;
  margin-bottom: 10px;
}
.ts-world .blog-browse:hover { color: var(--wg-accent, var(--terra)); }
.ts-world .blog-grid { display: grid; grid-template-columns: 1fr 1.4fr; gap: 32px; align-items: stretch; }

.ts-world .blog-featured {
  display: flex;
  flex-direction: column;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out);
  height: 100%;
}
.ts-world .blog-featured:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.ts-world .blog-featured-img {
  width: 100%;
  flex: 1;
  min-height: 200px;
  position: relative;
  overflow: hidden;
  border-top: 3px solid var(--terra);
  border-radius: 0;
}
.ts-world .blog-featured-body { padding: 28px 28px 32px; display: flex; flex-direction: column; gap: 10px; background: #F8F8F8; }
.ts-world .blog-featured-title {
  font-family: 'Inter', sans-serif;
  font-size: 24px;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--charcoal);
  line-height: 1.3;
}
.ts-world .blog-featured-excerpt { font-size: 14px; color: var(--charcoal); line-height: 1.75; }

.ts-world .blog-side { display: flex; flex-direction: column; gap: 24px; }
.ts-world .blog-card {
  display: grid;
  grid-template-columns: 240px 1fr;
  text-decoration: none;
  color: inherit;
  border-radius: 12px;
  overflow: hidden;
  background: var(--white);
  box-shadow: var(--shadow-sm);
  transition: box-shadow 0.3s var(--ease-out), transform 0.3s var(--ease-out);
}
.ts-world .blog-card:hover { box-shadow: var(--shadow-lg); transform: translateY(-3px); }
.ts-world .blog-card-img { width: 100%; height: 100%; min-height: 160px; position: relative; overflow: hidden; }
.ts-world .blog-card-body { padding: 20px 22px; display: flex; flex-direction: column; gap: 8px; justify-content: center; background: #F8F8F8; }
.ts-world .blog-card-title {
  font-family: 'Inter', sans-serif;
  font-size: 17px;
  font-weight: 700;
  letter-spacing: -0.05em;
  color: var(--charcoal);
  line-height: 1.35;
}
.ts-world .blog-meta { font-size: 11px; font-weight: 500; letter-spacing: 0.06em; color: var(--charcoal); text-transform: uppercase; }
.ts-world .blog-featured-tag,
.ts-world .blog-card-tag {
  position: absolute;
  top: 14px;
  left: 14px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  background: var(--white);
  color: var(--charcoal);
  padding: 4px 10px;
  border-radius: 4px;
}
.ts-world .blog-read-link {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.06em;
  color: var(--charcoal);
  text-decoration: underline;
  text-underline-offset: 3px;
  transition: color 0.15s;
  margin-top: 4px;
}
.ts-world .blog-featured:hover .blog-read-link,
.ts-world .blog-card:hover .blog-read-link { color: var(--wg-accent, var(--terra)); }

/* ── RESPONSIVE ── */
@media (max-width: 1100px) {
  .ts-world .merch-product-grid { grid-template-columns: repeat(3, 1fr); }
}
@media (max-width: 900px) {
  .ts-world .merch-grid-inner { grid-template-columns: 1fr; }
  .ts-world .merch-sidebar { position: static; }
  .ts-world .merch-product-grid { grid-template-columns: repeat(2, 1fr); }
  .ts-world .blog-grid { grid-template-columns: 1fr; }
  .ts-world .blog-card { grid-template-columns: 130px 1fr; }
}
@media (max-width: 560px) {
  .ts-world .merch-grid-section { padding: 40px 6% 56px; }
  .ts-world .merch-product-grid { grid-template-columns: 1fr; }
  .ts-world .blog-section { padding: 64px 24px; }
  .ts-world .blog-card { grid-template-columns: 1fr; }
  .ts-world .blog-card-img { min-height: 200px; }
  /* Phones: the department heading and its quick-filter links wrap instead of
   * running off the right edge, and the blog header stacks so "Read All … →"
   * drops under the title rather than pushing the page sideways. */
  .ts-world .dept-row-label { flex-wrap: wrap; row-gap: 8px; }
  .ts-world .dept-tab-links { flex-wrap: wrap; gap: 6px 14px; }
  .ts-world .blog-header { flex-direction: column; align-items: flex-start; gap: 14px; margin-bottom: 32px; padding-bottom: 24px; }
  .ts-world .blog-browse { white-space: normal; margin-bottom: 0; }
}
