/* =========================================================
   Living map (map.html)
   One ivory "atlas plate" (the home page's map teaser, grown up): filters with counts, the Leaflet
   map in brand tones, the synced list of trees and the map key. Logical properties only; the map
   canvas itself runs dir="ltr" (Leaflet's internals are physical), everything around it mirrors.
   ========================================================= */

:root {
  --pin-available: var(--athar-green);
  --pin-adopted: var(--athar-brown);
  --pin-zayed: var(--athar-tan);
  /* the land tone of the toned basemap (Cream + Dune, see the filter at the end of map.html) */
  --map-land: var(--athar-dune);
  /* the map frame ends inside the first screen on a laptop (1440x900), taller on taller screens */
  --map-h: clamp(460px, calc(100svh - var(--header-h) - 312px), 760px);
  --list-w: clamp(350px, 28vw, 440px);
  --float-shadow: 0 8px 24px rgba(56, 40, 20, .14);
}
@supports (color: color-mix(in srgb, red 50%, blue)) {
  :root { --map-land: color-mix(in srgb, var(--athar-cream) 45%, var(--athar-dune)); }
}

/* ---------- hero: short (no dateline), so the whole map plate fits the first screen ---------- */
/* (overflow-x only: the rings may run on behind the plate, never past the page edge) */
.map-hero { overflow: visible; overflow-x: clip; padding-block: clamp(1rem, 2vw, 1.75rem) clamp(1.5rem, 2.6vw, 2.25rem); }
/* the lead sits on the headline's last baseline */
.map-hero .hero-grid { align-items: end; align-items: last baseline; }
.map-hero .label { margin-block-end: .85rem; }
.map-hero .rule { margin-block: 1.15rem 0; }
.map-hero .lead { margin: 0; max-width: 34ch; text-wrap: pretty; }
html[lang="ar"] .map-hero .lead { max-width: 31ch; }
@media (max-width: 960px) {
  .map-hero .hero-grid { row-gap: 1.1rem; align-items: start; }
}
/* the headline's full stop is the place: fingerprint rings radiate from it, as around the area pins
   on the map (sizes in em, so they follow the headline; behind the letters) */
.hero-ping { position: relative; display: inline-block; width: 0; height: 0; pointer-events: none; }
.hero-ping i {
  --d: 2em; position: absolute; z-index: -1; width: var(--d); height: var(--d); border-radius: 50%;
  inset-block-start: calc(var(--d) / -2 - .1em); inset-inline-start: calc(var(--d) / -2 - .13em);
  border: 1px solid rgba(104, 73, 37, .3);
}
.hero-ping i:nth-child(1) { --d: .66em; border-color: rgba(63, 89, 59, .45); }
.hero-ping i:nth-child(2) { --d: 1.25em; border-color: rgba(104, 73, 37, .34); }
.hero-ping i:nth-child(3) { --d: 2.05em; border-color: rgba(104, 73, 37, .24); }
.hero-ping i:nth-child(4) { --d: 3.05em; border-color: rgba(104, 73, 37, .16); }
.hero-ping i:nth-child(5) { --d: 4.25em; border-color: rgba(104, 73, 37, .09); }
.hero-ping i.ripple { --d: 4.25em; border: 1.5px solid rgba(63, 89, 59, .5); opacity: 0; animation: map-hero-ping 5s cubic-bezier(.15, .6, .25, 1) 1s infinite; }
html[lang="ar"] .hero-ping i { inset-block-start: calc(var(--d) / -2 - .2em); inset-inline-start: calc(var(--d) / -2 - .1em); }
@keyframes map-hero-ping { 0% { opacity: 0; transform: scale(.14); } 14% { opacity: .9; } 100% { opacity: 0; transform: scale(1); } }

/* ---------- the atlas plate ---------- */
.map-section { position: relative; z-index: 1; padding-block-end: clamp(3.5rem, 7vw, 6rem); }
.atlas {
  display: grid; grid-template-columns: minmax(0, 1fr) var(--list-w);
  grid-template-areas: "filters count" "map list" "foot foot";
  column-gap: clamp(.75rem, 1.2vw, 1rem); row-gap: .75rem;
  padding: clamp(.75rem, 1.1vw, 1rem); border-radius: 32px; background: var(--athar-ivory); box-shadow: var(--shadow-card);
}
.atlas > * { min-width: 0; }
/* one kind of tree on the map: no filter row and no count, the map and the list start at the top */
.atlas.no-filters { grid-template-areas: "map list" "foot foot"; }
.map-filters[hidden], .map-list-count[hidden], .map-filters .chip[hidden], .chips-sep[hidden],
.map-key li[hidden], .map-sample[hidden], .jump[hidden] { display: none; }
.map-filters { grid-area: filters; align-items: center; }
/* the count lines up with the first row of chips, also when the tribute chip wraps to a second row */
.map-list-count { grid-area: count; align-self: start; min-height: 47px; display: flex; align-items: center; padding-inline: 1rem; }
.map-frame { grid-area: map; }
.map-list { grid-area: list; }
.atlas-foot { grid-area: foot; }

/* filters: the chips carry the counts; the tribute stands a little apart from the two statuses */
.map-filters .chip { gap: .5rem; padding-inline: 1rem .45rem; transition: border-color .2s, background-color .2s, color .2s; }
.map-filters .chip:not(:has(.dot)) { padding-inline-start: 1.15rem; }
.map-filters .chip .count {
  min-width: 1.9rem; height: 1.9rem; padding-inline: .45rem; border-radius: var(--radius-pill);
  display: inline-grid; place-items: center; background: var(--athar-sand); color: var(--athar-brown);
  font-family: var(--font-num); font-weight: 700; font-size: .875rem; line-height: 1;
}
.map-filters .chip[aria-pressed="true"] .count { background: rgba(252, 248, 239, .2); color: var(--athar-cream); }
.map-filters .chip[aria-pressed="true"] .dot { box-shadow: 0 0 0 2px var(--athar-cream); }
.map-filters .chip:hover { border-color: var(--athar-brown); }
.map-filters .chip:focus-visible { outline: 3px solid var(--athar-green); outline-offset: 2px; }
.map-filters .chip-tribute:not([aria-pressed="true"]) { border-color: rgba(200, 176, 138, .75); }
.chips-sep { align-self: stretch; width: 1px; margin-block: .55rem; margin-inline: .35rem; background: var(--line); }
/* the filters are a size container: once the row is too narrow for all four chips, the tribute wraps
   to its own line and the divider goes */
.map-filters { container-type: inline-size; }
@container (max-width: 720px) { .chips-sep { display: none; } }
html[lang="ar"] .map-filters .chip { font-size: 1.0625rem; }

.map-list-count { font-weight: 700; color: var(--athar-brown); font-size: .9375rem; }
.map-list-count b { font-family: var(--font-num); font-size: 1.25rem; color: var(--athar-green); margin-inline-end: .15rem; }
html[lang="ar"] .map-list-count { font-size: 1rem; }

/* colour dots shared by chips, cards, popups and the key */
.dot { width: 12px; height: 12px; border-radius: 50%; flex: none; display: inline-block; background: var(--pin-available); box-shadow: 0 0 0 2px var(--athar-ivory); }
.dot.available { background: var(--pin-available); }
.dot.adopted { background: var(--pin-adopted); }
/* the tribute: a small medallion, Tan with a Brown heart */
.dot.zayed { background: radial-gradient(circle, var(--athar-brown) 0 2px, var(--pin-zayed) 2.5px); }

/* ---------- the map frame ---------- */
.map-frame {
  position: relative; height: var(--map-h); border-radius: 22px; overflow: hidden; isolation: isolate;
  background: var(--map-land);
}
/* a hairline inside the frame edge, over the tiles */
.map-frame::after { content: ""; position: absolute; inset: 0; z-index: 3; border-radius: inherit; box-shadow: inset 0 0 0 1px rgba(104, 73, 37, .12); pointer-events: none; }
.map-canvas { position: absolute; inset: 0; z-index: 0; font-family: var(--font-latin); --map-mask: var(--athar-ivory); }
/* the UAE-only mask (map.js) lives in its own pane: free it from the base svg { max-width: 100% } rule, as Leaflet does for its overlay pane */
.map-canvas .leaflet-uae-mask-pane svg { max-width: none !important; max-height: none !important; }
html[lang="ar"] .map-canvas { font-family: var(--font-arabic); }
/* under the tiles (and wherever they fail): the quiet dot grid of the home page's map teaser */
.map-canvas.leaflet-container, .map-state {
  background: radial-gradient(circle, rgba(104, 73, 37, .2) 1.1px, transparent 1.6px) 0 0 / 18px 18px, var(--map-land);
}

/* the compass: a north needle in the top corner opposite the zoom buttons */
.map-north {
  position: absolute; z-index: 2; inset-block-start: 1rem; inset-inline-end: 1rem;
  width: 44px; height: 44px; border-radius: 50%; display: grid; justify-items: center; align-content: center; gap: 2px;
  background: rgba(254, 253, 249, .94); box-shadow: var(--float-shadow); color: var(--athar-brown);
  font: 800 .6875rem/1 var(--font-latin); letter-spacing: .08em; pointer-events: none;
}
.map-north::before { content: ""; position: absolute; inset: 4px; border-radius: 50%; border: 1px solid rgba(104, 73, 37, .22); }
.map-north .needle { width: 8px; height: 11px; background: var(--athar-brown); clip-path: polygon(50% 0, 100% 100%, 50% 78%, 0 100%); }
.map-north [data-lang="ar"] { font-family: var(--font-arabic); font-size: .8125rem; font-weight: 700; letter-spacing: 0; line-height: .9; }

/* ---------- the list ---------- */
.map-list { height: var(--map-h); display: flex; flex-direction: column; min-height: 0; }
.tlist { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding-block: 0 .75rem; padding-inline: 0 .25rem; display: grid; gap: .35rem; align-content: start; scrollbar-width: thin; scrollbar-color: var(--athar-tan) transparent; }
/* desktop: the list fades out at the bottom, so it reads as "more below", not as cut off */
@media (min-width: 1001px) {
  .tlist {
    -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
    mask-image: linear-gradient(to bottom, #000 calc(100% - 56px), transparent);
    padding-block-end: 56px;
  }
}

/* tree cards: photo · kicker · place · ID and facts · open */
.tcard {
  position: relative; display: grid; grid-template-columns: 76px minmax(0, 1fr) auto; grid-template-areas: "img body open";
  gap: 1rem; align-items: center; padding: .6rem; padding-inline-end: .75rem; border-radius: 20px; background: transparent;
  transition: background-color .2s, box-shadow .2s;
}
.tcard:hover, .tcard.is-hover { background: var(--athar-cream); }
.tcard.is-active { background: var(--athar-cream); box-shadow: inset 0 0 0 2px var(--athar-green); }
.tcard-hit { position: absolute; inset: 0; z-index: 1; border: 0; background: transparent; border-radius: inherit; cursor: pointer; padding: 0; }
.tcard-hit:focus-visible { outline: 3px solid var(--athar-green); outline-offset: -3px; }
/* (crops keep the upper part: the canopy, or the ATHAR mark on a tag photo) */
.tcard-img { grid-area: img; width: 76px; height: 76px; border-radius: 16px; object-fit: cover; object-position: 50% 22%; background: var(--athar-sand); }
.tcard-body { grid-area: body; min-width: 0; display: grid; gap: .15rem; }
.tcard-kicker { display: flex; align-items: center; gap: .45rem; font-size: .75rem; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; color: var(--athar-brown); line-height: 1.35; }
html[lang="ar"] .tcard-kicker { letter-spacing: 0; text-transform: none; font-size: .875rem; }
.tcard-kicker .dot { width: 10px; height: 10px; box-shadow: none; }
.tcard-kicker .dot.zayed { background: radial-gradient(circle, var(--athar-brown) 0 1.5px, var(--pin-zayed) 2px); }
.tcard-title { font-weight: 800; font-size: 1.0625rem; line-height: 1.25; color: var(--athar-green); }
html[lang="ar"] .tcard-title { font-family: var(--font-arabic-display); font-weight: 700; font-size: 1.125rem; line-height: 1.45; }
.tcard-meta { display: flex; flex-wrap: wrap; align-items: center; gap: .1rem .6rem; font-size: .8125rem; color: var(--muted); }
html[lang="ar"] .tcard-meta { font-size: .9375rem; }
.tcard-meta .tree-id { font-size: .8125rem; }
.tcard-meta .warn { color: var(--warn); font-weight: 700; display: inline-flex; align-items: center; gap: .2rem; }
.tcard-meta .warn .ms { font-size: 1rem; }
.tcard-open {
  grid-area: open; position: relative; z-index: 2; width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  border: 1.5px solid var(--line); color: var(--athar-brown); text-decoration: none; background: var(--athar-ivory);
  transition: background-color .2s, color .2s, border-color .2s;
}
.tcard-open:hover, .tcard-open:focus-visible { background: var(--athar-green); border-color: var(--athar-green); color: var(--athar-cream); }
.tcard-open .ms { font-size: 1.25rem; }

/* one tree in view: a feature card the height of the map (photo, place, ID and facts, its page) */
.tlist.is-single { display: block; overflow: visible; padding: 0; -webkit-mask-image: none; mask-image: none; }
.tfeature-item { height: 100%; }
.tcard.tfeature {
  height: 100%; display: flex; flex-direction: column; gap: 0; padding: 0; overflow: hidden;
  border-radius: 22px; background: var(--athar-cream); box-shadow: none;
}
/* the edge ring sits over the photo too (an overlay), so the hover and selected states frame the whole card */
.tcard.tfeature::after { content: ""; position: absolute; inset: 0; z-index: 1; border-radius: inherit; pointer-events: none; box-shadow: inset 0 0 0 1px rgba(104, 73, 37, .1); transition: box-shadow .2s; }
.tcard.tfeature:hover, .tcard.tfeature.is-hover, .tcard.tfeature.is-active { background: var(--athar-cream); box-shadow: none; }
.tcard.tfeature:hover::after, .tcard.tfeature.is-hover::after { box-shadow: inset 0 0 0 1.5px var(--athar-tan); }
.tcard.tfeature.is-active::after { box-shadow: inset 0 0 0 2px var(--athar-green); }
.tfeature-img { flex: 1 1 0; min-height: 150px; width: 100%; object-fit: cover; object-position: 50% 24%; background: var(--athar-sand); display: block; }
.tfeature-body { flex: none; display: grid; gap: .3rem; padding: 1.15rem 1.35rem 1.35rem; }
.tfeature-title { font-weight: 800; font-size: 1.5rem; line-height: 1.2; color: var(--athar-green); }
html[lang="ar"] .tfeature-title { font-family: var(--font-arabic-display); font-weight: 700; font-size: 1.5rem; line-height: 1.45; }
.tfeature-story { margin-block-start: .35rem; font-size: .9375rem; line-height: 1.5; color: var(--athar-ink); text-wrap: pretty;
  display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 3; line-clamp: 3; overflow: hidden; }
html[lang="ar"] .tfeature-story { font-size: 1rem; line-height: 1.75; }
.tfeature-honour { margin-block-start: .35rem; padding-block-start: .5rem; border-block-start: 1px solid var(--line); font-size: .9375rem; font-weight: 600; color: var(--athar-brown); }
.tfeature-actions { display: flex; flex-wrap: wrap; align-items: center; gap: .5rem 1.25rem; margin-block-start: .85rem; }
.tfeature-actions .btn { min-height: 44px; }
.tfeature-actions .btn .ms { font-size: 1.15em; }
.tfeature-locate { display: inline-flex; align-items: center; gap: .35rem; font-weight: 700; font-size: .9375rem; color: var(--athar-brown); }
.tfeature-locate .ms { font-size: 1.2rem; }
.tfeature-locate:hover { color: var(--athar-green); }
.tfeature-locate:focus-visible { outline: 3px solid var(--athar-green); outline-offset: 3px; border-radius: 6px; }

/* list loading skeleton and empty state */
.tlist-loading { display: grid; gap: .5rem; }
.tlist-loading span { height: 96px; border-radius: 20px; background: linear-gradient(90deg, var(--athar-dune), var(--athar-cream), var(--athar-dune)); background-size: 200% 100%; animation: map-shimmer 1.4s linear infinite; }
@keyframes map-shimmer { to { background-position: -200% 0; } }
.tlist-empty { display: grid; justify-items: center; text-align: center; gap: .75rem; padding: 2.5rem 1.25rem; color: var(--muted); }
.tlist-empty .h4 { color: var(--athar-green); }

/* ---------- the key: what each pin means, then the "sample trees" caption ---------- */
.atlas-foot {
  display: grid; grid-template-columns: minmax(0, 3fr) minmax(0, 1.15fr); gap: 1rem clamp(1.5rem, 3vw, 3rem); align-items: start;
  margin-block-start: .25rem; padding: 1.1rem 1rem .6rem; border-block-start: 1px solid var(--line);
}
.map-key { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); }
.map-key li { display: flex; align-items: flex-start; gap: .65rem; padding-inline: 1.25rem; font-size: .9375rem; line-height: 1.45; color: var(--muted); text-wrap: pretty; }
/* one kind of tree: its key line on its own; the first line shown never carries a divider */
.map-key.is-one { display: block; }
.map-key li:nth-child(1 of :not([hidden])) { padding-inline-start: 0; border-inline-start: 0; }
.map-key li:first-child { padding-inline-start: 0; }
.map-key li + li { border-inline-start: 1px solid var(--line); }
.map-key .dot { margin-block-start: .3rem; box-shadow: none; }
.map-key b { display: block; color: var(--athar-green); font-weight: 800; font-size: 1rem; margin-block-end: .1rem; }
html[lang="ar"] .map-key li { font-size: 1rem; line-height: 1.7; }
html[lang="ar"] .map-key .dot { margin-block-start: .5rem; }
html[lang="ar"] .map-key b { font-family: var(--font-arabic-display); font-weight: 700; font-size: 1.0625rem; }
.map-notes { display: grid; gap: .6rem; }
.map-promise, .map-sample { display: flex; align-items: flex-start; gap: .5rem; font-size: .8125rem; line-height: 1.5; color: var(--muted); text-wrap: pretty; }
.map-promise { font-size: .875rem; color: var(--athar-green); font-weight: 600; }
.map-promise .ms, .map-sample .ms { font-size: 1.15rem; color: var(--athar-brown); flex: none; }
html[lang="ar"] .map-promise, html[lang="ar"] .map-sample { font-size: .9375rem; line-height: 1.7; }

/* ---------- map overlays: loading / error, tiles note, touch hint, jump-to ---------- */
.map-state {
  position: absolute; inset: 0; z-index: 5; display: grid; place-content: center; justify-items: center; gap: 1.25rem;
  text-align: center; padding: 2rem; color: var(--athar-brown); font-weight: 700;
  transition: opacity .5s var(--ease), visibility .5s;
}
.map-state[hidden] { display: none; }
.map-state.is-done { opacity: 0; visibility: hidden; pointer-events: none; }
/* loading: the mark, with fingerprint rings rippling out from it */
.map-state-art { position: relative; width: 150px; height: 150px; display: grid; place-items: center; }
.map-state-art i { position: absolute; inset: 0; border-radius: 50%; border: 1.5px solid rgba(104, 73, 37, .45); opacity: 0; animation: map-ripple 3.6s cubic-bezier(.15, .6, .25, 1) infinite; }
.map-state-art i:nth-child(2) { animation-delay: 1.2s; }
.map-state-art i:nth-child(3) { animation-delay: 2.4s; }
@keyframes map-ripple { 0% { opacity: 0; transform: scale(.3); } 18% { opacity: .85; } 100% { opacity: 0; transform: scale(1.2); } }
.map-state-mark { position: relative; width: 52px; height: auto; }
/* error: one calm ivory card on the dot grid */
.map-state.is-error { font-weight: 400; }
.map-state-card {
  display: grid; justify-items: center; gap: .6rem; max-width: 360px; padding: clamp(1.5rem, 3vw, 2rem);
  background: var(--athar-ivory); border-radius: var(--radius-card); box-shadow: 0 18px 44px rgba(28, 22, 14, .12);
}
.map-state-card .h4 { margin-block-start: .35rem; }
.map-state-card p { text-wrap: balance; }
.map-state-card .btn { margin-block-start: .5rem; min-height: 44px; }

/* soft notice when only the tiles fail (pins and list keep working on the dot grid) */
.map-note {
  position: absolute; z-index: 4; inset-block-start: 1rem; inset-inline: 4.5rem; margin-inline: auto; max-width: 440px; width: fit-content;
  display: flex; align-items: center; gap: .6rem; padding: .65rem 1.1rem; border-radius: 18px;
  background: rgba(254, 253, 249, .96); box-shadow: var(--float-shadow);
  font-size: .875rem; font-weight: 600; line-height: 1.4; color: var(--athar-brown);
}
html[lang="ar"] .map-note { font-size: .9375rem; }
.map-note[hidden] { display: none; }
.map-note .ms { font-size: 1.25rem; flex: none; }
/* phones: one finger scrolls the page, two fingers move the map */
.map-hint {
  position: absolute; z-index: 4; inset: 0; display: flex; align-items: center; justify-content: center; gap: .5rem;
  padding: 2rem; background: rgba(28, 22, 14, .42); color: var(--athar-cream); font-weight: 700; font-size: 1.0625rem; text-align: center;
  opacity: 0; visibility: hidden; pointer-events: none; transition: opacity .3s, visibility .3s;
}
.map-hint.show { opacity: 1; visibility: visible; }

/* go to a place: laid over the bottom of the map (same grid area); a row of pills under it on phones */
.map-jump {
  grid-area: map; align-self: end; justify-self: start; position: relative; z-index: 4;
  margin-block-end: 1.75rem; margin-inline-start: 1rem; max-width: calc(100% - 2rem);
  display: flex; gap: .25rem; padding: .3rem; border-radius: var(--radius-pill);
  background: rgba(254, 253, 249, .95); box-shadow: var(--float-shadow);
  overflow-x: auto; scrollbar-width: none;
}
.map-jump::-webkit-scrollbar { display: none; }
.map-jump[hidden] { display: none; }
.jump {
  flex: none; display: inline-flex; align-items: center; gap: .35rem; min-height: 40px; padding: .35rem .9rem;
  border-radius: var(--radius-pill); border: 0; background: transparent; color: var(--athar-brown);
  font-weight: 700; font-size: .875rem; cursor: pointer; white-space: nowrap; transition: background-color .2s, color .2s;
}
html[lang="ar"] .jump { font-size: .9375rem; }
.jump .ms { font-size: 1.15rem; }
.jump:hover { background: var(--athar-dune); }
.jump:focus-visible { outline: 3px solid var(--athar-green); outline-offset: -3px; }
.jump[aria-pressed="true"] { background: var(--athar-green); color: var(--athar-cream); }

/* ---------- Leaflet skin ---------- */
/* the basemap in brand tones: an SVG filter (end of map.html) closes over the tiles' thin English place
   names and borders, then maps the grey luminance onto Sage (the sea), Cream+Dune (the land) and Ivory
   (the roads). On the whole pane,
   after Leaflet has blended the tiles (per tile, fractional zooms showed hairline seams); the pane
   has no size of its own, so the filter region is set in user space. */
.map-canvas .leaflet-tile-pane { filter: url(#athar-map-tone); }
/* Leaflet hides tile seams with plus-lighter blending, which leaves faint bright lines at fractional
   zooms; the tone curve would sharpen them, so the tiles overlap by a pixel instead */
.map-canvas img.leaflet-tile { mix-blend-mode: normal; width: 257px !important; height: 257px !important; }
.map-defs { position: absolute; width: 0; height: 0; overflow: hidden; pointer-events: none; }
.map-canvas .leaflet-container a, .map-canvas a { color: inherit; }
.map-canvas .leaflet-control-zoom { border: 0; border-radius: 16px; overflow: hidden; box-shadow: var(--float-shadow); margin: 1rem; }
.map-canvas .leaflet-control-zoom a {
  width: 44px; height: 44px; line-height: 44px; font-size: 1.35rem; font-weight: 400;
  background: rgba(254, 253, 249, .96); color: var(--athar-brown); border-block-end-color: var(--line);
}
.map-canvas .leaflet-control-zoom a:hover { background: var(--athar-dune); }
.map-canvas .leaflet-control-zoom a:focus-visible { outline: 3px solid var(--athar-green); outline-offset: -3px; }
.map-canvas .leaflet-control-attribution { font-size: 10px; background: rgba(252, 248, 239, .82); color: var(--muted); border-radius: 8px; margin: 0 .4rem .4rem; }
.map-canvas .leaflet-control-attribution a { color: var(--athar-brown); }

/* brand pins: ivory ring, colour by kind, a soft warm shadow */
.pin-wrap { background: none; border: 0; }
.pin {
  display: block; width: 22px; height: 22px; margin: 3px; border-radius: 50%; background: var(--pin-available);
  border: 3px solid var(--athar-ivory); box-shadow: 0 2px 8px rgba(56, 40, 20, .38);
  transition: transform .25s var(--ease), box-shadow .25s;
}
.pin.adopted { background: var(--pin-adopted); }
/* in honour of Sheikh Zayed: a medallion (Tan, Brown heart, a Tan hairline outside the ivory ring) */
.pin.zayed {
  background: radial-gradient(circle, var(--athar-brown) 0 3px, var(--pin-zayed) 3.5px);
  box-shadow: 0 0 0 1.5px var(--pin-zayed), 0 2px 8px rgba(56, 40, 20, .38);
}
.leaflet-marker-icon:hover .pin, .pin.is-hover { transform: scale(1.18); }
.pin.is-active { transform: scale(1.32); box-shadow: 0 0 0 5px rgba(63, 89, 59, .22), 0 4px 12px rgba(56, 40, 20, .4); }
.pin.adopted.is-active { box-shadow: 0 0 0 5px rgba(104, 73, 37, .22), 0 4px 12px rgba(56, 40, 20, .4); }
.pin.zayed.is-active { box-shadow: 0 0 0 1.5px var(--pin-zayed), 0 0 0 6px rgba(200, 176, 138, .4), 0 4px 12px rgba(56, 40, 20, .4); }
.leaflet-marker-icon:focus-visible { outline: none; }
.leaflet-marker-icon:focus-visible .pin { box-shadow: 0 0 0 3px var(--athar-cream), 0 0 0 6px var(--athar-green); }

/* area pins (below zoom 10): a disc with the count, two fingerprint rings around it, a name label;
   they settle in one after another when drawn */
.pin-region {
  --ring: rgba(63, 89, 59, .3);
  position: relative; width: 40px; height: 40px; margin: 2px; border-radius: 50%; display: grid; place-items: center;
  background: var(--athar-green); color: var(--athar-cream); border: 3px solid var(--athar-ivory);
  font: 700 1rem/1 var(--font-num); box-shadow: 0 4px 12px rgba(56, 40, 20, .35);
  transition: transform .25s var(--ease);
  animation: map-pin-in .7s var(--ease) both; animation-delay: calc(var(--i, 0) * .12s);
}
.pin-region::before, .pin-region::after { content: ""; position: absolute; border-radius: 50%; border: 1.5px solid var(--ring); pointer-events: none; animation: map-ring-in 1.4s var(--ease) both; animation-delay: calc(var(--i, 0) * .12s + .2s); }
.pin-region::before { inset: -10px; }
.pin-region::after { inset: -19px; opacity: .55; animation-delay: calc(var(--i, 0) * .12s + .35s); }
.pin-region.adopted { --ring: rgba(104, 73, 37, .3); background: var(--athar-brown); }
.pin-region.zayed { --ring: rgba(104, 73, 37, .32); background: var(--athar-tan); color: #4E361B; }
.pin-region b { font-weight: 700; }
@keyframes map-pin-in { from { opacity: 0; transform: scale(.4); } }
@keyframes map-ring-in { from { opacity: 0; transform: scale(.5); } }
.leaflet-marker-icon:hover .pin-region { transform: scale(1.08); }
.leaflet-marker-icon:focus-visible .pin-region { box-shadow: 0 0 0 3px var(--athar-cream), 0 0 0 6px var(--athar-green); }
.map-canvas .leaflet-tooltip.region-tip {
  padding: .3rem .7rem; border: 0; border-radius: var(--radius-pill); background: rgba(254, 253, 249, .95);
  box-shadow: 0 4px 12px rgba(56, 40, 20, .14); white-space: nowrap;
  font: 800 11.5px/1.3 var(--font-latin); letter-spacing: var(--track-caps); text-transform: uppercase; color: var(--athar-brown);
}
.map-canvas .leaflet-tooltip.region-tip::before { display: none; }
.region-tip [lang="ar"] { font-family: var(--font-arabic); font-weight: 700; letter-spacing: 0; text-transform: none; font-size: 13.5px; }

/* popup card */
.athar-popup .leaflet-popup-content-wrapper { border-radius: 22px; padding: 0; background: var(--athar-ivory); box-shadow: 0 18px 44px rgba(28, 22, 14, .22); overflow: hidden; }
.athar-popup .leaflet-popup-content { margin: 0; width: 260px !important; line-height: 1.45; font-size: 1rem; }
.athar-popup .leaflet-popup-tip { background: var(--athar-ivory); }
.pop { position: relative; font-family: var(--font-latin); color: var(--athar-ink); }
.pop:lang(ar) { font-family: var(--font-arabic); }
.pop-img { width: 100%; height: 136px; object-fit: cover; display: block; background: var(--athar-sand); }
.pop-body { padding: .9rem 1.1rem 1.1rem; display: grid; gap: .3rem; }
.pop-kicker { margin: 0 !important; display: flex; align-items: center; gap: .45rem; font-size: .75rem; font-weight: 800; letter-spacing: .1em; text-transform: uppercase; color: var(--athar-brown); }
.pop:lang(ar) .pop-kicker { letter-spacing: 0; text-transform: none; font-size: .875rem; }
.pop-kicker .dot { width: 10px; height: 10px; box-shadow: none; }
.pop-kicker .dot.zayed { background: radial-gradient(circle, var(--athar-brown) 0 1.5px, var(--pin-zayed) 2px); }
.pop-title { margin: 0 !important; font-weight: 800; font-size: 1.125rem; line-height: 1.25; color: var(--athar-green); }
.pop:lang(ar) .pop-title { font-family: var(--font-arabic-display); font-weight: 700; line-height: 1.45; }
.pop-meta { margin: 0 !important; display: flex; flex-wrap: wrap; gap: .1rem .6rem; font-size: .8125rem; color: var(--muted); }
.pop:lang(ar) .pop-meta { font-size: .9375rem; }
/* the honour line on trees that stand in honour of the late Sheikh Zayed */
.pop-honour { margin: .35rem 0 0 !important; padding-block-start: .55rem; border-block-start: 1px solid var(--line); font-size: .875rem; line-height: 1.45; color: var(--athar-brown); font-weight: 600; }
.pop:lang(ar) .pop-honour { font-size: .9375rem; line-height: 1.7; }
.pop .btn { margin-block-start: .6rem; min-height: 44px; color: var(--athar-cream); }
.pop .btn:hover { color: var(--athar-cream); }
.pop-close {
  position: absolute; inset-block-start: .5rem; inset-inline-end: .5rem; z-index: 1; width: 36px; height: 36px; border-radius: 50%;
  display: grid; place-items: center; border: 0; background: rgba(254, 253, 249, .92); color: var(--athar-brown); cursor: pointer;
  box-shadow: 0 2px 8px rgba(28, 22, 14, .2);
}
.pop-close::before { content: ""; position: absolute; inset: -4px; }
.pop-close .ms { font-size: 1.2rem; }

/* ---------- closing band: find a tree by its ID, right here ---------- */
.map-closing .id-form { margin: 2rem auto 0; width: min(100%, 460px); justify-items: center; }
.map-closing .id-form > label { color: var(--athar-sand); }
.map-closing .id-form .row { width: 100%; border-color: transparent; box-shadow: 0 14px 36px rgba(20, 30, 18, .28); }
.map-closing .id-form .row .btn .ms { font-size: 1.15em; }
.map-closing .id-form .error { display: inline-flex; align-items: center; gap: .4rem; color: var(--athar-cream); font-size: .875rem; }
.map-closing .id-form .error[hidden] { display: none; }
.map-closing .id-form .error .ms { color: var(--athar-sand); font-size: 1.15rem; }
.map-closing-paths { margin-block-start: 1.75rem; color: var(--athar-sand); font-size: 1rem; }
.map-closing-paths a { color: var(--athar-cream); font-weight: 700; text-underline-offset: 4px; text-decoration-color: rgba(252, 248, 239, .5); display: inline-block; padding-block: .6rem; }
.map-closing-paths a:hover { text-decoration-color: currentColor; }
.map-closing-paths .or { margin-inline: .15rem; }
html[lang="ar"] .map-closing-paths { font-size: 1.0625rem; }

/* ---------- tablets and phones: the plate opens up; map, then a rail of postcards ---------- */
@media (max-width: 1000px) {
  .atlas {
    grid-template-columns: minmax(0, 1fr); grid-template-areas: "filters" "map" "count" "list" "foot";
    padding: 0; background: none; box-shadow: none; border-radius: 0; row-gap: 1rem;
  }
  .atlas.no-filters { grid-template-areas: "map" "list" "foot"; }
  .map-frame { height: clamp(380px, 58svh, 560px); border-radius: 24px; box-shadow: var(--shadow-card); }
  .map-list-count { padding-inline: 0; margin-block-start: .5rem; min-height: 0; }
  .map-list { height: auto; margin-inline: calc(var(--margin) * -1); }
  .tlist {
    display: grid; grid-auto-flow: column; grid-auto-columns: min(46%, 330px); align-content: stretch; gap: .9rem;
    overflow-x: auto; overflow-y: hidden; scroll-snap-type: x mandatory; scrollbar-width: none;
    padding: .25rem var(--margin) 1.25rem; scroll-padding-inline: var(--margin);
  }
  .tlist::-webkit-scrollbar { display: none; }
  .tlist:has(.tlist-empty) { grid-auto-columns: calc(100% - 2 * var(--margin)); }
  /* one tree: the feature card across the width, photo beside the words */
  .tlist.is-single { display: block; overflow: visible; padding: .25rem var(--margin) 1.25rem; }
  .tcard.tfeature, .tcard.tfeature:hover, .tcard.tfeature.is-hover, .tcard.tfeature.is-active { flex-direction: row; height: auto; border-radius: 24px; background: var(--athar-ivory); box-shadow: var(--shadow-card); }
  .tcard.tfeature::after { box-shadow: none; }
  .tfeature-img { flex: 0 0 42%; width: 42%; min-height: 0; height: auto; aspect-ratio: 4 / 3; align-self: stretch; }
  .tfeature-body { flex: 1 1 0; min-width: 0; align-content: center; padding: 1.25rem 1.5rem; }
  .tlist-loading { grid-auto-flow: column; grid-auto-columns: min(46%, 330px); }
  .tlist-loading span { height: 300px; }
  /* postcard: the photo on top, then the words, the open button at the end */
  .tcard {
    scroll-snap-align: start; grid-template-columns: minmax(0, 1fr) auto; grid-template-areas: "img img" "body open";
    align-items: end; gap: .85rem .75rem; height: 100%; padding: .5rem .5rem 1rem; padding-inline-start: .5rem;
    background: var(--athar-ivory); box-shadow: var(--shadow-card); border-radius: 24px;
  }
  .tcard:hover, .tcard.is-hover { background: var(--athar-ivory); box-shadow: var(--shadow-card), inset 0 0 0 1.5px var(--athar-tan); }
  .tcard.is-active { background: var(--athar-ivory); box-shadow: var(--shadow-card), inset 0 0 0 2px var(--athar-green); }
  .tcard-img { width: 100%; height: auto; aspect-ratio: 16 / 10; border-radius: 18px; }
  .tcard-body { padding-inline-start: .5rem; align-self: start; }
  .tcard-open { margin-block-end: .1rem; }
  .atlas-foot { grid-template-columns: minmax(0, 1fr); padding: 1.5rem 0 0; margin: 0; }
  .map-key { grid-template-columns: minmax(0, 1fr); gap: 1rem; }
  .map-key li, .map-key li:first-child { padding-inline: 0; }
  .map-key li + li { border-inline-start: 0; }
}
@media (min-width: 621px) and (max-width: 1000px) {
  .map-key { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; }
  .map-key li { padding-inline: 1rem; }
  .map-key li:first-child { padding-inline-start: 0; }
  .map-key li + li { border-inline-start: 1px solid var(--line); }
}
/* the jump bar fades at its end only while it runs past the edge (map.js sets .is-overflow) */
.map-jump.is-overflow {
  -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to right, #000 calc(100% - 2.5rem), transparent);
}
html[dir="rtl"] .map-jump.is-overflow {
  -webkit-mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent);
  mask-image: linear-gradient(to left, #000 calc(100% - 2.5rem), transparent);
}
@media (max-width: 620px) {
  .map-frame { border-radius: 22px; }
  /* the three filters on one row, the tribute on its own row below */
  .chips-sep { display: none; }
  .map-filters { gap: .5rem .375rem; }
  .map-filters .chip { gap: .4rem; padding-inline: .8rem .35rem; font-size: .9375rem; }
  .map-filters .chip:not(:has(.dot)) { padding-inline-start: .9rem; }
  .map-filters .chip .count { min-width: 1.7rem; height: 1.7rem; padding-inline: .35rem; font-size: .8125rem; }
  .map-filters .dot { width: 10px; height: 10px; }
  html[lang="ar"] .map-filters .chip { font-size: 1rem; }
  .tlist, .tlist-loading { grid-auto-columns: min(80%, 300px); }
  .atlas { grid-template-areas: "filters" "map" "jump" "count" "list" "foot"; }
  .atlas.no-filters { grid-template-areas: "map" "jump" "list" "foot"; }
  .atlas.no-jumps { grid-template-areas: "filters" "map" "count" "list" "foot"; }
  .atlas.no-filters.no-jumps { grid-template-areas: "map" "list" "foot"; }
  /* the feature card: a tall postcard */
  .tcard.tfeature, .tcard.tfeature:hover, .tcard.tfeature.is-hover, .tcard.tfeature.is-active { flex-direction: column; }
  .tfeature-img { flex: none; width: 100%; aspect-ratio: 16 / 10; }
  .tfeature-body { padding: 1rem 1.15rem 1.2rem; }
  .tfeature-title { font-size: 1.3125rem; }
  html[lang="ar"] .tfeature-title { font-size: 1.375rem; }
  .map-jump {
    grid-area: jump; align-self: auto; justify-self: stretch; max-width: none; margin: -.25rem calc(var(--margin) * -1) 0;
    padding: .1rem var(--margin); gap: .4rem; border-radius: 0; background: none; box-shadow: none;
  }
  .jump { min-height: 44px; padding-inline: 1rem; border: 1.5px solid var(--line); background: var(--athar-ivory); }
  .jump:hover { background: var(--athar-ivory); border-color: var(--athar-brown); }
  .jump[aria-pressed="true"] { border-color: var(--athar-green); }
  .map-north { inset-block-start: .75rem; inset-inline-end: .75rem; }
  .map-canvas .leaflet-control-zoom { margin: .75rem; }
  .map-note { inset-block: auto 1.75rem; inset-inline: .75rem; }
  .map-canvas .leaflet-tooltip.region-tip { padding: .25rem .55rem; font-size: 10.5px; letter-spacing: .1em; }
  .region-tip [lang="ar"] { font-size: 12.5px; }
  /* the popup drops its photo on phones (the postcard under the map shows it): it stays clear of the edges */
  .athar-popup .leaflet-popup-content { width: 284px !important; }
  .pop-img { display: none; }
  .pop-body { padding-block-start: 1.05rem; }
  .pop-kicker, .pop-title { padding-inline-end: 2.4rem; }
  .pop-kicker { letter-spacing: .06em; }
}

@media (prefers-reduced-motion: reduce) {
  .tlist-loading span, .pin-region, .pin-region::before, .pin-region::after { animation: none; }
  .hero-ping i.ripple { display: none; }
  .map-state-art i { animation: none; opacity: .5; }
  .map-state-art i:nth-child(1) { transform: scale(.55); }
  .map-state-art i:nth-child(2) { transform: scale(.8); opacity: .35; }
  .map-state-art i:nth-child(3) { transform: scale(1.05); opacity: .2; }
}
