/* Category list page (kategorija.html): the tinted head with the drawing and the
   facts, picking mode, the compatibility banner, the toolbar, the filter panel
   and its phone sheet, and the notes around the product rows of parts.css. */

/* ---------- head ---------- */
/* One tint band behind crumbs and head: the ::before reaches 100vmax to each
   side while the content keeps the .wrap gutters (main clips what overflows). */
.page-category .cat-head { position: relative; isolation: isolate; padding-bottom: 30px; margin-bottom: 28px; }
.page-category .cat-head::before {
  content: ""; position: absolute; z-index: -1; inset: 0 -100vmax; background: var(--tint); border-bottom: 1px solid var(--tint-2);
}
/* the head's own band paints behind the crumbs too (tint, or --accent-soft when picking) */
.page-category .cat-head .crumbs { border-image: none; }
.cat-head-in { display: flex; align-items: center; gap: 28px; padding-top: 6px; }
.cat-head-art { flex: none; display: grid; place-items: center; width: 148px; height: 148px; color: var(--ill-dark); }
.cat-head-text { min-width: 0; }
.page-category .cat-head h1 { font-size: clamp(32px, 4.4vw, 48px); line-height: 1.02; }
.cat-facts { display: flex; flex-wrap: wrap; gap: 14px 0; margin: 20px 0 0; }
.cat-facts > div { display: flex; flex-direction: column-reverse; justify-content: flex-end; gap: 3px; padding: 0 26px; border-left: 1px solid var(--line-2); }
.cat-facts > div:first-child { padding-left: 0; border-left: 0; }
.cat-facts dt { font-size: 13px; color: var(--ink-2); }
.cat-facts dd { margin: 0; font: 700 24px/1.1 var(--font-display); letter-spacing: -.02em; color: var(--ink); white-space: nowrap; }
.cat-facts .fact-good dd { color: var(--good); }

/* ---------- picking mode ---------- */
.page-category .cat-head.picking::before { background: var(--accent-soft); border-bottom-color: color-mix(in srgb, var(--accent) 18%, transparent); }
.pick-bar {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 20px; margin: 2px 0 18px;
  padding: 12px 14px 12px 16px; border-radius: var(--r-l); background: var(--surface); font-size: 14px; color: var(--ink-2);
}
.pick-bar b { color: var(--ink); font-weight: 600; }
.pick-kicker { margin-bottom: 6px; font-size: 14px; font-weight: 600; color: var(--accent); }

/* ---------- layout ---------- */
.cat-layout { display: grid; grid-template-columns: 252px minmax(0, 1fr); gap: 28px; align-items: start; }
.cat-main { min-width: 0; }

/* The compatibility banner itself is in style.css; here only its spacing above the list. */
.page-category .compat { margin-bottom: 16px; }

/* ---------- toolbar ---------- */
.cat-search { margin-bottom: 14px; }
.list-bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 10px 16px; margin-bottom: 8px; }
.list-bar-l { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; }
.count { font-size: 14.5px; color: var(--ink-2); }
.count b { font: 700 18px/1 var(--font-display); color: var(--ink); font-variant-numeric: tabular-nums; }
.sort { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--ink-2); }
.filters-toggle { display: none; }
.filters-toggle .f-n {
  display: inline-grid; place-items: center; min-width: 20px; height: 20px; padding: 0 5px; border-radius: 10px;
  background: var(--accent); color: var(--on-accent); font-size: 12px; font-weight: 700;
}

/* chips of the active filters */
.active { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 12px; }
.active:empty { display: none; }
.active .chip { height: 30px; padding: 0 10px 0 12px; border-color: var(--line-2); color: var(--ink); font-weight: 500; text-align: left; }
.active .chip:hover { border-color: var(--accent); color: var(--accent); }
.active .chip .ico { color: var(--ink-3); }
.f-clear-all { padding: 4px 6px; border: 0; background: none; font: 600 13px/1 var(--font-body); color: var(--accent); cursor: pointer; }
.f-clear-all:hover { text-decoration: underline; }

/* ---------- filter panel ---------- */
/* On --tint without a border; groups are divided by --tint-2 lines. The controls
   are made by renderFilter() in filters.js (check lists, number fields with
   preset ranges, yes/no as a short check list). */
.filters { padding: 4px 18px 8px; border-radius: var(--r-l); background: var(--tint); }
.f-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.filters-title { padding: 16px 0 4px; font-size: 18px; line-height: 1.2; outline: none; }
.f-close, .f-foot { display: none; }
.filters .fg { min-width: 0; margin: 0; padding: 15px 0; border: 0; border-bottom: 1px solid var(--tint-2); }
.f-body > .fg:last-of-type, .f-more > .fg:last-child { border-bottom: 0; }
.filters legend { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; float: left; width: 100%; margin-bottom: 8px; padding: 0; font-weight: 650; font-size: 14px; }
.filters legend + * { clear: left; }
.opts { display: grid; margin: 0; padding: 0; list-style: none; }
.opt { display: flex; align-items: center; gap: 10px; min-height: 30px; padding: 4px 0; border-radius: var(--r-s); cursor: pointer; font-size: 14px; }
.opt input { flex: none; width: 17px; height: 17px; margin: 0; accent-color: var(--accent); }
.opt:hover .opt-l { color: var(--accent); }
.opt-l { min-width: 0; overflow-wrap: anywhere; }
.opt .n { min-width: 24px; margin-left: auto; text-align: right; color: var(--ink-3); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.opt-unk .opt-l { color: var(--ink-2); font-style: italic; }
.f-all { margin-top: 4px; padding: 4px 0; border: 0; background: none; font: 600 13px/1.3 var(--font-body); color: var(--accent); cursor: pointer; }
.f-all:hover { text-decoration: underline; }
.f-empty, .f-note { margin: 2px 0 0; font-size: 12.5px; line-height: 1.4; color: var(--ink-3); }
.filters .f-search { width: 100%; height: 34px; margin: 0 0 6px; padding: 0 10px; border-radius: var(--r-s); font-size: 13.5px; }
.f-val { font-weight: 600; font-size: 13.5px; color: var(--ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.f-minmax { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--ink-2); }
.f-minmax label { display: flex; flex: 1; align-items: center; gap: 6px; min-width: 0; font-size: 13px; }
.filters .f-num { width: 100%; min-width: 0; height: 36px; padding: 0 8px; font-size: 14px; -moz-appearance: textfield; appearance: textfield; }
.f-num::-webkit-inner-spin-button, .f-num::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.f-unit { flex: none; }
.f-presets { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 10px; }
.f-presets .chip { height: 30px; padding: 0 10px; }
.fg-range .opt-unk { margin-top: 6px; }
/* yes/no: the three answers side by side (they are short) */
.fg-bool .opts { display: flex; flex-wrap: wrap; gap: 0 18px; }
.fg-bool .opt { gap: 8px; }
.fg-bool .opt .n { min-width: 0; margin-left: 0; }

.f-more-btn {
  display: flex; align-items: center; justify-content: space-between; width: 100%; margin: 4px 0; padding: 14px 0; border: 0;
  border-top: 1px solid var(--tint-2); background: none; font: 650 14.5px/1.2 var(--font-body); color: var(--accent); cursor: pointer; text-align: left;
}
.f-chev { width: 9px; height: 9px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg) translateY(-3px); transition: transform .15s; }
.f-more-btn[aria-expanded="true"] .f-chev { transform: rotate(-135deg) translate(-2px, -2px); }
.f-more { border-top: 1px solid var(--tint-2); }

/* ---------- list ---------- */
/* A long list costs nothing for the rows that are off screen. */
.page-category .row { content-visibility: auto; contain-intrinsic-size: auto 124px; }
.list-more { display: flex; justify-content: flex-start; margin-top: 20px; }
.foot-note { max-width: 62em; margin-top: 26px; font-size: 13px; line-height: 1.5; color: var(--ink-3); }
.page-category .card.notice p { max-width: 46em; }

/* ---------- breakpoints ---------- */
/* Phone and small tablet: the panel is a full-screen sheet behind a "Filteri"
   button, with a sticky head and foot. */
@media (max-width: 860px) {
  .cat-layout { grid-template-columns: minmax(0, 1fr); gap: 14px; }
  .filters-toggle { display: inline-flex; }
  /* "Filteri" and the sort on one line, the count under them */
  .list-bar { display: grid; grid-template-columns: auto minmax(0, 1fr); }
  .list-bar-l { display: contents; }
  .filters-toggle { grid-column: 1; grid-row: 1; }
  .sort { grid-column: 2; grid-row: 1; justify-self: end; }
  .count { grid-column: 1 / -1; grid-row: 2; }
  .filters { display: none; padding: 0; }
  .filters.open {
    display: flex; flex-direction: column; position: fixed; inset: 0; z-index: 70; border-radius: 0; background: var(--surface);
  }
  .filters.open .f-head { flex: none; padding: 6px 8px 6px 16px; border-bottom: 1px solid var(--line); }
  .filters.open .filters-title { padding: 10px 0; font-size: 19px; }
  .filters.open .f-close { display: grid; width: 44px; height: 44px; color: var(--ink); }
  .filters.open .f-close:hover { background: var(--surface-2); color: var(--ink); }
  .filters.open .f-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; padding: 0 16px 16px; }
  .filters.open .f-foot {
    flex: none; display: flex; gap: 10px; padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
    border-top: 1px solid var(--line); background: var(--surface);
  }
  .f-foot .f-clear { flex: none; }
  .f-foot .f-show { flex: 1; justify-content: center; }
  body:has(.filters.open) { overflow: hidden; }
  .filters .opt { min-height: 40px; }
  .filters .f-search, .filters .f-num { height: 40px; font-size: 16px; }
  .f-presets .chip { height: 40px; padding: 0 14px; font-size: 14px; }
}
@media (max-width: 720px) {
  .page-category .cat-head { padding-bottom: 22px; margin-bottom: 18px; }
  .cat-head-in { align-items: flex-start; gap: 16px; }
  .cat-head-art { width: 84px; height: 84px; }
  .cat-head-art .art svg { width: 84px; height: 84px; }
  .cat-head-art .ico svg { width: 44px; height: 44px; }
  .cat-facts { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 18px; margin-top: 14px; }
  .cat-facts > div, .cat-facts > div:first-child { padding: 0; border: 0; }
  .cat-facts dd { font-size: 19px; }
  .cat-facts dt { font-size: 12.5px; }
}
@media (max-width: 640px) {
  .page-category .row { contain-intrinsic-size: auto 150px; }
  .sort { justify-self: stretch; }
  /* the select keeps its name for assistive technology: hidden like .visually-hidden, not display:none */
  .sort label {
    position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden;
    clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .sort select { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .f-chev { transition: none; }
}
