@font-face { font-family: 'Noto Sans Arabic'; font-weight: 400; font-display: swap; src: url(lib/fonts/noto-sans-arabic-arabic-400-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+066A-066D; }
@font-face { font-family: 'Noto Sans Arabic'; font-weight: 600; font-display: swap; src: url(lib/fonts/noto-sans-arabic-arabic-600-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+066A-066D; }
@font-face { font-family: 'Noto Sans Arabic'; font-weight: 700; font-display: swap; src: url(lib/fonts/noto-sans-arabic-arabic-700-normal.woff2) format('woff2'); unicode-range: U+0600-06FF, U+0750-077F, U+0870-08FF, U+FB50-FDFF, U+FE70-FEFF, U+200C-200F, U+066A-066D; }
@font-face { font-family: 'Inter'; font-weight: 400; font-display: swap; src: url(lib/fonts/inter-latin-400-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 600; font-display: swap; src: url(lib/fonts/inter-latin-600-normal.woff2) format('woff2'); }
@font-face { font-family: 'Inter'; font-weight: 700; font-display: swap; src: url(lib/fonts/inter-latin-700-normal.woff2) format('woff2'); }

/* night-blue glass over satellite imagery: water reads as light, rain as amber */
:root {
  --font: 'Inter', 'Noto Sans Arabic', system-ui, sans-serif;
  --night: #0a1220; --night-2: #111c2e; --glass: rgb(13 21 36 / 74%); --glass-line: rgb(255 255 255 / 10%);
  --text: #e8eef6; --dim: #9fb0c3; --faint: #6c7f95;
  --water: #5fd0ff; --water-2: #2f7fe0; --rain: #f5b942; --soil: #84cc16; --drain: #94a3b8; --out: #f472b6; --surf: #a78bfa;   /* water-balance colours: kept apart from the blue-to-red depth colours */
  --go-1: #2fb7ff; --go-2: #3a6cf4;
  --side-w: 372px; --r: 16px;
}
* { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; font-family: var(--font); color: var(--text); background: var(--night); font-size: 14.5px; line-height: 1.55; -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
button, input, select { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--water); outline-offset: 2px; }
.glass { background: var(--glass); border: 1px solid var(--glass-line); -webkit-backdrop-filter: blur(14px) saturate(1.2); backdrop-filter: blur(14px) saturate(1.2); box-shadow: 0 10px 30px rgb(0 0 0 / 35%); }

.fl { position: relative; height: 100%; }
.stage { position: absolute; inset: 0; }
#map { position: absolute; inset: 0; background: #0d1626; }
#water, #flow { position: absolute; left: 0; top: 0; pointer-events: none; z-index: 410; }
#flow { z-index: 411; mix-blend-mode: screen; }
.basemap-sat { filter: saturate(.7) brightness(.62) contrast(1.05); }
.basemap-dark { filter: brightness(1.15); }
/* relief: light hill shading darkened and tinted slate-teal; the dark grey roads map is added on top with a screen blend so only roads and towns show */
.basemap-relief { filter: brightness(.27) contrast(1.6) sepia(.6) hue-rotate(155deg) saturate(1.8); }
.basemap-roads { mix-blend-mode: screen; opacity: .45; }
#water { filter: saturate(1.25) brightness(1.1); }
.basemap-topo { filter: saturate(.85) brightness(.9); }
.basemap-lbl { filter: brightness(1.1); }
.leaflet-container { font-family: var(--font); background: #0d1626; }
.leaflet-control-attribution { background: rgb(10 18 32 / 70%) !important; color: var(--faint) !important; font-size: 10.5px; }
.leaflet-control-attribution a { color: var(--dim) !important; }

#rainfx { position: absolute; inset: 0; z-index: 420; pointer-events: none; opacity: .22;
  background-image: repeating-linear-gradient(104deg, transparent 0 11px, rgb(210 235 255 / 80%) 11px 12px, transparent 12px 27px);
  background-size: 70px 70px; animation: rain .42s linear infinite; mix-blend-mode: screen; }
@keyframes rain { to { background-position: -18px 70px; } }

.plc i { position: absolute; left: -4px; top: -4px; width: 8px; height: 8px; border-radius: 50%; background: var(--rain); box-shadow: 0 0 0 2px rgb(10 18 32 / 80%); }
.plc span { position: absolute; left: 9px; top: -10px; white-space: nowrap; color: #fff; font-size: 12px; font-weight: 600; text-shadow: 0 1px 3px #000, 0 0 2px #000; }
.plc.flip span { left: auto; right: 9px; }
.plc.big span { font-size: 15px; font-weight: 700; }
.plc.big i { width: 11px; height: 11px; left: -5.5px; top: -5.5px; background: #fff; }

/* title card */
.hero { position: absolute; z-index: 600; top: 16px; inset-inline-start: 16px; max-width: 420px; border-radius: var(--r); padding: 14px 18px; }
.kicker { font-size: 12px; font-weight: 600; letter-spacing: .02em; color: var(--water); }
.hero h1 { margin: 2px 0 10px; font-size: 26px; line-height: 1.25; font-weight: 700; }
.citysel { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 12.5px; color: var(--dim); }
.citysel select, .basesel select { appearance: none; -webkit-appearance: none; border: 1px solid rgb(95 208 255 / 45%); border-radius: 10px; background: rgb(95 208 255 / 12%) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23cfe9ff' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat; background-size: 10px 6px; color: #fff; font-weight: 700; font-size: 14px; padding: 5px 12px; padding-inline-end: 30px; cursor: pointer; max-width: 100%; }
[dir="rtl"] .citysel select, [dir="rtl"] .basesel select { background-position: left 11px center; }
[dir="ltr"] .citysel select, [dir="ltr"] .basesel select { background-position: right 11px center; }
.picker { position: relative; min-width: 0; }
#pick-btn { appearance: none; border: 1px solid rgb(95 208 255 / 45%); border-radius: 10px; background: rgb(95 208 255 / 12%) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%23cfe9ff' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat; background-size: 10px 6px; color: #fff; font-size: 14px; padding: 5px 12px; padding-inline-end: 30px; cursor: pointer; max-width: 100%; text-align: start; }
#pick-btn b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 700; }
[dir="rtl"] #pick-btn { background-position: left 11px center; } [dir="ltr"] #pick-btn { background-position: right 11px center; }
.pick-pop { position: absolute; z-index: 900; top: calc(100% + 6px); inset-inline-start: 0; width: 330px; max-width: calc(100vw - 40px); background: var(--night-2); border: 1px solid rgb(95 208 255 / 30%); border-radius: 12px; box-shadow: 0 16px 40px rgb(0 0 0 / 55%); padding: 8px; }
.pick-pop[hidden] { display: none; }
body.picking .hero { z-index: 1500; }
#pick-q { width: 100%; box-sizing: border-box; background: var(--night); border: 1px solid var(--glass-line); border-radius: 8px; padding: 7px 10px; font-size: 14px; color: var(--text); outline: none; }
#pick-q:focus { border-color: rgb(95 208 255 / 60%); }
#pick-list { list-style: none; margin: 6px 0 0; padding: 0; max-height: min(420px, 55vh); overflow-y: auto; overscroll-behavior: contain; }
#pick-list li { padding: 6px 10px; border-radius: 7px; font-size: 13.5px; line-height: 1.35; color: var(--text); }
#pick-list li.gov { position: sticky; top: 0; z-index: 1; background: var(--night-2); color: var(--water); font-size: 12px; font-weight: 700; padding: 8px 6px 4px; letter-spacing: .02em; }
#pick-list li.qh { color: var(--dim); font-weight: 700; font-size: 13px; padding-top: 8px; }
#pick-list li.opt { cursor: pointer; }
#pick-list li.opt.q { font-weight: 700; display: flex; align-items: baseline; gap: 8px; }
#pick-list li.opt.q small { color: var(--water); font-weight: 600; font-size: 11.5px; }
#pick-list li.opt.n { padding-inline-start: 26px; color: #d6e0ec; }
#pick-list li.opt:hover, #pick-list li.opt.act { background: rgb(95 208 255 / 14%); }
#pick-list li.opt[aria-selected="true"] { background: var(--water-2); color: #fff; }
#pick-list li.opt[aria-selected="true"] small { color: #dff4ff; }
#pick-list li.none { color: var(--faint); text-align: center; padding: 14px; }
#place optgroup { background: var(--night-2); color: var(--water); font-weight: 700; font-style: normal; }
#place option { background: var(--night-2); color: var(--text); font-weight: 500; }
.citysel select option, .basesel select option { background: var(--night-2); color: var(--text); font-weight: 500; }
.basesel { align-items: center; gap: 4px; padding: 3px 3px 3px 10px; }
[dir="rtl"] .basesel { padding: 3px 10px 3px 3px; }
.basesel svg { width: 16px; height: 16px; fill: none; stroke: var(--water); stroke-width: 1.5; stroke-linejoin: round; flex: none; }
.basesel select { border: 0; background-color: transparent; font-size: 12.5px; font-weight: 600; padding: 4px 8px; padding-inline-end: 26px; border-radius: 999px; }
.langs { display: flex; gap: 4px; }
.langs button { border: 1px solid var(--glass-line); background: transparent; color: var(--dim); border-radius: 999px; padding: 2px 12px; font-size: 12.5px; cursor: pointer; }
.langs button[aria-pressed="true"] { background: var(--text); color: var(--night); border-color: var(--text); font-weight: 600; }

/* map controls */
.mapctl { position: absolute; z-index: 600; top: 16px; inset-inline-start: calc(16px + 420px + 12px); inset-inline-end: calc(var(--side-w) + 32px); display: flex; flex-wrap: wrap; gap: 8px; justify-content: flex-end; align-items: flex-start; }
.pill { display: flex; border-radius: 999px; padding: 3px; }
.pill button { border: 0; background: none; color: var(--dim); padding: 5px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 600; cursor: pointer; white-space: nowrap; }
.pill button[aria-pressed="true"] { background: rgb(95 208 255 / 18%); color: #fff; box-shadow: inset 0 0 0 1px rgb(95 208 255 / 45%); }
.pill.zoom button { width: 32px; padding: 3px 0; font-size: 17px; line-height: 1.2; }

.legend { position: absolute; z-index: 600; bottom: 128px; inset-inline-start: 16px; border-radius: 12px; padding: 9px 12px 7px; font-size: 11.5px; min-width: 230px; }
.legend2 { display: none; }
.legend b { display: block; font-size: 12px; margin-bottom: 6px; }
.legend .ramp { height: 10px; border-radius: 5px; direction: ltr; }
.legend .ticks { position: relative; height: 16px; direction: ltr; color: var(--dim); margin-top: 2px; }
.legend .danger { display: block; margin-top: 4px; color: #ff8a5c; font-size: 11px; max-width: 230px; }
.legend .ticks span { position: absolute; transform: translateX(-50%); }

/* timeline */
.timebar { position: absolute; z-index: 600; bottom: 16px; inset-inline-start: 16px; inset-inline-end: calc(var(--side-w) + 32px); border-radius: var(--r); padding: 10px 16px 6px; display: flex; gap: 14px; align-items: center; }
.tb-play { flex: none; width: 46px; height: 46px; border-radius: 50%; border: 0; background: linear-gradient(135deg, var(--go-1), var(--go-2)); display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 18px rgb(47 127 224 / 45%); }
.tb-play svg { width: 20px; height: 20px; fill: #fff; }
.tb-mid { flex: 1; min-width: 0; }
.tb-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.tb-row b { font-variant-numeric: tabular-nums; font-size: 17px; letter-spacing: .02em; }
.phase { font-size: 12px; font-weight: 600; padding: 2px 10px; border-radius: 999px; background: rgb(95 208 255 / 14%); color: var(--water); }
.phase.rain { background: rgb(245 185 66 / 16%); color: var(--rain); }
.tb-key { font-size: 11.5px; color: var(--faint); display: flex; gap: 10px; }
.tb-key i { display: inline-block; width: 14px; height: 0; border-top: 2px solid var(--water); vertical-align: middle; margin-inline-end: 4px; }
.tb-key i.prev { border-top: 2px dashed var(--dim); }
.tb-row select { margin-inline-start: auto; border: 1px solid var(--glass-line); border-radius: 8px; background: var(--night-2); padding: 2px 6px; font-size: 12.5px; }
.tb-track { position: relative; height: 48px; direction: ltr; margin-top: 4px; }
#spark { position: absolute; inset: 0; width: 100%; height: 44px; }
#scrub { position: absolute; left: 0; right: 0; bottom: -6px; width: 100%; height: 22px; margin: 0; background: transparent; -webkit-appearance: none; appearance: none; }
#scrub::-webkit-slider-runnable-track { height: 22px; background: transparent; }
#scrub::-moz-range-track { height: 22px; background: transparent; }
#scrub::-webkit-slider-thumb { -webkit-appearance: none; width: 18px; height: 18px; margin-top: 2px; border-radius: 50%; background: #fff; border: 4px solid var(--water-2); box-shadow: 0 2px 8px rgb(0 0 0 / 40%); }
#scrub::-moz-range-thumb { width: 12px; height: 12px; border-radius: 50%; background: #fff; border: 4px solid var(--water-2); }
.tb-ticks { position: relative; height: 16px; direction: ltr; font-size: 11px; color: var(--faint); }
.tb-ticks span { position: absolute; transform: translateX(-50%); white-space: nowrap; }
.tb-ticks span:first-child { transform: none; }
.tb-ticks span:last-child { transform: translateX(-100%); }

/* side panel */
.side { position: absolute; z-index: 600; top: 16px; bottom: 16px; inset-inline-end: 16px; width: var(--side-w); border-radius: var(--r); overflow-y: auto; padding: 4px 0 14px; scrollbar-width: thin; scrollbar-color: rgb(255 255 255 / 18%) transparent; }
.card { margin: 10px 12px 0; padding: 14px; border-radius: 12px; background: rgb(255 255 255 / 4%); border: 1px solid var(--glass-line); }
.card h2 { margin: 0 0 10px; font-size: 14.5px; }
.card h3 { margin: 14px 0 6px; font-size: 12.5px; color: var(--dim); font-weight: 600; }
.sub-h { font-size: 13px; margin: 6px 0 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 10px; }
.chips button { border: 1px solid var(--glass-line); background: rgb(255 255 255 / 4%); color: var(--dim); border-radius: 999px; padding: 4px 10px; font-size: 12px; cursor: pointer; }
.chips button[aria-pressed="true"] { border-color: rgb(95 208 255 / 55%); background: rgb(95 208 255 / 14%); color: #fff; font-weight: 600; }
.sl { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 0 8px; margin: 6px 0 4px; font-size: 13px; }
.sl b { font-variant-numeric: tabular-nums; color: var(--water); font-weight: 600; }
.sl input { grid-column: 1 / -1; width: 100%; accent-color: var(--water-2); margin: 6px 0 2px; }
.intens { margin: 0 0 8px; font-size: 12px; color: var(--rain); }
.seg { display: flex; background: rgb(0 0 0 / 22%); border: 1px solid var(--glass-line); border-radius: 10px; padding: 3px; margin: 0 0 14px; }
.seg button { flex: 1; border: 0; background: none; padding: 5px 6px; border-radius: 8px; font-size: 12.5px; cursor: pointer; color: var(--dim); }
.seg button[aria-pressed="true"] { background: rgb(255 255 255 / 12%); color: #fff; font-weight: 600; }
.go { position: relative; overflow: hidden; width: 100%; border: 0; border-radius: 12px; background: linear-gradient(135deg, var(--go-1), var(--go-2)); color: #fff; font-weight: 700; padding: 11px; cursor: pointer; box-shadow: 0 6px 18px rgb(47 127 224 / 35%); }
.go span { position: relative; z-index: 1; }
.go i { position: absolute; inset: 0 auto 0 0; width: 0; background: rgb(255 255 255 / 22%); }
.go.busy { cursor: default; }
.go.ready { animation: goPulse 1.8s ease-in-out infinite; }
@keyframes goPulse { 0%, 100% { box-shadow: 0 6px 18px rgb(47 127 224 / 35%); } 50% { box-shadow: 0 0 0 4px rgb(95 208 255 / 35%), 0 6px 22px rgb(47 127 224 / 55%); } }
@media (prefers-reduced-motion: reduce) { .go.ready { animation: none; } }
.run-hint { margin: 8px 2px 0; font-size: 12px; line-height: 1.5; color: var(--dim); text-align: center; }
.run-hint[hidden] { display: none; }

.kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.kpis div { background: rgb(0 0 0 / 22%); border-radius: 10px; padding: 9px 10px; }
.kpis b { display: block; font-size: 21px; color: #fff; font-variant-numeric: tabular-nums; line-height: 1.2; }
.kpis span { display: block; font-size: 11.5px; color: var(--dim); line-height: 1.4; }
.kpis em { display: block; font-style: normal; font-size: 11px; color: var(--faint); margin-top: 2px; }
.balbar { display: flex; height: 12px; border-radius: 6px; overflow: hidden; background: rgb(0 0 0 / 25%); }
.balbar i { display: block; height: 100%; transition: width .25s; }
.balkey { list-style: none; margin: 8px 0 0; padding: 0; font-size: 12.5px; }
.balkey li { display: grid; grid-template-columns: 10px 1fr auto auto; gap: 8px; align-items: center; padding: 2px 0; }
.balkey li i { width: 10px; height: 10px; border-radius: 3px; }
.balkey li b { font-variant-numeric: tabular-nums; font-weight: 600; }
.balkey li em { font-style: normal; color: var(--faint); font-variant-numeric: tabular-nums; min-width: 36px; text-align: end; }
.note { margin: 8px 0 0; font-size: 12px; color: var(--faint); }
#place { width: 100%; background: var(--night-2); border: 1px solid var(--glass-line); border-radius: 8px; padding: 6px 8px; font-size: 13px; }
#probe { width: 100%; height: auto; margin-top: 6px; }
#probe text { font-size: 10px; fill: var(--faint); font-family: var(--font); }
.about summary { font-weight: 700; font-size: 14.5px; cursor: pointer; }
.about div { font-size: 13px; color: var(--dim); }
.about p { margin: 8px 0; }
.about b { color: var(--text); }
.about a { color: var(--water); }

/* inside the atlas window: room for the atlas close button */
.embedded .side { top: 64px; }

@media (max-width: 1180px) {
  .mapctl { inset-inline-start: 16px; top: auto; bottom: 160px; justify-content: flex-start; inset-inline-end: calc(var(--side-w) + 32px); }
  .legend { bottom: 214px; }
}
@media (max-width: 860px) {
  body { overflow-y: auto; }
  .fl { height: auto; }
  .stage { position: relative; height: 64vh; min-height: 420px; }
  .hero { position: absolute; top: 10px; inset-inline-start: 10px; right: auto; left: auto; max-width: calc(100% - 20px); padding: 8px 12px; }
  .hero h1 { font-size: 18px; margin: 0 0 6px; }
  .citysel { margin-bottom: 6px; }
  #pick-btn { font-size: 13px; padding-top: 3px; padding-bottom: 3px; }
  .picker { position: static; }
  .pick-pop { top: calc(100% + 6px); width: calc(100vw - 20px); max-width: none; box-sizing: border-box; }
  [dir="rtl"] .pick-pop { right: 0; left: auto; } [dir="ltr"] .pick-pop { left: 0; right: auto; }
  #pick-list { max-height: 58vh; }
  .embedded .hero { max-width: calc(100% - 70px); }
  .mapctl { top: auto; bottom: 138px; inset-inline-start: 10px; inset-inline-end: 10px; gap: 6px; }
  .pill button { padding: 4px 9px; font-size: 11.5px; }
  .pill.zoom { display: none; }
  .legend { display: none; }
  .legend2 { display: block; position: static; margin: 0 14px 12px; background: var(--night-2); border: 1px solid var(--glass-line); }
  .legend2 .danger { max-width: none; }
  .timebar { inset-inline-start: 8px; inset-inline-end: 8px; bottom: 8px; padding: 8px 10px 4px; gap: 10px; }
  .tb-play { width: 40px; height: 40px; }
  .tb-key { display: none; }
  .tb-row { flex-wrap: nowrap; gap: 6px; }
  .tb-row b { font-size: 14px; white-space: nowrap; }
  .phase { font-size: 10.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .timebar { bottom: 24px; }
  .leaflet-control-attribution { font-size: 8.5px; line-height: 1.3; }
  .side { position: relative; inset: auto; width: auto; border-radius: 0; border: 0; box-shadow: none; overflow: visible; background: var(--night); -webkit-backdrop-filter: none; backdrop-filter: none; }
  .embedded .side { top: auto; }
}
.leaflet-tooltip.ptip { background: rgb(10 18 32 / 88%); color: #fff; border: 1px solid rgb(245 185 66 / 60%); border-radius: 8px; font: 600 12.5px/1.3 inherit; padding: 3px 9px; box-shadow: 0 4px 14px rgb(0 0 0 / 40%); }
.leaflet-tooltip.ptip::before { border-top-color: rgb(245 185 66 / 60%); }
