/* Tokens: see DESIGN.md */
:root {
  --bg: #FFFFFF; --surface: #FFFFFF; --soft: #F4F7FB; --ink: #101828; --muted: #5A6474; --line: #E2E7EE;
  --accent: #0053A6; --accent-hover: #00478F; --accent-ink: #FFFFFF; --accent-soft: #EAF2FB; --danger: #B3261E; --ok: #0A7D33;
  --map-bg: #F8FAFC; --paper: #EFE6D2;
  --st-available: #FFFFFF; --st-under_action: #FF972D; --st-reserved: #C8474B; --st-sold: #0A7D33;
  --st-next_phase: #8C8A88; --st-transferred: #0B5C99; --st-park: #A6E8B0;
  --r-sm: 8px; --r-md: 14px; --r-lg: 20px;
  --shadow: 0 12px 32px -12px rgb(31 27 24 / .18);
  --font: "IBM Plex Sans Arabic", "IBM Plex Sans", system-ui, sans-serif;
  --mono: "IBM Plex Mono", ui-monospace, monospace;
}
[data-theme="dark"] {
  --bg: #0F1218; --surface: #171B23; --soft: #141922; --ink: #EEF1F5; --muted: #9BA5B4; --line: #2A313C;
  --accent: #2F7FD6; --accent-hover: #4A93E3; --accent-ink: #FFFFFF; --accent-soft: #16263A; --danger: #F2B8B5; --ok: #7BD694;
  --map-bg: #EEF1F5; --shadow: 0 12px 32px -12px rgb(0 0 0 / .6);
}
[lang="en"] { --font: "IBM Plex Sans", "IBM Plex Sans Arabic", system-ui, sans-serif; }

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 88px; -webkit-text-size-adjust: 100%; }
body { margin: 0; background: var(--bg); color: var(--ink); font: 400 16px/1.7 var(--font); }
h1, h2, h3, p, ol, ul, dl, dd { margin: 0; padding: 0; }
ol, ul { list-style: none; }
[hidden] { display: none !important; }
img, svg { display: block; max-width: 100%; }
button, input { font: inherit; color: inherit; }
a { color: inherit; }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; border-radius: 4px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.skip { position: absolute; inset-inline-start: 16px; top: -60px; background: var(--ink); color: var(--bg); padding: 8px 16px; border-radius: var(--r-sm); z-index: 50; }
.skip:focus { top: 12px; }
.wrap { width: 100%; max-width: 1168px; margin-inline: auto; padding-inline: 24px; }

h1 { font-size: clamp(36px, 5.4vw, 56px); line-height: 1.15; font-weight: 600; max-width: 16ch; }
h2 { font-size: clamp(26px, 3.4vw, 36px); line-height: 1.25; font-weight: 600; }
h3 { font-size: 20px; line-height: 1.4; font-weight: 600; }
[lang="en"] h1, [lang="en"] h2 { letter-spacing: -0.02em; }
.lead { font-size: 18px; line-height: 1.7; color: var(--muted); max-width: 52ch; }
.fine { font-size: 14px; line-height: 1.5; color: var(--muted); }
.eyebrow { font-size: 14px; font-weight: 500; color: var(--muted); }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 8px 20px;
  border-radius: var(--r-sm); border: 1px solid transparent; font-weight: 600; font-size: 15px; text-decoration: none; cursor: pointer;
  transition: background-color .2s ease-out, border-color .2s ease-out, transform .1s ease-out; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.lg { min-height: 52px; padding: 12px 28px; font-size: 16px; }
.btn.primary { background: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { background: var(--accent-hover); }
.btn.dark { background: var(--ink); color: var(--bg); }
.btn.dark:hover { opacity: .88; }
.btn.ghost { border-color: var(--line); background: var(--surface); }
.btn.ghost:hover { border-color: var(--ink); }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.link-btn { background: none; border: 0; padding: 4px; cursor: pointer; font-weight: 500; text-decoration: underline; text-underline-offset: 4px; }
.icon-btn { min-width: 44px; height: 44px; display: inline-grid; place-items: center; background: none; border: 1px solid transparent;
  border-radius: var(--r-sm); cursor: pointer; font-weight: 600; font-size: 14px; }
.icon-btn:hover { border-color: var(--line); background: var(--surface); }

/* nav */
.nav { position: sticky; top: 0; z-index: 20; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.nav-in { display: flex; align-items: center; justify-content: space-between; height: 72px; }
.brand img { height: 48px; width: auto; }
.logo-d, [data-theme="dark"] .logo-l { display: none; }
[data-theme="dark"] .logo-d { display: block; }
.nav-actions { display: flex; align-items: center; gap: 4px; }
.nav-actions .btn { margin-inline-start: 8px; }

/* hero */
.hero { padding-block: 72px 48px; display: grid; gap: 24px; }
.cta-row { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 8px; }

/* demo */
.demo { padding-bottom: 96px; }
.demo-head { display: flex; flex-wrap: wrap; align-items: end; justify-content: space-between; gap: 16px 32px; margin-bottom: 16px; }
.steps-bar { display: flex; flex-wrap: wrap; gap: 8px 20px; font-size: 14px; color: var(--muted); }
.steps-bar li { display: flex; align-items: center; gap: 8px; }
.steps-bar b { font-weight: 500; }
.steps-bar span { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--line); font: 500 12px/1 var(--mono); background: var(--surface); }
.steps-bar li.is-active { color: var(--ink); }
.steps-bar li.is-active span { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.steps-bar li.is-done span { background: var(--ok); border-color: var(--ok); color: #fff; }
[data-theme="dark"] .steps-bar li.is-done span { color: #10240F; }

.coach { display: flex; align-items: center; gap: 12px; padding: 14px 20px; background: var(--ink); color: var(--bg); border-radius: var(--r-md); margin-bottom: 16px; min-height: 56px; }
.coach p { flex: 1; font-weight: 500; line-height: 1.5; }
.coach .link-btn { color: inherit; white-space: nowrap; }
.coach-dot { width: 10px; height: 10px; border-radius: 50%; background: #FF972D; flex: none; animation: pulse 1.6s ease-out infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgb(255 151 45 / .7); } 100% { box-shadow: 0 0 0 12px rgb(255 151 45 / 0); } }

.stage { display: grid; grid-template-columns: minmax(0, 1fr) 360px; gap: 16px; align-items: stretch; }
.map-wrap { padding-top: 44px; position: relative; background: var(--map-bg); border: 1px solid var(--line); border-radius: var(--r-lg); box-shadow: var(--shadow); overflow: hidden;
  transition: background-color .9s ease-out, transform .9s cubic-bezier(.2,.8,.2,1); color: #1F1B18; }
#map { width: 100%; height: auto; }
.map-tag { position: absolute; top: 14px; inset-inline-start: 14px; z-index: 2; padding: 4px 12px; border-radius: 999px; background: #1F1B18; color: #fff; font-size: 13px; font-weight: 500; }
.road { fill: none; stroke: #CFC9BD; stroke-width: 1; stroke-dasharray: 6 6; }
.plot { stroke: #5B544C; stroke-width: 1; cursor: pointer; transition: fill .5s ease-out, stroke-width .15s; fill: var(--st-available); }
.plot[data-status="under_action"] { fill: var(--st-under_action); }
.plot[data-status="reserved"] { fill: var(--st-reserved); }
.plot[data-status="sold"] { fill: var(--st-sold); }
.plot[data-status="next_phase"] { fill: var(--st-next_phase); }
.plot[data-status="transferred"] { fill: var(--st-transferred); }
.plot:hover, .plot:focus-visible { stroke-width: 2.5; stroke: #1F1B18; outline: none; }
.plot.is-selected { stroke: #1F1B18; stroke-width: 3.5; }
.plot.is-hint { animation: hint 1.4s ease-in-out infinite; }
@keyframes hint { 50% { fill: #FFE7C7; } }
.plot-label { font: 500 9px/1 var(--mono); fill: #1F1B18; text-anchor: middle; pointer-events: none; opacity: .55; }
.plot[data-status="sold"] + .plot-label, .plot[data-status="transferred"] + .plot-label, .plot[data-status="reserved"] + .plot-label { fill: #fff; opacity: .85; }
.park { fill: var(--st-park); stroke: #5B544C; stroke-width: 1; transition: fill .5s ease-out; }
.park-label { font: 500 11px/1 var(--font); fill: #1F5130; text-anchor: middle; pointer-events: none; transition: opacity .5s; }

/* paper phase: before the plan becomes interactive */
.stage[data-phase="paper"] .map-wrap { transform: rotate(-1.2deg) scale(.97);
  background: radial-gradient(120% 90% at 20% 10%, transparent 55%, rgb(0 0 0 / .13)), linear-gradient(100deg, rgb(0 0 0 / .05), transparent 30%), #E9E7E0; }
/* photocopy grain and toner specks */
.map-wrap::before { content: ""; position: absolute; inset: 0; z-index: 1; pointer-events: none; opacity: 0; mix-blend-mode: multiply; transition: opacity .9s ease-out;
  background-image:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='240' height='240'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.9' numOctaves='2' stitchTiles='stitch'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -1.1 1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='.55'/%3E%3C/svg%3E"),
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='400' height='400'%3E%3Cfilter id='s'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.12' seed='7'/%3E%3CfeColorMatrix values='0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 -9 3.1'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23s)' opacity='.35'/%3E%3C/svg%3E"); }
.stage[data-phase="paper"] .map-wrap::before { opacity: .6; }
.paper-only, .road-name, .paper-title { opacity: 0; transition: opacity .7s ease-out; pointer-events: none; }
.stage[data-phase="paper"] .paper-only, .stage[data-phase="paper"] .road-name, .stage[data-phase="paper"] .paper-title { opacity: 1; }
.frame { fill: none; stroke: #111; stroke-width: 2.2; }
.frame.thin { stroke-width: .8; }
.ink { fill: #111; }
.hand { font: 700 11px/1 "Aref Ruqaa", var(--font); fill: #111; text-anchor: middle; }
.paper-title { position: absolute; z-index: 2; inset-inline: 0; bottom: 14px; text-align: center; color: #111; font: 700 clamp(17px, 2.6vw, 26px)/1.3 "Aref Ruqaa", var(--font); }
.stage[data-phase="paper"] .plan { filter: url(#rough); }
.stage[data-phase="paper"] .plot, .stage[data-phase="paper"] .park { stroke: #111; stroke-width: 1.4; }
.stage[data-phase="paper"] .road { stroke: #111; stroke-width: .7; stroke-dasharray: 14 4 2 4; }
.stage[data-phase="paper"] .park-label { fill: #111; opacity: 1; font-family: "Aref Ruqaa", var(--font); font-size: 14px; }
.stage[data-phase="paper"] .plot-label { fill: #111 !important; opacity: .9 !important; font-family: "Aref Ruqaa", var(--mono); font-size: 11px; }
.stage[data-phase="paper"] .plot, .stage[data-phase="paper"] .park { fill: transparent !important; pointer-events: none; }
.stage[data-phase="paper"] .legend { opacity: 0; }
.stage[data-phase="paper"] .panel { opacity: .45; pointer-events: none; }
.scan { position: absolute; inset-block: 0; width: 90px; inset-inline-start: -90px; background: linear-gradient(90deg, transparent, rgb(0 83 166 / .28), transparent); pointer-events: none; opacity: 0; }
.stage.is-scanning .scan { opacity: 1; animation: scan 1.3s ease-in-out forwards; }
@keyframes scan { to { inset-inline-start: 100%; } }

.legend { padding: 4px 16px 14px; display: flex; flex-wrap: wrap; gap: 4px 14px; font-size: 12px; color: #1F1B18; transition: opacity .6s; }
.legend li { display: flex; align-items: center; gap: 6px; }
.dot { width: 12px; height: 12px; border-radius: 3px; border: 1px solid #5B544C; flex: none; }

.tip { position: absolute; z-index: 3; pointer-events: none; min-width: 170px; padding: 10px 12px; background: #1F1B18; color: #fff; border-radius: var(--r-sm); font-size: 13px; line-height: 1.6; box-shadow: var(--shadow); }
.tip b { font: 500 14px/1.4 var(--mono); display: block; }

.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; transition: opacity .6s; min-height: 420px; }
.tabs { display: grid; grid-template-columns: 1fr 1fr; border-bottom: 1px solid var(--line); }
.tabs button { min-height: 48px; background: none; border: 0; border-bottom: 2px solid transparent; cursor: pointer; font-weight: 500; font-size: 14px; color: var(--muted); }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.view { padding: 20px; flex: 1; display: none; }
.stage[data-view="customer"] #viewCustomer, .stage[data-view="admin"] #viewAdmin { display: grid; gap: 16px; align-content: start; }
.demo-note { padding: 12px 20px; border-top: 1px solid var(--line); font-size: 12px; }
.empty { color: var(--muted); font-size: 15px; }
.plot-code { font: 500 22px/1.2 var(--mono); }
.badge { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: 999px; border: 1px solid var(--line); font-size: 13px; font-weight: 500; }
.specs { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.specs div { border: 1px solid var(--line); border-radius: var(--r-sm); padding: 8px 12px; }
.specs dt { font-size: 12px; color: var(--muted); }
.specs dd { font-weight: 500; }
.mini-form { display: grid; gap: 12px; }
.panel-title { font-size: 14px; font-weight: 600; color: var(--muted); }
.lead-row { display: grid; gap: 2px; padding: 12px; border: 1px solid var(--line); border-radius: var(--r-sm); animation: drop .5s cubic-bezier(.2,.8,.2,1); }
.lead-row b { font-weight: 600; }
.lead-row span { font-size: 13px; color: var(--muted); }
.lead-row .new { color: var(--ok); font-weight: 600; }
@keyframes drop { from { opacity: 0; transform: translateY(-10px); } }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-size: 14px; font-weight: 500; }
.chip:hover { border-color: var(--ink); }
.chip[aria-pressed="true"] { border-color: var(--ink); box-shadow: inset 0 0 0 1px var(--ink); }
.chip.is-hint { animation: chipHint 1.4s ease-in-out infinite; }
@keyframes chipHint { 50% { box-shadow: 0 0 0 4px rgb(200 71 75 / .3); } }
.done-box { display: grid; gap: 12px; padding: 16px; border-radius: var(--r-md); background: var(--bg); border: 1px solid var(--line); }

/* clients */
.clients { padding-block: 0 96px; }
.clients .eyebrow { text-align: center; margin-bottom: 24px; }
.marquee { overflow: hidden; direction: ltr; mask-image: linear-gradient(90deg, transparent, #000 8%, #000 92%, transparent); }
.track { display: flex; gap: 16px; width: max-content; animation: marquee 48s linear infinite; }
.marquee:hover .track, .marquee:focus-within .track { animation-play-state: paused; }
@keyframes marquee { to { transform: translateX(-50%); } }
.track li { flex: none; width: 176px; height: 88px; display: grid; place-items: center; background: #fff; border: 1px solid var(--line); border-radius: var(--r-md); padding: 16px 20px; }
.track img { max-height: 52px; max-width: 100%; width: auto; filter: grayscale(1); opacity: .8; transition: filter .2s, opacity .2s; }
.track li:hover img { filter: none; opacity: 1; }

/* how */
.how { padding-bottom: 96px; display: grid; gap: 32px; }
.how-grid { display: grid; grid-template-columns: repeat(3, 1fr); border-block: 1px solid var(--line); }
.how-grid li { padding: 28px 24px; display: grid; gap: 8px; align-content: start; }
.how-grid li + li { border-inline-start: 1px solid var(--line); }
.how-grid li:first-child { padding-inline-start: 0; }
.how-grid p { color: var(--muted); }
.num { font: 500 13px/1 var(--mono); color: var(--muted); }
.integrations { color: var(--muted); }
.integrations b { color: var(--ink); font: 500 15px/1 var(--mono); }

/* contact */
.contact { display: grid; grid-template-columns: 1fr minmax(0, 440px); gap: 48px; align-items: center; padding-bottom: 96px; }
.contact-copy { display: grid; gap: 20px; justify-items: start; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); padding: 28px; }
.form { display: grid; gap: 16px; }
.field { display: grid; gap: 6px; }
.field label { font-size: 14px; font-weight: 500; }
.opt { color: var(--muted); font-weight: 400; }
input { width: 100%; min-height: 48px; padding: 8px 14px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-sm); transition: border-color .2s; }
input:hover { border-color: var(--muted); }
input:focus-visible { outline: 2px solid var(--ink); outline-offset: 0; border-color: var(--ink); }
input[aria-invalid="true"] { border-color: var(--danger); }
input::placeholder { color: var(--muted); opacity: .7; }
[dir="rtl"] input[dir="ltr"] { text-align: end; }
.error { font-size: 13px; color: var(--danger); }
.form-msg { font-weight: 500; min-height: 1.5em; }
.form-msg.ok { color: var(--ok); }
.form-msg.bad { color: var(--danger); }
.hp { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }

.footer { border-top: 1px solid var(--line); }
.footer-in { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px; padding-block: 24px; font-size: 14px; color: var(--muted); }

@media (max-width: 960px) {
  .stage { grid-template-columns: 1fr; }
  .panel { min-height: 0; }
  .contact { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .wrap { padding-inline: 16px; }
  .hero { padding-block: 40px 32px; }
  .brand img { height: 40px; }
  .nav-in { height: 64px; }
  .nav-actions .btn { padding-inline: 14px; margin-inline-start: 4px; }
  .demo, .how, .contact, .clients { padding-bottom: 64px; }
  .cta-row .btn { flex: 1 1 100%; }
  .how-grid { grid-template-columns: 1fr; }
  .how-grid li { padding-inline: 0; }
  .how-grid li + li { border-inline-start: 0; border-top: 1px solid var(--line); }
  .coach { align-items: flex-start; padding: 12px 16px; }
  .coach-dot { margin-top: 7px; }
  .track li { width: 140px; height: 76px; }
  .card { padding: 20px; }
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .marquee { mask-image: none; }
  .track { flex-wrap: wrap; justify-content: center; width: auto; padding-inline: 16px; }
  .track li[aria-hidden="true"] { display: none; }
}

/* ---- v2: hero with looping map, white page, framed steps, demo page ---- */
.hero { grid-template-columns: minmax(0, 1fr) minmax(0, 1.15fr); gap: 48px; align-items: center; padding-block: 56px 72px; }
.hero-copy { display: grid; gap: 24px; }
.hero h1 { font-size: clamp(34px, 4.3vw, 52px); max-width: none; }
.hero-stage { display: block; }
.hero-stage .plot { cursor: default; pointer-events: none; }

.clients { background: var(--soft); padding-block: 40px; margin-bottom: 96px; }

.how-grid { gap: 20px; border: 0; }
.how-grid li, .how-grid li:first-child { padding: 24px; gap: 8px; background: var(--surface); border: 1.5px solid var(--accent); border-radius: var(--r-md); }
.how-grid li + li { border-inline-start: 1.5px solid var(--accent); }
.how-top { display: flex; align-items: center; justify-content: space-between; margin-bottom: 12px; }
.how-icon { width: 48px; height: 48px; display: grid; place-items: center; border-radius: 12px; background: var(--accent-soft); color: var(--accent); }
.how .num { font: 600 13px/1.4 var(--font); color: var(--accent); background: var(--accent-soft); padding: 4px 12px; border-radius: 999px; }
.integrations { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; }
.integrations b { border: 1px solid var(--line); border-radius: 999px; padding: 8px 14px; background: var(--soft); }

.demo-page { padding-top: 24px; }
.demo-page h1 { font-size: clamp(28px, 3.6vw, 40px); max-width: none; }
.demo-page .demo-head { align-items: end; }
.back { display: inline-flex; align-items: center; gap: 6px; min-height: 44px; margin-bottom: 8px; color: var(--muted); text-decoration: none; font-size: 14px; font-weight: 500; }
.back:hover { color: var(--ink); }
[dir="rtl"] .back span[aria-hidden] { transform: scaleX(-1); }

@media (max-width: 960px) {
  .hero { grid-template-columns: 1fr; gap: 32px; }
}
@media (max-width: 640px) {
  .hero { padding-block: 32px 48px; }
  .clients { padding-block: 32px; margin-bottom: 64px; }
  .how-grid li, .how-grid li:first-child { padding: 20px; }
  .how-grid li + li { border-top: 1.5px solid var(--accent); }
}
