/* System fonts only: no font download on a slow connection, and no third party sees the visit. */
:root {
  --bg: #f6f5fa;
  --card: #ffffff;
  --ink: #1d1b26;
  --muted: #6b6878;
  --line: #e4e1ee;
  --brand: #6d28d9;
  --brand-ink: #ffffff;
  --brand-soft: #efe8fd;
  --pro: #b45309;
  --pro-soft: #fef3c7;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #14121c;
    --card: #1f1c2b;
    --ink: #f1eff8;
    --muted: #a5a1b6;
    --line: #33304a;
    --brand: #a78bfa;
    --brand-ink: #1b1530;
    --brand-soft: #2c2547;
    --pro: #fbbf24;
    --pro-soft: #3b2f12;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font: 16px/1.6 "Segoe UI", Tahoma, "Geeza Pro", "Noto Sans Arabic", "Noto Naskh Arabic", system-ui, sans-serif;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
.wrap { max-width: 1180px; margin: 0 auto; padding: 0 16px; }

.top { padding: 22px 0 14px; }
.brand { margin: 0 0 4px; color: var(--brand); font-weight: 700; font-size: 14px; }
h1 { margin: 0 0 8px; font-size: 26px; line-height: 1.3; }
.lead { margin: 0; color: var(--muted); max-width: 62ch; }

.status { color: var(--muted); padding: 28px 0; text-align: center; }
.empty { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 28px 18px; text-align: center; }
.empty h2 { margin: 0 0 6px; font-size: 20px; }
.empty p { margin: 0 0 12px; color: var(--muted); }

.controls { position: sticky; top: 0; z-index: 1100; background: var(--bg); padding: 10px 0 8px; }
.row { display: flex; gap: 8px; }
.search {
  flex: 1; min-width: 0; height: 46px; padding: 0 14px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
}
.search:focus-visible, .btn:focus-visible, .chip:focus-visible, .card:focus-visible { outline: 2px solid var(--brand); outline-offset: 2px; }
.btn {
  height: 46px; padding: 0 16px; font: inherit; font-weight: 700; white-space: nowrap; cursor: pointer;
  color: var(--brand); background: var(--brand-soft); border: 1px solid transparent; border-radius: 12px;
}
.btn[aria-pressed="true"] { color: var(--brand-ink); background: var(--brand); }
.btn:disabled { opacity: .6; cursor: progress; }

/* one line that scrolls sideways inside itself: the page never scrolls sideways */
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 10px 0 4px; scrollbar-width: none; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; height: 38px; padding: 0 14px; font: inherit; font-size: 15px; cursor: pointer;
  color: var(--ink); background: var(--card); border: 1px solid var(--line); border-radius: 999px;
}
.chip b { color: var(--muted); font-weight: 400; margin-inline-start: 4px; }
.chip[aria-pressed="true"] { color: var(--brand-ink); background: var(--brand); border-color: var(--brand); }
.chip[aria-pressed="true"] b { color: inherit; opacity: .85; }
.note { margin: 6px 0 0; font-size: 13px; color: var(--muted); }

/* phone: map first, list under it */
.layout { display: flex; flex-direction: column; gap: 12px; }
.map-col { order: -1; scroll-margin-top: 130px; }
.map { height: 44vh; min-height: 260px; max-height: 420px; border: 1px solid var(--line); border-radius: 14px; overflow: hidden; background: var(--line); z-index: 0; }
.count { margin: 0 0 8px; font-size: 14px; color: var(--muted); }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.card {
  display: block; width: 100%; text-align: start; font: inherit; color: inherit; cursor: pointer;
  background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px;
  scroll-margin: 140px 0 20px;
}
.card.active { border-color: var(--brand); box-shadow: 0 0 0 2px var(--brand-soft); }
.card-head { display: flex; align-items: center; gap: 8px; }
.card-name { font-weight: 700; font-size: 17px; overflow-wrap: anywhere; }
.pro { flex: none; font-size: 12px; font-weight: 700; color: var(--pro); background: var(--pro-soft); border-radius: 6px; padding: 1px 7px; direction: ltr; }
.card-meta { display: flex; flex-wrap: wrap; gap: 2px 10px; margin-top: 2px; font-size: 14px; color: var(--muted); overflow-wrap: anywhere; }
.card-meta .dist { color: var(--brand); font-weight: 700; }
.no-match { margin: 14px 0; text-align: center; color: var(--muted); }

.owner { margin: 22px 0 8px; padding: 14px 16px; text-align: center; background: var(--brand-soft); border-radius: 14px; }
.owner strong { color: var(--brand); }
.foot { padding: 18px 0 30px; text-align: center; font-size: 14px; }
.foot a { color: var(--brand); }

/* the map's own text (popup, credit) follows the page direction */
.leaflet-container { font: inherit; }
.leaflet-popup-content { margin: 10px 14px; text-align: start; direction: rtl; font-size: 14px; line-height: 1.5; }
.leaflet-popup-content strong { display: block; font-size: 15px; }
.leaflet-popup-content span { color: #555; }

@media (min-width: 900px) {
  h1 { font-size: 34px; }
  .top { padding: 34px 0 18px; }
  .layout { display: grid; grid-template-columns: minmax(320px, 400px) 1fr; gap: 18px; align-items: start; }
  .map-col { order: 0; position: sticky; top: 124px; }
  .map { height: calc(100vh - 190px); max-height: none; min-height: 420px; }
}
