/* ==========================================================
   SOWAYA | products.css
   Shop grid, product cards, product page and the add-to-cart
   control. Load after base.css and page.css. Flat colour only.
   ========================================================== */

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  margin: -1px;
  padding: 0;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

/* ---------- Shop intro (no hero, products come first) ---------- */
.shop {
  padding-block: clamp(2rem, 4vw, 3rem) var(--section);
}
.shopintro {
  max-width: 40rem;
  margin: 0 0 1.75rem;
  font-size: 1.05rem;
  line-height: 1.65;
  color: var(--muted);
}
.shopintro a {
  color: var(--green);
  text-underline-offset: 3px;
}

/* ---------- Category chips ---------- */
.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: clamp(1.5rem, 3vw, 2rem);
}
.chip {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.65rem 1.15rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--green-ink);
  text-decoration: none;
  transition:
    border-color 0.2s,
    background-color 0.2s,
    color 0.2s;
}
.chip span {
  padding: 0.2rem 0.5rem;
  border-radius: 999px;
  background: var(--sand);
  font-size: 0.75rem;
  font-weight: 700;
  color: var(--muted);
  transition:
    background-color 0.2s,
    color 0.2s;
}
.chip:hover {
  border-color: var(--green);
}
.chip.is-active {
  border-color: var(--green);
  background: var(--green);
  color: var(--cream);
}
.chip.is-active span {
  background: var(--gold);
  color: var(--green-ink);
}

/* ---------- Grid and cards ---------- */
.pgrid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: clamp(1rem, 2vw, 1.5rem);
}
.pcard {
  display: flex;
  flex-direction: column;
  padding: 0.6rem;
  border: 1px solid var(--line);
  border-radius: 24px;
  background: var(--white);
  transition:
    border-color 0.2s,
    transform 0.25s;
}
.pcard:hover {
  border-color: var(--green);
  transform: translateY(-3px);
}
.pcard__media {
  position: relative;
  display: block;
  aspect-ratio: 1 / 1;
  border-radius: 17px;
  background: var(--sand);
  overflow: hidden;
}
.pcard__media img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  transition: transform 0.5s;
}
.pcard:hover .pcard__media img {
  transform: scale(1.05);
}
.pcard.is-out .pcard__media img {
  opacity: 0.5;
  filter: grayscale(0.4);
}
.pcard__ph {
  display: block;
  width: 100%;
  height: 100%;
  background: var(--sand);
}
.badge {
  position: absolute;
  top: 0.7rem;
  left: 0.7rem;
  padding: 0.3rem 0.7rem;
  border-radius: 999px;
  background: var(--gold);
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--green-ink);
}
.badge--low {
  background: var(--white);
  box-shadow: inset 0 0 0 1px var(--gold);
}
.badge--out {
  background: var(--charcoal);
  color: var(--cream);
}
.pcard__body {
  display: flex;
  flex-direction: column;
  flex: 1;
  padding: 1rem 0.6rem 0.5rem;
}
.pcard__title {
  margin: 0;
  font-size: 1.12rem;
  line-height: 1.25;
  color: var(--green-ink);
}
.pcard__title a {
  color: inherit;
  text-decoration: none;
}
.pcard__title a:hover {
  color: var(--green);
}
.pcard__unit {
  margin: 0.3rem 0 0;
  font-size: 0.86rem;
  color: var(--muted);
}
.pcard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: auto;
  padding-top: 1.1rem;
}
.pcard__price {
  margin: 0;
  font-family: var(--font-head);
  font-size: 1.4rem;
  font-weight: 600;
  line-height: 1;
  color: var(--green-ink);
}

/* ---------- Add to cart ---------- */
.buy {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.75rem;
}
.buy__btn {
  justify-content: center;
}
.buy--compact {
  position: relative;
  display: block;
  flex-shrink: 0;
}
.buy--compact .buy__btn {
  width: 2.9rem;
  height: 2.9rem;
  padding: 0;
  border-radius: 50%;
}
.buy--compact .buy__btn:hover {
  transform: scale(1.08);
}
.buy__off {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--muted);
}
.buy--compact .buy__note {
  position: absolute;
  right: 0;
  bottom: calc(100% + 0.6rem);
  z-index: 3;
  width: max-content;
  max-width: 13rem;
  padding: 0.55rem 0.8rem;
  border-radius: 12px;
  background: var(--charcoal);
  font-size: 0.8rem;
  line-height: 1.4;
  color: var(--cream);
}
.buy__btn--off {
  background: var(--sand);
  color: var(--muted);
  cursor: not-allowed;
  border-color: var(--line);
}
.buy__btn--off:hover {
  transform: none;
}
.buy__note {
  flex-basis: 100%;
  margin: 0;
  min-height: 0;
  font-size: 0.88rem;
  color: var(--green);
}
.buy__note:empty {
  display: none;
}
.stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid rgba(36, 43, 39, 0.28);
  border-radius: 999px;
  background: var(--white);
}
.stepper__btn {
  width: 2.9rem;
  height: 3rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.3rem;
  color: var(--green-ink);
  cursor: pointer;
  border-radius: 999px;
  transition: background-color 0.2s;
}
.stepper__btn:hover {
  background: var(--sand);
}
.stepper__input {
  width: 3rem;
  height: 3rem;
  border: 0;
  background: none;
  font: inherit;
  font-size: 1.05rem;
  font-weight: 700;
  text-align: center;
  color: var(--green-ink);
  -moz-appearance: textfield;
  appearance: textfield;
}
.stepper__input::-webkit-outer-spin-button,
.stepper__input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.stepper:focus-within {
  border-color: var(--green);
  box-shadow: 0 0 0 4px rgba(217, 162, 39, 0.35);
}
.stepper__input:focus {
  outline: none;
}

/* ---------- Pager and empty ---------- */
.pager {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-top: clamp(2.5rem, 5vw, 3.5rem);
}
.pager__link {
  padding: 0.7rem 1.25rem;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--white);
  font-weight: 600;
  color: var(--green-ink);
  text-decoration: none;
  transition:
    border-color 0.2s,
    background-color 0.2s,
    color 0.2s;
}
a.pager__link:hover {
  border-color: var(--green);
  background: var(--green);
  color: var(--cream);
}
.pager__link.is-off {
  opacity: 0.4;
}
.pager__now {
  font-size: 0.9rem;
  color: var(--muted);
}
.pempty {
  max-width: 34rem;
  margin-inline: auto;
  padding: clamp(1.5rem, 4vw, 3rem) 0;
  text-align: center;
}
.pempty h2 {
  margin: 0 0 1rem;
  color: var(--green-ink);
}
.pempty p {
  margin: 0 0 1.75rem;
  color: var(--muted);
  line-height: 1.65;
}

/* ---------- Product page ---------- */
.pdetail {
  padding-block: clamp(2rem, 4vw, 3.5rem) clamp(3.5rem, 7vw, 6rem);
}
.pdetail .crumbs {
  margin-bottom: clamp(1.5rem, 3vw, 2.25rem);
}
.pdetail__grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: clamp(2rem, 6vw, 5rem);
  align-items: start;
}
.pdetail__grid--solo {
  grid-template-columns: minmax(0, 36rem);
}
.pdetail__media {
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--sand);
  overflow: hidden;
}
.pdetail__media img {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 1 / 1;
  object-fit: cover;
}
.pdetail__cat {
  margin: 0 0 0.75rem;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--green);
}
.pdetail__title {
  margin: 0 0 1rem;
  font-size: clamp(2rem, 4vw, 3rem);
  line-height: 1.1;
  color: var(--green-ink);
}
.pdetail__price {
  margin: 0 0 0.5rem;
  font-family: var(--font-head);
  font-size: clamp(1.8rem, 3vw, 2.3rem);
  font-weight: 600;
  color: var(--green-ink);
}
.pdetail__price span {
  font-family: var(--font-body);
  font-size: 1rem;
  font-weight: 400;
  color: var(--muted);
}
.pdetail__stock {
  margin: 0 0 1.75rem;
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--green);
}
.pdetail__stock::before {
  content: "";
  display: inline-block;
  width: 0.55rem;
  height: 0.55rem;
  margin-right: 0.5rem;
  border-radius: 50%;
  background: currentColor;
}
.pdetail__stock.is-low {
  color: #9a6a00;
}
.pdetail__stock.is-out {
  color: #b3382c;
}
.pdetail__buy {
  margin-bottom: 2rem;
  padding-bottom: 2rem;
  border-bottom: 1px solid var(--line);
}
.pdetail__points {
  margin: 0 0 1.5rem;
  padding: 1.5rem 0 0;
  list-style: none;
  border-top: 1px solid var(--line);
}
.pdetail__points li {
  position: relative;
  margin-bottom: 0.6rem;
  padding-left: 1.6rem;
  font-size: 0.96rem;
  color: var(--charcoal);
}
.pdetail__points li::before {
  content: "✓";
  position: absolute;
  left: 0;
  font-weight: 700;
  color: var(--green);
}
.pdetail__bulk {
  margin: 0;
  font-size: 0.95rem;
  color: var(--muted);
}
.pdetail__bulk a {
  color: var(--green);
  text-underline-offset: 3px;
}
.pdetail__desc {
  margin: 0 0 1.75rem;
  font-size: 1.02rem;
  line-height: 1.75;
  color: var(--charcoal);
}
.pdetail__desc p {
  margin: 0 0 1rem;
}
.pdetail__desc p:last-child {
  margin-bottom: 0;
}

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .pgrid {
    grid-template-columns: repeat(3, minmax(0, 1fr));
  }
}
@media (max-width: 860px) {
  .pgrid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .pdetail__grid,
  .pdetail__grid--solo {
    grid-template-columns: minmax(0, 1fr);
  }
  .pdetail__media {
    max-width: 32rem;
  }
}
@media (max-width: 520px) {
  .pgrid {
    gap: 0.75rem;
  }
  .pcard {
    padding: 0.45rem;
    border-radius: 20px;
  }
  .pcard__media {
    border-radius: 14px;
  }
  .pcard__body {
    padding: 0.8rem 0.4rem 0.35rem;
  }
  .pcard__title {
    font-size: 1rem;
  }
  .pcard__unit {
    font-size: 0.8rem;
  }
  .pcard__price {
    font-size: 1.15rem;
  }
  .buy--compact .buy__btn {
    width: 2.6rem;
    height: 2.6rem;
  }
  .pdetail__buy .buy {
    flex-direction: column;
    align-items: stretch;
  }
  .pdetail__buy .stepper {
    align-self: flex-start;
  }
  .pager {
    flex-wrap: wrap;
    justify-content: center;
  }
  .pager__now {
    order: -1;
    flex-basis: 100%;
    text-align: center;
  }
}
