.sfpm-section,
.sfpm-section * {
  box-sizing: border-box;
}

.sfpm-section {
  width: 100%;
  --sfpm-marker-size: 54px;
  --sfpm-panel-width: 680px;
  --sfpm-panel-height: 280px;
  --sfpm-accent: #075fc9;
  --sfpm-accent-dark: #064fa7;
}

.sfpm-copy {
  max-width: 1040px;
  margin: 0 auto 36px;
  text-align: center;
}

.sfpm-heading {
  margin: 0 0 18px;
  font-size: clamp(30px, 4vw, 48px);
  line-height: 1.1;
  letter-spacing: -0.035em;
}

.sfpm-intro {
  max-width: 850px;
  margin: 0 auto;
  color: #4b5563;
  font-size: clamp(17px, 2vw, 21px);
  line-height: 1.45;
}

.sfpm-tags {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 24px;
}

.sfpm-tag {
  display: inline-flex;
  min-height: 40px;
  padding: 8px 17px;
  align-items: center;
  border: 1px solid #cfe0f6;
  border-radius: 999px;
  background: #f4f8fd;
  color: var(--sfpm-accent);
  font-size: 14px;
  font-weight: 600;
  line-height: 1.2;
}

.sfpm-map-shell {
  position: relative;
  isolation: isolate;
  width: 100%;
  height: var(--sfpm-map-height, 600px);
  min-height: 320px;
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.08);
  border-radius: 18px;
  background: #eaf1f7;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.08);
}

.sfpm-map {
  width: 100%;
  height: 100%;
  min-height: inherit;
}

.sfpm-loading {
  position: absolute;
  z-index: 8;
  inset: 0;
  display: grid;
  place-items: center;
  pointer-events: none;
  background: linear-gradient(110deg, #e8eef5 8%, #f7f9fc 18%, #e8eef5 33%);
  background-size: 200% 100%;
  animation: sfpm-shimmer 1.35s linear infinite;
  transition: opacity 220ms ease, visibility 220ms ease;
}

.sfpm-loading span {
  width: 42px;
  height: 42px;
  border: 4px solid rgba(7, 95, 201, 0.16);
  border-top-color: var(--sfpm-accent);
  border-radius: 50%;
  animation: sfpm-spin 0.8s linear infinite;
}

.sfpm-is-ready .sfpm-loading,
.sfpm-has-error .sfpm-loading {
  opacity: 0;
  visibility: hidden;
}

.sfpm-error,
.sfpm-noscript {
  position: absolute;
  z-index: 9;
  inset: 20px;
  display: grid;
  margin: 0;
  padding: 30px;
  place-items: center;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.96);
  color: #7f1d1d;
  text-align: center;
  font-weight: 600;
}

.sfpm-editor-notice {
  padding: 18px 20px;
  border-left: 4px solid #dba617;
  background: #fff8e5;
  color: #3c434a;
}

/*
 * MapLibre positioning hosts.
 *
 * MapLibre writes an inline transform to these outer elements. Keeping buttons,
 * hover effects and theme styles on inner elements prevents Elementor/global
 * button CSS from overriding map coordinates or animating marker movement.
 */
.sfpm-map-shell .maplibregl-marker.sfpm-marker-root,
.sfpm-map-shell .maplibregl-marker.sfpm-cluster-root,
.sfpm-map-shell .maplibregl-marker.sfpm-spider-root,
.sfpm-map-shell .maplibregl-marker.sfpm-marker-root:hover,
.sfpm-map-shell .maplibregl-marker.sfpm-cluster-root:hover,
.sfpm-map-shell .maplibregl-marker.sfpm-spider-root:hover,
.sfpm-map-shell .maplibregl-marker.sfpm-marker-root:focus,
.sfpm-map-shell .maplibregl-marker.sfpm-cluster-root:focus,
.sfpm-map-shell .maplibregl-marker.sfpm-spider-root:focus,
.sfpm-map-shell .maplibregl-marker.sfpm-marker-root:active,
.sfpm-map-shell .maplibregl-marker.sfpm-cluster-root:active,
.sfpm-map-shell .maplibregl-marker.sfpm-spider-root:active {
  display: block !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  opacity: 1;
  pointer-events: auto;
  translate: none !important;
  rotate: none !important;
  scale: none !important;
  transition: none !important;
  transition-property: none !important;
  transition-duration: 0s !important;
  animation: none !important;
}

.sfpm-map-shell .maplibregl-marker.sfpm-marker-root::before,
.sfpm-map-shell .maplibregl-marker.sfpm-marker-root::after,
.sfpm-map-shell .maplibregl-marker.sfpm-cluster-root::before,
.sfpm-map-shell .maplibregl-marker.sfpm-cluster-root::after,
.sfpm-map-shell .maplibregl-marker.sfpm-spider-root::before,
.sfpm-map-shell .maplibregl-marker.sfpm-spider-root::after {
  content: none !important;
  display: none !important;
}

.sfpm-marker-root {
  width: var(--sfpm-marker-size);
  height: var(--sfpm-marker-size);
}

.sfpm-cluster-root {
  width: 58px;
  height: 58px;
}

.sfpm-spider-root {
  width: 34px;
  height: 34px;
}

/* Individual project photo marker. */
.sfpm-marker {
  all: unset;
  position: relative;
  display: block !important;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  color: inherit !important;
  cursor: pointer;
  line-height: 1 !important;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.sfpm-marker::before,
.sfpm-marker::after {
  content: none !important;
  display: none !important;
}

.sfpm-marker-visual {
  position: relative;
  display: block;
  width: 100%;
  height: 100%;
  overflow: hidden;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: var(--sfpm-accent);
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.34), 0 0 0 2px rgba(15, 23, 42, 0.14);
  transform: scale(1);
  transform-origin: center;
  transition: transform 150ms ease, box-shadow 150ms ease;
}

.sfpm-marker-visual::after {
  content: "";
  position: absolute;
  inset: 0;
  border-radius: inherit;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.36);
  pointer-events: none;
}

.sfpm-marker:hover .sfpm-marker-visual,
.sfpm-marker:focus-visible .sfpm-marker-visual,
.sfpm-marker-active .sfpm-marker-visual {
  transform: scale(1.08);
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.38), 0 0 0 4px rgba(7, 95, 201, 0.24);
}

.sfpm-marker:focus-visible {
  outline: none !important;
}

.sfpm-marker-image {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}

.sfpm-marker-fallback {
  display: grid;
  width: 100%;
  height: 100%;
  place-items: center;
  color: #ffffff;
}

.sfpm-marker-fallback-icon {
  width: 44%;
  height: 44%;
}

/* Cluster marker. The outer .sfpm-cluster-root owns map positioning. */
.sfpm-cluster-marker {
  all: unset;
  position: relative;
  display: block !important;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  overflow: visible !important;
  border: 0 !important;
  border-radius: 50% !important;
  background: transparent !important;
  box-shadow: none !important;
  filter: none !important;
  color: inherit !important;
  cursor: pointer;
  line-height: 1 !important;
  appearance: none;
  -webkit-appearance: none;
  touch-action: manipulation;
}

.sfpm-cluster-marker::before,
.sfpm-cluster-marker::after {
  content: none !important;
  display: none !important;
}

.sfpm-cluster-visual {
  position: relative;
  display: flex;
  width: 100%;
  height: 100%;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  border: 4px solid #ffffff;
  border-radius: 50%;
  background: var(--sfpm-accent);
  color: #ffffff;
  box-shadow: 0 7px 18px rgba(15, 23, 42, 0.3), 0 0 0 2px rgba(7, 95, 201, 0.2);
  transform: scale(1);
  transform-origin: center;
  transition: transform 150ms ease, background 150ms ease, box-shadow 150ms ease;
}

.sfpm-cluster-visual::before,
.sfpm-cluster-visual::after {
  content: none !important;
  display: none !important;
}

.sfpm-cluster-marker:hover .sfpm-cluster-visual,
.sfpm-cluster-marker:focus-visible .sfpm-cluster-visual {
  background: var(--sfpm-accent-dark);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.34), 0 0 0 4px rgba(7, 95, 201, 0.23);
  transform: scale(1.06);
}

.sfpm-cluster-marker:focus-visible {
  outline: none !important;
}

.sfpm-cluster-count {
  display: block;
  font-size: 19px;
  font-weight: 800;
  line-height: 0.95;
}

.sfpm-cluster-label {
  display: block;
  margin-top: 2px;
  font-size: 8px;
  font-weight: 700;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

/* Center button shown while a dense cluster is expanded into a spider layout. */
.sfpm-spider-hub {
  all: unset;
  display: grid !important;
  box-sizing: border-box;
  width: 100% !important;
  height: 100% !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  place-items: center;
  border: 3px solid #ffffff !important;
  border-radius: 50% !important;
  background: #111827 !important;
  color: #ffffff !important;
  cursor: pointer;
  font: 700 22px/1 Arial, sans-serif !important;
  box-shadow: 0 5px 14px rgba(15, 23, 42, 0.34) !important;
  appearance: none;
  -webkit-appearance: none;
}

.sfpm-spider-hub::before,
.sfpm-spider-hub::after {
  content: none !important;
  display: none !important;
}

/* Never animate child effects while the map itself is moving. */
.sfpm-map-moving .sfpm-marker-visual,
.sfpm-map-moving .sfpm-cluster-visual {
  transform: scale(1) !important;
  transition: none !important;
}

/* Fixed project card: bigger photo, compact information, no page scrolling. */
.sfpm-project-panel {
  position: absolute;
  z-index: 7;
  top: 16px;
  left: 16px;
  width: min(var(--sfpm-panel-width), calc(100% - 88px));
  height: min(var(--sfpm-panel-height), calc(100% - 32px));
  max-height: var(--sfpm-panel-height);
  overflow: hidden;
  border: 1px solid rgba(15, 23, 42, 0.1);
  border-radius: 17px;
  background: rgba(255, 255, 255, 0.985);
  box-shadow: 0 20px 52px rgba(15, 23, 42, 0.26);
  opacity: 0;
  transform: translateY(-10px) scale(0.985);
  transform-origin: top left;
  pointer-events: none;
  transition: opacity 180ms ease, transform 180ms ease;
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

.sfpm-project-panel[hidden] {
  display: none;
}

.sfpm-project-panel-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

.sfpm-panel-card {
  position: relative;
  display: grid;
  width: 100%;
  height: 100%;
  grid-template-columns: minmax(260px, 55%) minmax(0, 45%);
  margin: 0;
  overflow: hidden;
  background: #ffffff;
  color: #111827;
}

.sfpm-panel-media {
  position: relative;
  min-width: 0;
  min-height: 0;
  overflow: hidden;
  background: #e5e7eb;
}

.sfpm-panel-media::after {
  content: "";
  position: absolute;
  inset: auto 0 0;
  height: 45%;
  pointer-events: none;
  background: linear-gradient(to top, rgba(15, 23, 42, 0.36), transparent);
}

.sfpm-panel-image,
.sfpm-panel-image-placeholder {
  display: block;
  width: 100%;
  height: 100%;
}

.sfpm-panel-image {
  object-fit: cover;
  object-position: center;
}

.sfpm-panel-image-placeholder {
  display: grid;
  place-items: center;
  background: linear-gradient(135deg, #dbeafe, #e2e8f0);
  color: var(--sfpm-accent);
}

.sfpm-panel-image-placeholder-icon {
  width: 52px;
  height: 52px;
  opacity: 0.7;
}

.sfpm-panel-expand {
  position: absolute;
  z-index: 2;
  left: 14px;
  bottom: 14px;
  display: inline-flex !important;
  width: auto !important;
  min-width: 0 !important;
  min-height: 36px !important;
  margin: 0 !important;
  padding: 8px 12px !important;
  gap: 7px;
  align-items: center;
  border: 1px solid rgba(255, 255, 255, 0.6) !important;
  border-radius: 999px !important;
  background: rgba(15, 23, 42, 0.78) !important;
  color: #ffffff !important;
  cursor: pointer;
  font-size: 12px !important;
  font-weight: 700 !important;
  line-height: 1 !important;
  box-shadow: 0 5px 16px rgba(15, 23, 42, 0.24) !important;
  backdrop-filter: blur(7px);
  -webkit-backdrop-filter: blur(7px);
}

.sfpm-panel-expand::before,
.sfpm-panel-expand::after {
  content: none !important;
}

.sfpm-panel-expand:hover,
.sfpm-panel-expand:focus-visible {
  background: rgba(7, 95, 201, 0.92) !important;
  outline: none !important;
}

.sfpm-panel-expand-icon {
  width: 15px;
  height: 15px;
}

.sfpm-panel-body {
  display: flex;
  min-width: 0;
  min-height: 0;
  padding: 25px 24px 21px;
  flex-direction: column;
  align-items: flex-start;
  overflow: hidden;
}

.sfpm-panel-title {
  display: -webkit-box;
  overflow: hidden;
  margin: 0 38px 10px 0;
  color: #111827;
  font-size: 22px;
  line-height: 1.18;
  font-weight: 760;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sfpm-panel-location {
  display: flex;
  min-width: 0;
  gap: 7px;
  align-items: flex-start;
  margin: 0 0 12px;
  color: #475569;
  font-size: 13px;
  line-height: 1.35;
}

.sfpm-panel-location span {
  display: -webkit-box;
  overflow: hidden;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 2;
}

.sfpm-panel-location-icon {
  width: 15px;
  height: 15px;
  margin-top: 1px;
  flex: 0 0 15px;
  color: var(--sfpm-accent);
}

.sfpm-panel-excerpt {
  display: -webkit-box;
  overflow: hidden;
  margin: 0;
  color: #374151;
  font-size: 14px;
  line-height: 1.45;
  -webkit-box-orient: vertical;
  -webkit-line-clamp: 4;
}

.sfpm-panel-button {
  display: inline-flex;
  min-height: 38px;
  margin-top: auto;
  padding: 8px 15px;
  justify-content: center;
  align-items: center;
  border-radius: 8px;
  background: var(--sfpm-accent);
  color: #ffffff !important;
  font-size: 13px;
  font-weight: 700;
  text-decoration: none !important;
  transition: transform 150ms ease, background 150ms ease;
}

.sfpm-panel-button:hover,
.sfpm-panel-button:focus-visible {
  background: var(--sfpm-accent-dark);
  transform: translateY(-1px);
  outline: none;
}

.sfpm-panel-close {
  position: absolute;
  z-index: 4;
  top: 11px;
  right: 11px;
  display: grid !important;
  width: 32px !important;
  height: 32px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  place-items: center;
  border: 0 !important;
  border-radius: 50% !important;
  background: rgba(255, 255, 255, 0.96) !important;
  color: #111827 !important;
  cursor: pointer;
  font: 400 23px/1 Arial, sans-serif !important;
  box-shadow: 0 2px 10px rgba(15, 23, 42, 0.23) !important;
}

.sfpm-panel-close::before,
.sfpm-panel-close::after {
  content: none !important;
}

.sfpm-panel-close:hover,
.sfpm-panel-close:focus-visible {
  background: #ffffff !important;
  outline: 3px solid rgba(7, 95, 201, 0.25) !important;
}

/* Optional large photo viewer opens only when requested. */
.sfpm-photo-viewer {
  position: absolute;
  z-index: 20;
  inset: 0;
  display: grid;
  padding: 34px;
  place-items: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 180ms ease;
}

.sfpm-photo-viewer[hidden] {
  display: none;
}

.sfpm-photo-viewer-visible {
  opacity: 1;
  pointer-events: auto;
}

.sfpm-photo-viewer-backdrop {
  position: absolute;
  inset: 0;
  width: 100% !important;
  height: 100% !important;
  margin: 0 !important;
  padding: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: rgba(2, 6, 23, 0.76) !important;
  cursor: zoom-out;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}

.sfpm-photo-viewer-backdrop::before,
.sfpm-photo-viewer-backdrop::after {
  content: none !important;
}

.sfpm-photo-viewer-frame {
  position: relative;
  z-index: 1;
  display: flex;
  max-width: min(1040px, 92%);
  max-height: 92%;
  margin: 0;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 16px;
  background: #0f172a;
  box-shadow: 0 26px 80px rgba(0, 0, 0, 0.45);
}

.sfpm-photo-viewer-image {
  display: block;
  max-width: 100%;
  max-height: calc(var(--sfpm-map-height, 600px) - 105px);
  object-fit: contain;
  background: #020617;
}

.sfpm-photo-viewer-caption {
  min-height: 42px;
  padding: 11px 52px 11px 16px;
  color: #ffffff;
  font-size: 14px;
  font-weight: 650;
  line-height: 1.35;
}

.sfpm-photo-viewer-close {
  position: absolute;
  z-index: 2;
  top: 10px;
  right: 10px;
  display: grid !important;
  width: 36px !important;
  height: 36px !important;
  min-width: 0 !important;
  min-height: 0 !important;
  margin: 0 !important;
  padding: 0 !important;
  place-items: center;
  border: 1px solid rgba(255, 255, 255, 0.42) !important;
  border-radius: 50% !important;
  background: rgba(15, 23, 42, 0.82) !important;
  color: #ffffff !important;
  cursor: pointer;
  font: 400 25px/1 Arial, sans-serif !important;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3) !important;
}

.sfpm-photo-viewer-close::before,
.sfpm-photo-viewer-close::after {
  content: none !important;
}

.sfpm-map-shell .maplibregl-ctrl-group {
  overflow: hidden;
  border-radius: 9px;
  box-shadow: 0 3px 12px rgba(15, 23, 42, 0.18);
}

.sfpm-map-shell .maplibregl-ctrl-attrib {
  font-size: 10px;
}

@keyframes sfpm-spin {
  to { transform: rotate(360deg); }
}

@keyframes sfpm-shimmer {
  to { background-position-x: -200%; }
}

@media (max-width: 767px) {
  .sfpm-copy {
    margin-bottom: 25px;
  }

  .sfpm-tags {
    gap: 7px;
  }

  .sfpm-tag {
    min-height: 36px;
    padding: 7px 12px;
    font-size: 12px;
  }

  .sfpm-map-shell {
    height: min(var(--sfpm-map-height, 520px), 72vh);
    min-height: 430px;
    border-radius: 14px;
  }

  .sfpm-marker-root {
    width: min(var(--sfpm-marker-size), 48px);
    height: min(var(--sfpm-marker-size), 48px);
  }

  .sfpm-cluster-root {
    width: 52px;
    height: 52px;
  }

  .sfpm-cluster-count {
    font-size: 17px;
  }

  .sfpm-project-panel {
    top: auto;
    right: 12px;
    bottom: 12px;
    left: 12px;
    width: auto;
    height: auto;
    max-height: calc(100% - 24px);
    border-radius: 15px;
    transform: translateY(12px) scale(0.99);
    transform-origin: bottom center;
  }

  .sfpm-project-panel-visible {
    transform: translateY(0) scale(1);
  }

  .sfpm-panel-card {
    display: block;
    height: auto;
    max-height: calc(72vh - 24px);
    overflow-y: auto;
  }

  .sfpm-panel-media {
    height: 190px;
  }

  .sfpm-panel-body {
    min-height: 178px;
    padding: 19px 18px 18px;
  }

  .sfpm-panel-title {
    margin-right: 38px;
    font-size: 19px;
  }

  .sfpm-panel-excerpt {
    -webkit-line-clamp: 3;
  }

  .sfpm-panel-button {
    margin-top: 16px;
  }

  .sfpm-photo-viewer {
    padding: 14px;
  }

  .sfpm-photo-viewer-frame {
    max-width: 100%;
    max-height: 100%;
    border-radius: 13px;
  }

  .sfpm-photo-viewer-image {
    max-height: calc(72vh - 80px);
  }
}

@media (prefers-reduced-motion: reduce) {
  .sfpm-loading,
  .sfpm-loading span,
  .sfpm-marker-visual,
  .sfpm-cluster-visual,
  .sfpm-project-panel,
  .sfpm-photo-viewer,
  .sfpm-panel-button {
    animation: none !important;
    transition: none !important;
  }
}
