/* ============================================================================
   Brick Auction — shop page (/products) — «چک»
   Loaded ONLY by products.html, on top of styles.css: the chrome (.nav, .btn,
   .chip, .section-head, .footer, the reveal animation) is reused as-is and
   every colour here comes from the same "Warm Monochrome" tokens, so nothing
   in index.html's payload changes.

   The page is a catalogue + a purely client-side cart. There is no checkout
   here by design — the CTA hands the visitor to the customer app.
   ========================================================================== */

/* ── Utilities ─────────────────────────────────────────────────────────── */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* The shop link is the one nav item that survives the ≤1250px collapse (see
   styles.css) — it points at another page, which scrolling cannot reach. */
.nav__shop[aria-current="page"] {
  color: var(--ink);
  font-weight: 700;
}

/* ── Cart trigger (nav) ────────────────────────────────────────────────── */
.cartbtn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 16px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 0.94rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease);
}
.cartbtn:hover {
  border-color: var(--ink);
}
/* An author `display` beats the UA stylesheet's `[hidden] { display: none }`,
   so the empty-cart badge needs this or it renders a permanent «۰». */
.cartbtn__count[hidden] {
  display: none;
}
.cartbtn__count {
  min-width: 22px;
  height: 22px;
  padding: 0 6px;
  border-radius: 11px;
  background: var(--ink);
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

/* ── Intro ─────────────────────────────────────────────────────────────── */
.shop-intro {
  padding: clamp(28px, 5vw, 56px) var(--pad-x) clamp(20px, 3vw, 28px);
  background: var(--surface-1);
  border-bottom: 1px solid var(--line);
}
.shop-intro__title {
  font-size: clamp(1.7rem, 4vw, 2.6rem);
  font-weight: 800;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.shop-intro__sub {
  margin-top: 10px;
  max-width: 62ch;
  color: var(--muted);
  font-size: 1.02rem;
}
.shop-intro__points {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 10px;
  margin-top: 18px;
}
.shop-intro__points li {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 7px 13px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--card);
  color: var(--muted-strong);
  font-size: 0.86rem;
  font-weight: 600;
}
.shop-intro__points li::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green);
  flex: none;
}

/* ── Toolbar (search + result count) ───────────────────────────────────── */
.shop {
  padding: clamp(22px, 3.5vw, 34px) var(--pad-x) clamp(32px, 5vw, 56px);
}
.shop__toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px 18px;
}
.shop__search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 260px;
  max-width: 380px;
  padding: 0 14px;
  border: 1px solid var(--line-2);
  border-radius: 12px;
  background: var(--card);
  color: var(--muted-strong);
  transition: border-color 0.2s var(--ease);
}
.shop__search:focus-within {
  border-color: var(--ink);
}
.shop__search svg {
  flex: none;
}
.shop__search input {
  flex: 1;
  min-width: 0;
  padding: 12px 0;
  border: 0;
  background: transparent;
  font: inherit;
  font-size: 0.96rem;
  color: var(--text);
  outline: none;
}
/* The wrapper carries the focus ring, so suppress the inner one. */
.shop__search input:focus-visible {
  outline: none;
}
.shop__search input::-webkit-search-cancel-button {
  -webkit-appearance: none;
}
.shop__count {
  color: var(--muted-strong);
  font-size: 0.92rem;
  font-weight: 600;
}

/* ── Category filters ──────────────────────────────────────────────────── */
.shop__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-bottom: 2px;
}
.fchip {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 9px 15px;
  border: 1px solid var(--line-2);
  border-radius: 999px;
  background: var(--card);
  color: var(--text-2);
  font: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  white-space: nowrap;
  transition: border-color 0.2s var(--ease), background-color 0.2s var(--ease),
    color 0.2s var(--ease);
}
.fchip:hover {
  border-color: var(--ink);
  color: var(--ink);
}
.fchip.is-active {
  background: var(--ink);
  border-color: var(--ink);
  color: #fff;
}
.fchip__n {
  padding: 2px 7px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--muted-strong);
  font-size: 0.76rem;
  font-weight: 700;
}
.fchip.is-active .fchip__n {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

/* ── Product grid ──────────────────────────────────────────────────────── */
.shop__grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(228px, 1fr));
  gap: 18px;
  margin-top: 22px;
}
.shop__empty {
  margin-top: 32px;
  padding: 28px;
  border: 1px dashed var(--line-2);
  border-radius: 16px;
  background: var(--surface-1);
  color: var(--muted);
  text-align: center;
}

.pcard {
  display: flex;
  flex-direction: column;
  border: 1px solid var(--line);
  border-radius: 18px;
  background: var(--card);
  overflow: hidden;
  transition: border-color 0.2s var(--ease), box-shadow 0.2s var(--ease),
    transform 0.2s var(--ease);
}
.pcard:hover {
  border-color: var(--line-2);
  box-shadow: 0 12px 28px rgba(38, 50, 56, 0.08);
  transform: translateY(-2px);
}
.pcard[hidden] {
  display: none;
}
.pcard__media {
  display: block;
  position: relative;
  aspect-ratio: 4 / 3;
  background: var(--surface-2);
}
.pcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pcard__noimg {
  display: block;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, var(--surface-2), var(--surface-3));
}
.pcard__body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 15px 15px;
  flex: 1;
}
.pcard__cat {
  color: var(--muted-2);
  font-size: 0.78rem;
  font-weight: 600;
}
.pcard__title {
  font-size: 1rem;
  font-weight: 700;
  line-height: 1.55;
  color: var(--ink);
}
/* The title is the crawlable link to the product's own page — Torob discovers
   the product pages by following these. */
.pcard__title a {
  color: inherit;
}
.pcard__title a:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}
/* Wraps between attributes, never inside one — a clamped «جنس: رس…» reads as a
   broken card. The generator caps the list at three, so two lines is the worst
   case at any card width. */
.pcard__specs {
  color: var(--muted-strong);
  font-size: 0.8rem;
  line-height: 1.75;
}
.pcard__spec {
  display: inline-block;
  margin-inline-end: 10px;
  white-space: nowrap;
}
.pcard__spec b {
  font-weight: 600;
  color: var(--muted-2);
}
.pcard__price {
  margin-top: auto;
  padding-top: 8px;
  display: flex;
  align-items: baseline;
  gap: 6px;
  flex-wrap: wrap;
}
.pcard__amount {
  font-size: 1.24rem;
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.pcard__unit {
  color: var(--muted-strong);
  font-size: 0.82rem;
  font-weight: 600;
}
.pcard__moq {
  color: var(--muted-2);
  font-size: 0.78rem;
}
.pcard__add {
  margin-top: 8px;
  width: 100%;
}
/* Already in the cart — the button stays a real "add another minimum order"
   control, but says so, so a second press is never a surprise. */
.pcard.is-in-cart .pcard__add {
  background: var(--card);
  color: var(--ink);
  border-color: var(--ink);
}
.pcard.is-in-cart .pcard__add:hover {
  background: var(--surface-2);
}

/* ── How it works ──────────────────────────────────────────────────────── */
.steps {
  padding: clamp(32px, 5vw, 60px) var(--pad-x);
  background: var(--surface-1);
  border-top: 1px solid var(--line);
}
.steps__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
  margin-top: 26px;
}
.step {
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--card);
}
.step__n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
}
.step__title {
  margin-top: 14px;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
}
.step__text {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.94rem;
}

/* ── Cart drawer ───────────────────────────────────────────────────────── */
.cart-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(38, 50, 56, 0.42);
  animation: cart-fade 0.2s var(--ease);
}
.cart-backdrop[hidden],
.cart[hidden],
.cartbar[hidden] {
  display: none;
}
@keyframes cart-fade {
  from {
    opacity: 0;
  }
}

.cart {
  position: fixed;
  inset-block: 0;
  /* End side — the LEFT edge under `dir="rtl"`. That is the side the cart
     trigger sits on (`.nav__actions` is pushed there by `margin-inline-start:
     auto`), and the sticky mini-cart's button too, so the panel opens next to
     what opened it instead of flying in from the opposite edge. */
  inset-inline-end: 0;
  z-index: 61;
  display: flex;
  flex-direction: column;
  width: min(420px, 100%);
  background: var(--card);
  box-shadow: 0 0 40px rgba(38, 50, 56, 0.18);
  animation: cart-in 0.24s var(--ease);
}
@keyframes cart-in {
  from {
    transform: translateX(-24px);
    opacity: 0;
  }
}
.cart__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
}
.cart__title {
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--ink);
}
.cart__close {
  display: inline-flex;
  padding: 8px;
  border: 0;
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  cursor: pointer;
}
.cart__close:hover {
  background: var(--surface-3);
}
.cart__body {
  flex: 1;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  padding: 16px 20px;
}
.cart__empty {
  padding: 36px 8px;
  text-align: center;
  color: var(--muted);
  font-size: 0.94rem;
}
.cart__empty-title {
  display: block;
  margin-bottom: 6px;
  color: var(--ink);
  font-weight: 700;
  font-size: 1rem;
}
.cart__list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.citem {
  display: grid;
  grid-template-columns: 64px 1fr;
  gap: 12px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--line);
}
.cart__list > .citem:last-child {
  border-bottom: 0;
  padding-bottom: 0;
}
.citem__img {
  width: 64px;
  height: 64px;
  border-radius: 12px;
  object-fit: cover;
  background: var(--surface-2);
}
.citem__name {
  font-size: 0.94rem;
  font-weight: 700;
  color: var(--ink);
  line-height: 1.6;
}
.citem__unit {
  margin-top: 2px;
  color: var(--muted-2);
  font-size: 0.78rem;
}
.citem__controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 10px;
}
.citem__qty {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  border: 1px solid var(--line-2);
  border-radius: 10px;
  overflow: hidden;
}
.citem__step {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: 0;
  background: var(--card);
  color: var(--ink);
  font: inherit;
  font-size: 1.1rem;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
}
.citem__step:hover:not(:disabled) {
  background: var(--surface-2);
}
.citem__step:disabled {
  color: var(--line-2);
  cursor: not-allowed;
}
.citem__n {
  min-width: 74px;
  text-align: center;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--ink);
}
.citem__total {
  font-size: 0.9rem;
  font-weight: 700;
  color: var(--ink);
  white-space: nowrap;
}
.citem__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-top: 8px;
}
.citem__remove {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted-strong);
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  cursor: pointer;
}
.citem__remove:hover {
  color: #a13c28;
}

.cart__foot {
  padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
  border-top: 1px solid var(--line);
  background: var(--surface-1);
}
.cart__totalrow {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}
.cart__totallabel {
  color: var(--muted-strong);
  font-weight: 600;
}
.cart__total {
  color: var(--ink);
  font-weight: 700;
}
.cart__total b {
  font-size: 1.3rem;
  font-weight: 800;
  letter-spacing: -0.01em;
}
.cart__cta {
  width: 100%;
}
.cart__note {
  margin-top: 10px;
  color: var(--muted-strong);
  font-size: 0.78rem;
  line-height: 1.8;
}

/* ── Sticky mini-cart (mobile) ─────────────────────────────────────────── */
.cartbar {
  position: fixed;
  inset-inline: 0;
  bottom: 0;
  z-index: 50;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom, 0px));
  background: var(--card);
  border-top: 1px solid var(--line-2);
  box-shadow: 0 -8px 24px rgba(38, 50, 56, 0.08);
}
.cartbar__info {
  color: var(--muted-strong);
  font-size: 0.88rem;
}
.cartbar__info b {
  color: var(--ink);
  font-weight: 800;
}

/* ── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 960px) {
  .steps__grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 700px) {
  .shop__grid {
    grid-template-columns: repeat(2, 1fr);
    gap: 12px;
  }
  .pcard__body {
    padding: 12px 12px 13px;
  }
  .pcard__title {
    font-size: 0.92rem;
  }
  .pcard__amount {
    font-size: 1.08rem;
  }
  .pcard__specs {
    -webkit-line-clamp: 3;
    line-clamp: 3;
    font-size: 0.75rem;
  }
  .pcard__add {
    padding: 11px 12px;
    font-size: 0.86rem;
  }
  /* The nav trigger loses its label on small screens; the sticky bar below is
     the primary way back into the cart there. */
  .cartbtn__label {
    display: none;
  }
  .cartbtn {
    padding: 10px 12px;
  }
  .cartbar[data-visible] {
    display: flex;
  }
  /* Keep the footer clear of the sticky bar. */
  body.has-cartbar {
    padding-bottom: 78px;
  }
}

@media (max-width: 560px) {
  .cart {
    inset-block-start: auto;
    width: 100%;
    max-height: 88vh;
    max-height: 88dvh;
    border-start-start-radius: 22px;
    border-start-end-radius: 22px;
  }
  @keyframes cart-in {
    from {
      transform: translateY(24px);
      opacity: 0;
    }
  }
  .shop-intro__points {
    gap: 6px;
  }
  .shop-intro__points li {
    font-size: 0.8rem;
    padding: 6px 11px;
  }
}

/* Two columns hold down to a 375px phone (the same treatment the customer app's
   product picker uses); only the genuinely narrow devices drop to one. */
@media (max-width: 340px) {
  .shop__grid {
    grid-template-columns: 1fr;
  }
}

/* ── Reduced motion ────────────────────────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  .pcard:hover {
    transform: none;
  }
  .cart,
  .cart-backdrop {
    animation: none;
  }
}


/* ── Product page (/products/<public_id>) ──────────────────────────────────
   One dedicated page per product: Torob rejects a store without them, and its
   terms require the product's information to be readable with JavaScript
   disabled — so everything below is styling over static markup, never over
   something a script had to render. */
/* ⚠️ `.crumbs` is ALSO declared in content.css, and a /brick/<slug> category
   page loads BOTH — with shop.css last, so this block wins there. The colour
   was `--muted-2` (#918878), which styles.css marks as mockup-internal and
   which measures 3.5:1 on the card background: below WCAG AA for body text.
   The breadcrumb one click away, on a page that loads only content.css,
   rendered the same markup at 5.3:1. `--muted-strong` is the AA-passing token
   and is now what both files use — keep them in step. */
.crumbs {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: clamp(18px, 3vw, 26px) var(--pad-x) 0;
  color: var(--muted-strong);
  font-size: 0.86rem;
}
.crumbs a:hover {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 3px;
}
.crumbs [aria-current="page"] {
  color: var(--muted-strong);
  font-weight: 600;
}

.pdp {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(24px, 4vw, 48px);
  align-items: start;
  padding: clamp(20px, 3.5vw, 36px) var(--pad-x) clamp(36px, 5vw, 64px);
}
.pdp__media {
  position: relative;
  aspect-ratio: 4 / 3;
  border: 1px solid var(--line);
  border-radius: 20px;
  background: var(--surface-2);
  overflow: hidden;
}
.pdp__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}
.pdp__cat {
  color: var(--muted-2);
  font-size: 0.86rem;
  font-weight: 600;
}
.pdp__title {
  margin-top: 6px;
  font-size: clamp(1.4rem, 3vw, 2.1rem);
  font-weight: 800;
  line-height: 1.5;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.pdp__subtitle {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.98rem;
}

/* The buy box — price, availability and the purchase button in one block,
   above the fold. This is the "clearly defined purchase button" Torob's
   rejection asked for. */
.pdp__buybox {
  margin-top: 22px;
  padding: 20px;
  border: 1px solid var(--line-2);
  border-radius: 20px;
  background: var(--surface-1);
}
.pdp__stock {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--green);
  font-size: 0.88rem;
  font-weight: 700;
}
.pdp__stock-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--green);
}
.pdp__price {
  margin-top: 10px;
  display: flex;
  align-items: baseline;
  gap: 8px;
  flex-wrap: wrap;
}
.pdp__amount {
  font-size: clamp(1.7rem, 4vw, 2.3rem);
  font-weight: 800;
  color: var(--ink);
  letter-spacing: -0.01em;
}
.pdp__unit {
  color: var(--muted-strong);
  font-size: 0.94rem;
  font-weight: 600;
}
.pdp__moq {
  margin-top: 4px;
  color: var(--muted-2);
  font-size: 0.86rem;
}
.pdp__add {
  margin-top: 16px;
  width: 100%;
}
.pdp__note {
  margin-top: 12px;
  color: var(--muted-strong);
  font-size: 0.8rem;
  line-height: 1.8;
}

.pdp__specs {
  margin-top: 26px;
}
.pdp__specs-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--ink);
  margin-bottom: 12px;
}
.pdp__row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  padding: 11px 2px;
  border-bottom: 1px solid var(--line);
}
.pdp__row:last-child {
  border-bottom: 0;
}
.pdp__label {
  color: var(--muted-2);
  font-size: 0.9rem;
}
.pdp__value {
  margin: 0;
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 600;
  text-align: end;
}
.pdp__back {
  margin-top: 22px;
  font-size: 0.9rem;
  font-weight: 600;
}
.pdp__back a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
}

@media (max-width: 860px) {
  .pdp {
    grid-template-columns: 1fr;
  }
}

/* ── Freshness, synonyms and the buying-guide prose on product pages ───────
   Added with the SEO pass. `.pdp__specs-title` already existed, but the heading
   it styles used to sit INSIDE the <dl> (invalid — a dl takes only dt/dd/div),
   so it is now a sibling above it and needs its own bottom margin. */
.shop-intro__stamp {
  margin: 10px 0 0;
  font-size: 13.5px;
  color: var(--muted-strong);
}
.shop-intro__stamp b {
  color: var(--ink);
  font-weight: 600;
}
.pdp__stamp {
  margin: 8px 0 0;
  font-size: 13px;
  color: var(--muted-strong);
}
.pdp__stamp b {
  color: var(--ink);
  font-weight: 600;
}
.pdp__specs-title {
  margin: 28px 0 12px;
}
/* «این محصول در بازار با نام‌های … هم شناخته می‌شود» — the market spellings the
   catalogue does not use. Visible on purpose: it is the sentence that makes the
   page findable for «لفتون» when the catalogue says «لفتن». */
.pdp__aka {
  margin: 20px 0 0;
  padding: 14px 16px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--muted);
  line-height: 1.9;
}
.pdp__blurb {
  margin: 16px 0 0;
  font-size: 14.5px;
  color: var(--muted);
  line-height: 2;
}
.pdp__blurb a,
.pdp__aka a {
  color: var(--ink);
  text-decoration: underline;
  text-underline-offset: 4px;
  text-decoration-color: var(--line-2);
}
.pdp__blurb a:hover,
.pdp__aka a:hover {
  text-decoration-color: var(--ink);
}
.pdp__related-title {
  margin: 32px 0 4px;
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
}

/* A category page loads BOTH shop.css and content.css: the buying-guide prose
   is `.doc`, the grid below it is `.shop`. The grid needs the page gutter, the
   same as every other section — an earlier attempt zeroed it and rendered the
   product cards edge-to-edge at every breakpoint. `.shop` already carries
   `padding: 0 var(--pad-x)`; the only thing needed here is to stop the nested
   `.doc__inner` from adding a second, narrower measure on top of it. */
.shop > .doc__inner {
  max-width: none;
  margin-inline: 0;
}
