/* ==========================================================================
   Brastos Sodas — category page · v4 (04-page-shop.md, PLAN-B3.md §4)
   --------------------------------------------------------------------------
   Owner: P-plp. Imports nothing; tokens only (tokens.css). Everything shared —
   header, cards, shelf list rows ≤ 599, stepper, footer, drawer — is base.css.
   This file adds: page head, the sidebar (column ≥ 1200, sheet ≤ 1199 via
   :target or [data-open]), the compact line above the grid ≤ 1199, the toolbar,
   active chips, the 3-up grid, the empty state and `Rodyti daugiau`. The
   breadcrumb is base.css .crumbs. Animated: transform + opacity only.
   ========================================================================== */

/* ---------- page section: half step above the breadcrumb, full step below ---------- */
.plp { padding-block: var(--sec-y-half) var(--sec-y); }

/* breadcrumb: base.css .crumbs (one implementation for every page) */

/* ---------- head: H1 + count on one baseline ---------- */
.plp__head { display: flex; align-items: baseline; flex-wrap: wrap; gap: var(--sp-2) var(--sp-4); margin-top: var(--sp-4); margin-bottom: var(--sp-6); }
.plp__count { font-size: var(--fz-body); color: var(--ink-soft); }

/* ---------- body: sidebar 3fr / grid 9fr ≥ 1200 (--bp-xl, 01 §4.1); 1000–1199 runs the 3-up grid without it ---------- */
.plp__body { display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 9fr); gap: var(--sp-6); align-items: start; }
.plp-main { min-width: 0; }

/* ---------- sidebar ---------- */
.plp-side { min-width: 0; }
.plp-side__head { display: none; }          /* the sheet's title row; the column has the H1 */
.plp-side__foot { display: none; }          /* the sheet's `Rodyti prekes (n)` */
.plp-side__body { display: flex; flex-direction: column; gap: var(--sp-5); }

/* the selector card: --chrome on the page ground, like the homepage "when" card in reverse */
.plp-fulfil { display: flex; flex-direction: column; gap: var(--sp-2); padding-bottom: var(--sp-4); border-bottom: 1px solid var(--line); }
.plp-fulfil h3 { font-family: var(--ff-body); font-size: var(--fz-ui); font-weight: 600; line-height: var(--lh-tight); }
.plp-fulfil__line { font-size: var(--fz-ui); line-height: var(--lh-body); }
.plp-fulfil__line b { font-weight: 500; }
.plp-facet--select { display: flex; flex-direction: column; gap: var(--sp-2); }
.plp-facet--select > span { font-size: var(--fz-ui); font-weight: 600; line-height: var(--lh-tight); }
.plp-facet--select select { min-height: var(--target-min); padding: 0 var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--rad-s); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fz-ui); }
.plp-facet--select select:focus-visible { outline: var(--focus-ring-w) solid var(--focus); outline-offset: var(--focus-ring-offset); }
/* the compact line above the grid — the fulfilment promise where the sidebar is not (≤ 1199; QA2 cro 5) */
.plp-main .plp-compact { display: none; margin-bottom: var(--sp-4); padding: var(--sp-2) var(--sp-4); border-radius: var(--rad-m); background: var(--chrome); }

/* `Tiekėjas` sits behind a closed disclosure: two facets open, the 13-value supplier list one tap away (QA2 design Y2) */
.plp-facet--fold { padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.plp-facet--fold > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); min-height: 36px; margin: 0 calc(-1 * var(--sp-1)); padding: 0 var(--sp-1); list-style: none; cursor: pointer; font-size: var(--fz-ui); font-weight: 600; line-height: var(--lh-tight); border-radius: var(--rad-s); }
.plp-facet--fold > summary::-webkit-details-marker { display: none; }
.plp-facet--fold > summary::after { content: ""; width: 7px; height: 7px; margin-right: var(--sp-1); border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-2px) rotate(45deg); transition: transform var(--t-colour) var(--ease-out); }
.plp-facet--fold[open] > summary::after { transform: translateY(2px) rotate(225deg); }
.plp-facet--fold > summary:hover { background: var(--chrome); }
.plp-facet--fold > summary:focus-visible { outline: var(--focus-ring-w) solid var(--focus); outline-offset: 0; }
.plp-facet--fold .plp-facet { padding-top: var(--sp-2); border-top: 0; }

/* facets: fieldsets with a legend, rows of 40 px so every option is a full-width target */
.plp-form { display: flex; flex-direction: column; gap: var(--sp-4); }
.plp-facet { border: 0; padding: 0; margin: 0; min-width: 0; }
.plp-facet + .plp-facet, .plp-facet + .plp-facet--select { padding-top: var(--sp-4); border-top: 1px solid var(--line); }
.plp-facet legend { padding: 0; margin-bottom: var(--sp-2); font-size: var(--fz-ui); font-weight: 600; line-height: var(--lh-tight); float: left; width: 100%; }
.plp-facet legend + * { clear: both; }
.plp-opt { display: flex; align-items: center; gap: var(--sp-3); min-height: 36px; padding: 0 var(--sp-1); margin: 0 calc(-1 * var(--sp-1)); border-radius: var(--rad-s); font-size: var(--fz-ui); cursor: pointer; transition: background-color var(--t-colour) var(--ease-out); }
.plp-opt:hover { background: var(--chrome); }
.plp-opt input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--forest); cursor: pointer; }
.plp-opt__l { flex: 1 1 auto; min-width: 0; }
.plp-opt__n { flex: none; font-size: var(--fz-meta); color: var(--ink-soft); }
.plp-opt:has(input:checked) .plp-opt__l { font-weight: 500; }
.plp-opt:has(input:focus-visible) { outline: var(--focus-ring-w) solid var(--focus); outline-offset: 0; }
.plp-opt input:focus-visible { outline: none; }   /* the row draws the ring (rule above) */

/* `Rodyti visus` — a <details>, so the hidden six exist without JS; no layout animation */
.plp-facet__more summary { display: inline-flex; align-items: center; min-height: 36px; padding: 0 var(--sp-1); margin: 0 calc(-1 * var(--sp-1)); list-style: none; cursor: pointer; font-size: var(--fz-ui); font-weight: 500; text-decoration: underline; text-underline-offset: 3px; text-decoration-thickness: 1px; color: var(--ink); border-radius: var(--rad-s); }
.plp-facet__more summary::-webkit-details-marker { display: none; }
.plp-facet__more summary:hover { color: var(--forest); }
.plp-facet__more-close { display: none; }
.plp-facet__more[open] .plp-facet__more-open { display: none; }
.plp-facet__more[open] .plp-facet__more-close { display: inline; }
.plp-facet__more[open] summary { margin-bottom: var(--sp-1); }

.plp-form__foot { display: flex; flex-wrap: wrap; align-items: center; gap: var(--sp-3) var(--sp-4); padding-top: var(--sp-4); border-top: 1px solid var(--line); }
html:not(.no-js) .plp-form__apply { display: none; }   /* with JS a change applies at once */

/* ---------- toolbar: `Filtrai (n)` (≤ 1199) · sort ---------- */
.plp-bar { display: flex; align-items: center; justify-content: flex-end; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.plp-bar__filters { display: none; }
.plp-sort { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fz-ui); }
.plp-sort label { color: var(--ink-soft); }
.plp-sort__sel { position: relative; display: inline-flex; }
.plp-sort__sel::after { content: ""; position: absolute; right: var(--sp-3); top: 50%; width: 7px; height: 7px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: translateY(-70%) rotate(45deg); pointer-events: none; }
.plp-sort select { min-height: 40px; padding: 0 var(--sp-6) 0 var(--sp-3); border: 1px solid var(--line-strong); border-radius: var(--rad-s); background: var(--surface); color: var(--ink); font: inherit; font-size: var(--fz-ui); font-weight: 500; appearance: none; -webkit-appearance: none; cursor: pointer; }
.plp-sort select:hover { border-color: var(--ink); }
html:not(.no-js) .plp-sort__go { display: none; }

/* ---------- active filter chips (JS-rendered; the theme renders them server-side) ---------- */
.plp-active { display: flex; flex-wrap: wrap; gap: var(--sp-2); margin-bottom: var(--sp-5); }
.plp-active .chip { padding-right: var(--sp-2); background: var(--chip-active); color: var(--on-chip-active); text-decoration: none; }
.plp-active .chip:hover { background: var(--forest-deep); }
.plp-active .chip svg { width: 14px; height: 14px; }
.plp-active__clear { display: inline-flex; align-items: center; min-height: 32px; padding: 0 var(--sp-2); }

/* ---------- grid: 3-up beside the sidebar ---------- */
.plp-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
html:not(.no-js) .plp-grid .card.is-more { display: none; }
/* the photo placeholder is a text node inside the media link; without this it paints as an underlined link (candidate for base.css — B-home) */
.plp-grid .card__pending { display: grid; place-items: center; height: 100%; padding: var(--sp-3); font-size: var(--fz-meta); color: var(--ink-muted); text-decoration: none; text-align: center; }
.plp-grid .card__media:has(.card__pending) { text-decoration: none; }   /* beyond the first 12; `Rodyti daugiau` opens them. Without JS every card renders */

/* ---------- empty state: one sentence, one action ---------- */
.plp-empty { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-4); padding-block: var(--sp-6); border-top: 1px solid var(--line); }
.plp-empty p { font-size: var(--fz-lead); }

/* ---------- Rodyti daugiau ---------- */
.plp-more { display: flex; flex-direction: column; align-items: center; gap: var(--sp-3); margin-top: var(--sec-y-half); }
html.no-js .plp-more { display: none; }   /* all 26 are open without JS; the theme paginates server-side */

/* ---------- sheet ≤ 1199: the sidebar leaves the plane (the column from 1200 keeps cards ≥ 245 px — 01 §4.2) ---------- */
.plp-scrim { position: fixed; inset: 0; z-index: var(--z-scrim); background: var(--scrim); opacity: 0; visibility: hidden; transition: opacity var(--t-fade) var(--ease-out), visibility var(--t-fade); }
.plp-scrim.is-on { opacity: 1; visibility: visible; }

@media (max-width: 1199px) {
  .plp__body { display: block; }
  .plp-main .plp-compact { display: flex; }
  .plp-bar { justify-content: space-between; }
  .plp-bar__filters { display: inline-flex; }
  .plp-bar__filters [data-filters-n]:empty { display: none; }   /* an empty flex item would still take the gap */

  .plp-side { position: fixed; top: 0; right: 0; bottom: 0; z-index: var(--z-sheet); width: min(420px, 100%); display: flex; flex-direction: column;
    background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sheet); border-radius: var(--rad-l) 0 0 var(--rad-l);
    transform: translateX(100%); visibility: hidden; transition: transform var(--t-fade) var(--ease-out), visibility var(--t-fade); }
  .plp-side:target, .plp-side[data-open] { transform: none; visibility: visible; transition: transform var(--t-fade) var(--ease-out); }
  .plp-side__head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-4); height: 64px; padding: 0 var(--sp-3) 0 var(--sp-5); border-bottom: 1px solid var(--line); flex: none; }
  .plp-side__head h2 { font-family: var(--ff-body); font-size: var(--fz-h3); font-weight: 600; }
  .plp-side__close { display: grid; place-items: center; width: var(--target-min); height: var(--target-min); border: 0; border-radius: var(--rad-pill); background: transparent; color: var(--ink); transition: background-color var(--t-colour) var(--ease-out); }
  .plp-side__close:hover { background: var(--page); }
  .plp-side__close svg { width: 20px; height: 20px; }
  .plp-side__body { flex: 1 1 auto; overflow-y: auto; overscroll-behavior: contain; padding: var(--sp-4) var(--sp-5); }
  .plp-side__foot { display: block; flex: none; padding: var(--sp-4) var(--sp-5) calc(var(--sp-5) + env(safe-area-inset-bottom)); border-top: 1px solid var(--line); }
  .plp-form__foot { border-top: 0; padding-top: 0; }
  .plp-form__apply { display: none; }           /* the sheet foot carries the submit at this width */
  .plp-fulfil { background: var(--chrome); }
  .plp-opt:hover { background: var(--page); }
}
@media (max-width: 999px) {
  .plp-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-6) var(--sp-4); }
}

@media (max-width: 599px) {
  .plp-side { width: 100%; top: auto; max-height: calc(100dvh - var(--sp-8)); border-radius: var(--rad-l) var(--rad-l) 0 0; transform: translateY(100%); }
  .plp-side:target, .plp-side[data-open] { transform: none; }
  .plp-bar { flex-wrap: wrap; }
  .plp-sort { flex: 1 1 auto; justify-content: flex-end; }
  .plp-sort label { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
  .plp-sort select { max-width: 100%; }
  .plp__head { margin-bottom: var(--sp-5); }
  /* list rows come from base.css .shelf--list — this repeats its column rule because .plp-grid above outranks it by order */
  .plp-grid { grid-template-columns: 1fr; gap: 0; }
  .plp-active { margin-bottom: var(--sp-4); }
}
