@import url("fonts.css");

/* ------------------------------------------------------------------ tokens */
:root {
  color-scheme: light;
  --ink:      #14161b;
  --ink-2:    #3b4050;
  --muted:    #5d6473;
  --faint:    #8a909c;
  --bg:       #f4f5f7;
  --panel:    #ffffff;
  --line:     #e0e3e9;
  --line-2:   #cdd2da;
  --accent:   #3646c8;   /* Majorelle */
  --accent-2: #2a38a6;
  --accent-bg:#eceefc;
  --saffron:  #e5a500;
  --ok:       #1d7a4c;
  --ok-bg:    #e6f4ec;
  --err:      #b3261e;
  --err-bg:   #fcebea;

  --f-body: "Barlow", system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;
  --f-disp: "Barlow Condensed", "Arial Narrow", "Barlow", system-ui, sans-serif;
  --f-ar:   "IBM Plex Sans Arabic", "Segoe UI", Tahoma, Arial, sans-serif;

  --r: 4px;
  --wrap: 76rem;
  --gut: clamp(16px, 4vw, 32px);
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --ink:      #eceef2;
    --ink-2:    #c6cad3;
    --muted:    #9aa1ae;
    --faint:    #6f7684;
    --bg:       #0e1014;
    --panel:    #161920;
    --line:     #262a33;
    --line-2:   #343945;
    --accent:   #8e99ff;
    --accent-2: #aab2ff;
    --accent-bg:#1d2142;
    --saffron:  #f2bd34;
    --ok:       #5cc68f;
    --ok-bg:    #13281d;
    --err:      #f08b84;
    --err-bg:   #2d1514;
  }
}

/* ------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 400 16px/1.55 var(--f-body);
  -webkit-font-smoothing: antialiased;
  min-height: 100vh;
  display: flex; flex-direction: column;
}
html[lang="ar"] body { font-family: var(--f-ar); line-height: 1.7; }
img { max-width: 100%; display: block; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.muted { color: var(--muted); }
.num { font-variant-numeric: tabular-nums; }
.skip { position: absolute; inset-inline-start: -999px; top: 8px; background: var(--panel); padding: 8px 12px; z-index: 50; }
.skip:focus { inset-inline-start: 8px; }
.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut); }

/* ----------------------------------------------------------------- header */
.top {
  position: sticky; top: env(safe-area-inset-top, 0px); z-index: 20;
  background: var(--panel); border-block-end: 1px solid var(--line);
}
.top-in {
  max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gut);
  height: 60px; display: flex; align-items: center; gap: 24px;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark {
  font: 700 15px/1 var(--f-disp); letter-spacing: .06em;
  background: var(--accent); color: #fff; padding: 7px 7px 6px; border-radius: 3px;
}
.brand-name { font: 600 19px/1 var(--f-disp); letter-spacing: .01em; white-space: nowrap; }
.nav { display: flex; gap: 4px; margin-inline-start: 8px; }
.nav a {
  text-decoration: none; color: var(--muted); font-weight: 500;
  padding: 8px 10px; border-radius: var(--r);
}
.nav a:hover { color: var(--ink); background: var(--bg); }
.nav a[aria-current="page"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); border-radius: 0; }
.lang { margin-inline-start: auto; display: flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.lang button {
  background: none; border: 0; padding: 6px 10px; min-width: 38px;
  font: 600 13px/1 var(--f-body); color: var(--muted); cursor: pointer;
}
.lang button[lang="ar"] { font-family: var(--f-ar); font-size: 15px; }
.lang button + button { border-inline-start: 1px solid var(--line-2); }
.lang button[aria-pressed="true"] { background: var(--ink); color: var(--panel); }
@media (max-width: 640px) {
  .brand-name { display: none; }
  .nav { margin-inline-start: 0; }
  .top-in { gap: 12px; }
}

main { flex: 1; outline: none; }

/* ------------------------------------------------------------------- intro */
.intro { padding-block: 36px 20px; }
.intro h1 {
  font: 700 clamp(2rem, 4.6vw, 3.1rem)/1.02 var(--f-disp);
  letter-spacing: -.005em; margin: 0 0 10px; max-width: 18ch; text-wrap: balance;
}
html[lang="ar"] .intro h1 { font-family: var(--f-ar); font-weight: 600; line-height: 1.25; letter-spacing: 0; }
.intro p { margin: 0; color: var(--muted); max-width: 52ch; font-size: 1.05rem; }

/* ----------------------------------------------------------------- filters */
.filters {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r);
  padding: 12px; display: grid; gap: 10px;
  grid-template-columns: minmax(200px, 2.2fr) repeat(5, minmax(120px, 1fr));
}
@media (max-width: 1060px) { .filters { grid-template-columns: 1fr 1fr 1fr; } .filters .q { grid-column: 1 / -1; } }
@media (max-width: 560px)  { .filters { grid-template-columns: 1fr 1fr; } }
.field label { display: block; font-size: 12px; font-weight: 600; color: var(--muted); margin-block-end: 4px; letter-spacing: .02em; }
.field input, .field select, .field textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r);
  padding: 9px 10px; min-height: 40px;
}
.field select { appearance: none; padding-inline-end: 28px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 15px) 17px, calc(100% - 10px) 17px; background-size: 5px 5px; background-repeat: no-repeat; }
html[dir="rtl"] .field select { background-position: 10px 17px, 15px 17px; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-bg); }

.bar { display: flex; flex-wrap: wrap; align-items: center; gap: 12px; padding-block: 18px 12px; }
.bar .count { font: 600 1.1rem/1 var(--f-disp); }
html[lang="ar"] .bar .count { font-family: var(--f-ar); }
.bar .sort { margin-inline-start: auto; display: flex; align-items: center; gap: 8px; }
.bar .sort label { font-size: 13px; color: var(--muted); }
.bar .sort select { width: auto; min-height: 36px; padding-block: 6px; }
.linkbtn { background: none; border: 0; padding: 0; color: var(--accent); text-decoration: underline; text-underline-offset: 3px; cursor: pointer; }

/* -------------------------------------------------------------------- grid */
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); padding-block-end: 48px; }
.card {
  display: flex; flex-direction: column; background: var(--panel);
  border: 1px solid var(--line); border-radius: var(--r); overflow: hidden;
  text-decoration: none; transition: border-color .15s, transform .15s;
}
.card:hover { border-color: var(--line-2); transform: translateY(-2px); }
.card .ph { position: relative; aspect-ratio: 3 / 2; background: var(--line); }
.card .ph img { width: 100%; height: 100%; object-fit: cover; }
.chip {
  position: absolute; inset-block-start: 10px; inset-inline-start: 10px;
  background: rgba(14,16,20,.78); color: #fff; font-size: 12px; font-weight: 600;
  padding: 3px 8px; border-radius: 3px;
}
.card .bd { padding: 12px 14px 14px; display: flex; flex-direction: column; gap: 6px; flex: 1; }
.make { font-size: 12px; font-weight: 600; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
html[lang="ar"] .make { letter-spacing: 0; }
.model { font: 600 1.45rem/1.05 var(--f-disp); margin: 0; }
.specs { font-size: 14px; color: var(--ink-2); }
.specs span + span::before { content: "·"; margin-inline: 6px; color: var(--faint); }
.price { margin-block-start: auto; padding-block-start: 8px; border-block-start: 1px dashed var(--line);
  font: 700 1.5rem/1 var(--f-disp); }
.price .dh, .pricebox .dh { display: block; font: 500 13px/1.3 var(--f-body); color: var(--muted); margin-block-start: 4px; }
.chip.new { background: var(--saffron); color: #1b1300; }
.ratenote { margin: 8px 0 0; font-size: 12px; color: var(--faint); }
html[lang="ar"] .price { font-family: var(--f-body); font-size: 1.3rem; }

.empty { padding: 40px 0 64px; text-align: start; }
.empty p { margin: 0 0 8px; font-size: 1.1rem; }

/* ------------------------------------------------------------------ detail */
.crumb { padding-block: 22px 14px; }
.crumb a { color: var(--muted); text-decoration: none; font-weight: 500; }
.crumb a:hover { color: var(--ink); }
.crumb a::before { content: "← "; }
html[dir="rtl"] .crumb a::before { content: "→ "; }
.det { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, 1fr); gap: 28px; padding-block-end: 56px; align-items: start; }
@media (max-width: 900px) { .det { grid-template-columns: 1fr; } }
.det .hero { aspect-ratio: 3 / 2; background: var(--line); border-radius: var(--r); overflow: hidden; }
.det .hero img { width: 100%; height: 100%; object-fit: cover; }
.gal-main { position: relative; aspect-ratio: 3 / 2; background: #0e1014; border-radius: var(--r); overflow: hidden; }
.gal-main img { width: 100%; height: 100%; object-fit: contain; }
.gal-btn { position: absolute; top: 50%; transform: translateY(-50%); width: 42px; height: 56px; border: 0; cursor: pointer;
  background: rgba(14,16,20,.55); color: #fff; font-size: 30px; line-height: 1; }
.gal-btn:hover { background: rgba(14,16,20,.8); }
.gal-btn.prev { inset-inline-start: 0; border-radius: 0 3px 3px 0; }
.gal-btn.next { inset-inline-end: 0; border-radius: 3px 0 0 3px; }
html[dir="rtl"] .gal-btn.prev { border-radius: 3px 0 0 3px; } html[dir="rtl"] .gal-btn.next { border-radius: 0 3px 3px 0; }
html[dir="rtl"] .gal-btn { transform: translateY(-50%) scaleX(-1); }
.gal-count { position: absolute; inset-block-end: 10px; inset-inline-end: 10px; background: rgba(14,16,20,.7); color: #fff; font-size: 13px; padding: 3px 8px; border-radius: 3px; }
.thumbs { display: flex; gap: 6px; overflow-x: auto; padding-block: 8px 2px; scrollbar-width: thin; }
.thumbs button { flex: 0 0 auto; padding: 0; border: 2px solid transparent; border-radius: 3px; background: none; cursor: pointer; opacity: .7; }
.thumbs button[aria-current="true"] { border-color: var(--accent); opacity: 1; }
.thumbs img { width: 64px; height: 64px; object-fit: cover; border-radius: 2px; }
.det .credit { font-size: 12px; color: var(--faint); margin-block-start: 6px; }
.det h1 { font: 700 clamp(1.9rem, 4vw, 2.6rem)/1.02 var(--f-disp); margin: 22px 0 6px; }
html[lang="ar"] .det h1 { font-family: var(--f-ar); font-weight: 600; line-height: 1.3; }
.det .lead { color: var(--ink-2); max-width: 60ch; margin: 0 0 22px; }
.spec-table { width: 100%; border-collapse: collapse; background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.spec-table th, .spec-table td { text-align: start; padding: 11px 14px; border-block-end: 1px solid var(--line); }
.spec-table tr:last-child th, .spec-table tr:last-child td { border-block-end: 0; }
.spec-table th { width: 42%; font-weight: 500; color: var(--muted); }
.spec-table td { font-weight: 600; }

.side { position: sticky; top: calc(76px + env(safe-area-inset-top, 0px)); background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
@media (max-width: 900px) { .side { position: static; } }
.side .pricebox { padding: 18px 18px 16px; border-block-end: 1px solid var(--line); }
.side .pricebox .lbl { font-size: 12px; font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.side .pricebox .big { font: 700 2.3rem/1.1 var(--f-disp); }
html[lang="ar"] .side .pricebox .big { font-family: var(--f-body); font-size: 2rem; }

.side form { padding: 16px 18px 18px; display: grid; gap: 12px; }
.side h2 { margin: 0; font: 600 1.35rem/1.1 var(--f-disp); }
html[lang="ar"] .side h2 { font-family: var(--f-ar); }
.side .hint { margin: -6px 0 2px; color: var(--muted); font-size: 14px; }
.field textarea { min-height: 84px; resize: vertical; }
.via { display: flex; flex-wrap: wrap; gap: 6px; border: 0; padding: 0; margin: 0; }
.via legend { font-size: 12px; font-weight: 600; color: var(--muted); margin-block-end: 6px; padding: 0; }
.via label { position: relative; }
.via input { position: absolute; opacity: 0; inset: 0; }
.via span { display: inline-block; padding: 7px 12px; border: 1px solid var(--line-2); border-radius: var(--r); font-size: 14px; font-weight: 500; cursor: pointer; }
.via input:checked + span { background: var(--ink); color: var(--panel); border-color: var(--ink); }
.via input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.hp { position: absolute; inset-inline-start: -9999px; width: 1px; height: 1px; overflow: hidden; }
.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: var(--r);
  padding: 13px 16px; font-weight: 600; font-size: 1rem; cursor: pointer;
}
.btn:hover { background: var(--accent-2); }
.btn[disabled] { opacity: .6; cursor: progress; }
.msg { border-radius: var(--r); padding: 10px 12px; font-size: 14px; }
.msg.err { background: var(--err-bg); color: var(--err); }
.done { padding: 22px 18px; }
.done h2 { color: var(--ok); }
.done .ref { display: inline-block; margin-block: 8px; font: 700 1.3rem/1 var(--f-disp); letter-spacing: .04em;
  background: var(--ok-bg); color: var(--ok); padding: 6px 10px; border-radius: 3px; }
.fine { font-size: 12px; color: var(--faint); margin: 0; }

/* ------------------------------------------------------------------ pages */
.page { padding-block: 40px 64px; max-width: 46rem; }
.page h1 { font: 700 clamp(2rem, 4.4vw, 2.8rem)/1.05 var(--f-disp); margin: 0 0 18px; }
html[lang="ar"] .page h1 { font-family: var(--f-ar); font-weight: 600; line-height: 1.3; }
.page p { margin: 0 0 14px; color: var(--ink-2); font-size: 1.05rem; }
.facts { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; margin-block: 26px; }
@media (max-width: 560px) { .facts { grid-template-columns: 1fr; } }
.facts div { background: var(--panel); padding: 16px; }
.facts b { display: block; font: 700 1.6rem/1.1 var(--f-disp); }
.facts span { color: var(--muted); font-size: 14px; }
.credits { list-style: none; padding: 0; margin: 0; border: 1px solid var(--line); border-radius: var(--r); background: var(--panel); }
.credits li { padding: 10px 14px; border-block-end: 1px solid var(--line); font-size: 14px; }
.credits li:last-child { border-block-end: 0; }
.credits a { color: var(--accent); }

/* ------------------------------------------------------------------ footer */
.foot { border-block-start: 1px solid var(--line); background: var(--panel); }
.foot-in { max-width: var(--wrap); margin-inline: auto; padding: 22px var(--gut) calc(22px + env(safe-area-inset-bottom, 0px));
  display: flex; flex-wrap: wrap; gap: 12px 24px; align-items: center; justify-content: space-between; font-size: 14px; }
.foot-in strong { margin-inline-end: 8px; }
.foot-links { display: flex; gap: 18px; }
.foot-links a { color: var(--muted); }

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