/* ---------- Catalog page (appended after product.css) ---------- */
.cat-hero { padding: 20px 0 8px; }
.cat-hero h1 { font-size: clamp(30px, 4.2vw, 46px); max-width: 22ch; margin-bottom: 14px; }
.cat-hero .lead { font-size: 17px; max-width: 70ch; margin: 0; }
.trust-row { display: flex; flex-wrap: wrap; gap: 10px; list-style: none; margin: 20px 0 0; padding: 0; }
.trust-row li { display: inline-flex; align-items: center; gap: 8px; background: #fff; border: 0; border-radius: 999px; padding: 9px 15px; font-size: 14px; font-weight: 600; box-shadow: var(--ring), 0 1px 2px rgba(8,26,44,.05); }
.trust-row svg { color: var(--ok); flex: none; }

/* Filter bar */
.filter-bar { margin: 28px 0 0; padding: 18px; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; }
.filters button { font: inherit; font-size: 14px; font-weight: 700; min-height: 40px; padding: 8px 14px; border-radius: 999px; border: 1.5px solid var(--line); background: #fff; color: var(--ink); cursor: pointer; }
.filters button:hover { border-color: var(--accent); color: var(--accent); }
.filters button[aria-pressed="true"] { background: var(--navy); border-color: var(--navy); color: #fff; }
.filters .n { font-weight: 600; opacity: .8; margin-left: 4px; }
.filter-tools { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; }
.cat-search { position: relative; flex: 1 1 320px; max-width: 480px; }
.cat-search input { width: 100%; height: 46px; font: inherit; padding: 0 14px 0 42px; border: 1.5px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink); }
.cat-search input:focus-visible { border-color: var(--accent); }
.cat-search svg { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.result-count { margin: 0; min-height: 22px; font-size: 14px; color: var(--muted); }

/* Grid */
.catalog-grid { list-style: none; margin: 22px 0 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 20px; }
.catalog-grid > li[hidden] { display: none; }
.p-card { display: flex; flex-direction: column; height: 100%; overflow: hidden; }
.p-card .thumb { position: relative; aspect-ratio: 4 / 3; display: grid; place-items: center; background: radial-gradient(circle at 50% 40%, #ffffff 0%, #e9eff5 75%); }
.p-card .thumb svg { grid-area: 1 / 1; height: 86%; width: auto; transition: transform .3s ease, opacity .3s ease; }
.p-card .thumb .t-box { height: 78%; opacity: 0; transform: scale(.94); }
.p-card:hover .thumb .t-vial, .p-card:focus-within .thumb .t-vial { opacity: 0; transform: scale(1.06); }
.p-card:hover .thumb .t-box, .p-card:focus-within .thumb .t-box { opacity: 1; transform: scale(1); }
.view-dots { position: absolute; bottom: 10px; left: 50%; transform: translateX(-50%); display: flex; gap: 6px; }
.view-dots i { width: 7px; height: 7px; border-radius: 50%; background: #9fb0c2; transition: background .2s; }
.view-dots i:first-child { background: var(--navy); }
.p-card:hover .view-dots i:first-child, .p-card:focus-within .view-dots i:first-child { background: #9fb0c2; }
.p-card:hover .view-dots i:last-child, .p-card:focus-within .view-dots i:last-child { background: var(--navy); }
.p-card .badge { position: absolute; top: 12px; left: 12px; background: var(--ok); color: #fff; font-size: 12px; font-weight: 800; padding: 5px 10px; border-radius: 999px; }
.p-body { display: flex; flex-direction: column; gap: 10px; flex: 1; padding: 16px 18px 18px; }
.p-body .tag { font-size: 11.5px; font-weight: 800; text-transform: uppercase; letter-spacing: .06em; color: var(--accent); }
.p-body h3 { font-size: 18px; line-height: 1.3; margin: 0; }
.p-body h3 a { color: var(--ink); text-decoration: none; }
.p-body h3 a:hover { color: var(--accent); text-decoration: underline; }
.specs { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; font-size: 14px; }
.specs dt { color: var(--muted); }
.specs dd { margin: 0; font-family: var(--mono); font-size: 13.5px; word-break: break-word; }
.from { margin: auto 0 0; padding-top: 4px; font-size: 14px; color: var(--muted); }
.from strong { font-size: 22px; color: var(--ink); }
.p-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.p-actions .btn { height: 46px; padding: 0 10px; font-size: 14.5px; text-align: center; line-height: 1.15; }
.btn-add { background: var(--accent); color: var(--accent-ink); }
.btn-add:hover { background: var(--accent-hover); color: #fff; }
.btn-add.added { background: var(--ok); }
.empty-state { text-align: center; padding: 48px 16px; color: var(--muted); }
.empty-state[hidden] { display: none; }

/* Research-use confirmation dialog (Quick Add) */
.ruo-dialog { width: min(480px, calc(100% - 32px)); padding: 0; border: 0; border-radius: 14px; color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.3); }
.ruo-dialog::backdrop { background: rgba(5,15,25,.55); }
.ruo-dialog form { padding: 24px; }
.ruo-dialog h2 { font-size: 20px; margin: 0 0 8px; }
.ruo-dialog p { margin: 0 0 16px; color: var(--muted); font-size: 14.5px; }
.ruo-actions { display: flex; justify-content: flex-end; gap: 10px; }
.ruo-actions .btn { height: 46px; padding: 0 18px; }

/* Hide the grid until URL filters are applied, so pre-filtered links don't flash all cards */
html[data-filtering] #catalogGrid { visibility: hidden; }

@media (max-width: 1000px) { .catalog-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* Stay two-up on phones: one card per row wastes most of the screen and makes the catalog feel endless.
   At ~175px per card the type and the side-by-side buttons no longer fit, so both are tightened. */
@media (max-width: 640px) {
  .catalog-grid { gap: 12px; }
  .p-body { gap: 8px; padding: 12px 12px 14px; }
  .p-body h3 { font-size: 15.5px; }
  .p-body .tag { font-size: 10.5px; }
  .specs { font-size: 12.5px; gap: 2px 8px; }
  .specs dd { font-size: 12px; }
  .from { font-size: 12.5px; }
  .from strong { font-size: 18px; }
  .p-actions { grid-template-columns: 1fr; gap: 8px; }
  .p-actions .btn { height: 40px; font-size: 13.5px; }
  .p-card .badge { font-size: 10.5px; padding: 4px 8px; top: 8px; left: 8px; }
}
