/* The Community search: a Card Search-style sidebar beside a results column, with category
   tabs across the top of the results. Loaded by community.html only, after /styles.css, so
   these rules win ties against the shared community.css rules they refine. */

.community-browser-head{display:flex;flex-wrap:wrap;justify-content:space-between;align-items:end;gap:18px 24px;margin-bottom:22px}
.community-shelf-controls{display:flex;flex-wrap:wrap;align-items:center;gap:10px}
/* With the hero gone, the browser is the page: it starts under the header with a real h1. */
.community-page{width:100%;max-width:none;padding:28px clamp(16px,2vw,34px) 70px}
.community-browser{padding:clamp(20px,2vw,34px)}
.community-browser-head h1{margin:0;font:var(--text-4xl) Georgia,serif}
.community-lede{margin:6px 0 0;color:var(--muted);font-size:var(--text-xs);max-width:620px}

/* Current legal · Upcoming sets · All — the same segmented look as the Decks/Packages switch
   beside it, because it is the same kind of choice: which shelf, not which filter. */
.community-release{display:inline-flex;height:28px;border:1px solid var(--line-strong);border-radius:4px;overflow:hidden;background:var(--surface-raised)}
.community-release button{border:0;border-right:1px solid var(--line);background:transparent;color:var(--muted);padding:0 11px;font:700 var(--text-2xs)/1 inherit;cursor:pointer;white-space:nowrap}
.community-release button:last-child{border-right:0}
.community-release button:hover{color:var(--ink);background:var(--surface-muted)}
.community-release button.active{color:var(--green2);background:var(--accent-soft)}
.community-release button[data-release="upcoming"].active{color:var(--copper)}
.community-release button:focus-visible{outline:2px solid var(--green2);outline-offset:-2px}

.community-layout{display:grid;grid-template-columns:minmax(270px,310px) minmax(0,1fr);gap:clamp(18px,2vw,30px);align-items:start}
.community-refine{position:sticky;top:96px;padding:20px;box-shadow:none;max-height:calc(100vh - 116px);overflow-y:auto;overscroll-behavior:contain;scrollbar-width:thin}
.community-refine .panel-title{margin-bottom:12px}
.community-refine .panel-title h2{font:var(--text-xl) Georgia,serif}
.community-refine .community-query-label{position:absolute;width:1px;height:1px;margin:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap}
.community-refine .search{width:100%}
/* Direct children only: the mana checkboxes are labels too, and must keep their 32px circles. */
.community-fields>label{display:grid;gap:4px;width:100%;margin:0;color:var(--muted);font-size:var(--text-2xs);text-transform:uppercase;letter-spacing:.1em}
.community-fields>label input{margin:0;text-transform:none;letter-spacing:normal}
.community-refine select{width:100%}
/* Not `.community-filters`: community.css still styles that name as the old row of format
   chips, and those rules would turn this column into a wrapping row of pills. */
.community-fields{display:grid;grid-template-columns:1fr;gap:9px;margin-top:12px}
.community-fields select{margin:0;padding:9px 10px;font-size:var(--text-2xs)}
.community-fields input{padding:10px 11px}
/* All six colors on one row. At the sidebar's 290px the fieldset has about 226px inside it,
   and six 32px circles with 7px gaps need 227 — so they wrapped one onto a second line. The gap
   is tighter here and the circles may shrink a little, never below 24px, rather than wrap. */
.community-fields .color-filter{flex-wrap:nowrap;gap:5px;justify-content:space-between;margin:0}
/* community.css sizes every label in the browser to min(380px,100%), which outranks the 32px
   `.mana-check` circle from filters.css — and the symbol inside is 100% of its label. Pinned
   back here so each color is the same small circle it is on Card Search. */
.community-fields .color-filter .mana-check{width:32px;height:32px;flex:0 1 32px;min-width:24px;height:auto;aspect-ratio:1;margin:0}
.community-fields .filter-clear{border:0;background:transparent;color:var(--green2);padding:5px;cursor:pointer;font-size:var(--text-2xs);font-weight:700;text-transform:uppercase;letter-spacing:.12em}
/* The filters fold away on a phone, where they would otherwise stand between the query and
   the results. On a wide screen they are always open and the summary is not shown. */
.community-filter-panel>summary{display:none}
.community-inline-add{display:flex;gap:6px}
.community-inline-add input{flex:1;min-width:0}
.community-inline-add button{padding:8px 10px}

.community-syntax{margin:8px 0 2px;font-size:var(--text-2xs);color:var(--muted)}
.community-syntax summary{color:var(--green2);font-weight:700;cursor:pointer}
.community-syntax p{margin:8px 0}
.community-syntax dl{display:grid;gap:7px;margin:0}
.community-syntax dt{display:flex;flex-wrap:wrap;gap:4px}
.community-syntax dd{margin:0 0 2px;line-height:1.45}
.community-syntax code{background:var(--surface-muted);color:var(--green2);padding:2px 5px;font:700 var(--text-2xs) system-ui}

.community-results{min-width:0}
.community-results-controls{position:sticky;top:76px;z-index:8;margin:-8px 0 0;padding:12px;border:1px solid var(--line);border-radius:4px;background:var(--surface);box-shadow:var(--shadow)}
.community-results-topline{display:flex;align-items:end;gap:16px}
.community-results-topline .community-tabs{flex:1 1 auto;min-width:0}
.community-results-topline .community-shelf-controls{flex:0 0 auto;padding-bottom:3px}
/* One row that scrolls sideways on a narrow screen rather than wrapping into three. */
.community-tabs{display:flex;gap:4px;overflow-x:auto;padding-bottom:2px;border-bottom:1px solid var(--line);scrollbar-width:thin}
.community-tabs button{flex:0 0 auto;padding:10px 13px;border:0;border-bottom:2px solid transparent;margin-bottom:-1px;background:transparent;color:var(--muted);font-weight:700;font-size:var(--text-xs);cursor:pointer;white-space:nowrap}
.community-tabs button:hover{color:var(--ink)}
.community-tabs button.active{color:var(--green2);border-bottom-color:var(--green2)}
.community-tabs button:focus-visible{outline:2px solid var(--green2);outline-offset:-2px}

.community-toolbar{display:flex;flex-wrap:wrap;align-items:center;justify-content:space-between;gap:10px 16px;padding:12px 0 2px}
.community-chips{display:flex;flex-wrap:wrap;gap:6px;min-width:0}
.community-chip{display:inline-flex;align-items:center;gap:6px;max-width:100%;padding:5px 9px;border:1px solid var(--green);border-radius:999px;background:var(--accent-soft);color:var(--green2);font-size:var(--text-2xs);font-weight:700;cursor:pointer}
.community-chip>span:not(.community-chip-symbols){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}
.community-chip:hover{border-color:var(--danger);color:var(--danger)}
.community-chip-symbols{display:inline-flex;gap:2px}
.community-chip-symbols img{width:13px;height:13px}
.community-sort-label{display:flex;align-items:center;gap:8px;margin:0 0 0 auto;color:var(--muted);font-size:var(--text-2xs);text-transform:uppercase;letter-spacing:.1em}
.community-sort-label select{width:auto;margin:0;padding:7px 9px;font-size:var(--text-2xs)}

/* Fill every available row in the results column, including the former right margin. */
.community-layout .community-grid{grid-template-columns:repeat(auto-fill,minmax(210px,1fr))}
.community-deck-upcoming{border-left-color:var(--copper)!important}

/* Category cards: the same footprint as a deck card, so switching tabs does not reflow the
   page, with the category's art behind its name and its deck count beneath. */
.community-category-card{position:relative;display:flex;flex-direction:column;justify-content:flex-end;gap:3px;min-width:0;height:150px;padding:14px;overflow:hidden;isolation:isolate;border:1px solid var(--line);border-left:3px solid var(--copper);background:var(--surface-raised);color:var(--ink);text-align:left;cursor:pointer}
.community-category-card:hover,.community-category-card:focus-visible{border-color:var(--green)}
.community-category-card:focus-visible{outline:2px solid var(--green2);outline-offset:2px}
.community-category-card strong{font:var(--text-l) Georgia,serif;overflow:hidden;text-overflow:ellipsis;display:-webkit-box;-webkit-line-clamp:2;-webkit-box-orient:vertical}
.community-category-card small{color:var(--muted);font-size:var(--text-2xs)}
.community-category-art,.community-category-scrim{position:absolute;inset:0;width:100%;height:100%;pointer-events:none}
.community-category-art{z-index:-2;object-fit:cover;object-position:center 18%;transform:scale(1.12);filter:saturate(.85);transition:transform .25s}
.community-category-scrim{z-index:-1;background:linear-gradient(180deg,rgba(12,18,15,.08) 0%,rgba(12,18,15,.45) 45%,rgba(12,18,15,.94) 100%)}
.community-category-card.has-art{color:var(--on-inverse)}
.community-category-card.has-art strong{text-shadow:0 1px 3px rgba(0,0,0,.8)}
.community-category-card.has-art small{color:rgba(244,239,228,.82)}
.community-category-card.has-art:hover .community-category-art{transform:scale(1.18)}
/* A builder's own picture is usually a face or a square logo: centre it, and zoom it less. */
.community-category-art.community-avatar-art{object-position:center;transform:none}
.community-category-card.has-art:hover .community-avatar-art{transform:scale(1.05)}
/* Two commanders. Each art is a 60%-wide box centred on its own half of the card — at 25% and
   75% — so each commander sits in the middle of the half it owns rather than drifting toward
   the seam. The left box runs from -5% to 55% and fades out over its last sixth, which is the
   45–55% band of the card, onto the right art underneath it. */
.community-pair-art{transform:none;object-position:center 18%}
.community-pair-left{z-index:-2;left:-5%;width:60%;-webkit-mask-image:linear-gradient(90deg,black 83%,transparent);mask-image:linear-gradient(90deg,black 83%,transparent)}
.community-pair-right{z-index:-3;left:45%;width:60%}
.community-category-card.has-pair-art:hover .community-category-art{transform:scale(1.05)}
/* Same top-left slot as a deck card's colors, and the same rule: stop short of the badges. */
.community-category-symbols{position:absolute;z-index:3;top:12px;left:14px;display:flex;gap:4px;max-width:calc(100% - 92px)}
/* Color identity cards have no art, so each color is a radial glow of its own mana token,
   spread across the card (see colorWash in community.js), under the same scrim as art. */
/* Oversized and centred so the rays run past every edge of the card rather than stopping at
   a visible corner; the hover turns the burst a few degrees instead of zooming it. */
.community-color-wash{position:absolute;inset:-40%;z-index:-2;pointer-events:none;transition:transform .6s ease;filter:saturate(1.35) brightness(1.08)}
.community-category-card.has-color-wash{color:var(--on-inverse)}
.community-category-card.has-color-wash strong{text-shadow:0 1px 3px rgba(0,0,0,.7)}
.community-category-card.has-color-wash small{color:var(--on-inverse);opacity:.85}
/* Only under the text: a scrim across the whole card greys every color toward the same mud. */
.community-category-card.has-color-wash .community-category-scrim{background:linear-gradient(180deg,transparent 55%,rgba(12,18,15,.62) 100%)}
.community-category-card.has-color-wash:hover .community-color-wash{transform:rotate(12deg)}
.community-category-symbols img{flex:0 1 26px;min-width:16px;width:26px;height:auto;aspect-ratio:1;filter:drop-shadow(0 1px 2px rgba(0,0,0,.35))}

@media(max-width:1050px){
  .community-results-topline{align-items:stretch;flex-direction:column;gap:8px}
  .community-results-topline .community-shelf-controls{padding-bottom:0}
}
/* Below the Card Search breakpoint the sidebar stops being a sidebar: it sits above the
   results, unstuck, and the page scrolls as one. */
@media(max-width:850px){
  .community-layout{grid-template-columns:1fr}
  .community-refine{position:static;max-height:none;overflow:visible}
  .community-results-controls{position:static;margin:0;padding-top:0}
  .community-filter-panel>summary{display:block;margin-top:10px;padding:9px 0;color:var(--green2);font-size:var(--text-xs);font-weight:700;cursor:pointer}
  .community-layout .community-grid{grid-template-columns:repeat(3,minmax(0,1fr))}
}
@media(max-width:640px){
  .community-browser-head{align-items:stretch;flex-direction:column}
  .community-shelf-controls{flex-direction:column;align-items:stretch}
  .community-release,.community-shelf-controls .library-kind-control{display:flex;width:100%}
  .community-release button,.community-shelf-controls .library-kind-control button{flex:1}
  .community-layout .community-grid{grid-template-columns:repeat(2,minmax(0,1fr))}
  .community-sort-label{margin-left:0}
}
@media(max-width:400px){.community-layout .community-grid{grid-template-columns:1fr}}
