/* The Books page (Views/Books/Index.cshtml, catalog.js): a banner in the blog's style
   (blog.css .blog-hero) with three Recommended books and the search, then a filter
   panel on the left that folds to a strip of icons (a sheet behind a Filters button on
   phones), quick buttons, the results bar and the usual shelf tiles (book-shelf.css,
   unchanged). Its colours follow the book page (book-page.css). Night mode at the end. */

.cat-hero,
.cat-studio {
  --cat-ink: #18211a;
  --cat-muted: #5f6a5b;
  --cat-line: #e1e6da;
  --cat-panel: #fff;
  --cat-soft: #fafbf8;
  --cat-blue: #1d4ed8;
  --cat-blue-soft: #eaf0fd;
  --cat-blue-ring: #c9d6f7;
  --cat-blue-deep: #1e3a8a;
  --cat-gold-soft: #fbf3dc;
  --cat-dots: #c7cebe;
}

/* ---- The banner ---- */
.cat-hero {
  position: relative;
  overflow: hidden;
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  justify-content: space-between;
  gap: 1.25rem 2rem;
  /* The blog banner's own margin and padding (blog.css .blog-hero), so both are the same height. */
  margin: 1.5rem 0 1.25rem;
  padding: 2.25rem 2rem;
  border-radius: 1.25rem;
  color: #fff;
  background:
    radial-gradient(circle at 85% 15%, rgba(212, 175, 55, 0.35), transparent 45%),
    linear-gradient(135deg, var(--bb-blue-900, #1e3a8a) 0%, var(--bb-blue-700, #1d4ed8) 55%, var(--bb-sage-700, #536440) 100%);
  box-shadow: 0 18px 40px -24px rgba(30, 58, 138, 0.7);
}
.cat-hero::after {
  content: "";
  position: absolute;
  right: -40px;
  bottom: -60px;
  width: 260px;
  height: 260px;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.12);
  box-shadow: 0 0 0 30px rgba(255, 255, 255, 0.04), 0 0 0 60px rgba(255, 255, 255, 0.03);
  pointer-events: none;
}
/* Text column: the blog banner's rows (eyebrow, title, line, one row of buttons). */
.cat-hero-text { position: relative; z-index: 1; max-width: 40rem; }
.cat-hero-eyebrow { display: inline-block; margin-bottom: 0.5rem; font-size: 0.75rem; font-weight: 700; letter-spacing: 0.12em; text-transform: uppercase; color: var(--bb-gold-400, #e3c567); }
.cat-hero h1 { margin: 0 0 0.5rem; color: #fff; font-size: clamp(1.6rem, 3.5vw, 2.4rem); font-weight: 800; line-height: 1.15; overflow-wrap: anywhere; }
.cat-hero p { margin: 0; color: rgba(255, 255, 255, 0.85); }
.cat-hero-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; min-height: 2.65rem; margin-top: 1rem; }
.cat-hero-actions a { padding: 0.45rem 0.85rem; border-radius: 0.65rem; font-size: 0.85rem; font-weight: 700; text-decoration: none; }
.cat-hero-stat { padding: 0.15rem 0.7rem; border: 1px solid rgba(255, 255, 255, 0.18); border-radius: 999px; background: rgba(255, 255, 255, 0.12); font-size: 0.8rem; color: rgba(255, 255, 255, 0.9); white-space: nowrap; }
.cat-hero-stat b { color: #fff; font-weight: 800; font-variant-numeric: tabular-nums; }
.cat-hero-deals { background: #f2c94c; color: #3a2c00; }
.cat-hero-deals:hover { background: #f5d46b; color: #3a2c00; }
.cat-hero-sell { border: 1px solid rgba(255, 255, 255, 0.45); color: #fff; }
.cat-hero-sell:hover { background: rgba(255, 255, 255, 0.12); color: #fff; }

/* Search at the bottom right, as on the blog. On computers the covers stand above it
   (taken out of the flow), so they never make the banner taller than the blog's. */
.cat-hero-side { position: relative; z-index: 1; display: grid; gap: 0.9rem; justify-items: end; flex: 1 1 20rem; max-width: 30rem; }
.cat-hero-picks { display: grid; justify-items: center; gap: 0.35rem; width: 100%; }
@media (min-width: 992px) {
  /* Computers: always the blog banner's height (261px with its usual text) and both
     halves side by side, the text wrapping and the search narrowing instead of moving below. */
  .cat-hero { flex-wrap: nowrap; min-height: 16.3125rem; }
  .cat-hero-text { flex: 1 1 auto; min-width: 0; }
  .cat-hero-side { flex: 0 1 26rem; min-width: 0; }
  .cat-hero-picks { position: absolute; left: 0; right: 0; bottom: calc(100% + 0.6rem); }
}
@media (min-width: 992px) and (max-width: 1199.98px) {
  .cat-search-ai span { display: none; }
}
.cat-hero-picks-label { font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--bb-gold-400, #e3c567); }

/* Up to five covers fanned like a hand of cards: the middle one biggest and in front.
   Sizes are in em so the whole fan scales with its font-size on narrower screens. */
.cat-hero-fan { display: flex; align-items: flex-end; justify-content: center; height: 9.6em; font-size: 14px; }
.cat-hero-fan a { position: relative; display: block; flex: none; width: 5.3em; border-radius: 2px 6px 6px 2px; transition: transform 0.25s ease, box-shadow 0.25s ease; box-shadow: 0 12px 20px -10px rgba(0, 0, 0, 0.65); }
.cat-hero-fan img { display: block; width: 100%; aspect-ratio: 2 / 3; object-fit: cover; border-radius: inherit; border: 1px solid rgba(255, 255, 255, 0.2); background: rgba(255, 255, 255, 0.2); box-shadow: inset 3px 0 0 rgba(0, 0, 0, 0.2); }
.cat-hero-pdf { position: absolute; top: 5px; right: 5px; padding: 1px 4px; border-radius: 2px; background: #dc2626; color: #fff; font-size: 0.58rem; font-weight: 700; line-height: 1.1; }

.cat-hero-fan.is-5 a:nth-child(1) { z-index: 1; width: 4.6em; transform: rotate(-14deg) translate(2.3em, 0.45em); }
.cat-hero-fan.is-5 a:nth-child(2) { z-index: 2; transform: rotate(-7deg) translateX(1.1em); }
.cat-hero-fan.is-5 a:nth-child(3) { z-index: 3; width: 6em; transform: translateY(-0.7em); }
.cat-hero-fan.is-5 a:nth-child(4) { z-index: 2; transform: rotate(7deg) translateX(-1.1em); }
.cat-hero-fan.is-5 a:nth-child(5) { z-index: 1; width: 4.6em; transform: rotate(14deg) translate(-2.3em, 0.45em); }

.cat-hero-fan.is-4 a:nth-child(1) { z-index: 1; width: 4.9em; transform: rotate(-11deg) translate(1.5em, 0.3em); }
.cat-hero-fan.is-4 a:nth-child(2) { z-index: 2; width: 5.7em; transform: rotate(-4deg) translate(0.45em, -0.5em); }
.cat-hero-fan.is-4 a:nth-child(3) { z-index: 2; width: 5.7em; transform: rotate(4deg) translate(-0.45em, -0.5em); }
.cat-hero-fan.is-4 a:nth-child(4) { z-index: 1; width: 4.9em; transform: rotate(11deg) translate(-1.5em, 0.3em); }

.cat-hero-fan.is-3 a:nth-child(1) { transform: rotate(-9deg) translateX(1.4em); }
.cat-hero-fan.is-3 a:nth-child(2) { z-index: 1; width: 6em; transform: translateY(-0.7em); }
.cat-hero-fan.is-3 a:nth-child(3) { transform: rotate(8deg) translateX(-1.4em); }
.cat-hero-fan.is-2 a:nth-child(1) { transform: rotate(-6deg) translateX(0.5em); }
.cat-hero-fan.is-2 a:nth-child(2) { z-index: 1; transform: rotate(5deg) translateX(-0.5em); }

/* Pointing at a cover lifts it out of the fan. As specific as the fan rules above
   (and after them), or their tilt would win and the cover wouldn't move. */
.cat-hero-fan.cat-hero-fan a:hover,
.cat-hero-fan.cat-hero-fan a:focus-visible { z-index: 5; transform: translateY(-1em) rotate(0) scale(1.06); box-shadow: 0 20px 28px -12px rgba(0, 0, 0, 0.75); outline-color: #e3c567; }

/* Narrower screens (the banner's two halves get less room): a smaller fan. */
@media (max-width: 1199.98px) { .cat-hero-fan { font-size: 13px; } }
@media (max-width: 991.98px) { .cat-hero-fan { font-size: 13px; } }

.cat-search { display: flex; align-items: center; gap: 0.4rem; width: 100%; padding: 0.25rem 0.25rem 0.25rem 0.9rem; border-radius: 999px; background: #fff; color: var(--bb-sage-700, #536440); box-shadow: 0 12px 26px -16px rgba(0, 0, 0, 0.6); }
.cat-search input { flex: 1; min-width: 0; padding: 0.4rem 0; border: 0; outline: 0; background: none; color: #18211a; font-size: 0.95rem; }
.cat-search-go { padding: 0.42rem 0.9rem; border: 0; border-radius: 999px; background: var(--bb-blue-600, #1d4ed8); color: #fff; font-size: 0.82rem; font-weight: 700; }
.cat-search-ai { display: inline-flex; align-items: center; gap: 0.3rem; padding: 0.42rem 0.75rem; border-radius: 999px; background: #fbf3dc; color: #7a4f00; font-size: 0.8rem; font-weight: 700; white-space: nowrap; text-decoration: none; }
.cat-search-ai:hover { background: #f7e8bd; color: #7a4f00; }

/* ---- Panel | books ---- */
.cat-studio { display: grid; grid-template-columns: 236px minmax(0, 1fr); gap: 1.5rem; align-items: start; margin-bottom: 1rem; }
.cat-studio.is-folded { grid-template-columns: 52px minmax(0, 1fr); }
.cat-main { display: grid; gap: 1rem; min-width: 0; container-type: inline-size; container-name: catalog; }

/* ---- The filter panel ---- */
.cat-panel { position: sticky; top: 1rem; display: grid; gap: 2px; align-content: start; min-width: 0; max-height: calc(100vh - 2rem); overflow-y: auto; padding: 0.5rem; border: 1px solid var(--cat-line); border-radius: 1rem; background: var(--cat-panel); scrollbar-width: thin; }
.cat-panel-head { display: flex; align-items: center; justify-content: space-between; gap: 0.4rem; padding: 0.2rem 0.2rem 0.4rem 0.45rem; }
.cat-panel-head b { display: flex; align-items: center; gap: 0.4rem; font-size: 0.95rem; font-weight: 800; color: var(--cat-ink); }
.cat-panel-head b em { padding: 0 0.45rem; border-radius: 999px; background: var(--cat-blue); color: #fff; font-size: 0.7rem; font-style: normal; font-weight: 700; }
.cat-fold { display: grid; place-items: center; width: 30px; height: 30px; padding: 0; border: 1px solid var(--cat-line); border-radius: 0.55rem; background: var(--cat-panel); color: var(--cat-muted); }
.cat-fold:hover { border-color: var(--cat-blue-ring); color: var(--cat-blue); }
.cat-fold-out { display: none; }
.cat-sheet-apply { display: none; }

.cat-sec { border-top: 1px solid var(--cat-line); }
.cat-sec > summary { display: flex; align-items: center; gap: 0.4rem; padding: 0.55rem 0.45rem 0.4rem; list-style: none; cursor: pointer; font-size: 0.7rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cat-muted); }
.cat-sec > summary::-webkit-details-marker { display: none; }
.cat-sec > summary::after { content: ""; width: 7px; height: 7px; margin-left: auto; border: solid currentColor; border-width: 0 2px 2px 0; transform: rotate(45deg) translateY(-2px); transition: transform 0.2s; }
.cat-sec:not([open]) > summary::after { transform: rotate(-45deg); }
.cat-sec > summary i { padding: 0 0.4rem; border-radius: 999px; background: var(--cat-blue-soft); color: var(--cat-blue); font-size: 0.7rem; font-style: normal; letter-spacing: 0; text-transform: none; }

.cat-opts { display: grid; gap: 1px; padding-bottom: 0.45rem; }
.cat-opts.is-trimmed .is-extra { display: none; }
.cat-opt { position: relative; display: flex; align-items: center; gap: 0.5rem; margin: 0; padding: 0.3rem 0.45rem; border-radius: 0.55rem; cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--cat-ink); }
.cat-opt:hover { background: var(--cat-soft); }
.cat-opt input { position: absolute; opacity: 0; pointer-events: none; }
.cat-box { display: grid; place-items: center; flex: none; width: 16px; height: 16px; border: 1.5px solid #b8c2ac; border-radius: 5px; }
.cat-opt input:checked + .cat-box { border-color: var(--cat-blue); background: var(--cat-blue); }
.cat-opt input:checked + .cat-box::after { content: ""; width: 8px; height: 4px; border: 2px solid #fff; border-top: 0; border-right: 0; transform: rotate(-45deg) translate(1px, -1px); }
.cat-opt input:focus-visible + .cat-box { outline: 3px solid var(--cat-blue); outline-offset: 2px; }
.cat-opt:has(input:checked) { color: var(--cat-blue); }
.cat-opt-name { flex: 1; min-width: 0; overflow-wrap: anywhere; }
/* No books with the other filters chosen: still clickable, but dimmed. */
.cat-opt.is-empty { opacity: 0.45; }
.cat-opt.is-empty:hover { opacity: 0.7; }
.cat-opt-n { color: var(--cat-muted); font-size: 0.75rem; font-weight: 500; font-variant-numeric: tabular-nums; }
.cat-more { justify-self: start; padding: 0.2rem 0.45rem; border: 0; background: none; color: var(--cat-blue); font-size: 0.8rem; font-weight: 600; }

.cat-segs { display: grid; grid-template-columns: repeat(3, 1fr); gap: 4px; padding: 0 0.25rem 0.55rem; }
.cat-segs label { margin: 0; cursor: pointer; }
.cat-segs input { position: absolute; opacity: 0; pointer-events: none; }
.cat-segs span { display: block; padding: 0.35rem 0.15rem; border: 1px solid var(--cat-line); border-radius: 0.55rem; background: var(--cat-panel); text-align: center; font-size: 0.8rem; font-weight: 600; color: var(--cat-ink); }
.cat-segs input:checked + span { border-color: var(--cat-ink); background: var(--cat-ink); color: #fff; }
.cat-segs input:focus-visible + span { outline: 3px solid var(--cat-blue); outline-offset: 2px; }

/* Sold by */
.cat-sold { position: relative; padding: 0 0.25rem 0.55rem; }
.cat-sold-btn { display: flex; align-items: center; gap: 0.5rem; padding: 0.4rem 0.6rem; border: 1px solid var(--cat-line); border-radius: 0.65rem; background: var(--cat-panel); list-style: none; cursor: pointer; font-size: 0.86rem; font-weight: 600; color: var(--cat-ink); }
.cat-sold-btn::-webkit-details-marker { display: none; }
.cat-sold[open] > .cat-sold-btn { border-color: var(--cat-blue); box-shadow: 0 0 0 3px var(--cat-blue-soft); }
.cat-sold-who { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cat-sold-ch { flex: none; color: var(--cat-muted); transition: transform 0.2s; }
.cat-sold[open] .cat-sold-ch { transform: rotate(180deg); }
.cat-av { display: grid; place-items: center; flex: none; width: 22px; height: 22px; border-radius: 50%; background: linear-gradient(135deg, var(--cat-blue), #718a56); color: #fff; font-size: 0.68rem; font-weight: 800; }
.cat-av.is-all { background: #5f6a5b; }
.cat-av.is-store { background: #1d4ed8; }
.cat-av.is-members { background: #718a56; }
.cat-av.is-premium { background: #b7791f; }
.cat-sold-pop { display: grid; gap: 1px; margin-top: 0.4rem; padding: 0.35rem; border: 1px solid var(--cat-line); border-radius: 0.85rem; background: var(--cat-panel); box-shadow: 0 22px 40px -20px rgba(24, 33, 26, 0.5); }
.cat-sold-grp { padding: 0.35rem 0.45rem 0.15rem; font-size: 0.66rem; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--cat-muted); }
.cat-sold-grp span { font-weight: 500; letter-spacing: 0; text-transform: none; }
.cat-sold-it { position: relative; display: flex; align-items: center; gap: 0.55rem; margin: 0; padding: 0.35rem 0.45rem; border-radius: 0.55rem; cursor: pointer; font-size: 0.85rem; color: var(--cat-ink); }
.cat-sold-it:hover { background: var(--cat-soft); }
.cat-sold-it input { position: absolute; opacity: 0; pointer-events: none; }
.cat-sold-it:has(input:checked) { background: var(--cat-blue-soft); color: var(--cat-blue); font-weight: 600; }
.cat-sold-it:has(input:focus-visible) { outline: 3px solid var(--cat-blue); outline-offset: -1px; }
.cat-sold-txt { display: grid; flex: 1; min-width: 0; overflow-wrap: anywhere; }
.cat-sold-txt small { color: var(--cat-muted); font-size: 0.72rem; font-weight: 400; }
.cat-sold-n { color: var(--cat-muted); font-size: 0.75rem; font-variant-numeric: tabular-nums; }
.cat-sold-find { display: flex; align-items: center; gap: 0.35rem; margin: 0.2rem 0.1rem 0.15rem; padding: 0.3rem 0.55rem; border: 1px solid var(--cat-line); border-radius: 0.55rem; color: var(--cat-muted); }
.cat-sold-find input { flex: 1; min-width: 0; border: 0; outline: 0; background: none; color: var(--cat-ink); font-size: 0.82rem; }
.cat-sold-list { display: grid; gap: 1px; max-height: 13rem; overflow-y: auto; scrollbar-width: thin; }
.cat-sold-list mark { padding: 0; border-radius: 3px; background: var(--cat-gold-soft); color: inherit; }
.cat-sold-none { margin: 0; padding: 0.35rem 0.45rem; color: var(--cat-muted); font-size: 0.8rem; }
.cat-sold-clear { padding: 0.35rem 0.45rem 0.15rem; font-size: 0.8rem; font-weight: 600; }
.cat-panel-clear { display: block; padding: 0.45rem; border-top: 1px solid var(--cat-line); text-align: center; font-size: 0.82rem; font-weight: 600; }

/* Folded: a slim strip of icons, with a dot on each part in use. */
.cat-rail { display: none; }
.cat-studio.is-folded .cat-panel { justify-items: center; padding: 0.35rem; overflow: visible; }
.cat-studio.is-folded .cat-panel-head { flex-direction: column; padding: 0.1rem 0 0.35rem; }
.cat-studio.is-folded .cat-panel-head b span,
.cat-studio.is-folded .cat-sec,
.cat-studio.is-folded .cat-panel-clear { display: none; }
.cat-studio.is-folded .cat-fold-in { display: none; }
.cat-studio.is-folded .cat-fold-out { display: block; }
.cat-studio.is-folded .cat-rail { display: grid; gap: 4px; }
.cat-rail button { position: relative; display: grid; place-items: center; width: 36px; height: 36px; padding: 0; border: 0; border-radius: 0.6rem; background: none; color: var(--cat-muted); }
.cat-rail button:hover { background: var(--cat-soft); color: var(--cat-blue); }
.cat-rail svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.cat-rail button.is-on::after { content: ""; position: absolute; top: 6px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: var(--cat-blue); }

/* ---- Quick buttons and the results bar ---- */
.cat-quick { display: flex; gap: 0.4rem; overflow-x: auto; padding-bottom: 2px; scrollbar-width: none; }
.cat-quick::-webkit-scrollbar { display: none; }
.cat-quick a { flex: none; padding: 0.3rem 0.8rem; border: 1px solid var(--cat-line); border-radius: 999px; background: var(--cat-panel); color: var(--cat-ink); font-size: 0.84rem; font-weight: 600; text-decoration: none; }
.cat-quick a:hover { border-color: var(--cat-blue-ring); color: var(--cat-blue); }
.cat-quick a[aria-current] { border-color: var(--cat-blue-ring); background: var(--cat-blue-soft); color: var(--cat-blue); }
/* A thin line between the capsule groups: format (Printed, PDF) and condition (New, Used). */
.cat-quick-sep { flex: none; align-self: center; width: 1px; height: 1.2rem; margin: 0 0.15rem; background: var(--cat-line); }
.cat-results { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.5rem 0.75rem; }
.cat-results-left { display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem 0.75rem; min-width: 0; }
.cat-count { font-size: 1rem; font-weight: 800; color: var(--cat-ink); font-variant-numeric: tabular-nums; }
.cat-count span { margin-left: 0.15rem; font-size: 0.84rem; font-weight: 500; color: var(--cat-muted); }
.cat-active { display: flex; flex-wrap: wrap; align-items: center; gap: 0.35rem; }
.cat-active a { padding: 0.15rem 0.6rem; border: 1px solid var(--cat-blue-ring); border-radius: 999px; background: var(--cat-blue-soft); color: var(--cat-blue); font-size: 0.8rem; font-weight: 600; text-decoration: none; }
.cat-active a:hover { border-color: var(--cat-blue); }
.cat-active a.cat-clear { border: 0; background: none; color: var(--cat-muted); text-decoration: underline; }
.cat-tools { display: flex; align-items: center; gap: 0.5rem; }
.cat-tools .form-select { width: auto; min-width: 10rem; border-radius: 0.65rem; }
.cat-filters-btn { display: none; align-items: center; gap: 0.35rem; padding: 0.3rem 0.7rem; border: 1px solid var(--cat-line); border-radius: 0.65rem; background: var(--cat-panel); color: var(--cat-ink); font-size: 0.85rem; font-weight: 600; }
.cat-filters-btn b { padding: 0 0.4rem; border-radius: 999px; background: var(--cat-blue); color: #fff; font-size: 0.7rem; }
.cat-allh { display: flex; align-items: center; gap: 0.75rem; }
.cat-allh h2 { margin: 0; font-size: 1.3rem; font-weight: 900; }
.cat-allh::after { content: ""; flex: 1; border-bottom: 1.5px dotted var(--cat-dots); }
.cat-main .book-shelf { margin: 0; }

/* Tiles per row by the room next to the panel (numbers that divide 48, as book-shelf.css). */
.cat-main .hb-shelf.is-grid,
.cat-main .hb-shelf.is-row { --hb-cols: 4; }
.cat-main .hb-shelf.is-row > * { display: grid; }
.cat-main .hb-shelf.is-row > :nth-child(n + 5) { display: grid; }
@container catalog (min-width: 560px) { .cat-main .hb-shelf.is-grid, .cat-main .hb-shelf.is-row { --hb-cols: 6; } .cat-main .hb-shelf.is-row > :nth-child(n + 7) { display: none; } }
@container catalog (min-width: 800px) { .cat-main .hb-shelf.is-grid, .cat-main .hb-shelf.is-row { --hb-cols: 8; } .cat-main .hb-shelf.is-row > :nth-child(n + 7) { display: grid; } .cat-main .hb-shelf.is-row > :nth-child(n + 9) { display: none; } }
@container catalog (min-width: 1180px) { .cat-main .hb-shelf.is-grid, .cat-main .hb-shelf.is-row { --hb-cols: 12; } .cat-main .hb-shelf.is-row > :nth-child(n + 9) { display: grid; } }

/* ---- Phones and small tablets: no side panel; it slides up behind the Filters button ---- */
.cat-scrim { display: none; }
@media (max-width: 991.98px) {
  .cat-studio,
  .cat-studio.is-folded { grid-template-columns: minmax(0, 1fr); }
  .cat-filters-btn { display: inline-flex; }
  .cat-fold { display: none; }
  .cat-studio .cat-panel,
  .cat-studio.is-folded .cat-panel {
    position: fixed;
    z-index: 1050;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: 82vh;
    overflow-y: auto;
    justify-items: stretch;
    padding: 0.75rem max(0.9rem, env(safe-area-inset-right, 0px)) calc(1rem + env(safe-area-inset-bottom, 0px)) max(0.9rem, env(safe-area-inset-left, 0px));
    border-radius: 1.1rem 1.1rem 0 0;
    box-shadow: 0 -20px 40px -20px rgba(0, 0, 0, 0.45);
    transform: translateY(105%);
    transition: transform 0.25s ease;
    visibility: hidden;
  }
  .cat-studio.is-folded .cat-panel-head { flex-direction: row; }
  .cat-studio.is-folded .cat-panel-head b span,
  .cat-studio.is-folded .cat-sec { display: block; }
  .cat-studio.is-folded .cat-rail { display: none; }
  .cat-studio.is-sheet .cat-panel { transform: none; visibility: visible; }
  .cat-sheet-apply { display: inline-flex; }
  .cat-studio.is-sheet .cat-scrim { display: block; position: fixed; inset: 0; z-index: 1049; background: rgba(24, 33, 26, 0.4); }
  .cat-sold-pop { box-shadow: none; }
}

@media (max-width: 767.98px) {
  .cat-hero { padding: 1.5rem 1.25rem; }
  .cat-hero-picks { display: none; }
  .cat-hero-side { max-width: none; justify-items: stretch; }
  .cat-search-ai span { display: none; }
  .cat-tools .form-select { min-width: 0; max-width: 11rem; }
}

@media (prefers-reduced-motion: reduce) {
  .cat-hero-fan a, .cat-panel, .cat-sec > summary::after, .cat-sold-ch { transition: none; }
}

/* ---- Night mode ---- */
[data-blog-theme="dark"] .cat-hero,
[data-blog-theme="dark"] .cat-studio {
  --cat-ink: #e6eadf;
  --cat-muted: #adb7a4;
  --cat-line: #2f3628;
  --cat-panel: #1a1e15;
  --cat-soft: #20261a;
  --cat-blue: #8fb0ff;
  --cat-blue-soft: #1c2742;
  --cat-blue-ring: #34477a;
  --cat-blue-deep: #a9c1ff;
  --cat-gold-soft: #3a3016;
  --cat-dots: #4a5340;
}
[data-blog-theme="dark"] .cat-segs input:checked + span { border-color: #e6eadf; background: #e6eadf; color: #1a1e15; }
[data-blog-theme="dark"] .cat-panel-head b em,
[data-blog-theme="dark"] .cat-filters-btn b { background: #3b5bdb; }
[data-blog-theme="dark"] .cat-opt input:checked + .cat-box { border-color: #3b5bdb; background: #3b5bdb; }
