:root {
  --brand: #14594F;
  --bg: #F4F5F7;
  --surface: #FFFFFF;
  --ink: #15171C;
  --muted: #646B76;
  --line: #E2E5EA;
  --danger: #B42318;
  --ok: #067647;
  --r-sm: 6px;
  --r-md: 12px;
  --font: 'IBM Plex Sans Arabic', system-ui, -apple-system, 'Segoe UI', Tahoma, sans-serif;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font-family: var(--font); font-size: 16px; line-height: 1.6; color: var(--ink); background: var(--bg); }
img { max-width: 100%; display: block; }
a { color: inherit; }
a:hover { color: var(--brand); }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--brand) 55%, transparent); outline-offset: 2px; }
.wrap { width: min(1200px, 100% - 32px); margin-inline: auto; }
.muted { color: var(--muted); }

/* header */
.top { background: var(--surface); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.top-in { display: flex; align-items: center; gap: 20px; min-height: 68px; }
.brand { font-weight: 700; font-size: 1.25rem; text-decoration: none; white-space: nowrap; }
.brand img { max-height: 42px; width: auto; }
.search { flex: 1; }
.search input { width: 100%; max-width: 460px; }
.top-nav { display: flex; gap: 18px; align-items: center; white-space: nowrap; }
.top-nav a { text-decoration: none; font-weight: 500; }
.cart-link .count { display: inline-grid; place-items: center; min-width: 22px; height: 22px; padding: 0 6px; margin-inline-start: 6px; border-radius: 11px; background: var(--brand); color: #fff; font-size: .8rem; }

/* forms */
input, select, textarea { font: inherit; color: inherit; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); }
input:focus, select:focus, textarea:focus { border-color: var(--brand); outline: none; box-shadow: 0 0 0 3px color-mix(in srgb, var(--brand) 18%, transparent); }
.btn { display: inline-flex; justify-content: center; align-items: center; gap: 8px; padding: 12px 22px; border: 0; border-radius: var(--r-sm); background: var(--brand); color: #fff; font: inherit; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn:hover { color: #fff; filter: brightness(1.08); }
.btn:disabled { background: #9AA1AB; cursor: not-allowed; filter: none; }
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.link-btn { background: none; border: 0; padding: 0; font: inherit; color: var(--muted); text-decoration: underline; cursor: pointer; }
.flash { margin: 18px 0; padding: 12px 16px; border-radius: var(--r-sm); background: #ECFDF3; color: var(--ok); }
.flash.err { background: #FEF3F2; color: var(--danger); }

/* home */
.hero { padding: 56px 0 28px; }
.hero h1 { margin: 0; max-width: 18ch; font-size: clamp(2rem, 5vw, 3.6rem); line-height: 1.15; letter-spacing: -.01em; }
.page-h { font-size: 1.7rem; margin: 32px 0 18px; line-height: 1.3; }
.cats { display: flex; gap: 8px; overflow-x: auto; padding: 4px 0 18px; scrollbar-width: thin; }
.cats a { flex: none; padding: 7px 14px; border: 1px solid var(--line); border-radius: 999px; background: var(--surface); text-decoration: none; font-size: .92rem; }
.cats a.on { background: var(--ink); border-color: var(--ink); color: #fff; }
.grid { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(210px, 1fr)); gap: 20px; }
.card a { display: flex; flex-direction: column; gap: 8px; text-decoration: none; }
.thumb { aspect-ratio: 1; background: var(--surface); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.thumb img { width: 100%; height: 100%; object-fit: cover; transition: transform .35s ease; }
.card a:hover .thumb img { transform: scale(1.04); }
.card-title { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: .95rem; }
.card-price { font-weight: 700; font-size: 1.08rem; font-variant-numeric: tabular-nums; }
.oos { font-style: normal; font-weight: 500; font-size: .8rem; color: var(--danger); }
.empty { padding: 48px 0; color: var(--muted); }
.pager { display: flex; justify-content: center; gap: 18px; align-items: center; margin: 36px 0; }

/* product */
.pdp { display: grid; grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr); gap: 40px; padding: 32px 0; }
.main-img { aspect-ratio: 1; background: var(--surface); border-radius: var(--r-md); overflow: hidden; border: 1px solid var(--line); }
.main-img img { width: 100%; height: 100%; object-fit: contain; }
.thumbs { display: flex; gap: 8px; margin-top: 10px; overflow-x: auto; }
.tb { flex: none; width: 68px; height: 68px; padding: 0; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; cursor: pointer; }
.tb img { width: 100%; height: 100%; object-fit: cover; }
.buy h1 { font-size: 1.6rem; line-height: 1.35; margin: 0 0 12px; }
.price { font-size: 2rem; font-weight: 700; margin: 0 0 20px; color: var(--brand); font-variant-numeric: tabular-nums; }
.buy-form { display: grid; gap: 8px; max-width: 420px; }
.buy-form label { font-weight: 500; margin-top: 8px; }
.buy-form input[type=number] { width: 110px; }
.buy-form .btn { margin-top: 14px; padding-block: 15px; font-size: 1.05rem; }
.desc { grid-column: 1 / -1; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 24px 28px; }
.desc h2 { margin-top: 0; font-size: 1.25rem; }
.desc-body { max-width: 75ch; overflow-x: auto; }
.desc-body img { height: auto; margin: 10px 0; }

/* cart & checkout */
.cart-layout { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 28px; align-items: start; padding-bottom: 40px; }
.cart-lines { display: grid; gap: 12px; }
.line { display: grid; grid-template-columns: 72px 1fr 80px auto auto; gap: 14px; align-items: center; background: var(--surface); padding: 12px; border: 1px solid var(--line); border-radius: var(--r-md); }
.line-img { width: 72px; height: 72px; border-radius: var(--r-sm); overflow: hidden; background: var(--bg); }
.line-img img { width: 100%; height: 100%; object-fit: cover; }
.line-info { display: grid; gap: 2px; min-width: 0; }
.line-info a { text-decoration: none; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.line-info small { color: var(--muted); }
.line input { width: 80px; }
.line-total { font-variant-numeric: tabular-nums; }
.summary { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 20px; display: grid; gap: 10px; position: sticky; top: 88px; }
.summary > div { display: flex; justify-content: space-between; gap: 12px; }
.summary .mini { font-size: .9rem; color: var(--muted); }
.summary .sum-total { border-top: 1px solid var(--line); padding-top: 12px; font-weight: 700; font-size: 1.15rem; }
.summary .btn { margin-top: 8px; }
.checkout-form { display: grid; gap: 22px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.fields label { display: grid; gap: 6px; font-weight: 500; font-size: .93rem; }
.fields .full { grid-column: 1 / -1; }
.methods { border: 0; padding: 0; margin: 0; display: grid; gap: 10px; }
.methods legend { font-weight: 700; margin-bottom: 8px; }
.method { display: flex; gap: 12px; align-items: flex-start; padding: 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); cursor: pointer; }
.method:has(input:checked) { border-color: var(--brand); box-shadow: 0 0 0 1px var(--brand); }
.method span { display: grid; }
.method small { color: var(--muted); }
.narrow { max-width: 640px; padding-bottom: 48px; }

/* tracking */
.steps { list-style: none; padding: 0; margin: 24px 0; display: grid; grid-template-columns: repeat(4, 1fr); counter-reset: s; }
.steps li { position: relative; padding-top: 34px; font-size: .9rem; color: var(--muted); text-align: center; }
.steps li::before { counter-increment: s; content: counter(s); position: absolute; top: 0; inset-inline-start: 50%; transform: translateX(50%); width: 26px; height: 26px; border-radius: 50%; display: grid; place-items: center; background: var(--line); color: var(--muted); font-size: .8rem; z-index: 1; }
[dir=ltr] .steps li::before { transform: translateX(-50%); }
.steps li::after { content: ''; position: absolute; top: 12px; inset-inline-start: 50%; width: 100%; height: 2px; background: var(--line); }
.steps li:last-child::after { display: none; }
.steps li.done { color: var(--ink); font-weight: 500; }
.steps li.done::before { background: var(--brand); color: #fff; }
.steps li.done:has(+ .done)::after { background: var(--brand); }

/* footer */
.foot { margin-top: 56px; background: var(--surface); border-top: 1px solid var(--line); padding: 32px 0 20px; font-size: .93rem; }
.foot-in { display: flex; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.foot p { margin: 4px 0 0; color: var(--muted); }
.foot-contact { display: flex; gap: 18px; flex-wrap: wrap; }
.copy { margin-top: 20px; color: var(--muted); font-size: .85rem; }

@media (max-width: 860px) {
  .pdp, .cart-layout { grid-template-columns: 1fr; gap: 24px; }
  .summary { position: static; }
  .top-in { flex-wrap: wrap; padding: 10px 0; gap: 10px 16px; }
  .search { order: 3; flex-basis: 100%; }
  .search input { max-width: none; }
  .top-nav { margin-inline-start: auto; }
}
@media (max-width: 560px) {
  .grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .fields { grid-template-columns: 1fr; }
  .line { grid-template-columns: 60px 1fr auto; }
  .line-img { width: 60px; height: 60px; }
  .line-total { grid-column: 2; }
  .hero { padding-top: 32px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; } }

/* breadcrumbs & pages */
.crumbs { display: flex; flex-wrap: wrap; gap: 6px; font-size: .88rem; color: var(--muted); margin: 22px 0 -10px; }
.crumbs a { text-decoration: none; }
.crumbs > * + *::before { content: '/'; margin-inline-end: 6px; color: var(--line); }
.foot-pages { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 18px; font-size: .88rem; }
.foot-pages a { color: var(--muted); }
.prose p { max-width: 70ch; }
