/* ==========================================================================
   Naveed Mobiles — catalogue: product card, grid, filters, product page.
   ========================================================================== */

/* ---------------------------------------------------------- product card --
   Appears hundreds of times, so it carries the thesis: real specs in mono,
   an honest stock line, and no urgency theatre anywhere. */

.pcard {
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
  overflow: hidden;
  transition: transform var(--dur-slow) var(--ease-out),
              border-color var(--dur-slow) var(--ease-out);
}
@media (hover: hover) {
  .pcard:hover { transform: translateY(-2px); border-color: var(--cyan); }
}
.pcard__link { display: block; color: inherit; text-decoration: none; height: 100%; }

.pcard__media { position: relative; background: var(--surface); }
.pcard__media img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }

/* Semantic, not decorative: this only ever appears when stock is genuinely 0. */
.pcard__flag {
  position: absolute; inset-inline: 0; bottom: 0;
  padding: 0.3rem 0.6rem;
  background: var(--status-out);
  color: #FFFFFF;
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
}
/* Caught by the 360px/contrast sweep: dark theme's --status-out (#D4646E) is
   tuned as TEXT on a dark surface (.stock--out uses it that way and clears
   AA), but white text on it as a BACKGROUND only reaches 3.59:1 — the token
   itself is not touched, since that would risk the pairing it IS tuned for.
   Reuses the light theme's --status-out value here instead: it is already in
   the palette, and white-on-it clears 7.55:1. */
[data-theme="dark"] .pcard__flag { background: #96303A; }

/* Only ever rendered next to a genuine struck-through price (discountPercent()
   returns null otherwise) — never decoration, never invented. Small, corner-
   anchored, mono for the number: a fact stated plainly, not a sale sticker.
   Deliberately NOT red or spinning — that vocabulary is reserved for real
   stock states, and a discount badge is not urgency theatre. */
.pcard__discount {
  position: absolute; top: 0.5rem; left: 0.5rem;
  padding: 0.2rem 0.45rem;
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  border: 1px solid var(--status-ok);
  color: var(--status-ok);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.75rem;
  font-weight: 700;
}

.pcard__body { padding: 0.75rem; display: grid; gap: 0.25rem; }

.pcard__brand {
  font-size: 0.6875rem;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--ink-faint);
}

.pcard__name {
  font-family: var(--font-body);
  font-size: 0.9375rem;
  font-weight: 600;
  line-height: 1.3;
  letter-spacing: 0;
}

/* The spec strip. Mono, muted, directly under the title and above the price,
   so a column of cards can be compared by scanning straight down. */
.pcard__spec { margin-top: 0.125rem; }

.pcard__prices { display: flex; align-items: baseline; gap: 0.5rem; flex-wrap: wrap; margin-top: 0.25rem; }
.pcard__price  { font-size: 1.0625rem; font-weight: 600; }
/* Only rendered via hasGenuineAnchor(): an item must actually have sold at this
   price. An invented anchor is the oldest trick in this market. */
.pcard__anchor { font-size: 0.875rem; color: var(--ink-faint); text-decoration: line-through; }

/* ------------------------------------------------------------------ grid -- */

.pgrid {
  display: grid;
  gap: 0.75rem;
  grid-template-columns: repeat(2, minmax(0, 1fr));
}
@media (min-width: 640px)  { .pgrid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; } }
@media (min-width: 1024px) { .pgrid { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* Results changed, no reload. 150ms, opacity only. */
.pgrid.is-swapping { opacity: 0.45; transition: opacity var(--dur-fast) var(--ease-out); }

.pgrid-empty {
  grid-column: 1 / -1;
  padding: 2.5rem 1rem;
  text-align: center;
  border: 1px dashed var(--hairline);
  border-radius: var(--r-md);
}

/* --------------------------------------------------------------- listing -- */

.listing { display: grid; gap: 1.5rem; }
@media (min-width: 1024px) { .listing { grid-template-columns: 260px minmax(0, 1fr); gap: 2rem; align-items: start; } }

.listing__head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.75rem; justify-content: space-between; }
.listing__count { font-size: 0.875rem; color: var(--ink-soft); }

.crumbs { font-size: 0.8125rem; color: var(--ink-soft); margin-bottom: 0.75rem; }
.crumbs a { color: var(--ink-soft); }
.crumbs span { margin-inline: 0.375rem; color: var(--ink-faint); }

/* --------------------------------------------------------------- filters --
   Left rail on desktop, bottom sheet on mobile. Never a dropdown row on
   mobile: a filter you cannot see the state of is a filter nobody uses. */

.filters { display: grid; gap: 1.25rem; }
.filters__group { display: grid; gap: 0.5rem; }
.filters__group h3 { font-size: 0.75rem; text-transform: uppercase; letter-spacing: 0.07em; color: var(--ink-faint); }
.filters__opts { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.filters__opts .chip { min-height: 40px; font-size: 0.875rem; }
.filters__opt-icon { display: inline-flex; margin-right: 0.25rem; vertical-align: -3px; color: var(--ink-soft); }

.filters__range { display: flex; align-items: center; gap: 0.5rem; }
.filters__range input {
  width: 100%; min-width: 0; min-height: 44px;
  padding: 0.5rem 0.625rem;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
}

/* Applied filters, with a clear remove affordance. */
.applied { display: flex; flex-wrap: wrap; gap: 0.375rem; margin-bottom: 1rem; }
.applied__chip {
  display: inline-flex; align-items: center; gap: 0.375rem;
  min-height: 36px;
  padding: 0.25rem 0.5rem 0.25rem 0.75rem;
  border: 1px solid var(--cyan);
  border-radius: var(--r-sm);
  background: var(--cyan-wash);
  font-size: 0.8125rem;
  text-decoration: none;
  color: var(--ink);
}
.applied__chip b { font-weight: 600; }
.applied__x { font-size: 1rem; line-height: 1; color: var(--ink-soft); }

.filter-trigger { display: inline-flex; }
@media (min-width: 1024px) { .filter-trigger { display: none; } }

/* The mobile sheet. One of the few places a real shadow is used. */
.sheet[hidden] { display: none; }
/* The scrim itself is frosted: it is the one place a blur genuinely helps,
   pushing the page behind it out of focus so the sheet reads as the only
   thing you can act on. Tint carries the contrast; the blur is decoration. */
.sheet {
  position: fixed; inset: 0; z-index: 60;
  display: grid; align-items: end;
  background: rgba(26, 24, 71, 0.45);
  overscroll-behavior: contain;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sheet { -webkit-backdrop-filter: blur(6px); backdrop-filter: blur(6px); }
}
.sheet__panel {
  background: var(--glass-bg-solid);
  border-radius: var(--r-lg) var(--r-lg) 0 0;
  box-shadow: var(--shadow-float);
  max-height: 85vh;
  overflow-y: auto;
  padding: 1rem 1rem 5.5rem;
}
@supports ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .sheet__panel {
    background: var(--glass-bg);
    -webkit-backdrop-filter: var(--glass-blur);
    backdrop-filter: var(--glass-blur);
  }
}
.sheet__head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 1rem; }
/* Apply sits in the thumb zone, pinned to the bottom of the sheet. */
.sheet__foot {
  position: sticky; bottom: 0;
  margin: 1rem -1rem -5.5rem;
  padding: 0.75rem 1rem;
  background: var(--surface-raised);
  border-top: 1px solid var(--hairline);
  display: flex; gap: 0.5rem;
}
.sheet__foot .btn { flex: 1; }
@media (min-width: 1024px) {
  .listing__rail { position: sticky; top: 96px; }
  /* On desktop the sheet is not a sheet at all — it is a plain filter rail in
     the page flow, so every floating treatment including the glass comes off. */
  .sheet { position: static; display: block; background: none; -webkit-backdrop-filter: none; backdrop-filter: none; }
  .sheet__panel {
    max-height: none; overflow: visible; box-shadow: none; padding: 0;
    border-radius: 0; background: none; border: 0;
    -webkit-backdrop-filter: none; backdrop-filter: none;
  }
  .sheet__head, .sheet__foot { display: none; }
}

/* ---------------------------------------------------------- product page -- */

.product { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .product { grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 2.5rem; align-items: start; } }
@media (min-width: 900px) { .product__gallery { position: sticky; top: 96px; } }

.gallery__main { border: 1px solid var(--hairline); border-radius: var(--r-md); overflow: hidden; background: var(--surface-raised); }
.gallery__main img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
.gallery__thumbs { display: flex; gap: 0.5rem; margin-top: 0.5rem; overflow-x: auto; }
.gallery__thumb {
  flex: 0 0 64px; padding: 0; border: 1px solid var(--hairline);
  border-radius: var(--r-sm); overflow: hidden; background: none; cursor: pointer;
}
.gallery__thumb[aria-current="true"] { border-color: var(--cyan); border-width: 2px; }
.gallery__thumb img { width: 100%; aspect-ratio: 1 / 1; object-fit: cover; }
/* Accessories are bought blind on size constantly, so one photo must show scale. */
.gallery__scale-note { font-size: 0.75rem; color: var(--ink-faint); margin-top: 0.375rem; }

.product__title { margin-bottom: 0.375rem; }
.product__spec  { margin-bottom: 0.75rem; font-size: 0.9375rem; }
.product__price { font-size: 1.75rem; font-weight: 700; }
.product__anchor { font-size: 1rem; color: var(--ink-faint); text-decoration: line-through; margin-left: 0.5rem; }

/* Same rule as the card badge: only ever shown next to a genuine struck-
   through anchor, keyed to whichever price is currently selected. */
.product__discount {
  display: inline-block;
  margin-left: 0.5rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--r-sm);
  border: 1px solid var(--status-ok);
  color: var(--status-ok);
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: 0.8125rem;
  font-weight: 700;
  vertical-align: middle;
}

.variants { display: grid; gap: 0.5rem; margin-block: 1.25rem; }
.variants__opts { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.variants__opts .chip { flex-direction: column; align-items: flex-start; gap: 0; padding: 0.375rem 0.75rem; }
.variants__opts .chip small { font-size: 0.6875rem; color: var(--ink-soft); }
.variants__opts .chip[disabled] { opacity: 0.45; cursor: not-allowed; }

.buybar { display: flex; gap: 0.75rem; align-items: center; margin-block: 1rem; }
.buybar .btn { flex: 1; }
.qty { display: flex; align-items: center; border: 1px solid var(--hairline); border-radius: var(--r-md); }
.qty button { width: 44px; height: 44px; background: none; border: 0; cursor: pointer; font-size: 1.125rem; }
.qty input { width: 44px; height: 44px; border: 0; text-align: center; background: none; font-family: var(--font-mono); }

/* Sticky in the thumb zone on mobile: add-to-cart must never require a scroll. */
@media (max-width: 899px) {
  .buybar--sticky {
    position: sticky; bottom: 0; z-index: 30;
    margin-inline: -1rem; padding: 0.75rem 1rem;
    background: var(--surface-raised);
    border-top: 1px solid var(--hairline);
  }
}

.panel { border-top: 1px solid var(--hairline); padding-block: 1.25rem; }
.panel h2 { font-size: 1.0625rem; margin-bottom: 0.625rem; }

/* Kills more support messages than anything else on the page. */
.boxlist { list-style: none; display: grid; gap: 0.25rem; }
.boxlist li { padding-left: 1.125rem; position: relative; }
.boxlist li::before { content: ""; position: absolute; left: 0; top: 0.6em; width: 6px; height: 6px; border-radius: 50%; background: var(--cyan); }

.spectable { width: 100%; border-collapse: collapse; font-size: 0.9375rem; }
.spectable th, .spectable td { text-align: left; padding: 0.5rem 0; border-bottom: 1px solid var(--hairline); vertical-align: top; }
.spectable th { width: 42%; font-weight: 500; color: var(--ink-soft); }
.spectable td { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }

.compat { display: flex; flex-wrap: wrap; gap: 0.375rem; }
.compat a {
  display: inline-block; padding: 0.3rem 0.625rem;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  font-size: 0.8125rem; text-decoration: none; color: var(--ink);
}
.compat a:hover { background: var(--cyan-wash); border-color: var(--cyan); }

/* ------------------------------------------------------------------ cart -- */

.cart { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .cart { grid-template-columns: minmax(0, 1fr) 320px; align-items: start; gap: 2rem; } }

.cart__lines { display: grid; gap: 0.75rem; }

.cartline {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0.75rem;
  padding: 0.75rem;
  background: var(--surface-raised);
  border: 1px solid var(--hairline);
  border-radius: var(--r-md);
}
@media (min-width: 640px) { .cartline { grid-template-columns: 88px minmax(0, 1fr) auto; } }

.cartline__media img { width: 88px; height: 88px; object-fit: cover; border-radius: var(--r-sm); }
.cartline__body { display: grid; gap: 0.125rem; align-content: start; min-width: 0; }
.cartline__name { font-weight: 600; color: inherit; text-decoration: none; }
.cartline__name:hover { text-decoration: underline; }

.cartline__actions {
  grid-column: 1 / -1;
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding-top: 0.5rem; border-top: 1px solid var(--hairline);
}
@media (min-width: 640px) {
  .cartline__actions {
    grid-column: auto;
    flex-direction: column; align-items: flex-end;
    padding-top: 0; border-top: 0;
  }
}
.cartline__qty { display: flex; gap: 0.375rem; }
.cartline__qty input {
  width: 64px; min-height: 44px; text-align: center;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  background: var(--surface-raised);
}
.cartline__total { font-weight: 600; }

.linkbtn {
  background: none; border: 0; padding: 0.5rem 0;
  min-height: 44px;
  color: var(--cyan-ink); cursor: pointer;
  text-decoration: underline; text-underline-offset: 2px;
}

.cart__summary { padding: 1rem; }
@media (min-width: 900px) { .cart__summary { position: sticky; top: 96px; } }
.cart__summary h2 { font-size: 1.0625rem; margin-bottom: 0.75rem; }

.totals { display: grid; grid-template-columns: 1fr auto; gap: 0.375rem 1rem; margin-bottom: 0.75rem; }
.totals dt { color: var(--ink-soft); }
.totals dd { text-align: right; }
.totals .is-total { font-size: 1.125rem; font-weight: 700; }
.totals__rule { grid-column: 1 / -1; border-top: 1px solid var(--hairline); margin-block: 0.25rem; }

/* -------------------------------------------------------------- checkout -- */

/* Real labels, always. Placeholder text is not a label. */
.field { display: grid; gap: 0.25rem; margin-bottom: 1rem; }
.field label { font-weight: 600; font-size: 0.9375rem; }
.field input, .field select, .field textarea {
  width: 100%;
  min-height: 44px;
  padding: 0.625rem 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  background: var(--surface-raised);
  color: var(--ink);
}
.field textarea { min-height: 88px; resize: vertical; }
.field input[aria-invalid="true"], .field select[aria-invalid="true"], .field textarea[aria-invalid="true"] {
  border-color: var(--status-out);
  border-width: 2px;
}
.field__hint { font-size: 0.8125rem; color: var(--ink-faint); }
.field__err  { font-size: 0.8125rem; color: var(--status-out); font-weight: 600; }

.payopt {
  display: flex; gap: 0.625rem; align-items: flex-start;
  padding: 0.75rem;
  border: 1px solid var(--hairline);
  border-radius: var(--r-sm);
  margin-bottom: 0.5rem;
  cursor: pointer;
}
.payopt:has(input:checked) { border-color: var(--cyan); background: var(--cyan-wash); }
.payopt input { margin-top: 0.25rem; width: 20px; height: 20px; flex: 0 0 auto; }
.payopt span { display: grid; gap: 0.125rem; }
.payopt small { color: var(--ink-soft); font-size: 0.8125rem; }
.payopt--plain { border-style: dashed; }

.sumline {
  display: flex; justify-content: space-between; gap: 0.75rem;
  padding-block: 0.375rem;
  border-bottom: 1px solid var(--hairline);
  font-size: 0.9375rem;
}

/* --------------------------------------------------------------- invoice -- */

.invoice { display: grid; gap: 1.5rem; }
@media (min-width: 900px) { .invoice { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; gap: 2rem; } }

.statusbar {
  display: flex; flex-wrap: wrap; gap: 0.5rem;
  padding: 0.75rem 1rem;
  border-radius: var(--r-md);
  border: 1px solid var(--hairline);
  background: var(--surface-raised);
  align-items: center;
  margin-bottom: 1rem;
}
.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: var(--r-sm);
  font-size: 0.8125rem;
  font-weight: 600;
}
.badge--wait { background: var(--cyan-wash); color: var(--cyan-ink); }
.badge--ok   { background: rgba(23,112,94,0.12); color: var(--status-ok); }
.badge--warn { background: rgba(156,90,12,0.12); color: var(--status-low); }
.badge--bad  { background: rgba(150,48,58,0.12); color: var(--status-out); }

.qrbox { text-align: center; padding: 1rem; }
.qrbox img { width: 100%; max-width: 260px; margin-inline: auto; border-radius: var(--r-sm); }
.qrbox__missing {
  display: grid; place-items: center;
  aspect-ratio: 1 / 1; max-width: 260px; margin-inline: auto;
  border: 1px dashed var(--hairline); border-radius: var(--r-sm);
  color: var(--ink-faint); padding: 1rem; font-size: 0.875rem;
}

/* THE number the buyer must transfer and the operator must match. The paisa
   digits are weighted heavier because they are what identifies the order. */
.payamount { text-align: center; margin-block: 0.75rem; }
.payamount__rs {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: clamp(1.75rem, 1.2rem + 2.2vw, 2.5rem);
  font-weight: 500;
  letter-spacing: -0.01em;
}
.payamount__paisa { font-weight: 800; color: var(--cyan-ink); }
.payamount__note { font-size: 0.8125rem; color: var(--ink-soft); margin-top: 0.375rem; }

.steps { list-style: none; display: grid; gap: 0.5rem; counter-reset: step; }
.steps li {
  display: grid; grid-template-columns: 26px 1fr; gap: 0.625rem; align-items: start;
  font-size: 0.9375rem;
}
.steps li::before {
  counter-increment: step; content: counter(step);
  display: grid; place-items: center;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--cyan-wash); color: var(--cyan-ink);
  font-family: var(--font-mono); font-size: 0.8125rem; font-weight: 600;
}

.timeline { list-style: none; display: grid; gap: 0.625rem; }
.timeline li { display: grid; grid-template-columns: auto 1fr; gap: 0.625rem; font-size: 0.875rem; }
.timeline time { color: var(--ink-faint); font-family: var(--font-mono); white-space: nowrap; }

/* ------------------------------------------------------------ pagination -- */

.pager { display: flex; gap: 0.375rem; justify-content: center; margin-top: 1.5rem; flex-wrap: wrap; }
.pager a, .pager span {
  min-width: 44px; min-height: 44px;
  display: inline-grid; place-items: center;
  padding-inline: 0.5rem;
  border: 1px solid var(--hairline); border-radius: var(--r-sm);
  text-decoration: none; color: var(--ink);
  font-family: var(--font-mono);
}
.pager .is-current { background: var(--cyan-wash); border-color: var(--cyan); font-weight: 600; }
.pager .is-gap { border: 0; min-width: 0; }
