/* Wave 4 (wave4.py), linked last in every page's head, after wave3.css. Existing tokens only; corners 6 px; no pills. */

/* 1. /solar-bundles voltage tabs (M-136): the deal category buttons' look (deals-sort59.css .dq-cat), the count after the name */
.w4-tabs{display:flex;flex-wrap:wrap;gap:8px;margin:16px 0 0}
.w4-tab{display:inline-flex;align-items:center;justify-content:center;gap:8px;min-height:44px;box-sizing:border-box;padding:4px 16px;border:1px solid var(--line);border-radius:6px;
  background:var(--surface);color:var(--ink);font-size:14px;line-height:18px;font-weight:600;text-align:center;text-decoration:none}
.w4-tab small{font-size:12px;font-weight:400;color:var(--muted)}
.w4-tab[aria-current]{background:var(--action-fill);border-color:var(--action-fill);color:var(--on-primary)}
.w4-tab[aria-current] small{color:inherit}
@media (hover:hover) and (pointer:fine){.w4-tab:not([aria-current]):hover{border-color:var(--green);color:var(--green)}}
.w4-tab:focus-visible{outline:2px solid var(--focus);outline-offset:2px}
@media (max-width:767px){.w4-tabs{display:grid;grid-template-columns:repeat(3,minmax(0,1fr))}.w4-tab{padding:4px 8px;gap:6px}}

/* 2. /deals (M-232): on a phone the six category buttons stay three to a row and the two filter buttons share the last row */
@media (max-width:767px){.dq-cats:has(.dq-filter){grid-template-columns:repeat(6,minmax(0,1fr))}.dq-cats:has(.dq-filter)>.dq-cat{grid-column:span 2}.dq-cats:has(.dq-filter)>.dq-filter{grid-column:span 3}}

/* 3. /distributors: rows that fill. Each card carries its row's length (--d2 ... --d8: wave4.balanced_dir) and takes that share of the row. */
.dir-grid.w4-bal{display:flex;flex-wrap:wrap;gap:10px}
.dir-grid.w4-bal>*{flex:1 1 100%;min-width:0;box-sizing:border-box}
@media (min-width:520px){.dir-grid.w4-bal>*{flex-basis:calc((100% - (var(--d2) - 1) * 10px) / var(--d2) - 1px)}}
@media (min-width:720px){.dir-grid.w4-bal>*{flex-basis:calc((100% - (var(--d3) - 1) * 10px) / var(--d3) - 1px)}}
@media (min-width:960px){.dir-grid.w4-bal>*{flex-basis:calc((100% - (var(--d4) - 1) * 10px) / var(--d4) - 1px)}}
@media (min-width:1200px){.dir-grid.w4-bal>*{flex-basis:calc((100% - (var(--d5) - 1) * 10px) / var(--d5) - 1px)}}
@media (min-width:1440px){.dir-grid.w4-bal>*{flex-basis:calc((100% - (var(--d6) - 1) * 10px) / var(--d6) - 1px)}}
@media (min-width:1800px){.dir-grid.w4-bal>*{flex-basis:calc((100% - (var(--d8) - 1) * 10px) / var(--d8) - 1px)}}

/* 4. Similar products: as many columns as cards from 761 px (sim-nN: wave4.similar_grid), so the row fills; a single card keeps a card's width */
@media (min-width:761px){
  .product-grid.sim-grid.sim-n3{grid-template-columns:repeat(3,minmax(0,1fr))}
  .product-grid.sim-grid.sim-n2{grid-template-columns:repeat(2,minmax(0,1fr))}
  .product-grid.sim-grid.sim-n1{grid-template-columns:minmax(0,1fr);max-width:440px}
}

/* 5. Product page: the store's name opens its store page (M-024), as the page's other text links; the refurbished fold (M-025) */
#sellers .pm-sname a{color:inherit;text-decoration:none}
@media (hover:hover) and (pointer:fine){#sellers .pm-sname a:hover{text-decoration:underline}}
#sellers .pm-sname a:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:6px}
.w4-refurb{margin-top:16px}
.w4-refurb>summary{display:flex;align-items:center;min-height:44px;cursor:pointer;font-size:16px;font-weight:600;color:var(--ink)}
.w4-refurb>summary:focus-visible{outline:2px solid var(--focus);outline-offset:2px;border-radius:6px}
.w4-refurb>.table-wrap{margin-top:8px}
