/* Pagina Piese · Galerie. Stiluri locale; headerul, footerul și celelalte liste rămân comune. */
.gallery-page .page-head {
  justify-content: space-between;
  align-items: baseline;
  padding: clamp(28px, 4vw, 64px) 0 clamp(28px, 4vw, 64px);
}
.gallery-page .page-head h1 {
  font-size: clamp(64px, 9vw, 144px);
  line-height: .98;
  letter-spacing: -.055em;
}
.gallery-intro {
  font-size: clamp(18px, 2vw, 28px);
  font-weight: 300;
  letter-spacing: -.025em;
  color: var(--secondary);
}
.gallery-page .cat-tools {
  gap: 12px 24px;
  padding-bottom: 16px;
  margin-bottom: 0;
}
.gallery-page .cat-chips { gap: 8px 24px; }
.gallery-page .chip {
  position: relative;
  min-height: 44px;
  padding: 0;
  background: transparent;
  border: 0;
  border-radius: 0;
  font-size: 13px;
  color: var(--secondary);
  box-shadow: none;
}
.gallery-page .chip::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 5px;
  height: 1px;
  background: currentColor;
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--link-duration) var(--link-ease);
}
.gallery-page .chip:hover,
.gallery-page .chip[aria-current="true"] { color: var(--ink); font-weight: 400; }
.gallery-page .chip:hover::after,
.gallery-page .chip[aria-current="true"]::after { transform: scaleX(1); }
.gallery-page .cat-search { position: relative; flex: 1 1 160px; max-width: 220px; margin-left: auto; }
.gallery-page .cat-search .field-input {
  height: 44px;
  padding: 0 34px 0 0;
  border: 0;
  border-bottom: 1px solid var(--border-control);
  border-radius: 0;
  background: transparent;
  font-size: 13px;
}
.gallery-page .cat-search .field-input::placeholder { color: var(--secondary); opacity: 1; }
.gallery-search-icon { position: absolute; right: 0; top: 13px; width: 18px; height: 18px; pointer-events: none; }
.gallery-page .cat-search:has(input:not(:placeholder-shown)) .gallery-search-icon { display: none; }
.gallery-page .cat-sort { gap: 12px; margin-left: 0; font-size: 12px; }
.gallery-page .cat-sort .field-select {
  min-width: 180px;
  height: 44px;
  padding: 0 24px 0 0;
  border: 0;
  border-bottom: 1px solid var(--border-control);
  border-radius: 0;
  background-color: transparent;
  background-position: right center;
  background-size: 14px 9px;
  font-size: 13px;
}
.gallery-page .cat-status { margin: 18px 0 0; font-size: 12px; }
.cat-status:focus { outline: none; }   /* primește focus din script (după resetare din starea goală), nu e control */
.gallery-page .cards {
  grid-template-columns: repeat(4, minmax(0, 1fr));
  column-gap: clamp(22px, 3vw, 52px);
  row-gap: clamp(44px, 6vw, 92px);
  padding-top: clamp(24px, 3vw, 46px);
  counter-reset: gallery-piece;
}
.gallery-page .cards > li { min-width: 0; counter-increment: gallery-piece; }
.gallery-page .cards > li::before {
  content: counter(gallery-piece, decimal-leading-zero);
  display: block;
  margin-bottom: 12px;
  font-size: 12px;
  font-weight: 300;
  color: var(--secondary);
  font-variant-numeric: tabular-nums;
}
.gallery-media { display: block; aspect-ratio: 1; overflow: hidden; background: var(--background); }
.gallery-page .cards img {
  width: 100%;
  height: 100%;
  background: transparent;
  mix-blend-mode: multiply;
  transform: scale(var(--gallery-scale, 1));
  transition: translate 650ms var(--motion-ease);
}
.gallery-page [data-product="first-quarter"] { --gallery-scale: 1.3; }
.gallery-page [data-product="screwing-ring"] { --gallery-scale: .8; }
.gallery-page .cards img[src$=".png"] { mix-blend-mode: normal; }
.gallery-page [data-product="meld"] img,
.gallery-page [data-product="alt"] img { --gallery-scale: 1.6; }
.gallery-page .cards a:focus-visible img { opacity: 1; translate: 0 -5px; }
@media (hover: hover) { .gallery-page .cards a:hover img { opacity: 1; translate: 0 -5px; } }   /* pe touch, fără hover „lipit” după apăsarea lungă */
.gallery-page .c-name { margin-top: 18px; font-size: clamp(17px, 1.45vw, 24px); letter-spacing: -.03em; line-height: 1.2; }
.gallery-page .c-price { margin-top: 6px; font-size: 13px; font-weight: 300; }
.gallery-page .c-row { position: relative; gap: 14px; }
.gallery-page .c-row > span { flex: 1; min-width: 0; }
.gallery-page .c-price { display: flex; align-items: center; gap: 14px; }
.gallery-page .c-price::after { content: ""; height: 1px; flex: 1; background: var(--border); }
.gallery-page .cards .c-arrow { width: 22px; height: 16px; margin-bottom: 1px; }
.gallery-page .list-main { padding-bottom: clamp(64px, 8vw, 128px); }
.gallery-page .cat-empty { margin-top: 32px; background: transparent; border-style: solid; }
@media (max-width: 1100px) {
  .gallery-page .cat-chips { flex: 1 1 100%; }
  .gallery-page .cat-search { margin-left: 0; max-width: 260px; }
  .gallery-page .cat-sort { margin-left: auto; }
  .gallery-page .cards { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 760px) {
  .gallery-page .page-head { align-items: flex-start; gap: 14px; }
  .gallery-intro { align-self: flex-end; padding-bottom: 4px; }
  .gallery-page .cat-chips { gap: 4px 20px; }
  .gallery-page .cat-sort { width: auto; gap: 8px; }
  .gallery-page .cat-sort > span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .gallery-page .cat-sort .field-select { min-width: 0; width: 172px; }
  .gallery-page .cat-search { min-width: 0; max-width: none; flex-basis: 120px; }
  .gallery-page .cards { grid-template-columns: repeat(2, minmax(0, 1fr)); column-gap: 20px; row-gap: 40px; }
  .gallery-page .c-name { font-size: 18px; }
  .gallery-page .c-price { font-size: 12px; gap: 8px; }
  .gallery-page .cards .c-arrow { width: 18px; }
}
@media (max-width: 380px) {
  .gallery-intro { font-size: 16px; }
  .gallery-page .cat-sort .field-select { width: 152px; font-size: 12px; }
  .gallery-page .cards { column-gap: 16px; }
  .gallery-page .c-name { font-size: 16px; }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-page .cards img, .gallery-page .chip::after { transition: none; }
  .gallery-page .cards a:hover img, .gallery-page .cards a:focus-visible img { translate: 0 0; }
}

/* Cautare extensibila si sortare editoriala. */
@media (min-width: 1101px) {
  .gallery-page .list-main { width: 100%; max-width: 1480px; margin-inline: auto; }
  .gallery-page .cards { row-gap: 48px; column-gap: 32px; }
  .gallery-page .gallery-media { aspect-ratio: 1.15; }
  .gallery-page .gallery-media img {
    mask-image: linear-gradient(to right, transparent, #000 6%, #000 94%, transparent), linear-gradient(to bottom, transparent, #000 6%, #000 94%, transparent);
    mask-composite: intersect;
  }
}
.gallery-page .cat-tools { display: grid; grid-template-columns: minmax(0, 1fr) auto; position: relative; }
.gallery-explore { position: relative; min-width: 0; min-height: 44px; padding-right: 244px; }
.gallery-explore .cat-chips { transition: opacity 350ms ease, translate 650ms var(--motion-ease); }
.gallery-page .gallery-explore .cat-search {
  position: absolute;
  right: 0;
  bottom: 0;
  z-index: 2;
  width: 220px;
  height: 44px;
  max-width: none;
  margin: 0;
  background: var(--background);
  transition: width 750ms var(--link-ease), height 750ms var(--link-ease);
}
.gallery-explore.is-searching .cat-chips { opacity: 0; translate: -14px 0; pointer-events: none; }
.gallery-page .gallery-explore.is-searching .cat-search { width: 100%; height: 100%; }
.gallery-page .cat-search .field-input { height: 100%; transition: border-color 650ms ease; }
.gallery-page .cat-search .field-input:focus { outline: none; box-shadow: none; border-bottom-color: var(--ink); }
.gallery-page .cat-search .field-input::-webkit-search-cancel-button { appearance: none; }
.gallery-search-close {
  position: absolute; right: -8px; top: 50%; translate: 0 -50%;
  display: grid; place-items: center; width: 44px; height: 44px;
  padding: 12px; border: 0; background: transparent; color: var(--ink); cursor: pointer;
}
.gallery-search-close svg { width: 20px; height: 20px; }
.gallery-explore.is-searching .gallery-search-icon { display: none; }
.gallery-search-close:focus-visible { outline: none; background: var(--mineral); }
.gallery-sort { position: relative; z-index: 5; width: 224px; }
.gallery-sort-trigger {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  width: 100%; min-height: 44px; padding: 0; border: 0;
  border-bottom: 1px solid var(--border-control); background: transparent;
  color: var(--secondary); font-size: 13px; text-align: left; cursor: pointer;
  transition: border-color 650ms ease, color 650ms ease;
}
.gallery-sort-trigger::after {
  content: ""; width: 7px; height: 7px; margin: -4px 4px 0 0;
  border-right: 1px solid currentColor; border-bottom: 1px solid currentColor;
  rotate: 45deg; transition: rotate 650ms var(--link-ease);
}
.gallery-sort-trigger:focus { outline: none; box-shadow: none; }
.gallery-sort-trigger:hover, .gallery-sort-trigger:focus-visible, .gallery-sort.is-open .gallery-sort-trigger { border-bottom-color: var(--ink); color: var(--ink); }
.gallery-sort.is-open .gallery-sort-trigger::after { rotate: 225deg; }
.gallery-sort-menu {
  position: absolute; right: 0; top: calc(100% + 12px); width: 290px;
  padding: 12px 20px; background: var(--background);
  border-top: 1px solid var(--ink); border-bottom: 1px solid var(--border);
  box-shadow: 0 16px 32px rgba(32,32,32,.06);
  visibility: hidden; opacity: 0; translate: 0 -8px;
  transition: opacity 320ms ease, translate 500ms var(--motion-ease), visibility 500ms;
}
.gallery-sort.is-open .gallery-sort-menu { visibility: visible; opacity: 1; translate: 0 0; }
.gallery-sort-menu button {
  position: relative; display: flex; align-items: center; gap: 18px;
  width: 100%; min-height: 52px; padding: 12px 4px; background: transparent;
  border: 0; color: var(--secondary); text-align: left; font-size: 13px; cursor: pointer;
}
.gallery-sort-number { font-size: 11px; font-weight: 300; font-variant-numeric: tabular-nums; }
.gallery-sort-menu button::after {
  content: ""; position: absolute; bottom: 8px; left: 38px; right: 4px; height: 1px;
  background: var(--ink); transform: scaleX(0); transform-origin: left;
  transition: transform var(--link-duration) var(--link-ease);
}
.gallery-sort-menu button:hover, .gallery-sort-menu button:focus-visible, .gallery-sort-menu button[aria-checked="true"] { color: var(--ink); }
.gallery-sort-menu button:focus-visible { outline: none; background: var(--mineral); }
.gallery-sort-menu button:hover::after, .gallery-sort-menu button:focus-visible::after, .gallery-sort-menu button[aria-checked="true"]::after { transform: scaleX(1); }
.gallery-page .chip:focus-visible { outline: none; color: var(--ink); }
.gallery-page .chip:focus-visible::after { transform: scaleX(1); }
@media (max-width: 1100px) {
  .gallery-explore { grid-column: 1 / -1; }
  .gallery-sort, .gallery-page .cat-sort { grid-column: 2; justify-self: end; }
}
@media (max-width: 760px) {
  .gallery-explore { padding: 0 0 60px; }
  .gallery-page .gallery-explore .cat-search { width: 100%; }
  .gallery-sort { width: 190px; }
  .gallery-sort-menu { width: min(290px, calc(100vw - 48px)); }
}
@media (prefers-reduced-motion: reduce) {
  .gallery-explore .cat-chips, .gallery-page .gallery-explore .cat-search,
  .gallery-sort-trigger, .gallery-sort-trigger::after, .gallery-sort-menu, .gallery-sort-menu button::after { transition: none; }
}

/* ═══════════ Filtre: mărime, material, preț ═══════════
   Bara (butonul „Filtre” + chips cu „×”) și panoul <dialog> apar doar cu JavaScript (lista-piese.js scoate atributul hidden).
   Panoul: pe desktop se deschide pe loc, sub bară (dialog nemodal); sub 761 px e o foaie modală de jos (:modal). */
.cat-filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 0 20px; padding-top: 6px; }
.cf-toggle {
  display: inline-flex; align-items: center; gap: 10px; min-height: 44px; padding: 0;
  border: 0; border-bottom: 1px solid var(--border-control); background: transparent;
  color: var(--secondary); font-size: 13px; cursor: pointer;
  transition: border-color 650ms ease, color 650ms ease;
}
.cf-toggle-icon { width: 20px; height: 20px; flex: none; }
.cf-toggle-count {
  display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--ink); color: var(--on-primary); font-size: 11px; font-weight: 500; line-height: 1; font-variant-numeric: tabular-nums;
}
.cf-toggle[aria-expanded="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.cf-toggle:focus-visible { color: var(--ink); border-bottom-color: var(--ink); }
@media (hover: hover) { .cf-toggle:hover { color: var(--ink); border-bottom-color: var(--ink); } }
.cf-active { display: flex; flex-wrap: wrap; gap: 8px; list-style: none; margin: 0; padding: 0; }
.cf-chip {
  position: relative; display: inline-flex; align-items: center; gap: 10px; min-height: 32px; padding: 0 10px;
  background: var(--surface); border: 1px solid var(--border-control); border-radius: 2px;
  color: var(--ink); font-size: 13px; cursor: pointer;
}
.cf-chip::before { content: ""; position: absolute; inset: -6px -2px; }    /* ținta de atingere ajunge la 44 px fără să îngroașe chipul */
.cf-chip svg { width: 10px; height: 10px; flex: none; }
@media (hover: hover) { .cf-chip:hover { border-color: var(--ink); } }
.cf-clear { margin-left: auto; }

.cat-filters { padding: 0; border: 0; background: transparent; color: inherit; }
.cf-form { margin: 0; }
.cf-group { min-width: 0; margin: 0; padding: 0; border: 0; }
.cf-group legend { float: left; width: 100%; padding: 0; margin: 0 0 12px; font-size: 12px; font-weight: 500; letter-spacing: .16em; text-transform: uppercase; color: var(--ink); }   /* float: legenda nu mai „taie” linia de sus a grupului */
.cf-group legend + * { clear: both; }
.cf-sizegrid { display: grid; grid-template-columns: repeat(auto-fill, minmax(48px, 1fr)); gap: 8px; }
.cf-size { position: relative; display: block; }
.cf-size input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.cf-size span {
  display: grid; place-items: center; min-height: 44px; border: 1px solid var(--border); border-radius: 2px;
  color: var(--secondary); font-size: 14px; font-variant-numeric: tabular-nums;
  transition: border-color 160ms ease, color 160ms ease;
}
@media (hover: hover) { .cf-size:hover span { border-color: var(--ink); color: var(--ink); } }
.cf-size input:checked + span { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); color: var(--ink); font-weight: 500; }
.cf-size input:focus-visible + span { outline: 2px solid var(--ink); outline-offset: 3px; }
.cf-note, .cf-hint { margin-top: 10px; font-size: 12px; line-height: 1.5; color: var(--secondary); }
.cf-optlist { display: grid; }
.cf-opt { display: flex; align-items: center; gap: 12px; min-height: 44px; color: var(--secondary); font-size: 14px; cursor: pointer; }
.cf-opt input { flex: none; width: 18px; height: 18px; margin: 0; accent-color: var(--ink); cursor: pointer; }
.cf-opt:has(input:checked) { color: var(--ink); }
.cf-swatch { flex: none; width: 18px; height: 18px; border: 1px solid var(--border-control); border-radius: 50%; }
.cf-pricefields { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.cf-field { display: grid; gap: 2px; color: var(--secondary); font-size: 12px; }
.cf-field .field-input { height: 44px; padding: 0 2px; border: 0; border-bottom: 1px solid var(--border-control); border-radius: 0; background: transparent; font-size: 14px; }
.cf-field .field-input:focus { border-bottom-color: var(--ink); }
.cf-field .field-input[aria-invalid="true"] { border-bottom-color: var(--error); }
.cf-error { margin-top: 6px; font-size: 13px; line-height: 1.4; color: var(--error); }
.cf-error:empty { margin: 0; }

/* desktop: panou pe loc, sub bară */
.cat-filters:not(:modal) {
  position: static; width: auto; max-width: none; height: auto; max-height: none; margin: 4px 0 0;
  border-top: 1px solid var(--border); border-bottom: 1px solid var(--border);
  animation: cf-inline-in 360ms var(--motion-ease) both;
}
.cat-filters:not(:modal) .cf-head, .cat-filters:not(:modal) .cf-foot { display: none; }   /* pe loc, „Resetează filtrele” e în bară, iar numărul de piese în mesajul de sub ea */
.cat-filters:not(:modal) .cf-form { padding: 26px 0 22px; }
.cat-filters:not(:modal) .cf-body { display: grid; grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr) minmax(0, 1fr); gap: 28px clamp(32px, 5vw, 72px); }
@media (max-width: 1100px) {
  .cat-filters:not(:modal) .cf-body { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .cat-filters:not(:modal) .cf-sizes { grid-column: 1 / -1; }
}

/* telefon: foaie modală, de jos */
html.cf-open { overflow: hidden; }
.cat-filters:modal {
  position: fixed; inset: auto 0 0 0; width: 100%; max-width: none; height: auto; margin: 0; overflow: hidden;
  max-height: 88vh; max-height: 88dvh;
  border-top: 1px solid var(--ink); background: var(--background); color: var(--ink);
  animation: cf-sheet-in 380ms var(--motion-ease) both;
}
.cat-filters:modal::backdrop { background: rgba(32, 32, 32, .42); animation: cf-fade-in 300ms ease both; }
.cat-filters:modal.is-closing { animation: cf-sheet-out 240ms ease-in both; }
.cat-filters:modal.is-closing::backdrop { animation: cf-fade-out 240ms ease both; }
.cat-filters:modal .cf-form { display: flex; flex-direction: column; max-height: inherit; }
.cf-head { display: flex; align-items: center; gap: 12px; padding: 4px 6px 4px var(--gutter); border-bottom: 1px solid var(--border); }
.cf-title { font-size: 26px; font-weight: 300; letter-spacing: -.035em; line-height: 1.2; }
.cf-count { margin-left: auto; font-size: 13px; color: var(--secondary); }
.cf-close { display: grid; place-items: center; flex: none; width: 44px; height: 44px; padding: 0; border: 0; background: transparent; color: var(--ink); cursor: pointer; }
.cf-close svg { width: 20px; height: 20px; }
.cat-filters:modal .cf-body { flex: 1 1 auto; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 22px var(--gutter) 24px; }
.cat-filters:modal .cf-group + .cf-group { margin-top: 24px; padding-top: 22px; border-top: 1px solid var(--border); }
.cat-filters:modal .cf-foot {
  display: flex; align-items: center; gap: 20px; padding: 12px var(--gutter) max(12px, env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); background: var(--background);
}
.cat-filters:modal .cf-reset { flex: none; }
.cat-filters:modal .cf-apply { flex: 1 1 auto; width: auto; }
@keyframes cf-inline-in { from { opacity: 0; transform: translateY(-6px); } }
@keyframes cf-sheet-in { from { transform: translateY(100%); } }
@keyframes cf-sheet-out { to { transform: translateY(100%); } }
@keyframes cf-fade-in { from { opacity: 0; } }
@keyframes cf-fade-out { to { opacity: 0; } }
@media (max-width: 760px) {
  .cf-sizegrid { grid-template-columns: repeat(auto-fill, minmax(46px, 1fr)); }
  .cat-filterbar { gap: 0 14px; }
}
@media (prefers-reduced-motion: reduce) {
  .cf-toggle, .cf-size span { transition: none; }
  .cat-filters, .cat-filters::backdrop { animation: none !important; }
}
