/* The catalogue page: its facets, the controls only it carries in the shared
   search row, and what its cards show beyond the shared tile (browse.css) —
   the range pill, the collection marks. */

#sortBtn{font-weight:500} /* a reading control, quieter than the action buttons */
#filtersBtn{display:none}
#filtersBtn .badge{background:var(--accent);color:var(--accent-ink);border-radius:99px;padding:0 6px;font-size:11px;font-weight:700}

/* ---------- facets ---------- */
/* only the vertical axis may scroll, in a stable gutter — a diagonal
   trackpad gesture must never nudge the column sideways. The sticky top
   equals the column's resting offset (113px header + 20px page padding,
   plus the status bar the header pads for),
   so pinning never makes it slide. */
aside{position:sticky;top:calc(133px + env(safe-area-inset-top));max-height:calc(100vh - 145px - env(safe-area-inset-top));overflow-y:auto;overflow-x:hidden;scrollbar-gutter:stable;padding-right:4px}
aside::-webkit-scrollbar{width:8px} aside::-webkit-scrollbar-thumb{background:var(--line);border-radius:9px}
.grp{margin-bottom:22px}
.grp h2{margin:0 0 9px;display:flex;align-items:center;gap:6px}
.grp h2 .src{font-weight:500;letter-spacing:0;text-transform:none;font-size:10px;opacity:.8}
/* the filter panel's head: what is active, and the way out of it */
.fgrab{display:none;width:36px;height:4px;border-radius:99px;background:var(--line);margin:8px auto 4px;flex:none}
.fhead{display:flex;align-items:center;gap:10px;margin-bottom:14px}
.fhead b{font-size:15px;letter-spacing:-.01em}
.factive{font-size:12.5px;color:var(--ink-3);flex:1}
/* the narrow aside: the count on its own line, the reset under it */
@media (min-width:861px){
  .fhead{flex-wrap:wrap;gap:6px 10px}
  .fhead b{display:none}
  .factive{flex:1 1 100%}
  .factive .fshort{display:none}
}
@media (max-width:860px){ .factive .flong{display:none} }
#reset{display:none;white-space:nowrap}
.fhead .closeF{display:none}
.ffoot{display:none}

/* ---------- the grid's own: the range pill and the colour's name on the swatch ---------- */
.sw .rng,.sw::after{
  position:absolute;left:7px;padding:3px 7px;border-radius:99px;
  background:rgba(255,255,255,.86);color:#1c1a17;backdrop-filter:blur(4px);
}
.sw .rng{top:7px;font-size:10px;font-weight:650;letter-spacing:.03em;text-transform:uppercase}
/* the colour's name, told on the swatch — hover only: at the finger it is the card that tells it */
.sw::after{
  content:attr(data-tip);
  bottom:7px;max-width:calc(100% - 14px);border-radius:8px;
  font-size:10.5px;font-weight:600;line-height:1.35;
  opacity:0;transform:translateY(3px);pointer-events:none;
  transition:opacity .13s ease,transform .13s ease;
}
.card:hover .sw::after{opacity:1;transform:translateY(0);transition-delay:.3s}
@media (hover:none){ .sw::after{display:none} }
.meta .px{font-size:12px;color:var(--ink-2);font-variant-numeric:tabular-nums;margin-top:auto;padding-top:5px}

/* ---------- collection marks on cards ---------- */
.marks{
  position:absolute;right:6px;top:6px;z-index:2;display:flex;gap:4px;
  opacity:0;transition:opacity .12s;
}
.card:hover .marks,.card:focus-within .marks{opacity:1}
.mark{
  width:28px;height:28px;border:0;border-radius:var(--radius-s);cursor:pointer;line-height:0;
  display:grid;place-items:center;backdrop-filter:blur(4px);
  background:rgba(255,255,255,.86);color:#57504a;
  box-shadow:0 1px 3px rgba(0,0,0,.22);
}
/* the card carries its state; at the pointer, hovering swaps it for the marks */
.statepill{
  position:absolute;right:6px;top:6px;z-index:2;display:grid;width:28px;height:28px;
  border-radius:var(--radius-s);place-items:center;color:#fff;line-height:0;
  box-shadow:0 1px 3px rgba(0,0,0,.22);transition:opacity .12s;
}
.statepill.owned{background:var(--ok)}
.statepill.wish{background:var(--warn)}
.statepill.proj{background:var(--accent);color:var(--accent-ink)}
@media (hover:hover){
  .card:hover .statepill,.card:focus-within .statepill{opacity:0}
}
@media (hover:none){ .marks{display:none} }
.mark:hover{color:#1c1a17}
.mark.on[data-mark="owned"]{background:var(--ok);color:#fff}
.mark.on[data-mark="wish"]{background:var(--warn);color:#fff}
.mark.on[data-mark="proj"]{background:var(--accent);color:var(--accent-ink)}
.card.owned{border-color:color-mix(in srgb,#2f7d4f 60%,var(--line))}
.card.wish{border-color:color-mix(in srgb,#b0472f 55%,var(--line))}

/* ---------- the load-your-own-CSV note ---------- */
.note[hidden]{display:none!important}
.note{
  margin:0 20px 12px;padding:10px 13px;border:1px solid var(--line);background:var(--panel);
  border-radius:var(--radius);font-size:13px;color:var(--ink-2);display:flex;gap:10px;align-items:center;flex-wrap:wrap;
}
.note b{color:var(--ink);font-weight:600}
.note code{background:var(--panel-2);border-radius:4px;padding:1px 5px;font-size:.92em}
.note .txt{flex:1 1 320px}
.note label{font-size:13px}
.note input[type=file]{display:none}
.note .ibtn{font-size:16px;line-height:1}

/* drag & drop */
#drop{
  position:fixed;inset:0;z-index:60;display:none;
  align-items:center;justify-content:center;
  background:color-mix(in srgb,var(--bg) 82%,transparent);backdrop-filter:blur(3px);
}
#drop.on{display:flex}
#drop .in{
  border:2px dashed var(--accent);border-radius:var(--radius-l);padding:44px 56px;text-align:center;
  background:var(--panel);box-shadow:var(--shadow);
}
#drop strong{display:block;font-size:19px;margin-bottom:6px;letter-spacing:-.01em}
#drop span{color:var(--ink-2);font-size:14px}

@media (max-width:860px){
  /* the filters become a bottom sheet: grab, fixed head, scrolling facets,
     and « Voir N peintures » pinned under the thumb */
  aside{
    position:fixed;left:0;right:0;bottom:0;top:auto;z-index:45;height:88dvh;max-height:none;
    background:var(--bg);border-top:1px solid var(--line);
    border-radius:var(--radius-l) var(--radius-l) 0 0;box-shadow:var(--shadow);
    display:none;flex-direction:column;padding:0;overflow:hidden;
  }
  aside.open{display:flex}
  .fgrab{display:block}
  .fhead{padding:6px 16px 10px;margin-bottom:0;border-bottom:1px solid var(--line)}
  .fhead .closeF{display:inline-grid}
  #facets{flex:1;overflow:auto;padding:14px 16px;-webkit-overflow-scrolling:touch}
  .ffoot{display:block;padding:10px 16px calc(10px + env(safe-area-inset-bottom));border-top:1px solid var(--line)}
  .ffoot .btn{width:100%}
  #filtersBtn{display:inline-flex}
  .chips{gap:8px}
  .chip{padding:2px 13px}
}

@media (max-width:600px){
  #sort{min-width:0}
  .meta .px{font-size:11.5px;padding-top:3px}
  .sw .rng{font-size:9.5px;padding:2px 6px;left:6px;top:6px}
}
