/* ---------- Design tokens ---------- */
:root {
  --ink: #171a1d;
  --ink-soft: #2b3036;
  --canvas: #ece7dd;
  --panel: #ffffff;
  --rust: #b5502d;
  --rust-dark: #8f3e21;
  --steel: #3e5c6b;
  --stitch: #c9bfa8;
  --text-muted: #5c5850;
  --radius: 4px;
  --font: "Vazirmatn", "Tahoma", sans-serif;
  --maxw: 1180px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--canvas);
  color: var(--ink);
  line-height: 1.7;
}
img { max-width: 100%; display: block; }
a { color: inherit; text-decoration: none; }
button { font-family: inherit; cursor: pointer; border: none; background: none; }

.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 20px; }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 13px 26px;
  border-radius: var(--radius);
  font-weight: 700;
  font-size: 15px;
  transition: transform .15s ease, background .15s ease;
}
.btn-primary { background: var(--rust); color: #fff; }
.btn-primary:hover { background: var(--rust-dark); }
.btn-primary:active { transform: scale(.98); }
.btn-block { width: 100%; justify-content: center; }

/* ---------- Header ---------- */
.site-header { background: var(--ink); color: #fff; }
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px;
}
.brand { display: flex; align-items: center; gap: 10px; }
.brand-mark {
  width: 12px; height: 26px;
  background: var(--rust);
  display: inline-block;
}
.brand-name { font-weight: 800; font-size: 20px; letter-spacing: -.2px; }
.header-actions { display: flex; align-items: center; gap: 14px; }
.phone-link { display: flex; align-items: center; gap: 6px; font-size: 14px; color: #d8d4c9; }
.cart-btn {
  display: flex; align-items: center; gap: 8px;
  background: var(--ink-soft); color: #fff;
  padding: 9px 16px; border-radius: var(--radius); font-weight: 600; font-size: 14px;
  position: relative;
}
.cart-count {
  background: var(--rust); color: #fff; font-size: 12px; font-weight: 700;
  min-width: 20px; height: 20px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- Hero ---------- */
.hero { background: var(--ink); color: #fff; padding: 64px 0 56px; position: relative; }
.hero-row { display: flex; align-items: center; justify-content: space-between; gap: 40px; }
.hero-copy { max-width: 560px; }
.hero-copy h1 {
  font-size: 42px; font-weight: 800; line-height: 1.25; margin: 0 0 14px;
  letter-spacing: -.5px;
}
.hero-copy p { color: #cfc9ba; font-size: 17px; margin: 0 0 26px; max-width: 46ch; }
.hero-tag {
  border: 1px dashed var(--stitch);
  padding: 20px 26px;
  min-width: 220px;
  color: #ece7dd;
}
.tag-line {
  font-size: 14px; font-weight: 600; padding: 8px 0;
  border-bottom: 1px solid rgba(236,231,221,.15);
}
.tag-line:last-child { border-bottom: none; }

/* ---------- Category bar ---------- */
.category-bar { background: var(--panel); border-bottom: 1px solid var(--stitch); position: sticky; top: 0; z-index: 5; }
.cat-row { display: flex; gap: 10px; overflow-x: auto; padding: 14px 20px; scrollbar-width: thin; }
.cat-chip {
  flex: 0 0 auto;
  padding: 9px 18px; border-radius: 999px; border: 1px solid var(--stitch);
  font-size: 14px; font-weight: 600; color: var(--ink-soft); background: transparent;
  white-space: nowrap;
}
.cat-chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Product grid ---------- */
main.wrap { padding-top: 40px; padding-bottom: 60px; }
.product-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 22px;
}
.product-card {
  background: var(--panel);
  border: 1px solid var(--stitch);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.product-card .accent-bar { height: 5px; background: var(--rust); }
.product-media {
  aspect-ratio: 4/3; background: #ddd6c6;
  display: flex; align-items: center; justify-content: center;
  overflow: hidden; position: relative;
}
.product-media img { width: 100%; height: 100%; object-fit: cover; }
.product-media .initial { font-size: 34px; font-weight: 800; color: var(--text-muted); }
.product-body { padding: 16px 16px 18px; display: flex; flex-direction: column; gap: 10px; flex: 1; }
.product-cat { font-size: 12px; color: var(--steel); font-weight: 700; }
.product-title { font-size: 16px; font-weight: 700; margin: 0; }
.product-price { font-size: 15px; font-weight: 800; color: var(--rust-dark); margin-top: auto; }
.product-actions { display: flex; gap: 8px; }
.btn-outline {
  flex: 1; text-align: center; font-size: 13px; font-weight: 700;
  padding: 9px 10px; border: 1px solid var(--ink); border-radius: var(--radius);
}
.btn-add { flex: 1; text-align: center; font-size: 13px; font-weight: 700; color: #fff;
  background: var(--ink); padding: 9px 10px; border-radius: var(--radius); }

.empty-state {
  text-align: center; padding: 60px 20px; color: var(--text-muted);
  border: 1px dashed var(--stitch); font-size: 15px;
}

/* ---------- Footer ---------- */
.site-footer { background: var(--ink); color: #cfc9ba; padding: 34px 0; margin-top: 20px; }
.footer-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 20px; flex-wrap: wrap; }
.footer-links { display: flex; gap: 18px; font-size: 14px; }
.footer-links a { color: #ece7dd; font-weight: 600; }

/* ---------- Popups ---------- */
.popup-overlay {
  position: fixed; inset: 0; background: rgba(23,26,29,.6);
  display: flex; align-items: center; justify-content: center;
  padding: 20px; z-index: 50;
}
.popup-overlay[hidden] { display: none; }
.popup-card {
  background: var(--panel); max-width: 420px; width: 100%;
  padding: 26px; position: relative; border-radius: var(--radius);
}
.popup-close {
  position: absolute; top: 10px; left: 10px;
  font-size: 22px; width: 32px; height: 32px; color: var(--text-muted);
}
.popup-card h3 { margin: 4px 0 8px; font-size: 19px; }
.popup-card img { border-radius: var(--radius); margin-bottom: 12px; }

.detail-card { max-width: 520px; }
.detail-media { aspect-ratio: 4/3; background: #ddd6c6; margin-bottom: 14px; overflow: hidden; }
.detail-media img { width: 100%; height: 100%; object-fit: cover; }
.detail-row { display: flex; gap: 8px; flex-wrap: wrap; margin: 10px 0; }
.detail-chip { border: 1px solid var(--stitch); padding: 5px 12px; font-size: 13px; border-radius: 999px; }
.detail-chip.is-active { background: var(--ink); color: #fff; border-color: var(--ink); }

/* ---------- Cart drawer ---------- */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(23,26,29,.5); z-index: 40; }
.cart-drawer {
  position: fixed; top: 0; bottom: 0; left: 0; width: min(360px, 92vw);
  background: var(--panel); z-index: 41; padding: 20px;
  display: flex; flex-direction: column; box-shadow: 8px 0 24px rgba(0,0,0,.15);
}
.cart-drawer[hidden] { display: none; }
.cart-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.cart-items { flex: 1; overflow-y: auto; display: flex; flex-direction: column; gap: 12px; }
.cart-item { display: flex; gap: 10px; align-items: center; border-bottom: 1px dashed var(--stitch); padding-bottom: 10px; }
.cart-item-info { flex: 1; font-size: 13px; }
.cart-item-info .ci-title { font-weight: 700; margin-bottom: 3px; }
.cart-item-info .ci-meta { color: var(--text-muted); font-size: 12px; }
.qty-controls { display: flex; align-items: center; gap: 8px; }
.qty-controls button { width: 26px; height: 26px; border: 1px solid var(--stitch); border-radius: var(--radius); font-weight: 700; }
.cart-empty { color: var(--text-muted); font-size: 14px; text-align: center; margin-top: 30px; }
.cart-summary { border-top: 1px solid var(--stitch); margin-top: 14px; padding-top: 14px; }
.cart-line { display: flex; justify-content: space-between; font-size: 14px; padding: 4px 0; }
.cart-total { font-weight: 800; font-size: 16px; padding-top: 8px; border-top: 1px solid var(--stitch); margin-top: 6px; }
.cart-note { font-size: 12px; color: var(--text-muted); margin-top: 10px; text-align: center; }

/* ---------- Responsive ---------- */
@media (max-width: 760px) {
  .hero-row { flex-direction: column; align-items: flex-start; }
  .hero-copy h1 { font-size: 30px; }
  .hero-tag { width: 100%; }
  .header-row { flex-wrap: wrap; gap: 10px; }
}

@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; scroll-behavior: auto !important; }
}

:focus-visible { outline: 2px solid var(--rust); outline-offset: 2px; }
