/* «/map/» only. Full-screen map under the header + tabs; the controls float over it (a side panel on a
   computer, a bottom sheet on a phone). Theme tokens come from /styles.css (day · night · sun). */
body[data-page="map"], body[data-page="map2025"] { display: flex; flex-direction: column; block-size: 100dvh; overflow: hidden; }
body[data-page="map"] #main, body[data-page="map2025"] #main { flex: 1 1 auto; min-block-size: 0; position: relative; }
body[data-page="map"] #foot, body[data-page="map2025"] #foot { display: none; }
body[data-page="map"] .banners, body[data-page="map2025"] .banners { flex: none; padding-block-end: 8px; }

.mp { position: absolute; inset: 0; }
.mp-map { position: absolute; inset: 0; background: #2a2620; }
.mp-map .leaflet-control-attribution { font-size: 10px; }
.cells-canvas { pointer-events: none; }

.mp-panel {
  position: absolute; z-index: 800; inset-block-start: 12px; inset-inline-start: 12px;
  inline-size: 360px; max-block-size: calc(100% - 24px); overflow-y: auto; overscroll-behavior: contain;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  padding: 10px 12px 12px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 6px 24px rgb(0 0 0 / 0.28);
}
[data-theme="sun"] .mp-panel { border-width: 2px; border-radius: 4px; box-shadow: none; }
@media (max-width: 759px) {
  .mp-panel {
    inset-block-start: auto; inset-block-end: 0; inset-inline: 0; inline-size: auto;
    max-block-size: 46%; border-radius: 12px 12px 0 0; padding-block-end: calc(12px + env(safe-area-inset-bottom));
  }
}

.mp-h1 { margin: 0; font-size: 16px; font-weight: 700; }
.mp-h1 small { display: block; font-size: 11px; font-weight: 400; color: var(--muted); margin-block-start: 2px; }
.mp-h2 { margin: 0; font-size: 13.5px; font-weight: 700; }
.mp-h3 { margin: 0 0 4px; font-size: 12px; font-weight: 700; color: var(--muted); }
.mp-note { margin: 0; font-size: 11px; color: var(--muted); line-height: 1.45; }
.mp-trust { margin: 0; font-size: 11.5px; font-weight: 600; border-inline-start: 3px solid var(--pick); padding-inline-start: 7px; }
.mp-capture { margin: 0; font-size: 12px; font-weight: 600; }
.mp-na { margin: 0; font-size: 12px; font-weight: 700; color: var(--alert); display: flex; flex-direction: column; gap: 2px; }
.mp-na small { font-weight: 400; color: var(--muted); font-size: 11px; }
.mp-err { margin: 0; color: var(--alert); font-weight: 700; }

.mp-box { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 6px; min-inline-size: 0; }
.mp-box > legend { padding: 0; font-size: 12px; font-weight: 700; color: var(--muted); margin-block-end: 4px; }
.mp-detail, .mp-tap { border-block-start: 1px solid var(--line); padding-block-start: 10px; }
.mp-row { display: flex; gap: 6px; flex-wrap: wrap; }
.mp-opt {
  display: inline-flex; align-items: center; gap: 6px; min-block-size: 32px; padding: 0 10px; border-radius: 999px;
  border: 1px solid var(--line); font-size: 12px; font-weight: 600; cursor: pointer; background: var(--bg);
}
.mp-opt input { margin: 0; accent-color: var(--ink); }
.mp-opt:has(input:checked) { border-color: var(--ink); }

.mp-switches { display: grid; grid-template-columns: 1fr 1fr; gap: 6px; }
.mp-sw {
  display: flex; align-items: center; gap: 8px; min-block-size: 40px; padding: 6px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); font-size: 12px; font-weight: 600; text-align: start; cursor: pointer;
}
.mp-sw__dot { inline-size: 14px; block-size: 14px; border-radius: 50%; border: 2px solid var(--muted); flex: none; }
.mp-sw.is-on { border-color: var(--ink); background: var(--soft); }
.mp-sw.is-on .mp-sw__dot { border-color: var(--ink); background: var(--ink); box-shadow: inset 0 0 0 2px var(--bg); }
[data-theme="sun"] .mp-sw, [data-theme="sun"] .mp-opt { border-width: 2px; }

.mp-range { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.mp-field { display: flex; flex-direction: column; gap: 3px; font-size: 11px; color: var(--muted); font-weight: 600; }
.mp-field select {
  font: inherit; font-size: 12.5px; color: var(--ink); background: var(--bg); border: 1px solid var(--line);
  border-radius: 6px; min-block-size: 34px; padding: 0 6px; font-variant-numeric: tabular-nums;
}
.mp-windows { margin: 0; padding: 0; list-style: none; font-size: 10.5px; color: var(--muted); display: flex; flex-direction: column; gap: 2px; }
.mp-srcs { margin: 0; padding: 0; border: 0; display: flex; flex-direction: column; gap: 4px; }
.mp-srcs > legend { font-size: 12px; font-weight: 700; color: var(--muted); padding: 0; margin-block-end: 2px; }
.mp-srcgrp { display: flex; flex-wrap: wrap; gap: 4px 6px; align-items: center; }
.mp-srcgrp__t { font-size: 10.5px; color: var(--muted); font-weight: 700; inline-size: 100%; }
.mp-chk {
  display: inline-flex; align-items: center; gap: 5px; min-block-size: 30px; padding: 0 8px; border-radius: 6px;
  border: 1px solid var(--line); font-size: 11.5px; font-weight: 600; cursor: pointer; background: var(--bg);
}
.mp-chk input { margin: 0; accent-color: var(--ink); }

.mp-legend { display: flex; flex-direction: column; gap: 2px; }
.mp-keys { margin: 0; padding: 0; list-style: none; display: grid; grid-template-columns: 1fr 1fr; gap: 3px 10px; font-size: 11px; }
.mp-keys li { display: flex; align-items: center; gap: 6px; min-inline-size: 0; }
.mp-keys--styles { margin-block-start: 6px; }
.mp-swatch { inline-size: 18px; block-size: 12px; border-radius: 2px; flex: none; outline: 1px solid var(--ink); outline-offset: -1px; }
.mp-swatch--none { background: transparent; outline: 1px dashed var(--muted); }
.mp-st--solid { background: #2f78c4; }
.mp-st--hatch { background: repeating-linear-gradient(135deg, #2f78c4 0 2px, rgb(47 120 196 / 0.35) 2px 5px); }
.mp-st--dots { background: radial-gradient(circle, #111 1px, transparent 1.3px) 0 0 / 4px 4px, #7fb2e6; }

.mp-rule { margin: 0; font-size: 12px; }
.mp-value { margin: 0; font-size: 17px; font-weight: 700; display: flex; flex-direction: column; }
.mp-value small { font-size: 11px; font-weight: 600; color: var(--pick); }
.mp-tblwrap { overflow-x: auto; }
.mp-tbl { inline-size: 100%; border-collapse: collapse; font-size: 11px; }
.mp-tbl th, .mp-tbl td { text-align: start; padding: 4px 4px; border-block-end: 1px solid var(--line); vertical-align: top; }
.mp-tbl thead th { font-size: 10.5px; color: var(--muted); }
.mp-tbl tbody th { font-weight: 600; }
.mp-tbl tr.is-driving { background: var(--soft); }
.mp-tbl tr.mp-conflict td, .mp-tbl tr.mp-conflict th { color: var(--alert); font-size: 10.5px; }
.mp-badge { display: inline-block; margin-inline-start: 4px; font-size: 9.5px; font-weight: 700; padding: 0 4px; border-radius: 3px; background: var(--ink); color: var(--bg); }

/* Each line takes its direction from its own first letter, so an English fallback string (before the
   Arabic arrives) does not come out scrambled inside the RTL page. */
.mp-panel :is(p, li, h1, h2, h3, th, td, legend, label > span, small) { unicode-bidi: plaintext; }
.mp-zoomin { margin: 0; font-size: 12px; font-weight: 600; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }

/* «/map2025/»: five sources; the change view (the first) spans the row. The precomputed MODIS images keep their
   250 m pixels crisp when zoomed in (never smoothed into a false finer picture). */
.mp-switches--5 > .mp-sw:first-child { grid-column: 1 / -1; }
.mp-px { image-rendering: pixelated; image-rendering: crisp-edges; }
.mp-keys--one { grid-template-columns: 1fr; }
.mp-foot { border-block-start: 1px solid var(--line); padding-block-start: 10px; }
body[data-page="map2025"] .mp-panel bdi.num { white-space: nowrap; }   /* a date never breaks at its hyphen */

/* «/map2025/» place names (our gazetteer) above everything, readable on photo, greenness and change alike:
   dark text on a white halo whatever the theme (they sit on the map, not on the page). */
.mp-labels { position: absolute; inset-block-start: 0; inset-inline-start: 0; }
.mp-lbl { position: absolute; left: 0; top: 0; inline-size: 0; block-size: 0; }
.mp-lbl__t {
  position: absolute; left: 0; bottom: 6px; transform: translateX(-50%); white-space: nowrap;
  font-family: 'IBM Plex Sans Arabic', system-ui, sans-serif; color: #17140f; line-height: 1.2;
  text-shadow: 0 0 1px #fff, 1px 0 0 #fff, -1px 0 0 #fff, 0 1px 0 #fff, 0 -1px 0 #fff,
               1px 1px 0 #fff, -1px -1px 0 #fff, 1px -1px 0 #fff, -1px 1px 0 #fff, 0 0 4px #fff, 0 0 6px rgb(255 255 255 / 0.8);
}
.mp-lbl--t1 .mp-lbl__t { font-size: 15px; font-weight: 700; }
.mp-lbl--t2 .mp-lbl__t { font-size: 13px; font-weight: 600; }
.mp-lbl--t3 .mp-lbl__t { font-size: 12px; font-weight: 600; color: #2b2620; }
.mp-lbl__dot { position: absolute; left: -3px; top: -3px; inline-size: 6px; block-size: 6px; border-radius: 50%; background: #17140f; box-shadow: 0 0 0 1.5px #fff; }
.mp-lbl--t1 .mp-lbl__dot { left: -4px; top: -4px; inline-size: 8px; block-size: 8px; }
.mp-top .mp-row { gap: 6px; }
.mp-labels--backed .mp-lbl__t { background: rgb(255 255 255 / 0.86); padding: 0 4px; border-radius: 4px; box-shadow: 0 1px 3px rgb(0 0 0 / 0.25); }
.mp-lbl--t4 .mp-lbl__t { font-size: 11px; font-weight: 600; color: #3a342c; }
.mp-lbl--t4 .mp-lbl__dot { left: -2px; top: -2px; inline-size: 4px; block-size: 4px; }

/* «/map/» (live): five switches — four greenness sources in two columns, accumulated rain across the row */
.mp-switches--live > .mp-sw:last-child { grid-column: 1 / -1; }
body[data-page="map"] .mp-panel bdi.num { white-space: nowrap; }

/* «/map/» grouped switches (2026-09-27): «Greenness today» · «Change» · «Rain», one active layer across all */
.mp-groups { display: flex; flex-direction: column; gap: 8px; }
.mp-group { display: flex; flex-direction: column; gap: 4px; }
.mp-group__t { margin: 0; }
.mp-switches--g > .mp-sw:last-child:nth-child(odd) { grid-column: 1 / -1; }
