/**
 * Keren Shutafut Interactive Map Styles
 */

/* Register --pin-scale as an animatable numeric property */
@property --pin-scale {
  syntax: '<number>';
  inherits: true;
  initial-value: 1;
}

/*
 * ── Local font (place .ttf files in assets/fonts/open-sans-hebrew/) ──────
 * Required files:
 *   assets/fonts/open-sans-hebrew/OpenSansHebrew-Regular.ttf
 *   assets/fonts/open-sans-hebrew/OpenSansHebrew-Bold.ttf
 */
@font-face {
  font-family: 'Open Sans Hebrew';
  src: url('../fonts/open-sans-hebrew/OpenSansHebrew-Regular.ttf') format('truetype');
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans Hebrew';
  src: url('../fonts/open-sans-hebrew/OpenSansHebrew-Light.ttf') format('truetype');
  font-weight: 300;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: 'Open Sans Hebrew';
  src: url('../fonts/open-sans-hebrew/OpenSansHebrew-Bold.ttf') format('truetype');
  font-weight: 700;
  font-style: normal;
  font-display: swap;
}

/* ── Design tokens ── */
:root {
  /* Brand palette */
  --color-beige:       #d4c4b0;
  --color-rust:        #a0594d;
  --color-sage:        #8b9f8f;
  --color-teal:        #7fa9a3;
  --color-dark-teal:   #3d5956;
  --color-puzzle-rust: #a0594d;
  --color-puzzle-gray: #8f8481;
  --color-bg-cream:    #fff4e3;

  /* Design-spec tokens */
  --ink:               #2b4a45;
  --panel-bg:          #fff4e3;
  --divider:           2px solid #2b4a45;
  --font-main:         'Open Sans Hebrew', 'Arial Hebrew', Arial, sans-serif;

  /* Panel geometry */
  --panel-width:     calc(22vw + 10px);
  --panel-min-width: 370px;
  --panel-max-width: 470px;
  --panel-pad-v:     36px;
  --panel-pad-h:     28px;
  --panel-radius:    20px 0 0 20px; /* rounded left edge, flush right */

  /* Spacing */
  --title-to-section:  20px;
  --header-to-options: 6px;
  --row-gap:           14px;
  --section-gap:       14px;
}

/* ─────────────────────────────────────────────
   Global radio button style
───────────────────────────────────────────── */
input[type="radio"]:checked {
  accent-color: rgb(150, 72, 50);
  outline: 1.5px solid transparent;
  box-shadow: 0 0 0 1.5px rgb(150, 72, 50), inset 0 0 0 1.5px white;
}

/* ─────────────────────────────────────────────
   Base
───────────────────────────────────────────── */
/* Hide the default WordPress site header on the map page */
#header { display: none !important; }

*, *::before, *::after {
  box-sizing: border-box;
}

html {
  direction: ltr;    /* Safari uses <html dir="rtl"> to flip the viewport origin */
  overflow: hidden;  /* prevent html-level horizontal scroll that causes single-tab clipping in Safari */
}

body {
  overflow: hidden;
  margin: 0;
  padding: 0;
  background: #fff4e3;
}

.map-page {
  position: relative;
  width: 100vw;
  height: 100vh;
  background: #fff4e3;
  font-family: var(--font-main);
  direction: rtl;
}

/* ─────────────────────────────────────────────
   Full-screen map (behind the panel)
───────────────────────────────────────────── */
#map-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  overflow: hidden;
  z-index: 1;
  background: #fff4e3;
  direction: ltr;
}

#map {
  width: 100%;
  height: 100%;
}

/* SVG fills viewport via slice; transform-origin at 0,0 for zoom math */
#map svg {
  width: 100%;
  height: 100%;
  display: block;
  transform-origin: 0 0;
  --pin-scale: 1;
  overflow: visible; /* pins near SVG edge are not clipped by viewBox; #map-container clips the viewport */
  direction: ltr;
}



/* ─────────────────────────────────────────────
   Filter panel — fixed right overlay
───────────────────────────────────────────── */
.filter-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: var(--panel-width);
  min-width: var(--panel-min-width);
  max-width: var(--panel-max-width);
  box-shadow: -13px 0 45px rgba(0, 0, 0, 0.20), -4px 0 13px rgba(0, 0, 0, 0.12);
  height: 100vh;
  background: var(--panel-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  overflow-y: auto;
  overflow-x: hidden;
  z-index: 100;
  /* ltr puts the scrollbar on the RIGHT side of the panel element */
  direction: ltr;
  border-radius: var(--panel-radius);
  border: 2px solid var(--ink);
  border-right: none;
  box-sizing: border-box;
}

/* All panel text */
.filter-panel,
.filter-panel * {
  font-family: var(--font-main);
}

/* Scrollbar on the right edge of the panel */
.filter-panel::-webkit-scrollbar          { width: 4px; }
.filter-panel::-webkit-scrollbar-track    { background: transparent; }
.filter-panel::-webkit-scrollbar-thumb    { background: rgba(43, 74, 69, 0.35); border-radius: 2px; }
.filter-panel::-webkit-scrollbar-thumb:hover { background: rgba(43, 74, 69, 0.6); }

.filter-panel-inner {
  /* Restore RTL for all content; direction: ltr on the parent only controls scrollbar side */
  direction: rtl;
  padding: var(--panel-pad-v) var(--panel-pad-h) 40px calc(var(--panel-pad-h) + 14px);
}

/* ── Panel title + clear button ── */
.filter-panel-top {
  margin-bottom: var(--title-to-section);
}

.filter-panel-title {
  font-size: 27px;
  font-weight: 700;
  line-height: 1.2;
  color: var(--ink);
  margin: 0 0 14px;
  direction: rtl;
  text-align: right;
}

.filter-clear-row {
  border-top: var(--divider);
  padding-top: 10px;
  margin-top: 8px;
  direction: ltr;
  text-align: left;
}

.clear-all-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-main);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.15s;
}

.clear-all-btn .clear-icon {
  width: 22px;
  height: 22px;
  flex-shrink: 0;
}

.clear-all-btn:hover  { opacity: 1; }
.clear-all-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
  border-radius: 2px;
  opacity: 1;
}

.panel-description {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.7;
  margin: 0;
  direction: rtl;
  text-align: right;
  border-right: 2px solid var(--ink);
  padding-right: 12px;
}

/* ─────────────────────────────────────────────
   Filter sections
───────────────────────────────────────────── */
.filter-group {
  padding-bottom: var(--section-gap);
  border-bottom: var(--divider);
  margin-bottom: var(--section-gap);
}

.filter-group--last {
  border-bottom: none;
  padding-bottom: 0;
  margin-bottom: 0;
}

/* ── Section icon (inline, beside header text) ── */
.filter-section-header {
  display: flex;
  align-items: flex-end;
  gap: 4px;
  padding-top: 8px;
  padding-bottom: 8px;
  margin-bottom: var(--header-to-options);
  direction: rtl;
}

.section-icon {
  display: block;
  width: 20px !important;  /* override any inline width/height attribute */
  height: 20px !important;
  flex-shrink: 0;
  align-self: flex-end;
  margin-top: 0;
}

.filter-group-title {
  font-size: 18px;
  font-weight: 500;
  color: var(--ink);
  margin: 0;
  line-height: 1.2;
  direction: rtl;
  text-align: right;
}

/* ─────────────────────────────────────────────
   3-column options grid
───────────────────────────────────────────── */
.filter-options-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-auto-rows: 36px; /* fixed row height = 2-line label, keeps spacing uniform */
  width: 100%;
  row-gap: var(--row-gap);
  column-gap: var(--row-gap);
  direction: rtl;
}

/* ── Single option label ── */
.filter-option {
  display: flex;
  align-items: flex-start; /* align radio button with first line of text */
  gap: 8px;
  direction: rtl;
  cursor: pointer;
  font-size: 12px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.4;
  transition: opacity 0.15s;
}

.filter-option:hover { opacity: 0.7; }

.option-text {
  direction: rtl;
  text-align: right;
}

/* ─────────────────────────────────────────────
   Custom checkbox — 14.79 × 14.79 px
───────────────────────────────────────────── */
.filter-option input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14.79px;
  height: 14.79px;
  min-width: 14.79px;
  border: 2px solid var(--ink);
  border-radius: 2.63px;
  background: transparent;
  margin: 0;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.filter-option input[type="checkbox"]:checked {
  background: var(--ink);
  border-color: var(--ink);
}

.filter-option input[type="checkbox"]:checked::after {
  content: '';
  position: absolute;
  left: 3.2px;
  top: 1px;
  width: 5.5px;
  height: 8.5px;
  border: 2px solid white;
  border-top: none;
  border-left: none;
  transform: rotate(45deg);
}

/* ─────────────────────────────────────────────
   Custom radio — square with checkmark (matches checkbox)
───────────────────────────────────────────── */
.filter-option input[type="radio"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14.79px;
  height: 14.79px;
  min-width: 14.79px;
  border: 2px solid var(--ink);
  border-radius: 2.63px;
  background: transparent;
  margin: 0;
  cursor: pointer;
  position: relative;
  transition: background 0.15s, border-color 0.15s;
  flex-shrink: 0;
}

.filter-option input[type="radio"]:checked {
  background: rgb(150, 72, 50);
  border-color: var(--ink);
  box-shadow: inset 0 0 0 1.5px var(--panel-bg);
}

/* Shared focus ring */
.filter-option input[type="checkbox"]:focus-visible,
.filter-option input[type="radio"]:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 2px;
}

/* ─────────────────────────────────────────────
   SVG region interaction
───────────────────────────────────────────── */
/* ── Zoom guide rectangles: hidden but still participate in layout for getBBox ── */
#north_zoom, #carmel_zoom, #center_zoom, #jerusalem_zoom, #south_zoom {
  opacity: 0;
  pointer-events: none;
}

/* ── Click pad overlays: invisible but always in layout for hit-testing ── */
[id$="_click_pad"] path {
  fill-opacity: 0;
  pointer-events: all;
}

/* Show the overlay on hover */
[id$="_click_pad"]:hover path {
  fill-opacity: 1;
}

/* Selected region: solid fill, bold outline, lifted shadow */
.clickable-region.selected path {
  fill: rgb(198, 179, 166) !important;
  fill-opacity: 1 !important;
  opacity: 1 !important;   /* override SVG cls-13 opacity:0.44 so fill and stroke are fully opaque */
  stroke: #2b4a45;
  stroke-width: 8px;
  stroke-linejoin: round;
  stroke-linecap: round;
}

/* Elevation effect: physically lift the region up + drop shadow */
.clickable-region.selected {
  filter: drop-shadow(0 10px 22px rgba(0, 0, 0, 0.52));
  transform: translateY(-8px);
  transition: transform 0.3s ease, filter 0.3s ease;
}

/* Elevated pin shadow is applied via SVG group filter on #pin-markers-elevated — no CSS filter needed here */

.clickable-region {
  cursor: pointer;
  transition: transform 0.3s ease, filter 0.3s ease;
}

/* ── Individual map pins ── */
#pin-markers {
  pointer-events: all;
}


/* ─────────────────────────────────────────────
   Pins (FIXED VERSION - NO COUNTER-SCALING)
───────────────────────────────────────────── */
.map-pin {
  cursor: pointer;
  transition: opacity 0.3s ease;
}

.map-pin--inactive {
  opacity: 1;
}

/* Elevated class kept for styling purposes, but elevation is now in SVG transform */
.map-pin--elevated {
  /* Elevation applied in SVG space via transform attribute, not CSS */
}

/* Scale the inner group so CSS transform doesn't conflict
   with the outer group's SVG translate attribute */
.map-pin-inner {
  transform-origin: 0 0; /* scale from the pin's anchor point */
  transition: transform 0.2s ease;
}

.map-pin:hover .map-pin-inner {
  transform: scale(1.15);
}

.map-pin:hover {
  filter: drop-shadow(0 4px 8px rgba(0, 0, 0, 0.35));
}

.map-pin.hidden {
  opacity: 0;
  pointer-events: none;
}

/* ── Custom pin tooltip ── */
#map-tooltip {
  position: fixed;
  background: var(--ink);
  color: var(--panel-bg);
  padding: 4px 10px;
  border-radius: 6px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  pointer-events: none;
  white-space: nowrap;
  z-index: 200;
  opacity: 0;
  transition: opacity 0.08s;
  transform: translate(-50%, calc(-100% - 10px));
}

#map-tooltip.visible {
  opacity: 1;
}

/* ── Mobile scroll hint toast ── */
#ks-scroll-hint {
  display: none;
  position: fixed;
  top: 60px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink);
  color: var(--panel-bg);
  padding: 10px 20px;
  border-radius: 20px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  z-index: 500;
  opacity: 0;
  transition: opacity 0.4s ease;
  pointer-events: none;
}

@media (max-width: 768px) {
  #ks-scroll-hint {
    display: block;
  }
}

#ks-scroll-hint.is-visible {
  opacity: 1;
}

/* ── Puzzle markers ── */
#puzzle-markers {
  position: absolute;
  inset: 0;
  pointer-events: none;
}

.puzzle-marker {
  position: absolute;
  width: 50px;
  height: 50px;
  pointer-events: all;
  cursor: pointer;
  transition: transform 0.25s;
}

.puzzle-marker:hover { transform: scale(1.1); }

.marker-count {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  border-radius: 50%;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  color: var(--color-rust);
  font-size: 13px;
}

/* ── Region labels ── */
.region-label {
  font-family: 'Heebo', Arial, sans-serif;
  font-size: 32px;
  font-weight: bold;
  fill: #8b4513;
  text-anchor: middle;
  display: none;
  pointer-events: none;
}

.region-label.visible { display: block; }

/* City label font override */
#map text {
  font-family: 'Editor Sans', 'Open Sans Hebrew', 'Arial Hebrew', Arial, sans-serif;
}

/* ─────────────────────────────────────────────
   Project details panel
───────────────────────────────────────────── */
.project-panel {
  position: fixed;
  top: 0;
  right: 0; /* extends to the right edge — filter panel (z-index 100) overlaps */
  /* content-width + filter-panel-width */
  width: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) * 2);
  height: 100vh;
  background: #fff4e3;
  border-radius: var(--panel-radius);
  border: 2px solid var(--ink);
  border-right: none;
  box-shadow: -13px 0 45px rgba(0, 0, 0, 0.20), -4px 0 13px rgba(0, 0, 0, 0.12);
  box-sizing: border-box;
  z-index: 90;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  overflow: hidden;
  font-family: var(--font-main);
  direction: ltr; /* scrollbar on right */
}

.project-panel.panel-open {
  transform: translateX(0);
}

.project-panel-inner {
  direction: rtl;
  /* right padding clears the filter panel sitting on top; left gets extra spacing */
  padding: var(--panel-pad-v) calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) + var(--panel-pad-h)) 40px calc(var(--panel-pad-h) + 20px);
  height: 100%;
  overflow-y: auto;
  box-sizing: border-box;
  scrollbar-width: thin;
  scrollbar-color: rgba(43,74,69,0.35) transparent;
}

.project-panel-inner::-webkit-scrollbar       { width: 4px; }
.project-panel-inner::-webkit-scrollbar-track { background: transparent; }
.project-panel-inner::-webkit-scrollbar-thumb { background: rgba(43,74,69,0.35); border-radius: 2px; }

.project-panel-close {
  position: absolute;
  top: 12px;
  left: 12px;
  width: 48px;
  height: 48px;
  background: none;
  border: none;
  cursor: pointer;
  color: var(--ink);
  padding: 0;
  opacity: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: opacity 0.15s;
  pointer-events: all;
}
.project-panel-close:hover { opacity: 0.6; }
.project-panel-close svg,
.project-panel-close::before,
.project-panel-close::after { pointer-events: none; }

.project-panel-title {
  display: flex;
  align-items: center;
  gap: 8px;
  direction: rtl;
  font-size: 23px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 16px;
  padding-left: 36px;
  line-height: 1.3;
}

.project-title-icon {
  width: 36px;
  height: 36px;
  flex-shrink: 0;
}

.project-panel-divider {
  height: 0;
  border: none;
  border-top: var(--divider);
  margin: 14px 0;
}

.project-panel-divider.hidden { display: none; }

.project-panel-description {
  font-size: 13px;
  font-weight: 400;
  color: var(--ink);
  line-height: 1.75;
  margin: 0;
  text-align: right;
}

.description-with-divider {
  position: relative;
  padding-right: 16px;
}

.vertical-divider-right {
  position: absolute;
  right: 0;
  top: 0;
  bottom: 0;
  width: 2px;
  background: var(--ink);
  opacity: 1;
}

.project-panel-meta {
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.project-meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--ink);
  direction: rtl;
}

.project-meta-row .meta-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ink);
}

.project-meta-row strong {
  font-weight: 700;
  white-space: nowrap;
}

.project-meta-row span {
  font-weight: 400;
}

#pm-location span {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

.project-panel-org {
  font-size: 13px;
  color: var(--ink);
  text-align: right;
}

.project-panel-org .org-label {
  font-weight: 700;
  margin-left: 4px;
}

.project-panel-org .org-name {
  font-weight: 400;
}

.project-panel-link {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  font-size: 13px;
  color: var(--ink);
  text-decoration: none;
  direction: rtl;
  opacity: 0.8;
  transition: opacity 0.15s;
}
.project-panel-link strong {
  font-weight: 700;
}
.project-panel-link:hover { opacity: 1; text-decoration: underline; }
.project-panel-link .meta-icon { width: 36px; height: 36px; flex-shrink: 0; }

/* Hide placeholder items when empty */
.project-meta-row.hidden,
.project-panel-org.hidden,
.project-panel-link.hidden { display: none; }

/* ── Related projects carousel ── */
.related-projects-section {
  direction: rtl;
}

.related-projects-section.hidden,
#related-divider.hidden { display: none; }

.related-projects-title {
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  margin: 0 0 10px;
  text-align: right;
  direction: rtl;
}

.related-carousel {
  direction: rtl;
}

/* Track: list container — only one slide visible at a time */
.carousel-track {
  list-style: none;
  margin: 0;
  padding: 0;
  min-height: 34px;
}

.carousel-slide {
  display: none;
}

.carousel-slide.carousel-slide--active {
  display: flex;
  align-items: center;
}

.related-project-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  background: none;
  border: none;
  padding: 4px 0;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  direction: rtl;
  text-align: right;
  cursor: pointer;
  transition: opacity 0.15s;
}

.related-project-btn:hover { opacity: 0.65; }

.related-project-icon {
  width: 20px;
  height: 20px;
  flex-shrink: 0;
}

.related-project-name {
  flex: 1;
  text-align: right;
  line-height: 1.35;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Carousel navigation footer */
.carousel-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  direction: rtl;
  margin-top: 10px;
}

.carousel-dots {
  display: flex;
  gap: 6px;
  align-items: center;
}

.carousel-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  border: none;
  padding: 0;
  background: rgba(43, 74, 69, 0.22);
  cursor: pointer;
  transition: background 0.18s;
  flex-shrink: 0;
}

.carousel-dot.carousel-dot--active {
  background: var(--ink);
}

.carousel-arrow {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  border: 1.5px solid var(--ink);
  border-radius: 50%;
  background: none;
  color: var(--ink);
  cursor: pointer;
  padding: 0;
  transition: opacity 0.15s;
  flex-shrink: 0;
}

.carousel-arrow svg {
  width: 10px;
  height: 10px;
  display: block;
}

.carousel-arrow:hover:not(:disabled) { opacity: 0.65; }
.carousel-arrow:disabled { opacity: 0.22; cursor: default; }

/* ── Legacy close button (kept for compatibility) ── */
.modal-close {
  position: absolute;
  top: 14px;
  right: 16px;
  background: none;
  border: none;
  font-size: 30px;
  line-height: 1;
  cursor: pointer;
  color: var(--ink);
  transition: opacity 0.15s;
}

.modal-close:hover { opacity: 0.6; }

#modal-title {
  color: var(--color-rust);
  margin: 0 0 20px;
  font-size: 22px;
  font-weight: 700;
}

.pin-item {
  border-bottom: 1px solid var(--color-bg-cream);
  padding: 14px 0;
}

.pin-item:last-child { border-bottom: none; }

.pin-item h3 {
  color: var(--ink);
  margin: 0 0 6px;
  font-size: 16px;
}

.pin-item p {
  color: #555;
  font-size: 14px;
  margin: 0;
  line-height: 1.5;
}

/* ─────────────────────────────────────────────
   Search row
───────────────────────────────────────────── */
.filter-search-row {
  direction: rtl;
  margin-bottom: var(--section-gap);
  padding-bottom: var(--section-gap);
  border-bottom: var(--divider);
}

.search-input-group {
  display: flex;
  align-items: center;
  gap: 6px;
  direction: rtl;
}

.map-search-input {
  flex: 1;
  min-width: 0;
  padding: 7px 14px;
  border: 2px solid var(--ink);
  border-radius: 20px;
  background: transparent;
  font-family: var(--font-main);
  font-size: 13px;
  color: var(--ink);
  direction: rtl;
  text-align: right;
  outline: none;
  transition: box-shadow 0.15s;
}

.map-search-input::placeholder {
  color: rgba(43, 74, 69, 0.4);
}

.map-search-input:focus {
  box-shadow: 0 0 0 3px rgba(43, 74, 69, 0.14);
}

.map-search-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  border: 2px solid var(--ink);
  border-radius: 50%;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  transition: background 0.15s, color 0.15s;
  padding: 0;
}

.map-search-btn svg {
  width: 16px;
  height: 16px;
}

.map-search-btn:hover {
  background: var(--ink);
  color: var(--panel-bg);
}

.map-search-btn:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

/* ─────────────────────────────────────────────
   Search results panel
───────────────────────────────────────────── */

/* Hidden by default */
.search-results-view  { display: none; }
.back-to-results-btn  { display: none; }

/* Search results mode */
.project-panel.panel-search-mode .search-results-view { display: block; }
.project-panel.panel-search-mode .project-panel-title,
.project-panel.panel-search-mode .description-with-divider,
.project-panel.panel-search-mode .project-panel-description,
.project-panel.panel-search-mode .project-panel-meta,
.project-panel.panel-search-mode #pm-org,
.project-panel.panel-search-mode #pm-link,
.project-panel.panel-search-mode #project-images,
.project-panel.panel-search-mode #related-projects-section,
.project-panel.panel-search-mode #related-divider,
.project-panel.panel-search-mode .project-panel-divider { display: none; }

/* Pin-from-search mode — show back button, hide search view */
.project-panel.panel-pin-from-search .back-to-results-btn {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: none;
  border: none;
  padding: 0 0 12px;
  font-family: var(--font-main);
  font-size: 12px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  opacity: 0.65;
  transition: opacity 0.15s;
  direction: rtl;
}
.project-panel.panel-pin-from-search .back-to-results-btn:hover { opacity: 1; }

.search-results-title {
  font-size: 17px;
  font-weight: 700;
  color: var(--ink);
  margin: 0;
  padding-left: 36px;
  text-align: right;
  direction: rtl;
}

.search-results-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 0;
}

.search-result-item {
  padding: 12px 0;
  border-bottom: 1px solid rgba(43, 74, 69, 0.18);
  direction: rtl;
}
.search-result-item:last-child { border-bottom: none; }

.search-result-title {
  display: block;
  width: 100%;
  background: none;
  border: none;
  padding: 0;
  font-family: var(--font-main);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  text-align: right;
  cursor: pointer;
  transition: opacity 0.15s;
  line-height: 1.4;
}
.search-result-title:hover { opacity: 0.65; }

.search-result-excerpt {
  font-size: 11px;
  color: var(--ink);
  opacity: 0.7;
  margin: 4px 0 0;
  line-height: 1.6;
  text-align: right;
  direction: rtl;
}

.search-result-empty {
  font-size: 13px;
  color: var(--ink);
  opacity: 0.6;
  text-align: right;
  padding: 16px 0;
  direction: rtl;
}

/* ─────────────────────────────────────────────
   Collapsible filter sections
───────────────────────────────────────────── */
.collapsible-header {
  cursor: pointer;
  user-select: none;
  width: 100%;
  justify-content: space-between;
}

.collapsible-header .filter-group-title {
  flex: 1;
}

.chevron-icon {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  color: var(--ink);
  /* start pointing up (expanded state) */
  transform: rotate(180deg);
  transition: transform 0.25s ease;
}

.collapsible-group.is-collapsed .chevron-icon {
  transform: rotate(0deg);
}

.filter-collapsible-body {
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.3s ease, opacity 0.25s ease;
}

.collapsible-group.is-collapsed .filter-collapsible-body {
  max-height: 0;
  opacity: 0;
}

/* ─────────────────────────────────────────────
   Responsive breakpoints
───────────────────────────────────────────── */

/* Medium–large screens */
@media screen and (max-width: 1400px) {
  :root { --panel-width: 26vw; }
}

/* Tablet landscape */
@media screen and (max-width: 1024px) {
  :root {
    --panel-width:       32vw;
    --panel-radius:      20px 0 0 20px;
    --panel-pad-h:       22px;
    --title-to-section:  28px;
    --header-to-options: 5px;
    --row-gap:           12px;
    --section-gap:       12px;
  }
}

/* Tablet portrait — bottom sheet */
@media screen and (max-width: 768px) {
  :root {
    --panel-width:       100vw;
    --panel-min-width:   unset;
    --panel-max-width:   unset;
    --panel-pad-v:       20px;
    --panel-pad-h:       16px;
    --title-to-section:  16px;
    --header-to-options: 5px;
    --row-gap:           12px;
    --section-gap:       12px;
    --panel-radius:      20px 20px 0 0;
  }

  .filter-panel {
    width: var(--panel-width) !important;
    height: auto;
    max-height: 60vh;
    top: auto;
    bottom: 0;
    right: 0;
    border-radius: var(--panel-radius);
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
  }

  .filter-panel-title { font-size: 22px; }
  .filter-group-title  { font-size: 16px; }
  .filter-option       { font-size: 12px; }
}

/* Mobile — 2-column grid */
@media screen and (max-width: 480px) {
  .filter-options-grid {
    grid-template-columns: repeat(2, 1fr);
  }
}

/* ─────────────────────────────────────────────
   Map logo
   Desktop: top-right below the lang-switcher,
            aligned with it above the panel edge.
   Mobile:  bottom-left corner (unchanged).
───────────────────────────────────────────── */
.map-logo {
  position: fixed;
  bottom: 16px;
  left: 16px;
  z-index: 100;
}

.map-logo img {
  display: block;
  max-width: 120px;
  height: auto;
}

/* Desktop: stacked below the lang-switcher, same right edge + same width */
@media screen and (min-width: 769px) {
  .map-logo {
    bottom: auto;
    left: auto;
    top: 52px;
    right: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) + 18px);
    transition: right 0.3s ease-in-out, left 0.3s ease-in-out;
  }

  .map-logo img {
    width: 61px;
    max-width: none;
    height: auto;
  }

  html[data-lang="en"] .map-logo {
    right: auto;
    left: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) + 18px);
  }

  /* Project panel open: shift logo with the lang-switcher */
  html.project-panel-open .map-logo {
    right: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) * 2 + 18px);
  }

  html[data-lang="en"].project-panel-open .map-logo {
    right: auto;
    left: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) * 2 + 18px);
  }
}

@media screen and (max-width: 768px) {
  .map-logo img {
    max-width: 80px;
  }
}

/* ─────────────────────────────────────────────
   Project featured image
───────────────────────────────────────────── */
.project-images-section {
  margin-top: 20px;
}

.project-images-section.hidden {
  display: none;
}

.project-images-section img.project-image {
  width: 100%;
  max-width: 100%;
  height: auto;
  display: block;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* ─────────────────────────────────────────────
   Language switcher button
───────────────────────────────────────────── */
.lang-switcher {
  position: fixed;
  top: 16px;
  /* Hebrew: just to the left of the right-side panel */
  right: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) + 12px);
  z-index: 200;
  display: flex;
  align-items: center;
  gap: 4px;
  background: var(--panel-bg);
  border: 2px solid var(--ink);
  border-radius: 20px;
  padding: 1px 8px;
  font-family: var(--font-main);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  cursor: pointer;
  transition: box-shadow 0.15s,
              right 0.3s ease-in-out,
              left 0.3s ease-in-out;
  line-height: 1;
}


.lang-switcher:hover {
  box-shadow: 0 2px 8px rgba(43, 74, 69, 0.25);
}

.lang-switcher:focus-visible {
  outline: 2px solid var(--ink);
  outline-offset: 3px;
}

.lang-sep {
  opacity: 0.35;
  font-weight: 400;
  margin: 0 1px;
}

.lang-opt {
  opacity: 0.4;
  transition: opacity 0.15s;
  padding: 4px 5px;
  cursor: pointer;
}

/* Highlight the active language */
html[data-lang="he"] .lang-opt[data-lang-opt="he"],
html[data-lang="en"] .lang-opt[data-lang-opt="en"],
html[data-lang="ar"] .lang-opt[data-lang-opt="ar"] {
  opacity: 1;
  font-weight: 700;
}

/* Arabic: same RTL layout as Hebrew; override font to Noto Sans Arabic */
html[data-lang="ar"] .filter-panel,
html[data-lang="ar"] .project-panel,
html[data-lang="ar"] .filter-panel *,
html[data-lang="ar"] .project-panel *,
html[data-lang="ar"] .map-search-input,
html[data-lang="ar"] .map-tooltip,
html[data-lang="ar"] #ks-bottom-sheet-inner,
html[data-lang="ar"] .ks-pin-detail,
html[data-lang="ar"] .ks-search-results {
  font-family: 'Noto Sans Arabic', 'Segoe UI', Arial, sans-serif;
}

/* English: just to the right of the left-side panel */
html[data-lang="en"] .lang-switcher {
  right: auto;
  left: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) + 12px);
}

/* Project panel open: shift switcher to stay on the map area */
html.project-panel-open .lang-switcher {
  right: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) * 2 + 12px);
}

html[data-lang="en"].project-panel-open .lang-switcher {
  right: auto;
  left: calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) * 2 + 12px);
}

/* ─────────────────────────────────────────────
   English (LTR) layout overrides
───────────────────────────────────────────── */

/* English logo position handled in the desktop media query above */

/* Map: shift container right so it starts after the left panel */
html[data-lang="en"] #map-container {
  left: clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width));
  width: calc(100vw - clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)));
}

/* English option text: left-aligned, free to wrap */
html[data-lang="en"] .option-text {
  text-align: left;
}

/* Filter panel flips to the left */
html[data-lang="en"] .filter-panel {
  right: auto;
  left: 0;
  border-radius: 0 20px 20px 0;
  border: 2px solid var(--ink);
  border-left: none;
  /* Tight shadow — stays within ~8px of the panel edge so it doesn't cover the map */
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.14);
}

html[data-lang="en"] .filter-panel-inner {
  direction: ltr;
  padding: var(--panel-pad-v) var(--panel-pad-h) 40px calc(var(--panel-pad-h) + 14px);
}

html[data-lang="en"] .filter-panel-title {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .panel-description {
  direction: ltr;
  text-align: left;
  border-right: none;
  border-left: 2px solid var(--ink);
  padding-right: 0;
  padding-left: 12px;
}

html[data-lang="en"] .filter-search-row,
html[data-lang="en"] .search-input-group {
  direction: ltr;
}

html[data-lang="en"] .map-search-input {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .filter-section-header {
  direction: ltr;
  align-items: flex-end;
}

html[data-lang="en"] .section-icon {
  align-self: flex-end;
  margin-top: 0;
}

html[data-lang="en"] .filter-group-title {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .filter-options-grid {
  direction: ltr;
}

html[data-lang="en"] .filter-option {
  direction: ltr;
}

html[data-lang="en"] .option-text {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .filter-clear-row {
  direction: rtl;
  text-align: right;
}

/* Project panel flips to the left */
html[data-lang="en"] .project-panel {
  right: auto;
  left: 0;
  border-radius: 0 20px 20px 0;
  border: 2px solid var(--ink);
  border-left: none;
  box-shadow: 3px 0 8px rgba(0, 0, 0, 0.14);
  transform: translateX(-100%); /* slides in from the left */
}

html[data-lang="en"] .project-panel.panel-open {
  transform: translateX(0);
}

html[data-lang="en"] .project-panel-inner {
  direction: ltr;
  /* left padding clears the filter panel; right gets normal spacing */
  padding: var(--panel-pad-v) calc(var(--panel-pad-h) + 20px) 40px
           calc(clamp(var(--panel-min-width), var(--panel-width), var(--panel-max-width)) + var(--panel-pad-h));
}

html[data-lang="en"] .project-panel-close {
  left: auto;
  right: 12px;
}

html[data-lang="en"] .project-panel-title {
  direction: ltr;
  text-align: left;
  padding-left: 0;
  padding-right: 36px;
}

html[data-lang="en"] .description-with-divider {
  padding-right: 0;
  padding-left: 16px;
}

html[data-lang="en"] .vertical-divider-right {
  right: auto;
  left: 0;
}

html[data-lang="en"] .project-panel-description {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .project-meta-row {
  direction: ltr;
}

html[data-lang="en"] .project-panel-org {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .project-panel-org .org-label {
  margin-left: 0;
  margin-right: 4px;
}

html[data-lang="en"] .project-panel-link {
  direction: ltr;
}

/* Search results panel in English */
html[data-lang="en"] .search-results-title {
  direction: ltr;
  text-align: left;
  padding-left: 0;
  padding-right: 36px;
}

html[data-lang="en"] .search-result-item,
html[data-lang="en"] .search-result-title,
html[data-lang="en"] .search-result-excerpt,
html[data-lang="en"] .search-result-empty {
  direction: ltr;
  text-align: left;
}

/* Back-to-results button in English */
html[data-lang="en"] .project-panel.panel-pin-from-search .back-to-results-btn {
  direction: ltr;
  flex-direction: row-reverse; /* arrow points right for LTR "back" */
}

/* Related projects carousel in English */
html[data-lang="en"] .related-projects-section,
html[data-lang="en"] .related-carousel,
html[data-lang="en"] .carousel-footer {
  direction: ltr;
}

html[data-lang="en"] .related-projects-title {
  direction: ltr;
  text-align: left;
}

html[data-lang="en"] .related-project-btn,
html[data-lang="en"] .related-project-name {
  direction: ltr;
  text-align: left;
}

/* Mobile: bottom-sheet panel — map fills full width, switcher falls back to fixed corner */
@media screen and (max-width: 768px) {
  /* Hebrew: panel is bottom sheet, so the calc() offset would be huge — reset to corner */
  .lang-switcher {
    right: 16px;
  }

  html[data-lang="en"] .filter-panel {
    left: 0;
    right: 0;
    top: auto;
    bottom: 0;
    border-radius: 20px 20px 0 0;
    border: 2px solid var(--ink);
    border-bottom: none;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
  }

  html[data-lang="en"] .lang-switcher {
    left: 16px;
    right: auto;
  }

  /* Mobile: panel is a bottom sheet — map fills full width regardless of language */
  html[data-lang="en"] #map-container {
    left: 0;
    width: 100vw;
  }
}

/* ─────────────────────────────────────────────
   Mobile-only elements — hidden on desktop
───────────────────────────────────────────── */
.ks-filter-fab,
.ks-filter-close,
.ks-filter-footer,
.ks-bottom-sheet,
.ks-overlay {
  display: none;
}

/* ─────────────────────────────────────────────
   Mobile layout (≤ 768px)
───────────────────────────────────────────── */
@media screen and (max-width: 768px) {

  /* Filter panel: starts off-screen, slides up with .is-open */
  #ks-filter-panel {
    width: 100vw !important;
    max-width: none !important;
    min-width: unset !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    bottom: 0 !important;
    height: auto;
    max-height: 85svh;
    border-radius: 20px 20px 0 0;
    border: 2px solid var(--ink);
    border-bottom: none;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 300;
    overflow-y: auto;
    padding-bottom: calc(env(safe-area-inset-bottom, 0px) + 80px);
  }

  #ks-filter-panel.is-open {
    transform: translateY(0);
  }

  /* Close button — top-center drag-handle style */
  .ks-filter-close {
    display: block;
    position: relative;
    width: 40px;
    height: 5px;
    background: rgba(43, 74, 69, 0.25);
    border: none;
    border-radius: 3px;
    margin: 0 auto 16px;
    cursor: pointer;
    font-size: 0;
    color: transparent;
    padding: 0;
  }

  /* Sticky footer inside filter panel */
  .ks-filter-footer {
    display: flex;
    gap: 10px;
    position: sticky;
    bottom: 0;
    background: var(--panel-bg);
    padding: 12px 16px calc(env(safe-area-inset-bottom, 0px) + 12px);
    border-top: 1px solid rgba(43, 74, 69, 0.15);
    direction: rtl;
  }

  .ks-filter-apply {
    flex: 1;
    background: var(--color-dark-teal);
    color: #fff;
    border: none;
    border-radius: 8px;
    padding: 12px 16px;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
  }

  .ks-filter-clear-mobile {
    flex: 0 0 auto;
    background: transparent;
    color: var(--color-dark-teal);
    border: 2px solid var(--color-dark-teal);
    border-radius: 8px;
    padding: 12px 16px;
    font-family: var(--font-main);
    font-size: 15px;
    cursor: pointer;
  }

  /* FAB filter button — fixed bottom-right */
  .ks-filter-fab {
    display: flex;
    align-items: center;
    gap: 6px;
    position: fixed;
    bottom: calc(env(safe-area-inset-bottom, 0px) + 20px);
    right: 20px;
    background: var(--color-dark-teal);
    color: #fff;
    border: none;
    border-radius: 50px;
    padding: 12px 18px;
    font-family: var(--font-main);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.25);
    z-index: 200;
    direction: rtl;
  }

  .ks-fab-label {
    line-height: 1;
  }

  .ks-fab-badge {
    background: var(--color-rust);
    color: #fff;
    border-radius: 50%;
    min-width: 20px;
    height: 20px;
    font-size: 12px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    padding: 0 4px;
  }

  /* Dim overlay — behind both sheets */
  .ks-overlay {
    display: block;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 250;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease;
  }

  .ks-overlay.is-active {
    opacity: 1;
    pointer-events: auto;
  }

  /* Bottom sheet — pin details */
  .ks-bottom-sheet {
    display: flex;
    flex-direction: column;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--panel-bg);
    border-radius: 20px 20px 0 0;
    border: 2px solid var(--ink);
    border-bottom: none;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.2);
    max-height: 75svh;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    z-index: 300;
    overflow: hidden;
  }

  .ks-bottom-sheet.is-open {
    transform: translateY(0);
  }

  .ks-bottom-sheet-handle {
    flex-shrink: 0;
    width: 40px;
    height: 5px;
    background: rgba(43, 74, 69, 0.25);
    border-radius: 3px;
    margin: 12px auto 8px;
  }

  .ks-bottom-sheet-inner {
    flex: 1;
    overflow-y: auto;
    padding: 4px 16px calc(env(safe-area-inset-bottom, 0px) + 20px);
    direction: rtl;
    font-family: var(--font-main);
  }

  .ks-bs-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--color-dark-teal);
    margin: 0 0 10px;
    line-height: 1.35;
  }

  .ks-bs-desc {
    font-size: 14px;
    color: var(--ink);
    line-height: 1.55;
    margin: 0 0 12px;
  }

  .ks-bs-meta-row {
    font-size: 13px;
    color: var(--ink);
    margin-bottom: 6px;
  }

  .ks-bs-org {
    font-size: 13px;
    color: var(--ink);
    margin: 10px 0 8px;
  }

  .ks-bs-org-label {
    font-weight: 600;
  }

  .ks-bs-link {
    display: inline-block;
    margin-top: 10px;
    color: var(--color-dark-teal);
    font-size: 14px;
    font-weight: 600;
    text-decoration: underline;
  }

  /* Hide desktop project panel on mobile — bottom sheet takes over */
  #project-panel {
    display: none !important;
  }

  /* Landscape adjustments */
  @media (orientation: landscape) {
    .ks-filter-fab {
      bottom: calc(env(safe-area-inset-bottom, 0px) + 12px);
      right: calc(env(safe-area-inset-right, 0px) + 16px);
    }

    #ks-filter-panel,
    .ks-bottom-sheet {
      max-height: 90svh;
    }
  }
}

/* ─────────────────────────────────────────────
   Print — show map only, hide UI panels
───────────────────────────────────────────── */
@media print {
  .filter-panel,
  .project-panel,
  .lang-switcher,
  .map-logo,
  #map-tooltip,
  .ks-filter-fab,
  .ks-bottom-sheet,
  .ks-overlay {
    display: none !important;
  }

  #map-container {
    position: static;
    width: 100%;
    height: 100vh;
    overflow: visible;
  }
}

/* Hamburger button: hidden on desktop */
.ks-hamburger-btn { display: none; }

/* ============================================================
   MOBILE LAYOUT — max-width 768px
   Direct overrides on .map-page / #map-container / .filter-panel
   These come last in the file so they win over all prior rules.
   ============================================================ */
@media (max-width: 768px) {

  /* 1. Outer wrapper: vertical stack */
  .map-page {
    display: flex !important;
    flex-direction: column !important;
    height: 100svh !important;
    width: 100vw !important;
    overflow: hidden !important;
    position: relative !important;
  }

  /* 2. Map: fills all space below the top bar */
  #map-container {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    flex: 1 1 auto !important;
    overflow: hidden !important;
    z-index: 1 !important;
  }

  /* SVG fills the map area */
  #map, #map svg {
    width: 100% !important;
    height: 100% !important;
  }

  /* English: map is always full-width on mobile */
  html[data-lang="en"] #map-container {
    left: auto !important;
    width: 100% !important;
  }

  /* 3. Panel: fixed bottom drawer, hidden until .is-open */
  .filter-panel,
  #ks-filter-panel {
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    top: auto !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: auto !important;
    max-height: 80svh !important;
    flex: none !important;
    min-height: 0 !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    -webkit-overflow-scrolling: touch;
    border-top: 2px solid var(--ink) !important;
    border-right: none !important;
    border-left: none !important;
    border-bottom: none !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.18) !important;
    transform: translateY(100%) !important;
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1) !important;
    z-index: 200 !important;
    box-sizing: border-box !important;
  }

  .filter-panel.is-open,
  #ks-filter-panel.is-open {
    transform: translateY(0) !important;
  }

  .filter-panel-inner {
    padding-top: 12px !important;
  }

  /* Hide the verbose intro text to save space */
  .panel-description {
    display: none !important;
  }

  /* 4. Touch-friendly targets: accordion headers */
  .collapsible-header {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Touch-friendly targets: each filter option label */
  .filter-option {
    min-height: 44px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* 5. Hide desktop-only chrome */
  .map-logo        { display: none !important; }
  #map-tooltip     { display: none !important; }
  .ks-filter-fab   { display: none !important; }
  .ks-filter-close { display: none !important; }
  #project-panel   { display: none !important; }
  .ks-bottom-sheet { display: none !important; }
  .ks-overlay      { display: none !important; }

  /* Overlay: shown when drawer is open */
  .ks-overlay.is-active {
    display: block !important;
    position: fixed !important;
    inset: 0 !important;
    background: rgba(0, 0, 0, 0.38) !important;
    z-index: 199 !important;
  }

  /* Hamburger button: icon + label side by side */
  .ks-hamburger-btn {
    display: flex !important;
    align-items: center;
    gap: 6px;
    min-height: 44px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--ink);
    padding: 0 4px;
    flex-shrink: 0;
    font-family: var(--font-main, 'Open Sans Hebrew', Arial, sans-serif);
    font-size: 15px;
    font-weight: 600;
  }

  /* Mobile top bar: hamburger on one side, lang switcher on the other */
  #mobile-top-bar {
    display: flex !important;
    flex-shrink: 0;
    align-items: center;
    justify-content: space-between;
    padding: 4px 8px 4px 12px;
    background: var(--panel-bg, #fff4e3);
    border-bottom: 2px solid var(--ink);
    box-sizing: border-box;
  }

  html[data-lang="en"] #mobile-top-bar {
    direction: ltr;
    padding: 4px 12px 4px 8px;
  }

  /* Lang switcher: inline in the top bar, not a fixed overlay */
  .lang-switcher {
    position: static !important;
    top: auto !important;
    right: auto !important;
    left: auto !important;
    flex-shrink: 0;
    min-height: 44px !important;
    transition: none !important;
    z-index: auto !important;
  }

  /* Fix 6: Touch targets under 44 px */
  .map-search-btn  { width: 44px !important; height: 44px !important; }
  .clear-all-btn   { min-height: 44px !important; }

  /* Hide the desktop icon-based clear button; the footer one takes its place */
  .filter-clear-row { display: none !important; }

  /* ── Issue 1: Filter footer — remove sticky, scroll with content ── */
  .ks-filter-footer {
    position: static !important;
    bottom: auto !important;
    box-shadow: none !important;
    padding: 12px 16px 16px !important;
  }

  /* Start hidden; JS shows it when filters are active */
  .ks-filter-clear-mobile {
    display: none !important;
  }

  .ks-filter-clear-mobile.is-visible {
    display: inline-flex !important;
    align-items: center;
    gap: 6px;
  }

  .ks-filter-clear-mobile .clear-icon {
    width: 18px !important;
    height: 18px !important;
    flex-shrink: 0;
  }

  /* ── Issue 2: Align section icons vertically with the header text ── */
  .filter-section-header,
  html[data-lang="en"] .filter-section-header {
    align-items: center !important;
  }

  /* align-self on the child overrides the container — must be explicit */
  .section-icon,
  html[data-lang="en"] .section-icon {
    align-self: center !important;
  }

  /* ── Back button: pinned to the far corner (end of inline axis) ── */
  /* RTL: inline-end = physical left   LTR: inline-end = physical right */
  .ks-pin-back {
    display: block !important;
    width: -webkit-fit-content !important;
    width: fit-content !important;
    margin-inline-start: auto !important;
    padding-bottom: 12px !important;
  }

  /* ── Issue 3: Unified search bar ── */
  .search-input-group {
    border: 1.5px solid var(--ink, #2b4a45) !important;
    border-radius: 50px !important;
    overflow: hidden !important;
    display: flex !important;
  }

  .map-search-input {
    border: none !important;
    border-radius: 0 !important;
    outline: none !important;
    box-shadow: none !important;
  }

  .map-search-btn {
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  /* ── Issue 4: Mobile pin detail panel ── */
  .ks-pin-detail {
    padding: 12px 16px 16px;
    direction: rtl;
    font-family: var(--font-main, 'Open Sans Hebrew', Arial, sans-serif);
  }

  html[data-lang="en"] .ks-pin-detail {
    direction: ltr;
  }

  .ks-pin-back {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: none;
    border: none;
    color: var(--ink, #2b4a45);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    padding: 4px 0 12px;
    margin-inline-start: 6px;
    font-family: inherit;
  }

  .ks-pin-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--ink, #2b4a45);
    margin: 0 0 8px;
    line-height: 1.3;
  }

  .ks-pin-meta {
    font-size: 13px;
    color: var(--ink, #2b4a45);
    opacity: 0.75;
    margin: 0 0 12px;
  }

  .ks-pin-image {
    width: 100%;
    height: auto;
    border-radius: 10px;
    margin: 0 0 14px;
    display: block;
  }

  .ks-pin-description {
    font-size: 14px;
    color: var(--ink, #2b4a45);
    line-height: 1.6;
    margin: 0 0 16px;
  }

  .ks-pin-link {
    display: inline-block;
    padding: 8px 20px;
    background: var(--ink, #2b4a45);
    color: var(--panel-bg, #fff4e3);
    border-radius: 50px;
    font-size: 14px;
    font-weight: 600;
    text-decoration: none;
    font-family: inherit;
  }

  /* ── Mobile search results list ── */
  .ks-search-results {
    padding: 12px 0 16px;
    font-family: var(--font-main, 'Open Sans Hebrew', Arial, sans-serif);
    direction: rtl;
  }

  html[data-lang="en"] .ks-search-results {
    direction: ltr;
  }

  .ks-search-results-title {
    font-size: 13px;
    font-weight: 600;
    color: var(--ink, #2b4a45);
    opacity: 0.7;
    margin: 0 16px 8px;
  }

  .ks-search-results-list {
    list-style: none;
    margin: 0;
    padding: 0;
  }

  .ks-search-result-item {
    border-bottom: 1px solid rgba(43, 74, 69, 0.15);
    padding: 0;
  }

  .ks-search-result-item:last-child {
    border-bottom: none;
  }

  .ks-search-result-title {
    display: block;
    width: 100%;
    text-align: inherit;
    background: none;
    border: none;
    padding: 10px 16px 4px;
    font-size: 15px;
    font-weight: 700;
    color: var(--ink, #2b4a45);
    cursor: pointer;
    font-family: inherit;
    line-height: 1.3;
  }

  .ks-search-result-excerpt {
    font-size: 12px;
    color: var(--ink, #2b4a45);
    opacity: 0.65;
    margin: 0;
    padding: 0 16px 10px;
    line-height: 1.5;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
  }

  .ks-search-empty {
    font-size: 14px;
    color: var(--ink, #2b4a45);
    opacity: 0.6;
    padding: 8px 16px;
    margin: 0;
  }
}
