/* ---------- خط ثمانية (محلي — يعمل بدون إنترنت) ---------- */
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Regular.woff2") format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Medium.woff2") format("woff2"); font-weight: 500 600; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }
@font-face { font-family: "Thmanyah Sans"; src: url("fonts/thmanyahsans-Black.woff2") format("woff2"); font-weight: 800 900; font-display: swap; }
@font-face { font-family: "Thmanyah Serif Display"; src: url("fonts/thmanyahserifdisplay-Bold.woff2") format("woff2"); font-weight: 700; font-display: swap; }

:root {
  --font: "Thmanyah Sans", "Segoe UI", Tahoma, Arial, sans-serif;
  --font-display: "Thmanyah Serif Display", "Thmanyah Sans", "Segoe UI", Tahoma, serif;
  --navy: #0d1730;
  --navy-2: #16233f;
  --gold: #d4a53c;
  --gold-l: #f2d48a;
  --gold-d: #9c7020;
  --bg: #f5f3ee;
  --card: #ffffff;
  --ink: #1c2233;
  --muted: #6b7180;
  --line: #e6e1d6;
  --ok: #1f9d55;
  --bad: #c0392b;
  --radius: 14px;
  --shadow: 0 6px 20px rgba(13, 23, 48, .08);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--ink);
  line-height: 1.6;
}
a { color: inherit; text-decoration: none; }
button, input, select { font: inherit; }
.wrap { max-width: 1240px; margin: 0 auto; padding: 0 16px; }

/* ---------- topbar ---------- */
.topbar { background: #070d1d; color: #cfd5e3; font-size: 13px; }
.topbar-in { display: flex; justify-content: space-between; gap: 12px; padding: 6px 16px; flex-wrap: wrap; }
.topbar a { color: var(--gold-l); direction: ltr; unicode-bidi: embed; }

/* ---------- header ---------- */
.header { background: var(--navy); color: #fff; position: sticky; top: 0; z-index: 20; box-shadow: 0 2px 12px rgba(0,0,0,.25); }
.header-in { display: flex; align-items: center; gap: 24px; padding: 12px 16px; }
.brand { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.brand-logo { width: 58px; height: 58px; }
.brand-text strong {
  display: block; font-family: var(--font-display); font-size: 25px; font-weight: 700; line-height: 1.4;
  background: linear-gradient(180deg, var(--gold-l), var(--gold) 55%, var(--gold-d));
  -webkit-background-clip: text; background-clip: text; color: transparent;
}
.brand-text small { color: #b8c0d4; font-size: 12.5px; }

.search {
  flex: 1; display: flex; align-items: center; gap: 8px;
  background: #fff; border-radius: 999px; padding: 0 14px; max-width: 560px; margin-inline-start: auto;
}
.search svg { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; flex-shrink: 0; }
.search input { border: 0; outline: 0; padding: 11px 0; width: 100%; background: transparent; color: var(--ink); }

/* ---------- brand menu ---------- */
.menu { background: var(--navy-2); border-top: 1px solid rgba(212,165,60,.25); }
.menu-in { display: flex; gap: 4px; overflow-x: auto; scrollbar-width: none; }
.menu-in::-webkit-scrollbar { display: none; }
.menu-item {
  background: none; border: 0; color: #dfe4ef; padding: 12px 18px; cursor: pointer;
  border-bottom: 3px solid transparent; white-space: nowrap; font-weight: 600;
  display: flex; align-items: center; gap: 8px;
}
.menu-item:hover { color: var(--gold-l); }
.menu-item.active { color: var(--gold-l); border-bottom-color: var(--gold); }
.menu-item .n { font-size: 11px; background: rgba(255,255,255,.1); padding: 0 7px; border-radius: 999px; }

/* ---------- hero ---------- */
.hero {
  background:
    radial-gradient(circle at 15% 50%, rgba(212,165,60,.18), transparent 45%),
    linear-gradient(135deg, var(--navy) 0%, #1a2950 100%);
  color: #fff; overflow: hidden;
}
.hero-in { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 36px 16px; }
.hero-kicker { color: var(--gold-l); margin: 0 0 6px; font-weight: 600; font-size: 14px; }
.hero h1 { margin: 0; font-family: var(--font-display); font-weight: 700; font-size: clamp(26px, 4.2vw, 42px); line-height: 1.35; }
.hero h1 span { color: var(--gold); }
.hero-sub { color: #c4cbe0; margin: 10px 0 0; max-width: 520px; }
.hero-logo { width: 170px; height: 170px; opacity: .95; filter: drop-shadow(0 10px 30px rgba(0,0,0,.4)); flex-shrink: 0; }

/* ---------- layout ---------- */
.layout { display: grid; grid-template-columns: 250px 1fr; gap: 24px; padding-top: 24px; padding-bottom: 40px; }

.filters {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow);
  padding: 18px; align-self: start; position: sticky; top: 150px;
}
.f-head { display: flex; justify-content: space-between; align-items: center; }
.f-head h3 { margin: 0 0 8px; font-size: 17px; }
.f-close { display: none; }
.f-block { border-top: 1px solid var(--line); padding: 14px 0; }
.f-block h4 { margin: 0 0 10px; font-size: 14px; color: var(--muted); font-weight: 600; }
.f-block h4 b { color: var(--ink); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: #faf8f3; border-radius: 999px; padding: 4px 12px;
  cursor: pointer; font-size: 13.5px;
}
.chip.active { background: var(--navy); color: var(--gold-l); border-color: var(--navy); }
input[type=range] { width: 100%; accent-color: var(--gold-d); }
.check { display: flex; align-items: center; gap: 8px; padding: 4px 0; cursor: pointer; }
.check input { accent-color: var(--gold-d); width: 16px; height: 16px; }

.btn-ghost {
  border: 1px solid var(--line); background: #fff; border-radius: 10px; padding: 8px 14px; cursor: pointer; width: 100%;
}
.btn-ghost:hover { border-color: var(--gold); }

/* ---------- toolbar ---------- */
.toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.toolbar h2 { margin: 0; font-size: 22px; }
.count { color: var(--muted); font-size: 14px; }
.tools { margin-inline-start: auto; display: flex; gap: 8px; }
.tools select { border: 1px solid var(--line); border-radius: 10px; padding: 7px 10px; background: #fff; }
.view-toggle { display: flex; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: #fff; }
.view-toggle button { border: 0; background: none; padding: 6px 12px; cursor: pointer; font-size: 16px; }
.view-toggle button.active { background: var(--navy); color: var(--gold-l); }
.f-open { display: none; width: auto; }

/* ---------- product grid ---------- */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 18px; }
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden;
  display: flex; flex-direction: column; position: relative; transition: transform .18s, box-shadow .18s;
  border: 1px solid transparent;
}
.card:hover { transform: translateY(-3px); box-shadow: 0 12px 28px rgba(13,23,48,.14); border-color: rgba(212,165,60,.45); }
.card .thumb {
  aspect-ratio: 1 / 1; background: linear-gradient(180deg, #fbfaf6, #f0ece2);
  display: grid; place-items: center; cursor: pointer; padding: 14px;
  min-height: 0; overflow: hidden;
}
.card .thumb img { width: 100%; height: 100%; object-fit: contain; display: block; }
.badge {
  position: absolute; top: 12px; right: 12px; background: var(--gold); color: var(--navy);
  font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 999px;
}
.badge.off { right: auto; left: 12px; background: var(--bad); color: #fff; }
.card .info { padding: 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.card .brand-tag { font-size: 12px; color: var(--gold-d); font-weight: 700; letter-spacing: .3px; }
.card h3 { margin: 0; font-size: 16.5px; cursor: pointer; direction: ltr; text-align: right; }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; }
.card .meta span { font-size: 12px; background: #f2efe7; padding: 1px 8px; border-radius: 6px; color: var(--muted); }
.card .specs { display: none; margin: 4px 0 0; padding: 0 18px 0 0; color: var(--muted); font-size: 13.5px; }
.price-row { display: flex; align-items: baseline; gap: 8px; margin-top: auto; padding-top: 8px; }
.price { font-size: 21px; font-weight: 800; color: var(--navy); }
.price small { font-size: 13px; font-weight: 600; color: var(--muted); }
.price.ask { font-size: 16px; color: var(--gold-d); }
.old { text-decoration: line-through; color: var(--muted); font-size: 14px; }
.stock { font-size: 12.5px; font-weight: 600; }
.stock.in { color: var(--ok); }
.stock.out { color: var(--bad); }
.actions { display: flex; gap: 8px; padding: 0 14px 14px; }
.btn {
  flex: 1; border: 0; border-radius: 10px; padding: 9px 10px; cursor: pointer; font-weight: 700; text-align: center;
  font-size: 14px;
}
.btn-wa { background: #1fa855; color: #fff; }
.btn-wa:hover { background: #178a45; }
.btn-dark { background: var(--navy); color: var(--gold-l); }
.btn-dark:hover { background: var(--navy-2); }
.btn[aria-disabled=true] { background: #c9c9c9; color: #fff; pointer-events: none; }
.card.out .thumb img { filter: grayscale(.8); opacity: .7; }

/* list view */
.grid.list { grid-template-columns: 1fr; }
.grid.list .card { flex-direction: row; align-items: stretch; }
.grid.list .thumb { width: 190px; flex-shrink: 0; aspect-ratio: auto; }
.grid.list .info { padding: 16px 18px; }
.grid.list .specs { display: block; }
.grid.list .actions { flex-direction: column; justify-content: center; padding: 16px; width: 170px; }
.grid.list .actions .btn { flex: 0; }

.empty { text-align: center; color: var(--muted); padding: 60px 0; font-size: 17px; }

/* ---------- modal ---------- */
dialog {
  border: 0; border-radius: 18px; padding: 0; width: min(820px, calc(100% - 32px)); max-height: 90vh;
  box-shadow: 0 30px 80px rgba(0,0,0,.35);
}
dialog::backdrop { background: rgba(7,13,29,.6); }
.m-close {
  position: absolute; top: 10px; left: 10px; border: 0; background: #fff; width: 34px; height: 34px;
  border-radius: 50%; cursor: pointer; font-size: 16px; box-shadow: var(--shadow); z-index: 2;
}
.m-body { display: grid; grid-template-columns: 1fr 1fr; }
.m-img { background: linear-gradient(180deg, #fbfaf6, #ece6d8); display: grid; place-items: center; padding: 30px; }
.m-img img { max-width: 100%; max-height: 380px; object-fit: contain; }
.m-info { padding: 28px; display: flex; flex-direction: column; gap: 10px; }
.m-info h2 { margin: 0; direction: ltr; text-align: right; }
.m-info ul { margin: 0; padding: 0 18px 0 0; }
.m-info li { padding: 2px 0; }
.m-info .actions { padding: 0; margin-top: auto; }

/* ---------- footer ---------- */
.footer { background: var(--navy); color: #c4cbe0; padding-top: 28px; }
.footer-in { display: flex; justify-content: space-between; align-items: center; gap: 20px; flex-wrap: wrap; }
.f-brand { display: flex; gap: 12px; align-items: center; }
.f-brand img { width: 64px; }
.f-brand strong { color: var(--gold-l); font-size: 20px; font-family: var(--font-display); font-weight: 700; }
.f-brand p { margin: 0; }
.f-contact { display: flex; gap: 10px; }
.f-contact a { border: 1px solid rgba(212,165,60,.5); color: var(--gold-l); padding: 8px 16px; border-radius: 10px; direction: ltr; }
.f-contact a:hover { background: rgba(212,165,60,.12); }
.copy { text-align: center; font-size: 13px; color: #7d86a0; margin: 24px 0 0; padding: 12px; border-top: 1px solid rgba(255,255,255,.07); }

/* ---------- responsive ---------- */
@media (max-width: 900px) {
  .layout { grid-template-columns: 1fr; }
  .filters {
    position: fixed; inset: 0 0 0 auto; width: min(320px, 85vw); z-index: 50; border-radius: 0;
    height: 100vh; transform: translateX(110%); transition: transform .25s, visibility .25s; overflow-y: auto;
    visibility: hidden;
  }
  .filters.open { transform: none; visibility: visible; box-shadow: -10px 0 40px rgba(0,0,0,.3); }
  .f-close { display: block; border: 0; background: none; font-size: 18px; cursor: pointer; }
  .f-open { display: inline-block; }
  .hero-logo { width: 110px; height: 110px; }
}
@media (max-width: 640px) {
  .header-in { flex-wrap: wrap; gap: 10px; }
  .search { max-width: none; flex-basis: 100%; }
  .brand-logo { width: 46px; height: 46px; }
  .brand-text strong { font-size: 19px; }
  .hero-in { padding: 24px 16px; }
  .hero-logo { display: none; }
  .grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card .info { padding: 10px; }
  .card h3 { font-size: 14.5px; }
  .price { font-size: 18px; }
  .actions { flex-direction: column; padding: 0 10px 10px; gap: 6px; }
  .grid.list .card { flex-direction: column; }
  .grid.list .thumb { width: auto; aspect-ratio: 16/10; }
  .grid.list .actions { width: auto; }
  .m-body { grid-template-columns: 1fr; }
  .m-img img { max-height: 240px; }
  .tools { margin-inline-start: 0; width: 100%; }
  .tools select { flex: 1; }
}
