/* TS Electrical Trading — Products */

.catalogue-head { padding: clamp(36px, 5vw, 60px) 0 6px; text-align: center; background: var(--panel); }
.catalogue-intro { max-width: 60ch; margin: 12px auto 0; color: var(--muted); font-size: 18px; }

/* Storefront switch
   A sticky bar under the header. Tap anywhere on the switch to change side;
   the coloured thumb slides across (red for the shop, orange for Shopee).
   Once stuck it shrinks smoothly into a slim bar: label on the left, current mode on the right. */
.storefront-bar {
  --ease: cubic-bezier(.3, .7, .2, 1);
  --dur: .38s;
  position: sticky; z-index: 850;
  top: calc(var(--header-h) + var(--admin-offset));
  padding: 14px 0;
  background: rgba(242, 244, 246, .94);
  -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid transparent;
  transition: top var(--dur) var(--ease), padding var(--dur) var(--ease),
              background-color var(--dur) ease, box-shadow var(--dur) ease, border-color var(--dur) ease;
}
.storefront-bar.is-stuck {
  padding: 6px 0;
  background: rgba(255, 255, 255, .96);
  border-bottom-color: var(--line);
  box-shadow: 0 6px 18px rgba(32, 38, 44, .08);
}
/* While browsing, the header slides away and the slim switch bar takes its place */
html.ts-header-tucked .storefront-bar { top: var(--admin-offset); }

.storefront { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 20px; }

/* Left cell: "Select storefront" stays put in both sizes */
.storefront-left { justify-self: end; }
.storefront-label { font-weight: 700; font-size: 14px; color: var(--ink-2); white-space: nowrap; transition: font-size var(--dur) var(--ease); }
.storefront-bar.is-stuck .storefront-label { font-size: 13px; color: var(--muted); }

/* Right cell: full description when big, a compact "Current mode: Local Store" pill when slim (cross-fade) */
.storefront-right { display: grid; justify-self: start; align-items: center; }
.storefront-mode,
.storefront-now { grid-area: 1 / 1; transition: opacity var(--dur) ease, transform var(--dur) var(--ease), visibility 0s linear 0s; }
.storefront-mode { max-width: 34ch; font-size: 13px; line-height: 1.4; color: var(--muted); }
.storefront-mode strong { color: var(--ink); }
.storefront-mode-label { display: block; font-weight: 600; }
.storefront-now {
  display: flex; align-items: center; gap: 8px; white-space: nowrap;
  font-size: 13px; color: var(--muted);
  opacity: 0; transform: translateY(6px); visibility: hidden; pointer-events: none;
}
.storefront-now strong {
  padding: 3px 10px; border-radius: 999px;
  background: #FDECEC; color: var(--red-dark); font-weight: 800; font-size: 13px;
}
.storefront-now strong[data-now="shopee"] { background: #FFF1EE; color: #C7381B; }
.storefront-bar.is-stuck .storefront-mode { opacity: 0; transform: translateY(-6px); visibility: hidden; transition: opacity var(--dur) ease, transform var(--dur) var(--ease), visibility 0s linear var(--dur); }
.storefront-bar.is-stuck .storefront-now { opacity: 1; transform: none; visibility: visible; }

.storefront-switch {
  position: relative;
  display: grid; grid-template-columns: 1fr 1fr;
  padding: 5px; background: #fff;
  border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 1px 2px rgba(32, 38, 44, .06);
  cursor: pointer; user-select: none;
  -webkit-tap-highlight-color: transparent; touch-action: manipulation;
  transition: padding var(--dur) var(--ease), border-radius var(--dur) var(--ease);
}
.storefront-thumb {
  position: absolute; top: 5px; bottom: 5px; left: 5px;
  width: calc(50% - 5px); border-radius: 8px;
  background: var(--red);
  box-shadow: 0 4px 12px rgba(211, 1, 1, .28);
  will-change: transform;
  /* the slide: smooth start and a soft landing */
  transition: transform .26s cubic-bezier(.4, 0, .2, 1), background-color .26s ease, box-shadow .26s ease,
              top var(--dur) var(--ease), bottom var(--dur) var(--ease), left var(--dur) var(--ease),
              width var(--dur) var(--ease), border-radius var(--dur) var(--ease);
}
.storefront-switch[data-active="shopee"] .storefront-thumb {
  transform: translateX(100%);
  background: #EE4D2D;
  box-shadow: 0 4px 12px rgba(238, 77, 45, .3);
}
.storefront-tab {
  position: relative; z-index: 1;
  display: flex; align-items: center; gap: 12px;
  min-width: 200px; min-height: 56px; padding: 8px 18px 8px 10px;
  border: 0; border-radius: 8px; background: transparent;
  text-align: left; color: var(--ink-2); cursor: pointer;
  -webkit-tap-highlight-color: transparent;
  /* text darkens straight away when the slider leaves… */
  transition: color .18s ease, min-height var(--dur) var(--ease), min-width var(--dur) var(--ease),
              padding var(--dur) var(--ease), gap var(--dur) var(--ease), border-radius var(--dur) var(--ease);
}
.storefront-icon {
  display: grid; place-items: center; flex: 0 0 auto; width: 38px; height: 38px;
  border-radius: 10px; background: rgba(32, 38, 44, .06); color: var(--muted); font-size: 15px;
  transition: background-color .18s ease, color .18s ease,
              width var(--dur) var(--ease), height var(--dur) var(--ease),
              border-radius var(--dur) var(--ease), font-size var(--dur) var(--ease);
}
.storefront-text { display: grid; line-height: 1.2; }
.storefront-text strong { font-weight: 800; font-size: 16px; transition: font-size var(--dur) var(--ease); }
.storefront-text small {
  display: block; max-height: 18px; overflow: hidden;
  font-weight: 500; font-size: 12.5px; color: var(--muted);
  transition: color .25s ease, max-height var(--dur) var(--ease), opacity var(--dur) ease;
}
@media (hover: hover) {
  .storefront-tab:hover:not([aria-selected="true"]) .storefront-icon { background: #E6EAED; color: var(--ink); }
}
/* …and turns white only as the slider arrives underneath it */
.storefront-tab[aria-selected="true"] { color: #fff; transition-delay: .08s, 0s, 0s, 0s, 0s, 0s; }
.storefront-tab[aria-selected="true"] .storefront-icon { transition-delay: .08s, .08s, 0s, 0s, 0s, 0s; }
.storefront-tab[aria-selected="true"] .storefront-text small { transition-delay: .08s, 0s, 0s; }
.storefront-tab[aria-selected="true"] .storefront-text small { color: rgba(255, 255, 255, .85); }
.storefront-tab[aria-selected="true"] .storefront-icon { background: rgba(255, 255, 255, .2); color: #fff; }
.storefront-tab:focus-visible { outline-offset: 2px; }

/* Slim state */
.storefront-bar.is-stuck .storefront-switch { padding: 3px; border-radius: 10px; }
.storefront-bar.is-stuck .storefront-thumb { top: 3px; bottom: 3px; left: 3px; width: calc(50% - 3px); border-radius: 7px; }
.storefront-bar.is-stuck .storefront-tab { min-height: 38px; min-width: 150px; padding: 4px 14px 4px 6px; gap: 8px; border-radius: 7px; }
.storefront-bar.is-stuck .storefront-icon { width: 28px; height: 28px; border-radius: 7px; font-size: 12px; }
.storefront-bar.is-stuck .storefront-text strong { font-size: 14px; }
.storefront-bar.is-stuck .storefront-text small { max-height: 0; opacity: 0; }

@media (prefers-reduced-motion: reduce) {
  .storefront-bar, .storefront-bar * { transition-duration: .01ms !important; }
}

/* Catalogue */
.catalogue { padding: clamp(28px, 4vw, 44px) 0 var(--section-y); overflow-x: clip; } /* keeps the edge-to-edge strip from adding a sideways scroll */
.store-panel:not([hidden]) { animation: ts-panel-in .2s ease both; }
@keyframes ts-panel-in { from { opacity: 0; } to { opacity: 1; } }

/* Category filter */
.filter-bar { display: grid; justify-items: center; gap: 12px; margin-bottom: 36px; }
.filter-title { font-weight: 700; font-size: 15px; color: var(--ink-2); }
.filter-group {
  display: flex; flex-wrap: wrap; justify-content: center; gap: 6px;
  padding: 6px; background: #fff;
  border: 1px solid var(--line); border-radius: 14px;
  box-shadow: var(--shadow-card);
}
.filter-chip {
  display: inline-flex; align-items: center; gap: 10px;
  min-height: 48px; padding: 8px 10px 8px 16px;
  border: 0; border-radius: 12px; background: transparent;
  font-weight: 700; font-size: 15px; color: var(--ink-2); cursor: pointer;
  transition: background-color .2s ease, color .2s ease;
}
.filter-chip .fas { width: 18px; font-size: 15px; color: var(--muted); transition: color .2s ease; }
.filter-chip-count {
  display: inline-grid; place-items: center; min-width: 26px; height: 26px; padding: 0 7px;
  border-radius: 999px; background: var(--panel);
  font-size: 13px; font-weight: 800; color: var(--ink-2);
  transition: background-color .2s ease, color .2s ease;
}
.filter-chip:hover { background: var(--panel); color: var(--ink); }
.filter-chip:hover .filter-chip-count { background: #fff; }
.filter-chip[aria-pressed="true"] { background: var(--red); color: #fff; }
.filter-chip[aria-pressed="true"] .fas { color: #fff; }
.filter-chip[aria-pressed="true"] .filter-chip-count { background: rgba(255, 255, 255, .22); color: #fff; }
.filter-chip:focus-visible { outline-offset: 2px; }

/* Shopee tab with products */
.shopee-head {
  display: flex; flex-wrap: wrap; align-items: center; gap: 16px 20px; margin-bottom: 28px;
  padding: 18px 22px; background: #FFF6F3; border: 1px solid #FBD9CF; border-radius: var(--radius-card);
}
.shopee-head .shopee-icon { margin: 0; }
.shopee-head-copy { flex: 1 1 280px; }
.shopee-head-copy h2 { font-weight: 800; font-stretch: 110%; font-size: 22px; color: var(--ink); }
.shopee-head-copy p { margin-top: 4px; color: var(--muted); }

/* Shopee tab without products */
.shopee-panel {
  max-width: 640px; margin: 8px auto 0; padding: clamp(32px, 5vw, 52px) clamp(22px, 4vw, 44px);
  text-align: center;
  border: 2px dashed var(--line); border-radius: 14px;
}
.shopee-icon {
  display: inline-grid; place-items: center; width: 64px; height: 64px; margin-bottom: 18px;
  border-radius: 50%; background: #FFF1EE; color: #EE4D2D; font-size: 26px;
}
.shopee-panel h2 { font-weight: 800; font-stretch: 110%; font-size: 26px; color: var(--ink); }
.shopee-panel p { margin: 10px auto 0; max-width: 50ch; color: var(--muted); }
.shopee-actions { display: flex; flex-wrap: wrap; justify-content: center; gap: 12px; margin-top: 24px; }

/* Tablets: the category buttons stick under the switch bar.
   When stuck the heading folds away and the buttons get slimmer; the extra bottom margin
   makes up the height difference so the products below do not jump. */


/* ☰ category button (phones only) */
.filter-toggle { display: none; }
.filter-drop-inner { min-height: 0; }

@media (max-width: 999px) {
  /* Sticks right under the storefront bar while scrolling the products */
  .filter-bar {
    position: sticky; z-index: 840;
    top: calc(var(--header-h) + var(--admin-offset) + var(--sf-h, 0px));
    justify-items: stretch; gap: 0;
    margin: 0 calc(-1 * var(--gutter)) 20px; padding: 0 var(--gutter);
    border-bottom: 1px solid transparent;
    transition: top .38s cubic-bezier(.3, .7, .2, 1), padding .38s cubic-bezier(.3, .7, .2, 1),
                background-color .3s ease, box-shadow .3s ease, border-color .3s ease;
  }
  html.ts-header-tucked .filter-bar { top: calc(var(--admin-offset) + var(--sf-h, 0px)); }
  .filter-bar.is-stuck {
    padding-top: 6px; padding-bottom: 6px;
    background: rgba(255, 255, 255, .96);
    -webkit-backdrop-filter: saturate(1.4) blur(10px); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom-color: var(--line);
    box-shadow: 0 6px 18px rgba(32, 38, 44, .08);
  }
  /* one shadow for the pair: the switch bar above drops its own */
  html.ts-filter-stuck .storefront-bar.is-stuck { box-shadow: none; }
  .filter-bar.is-stuck .filter-toggle { min-height: 44px; padding: 4px 12px 4px 4px; gap: 10px; border-radius: 10px; box-shadow: none; background: var(--panel); border-color: transparent; }
  .filter-bar.is-stuck .filter-toggle-bars { width: 36px; height: 36px; padding: 0 10px; border-radius: 8px; gap: 3.5px; }
  .filter-bar.is-stuck .filter-toggle-text { grid-auto-flow: column; justify-content: start; align-items: baseline; gap: 6px; }
  .filter-bar.is-stuck .filter-toggle-text small { font-size: 12px; }
  .filter-bar.is-stuck .filter-toggle-text small::after { content: ":"; }
  .filter-bar.is-stuck .filter-toggle-text strong { font-size: 15px; }
  .filter-bar.is-stuck.is-open .filter-toggle { border-color: var(--red); background: #fff; border-radius: 10px 10px 0 0; }
  .filter-toggle-bars, .filter-toggle-text small, .filter-toggle-text strong {
    transition: width .38s cubic-bezier(.3, .7, .2, 1), height .38s cubic-bezier(.3, .7, .2, 1), font-size .38s cubic-bezier(.3, .7, .2, 1);
  }
  .filter-title { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .filter-toggle {
    display: flex; align-items: center; gap: 14px; width: 100%;
    min-height: 58px; padding: 8px 16px 8px 8px;
    background: #fff; border: 1px solid var(--line); border-radius: 14px;
    box-shadow: var(--shadow-card); color: var(--ink); text-align: left; cursor: pointer;
    -webkit-tap-highlight-color: transparent;
    transition: border-color .25s ease, box-shadow .25s ease, border-radius .3s ease;
  }
  .filter-toggle-bars {
    display: grid; align-content: center; gap: 4px; flex: 0 0 auto;
    width: 42px; height: 42px; padding: 0 12px; border-radius: 10px; background: var(--red);
  }
  .filter-toggle-bars span {
    display: block; height: 2px; border-radius: 2px; background: #fff;
    transition: transform .3s cubic-bezier(.3, .7, .2, 1), opacity .2s ease;
  }
  .filter-toggle-text { display: grid; flex: 1 1 auto; min-width: 0; line-height: 1.2; }
  .filter-toggle-text small { font-size: 12.5px; font-weight: 600; color: var(--muted); }
  .filter-toggle-text strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 800; font-size: 16px; }
  .filter-toggle-chevron { color: var(--muted); transition: transform .3s cubic-bezier(.3, .7, .2, 1); }
  /* open: bars turn into an ×, chevron flips, button joins the list below */
  .filter-bar.is-open .filter-toggle { border-color: var(--red); border-radius: 14px 14px 0 0; box-shadow: none; }
  .filter-bar.is-open .filter-toggle-bars span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
  .filter-bar.is-open .filter-toggle-bars span:nth-child(2) { opacity: 0; }
  .filter-bar.is-open .filter-toggle-bars span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }
  .filter-bar.is-open .filter-toggle-chevron { transform: rotate(180deg); }

  /* the list drops down smoothly, over the products (nothing below jumps) */
  .filter-drop {
    position: absolute; left: var(--gutter); right: var(--gutter); top: 100%; z-index: 2;
    display: grid; grid-template-rows: 0fr;
    transition: grid-template-rows .35s cubic-bezier(.3, .7, .2, 1), visibility 0s linear .35s;
    visibility: hidden;
  }
  .filter-drop-inner { overflow: hidden; }
  .filter-bar.is-stuck .filter-drop { top: calc(100% - 6px); }
  .filter-bar.is-open .filter-drop-inner { overflow-y: auto; max-height: min(60vh, 420px); overscroll-behavior: contain; }
  .filter-bar.is-open .filter-drop { grid-template-rows: 1fr; visibility: visible; transition: grid-template-rows .35s cubic-bezier(.3, .7, .2, 1), visibility 0s; }
  .filter-group {
    display: grid; gap: 2px; padding: 6px; background: #fff;
    border: 1px solid var(--red); border-top: 0; border-radius: 0 0 14px 14px;
    box-shadow: 0 16px 30px rgba(32, 38, 44, .14);
  }
  .filter-bar.is-stuck .filter-group { border-radius: 0 0 10px 10px; }
  .filter-group { justify-content: stretch; justify-items: stretch; }
  .filter-chip { width: 100%; max-width: none; justify-content: flex-start; -webkit-tap-highlight-color: transparent; }
  .filter-chip-name { flex: 1 1 auto; text-align: left; }
}
@media (max-width: 999px) and (hover: none) {
  .filter-chip:hover:not([aria-pressed="true"]) { background: transparent; color: var(--ink-2); }
}
@media (max-width: 1000px) {
  .storefront { grid-template-columns: auto; justify-content: center; justify-items: center; gap: 8px; }
  .storefront-left { display: none; }
  .storefront-right { justify-self: center; justify-items: center; }
  .storefront-mode { max-width: none; text-align: center; }
  .storefront-mode-label { display: inline; }
  .storefront-bar.is-stuck .storefront-right { display: none; }
}
@media (max-width: 560px) {
  .storefront { grid-template-columns: minmax(0, 1fr); justify-items: stretch; }
  .storefront-switch { width: 100%; }
  .storefront-tab, .storefront-bar.is-stuck .storefront-tab { min-width: 0; gap: 8px; padding: 6px 10px 6px 6px; }
  .storefront-text small { max-height: 0; opacity: 0; }
  .storefront-icon { width: 32px; height: 32px; }
  .shopee-actions .btn { width: 100%; }
}

/* Bottom note under the local store products */
/* Top note: photos are for reference — a faint centred line */
.photo-note { display: flex; justify-content: center; align-items: baseline; gap: 5px; margin: 0 0 14px; text-align: center; opacity: .6; }
.photo-note p { margin: 0; text-wrap: balance; font-size: 12.5px; line-height: 1.5; font-style: italic; color: var(--muted); }
.photo-note strong { font-weight: 400; color: inherit; }
@media (max-width: 640px) { .photo-note { margin-bottom: 12px; } .photo-note p { font-size: 11.5px; } }

.more-note {
  display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px 24px;
  margin-top: clamp(36px, 5vw, 56px); padding: 24px 28px;
  background: var(--panel); border: 1px solid var(--line); border-left: 3px solid var(--red);
  border-radius: var(--radius-card);
}
.more-note-icon {
  display: grid; place-items: center; width: 48px; height: 48px;
  border-radius: 50%; background: #fff; border: 1px solid var(--line); color: var(--red); font-size: 18px;
}
.more-note-copy h2 { font-weight: 800; font-stretch: 108%; font-size: 20px; line-height: 1.25; color: var(--ink); }
.more-note-copy p { margin-top: 4px; max-width: 62ch; color: var(--muted); }
.more-note-actions { display: flex; flex-wrap: wrap; gap: 10px; }
@media (max-width: 760px) {
  .more-note { grid-template-columns: minmax(0, 1fr); padding: 22px 20px; }
  .more-note-actions .btn { flex: 1 1 auto; }
}

/* Switching side: the new list and wording fade in instead of jumping */
@keyframes ts-store-in { from { opacity: 0; } to { opacity: 1; } }
@keyframes ts-fade-in { from { opacity: 0; } to { opacity: 1; } }
.product-card.is-entering { animation: ts-fade-in .18s ease both; }
.store-panel.is-entering { animation: ts-store-in .2s cubic-bezier(.2, .7, .3, 1) both; }
.storefront-mode [data-mode].is-entering,
.storefront-now [data-now].is-entering { animation: ts-fade-in .18s ease both; }
@media (prefers-reduced-motion: reduce) {
  .storefront-thumb, .storefront-tab, .storefront-icon { transition-duration: .01s; transition-delay: 0s; }
  .product-card.is-entering, .store-panel.is-entering, .storefront-mode [data-mode].is-entering, .storefront-now [data-now].is-entering { animation: none; }
}

/* Phones: when the category bar sticks, the ☰ button slides in from the left */
@keyframes ts-slide-in-side {
  from { opacity: 0; transform: translateX(-48px); }
  to { opacity: 1; transform: none; }
}

@media (max-width: 999px) {
  .filter-bar.is-stuck .filter-toggle { animation: ts-slide-in-side .45s cubic-bezier(.22, .8, .25, 1) both; }
}
@media (prefers-reduced-motion: reduce) {
  .filter-bar.is-stuck .filter-toggle { animation: none; }
  .filter-group.is-gliding { transition: none; }
}

/* Computers: categories in a sidebar on the left that stays in view while scrolling;
   products on the right */
@media (min-width: 1000px) {
  .store-panel:has(> .filter-bar):not([hidden]) {
    display: grid; grid-template-columns: 224px minmax(0, 1fr); column-gap: 40px; align-items: start;
  }
  /* the sidebar sits further left, using some of the empty space beside the page */
  /* the local store spreads to both screen edges: sidebar at the left, wider product cards to the right */
  .store-panel:has(> .filter-bar):not([hidden]) { margin-left: calc(-1 * max(0px, (100vw - var(--sbw, 0px) - var(--container)) / 2 - 8px)); margin-right: calc(-1 * max(0px, (100vw - var(--sbw, 0px) - var(--container)) / 2 - 8px)); }
  /* product cards: a little shorter (wider photo area, tighter text) */
  .store-panel > :not(.filter-bar) { grid-column: 2; }
  .store-panel > .filter-bar {
    grid-column: 1; grid-row: 1 / span 4;
    position: sticky; top: calc(var(--header-h) + var(--admin-offset) + var(--sf-h, 0px) + 20px);
    display: block; margin: 0; padding: 14px 12px 12px;
    max-height: calc(100vh - var(--header-h) - var(--admin-offset) - var(--sf-h, 0px) - 40px); overflow-y: auto;
    background: #fff; border-radius: 14px;
    /* double red line, like the TS logo and the other frames */
    border: var(--frame-line) solid var(--red);
    box-shadow: inset 0 0 0 3px #fff, inset 0 0 0 calc(3px + var(--frame-line)) var(--red), var(--shadow-card);
    transition: top .38s cubic-bezier(.3, .7, .2, 1);
  }
  html.ts-header-tucked .store-panel > .filter-bar { top: calc(var(--admin-offset) + var(--sf-h, 0px) + 20px); }
  .filter-bar .filter-title {
    margin: 0 4px 8px; padding-bottom: 10px; border-bottom: 1px solid var(--line);
    font-size: 11.5px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  }
  .filter-bar .filter-group {
    display: flex; flex-direction: column; gap: 4px; padding: 0;
    background: none; border: 0; border-radius: 0; box-shadow: none;
  }
  .filter-bar .filter-chip { width: 100%; min-height: 40px; gap: 8px; padding: 6px 8px 6px 10px; border-radius: 9px; font-size: 14px; line-height: 1.3; text-align: left; }
  .filter-bar .filter-chip .fas { width: 16px; font-size: 13px; }
  .filter-bar .filter-chip-count { min-width: 22px; height: 22px; padding: 0 6px; font-size: 12px; }
  .filter-bar .filter-chip-name { flex: 1 1 auto; }
  .store-panel .product-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 18px; }
  .store-panel .more-note { grid-template-columns: auto minmax(0, 1fr); }
  .store-panel .more-note-actions { grid-column: 2; }
}
@media (min-width: 1240px) {
  .store-panel .product-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 20px; }
}
@media (min-width: 1000px) {
  .store-panel .spec-list { margin-top: 10px; }
  .store-panel .spec-row { padding: 6px 0; }
  .store-panel .product-summary { margin-top: 10px; }
}
