:root {
  --olive-dark: #505a3e;
  --olive: #7a8360;
  --sand: #cbc2ac;
  --linen: #dbd4c6;
  --rust: #9a5334;
  --paper: #efeae0;
  --ink: #2f3424;
  --white: #fbf9f4;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(60, 55, 40, .12);
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }
body {
  margin: 0; color: var(--ink);
  background-color: var(--paper);
  background-image:
    repeating-linear-gradient(0deg, rgba(120,110,80,.035) 0 1px, transparent 1px 3px),
    repeating-linear-gradient(90deg, rgba(120,110,80,.035) 0 1px, transparent 1px 3px);
  font-family: Inter, system-ui, sans-serif; line-height: 1.5;
}
html[dir="rtl"] body { font-family: Cairo, Tahoma, sans-serif; }
img { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { color: var(--olive-dark); line-height: 1.2; margin: 0 0 .5em; }

/* Top bar */
.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; justify-content: space-between;
  padding: 8px 20px; background: rgba(239, 234, 224, .92); backdrop-filter: blur(8px);
  border-bottom: 1px dashed var(--sand);
}
.brand img { height: 58px; width: auto; }
.top-actions { display: flex; gap: 8px; }
.pill {
  border: 1.5px solid var(--olive-dark); background: transparent; color: var(--olive-dark);
  border-radius: 999px; padding: 7px 16px; cursor: pointer; font-weight: 600;
}
.pill:hover { background: var(--olive-dark); color: var(--white); }
.cart-pill { background: var(--olive-dark); color: var(--white); }
.badge {
  display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px;
  border-radius: 99px; background: var(--rust); color: #fff; font-size: 12px; margin-inline-start: 4px;
}

/* Hero */
.hero { text-align: center; padding: 48px 20px 28px; max-width: 760px; margin: 0 auto; }
.hero h1 { font-size: clamp(28px, 5vw, 44px); }
.hero p { color: var(--olive); margin: 0 0 12px; }
.ribbon {
  display: inline-block; color: var(--rust) !important; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; font-size: 13px; border: 1.5px dashed var(--rust);
  border-radius: 99px; padding: 4px 14px;
}
.discount-strip { display: flex; flex-wrap: wrap; gap: 8px; justify-content: center; margin-top: 16px; }
.discount-strip span {
  background: var(--olive-dark); color: var(--white); border-radius: 10px; padding: 6px 14px;
  font-size: 14px; outline: 1px dashed rgba(255,255,255,.35); outline-offset: -4px;
}

/* Layout */
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 28px; max-width: 1240px; margin: 0 auto; padding: 0 20px 60px; }
.filters {
  background: var(--white); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow);
  align-self: start; position: sticky; top: 90px; border: 1px dashed var(--sand);
}
.filters-head { display: flex; justify-content: space-between; align-items: center; }
.filters-head h2 { font-size: 18px; margin: 0; }
.field { display: flex; flex-direction: column; gap: 6px; margin: 14px 0; font-size: 14px; font-weight: 600; color: var(--olive-dark); }
.field input, .field select, .field textarea, #sort {
  border: 1px solid var(--sand); background: #fff; border-radius: 10px; padding: 9px 11px; font-weight: 400; width: 100%;
}
.field input[type=range] { padding: 0; accent-color: var(--olive-dark); border: 0; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--sand); background: #fff; border-radius: 99px; padding: 4px 11px;
  font-size: 13px; cursor: pointer; font-weight: 500;
}
.chip.on { background: var(--olive-dark); border-color: var(--olive-dark); color: #fff; }
.check { display: flex; gap: 8px; align-items: center; font-size: 14px; accent-color: var(--olive-dark); }
.link { background: none; border: 0; color: var(--rust); cursor: pointer; text-decoration: underline; padding: 0; }

/* Catalog */
.catalog-bar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.catalog-bar #sort { width: auto; margin-inline-start: auto; }
.muted { color: var(--olive); }
.small { font-size: 13px; }
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 20px; }
.card {
  background: var(--white); border-radius: var(--radius); overflow: hidden; box-shadow: var(--shadow);
  cursor: pointer; transition: transform .2s; position: relative; border: 1px solid var(--linen);
}
.card:hover { transform: translateY(-3px); }
.card .ph { aspect-ratio: 3/4; background: var(--linen); overflow: hidden; }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.card .info { padding: 12px 14px 14px; }
.card h3 { font-size: 15px; margin: 0 0 2px; color: var(--ink); }
.card .meta { font-size: 12.5px; color: var(--olive); }
.card .price { font-weight: 700; color: var(--olive-dark); margin-top: 6px; }
.tag {
  position: absolute; top: 10px; inset-inline-start: 10px; background: var(--white); color: var(--rust);
  font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 99px; letter-spacing: .03em;
}
.card.sold .ph img { filter: grayscale(1) opacity(.55); }
.sold-stamp {
  position: absolute; top: 34%; left: 50%; transform: translate(-50%, -50%) rotate(-12deg);
  border: 3px solid var(--rust); color: var(--rust); font-weight: 800; font-size: 26px;
  padding: 4px 18px; border-radius: 8px; background: rgba(251, 249, 244, .85); letter-spacing: .12em;
}
.in-cart-tag { background: var(--olive-dark); color: #fff; }
.empty { text-align: center; color: var(--olive); padding: 30px 10px; }

/* Buttons */
.btn {
  display: inline-block; text-align: center; text-decoration: none; border: 0; border-radius: 12px;
  padding: 13px 18px; font-weight: 700; cursor: pointer; width: 100%;
}
.btn.primary { background: var(--olive-dark); color: #fff; }
.btn.primary:hover { background: var(--ink); }
.btn.rust { background: var(--rust); color: #fff; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* Dialog */
.dlg {
  border: 0; border-radius: 18px; padding: 0; max-width: 820px; width: calc(100% - 32px);
  background: var(--white); color: var(--ink); box-shadow: 0 20px 60px rgba(0,0,0,.25);
}
.dlg::backdrop { background: rgba(47, 52, 36, .55); }
.x { position: absolute; top: 8px; inset-inline-end: 12px; background: none; border: 0; font-size: 30px; cursor: pointer; color: var(--olive-dark); z-index: 2; }
.pd { display: grid; grid-template-columns: 1fr 1fr; }
.pd .ph { background: var(--linen); }
.pd .ph img { width: 100%; height: 100%; object-fit: cover; max-height: 80vh; }
.pd .thumbs { display: flex; gap: 6px; padding: 6px; }
.pd .thumbs img { width: 56px; height: 70px; object-fit: cover; border-radius: 6px; cursor: pointer; }
.pd .body { padding: 34px 26px 26px; display: flex; flex-direction: column; gap: 10px; }
.pd .price { font-size: 24px; font-weight: 700; color: var(--olive-dark); }
.spec { display: flex; gap: 8px; flex-wrap: wrap; }
.spec span { background: var(--paper); border-radius: 8px; padding: 4px 10px; font-size: 13px; }
.unique-note { border-inline-start: 3px solid var(--rust); padding-inline-start: 10px; color: var(--rust); font-size: 14px; }
.small-dlg { max-width: 420px; padding: 28px; text-align: center; }
.small-dlg .btn { margin: 10px 0; }

/* Drawer */
.drawer-bg { position: fixed; inset: 0; background: rgba(47, 52, 36, .5); z-index: 30; }
.drawer {
  position: fixed; top: 0; bottom: 0; inset-inline-end: 0; width: min(430px, 100%); z-index: 31;
  background: var(--white); padding: 18px 20px 30px; overflow-y: auto;
  transform: translateX(105%); transition: transform .25s ease, visibility 0s .25s; visibility: hidden;
}
.drawer.open { visibility: visible; transition: transform .25s ease; }
body { overflow-x: hidden; }
html[dir="rtl"] .drawer { transform: translateX(-105%); }
.drawer.open { transform: none !important; }
.drawer-head { display: flex; justify-content: space-between; align-items: center; position: relative; }
.drawer-head .x { position: static; }
.cart-row { display: grid; grid-template-columns: 64px 1fr auto; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px dashed var(--sand); }
.cart-row img { width: 64px; height: 80px; object-fit: cover; border-radius: 8px; }
.cart-row .nm { font-weight: 600; font-size: 14px; }
.cart-row .rm { background: none; border: 0; color: var(--rust); cursor: pointer; font-size: 13px; }
.cart-row.gone { opacity: .5; }
.hint { background: var(--paper); border-radius: 10px; padding: 10px 12px; font-size: 14px; margin-top: 14px; color: var(--olive-dark); }
.hint b { color: var(--rust); }
.totals { margin: 10px 0 16px; font-size: 14.5px; }
.totals div { display: flex; justify-content: space-between; padding: 3px 0; }
.totals .disc { color: var(--rust); }
.totals .grand { font-weight: 800; font-size: 18px; border-top: 1.5px solid var(--olive-dark); margin-top: 6px; padding-top: 8px; color: var(--olive-dark); }
.checkout h3 { font-size: 16px; margin-top: 10px; }
.error { color: #a12; background: #fbe9e7; padding: 8px 10px; border-radius: 8px; font-size: 14px; }

/* Footer */
.footer { text-align: center; padding: 30px 20px 40px; border-top: 1px dashed var(--sand); color: var(--olive); }
.footer-logo { width: 90px; margin: 0 auto 6px; }
.footer a { color: var(--rust); font-weight: 600; }
.socials { display: flex; gap: 18px; justify-content: center; flex-wrap: wrap; }

.g-btn { display: flex; align-items: center; }
.account-pill { display: inline-flex; align-items: center; gap: 6px; padding: 4px 14px 4px 4px; }
html[dir="rtl"] .account-pill { padding: 4px 4px 4px 14px; }
.account-pill img { width: 28px; height: 28px; border-radius: 50%; }
.account-pill img:not([src]) { display: none; }
.orders-dlg { max-width: 560px; padding: 28px 24px; }
.orders-head { margin-bottom: 10px; }
.order-card { border: 1px dashed var(--sand); border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 14px; }
.order-card .row { display: flex; justify-content: space-between; gap: 10px; }
.order-card .items { white-space: pre-line; color: var(--olive); margin: 6px 0; }
.status { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 99px; background: var(--paper); color: var(--olive-dark); text-transform: capitalize; }
.status.delivered { background: var(--olive-dark); color: #fff; }
.status.cancelled { background: #f3e2da; color: var(--rust); }
.only-mobile { display: none; }
@media (max-width: 820px) {
  .layout { grid-template-columns: 1fr; }
  .filters { display: none; position: static; }
  .filters.show { display: block; }
  .only-mobile { display: inline-block; }
  .pd { grid-template-columns: 1fr; }
  .pd .ph img { max-height: 55vh; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .brand img { height: 46px; }
  .account-pill span { display: none; }
  .account-pill { padding: 4px !important; }
  .top-actions { gap: 5px; }
  .pill { padding: 6px 11px; }
}
