/* Collections browser: sticky left filter rail + gallery, the way the 2022 site had it.
   The rail owns the ONE scrollbar on the page's chrome — individual trait groups grow
   inline instead of each getting their own little scroll box. */

.collection-layout {
  display: grid;
  grid-template-columns: 250px minmax(0, 1fr);
  gap: 28px;
  align-items: start;
}

/* ---- rail ---- */

.filter-rail {
  position: sticky;
  top: 84px;
  max-height: calc(100vh - 110px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding-right: 6px;
  scrollbar-width: thin;
  scrollbar-color: rgba(242, 185, 59, .35) transparent;
}
.filter-rail::-webkit-scrollbar { width: 6px; }
.filter-rail::-webkit-scrollbar-thumb { background: rgba(242, 185, 59, .3); border-radius: 3px; }
.filter-rail::-webkit-scrollbar-track { background: transparent; }

.rail-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 0 2px 10px;
  border-bottom: 1px solid rgba(242, 185, 59, .18);
  margin-bottom: 6px;
}
.rail-head h3 { margin: 0; font-size: 17px; color: #f5c778; flex: 1; }
.rail-close { display: none; background: none; border: none; color: #8a7a52; font-size: 26px; line-height: 1; cursor: pointer; }

.f-group { border-bottom: 1px solid rgba(242, 185, 59, .12); }
.f-group summary {
  cursor: pointer;
  padding: 11px 2px;
  font-weight: 600;
  font-size: 14px;
  letter-spacing: .02em;
  color: #f0c987;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 8px;
}
.f-group summary::-webkit-details-marker { display: none; }
.f-group summary::after { content: '＋'; margin-left: auto; opacity: .45; font-size: 13px; }
.f-group[open] summary::after { content: '－'; }
.f-count { color: #ff9d5c; font-size: 12px; font-weight: 600; }

.f-options { padding: 0 0 10px; }
.f-opt {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px 8px;
  border-radius: 7px;
  font-size: 13.5px;
  cursor: pointer;
}
.f-opt:hover { background: rgba(242, 185, 59, .09); }
.f-opt input { accent-color: #f2b93b; width: 14px; height: 14px; flex: none; }
.f-opt span { flex: 1; }
.f-opt em { font-style: normal; opacity: .45; font-size: 11.5px; }

/* ---- main column ---- */

.collection-main { min-width: 0; }
.rail-toggle { display: none; }
#filter-bar select {
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(242, 185, 59, .28);
  background: rgba(21, 18, 10, .9);
  color: #f0c987;
  font: inherit;
  font-size: 14px;
}

.active-chips { display: flex; flex-wrap: wrap; gap: 7px; margin: 0 0 16px; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px 4px 12px;
  border-radius: 999px;
  background: rgba(242, 185, 59, .13);
  border: 1px solid rgba(242, 185, 59, .3);
  color: #f0c987;
  font-size: 12.5px;
}
.chip button { background: none; border: none; color: inherit; opacity: .6; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.chip button:hover { opacity: 1; }

.g-rank { display: block; font-size: 12px; opacity: .6; margin-top: 2px; }
.g-pass {
  display: inline-block;
  margin-top: 6px;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  color: #1a1408;
  background: var(--grad);
}

/* ---- phones: the rail becomes a drawer ---- */

@media (max-width: 900px) {
  .collection-layout { grid-template-columns: 1fr; gap: 0; }
  .rail-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .filter-rail {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: min(310px, 86vw);
    max-height: none;
    z-index: 1001;
    background: #12100a;
    border-right: 1px solid rgba(242, 185, 59, .25);
    padding: 18px 14px;
    transform: translateX(-102%);
    transition: transform .22s ease;
  }
  .filter-rail.open { transform: none; }
  .rail-close { display: block; }
  .rail-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, .6);
    z-index: 1000;
  }
}
