/* ==========================================================================
   TMB Product Archives (3.6.0)
   File: assets/css/tmb-archive.css — shop, product categories, tags, brands,
   product search. Loaded by inc/archive.php on those pages only.
   Product cards (.co-prod-*) and pagination keep their styles from
   tmb-universal-styling.css; this file adds the hero, sub-category chips,
   filter bar, related sections and empty state.
   ========================================================================== */

.tmb-arc{ background:var(--tmb-color-bg); padding-bottom:var(--tmb-space-8, 64px); }
.tmb-arc__body{ display:grid; gap:var(--tmb-space-5); padding-top:var(--tmb-space-5); }

/* Header ----------------------------------------------------------------- */
.tmb-arc-hero{ position:relative; padding:clamp(14px, 2vw, 20px) 0 clamp(16px, 2.4vw, 24px); background:var(--tmb-color-surface); }
.tmb-arc-hero__inner{ display:grid; gap:clamp(8px, 1.2vw, 12px); }
.tmb-arc-crumbs ol{ display:flex; flex-wrap:wrap; gap:4px; margin:0; padding:0; list-style:none; font-size:var(--tmb-fs-xs); color:var(--tmb-color-text-subtle); }
.tmb-arc-crumbs li + li::before{ content:"/"; margin-right:4px; opacity:.6; }
.tmb-arc-crumbs a{ color:var(--tmb-color-text-muted); text-decoration:none; }
.tmb-arc-crumbs a:hover{ color:var(--tmb-color-primary); text-decoration:underline; }
.tmb-arc-hero__body{ display:flex; align-items:center; gap:var(--tmb-space-4); }
.tmb-arc-hero__copy{ display:grid; gap:6px; min-width:0; max-width:820px; }
.tmb-arc-hero__heading{ display:flex; flex-wrap:wrap; align-items:baseline; gap:6px 12px; }
.tmb-arc-hero__title{ margin:0; font-family:var(--tmb-font-heading); font-size:clamp(1.6rem, 1.15rem + 1.6vw, 2.4rem); line-height:1.08; letter-spacing:-.03em; color:var(--tmb-color-primary); text-wrap:balance; }
.tmb-arc-hero__page{ color:var(--tmb-color-text-subtle); font-size:.55em; font-weight:600; letter-spacing:0; }
.tmb-arc-hero__count{ flex:none; padding:2px 10px; border-radius:999px; background:var(--tmb-color-primary-soft); color:var(--tmb-color-primary); font-size:var(--tmb-fs-xs); font-weight:800; white-space:nowrap; }
.tmb-arc-hero__intro{ margin:0; color:var(--tmb-color-text-muted); font-size:var(--tmb-fs-sm); line-height:1.55; display:-webkit-box; -webkit-line-clamp:2; -webkit-box-orient:vertical; overflow:hidden; }
.tmb-arc-hero__more{ appearance:none; display:inline; margin-left:4px; padding:0; border:0; background:none; color:var(--tmb-color-primary); font:inherit; font-weight:700; text-decoration:underline; text-underline-offset:3px; cursor:pointer; }
.tmb-arc-hero__logo{ flex:none; display:grid; place-items:center; width:clamp(64px, 8vw, 96px); aspect-ratio:1; padding:10px; border-radius:var(--tmb-radius-md); background:#fff; box-shadow:var(--tmb-shadow-sm); }
.tmb-arc-hero__logo img{ max-width:100%; max-height:100%; width:auto; height:auto; object-fit:contain; }

/* Brand header: banner with a readable shade */
.tmb-arc-hero--brand{ padding:clamp(16px, 2.4vw, 24px) 0 clamp(24px, 3.5vw, 40px); background:var(--tmb-color-primary); color:var(--tmb-color-on-primary); overflow:hidden; isolation:isolate; }
.tmb-arc-hero--brand.has-banner::before{ content:""; position:absolute; inset:0; z-index:-2; background:var(--tmb-arc-banner) center/cover no-repeat; }
.tmb-arc-hero--brand::after{ content:""; position:absolute; inset:0; z-index:-1; background:linear-gradient(90deg, rgba(8,20,29,.88) 0%, rgba(8,20,29,.72) 50%, rgba(8,20,29,.4) 100%); }
.tmb-arc-hero--brand .tmb-arc-hero__title, .tmb-arc-hero--brand .tmb-arc-hero__more{ color:#fff; }
.tmb-arc-hero--brand .tmb-arc-hero__intro, .tmb-arc-hero--brand .tmb-arc-crumbs, .tmb-arc-hero--brand .tmb-arc-crumbs a{ color:rgba(255,255,255,.82); }
.tmb-arc-hero--brand .tmb-arc-hero__count{ background:rgba(255,255,255,.16); color:#fff; }
.tmb-arc-story{ padding:var(--tmb-space-5) 0; background:var(--tmb-color-surface); border-top:1px solid var(--tmb-color-border); }
.tmb-arc-story .tmb-prose{ max-width:860px; }

/* Sticky filter bar ------------------------------------------------------- */
.tmb-arc-bar{ position:sticky; top:calc(var(--tmb-header-height, 0px) - 1px); z-index:30; padding:10px 0; background:color-mix(in srgb, var(--tmb-color-surface) 94%, transparent); border-top:1px solid var(--tmb-color-border); border-bottom:1px solid var(--tmb-color-border); backdrop-filter:saturate(1.2) blur(10px); transition:box-shadow var(--tmb-motion-fast) ease; }
.tmb-arc-bar.is-stuck{ box-shadow:0 8px 24px rgba(15,23,42,.08); }
.tmb-arc-toolbar{ display:block; }
.tmb-arc__body{ display:grid; gap:var(--tmb-space-4); padding-top:var(--tmb-space-4); }
.tmb-arc-toolbar__count{ color:var(--tmb-color-text-subtle); font-size:var(--tmb-fs-xs); font-weight:600; margin-bottom:-4px; }
.tmb-arc-toolbar__count p{ margin:0; }

.tmb-filters{ display:grid; gap:8px; margin:0; float:none; }
.tmb-filters.is-loading{ opacity:.6; pointer-events:none; }
.tmb-filters__bar{ display:flex; align-items:center; gap:8px; }
.tmb-filters__field{ display:grid; gap:4px; min-width:0; margin:0; }
.tmb-filters__label{ color:var(--tmb-color-text-subtle); font-size:var(--tmb-fs-2xs); font-weight:800; letter-spacing:var(--tmb-tracking-caps); text-transform:uppercase; }
.tmb-filters__select{ width:100%; min-height:42px; font-size:var(--tmb-fs-sm); }
.tmb-filters__select.is-set{ border-color:var(--tmb-color-primary); box-shadow:inset 0 0 0 1px var(--tmb-color-primary); font-weight:700; }
.tmb-filters__toggle{ appearance:none; flex:none; display:inline-flex; align-items:center; gap:8px; min-height:42px; padding:0 16px; border:1px solid var(--tmb-color-border-strong); border-radius:var(--tmb-radius-pill, 999px); background:var(--tmb-color-surface); color:var(--tmb-color-text); font:inherit; font-size:var(--tmb-fs-sm); font-weight:700; cursor:pointer; }
.tmb-filters__toggle[aria-expanded="true"]{ border-color:var(--tmb-color-primary); color:var(--tmb-color-primary); }
.tmb-filters__count{ display:grid; place-items:center; min-width:20px; height:20px; padding:0 6px; border-radius:999px; background:var(--tmb-color-primary); color:var(--tmb-color-on-primary); font-size:11px; }
.tmb-filters__active{ display:flex; flex-wrap:wrap; align-items:center; gap:6px; }
.tmb-filters__chip{ display:inline-flex; align-items:center; gap:6px; min-height:30px; padding:0 10px 0 12px; border-radius:999px; background:var(--tmb-color-primary); color:var(--tmb-color-on-primary); font-size:var(--tmb-fs-xs); font-weight:700; text-decoration:none; }
.tmb-filters__chip:hover{ background:var(--tmb-color-primary-strong); color:var(--tmb-color-on-primary); text-decoration:none; }
.tmb-filters__clear{ padding:0 4px; color:var(--tmb-color-text-muted); font-size:var(--tmb-fs-xs); font-weight:700; }
.tmb-filters__sheet-head, .tmb-filters__sheet-foot, .tmb-filters__scrim{ display:none; }

/* Phones & tablets: Filters button + Sort in the bar; filters in a bottom sheet */
@media (max-width:899px){
  /* No backdrop-filter here: it would make the bar the containing block for the fixed sheet. */
  .tmb-arc-bar{ padding:8px 0; background:var(--tmb-color-surface); backdrop-filter:none; }
  .tmb-filters__field--sort{ flex:1 1 auto; }
  .tmb-filters__field--sort .tmb-filters__label{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
  .tmb-filters__panel{ position:fixed; left:0; right:0; bottom:0; z-index:2147483647; display:grid; gap:14px; max-height:min(82vh, 640px); padding:0 16px calc(16px + env(safe-area-inset-bottom, 0px)); overflow-y:auto; border-radius:20px 20px 0 0; background:var(--tmb-color-surface); box-shadow:0 -20px 50px rgba(15,23,42,.25); transform:translateY(105%); visibility:hidden; transition:transform 260ms var(--tmb-ease-out, ease), visibility 0s linear 260ms; }
  .tmb-filters__panel.is-open{ transform:none; visibility:visible; transition:transform 260ms var(--tmb-ease-out, ease); }
  .tmb-filters__sheet-head{ position:sticky; top:0; z-index:1; display:flex; align-items:center; justify-content:space-between; padding:16px 0 8px; background:var(--tmb-color-surface); font-size:var(--tmb-fs-lg); }
  .tmb-filters__sheet-head::before{ content:""; position:absolute; top:6px; left:50%; width:40px; height:4px; margin-left:-20px; border-radius:4px; background:var(--tmb-color-border-strong); }
  .tmb-filters__close{ appearance:none; display:grid; place-items:center; width:40px; height:40px; border:0; border-radius:50%; background:var(--tmb-color-surface-muted); color:var(--tmb-color-text); cursor:pointer; }
  .tmb-filters__panel .tmb-filters__select{ min-height:48px; font-size:16px; }
  .tmb-filters__sheet-foot{ position:sticky; bottom:calc(-16px - env(safe-area-inset-bottom, 0px)); display:flex; align-items:center; justify-content:space-between; gap:12px; margin:4px -16px 0; padding:12px 16px calc(12px + env(safe-area-inset-bottom, 0px)); border-top:1px solid var(--tmb-color-border); background:var(--tmb-color-surface); }
  .tmb-filters__sheet-clear{ color:var(--tmb-color-text-muted); font-weight:700; }
  .tmb-filters__apply{ flex:1; max-width:240px; justify-content:center; }
  .tmb-filters__scrim:not([hidden]){ display:block; position:fixed; inset:0; z-index:2147483646; background:rgba(15,23,42,.45); }
  html.tmb-sheet-open, html.tmb-sheet-open body{ overflow:hidden; }
  /* The app's bottom tab bar would sit over the sheet's buttons; step it aside while the sheet is open. */
  html.tmb-sheet-open .tmb-footer.tmb-thumb-tray, html.tmb-sheet-open .tmb-thumb-tray{ visibility:hidden; }
  .tmb-filters__active{ flex-wrap:nowrap; overflow-x:auto; scrollbar-width:none; margin:0 -16px; padding:0 16px; }
  .tmb-filters__active::-webkit-scrollbar{ display:none; }
  .tmb-filters__chip, .tmb-filters__clear{ flex:none; }
}

/* Desktop: one row, no labels */
@media (min-width:900px){
  .tmb-filters__toggle{ display:none; }
  .tmb-filters__panel{ display:flex; flex:1 1 auto; gap:8px; min-width:0; }
  .tmb-filters__field{ flex:1 1 0; max-width:230px; }
  .tmb-filters__field--sort{ flex:0 1 220px; margin-left:auto; }
  .tmb-filters__label{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap; }
}
@media (prefers-reduced-motion:reduce){ .tmb-filters__panel, .tmb-filters__panel.is-open{ transition:none; } }

/* Product cards: additions ---------------------------------------------- */
.tmb-price-from{ color:var(--tmb-color-text-subtle); font-size:.82em; font-weight:600; }
/* Sale/New badge: .tmb-product-loop-badge pins left and .co-prod-badge pins right, which
   stretched the badge across the image and hid the brand/category badge. Keep it top-right. */
.co-prod-media .co-prod-badge{ left:auto; right:10px; width:auto; padding:5px 10px; font-size:.72rem; font-weight:800; letter-spacing:.04em; text-transform:uppercase; }
.co-prod-badge--new{ background:var(--tmb-color-accent) !important; border-color:var(--tmb-color-accent) !important; color:var(--tmb-color-on-accent) !important; }
.co-prod-facts{ display:flex; flex-wrap:wrap; gap:4px 10px; margin:2px 0 0; font-size:var(--tmb-fs-2xs); }
.co-prod-sku{ color:var(--tmb-color-text-subtle); font-weight:700; letter-spacing:.03em; font-family:ui-monospace, SFMono-Regular, Menlo, monospace; }
.co-prod-stocked{ display:inline-flex; align-items:center; gap:4px; color:var(--tmb-color-success); font-weight:700; }
.co-prod-stocked::before{ content:""; width:6px; height:6px; border-radius:50%; background:currentColor; }

/* Related: brands in a category, a brand's categories -------------------- */
.tmb-arc-related{ display:grid; gap:var(--tmb-space-3); margin-top:var(--tmb-space-4); }
.tmb-arc-related h2, .tmb-arc-about h2{ margin:0; font-family:var(--tmb-font-heading); font-size:var(--tmb-fs-xl, 1.4rem); letter-spacing:-.02em; color:var(--tmb-color-primary); }
.tmb-arc-brands{ display:grid; grid-template-columns:repeat(auto-fill, minmax(150px, 1fr)); gap:var(--tmb-space-2); margin:0; padding:0; list-style:none; }
.tmb-arc-brand{ display:grid; justify-items:center; align-content:center; gap:6px; min-height:110px; padding:var(--tmb-space-3); border:1px solid var(--tmb-color-border); border-radius:var(--tmb-radius-md); background:var(--tmb-color-surface); color:var(--tmb-color-text); text-align:center; text-decoration:none; transition:border-color var(--tmb-motion-fast) ease, box-shadow var(--tmb-motion-fast) ease; }
.tmb-arc-brand:hover{ border-color:var(--tmb-color-primary); box-shadow:var(--tmb-shadow-sm); text-decoration:none; }
.tmb-arc-brand img{ max-width:110px; max-height:48px; width:auto; height:auto; object-fit:contain; }
.tmb-arc-brand strong{ color:var(--tmb-color-primary); }
.tmb-arc-brand small{ color:var(--tmb-color-text-subtle); font-size:var(--tmb-fs-2xs); font-weight:700; }
.tmb-arc-chips{ display:flex; flex-wrap:wrap; gap:8px; margin:0; padding:0; list-style:none; }
.tmb-arc-chip{ display:inline-flex; align-items:center; gap:8px; min-height:40px; padding:0 14px; border:1px solid var(--tmb-color-border); border-radius:999px; background:var(--tmb-color-surface); color:var(--tmb-color-text); font-size:var(--tmb-fs-sm); font-weight:700; text-decoration:none; }
.tmb-arc-chip:hover{ border-color:var(--tmb-color-primary); text-decoration:none; }
.tmb-arc-chip small{ color:var(--tmb-color-text-subtle); font-size:var(--tmb-fs-2xs); }
.tmb-arc-about{ display:grid; gap:var(--tmb-space-3); margin-top:var(--tmb-space-4); padding:var(--tmb-space-5); border:1px solid var(--tmb-color-border); border-radius:var(--tmb-radius-lg); background:var(--tmb-color-surface); }
.tmb-arc-about .tmb-prose{ max-width:860px; color:var(--tmb-color-text-muted); }

/* Empty state ------------------------------------------------------------- */
.tmb-arc-empty{ display:grid; justify-items:center; gap:var(--tmb-space-3); padding:clamp(32px, 6vw, 72px) var(--tmb-space-4); border:1px dashed var(--tmb-color-border-strong); border-radius:var(--tmb-radius-lg); background:var(--tmb-color-surface); text-align:center; }
.tmb-arc-empty h2{ margin:0; font-size:var(--tmb-fs-xl, 1.4rem); color:var(--tmb-color-primary); }
.tmb-arc-empty p{ margin:0; max-width:52ch; color:var(--tmb-color-text-muted); }
.tmb-arc-empty__search{ width:min(100%, 520px); }
.tmb-arc-empty__links{ display:flex; flex-wrap:wrap; justify-content:center; gap:8px; margin:var(--tmb-space-2) 0 0; padding:0; list-style:none; }
.tmb-arc-empty__links a{ display:inline-flex; min-height:40px; align-items:center; padding:0 16px; border-radius:999px; background:var(--tmb-color-primary-soft); color:var(--tmb-color-primary); font-weight:700; text-decoration:none; }

@media (max-width:599px){
  .tmb-arc-hero__body{ align-items:flex-start; }
  .tmb-arc-hero--brand .tmb-arc-hero__body{ flex-direction:column; }
  .tmb-arc-brands{ grid-template-columns:repeat(2, minmax(0, 1fr)); }
}
@media (prefers-reduced-motion:reduce){ .tmb-arc-subcat, .tmb-arc-brand{ transition:none; } }
