/* =======================================================================
   LORECRAFT · CARD BROWSER
   The look of the pages that list cards (the collection, Deck): the page
   column, the dark masthead with the logo, the filter toolbar, the warning
   line and the grid of cards with captions; the page of the collection
   (shared/collection-page.js): its top over the art, the bar above the
   cards, the sizes of the cards and the cards in text. The controls are
   built by shared/card-browser.js; the cards come from shared/card.css.

   Use on a page, after shared/base.css,
   shared/color-identity.css and shared/card.css:
     <link rel="stylesheet" href="../shared/card-browser.css">
   ======================================================================= */
:root{
  --band:var(--leather);   /* masthead: the card-back leather (shared/card.css) */
  --band-fg:var(--parchment);
  --band-muted:var(--parchment-muted);
  --warn-bg:#fbebeb;
  --warn-fg:#7a1d1d;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){--band:#0d0a12; --warn-bg:#3a1a1c; --warn-fg:#f3c4c4}
}
:root[data-theme="dark"]{--band:#0d0a12; --warn-bg:#3a1a1c; --warn-fg:#f3c4c4}

[hidden]{display:none !important}
.pad{padding-left:var(--gutter-l); padding-right:var(--gutter-r)}
.inner{max-width:var(--page-max); margin:0 auto}

/* ---------- masthead ---------- */
.mast{background:var(--band); color:var(--band-fg); padding-block:28px 24px}
.mast .inner{display:grid; gap:14px}
.mast img{width:min(420px,100%); height:auto; display:block}
.mast h1{font:700 clamp(26px,4vw,34px)/1.1 var(--display); text-wrap:balance}
.source{color:var(--band-muted); font-size:15px; font-variant-numeric:tabular-nums}
.source b{color:var(--band-fg); font-weight:500}

/* ---------- toolbar ---------- */
.tools{padding-block:18px; border-bottom:1px solid var(--line); background:var(--bg)}
.tools .inner{display:flex; flex-wrap:wrap; gap:12px 18px; align-items:center}
.group{display:flex; flex-wrap:wrap; gap:6px; align-items:center}
.group .eyebrow{margin-right:2px; white-space:nowrap}
label.group{flex-wrap:nowrap; min-width:0; max-width:100%}
label.group select{min-width:0; max-width:100%; text-overflow:ellipsis}
.seg{display:inline-flex; border:1px solid var(--line); border-radius:999px; overflow:hidden}
.seg button{font:500 15px/1 var(--sans); color:var(--fg); background:transparent; border:0; padding:8px 14px; cursor:pointer; min-height:36px}
.seg button + button{border-left:1px solid var(--line)}
.seg button[aria-pressed="true"]{background:var(--fg); color:var(--bg)}
/* the round filter buttons: a color disc (look: shared/color-identity.css), a card type icon, a rarity (its color: shared/card.css),
   a total cost or a resource circle (shared/card.css) */
.colorbtn, .typebtn, .rarbtn, .numbtn, .resbtn{display:inline-grid; place-items:center; width:34px; height:34px; border-radius:50%; border:2px solid transparent; background:var(--chip); color:var(--fg); cursor:pointer; padding:0}
.colorbtn span{display:grid; place-items:center; width:26px; height:26px; border-radius:50%}
.colorbtn svg{width:15px; height:15px}
.typebtn svg{width:20px; height:20px}
.rarbtn span{width:16px; height:16px; border-radius:50%}
.numbtn{font:700 14px/1 var(--sans)}
.resbtn .token{--size:26px}
.colorbtn[aria-pressed="true"], .typebtn[aria-pressed="true"], .rarbtn[aria-pressed="true"], .numbtn[aria-pressed="true"], .resbtn[aria-pressed="true"]{border-color:var(--fg)}
.colorbtn[aria-pressed="false"], .typebtn[aria-pressed="false"], .rarbtn[aria-pressed="false"], .numbtn[aria-pressed="false"], .resbtn[aria-pressed="false"]{opacity:.55}
select, input[type="search"]{font:400 15px/1.2 var(--sans); color:var(--fg); background:var(--surface); border:1px solid var(--line); border-radius:8px; padding:8px 10px; min-height:36px}
input[type="search"]{width:min(220px,100%)}
.btn{font:700 15px/1 var(--sans); color:var(--bg); background:var(--fg); border:0; border-radius:999px; padding:10px 16px; cursor:pointer; min-height:36px}
.btn.ghost{color:var(--fg); background:transparent; border:1px solid var(--line)}
.count{color:var(--muted); font-size:15px; font-variant-numeric:tabular-nums; margin-left:auto}
button:focus-visible, select:focus-visible, input:focus-visible{outline:2px solid var(--accent); outline-offset:2px}

/* ---------- messages ---------- */
.msg{max-width:var(--page-max); margin:18px auto 0; padding:12px 14px; border-radius:8px; background:var(--warn-bg); color:var(--warn-fg); font-size:15px}
.msg ul{margin:6px 0 0; padding-left:1.2em}

/* ---------- grid of cards ---------- */
.grid{display:grid; grid-template-columns:repeat(auto-fill, minmax(min(280px,100%),1fr)); gap:36px 24px; justify-items:center}
.grid.both{grid-template-columns:repeat(auto-fill, minmax(min(560px,100%),1fr))}
.item{display:grid; gap:10px; width:min(330px,100%); align-content:start; margin:0}
.both .item{width:min(660px,100%)}
.faces{display:grid; grid-template-columns:minmax(0,1fr); gap:14px}
.both .faces{grid-template-columns:repeat(2, minmax(0,1fr))}
@media (max-width:560px){ .both .faces{grid-template-columns:minmax(0,1fr)} }
.cap{display:grid; gap:2px}
.cap b{font:700 17px/1.2 var(--display)}
.cap small{color:var(--muted); font-size:14px}
.audio-preview{display:grid; gap:7px; padding:10px; border:1px solid var(--line); border-radius:10px; background:var(--surface)}
.audio-preview label{display:grid; gap:5px; color:var(--muted); font-size:13px}
.audio-preview select, .audio-preview audio{width:100%; min-width:0}
.qty{display:inline-block; min-width:2.1em; margin-right:.4em; padding:1px 7px; border-radius:999px; background:var(--fg); color:var(--bg);
  font:700 14px/1.35 var(--sans); text-align:center; font-variant-numeric:tabular-nums; vertical-align:2px}
.none{grid-column:1 / -1; color:var(--muted); text-align:center; padding:24px 0}

/* ---------- the page around the grid ---------- */
.page-body{padding-block:28px 72px}
/* the page's own empty notice: only inside .page-body, so it never reaches another .empty (an empty pile of the table, table.css) */
.page-body .empty{max-width:560px; margin:56px auto; text-align:center; display:grid; gap:12px; justify-items:center; color:var(--muted)}
.page-body .empty h2{font:700 24px/1.2 var(--display); color:var(--fg)}
.sr{position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); white-space:nowrap}

/* ---------- pager: a page of cards at a time ---------- */
.pager{grid-column:1 / -1; justify-self:stretch; display:flex; flex-wrap:wrap; gap:6px; align-items:center; justify-content:center}
.pager button{min-width:36px; height:36px; padding:0 10px; border-radius:999px; border:1px solid var(--line); background:transparent; color:var(--fg);
  font:500 15px/1 var(--sans); font-variant-numeric:tabular-nums; cursor:pointer}
.pager button[aria-current="page"]{background:var(--fg); color:var(--bg); border-color:var(--fg); font-weight:700}
.pager .gap{color:var(--muted); padding:0 2px}
.pager .of{color:var(--muted); font-size:15px; font-variant-numeric:tabular-nums; margin-left:8px}

/* ---------- the page of the collection (shared/collection-page.js; 24/11/2026: one page for the Collection and the player's, and
   prettier): its top, the bar above the cards, the sizes of the cards and the cards in text ---------- */
/* the top: the art of the seven Lorecraft of the colors side by side, each fading into the next, under a shade; the words over it, and a
   band of the seven colors at its foot */
.cb-hero{position:relative; isolation:isolate; overflow:hidden; background:var(--band); color:#fff; text-align:center;
  padding-block:clamp(38px, 6.5vw, 76px) clamp(30px, 4.5vw, 50px)}
.cb-hero-art{position:absolute; inset:0; z-index:-2; display:flex}
.cb-hero-art img{flex:1 1 0; min-width:0; height:100%; margin-inline:-1.6vw; object-fit:cover; object-position:center 28%;
  -webkit-mask-image:linear-gradient(90deg, transparent, #000 3.2vw, #000 calc(100% - 3.2vw), transparent);
  mask-image:linear-gradient(90deg, transparent, #000 3.2vw, #000 calc(100% - 3.2vw), transparent)}
.cb-hero-art img:first-child{margin-left:0; -webkit-mask-image:linear-gradient(90deg, #000 calc(100% - 3.2vw), transparent); mask-image:linear-gradient(90deg, #000 calc(100% - 3.2vw), transparent)}
.cb-hero-art img:last-child{margin-right:0; -webkit-mask-image:linear-gradient(90deg, transparent, #000 3.2vw); mask-image:linear-gradient(90deg, transparent, #000 3.2vw)}
.cb-hero-art img:only-child{margin:0; -webkit-mask-image:none; mask-image:none}   /* one picture (the Bazaar): from edge to edge */
.cb-hero::before{content:""; position:absolute; inset:0; z-index:-1;
  background:radial-gradient(ellipse at 50% 40%, rgb(12 9 16 / .2), rgb(12 9 16 / .62) 70%), linear-gradient(180deg, rgb(12 9 16 / .25), rgb(12 9 16 / .88))}
.cb-hero .inner{display:grid; gap:10px; justify-items:center}
.cb-logo{width:min(380px, 82%); height:auto; filter:drop-shadow(0 2px 12px rgb(0 0 0 / .65))}
.cb-hero .eyebrow{color:var(--light-fb); text-shadow:0 1px 6px rgb(0 0 0 / .8)}
.cb-hero h1{color:#fff; text-shadow:0 2px 18px rgb(0 0 0 / .7)}
.cb-hero .source{color:rgb(255 255 255 / .88); font-size:16px; text-shadow:0 1px 8px rgb(0 0 0 / .8)}
.cb-hero .source b{color:#fff; font-weight:600}
.cb-band{position:absolute; left:0; right:0; bottom:0; height:4px; display:flex}
.cb-band i{flex:1}
/* how much of the collection the player has: the cards and the share, a bar filling in the seven colors, the copies and where they came from */
.cb-have{width:min(580px, 100%); display:grid; gap:9px; margin-top:10px; padding:14px 18px 15px; border-radius:16px; text-align:left;
  background:rgb(14 11 19 / .62); border:1px solid rgb(255 255 255 / .16); box-shadow:0 10px 30px rgb(0 0 0 / .35); -webkit-backdrop-filter:blur(8px); backdrop-filter:blur(8px)}
.cb-have-line{display:flex; align-items:baseline; justify-content:space-between; gap:12px; margin:0; font:600 16px/1.3 var(--sans); color:#fff}
.cb-have-line b{font:700 22px/1 var(--display); color:var(--light-fb); font-variant-numeric:tabular-nums}
.cb-meter{--fill:0%; position:relative; height:10px; border-radius:999px; background:rgb(255 255 255 / .14); overflow:hidden}
.cb-meter i{position:absolute; inset:0; border-radius:inherit; clip-path:inset(0 calc(100% - max(var(--fill), 10px)) 0 0 round 999px);
  background:linear-gradient(90deg, var(--fire-fb), var(--frost-fb), var(--nature-fb), var(--light-fb), var(--shadow-fb), var(--arcane-fb), var(--energy-fb))}
.cb-have-more{margin:0; color:rgb(255 255 255 / .84); font-size:15px; line-height:1.45}
.cb-have-more a{color:var(--light-fb)}

/* the bar above the cards: the player's own and how many are shown on the left, how they are shown on the right */
.cb-bar{display:flex; flex-wrap:wrap; align-items:center; justify-content:space-between; gap:12px 22px; margin-bottom:26px; padding:10px 14px;
  border:1px solid var(--line); border-radius:16px; background:var(--surface); box-shadow:0 1px 2px rgb(0 0 0 / .12)}
.cb-shown{display:flex; flex-wrap:wrap; align-items:center; gap:10px 16px}
.cb-shown .count{margin-left:0}
.cb-layout{display:flex; flex-wrap:wrap; align-items:center; gap:10px 20px}
.cb-layout[data-view="text"] .sizes-group{display:none}   /* the size has nothing to do in the text */
.cb-layout .seg button{padding:7px 12px; min-height:34px; font-size:14px}
/* only the player's cards: a switch */
.cb-switch{position:relative; display:inline-flex; align-items:center; gap:10px; padding:5px 14px 5px 6px; border-radius:999px; border:1px solid var(--line);
  background:var(--chip); font:600 15px/1.2 var(--sans); cursor:pointer; user-select:none; transition:border-color .2s, background .2s}
.cb-switch input{position:absolute; opacity:0; width:1px; height:1px; margin:0}
.cb-track{position:relative; flex:none; width:40px; height:22px; border-radius:999px; background:color-mix(in srgb, var(--muted) 45%, transparent); transition:background .2s}
.cb-track::after{content:""; position:absolute; top:3px; left:3px; width:16px; height:16px; border-radius:50%; background:var(--fg); box-shadow:0 1px 3px rgb(0 0 0 / .35); transition:transform .2s}
.cb-switch:has(input:checked){border-color:var(--accent); background:color-mix(in srgb, var(--accent) 16%, var(--chip))}
.cb-switch input:checked + .cb-track{background:var(--accent)}
.cb-switch input:checked + .cb-track::after{transform:translateX(18px); background:#fff}
.cb-switch input:focus-visible + .cb-track{outline:2px solid var(--accent); outline-offset:2px}
@media (prefers-reduced-motion:reduce){ .cb-track, .cb-track::after, .cb-switch{transition:none} }
/* the sizes: each button a card of its size */
.seg.sizes button{display:grid; place-items:center; width:40px; padding:0}
.seg.sizes i{display:block; border:2px solid currentColor; border-radius:2px; aspect-ratio:5 / 7}
.seg.sizes [data-size="s"] i{height:11px}
.seg.sizes [data-size="m"] i{height:15px}
.seg.sizes [data-size="l"] i{height:19px}

/* the cards small and large (the medium is the grid's own) */
.grid[data-size="s"]{grid-template-columns:repeat(auto-fill, minmax(min(190px,100%),1fr)); gap:28px 16px}
.grid[data-size="s"] .item{width:min(232px,100%)}
.grid[data-size="s"].both{grid-template-columns:repeat(auto-fill, minmax(min(390px,100%),1fr))}
.grid[data-size="s"].both .item{width:min(464px,100%)}
.grid[data-size="s"] .cap b{font-size:15px}
.grid[data-size="s"] .cap small{font-size:12.5px}
.grid[data-size="l"]{grid-template-columns:repeat(auto-fill, minmax(min(390px,100%),1fr)); gap:44px 28px}
.grid[data-size="l"] .item{width:min(450px,100%)}
.grid[data-size="l"].both{grid-template-columns:repeat(auto-fill, minmax(min(780px,100%),1fr))}
.grid[data-size="l"].both .item{width:min(900px,100%)}

/* ---------- the cards in text: a line each, its colors down its edge; under the mouse, the card big beside it ---------- */
.grid.text{grid-template-columns:repeat(auto-fill, minmax(min(460px,100%),1fr)); gap:12px 14px; justify-items:stretch; align-items:start}
.cl-row{position:relative; display:grid; gap:6px; min-width:0; padding:12px 16px 14px 22px; border:1px solid var(--line); border-radius:14px; background:var(--surface);
  overflow:hidden; transition:border-color .15s, box-shadow .15s, transform .15s}
.cl-row::before{content:""; position:absolute; left:0; top:0; bottom:0; width:6px; background:var(--edge)}
.cl-row::after{content:""; position:absolute; inset:0; pointer-events:none; background:var(--edge); opacity:0; transition:opacity .15s}
.cl-row:hover, .cl-row:focus-visible{border-color:color-mix(in srgb, var(--fg) 30%, var(--line)); box-shadow:0 10px 26px rgb(0 0 0 / .25); transform:translateY(-1px); outline:none}
.cl-row:hover::after, .cl-row:focus-visible::after{opacity:.06}
.cl-head{display:flex; align-items:center; gap:10px; min-width:0}
.cl-type{flex:none; display:grid; place-items:center; width:26px; height:26px; color:var(--rc, var(--type-gray))}
.cl-type svg{width:22px; height:22px}
.cl-name{flex:1; min-width:0; margin:0; font:700 18px/1.2 var(--display); text-wrap:balance}
.cl-name .qty{vertical-align:2px}
.cl-stats{flex:none; padding:3px 10px; border-radius:999px; border:1px solid var(--line); background:var(--chip); font:700 15px/1.2 var(--sans); font-variant-numeric:tabular-nums; white-space:nowrap}
.cl-cost{flex:none; display:flex; gap:11px; padding-left:8px}
.cl-cost .token{--size:25px}
.cl-line{display:flex; flex-wrap:wrap; align-items:center; gap:4px 10px; margin:0; color:var(--muted); font:700 11.5px/1.35 var(--sans); letter-spacing:.07em; text-transform:uppercase}
.cl-line > span:not(.cl-colors) + span:not(.cl-colors)::before{content:"·"; margin-right:10px; color:var(--muted); opacity:.6}
.cl-rarity{color:var(--rc)}
.cl-colors{display:inline-flex; gap:4px; margin-left:auto}
.cl-color{display:inline-grid; place-items:center; width:20px; height:20px; border-radius:50%}
.cl-color svg{width:12px; height:12px}
.cl-text{display:grid; gap:5px; font:400 15px/1.45 var(--cardtext); color:var(--fg); overflow-wrap:anywhere}
.cl-text:empty{display:none}
.cl-text p{margin:0}
.cl-text .kws{gap:3px 14px}
.cl-text .reminder{color:var(--muted); font-size:.93em}
.cl-text .chips{display:flex; flex-wrap:wrap; gap:6px}
.cl-text .chip{gap:7px; padding:2px 10px 2px 7px; border-color:var(--line); color:var(--muted); font-size:11px}
.cl-text .chip > span{gap:4px}
.cl-text .chip.slots{gap:12px}
.cl-text .upgrade b, .cl-text .act-word{color:var(--accent)}
.cl-flavor{margin-top:3px !important; padding-top:7px; border-top:1px solid var(--line); color:var(--muted); font:italic 400 15px/1.4 var(--serif)}
@media (prefers-reduced-motion:reduce){ .cl-row{transition:none} .cl-row:hover, .cl-row:focus-visible{transform:none} }
@media (max-width:560px){
  .cb-bar{padding:10px 12px}
  .cb-layout{gap:10px 14px}
  .cl-row{padding:11px 12px 12px 18px}
  .cl-name{font-size:17px}
}
