/* Fabric library, /tech-pack/fabrics/ (pages/fabrics.php, tp-fabrics.js). Loads after tp-v4.css and tp-site-nav.css and uses their
   tokens (--ink, --mist, --line, --orange, --orange-ui, --orange-ink, --orange-wash, --display, --light). Every rule is scoped under .tpf.
   Parts: the trail and the hero (H1, lead, summary table), the filter bar (sent hidden, shown by tp-fabrics.js; sticky on wide screens),
   a section per material with its cards, "Why we list the weight after washing", the close and the garment links.
   Swatches (about 176 x 102 px) are drawn at their own size or smaller, never stretched, and toned down as on the builder's cards:
   their colors are the supplier's card, not the buyer's. */

.tpf{background:var(--paper);padding:20px 0 clamp(56px,7vw,96px)}
/* anchors and focus land below the sticky header and, where it sticks, the filter bar (--tpf-bar-h, set by tp-fabrics.js: 0 where the
   bar does not stick or the script does not run) */
html{scroll-padding-top:calc(var(--tp-sh-h,0px) + var(--tpf-bar-h,0px))}
.tpf .tp-pill--solid:hover{background:#111;border-color:#111;color:#fff}

/* ---------- hero: the H1 and lead beside the summary table ---------- */
.tpf-hero{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);gap:clamp(24px,3vw,40px);align-items:start;margin-top:28px}
.tpf-hero__text{min-width:0}
.tpf-eye{font:800 12px/1.3 var(--display);letter-spacing:.14em;text-transform:uppercase;color:var(--orange-ink)}
.tpf h1{font-size:clamp(32px,3.6vw,46px);line-height:1.08;margin-top:14px;max-width:22ch;color:var(--ink)}
.tpf-lead{font-family:var(--light);font-weight:300;font-size:clamp(17px,1.5vw,19px);line-height:1.6;color:var(--lede-ink);max-width:62ch;margin-top:18px}
.tpf .tp-actions{margin-top:24px}
.tpf-fine{font-size:13px;color:var(--muted);margin-top:16px;max-width:62ch}
/* the buying facts under the H1, dot-separated */
.tpf-facts{margin-top:14px;max-width:62ch;font:700 14px/1.6 var(--display);color:var(--text)}
.tpf-facts span{margin:0 3px;color:var(--orange-ui)}
/* the factory photo strip between the hero and the filters: three short frames */
.tpf-photos{list-style:none;margin:clamp(24px,3vw,36px) 0 0;padding:0;display:grid;grid-template-columns:repeat(3,minmax(0,1fr));gap:12px}
.tpf-photos li{margin:0}
.tpf-photos img{display:block;width:100%;height:auto;aspect-ratio:5/2;object-fit:cover;border-radius:10px;background:var(--mist)}

.tpf-sum{background:var(--mist);border-radius:14px;padding:22px 22px 18px}
.tpf-sum__t{font:700 15px/1.3 var(--display)}
.tpf-sum table{width:100%;border-collapse:collapse;margin-top:10px;font-size:14px}
.tpf-sum th,.tpf-sum td{text-align:left;padding:9px 10px 9px 0;vertical-align:top}
.tpf-sum thead th{font:800 11px/1.3 var(--display);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);padding-top:4px}
.tpf-sum tbody tr{border-top:1px solid var(--line)}
.tpf-sum tbody th{font:700 14px/1.4 var(--display)}
.tpf-sum tbody th a{text-decoration:none}
.tpf-sum tbody th a:hover{color:var(--orange-ink);text-decoration:underline}
.tpf-sum small{display:block;font:400 12px/1.4 var(--body);color:var(--muted)}
.tpf-sum td{white-space:nowrap}
.tpf-sum td:last-child{padding-right:0}
.tpf-sum__n{font-size:13px;color:var(--muted);margin-top:10px}

/* ---------- filter bar ---------- */
.tpf-bar{background:var(--paper);border-block:1px solid var(--line);margin-top:clamp(32px,4vw,48px);z-index:40}
.tpf-bar__in{display:grid;gap:10px;padding-block:14px}
.tpf-row{display:grid;grid-template-columns:96px minmax(0,1fr) auto;gap:12px;align-items:center}
.tpf-rl{font:800 11px/1.3 var(--display);letter-spacing:.12em;text-transform:uppercase;color:var(--muted)}
.tpf-chips{display:flex;flex-wrap:wrap;gap:8px;align-items:center;min-width:0}
.tpf-chip{display:inline-flex;align-items:center;gap:6px;min-height:44px;padding:0 14px;border:1px solid var(--stone);border-radius:999px;background:#fff;color:var(--text);font:400 14px/1.2 var(--body);cursor:pointer;white-space:nowrap;transition:border-color .2s,background .2s,color .2s}
.tpf-chip:hover{border-color:#111}
.tpf-n{color:var(--muted)}
.tpf-chip[data-f="mat"][aria-pressed="true"]{background:var(--ink);border-color:var(--ink);color:#fff}
.tpf-chip[data-f="mat"][aria-pressed="true"] .tpf-n{color:var(--muted-d)}
.tpf-chip[data-f="w"][aria-pressed="true"],.tpf-chip[data-f="knit"][aria-pressed="true"]{background:var(--orange-wash);border-color:var(--orange-ui);color:var(--orange-ink)}
.tpf-chip[aria-pressed="true"]{font-family:var(--display);font-weight:700}
.tpf-check{display:inline-flex;align-items:center;gap:8px;min-height:44px;padding:0 6px;font-size:14px;cursor:pointer;white-space:nowrap}
.tpf-check input{width:18px;height:18px;margin:0;accent-color:var(--orange-ui)}
/* the count and Clear sit at the end of the material row */
.tpf-status{display:flex;flex-wrap:wrap;align-items:center;justify-content:flex-end;gap:4px 14px;font-size:14px;color:var(--muted)}
.tpf-status [role="status"]{color:var(--text);font-family:var(--display);font-weight:700}
.tpf-clear{min-height:44px;padding:0 4px;border:0;background:none;color:var(--orange-ink);font:700 14px/1 var(--display);text-decoration:underline;text-underline-offset:.2em;cursor:pointer}
.tpf-clear:hover{color:var(--ink)}
/* wide and tall enough: the bar stays under the site header while the cards scroll */
@media (min-width:1024px) and (min-height:760px){
  .tpf-bar{position:sticky;top:calc(env(safe-area-inset-top,0px) + var(--tp-sh-h,0px))}
}
/* gate C M1: compact chips for a mouse, so the sticky bar takes about 136 px (touch keeps 44 px; WCAG 2.5.8 asks 24 px for a mouse) */
@media (min-width:1024px) and (min-height:760px) and (pointer:fine){
  .tpf-bar__in{gap:6px;padding-block:10px}
  .tpf-chip{min-height:34px;padding:0 12px}
  .tpf-check,.tpf-clear{min-height:34px}
}

/* ---------- a section per material ---------- */
.tpf-list{padding-top:8px}
.tpf-group{margin-top:clamp(40px,5vw,64px);scroll-margin-top:16px}
.tpf-ghead{max-width:820px}
.tpf h2{font-size:clamp(26px,3vw,34px);letter-spacing:-.025em;line-height:1.1;color:var(--ink)}
.tpf-ghead p{font-size:17px;line-height:1.6;margin-top:10px;max-width:72ch}
.tpf-grid{display:grid;grid-template-columns:repeat(auto-fill,minmax(250px,1fr));gap:18px;margin-top:22px}
.tpf-gnote{font-size:14px;color:var(--muted);margin-top:16px}
.tpf-gcount{color:var(--text)}
.tpf-empty{margin-top:40px;font-size:17px}

.tpf-card{display:flex;flex-direction:column;border:1px solid var(--line);border-radius:14px;overflow:hidden;background:#fff;scroll-margin-top:16px}
.tpf-card:target{border-color:var(--orange-ui);box-shadow:0 0 0 2px var(--orange-ui)}
.tpf-sw{display:grid;place-items:center;background:var(--mist);padding:20px 16px 18px}
/* the files run 174 to 356 px wide: each is drawn 176 px wide (the commonest file size) in the same frame, so the cards line up */
.tpf-sw img{display:block;width:min(176px,100%);height:auto;aspect-ratio:176/102;object-fit:cover;border-radius:3px;box-shadow:0 0 0 1px rgba(0,0,0,.08),0 6px 14px rgba(0,0,0,.08);filter:saturate(.4)}
.tpf-sw__none{font-size:13px;color:var(--muted)}
.tpf-bd{display:flex;flex-direction:column;gap:6px;flex-grow:1;padding:14px 16px 16px;min-width:0}
.tpf .tpf-card h3{font:700 17px/1.25 var(--display);letter-spacing:-.01em;color:var(--ink)}
.tpf-ref{display:block;margin-bottom:4px;font:800 12px/1.2 var(--display);letter-spacing:.08em;color:var(--orange-ink)}
.tpf-comp{font-size:14px;line-height:1.45}
.tpf-meta{font-size:13px;line-height:1.5;color:var(--muted)}
/* gate C M2: the actions span the card under its text */
.tpf-acts{display:flex;flex-wrap:wrap;gap:8px;margin:0;padding:0 16px 16px}
.tpf-acts .tpf-btn{flex:1 1 auto;justify-content:center;padding:0 10px}
.tpf-nob{flex:1 1 100%;font-size:13px;line-height:1.45;color:var(--muted)}
/* with "Email" beside WhatsApp the three do not fit one row of a card: the builder takes its own row, the two contacts share the next */
.tpf-acts .tpf-btn--ink{flex-basis:100%}
.tpf-btn{display:inline-flex;align-items:center;min-height:44px;padding:0 14px;border:1px solid var(--stone);border-radius:999px;color:var(--ink);font:700 14px/1.2 var(--display);text-decoration:none;transition:border-color .2s,background .2s}
.tpf-btn:hover{border-color:#111}
.tpf-btn--ink{background:var(--ink);border-color:var(--ink);color:#fff}
.tpf-btn--ink:hover{background:var(--orange-ui);border-color:var(--orange-ui);color:var(--on-orange)}

/* ---------- why we list the weight after washing ---------- */
.tpf-end{display:grid;gap:clamp(32px,4vw,48px);margin-top:clamp(48px,6vw,80px)}
.tpf-wash{display:grid;grid-template-columns:minmax(0,7fr) minmax(0,5fr);gap:clamp(24px,3vw,40px);align-items:center;background:var(--orange-wash);border-radius:16px;padding:clamp(22px,3vw,36px)}
.tpf-wash__text p{font-size:17px;line-height:1.6;margin-top:12px;max-width:66ch}
.tpf-wash__fig{margin:0}
.tpf-wash__fig ul{list-style:none;margin:0;padding:0;display:grid;gap:10px}
.tpf-wash__fig li{display:grid;grid-template-columns:104px minmax(0,1fr) 40px;gap:12px;align-items:center}
.tpf-wl{font-size:14px;color:var(--muted)}
.tpf-wbar{display:block;height:18px;background:rgba(255,255,255,.7);border-radius:4px;overflow:hidden}
.tpf-wfill{display:block;height:100%;border-radius:4px}
.tpf-wfill--roll{background:var(--stone)}
.tpf-wfill--hang{background:#ffb48f}
.tpf-wfill--tumble{background:var(--orange-ui)}
.tpf-wash__fig b{font-size:15px;text-align:right}
.tpf-wash__fig figcaption{font-size:12px;color:var(--muted);margin-top:10px}
/* the average gain by knit */
.tpf-gain{width:100%;max-width:520px;border-collapse:collapse;margin-top:18px;font-size:14px}
.tpf-gain caption{text-align:left;font:700 14px/1.4 var(--display);margin-bottom:6px}
.tpf-gain th,.tpf-gain td{text-align:left;padding:7px 12px 7px 0;border-top:1px solid rgba(0,0,0,.1)}
.tpf-gain thead th{font:800 11px/1.3 var(--display);letter-spacing:.08em;text-transform:uppercase;color:var(--muted);border-top:0}
.tpf-gain tbody th{font:700 14px/1.4 var(--display)}
.tpf-gain .tp-num{text-align:right;padding-right:0}

/* ---------- close and the garment links ---------- */
.tpf-close{display:flex;justify-content:space-between;align-items:center;gap:20px 32px;flex-wrap:wrap;border:1px solid var(--line);border-radius:16px;padding:clamp(22px,3vw,32px)}
.tpf-close__text{max-width:680px}
.tpf-close h2{font-size:clamp(22px,2.4vw,28px)}
.tpf-close p{font-size:16px;line-height:1.55;margin-top:10px}
.tpf-close .tp-actions{margin-top:0}
.tpf .tp-card{margin-top:0}
.tpf nav.tp-card ul{display:flex;flex-wrap:wrap;gap:8px;list-style:none;padding:0;margin:10px 0 0}
.tpf nav.tp-card li{margin:0}

/* ---------- tablets and phones ---------- */
@media (max-width:959px){
  .tpf-hero,.tpf-wash{grid-template-columns:minmax(0,1fr)}
  .tpf h1{max-width:none}
}
@media (max-width:640px){
  /* each row's chips scroll inside the row (the page never scrolls sideways); the label sits above them */
  .tpf-row{grid-template-columns:minmax(0,1fr);gap:6px}
  .tpf-status{justify-content:flex-start}
  .tpf-chips{flex-wrap:nowrap;overflow-x:auto;margin:-4px -16px;padding:4px 16px;scrollbar-width:none;scroll-padding-inline:16px}
  .tpf-chips::-webkit-scrollbar{display:none}
  /* a card is a row: the swatch beside its facts */
  .tpf-grid{grid-template-columns:minmax(0,1fr);gap:12px}
  .tpf-card{display:grid;grid-template-columns:100px minmax(0,1fr)}
  .tpf-sw{background:none;padding:14px 0 0 14px;align-content:start}
  .tpf-sw img{width:86px}
  .tpf-bd{padding:12px 14px 12px 12px}
  .tpf-acts{grid-column:1/-1;padding:0 14px 14px}
  .tpf-photos{gap:8px}
  .tpf-wash__fig li{grid-template-columns:92px minmax(0,1fr) 36px;gap:8px}
}
