/* Reference layout: full-width wrapping rounded rectangles above the book shelf. */
.discovery-page .plaza-layout { display:block; }
html[data-appearance] .discovery-page .category-sidebar { position:static; max-height:none; padding:0 0 10px; margin:0 0 10px; overflow:visible; border:0; border-radius:0; background:transparent; box-shadow:none; }
.discovery-page .plaza-main .discovery-filter-summary { margin:0 0 12px; }
.category-filter-heading,.category-filter-tools,.category-filter-bottom { display:flex; align-items:center; }
.category-filter-heading { justify-content:space-between; gap:12px; margin-bottom:12px; }
.discovery-page .category-filter-heading .category-title { display:block; margin:0; font:600 13px/1.6 var(--font-ui,system-ui); letter-spacing:0; color:var(--ink); }
.category-filter-tools { gap:12px; font-size:12px; color:var(--ink-light); white-space:nowrap; }
.category-filter-tools button,#category-fold { padding:4px 0; border:0; background:transparent; color:var(--ink-light); font:inherit; cursor:pointer; }
.category-filter-tools button:disabled { opacity:.5; cursor:default; }
.category-multiple,#category-fold { color:var(--accent-dark); }
.discovery-page .category-list { display:flex; flex-flow:row wrap; gap:8px; padding:0; overflow:visible; border:0; scroll-snap-type:none; }
html[data-appearance] .discovery-page .category-list .chip { display:inline-flex; flex:0 0 auto; justify-content:center; width:auto; min-height:30px; padding:4px 12px; border:1px solid var(--shelf-line); border-radius:8px; background:var(--site-paper); font:400 12px/1.6 var(--font-ui,system-ui); color:var(--ink); box-shadow:none; transform:none; white-space:nowrap; transition:background-color .2s,border-color .2s,color .2s; }
html[data-appearance] .discovery-page .category-list .chip.active { border-color:var(--accent); background:var(--site-soft); color:var(--accent-dark); font-weight:500; }
.discovery-page .category-list[data-collapsed="true"] .chip:nth-child(n+15):not(.active) { display:none; }
.category-filter-bottom { justify-content:flex-end; gap:12px; margin-top:14px; }
.discovery-page .category-filter-bottom .sort-options { display:inline-flex; align-items:center; padding:3px; border:1px solid var(--shelf-line); border-radius:12px; background:var(--site-paper); gap:2px; }
.discovery-page .category-filter-bottom .sort-btn { display:inline-flex; align-items:center; justify-content:center; gap:5px; padding:6px 12px; border:0; border-radius:8px; font:400 12px/1.5 var(--font-ui,system-ui); color:var(--ink-light); background:transparent; }
.discovery-page .category-filter-bottom .sort-btn.active { color:var(--accent-dark); background:var(--site-soft); box-shadow:none; }
#category-fold { display:inline-flex; flex-shrink:0; align-items:center; justify-content:center; gap:6px; min-height:36px; padding:4px 2px; border:0; border-radius:0; background:transparent; color:var(--accent-dark); font-size:12px; line-height:1.5; white-space:nowrap; transition:color .16s ease; }
#category-fold::after { content:""; display:inline-block; width:6px; height:6px; margin-top:-3px; border-right:1.5px solid currentColor; border-bottom:1.5px solid currentColor; transform:rotate(45deg); transition:transform .16s ease; }
#category-fold[aria-expanded="true"]::after { margin-top:3px; transform:rotate(225deg); }
#category-fold:hover { color:var(--accent); }
.category-filter-tools button:focus-visible,#category-fold:focus-visible,.category-list .chip:focus-visible,.category-filter-bottom .sort-btn:focus-visible { outline:2px solid var(--accent); outline-offset:3px; }
@media(max-width:768px) {
  html[data-appearance] .discovery-page .category-sidebar { position:sticky;top:8px;z-index:50;margin-bottom:14px;padding:8px 10px;border:1px solid var(--shelf-line);border-radius:12px;background:var(--site-paper);box-shadow:0 3px 14px #30204408; }
  .discovery-page .category-sidebar[data-collapsed="true"] .category-filter-heading { display:none; }
  .discovery-page .category-sidebar[data-collapsed="true"] .category-list { flex-flow:row nowrap;overflow-x:auto;overflow-y:hidden;width:calc(100% - 44px);padding:0;scrollbar-width:none;overscroll-behavior-x:contain; }
  .discovery-page .category-sidebar[data-collapsed="true"] .category-list::-webkit-scrollbar { display:none; }
  .discovery-page .category-sidebar .category-list[data-collapsed="true"] .chip:nth-child(n+15):not(.active) { display:inline-flex; }
  .category-sidebar[data-collapsed="true"] .category-filter-bottom { position:absolute;top:6px;right:10px;margin:0; }
  .category-sidebar[data-collapsed="true"] .sort-options { display:none; }
  .discovery-page .category-sidebar[data-collapsed="false"] { max-height:calc(100dvh - 110px - env(safe-area-inset-bottom,0px));overflow-y:auto;overscroll-behavior-y:contain; }
  .category-filter-heading { gap:6px; margin-bottom:7px; }
  .discovery-page .category-filter-heading .category-title { font-size:12px; }
  .category-filter-tools { gap:7px; font-size:10px; }
  .category-filter-bottom { margin-top:5px; }
}
@media(max-width:768px) {
  .discovery-page .search-bar { gap:6px;margin-bottom:14px; }
  .discovery-page .search-input { min-height:40px;padding-top:7px;padding-bottom:7px; }
  .discovery-page .search-btn { min-height:40px;padding:7px 14px; }
  html[data-appearance] .discovery-page .category-sidebar { padding:3px 7px;margin-bottom:6px; }
  .discovery-page .category-list { gap:4px; }
  html[data-appearance] .discovery-page .category-list .chip { min-width:28px;min-height:30px;padding:3px 7px;font-size:10px; }
  #category-fold { min-height:30px;padding-block:3px;font-size:11px; }
  .category-sidebar[data-collapsed="true"] .category-filter-bottom { top:3px;right:7px; }
}
