/* AMAADOR app r1. System fonts only, no external requests. */
:root {
  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-in-out: cubic-bezier(0.77, 0, 0.175, 1);
  --bg: #f5f6fa; --pn: #ffffff; --pn2: #f0f1f6; --tx: #14161f; --mu: #5b6172;
  --bd: rgb(20 22 31 / 0.08); --bd2: rgb(20 22 31 / 0.14);
  --ac: #4450d6; --ac-tx: #ffffff; --ac-soft: rgb(68 80 214 / 0.10);
  --sh: 0 1px 2px rgb(20 22 31 / 0.04), 0 8px 24px rgb(20 22 31 / 0.07);
  --sh-up: 0 2px 4px rgb(20 22 31 / 0.05), 0 16px 40px rgb(20 22 31 / 0.12);
  --r: 20px; --r-sm: 12px;
  --pk-bg: var(--pn); --pk-fg: var(--tx); --pk-muted: var(--mu); --pk-border: var(--bd); --pk-accent: var(--ac); --pk-radius: 16px;
  --dock-h: 64px;
}
:root[data-theme="dark"] {
  --bg: #000000; --pn: #0e0f14; --pn2: #17181f; --tx: #f5f5f7; --mu: #a1a4b3;
  --bd: rgb(255 255 255 / 0.09); --bd2: rgb(255 255 255 / 0.16);
  --ac: #8b96ff; --ac-tx: #0a0b12; --ac-soft: rgb(139 150 255 / 0.14);
  --sh: inset 0 1px 0 rgb(255 255 255 / 0.05), 0 1px 2px rgb(0 0 0 / 0.4);
  --sh-up: inset 0 1px 0 rgb(255 255 255 / 0.06), 0 16px 40px rgb(0 0 0 / 0.6);
  --pk-hover: rgb(255 255 255 / 0.07);
}

/* Space colours */
.sp-academy { --c1: #4450d6; --c2: #7b5cf0; }
.sp-opex { --c1: #e8590c; --c2: #f59f00; }
.sp-ai { --c1: #7c3aed; --c2: #0ea5e9; }
.sp-hse { --c1: #0b8a5f; --c2: #22b8a0; }
.sp-tafseery { --c1: #a8762a; --c2: #d4a94e; }
.sp-islam { --c1: #0f766e; --c2: #2aa198; }
.sp-mawarith { --c1: #1f6f54; --c2: #4c9a6a; }
.sp-exit { --c1: #1e3a8a; --c2: #3b82f6; }
.sp-passsnap { --c1: #0b1f3a; --c2: #2f6fb5; }
.sp-museum { --c1: #c2255c; --c2: #f06595; }

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 76px; }
body {
  margin: 0; background: var(--bg); color: var(--tx);
  font: 16px/1.5 ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, "Noto Sans", "Noto Sans Arabic", "Segoe UI Arabic", Tahoma, Arial, sans-serif;
  -webkit-font-smoothing: antialiased; min-height: 100dvh;
  padding-bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom));
  -webkit-tap-highlight-color: transparent;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; background: none; border: 0; padding: 0; cursor: pointer; }
svg.i { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; flex: none; }
h1, h2, h3, p { margin: 0; }
:focus-visible { outline: 2px solid var(--ac); outline-offset: 2px; border-radius: 8px; }
.skip { position: absolute; inset-inline-start: 12px; top: -60px; background: var(--ac); color: var(--ac-tx); padding: 10px 14px; border-radius: 10px; z-index: 100; }
.skip:focus { top: 12px; }
.num { font-variant-numeric: tabular-nums; }

/* ---------- Top bar ---------- */
.bar {
  position: sticky; top: 0; z-index: 40; display: flex; align-items: center; gap: 12px;
  height: 60px; padding: 0 max(16px, env(safe-area-inset-left)) 0 max(16px, env(safe-area-inset-right));
  padding-top: env(safe-area-inset-top); height: calc(60px + env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 82%, transparent);
  -webkit-backdrop-filter: saturate(1.6) blur(14px); backdrop-filter: saturate(1.6) blur(14px);
  border-bottom: 1px solid var(--bd);
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 44px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; background: linear-gradient(135deg, #4450d6, #7b5cf0); display: grid; place-items: center; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25); }
.brand-mark svg { width: 22px; height: 22px; fill: #fff; }
.brand-name { font-weight: 750; letter-spacing: 0.04em; font-size: 15px; }
.tabs { display: none; margin-inline-start: 20px; gap: 4px; }
.tabs a { display: flex; align-items: center; gap: 8px; height: 40px; padding: 0 14px; border-radius: 12px; color: var(--mu); font-weight: 600; font-size: 14.5px; transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.tabs a svg.i { width: 18px; height: 18px; }
.tabs a[aria-current="page"] { color: var(--tx); background: var(--pn); box-shadow: var(--sh); }
.tabs a:active { transform: scale(0.97); }
.icon-btn { margin-inline-start: auto; width: 44px; height: 44px; border-radius: 14px; display: grid; place-items: center; color: var(--mu); transition: background-color 160ms ease, transform 160ms var(--ease-out); }
@media (hover: hover) and (pointer: fine) {
  .tabs a:hover { color: var(--tx); }
  .icon-btn:hover { background: var(--pn2); color: var(--tx); }
}

/* ---------- Dock (phones) ---------- */
.dock {
  position: fixed; z-index: 45; left: 50%; transform: translateX(-50%);
  bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; gap: 2px; padding: 6px; height: var(--dock-h);
  width: min(420px, calc(100vw - 24px));
  background: color-mix(in srgb, var(--pn) 94%, transparent);
  -webkit-backdrop-filter: saturate(1.8) blur(18px); backdrop-filter: saturate(1.8) blur(18px);
  border: 1px solid var(--bd); border-radius: 22px; box-shadow: var(--sh-up);
}
.dock a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; border-radius: 16px; color: var(--mu); font-size: 11.5px; font-weight: 600; transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.dock a:active { transform: scale(0.95); }
.dock a[aria-current="page"] { color: var(--ac); background: var(--ac-soft); }

/* ---------- Layout ---------- */
main { max-width: 1120px; margin: 0 auto; padding: 20px 16px 8px; outline: none; }
.sec { margin-top: 36px; }
.sec-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 14px; }
.sec-h h2 { font-size: 19px; letter-spacing: -0.015em; line-height: 1.2; }
.link-btn { color: var(--ac); font-weight: 600; font-size: 14px; min-height: 44px; padding: 0 6px; display: inline-flex; align-items: center; border-radius: 10px; }

/* ---------- Hero ---------- */
.hero { padding: 28px 0 4px; }
.hero h1 { font-size: clamp(32px, 7.4vw, 56px); line-height: 1.06; letter-spacing: -0.03em; font-weight: 780; text-wrap: balance; }
.hero h1 em { font-style: normal; background: linear-gradient(100deg, #4450d6, #7c3aed 45%, #e8590c); -webkit-background-clip: text; background-clip: text; color: transparent; }
:root[data-theme="dark"] .hero h1 em { background-image: linear-gradient(100deg, #8b96ff, #c4a1ff 45%, #ffb057); }
html[dir="rtl"] .hero h1 { letter-spacing: 0; line-height: 1.25; }
.hero p { margin-top: 14px; color: var(--mu); font-size: 17px; max-width: 58ch; text-wrap: pretty; }
.hero-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 22px; }
.fake-search {
  flex: 1 1 320px; display: flex; align-items: center; gap: 12px; height: 56px; padding: 0 18px; border-radius: 18px;
  background: var(--pn); border: 1px solid var(--bd); box-shadow: var(--sh); color: var(--mu); font-size: 16px; text-align: start;
  transition: transform 160ms var(--ease-out), border-color 160ms ease;
}
.fake-search:active { transform: scale(0.985); }
.fake-search kbd { margin-inline-start: auto; font: 600 12px/1 ui-monospace, monospace; padding: 5px 7px; border-radius: 7px; border: 1px solid var(--bd2); display: none; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 9px; height: 56px; padding: 0 22px; border-radius: 18px;
  font-weight: 650; font-size: 15.5px; background: var(--tx); color: var(--bg);
  transition: transform 160ms var(--ease-out), opacity 160ms ease;
}
.btn:active { transform: scale(0.97); }
.btn.ghost { background: var(--pn); color: var(--tx); border: 1px solid var(--bd); box-shadow: var(--sh); }
.btn.sm { height: 44px; border-radius: 14px; padding: 0 16px; font-size: 14.5px; }
.btn svg.i { width: 19px; height: 19px; }

/* ---------- Space cards ---------- */
.grid4 { display: grid; gap: 14px; grid-template-columns: 1fr; }
.space {
  position: relative; overflow: hidden; display: flex; flex-direction: column; justify-content: space-between; gap: 22px;
  min-height: 190px; padding: 22px; border-radius: 26px; color: #fff; isolation: isolate;
  background: linear-gradient(135deg, var(--c1), var(--c2));
  box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22), 0 1px 2px rgb(20 22 31 / 0.06), 0 14px 32px -12px color-mix(in srgb, var(--c1) 55%, transparent);
  transition: transform 200ms var(--ease-out), box-shadow 200ms var(--ease-out);
}
.space:active { transform: scale(0.985); }
.space .glyph { position: absolute; inset-inline-end: -26px; bottom: -34px; width: 190px; height: 190px; opacity: 0.16; stroke-width: 1.1; z-index: -1; }
.space .tile { width: 48px; height: 48px; border-radius: 15px; background: rgb(255 255 255 / 0.18); display: grid; place-items: center; box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.3); }
.space .tile svg.i { width: 26px; height: 26px; }
.space-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.space h3 { font-size: 23px; letter-spacing: -0.02em; line-height: 1.15; }
.space p { margin-top: 6px; font-size: 14.5px; line-height: 1.45; color: rgb(255 255 255 / 0.9); max-width: 34ch; text-wrap: pretty; }
.space .meta { display: flex; align-items: center; justify-content: space-between; gap: 10px; font-size: 13.5px; font-weight: 600; }
.space .count b { font-size: 22px; letter-spacing: -0.02em; margin-inline-end: 6px; }
.pill { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: 99px; background: rgb(255 255 255 / 0.2); font-size: 12px; font-weight: 650; white-space: nowrap; }
.go { width: 38px; height: 38px; border-radius: 99px; background: rgb(255 255 255 / 0.2); display: grid; place-items: center; }
.go svg.i { width: 18px; height: 18px; }
.go svg.i, html[dir="rtl"] .back svg.i { transform: scaleX(-1); }
html[dir="rtl"] .go svg.i { transform: none; }
@media (hover: hover) and (pointer: fine) {
  .space:hover { transform: translateY(-3px); }
  .site:hover, .row:hover { border-color: var(--bd2); }
  .site:hover { transform: translateY(-2px); }
}

.grid-sites { display: grid; gap: 12px; grid-template-columns: 1fr; }
.site {
  display: flex; align-items: center; gap: 14px; padding: 14px; border-radius: var(--r); min-height: 76px;
  background: var(--pn); border: 1px solid var(--bd); box-shadow: var(--sh);
  transition: transform 200ms var(--ease-out), border-color 160ms ease;
}
.site:active { transform: scale(0.985); }
.tile-c { width: 46px; height: 46px; flex: none; border-radius: 14px; display: grid; place-items: center; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.25); }
.tile-c.sm { width: 38px; height: 38px; border-radius: 12px; }
.tile-c.sm svg.i { width: 19px; height: 19px; }
.site b { display: block; font-size: 15.5px; line-height: 1.25; }
.site span.d { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; color: var(--mu); font-size: 13.5px; line-height: 1.4; margin-top: 2px; }

/* ---------- Space page ---------- */
.back { display: inline-flex; align-items: center; gap: 4px; min-height: 44px; color: var(--mu); font-weight: 600; font-size: 14.5px; padding-inline-end: 10px; border-radius: 10px; }
.back svg.i { width: 18px; height: 18px; }
.head { position: relative; overflow: hidden; isolation: isolate; margin-top: 6px; padding: 26px 22px; border-radius: 28px; color: #fff; background: linear-gradient(135deg, var(--c1), var(--c2)); box-shadow: inset 0 1px 0 rgb(255 255 255 / 0.22), 0 18px 40px -16px color-mix(in srgb, var(--c1) 60%, transparent); }
.head .glyph { position: absolute; inset-inline-end: -30px; top: -30px; width: 230px; height: 230px; opacity: 0.14; stroke-width: 1; z-index: -1; }
.head h1 { font-size: clamp(28px, 6vw, 42px); letter-spacing: -0.025em; line-height: 1.1; text-wrap: balance; }
html[dir="rtl"] .head h1 { letter-spacing: 0; line-height: 1.3; }
.head p { margin-top: 10px; color: rgb(255 255 255 / 0.92); max-width: 56ch; text-wrap: pretty; }
.head .btn { margin-top: 18px; background: #fff; color: #14161f; }
.chips { display: flex; gap: 8px; overflow-x: auto; padding: 4px 16px 10px; margin: 0 -16px; scrollbar-width: none; scroll-snap-type: x proximity; }
.chips::-webkit-scrollbar { display: none; }
.chip {
  flex: none; display: inline-flex; align-items: center; gap: 8px; height: 44px; padding: 0 16px; border-radius: 99px; scroll-snap-align: start;
  background: var(--pn); border: 1px solid var(--bd); font-weight: 600; font-size: 14px; white-space: nowrap;
  transition: background-color 160ms ease, color 160ms ease, border-color 160ms ease, transform 160ms var(--ease-out);
}
.chip:active { transform: scale(0.96); }
.chip[aria-pressed="true"] { background: var(--tx); color: var(--bg); border-color: transparent; }
.chip small { font-size: 12px; opacity: 0.65; font-variant-numeric: tabular-nums; }
.chip svg.i { width: 16px; height: 16px; opacity: 0.7; }

.field { display: flex; align-items: center; gap: 12px; height: 54px; padding: 0 16px; border-radius: 16px; background: var(--pn); border: 1px solid var(--bd); box-shadow: var(--sh); transition: border-color 160ms ease, box-shadow 160ms ease; }
.field:focus-within { border-color: var(--ac); box-shadow: 0 0 0 4px var(--ac-soft); }
.field svg.i { color: var(--mu); }
.field input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: none; color: var(--tx); font: inherit; font-size: 16px; }
.field input::placeholder { color: var(--mu); }
.field .x { width: 36px; height: 36px; border-radius: 10px; display: grid; place-items: center; color: var(--mu); }
.field .x[hidden] { display: none; }
.field .x svg.i { width: 17px; height: 17px; }
.count-line { margin: 14px 2px 10px; color: var(--mu); font-size: 13.5px; font-variant-numeric: tabular-nums; }

.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; grid-template-columns: 1fr; }
.row { display: flex; align-items: stretch; background: var(--pn); border: 1px solid var(--bd); border-radius: 16px; transition: border-color 160ms ease; }
.row a { flex: 1; min-width: 0; display: flex; align-items: center; gap: 12px; padding: 12px; padding-inline-end: 4px; min-height: 64px; border-radius: 16px; transition: transform 160ms var(--ease-out); }
.row a:active { transform: scale(0.99); }
.row .t { min-width: 0; }
.row b { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; font-size: 15px; font-weight: 620; line-height: 1.32; overflow-wrap: anywhere; }
.row small { display: block; margin-top: 2px; color: var(--mu); font-size: 12.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.star { flex: none; width: 48px; display: grid; place-items: center; color: var(--mu); border-radius: 14px; transition: color 160ms ease, transform 160ms var(--ease-out); }
.star:active { transform: scale(0.88); }
.star svg.i { width: 20px; height: 20px; }
.star[aria-pressed="true"] { color: #e8a100; }
.star[aria-pressed="true"] svg.i { fill: currentColor; }
.more-wrap { display: flex; justify-content: center; margin-top: 16px; }
.group-h { display: flex; align-items: center; gap: 10px; margin: 26px 2px 10px; font-size: 15px; font-weight: 700; }
.group-h small { color: var(--mu); font-weight: 600; font-variant-numeric: tabular-nums; }

.empty { text-align: center; padding: 48px 16px; color: var(--mu); }
.empty .tile-e { width: 56px; height: 56px; margin: 0 auto 14px; border-radius: 18px; display: grid; place-items: center; background: var(--pn); border: 1px solid var(--bd); }
.empty b { display: block; color: var(--tx); font-size: 17px; margin-bottom: 4px; }
.skel { height: 64px; border-radius: 16px; background: linear-gradient(90deg, var(--pn) 0%, var(--pn2) 50%, var(--pn) 100%); background-size: 200% 100%; animation: sk 1.2s linear infinite; }
@keyframes sk { to { background-position: -200% 0; } }
.note { margin-top: 28px; color: var(--mu); font-size: 13px; text-align: center; text-wrap: pretty; }
.banner { display: none; margin: 0 auto; max-width: 1120px; padding: 10px 16px; font-size: 13.5px; color: var(--mu); text-align: center; }
html.is-offline .banner { display: block; }

/* ---------- Sheets ---------- */
.sheet-body { padding: 4px 4px calc(12px + env(safe-area-inset-bottom)); }
.sheet-body h2 { font-size: 21px; letter-spacing: -0.02em; margin-bottom: 4px; }
.sheet-body h3 { font-size: 13px; font-weight: 650; color: var(--mu); margin: 20px 0 8px; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: 1fr; gap: 4px; padding: 4px; border-radius: 14px; background: var(--pn2); }
.seg button { height: 44px; border-radius: 11px; font-weight: 620; font-size: 14.5px; color: var(--mu); transition: background-color 160ms ease, color 160ms ease, transform 160ms var(--ease-out); }
.seg button:active { transform: scale(0.97); }
.seg button[aria-pressed="true"] { background: var(--pn); color: var(--tx); box-shadow: var(--sh); }
.sheet-actions { display: grid; gap: 8px; margin-top: 22px; }
.sheet-actions .btn { width: 100%; }
.steps { margin: 12px 0 0; padding: 0; list-style: none; display: grid; gap: 10px; }
.steps li { padding: 14px; border-radius: 14px; background: var(--pn2); font-size: 14.5px; line-height: 1.45; }
.fine { margin-top: 18px; color: var(--mu); font-size: 12.5px; text-align: center; text-wrap: pretty; }

/* Toasts sit above the dock on phones */
.pk-toaster { bottom: calc(var(--dock-h) + 28px + env(safe-area-inset-bottom)); right: 12px; }
html[dir="rtl"] .pk-toaster { right: auto; left: 12px; }

/* One mount animation for the hero only */
@media (prefers-reduced-motion: no-preference) {
  .hero > * { animation: up 600ms var(--ease-out) both; }
  .hero > *:nth-child(2) { animation-delay: 60ms; }
  .hero > *:nth-child(3) { animation-delay: 120ms; }
  @keyframes up { from { opacity: 0; transform: translateY(10px); } }
}
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Wider screens ---------- */
@media (min-width: 640px) {
  .grid4 { grid-template-columns: 1fr 1fr; }
  .grid-sites { grid-template-columns: 1fr 1fr; }
  .list { grid-template-columns: 1fr 1fr; }
  .space { min-height: 220px; padding: 26px; }
}
@media (min-width: 900px) {
  body { padding-bottom: 40px; }
  .dock { display: none; }
  .tabs { display: flex; }
  main { padding: 28px 24px 8px; }
  .hero { padding-top: 44px; }
  .fake-search kbd { display: inline-block; }
  .grid-sites { grid-template-columns: repeat(3, 1fr); }
  .head { padding: 40px 36px; }
  .pk-toaster { bottom: 24px; right: 24px; }
  html[dir="rtl"] .pk-toaster { left: 24px; }
  .chips { flex-wrap: wrap; overflow: visible; margin: 0; padding: 4px 0 10px; }
}
@media (min-width: 1100px) {
  .list.wide { grid-template-columns: repeat(3, 1fr); }
}

.space h3.mt { margin-top: 16px; }
#sp-chips, #q-chips { margin-top: 12px; }
