/* ===================================================================
   OUTREACH MAP + GALLERY
   Design tokens
   -------------------------------------------------------------------
   bg-paper     #F7F2E7  sun-bleached field-paper background
   ink          #332F29  near-black warm ink, body text
   banyan       #2F4B3C  deep banyan green (matches relief-map pins)
   banyan-deep  #20342A  hover/active state of banyan
   clay         #C1502E  terracotta accent, sparing use
   gold         #D9A441  dusty gold, sparing use (visit-count chips)
   surface      #FFFFFF  card surfaces
   line         #E3D9C4  hairline borders on paper bg
=================================================================== */

:root {
  --bg-paper: #f7f2e7;
  --ink: #332f29;
  --ink-soft: #6b6258;
  --banyan: #2f4b3c;
  --banyan-deep: #20342a;
  --banyan-tint: #e6ece8;
  --clay: #c1502e;
  --gold: #d9a441;
  --surface: #ffffff;
  --line: #e3d9c4;
  --shadow-soft: 0 10px 30px -12px rgba(47, 75, 60, 0.25);
  --shadow-card: 0 6px 18px -8px rgba(51, 47, 41, 0.18);
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-sm: 8px;
  --font-display: "Fraunces", "Georgia", serif;
  --font-body: "Inter", -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
    scroll-behavior: auto !important;
  }
}

.outreach-section {
  background: var(--bg-paper);
  background-image:
    radial-gradient(circle at 12% 8%, rgba(217, 164, 65, 0.10), transparent 40%),
    radial-gradient(circle at 92% 85%, rgba(193, 80, 46, 0.07), transparent 45%);
  color: var(--ink);
  font-family: var(--font-body);
  padding: 4.5rem 0 5rem;
  position: relative;
}

.outreach-section * { box-sizing: border-box; }

/* ---------- Section heading ---------- */
.outreach-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--banyan);
  margin-bottom: 0.9rem;
}
.outreach-eyebrow::before {
  content: "";
  width: 26px;
  height: 2px;
  background: var(--clay);
  display: inline-block;
}

.outreach-heading {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(2rem, 3.4vw, 2.85rem);
  line-height: 1.12;
  color: var(--banyan-deep);
  margin-bottom: 0.9rem;
  letter-spacing: -0.01em;
}

.outreach-sub {
  font-size: 1.02rem;
  color: var(--ink-soft);
  max-width: 620px;
  line-height: 1.6;
  margin-bottom: 0;
}

/* ---------- Layout: map | sidebar ---------- */
.outreach-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.55fr) minmax(280px, 1fr);
  gap: 1.75rem;
  margin-top: 3rem;
}

@media (max-width: 991.98px) {
  .outreach-grid {
    grid-template-columns: 1fr;
  }
}

/* ---------- Map panel ---------- */
.map-panel {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  overflow: hidden;
  position: relative;
}

.map-panel-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.1rem 1.3rem;
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.map-panel-title {
  font-family: var(--font-display);
  font-size: 1.05rem;
  font-weight: 600;
  color: var(--banyan-deep);
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.map-panel-title svg { flex-shrink: 0; }

/* search box */
.district-search {
  position: relative;
  width: min(260px, 100%);
}

.district-search input {
  width: 100%;
  background: var(--bg-paper);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: 0.5rem 0.95rem 0.5rem 2.2rem;
  font-size: 0.88rem;
  font-family: var(--font-body);
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.district-search input:focus {
  border-color: var(--banyan);
  box-shadow: 0 0 0 3px rgba(47, 75, 60, 0.12);
}

.district-search svg {
  position: absolute;
  left: 0.75rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--ink-soft);
  pointer-events: none;
}

.district-search .clear-btn {
  position: absolute;
  right: 0.5rem;
  top: 50%;
  transform: translateY(-50%);
  border: none;
  background: transparent;
  color: var(--ink-soft);
  cursor: pointer;
  display: none;
  padding: 0.2rem;
  line-height: 0;
}
.district-search .clear-btn.visible { display: inline-flex; }
.district-search .clear-btn:hover { color: var(--clay); }

/* autocomplete dropdown */
.search-results {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-card);
  max-height: 240px;
  overflow-y: auto;
  z-index: 1000;
  display: none;
}
.search-results.show { display: block; }

.search-results button {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  border: none;
  background: transparent;
  text-align: left;
  padding: 0.55rem 0.9rem;
  font-size: 0.88rem;
  color: var(--ink);
  cursor: pointer;
  border-bottom: 1px solid var(--line);
}
.search-results button:last-child { border-bottom: none; }
.search-results button:hover,
.search-results button.active-option {
  background: var(--banyan-tint);
  color: var(--banyan-deep);
}
.search-results .match-count {
  font-size: 0.72rem;
  color: var(--ink-soft);
  background: var(--bg-paper);
  border-radius: 999px;
  padding: 0.1rem 0.5rem;
}
.search-results .no-match {
  padding: 0.75rem 0.9rem;
  font-size: 0.85rem;
  color: var(--ink-soft);
  cursor: default;
}

#sindh-map {
  height: 480px;
  width: 100%;
  background: #eef1e6;
}

@media (max-width: 575.98px) {
  #sindh-map { height: 380px; }
}

/* Leaflet pin (signature element): seed/drop shaped marker */
.district-pin {
  position: relative;
  width: 26px;
  height: 34px;
  transform: translate(-50%, -100%);
}

.district-pin .pin-drop {
  position: absolute;
  inset: 0;
  background: var(--banyan);
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 3px 8px rgba(32, 52, 42, 0.35);
  transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease;
}

.district-pin .pin-core {
  position: absolute;
  top: 6px;
  left: 6px;
  width: 14px;
  height: 14px;
  background: var(--bg-paper);
  border-radius: 50%;
}

.district-pin .pin-pulse {
  position: absolute;
  left: 50%;
  top: 38%;
  width: 14px;
  height: 14px;
  margin: -7px 0 0 -7px;
  border-radius: 50%;
  background: rgba(47, 75, 60, 0.35);
  opacity: 0;
}

.district-pin:hover .pin-drop {
  transform: rotate(-45deg) scale(1.12);
  background: var(--banyan-deep);
}

.district-pin.is-active .pin-drop {
  background: var(--clay);
  transform: rotate(-45deg) scale(1.25);
}

.district-pin.is-active .pin-pulse {
  animation: pin-bloom 1.8s ease-out infinite;
}

@keyframes pin-bloom {
  0%   { transform: scale(0.6); opacity: 0.55; }
  100% { transform: scale(2.6); opacity: 0; }
}

.leaflet-popup-content-wrapper {
  background: var(--banyan-deep);
  color: #fff;
  border-radius: var(--radius-sm);
}
.leaflet-popup-content {
  font-family: var(--font-body);
  font-size: 0.85rem;
  margin: 0.55rem 0.8rem;
}
.leaflet-popup-tip { background: var(--banyan-deep); }
.popup-district-name { font-weight: 600; display: block; }
.popup-visit-count { color: rgba(255,255,255,0.7); font-size: 0.78rem; }

/* ---------- Sidebar: district list ---------- */
.district-sidebar {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-soft);
  display: flex;
  flex-direction: column;
  max-height: 480px;
}

.district-sidebar-head {
  padding: 1.1rem 1.3rem 0.85rem;
  border-bottom: 1px solid var(--line);
}

.district-sidebar-head .count-chip {
  display: inline-block;
  margin-top: 0.35rem;
  font-size: 0.78rem;
  color: var(--ink-soft);
}

.district-list {
  list-style: none;
  margin: 0;
  padding: 0.5rem;
  overflow-y: auto;
  flex: 1;
}

.district-list-item button {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.6rem;
  background: transparent;
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.62rem 0.75rem;
  text-align: left;
  cursor: pointer;
  color: var(--ink);
  font-size: 0.92rem;
  transition: background 0.15s ease, color 0.15s ease;
}

.district-list-item button:hover {
  background: var(--banyan-tint);
}

.district-list-item button.active {
  background: var(--banyan);
  color: #fff;
}

.district-list-item .visit-pill {
  font-size: 0.7rem;
  font-weight: 600;
  padding: 0.12rem 0.5rem;
  border-radius: 999px;
  background: var(--bg-paper);
  color: var(--ink-soft);
  flex-shrink: 0;
}

.district-list-item button.active .visit-pill {
  background: rgba(255, 255, 255, 0.18);
  color: #fff;
}

.district-list-item button.no-match {
  display: none;
}

/* ---------- Gallery section ---------- */
.gallery-panel {
  margin-top: 2.5rem;
}

.gallery-panel-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.75rem;
  margin-bottom: 1.5rem;
}

.gallery-panel-title {
  font-family: var(--font-display);
  font-size: 1.5rem;
  font-weight: 600;
  color: var(--banyan-deep);
}

.gallery-panel-title .place {
  color: var(--clay);
}

.gallery-panel-meta {
  font-size: 0.88rem;
  color: var(--ink-soft);
}

/* empty state */
.gallery-empty {
  border: 1.5px dashed var(--line);
  border-radius: var(--radius-lg);
  padding: 3.5rem 2rem;
  text-align: center;
  background: rgba(255, 255, 255, 0.5);
}

.gallery-empty svg {
  color: var(--banyan);
  margin-bottom: 1rem;
}

.gallery-empty h3 {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--banyan-deep);
  margin-bottom: 0.4rem;
}

.gallery-empty p {
  color: var(--ink-soft);
  font-size: 0.92rem;
  margin: 0;
}

/* masonry grid via CSS columns — matches the reference Kadence layout */
.masonry-grid {
  column-count: 3;
  column-gap: 14px;
}

@media (max-width: 767.98px) {
  .masonry-grid { column-count: 2; }
}
@media (max-width: 479.98px) {
  .masonry-grid { column-count: 1; }
}

.masonry-item {
  break-inside: avoid;
  margin-bottom: 14px;
  border-radius: var(--radius-md);
  overflow: hidden;
  position: relative;
  box-shadow: var(--shadow-card);
  background: var(--surface);
  opacity: 0;
  transform: translateY(14px);
  animation: masonry-in 0.5s ease forwards;
}

@keyframes masonry-in {
  to { opacity: 1; transform: translateY(0); }
}

.masonry-item img {
  width: 100%;
  display: block;
  cursor: zoom-in;
  transition: transform 0.4s ease;
}

.masonry-item:hover img {
  transform: scale(1.035);
}

.masonry-item .cap-overlay {
  position: absolute;
  left: 0; right: 0; bottom: 0;
  padding: 0.6rem 0.75rem 0.5rem;
  background: linear-gradient(to top, rgba(32, 52, 42, 0.82), transparent);
  color: #fff;
  font-size: 0.78rem;
  opacity: 0;
  transform: translateY(6px);
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.masonry-item:hover .cap-overlay {
  opacity: 1;
  transform: translateY(0);
}

/* lightbox */
.lightbox-overlay {
  position: fixed;
  inset: 0;
  background: rgba(26, 22, 18, 0.92);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}
.lightbox-overlay.show { display: flex; }

.lightbox-overlay img {
  max-width: 92vw;
  max-height: 84vh;
  border-radius: var(--radius-sm);
  box-shadow: 0 20px 60px rgba(0,0,0,0.5);
}

.lightbox-caption {
  position: absolute;
  bottom: 2.2rem;
  left: 0;
  right: 0;
  text-align: center;
  color: rgba(255,255,255,0.85);
  font-size: 0.9rem;
  font-family: var(--font-body);
}

.lightbox-close,
.lightbox-nav {
  position: absolute;
  background: rgba(255,255,255,0.08);
  border: 1px solid rgba(255,255,255,0.25);
  color: #fff;
  border-radius: 50%;
  width: 42px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.2s ease;
}
.lightbox-close:hover,
.lightbox-nav:hover { background: rgba(255,255,255,0.2); }

.lightbox-close { top: 1.4rem; right: 1.4rem; }
.lightbox-nav.prev { left: 1.4rem; top: 50%; transform: translateY(-50%); }
.lightbox-nav.next { right: 1.4rem; top: 50%; transform: translateY(-50%); }

@media (max-width: 575.98px) {
  .lightbox-nav.prev { left: 0.5rem; }
  .lightbox-nav.next { right: 0.5rem; }
}

/* keyboard focus visibility (a11y) */
.district-pin:focus-visible .pin-drop,
.district-list-item button:focus-visible,
.district-search input:focus-visible,
.lightbox-close:focus-visible,
.lightbox-nav:focus-visible,
.masonry-item img:focus-visible {
  outline: 3px solid var(--gold);
  outline-offset: 2px;
}

/* loading skeleton */
.masonry-skeleton {
  height: 220px;
  border-radius: var(--radius-md);
  background: linear-gradient(100deg, var(--line) 30%, #f0e9d6 50%, var(--line) 70%);
  background-size: 200% 100%;
  animation: skeleton-sheen 1.4s ease-in-out infinite;
  margin-bottom: 14px;
  break-inside: avoid;
}
@keyframes skeleton-sheen {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}
