/* ══════════════════════════════════════════════════════════════
   FiberOpticsTools — catalog / shop page CSS
   Ported from docs/drafts/catalog-concept.html. Loads ONLY on the
   shop/catalog page. Composes the shared tokens + component patterns
   defined in frame.css — do NOT redefine tokens, base/reset, header,
   footer, cards, or the contextual right-rail here.
   Single light theme (values inherit from frame tokens).
   ══════════════════════════════════════════════════════════════ */

/* horizontal padding + centering come from Kadence's #inner-wrap.wrap; we only add vertical rhythm */
.cat-page { padding: 8px 0 64px; }

/* breadcrumb */
.crumb { display: flex; align-items: center; flex-wrap: wrap; gap: 7px;
  font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-bottom: 18px; }
.crumb a { color: var(--ink-dim); }
.crumb a:hover { color: var(--accent); }
.crumb .sep { color: var(--line-strong); }
.crumb .cur { color: var(--ink); }

/* two-column shell: sidebar + results */
.cat-shell { display: grid; grid-template-columns: 244px 1fr; gap: 26px; align-items: start; }
/* the results column uses <section>; neutralize the homepage's big section padding so its
   toolbar top-aligns with the sidebar's "All categories" instead of sitting 56px lower */
.cat-shell > section { padding: 0; border-bottom: none; }

/* left category sidebar */
.side { position: sticky; top: 84px; }
.side .sb-head { font-family: var(--mono); font-size: 11px; letter-spacing: 0.12em;
  text-transform: uppercase; color: var(--muted); padding: 0 4px 10px; }
.tree { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.tree ul { list-style: none; margin: 0; padding: 0; }
.tnode { border-top: 1px solid var(--line); }
.tree > ul > .tnode:first-child { border-top: 0; }
.trow { display: flex; align-items: center; gap: 8px; width: 100%; padding: 9px 12px;
  background: transparent; border: 0; text-align: left; cursor: pointer; color: var(--ink-dim);
  font-family: var(--sans); font-size: 13px; }
.trow:hover { background: var(--surface-2); color: var(--ink); }
.trow .tw { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.trow .tct { font-family: var(--mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.trow.on { color: var(--ink); background: color-mix(in srgb, var(--accent) 10%, transparent);
  box-shadow: inset 3px 0 0 var(--accent); font-weight: 600; }
.trow.on .tct { color: var(--accent); }
.caret { width: 14px; height: 14px; flex-shrink: 0; color: var(--muted);
  transition: transform .15s; }
.tnode.open > .trow .caret { transform: rotate(90deg); }
.trow.leaf .caret { visibility: hidden; }
.subtree { display: none; padding: 2px 0 6px; background: color-mix(in srgb, var(--ground) 40%, transparent); }
.tnode.open > .subtree { display: block; }
.subtree .trow { padding-left: 34px; font-size: 12.5px; }

/* toolbar above results */
.toolbar { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface);
  padding: 12px 14px; margin-bottom: 14px; display: flex; flex-direction: column; gap: 12px; }
.tb-filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.tb-filters .lbl { font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.12em; color: var(--muted); margin-right: 2px; }
.fchip { font-family: var(--mono); font-size: 12px; padding: 5px 11px 5px 11px; border-radius: 999px;
  border: 1px solid var(--line-strong); color: var(--ink-dim);
  background: color-mix(in srgb, var(--surface) 60%, transparent); cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px; }
.fchip:hover { border-color: var(--accent); color: var(--accent); }
.fchip svg { width: 11px; height: 11px; opacity: 0.7; }
.fchip.set { border-color: var(--accent); color: var(--accent);
  background: color-mix(in srgb, var(--accent) 12%, transparent); }
.fchip .x { color: var(--muted); }
.fchip.set .x { color: var(--accent); }
.tb-note { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.02em;
  display: inline-flex; align-items: center; gap: 6px; }
.tb-note svg { width: 12px; height: 12px; color: var(--signal); flex-shrink: 0; }

.tb-row2 { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }
/* Only separate from a filter row when one is actually present (no empty top border). */
.tb-filters + .tb-row2 { border-top: 1px solid var(--line); padding-top: 12px; }
.rescount { font-family: var(--mono); font-size: 12px; color: var(--ink-dim); font-variant-numeric: tabular-nums; }
.rescount b { color: var(--ink); font-weight: 700; }
.tb-row2 .spacer { flex: 1; }
.ctrl { display: inline-flex; align-items: center; gap: 7px; }
.ctrl .clbl { font-family: var(--mono); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--muted); }
.sortsel { position: relative; }
.sortsel select { appearance: none; -webkit-appearance: none; font-family: var(--mono); font-size: 12px;
  color: var(--ink); background: var(--ground); border: 1px solid var(--line-strong);
  border-radius: 7px; padding: 6px 28px 6px 11px; cursor: pointer; }
.sortsel select:focus { outline: 2px solid var(--accent); border-color: transparent; }
.sortsel svg { position: absolute; right: 9px; top: 50%; transform: translateY(-50%);
  width: 12px; height: 12px; color: var(--muted); pointer-events: none; }

/* results list */
.results { border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); overflow: hidden; }
.rrow { display: grid; grid-template-columns: 72px minmax(0,1fr) auto; align-items: center;
  gap: 14px; padding: 12px 16px; border-top: 1px solid var(--line); }
.results .rrow:first-child { border-top: 0; }
.rrow:hover { background: color-mix(in srgb, var(--accent) 5%, transparent); }
/* sized to fill the row height so supplier photos stay recognizable at a glance */
.rthumb { width: 72px; height: 72px; border-radius: 8px; border: 1px solid var(--line);
  background: #fff; overflow: hidden;
  display: grid; place-items: center; color: var(--accent); flex-shrink: 0; }
.rthumb svg { width: 30px; height: 30px; opacity: 0.9; }
.rthumb img { width: 100%; height: 100%; object-fit: contain; padding: 5px; }
.rmid { min-width: 0; display: flex; flex-direction: column; gap: 4px; }
.rsku { font-family: var(--mono); font-size: 10.5px; color: var(--muted); letter-spacing: 0.04em;
  /* a part number has no break points; on a phone it wraps rather than clips at the row edge */
  overflow-wrap: anywhere; }
.rnm { font-size: 13.5px; font-weight: 600; color: var(--ink); line-height: 1.3; }
.rnm a:hover { color: var(--accent); }
.rspecs { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 1px; }
.sc { font-family: var(--mono); font-size: 10.5px; color: var(--ink-dim); font-variant-numeric: tabular-nums;
  border: 1px solid var(--line); border-radius: 5px; padding: 1px 7px; background: color-mix(in srgb, var(--ground) 45%, transparent); }
.rright { display: flex; align-items: center; gap: 16px; justify-content: flex-end; }
.rprice { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; min-width: 92px; }
.rprice .price { font-size: 15px; }
.rprice .stock { white-space: nowrap; }
.rprice .oos { font-family: var(--mono); font-size: 10.5px; color: var(--muted);
  display: inline-flex; align-items: center; gap: 5px; }
.rprice .oos .odot { width: 6px; height: 6px; border-radius: 50%; background: var(--muted); }
.ractions { display: flex; gap: 7px; }
.radd { height: 36px; padding: 0 14px; border-radius: 7px; border: 0; background: var(--accent);
  color: var(--on-accent); font-weight: 700; font-size: 12.5px; font-family: var(--sans); cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; white-space: nowrap; }
/* Kadence's global a:hover/a:focus recolors anchor text; the accent fill needs the
   light text restated on every interactive state or it vanishes into the background. */
.radd:hover, .radd:focus, .radd:active { color: var(--on-accent); }
.radd:hover { background: var(--accent-deep); }
.radd.is-loading { opacity: 0.6; pointer-events: none; }
.radd:disabled { background: var(--surface-2); color: var(--muted); cursor: not-allowed; }
.radd svg { width: 14px; height: 14px; }
/* contextual row state — previously ordered / already in cart */
/* in cart = the Add button is replaced by a same-width, recolored quantity control.
   The row's data-qty attribute (server-rendered, kept live by syncInCart) drives the swap. */
.ractions[data-qty="0"] .rincart { display: none; }
.ractions:not([data-qty="0"]) .radd.add_to_cart_button { display: none; }
.radd, .rincart { width: 90px; box-sizing: border-box; flex: 0 0 auto; }
.radd { justify-content: center; padding: 0; }
.rincart { height: 36px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: space-between;
  background: color-mix(in srgb, var(--good) 15%, transparent); box-shadow: inset 0 0 0 1px var(--good); color: var(--good); }
.rincart button { width: 30px; height: 100%; border: 0; background: none; color: inherit; cursor: pointer; font-size: 15px; line-height: 1; }
.rincart button:hover { color: var(--ink); }
.rincart span { font-family: var(--mono); font-weight: 700; font-size: 12.5px; font-variant-numeric: tabular-nums; }
/* padding: 0 defeats Kadence's global button padding, which shoves the icon off-center */
.rlist { width: 36px; height: 36px; padding: 0; box-sizing: border-box; border-radius: 7px;
  border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink-dim); cursor: pointer; display: grid; place-items: center; flex-shrink: 0; }
.rlist:hover { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
a:focus-visible, button:focus-visible, select:focus-visible, .trow:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }

/* pagination footer — up to 100 per page, page links (no dynamic loading) */
.pager { display: flex; flex-direction: column; align-items: center; gap: 12px; margin-top: 22px; }
.pager .shown { font-family: var(--mono); font-size: 11.5px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pnums { display: flex; gap: 6px; align-items: center; }
.pnums a, .pnums span { font-family: var(--mono); font-size: 12px; min-width: 32px; height: 32px;
  display: inline-flex; align-items: center; justify-content: center; padding: 0 8px;
  border: 1px solid var(--line); border-radius: 7px; color: var(--ink-dim); }
.pnums a:hover { border-color: var(--accent); color: var(--accent); }
.pnums .cur { background: var(--accent); color: var(--on-accent); border-color: var(--accent); font-weight: 700; }

/* results reuse caption */
.reuse-note { margin-top: 20px; border: 1px dashed var(--line-strong); border-radius: var(--radius);
  background: color-mix(in srgb, var(--surface) 55%, transparent); padding: 14px 16px;
  display: flex; gap: 11px; align-items: flex-start; }
/* As the only child of the results box it is the empty state, not a caption under a list. */
.results > .reuse-note { margin: 0; border: 0; border-radius: 0; background: transparent; }
.reuse-note svg { width: 16px; height: 16px; color: var(--accent); flex-shrink: 0; margin-top: 2px; }
.reuse-note p { margin: 0; font-size: 12.5px; color: var(--muted); line-height: 1.55; }
.reuse-note b { color: var(--ink-dim); font-weight: 650; }
.reuse-note a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }
.reuse-note code { font-family: var(--mono); font-size: 11.5px; color: var(--accent);
  background: color-mix(in srgb, var(--accent) 10%, transparent); padding: 1px 5px; border-radius: 4px; }

/* mobile sticky Filters button + drawer */
.filtbar { display: none; }
.drawer-scrim { display: none; }

@media (max-width: 900px) {
  .cat-shell { grid-template-columns: 1fr; }
  /* sidebar becomes an off-canvas drawer */
  .side { position: fixed; top: 0; left: 0; bottom: 0; width: 300px; max-width: 86vw;
    z-index: 60; background: var(--surface); border-right: 1px solid var(--line-strong);
    padding: 18px 16px; overflow-y: auto; transform: translateX(-102%); transition: transform .2s ease;
    box-shadow: 0 0 60px -10px rgba(0,0,0,0.5); }
  body.drawer-open .side { transform: translateX(0); }
  body.drawer-open .drawer-scrim { display: block; position: fixed; inset: 0; z-index: 55;
    background: rgba(0,0,0,0.5); }
  .side .sb-close { display: flex; }
  /* sticky filters launcher */
  .filtbar { display: flex; gap: 10px; align-items: center; position: sticky; top: 76px; z-index: 30;
    margin-bottom: 14px; }
  .filtbtn { flex-shrink: 0; height: 40px; padding: 0 16px; border-radius: 8px;
    border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
    font-weight: 650; font-size: 13px; font-family: var(--sans); cursor: pointer;
    display: inline-flex; align-items: center; gap: 8px; box-shadow: 0 6px 20px -12px rgba(0,0,0,0.6); }
  .filtbtn svg { width: 15px; height: 15px; color: var(--accent); }
  .filtbtn .fbc { font-family: var(--mono); font-size: 11px; color: var(--on-accent);
    background: var(--accent); border-radius: 8px; padding: 0 6px; }
  .filtbar .mobsort { flex: 1; }
  .filtbar .sortsel select { width: 100%; }
  /* rows reflow to dense stacked cards */
  .rrow { grid-template-columns: 56px 1fr; grid-template-areas: "thumb mid" "act act";
    gap: 12px 12px; padding: 13px 14px; }
  .rthumb { width: 56px; height: 56px; }
  .rthumb { grid-area: thumb; }
  .rmid { grid-area: mid; }
  .rright { grid-area: act; justify-content: space-between; width: 100%;
    border-top: 1px dashed var(--line); padding-top: 11px; gap: 12px; }
  .rprice { flex-direction: row; align-items: center; gap: 10px; min-width: 0; }
  .radd { flex: 0 0 auto; }
}
.side .sb-close { display: none; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.side .sb-close button { width: 34px; height: 34px; border-radius: 7px; border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink-dim); cursor: pointer; display: grid; place-items: center; }
.side .sb-close .st { font-family: var(--mono); font-size: 12px; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted); }

@media (max-width: 560px) {
  .rprice { flex-direction: column; align-items: flex-end; gap: 3px; }
  .rright { align-items: flex-end; }
  .tb-row2 .spacer { display: none; }
}
