/* ========================================
   CITY NEIGHBORHOOD GIS MAP
======================================== */

.neighborhood-gis-section[hidden] {
  display: none !important;
}

.neighborhood-gis-section {
  background: var(--background-soft);
}

.neighborhood-gis-section .section-heading {
  max-width: 820px;
}

/* ========================================
   MAP LAYOUT
======================================== */

.map-layout {
  display: grid;

  grid-template-columns:
    minmax(0, 1.55fr)
    minmax(260px, 0.45fr);

  gap: 28px;

  align-items: stretch;
}

.map-card {
  min-width: 0;

  padding: 18px;

  background: #ffffff;

  border: 1px solid var(--border);

  border-radius: var(--radius-large);

  box-shadow: var(--shadow-soft);
}

.community-map-shell {
  position: relative;

  width: 100%;
  min-height: 560px;

  overflow: hidden;

  background: linear-gradient(145deg, #e9eef5 0%, #dce4ee 100%);

  border-radius: 14px;
}

.community-map-svg {
  display: block;

  width: 100%;
  height: 560px;

  overflow: visible;
}

/* ========================================
   NEIGHBORHOOD POLYGONS
======================================== */

.community-map-path {
  fill: #b8d2f6;
  fill-opacity: 0.95;

  stroke: #52606f;
  stroke-width: 1.25;

  vector-effect: non-scaling-stroke;

  cursor: pointer;

  transition:
    fill 150ms ease,
    fill-opacity 150ms ease,
    stroke 150ms ease,
    filter 150ms ease;
}

.community-map-path:hover,
.community-map-path:focus,
.community-map-path.is-active {
  fill: var(--brand-primary);
  fill-opacity: 0.9;

  stroke: #ffffff;
  stroke-width: 2;

  outline: none;

  filter: drop-shadow(0 3px 6px rgba(31, 106, 225, 0.3));
}

.community-map-path.is-selected {
  fill: var(--brand-primary-dark);
  fill-opacity: 1;

  stroke: #ffffff;
  stroke-width: 2.25;
}

/*
 * Portland's official neighborhood
 * region layer contains some overlapping
 * polygons.
 *
 * Keeping opacity below 1 makes those
 * overlaps visible instead of hiding them.
 */

/* ========================================
   MAP TOOLTIP
======================================== */

.community-map-tooltip {
  position: absolute;

  left: 18px;

  bottom: 18px;

  z-index: 5;

  display: flex;

  flex-direction: column;

  max-width: calc(100% - 36px);

  padding: 13px 16px;

  background: rgba(24, 33, 45, 0.94);

  border-radius: 11px;

  box-shadow: 0 10px 28px rgba(24, 33, 45, 0.2);

  pointer-events: none;
}

.community-map-tooltip-label {
  margin-bottom: 2px;

  color: #9dc1ff;

  font-family: 'Poppins', sans-serif;

  font-size: 9px;

  font-weight: 700;

  letter-spacing: 0.1em;

  text-transform: uppercase;
}

.community-map-tooltip strong {
  color: #ffffff;

  font-family: 'Poppins', sans-serif;

  font-size: 17px;

  line-height: 1.3;
}

.community-map-tooltip span:last-child {
  margin-top: 2px;

  color: rgba(255, 255, 255, 0.72);

  font-size: 11px;
}

/* ========================================
   SOURCE
======================================== */

.map-source {
  margin-top: 12px;

  color: var(--text-secondary);

  font-size: 11px;

  line-height: 1.5;
}

.map-source a {
  color: var(--brand-primary);

  font-weight: 700;
}

/* ========================================
   NEIGHBORHOOD LIST
======================================== */

.map-neighborhood-panel {
  display: flex;

  flex-direction: column;

  height: 600px;

  min-height: 0;

  overflow: hidden;

  background: #ffffff;

  border: 1px solid var(--border);

  border-radius: 16px;

  box-shadow: var(--shadow-soft);
}

.map-neighborhood-panel .map-neighborhood-list {
  flex: 1 1 auto;

  height: auto;

  min-height: 0;

  padding: 8px 0 10px;

  overflow-y: auto;
}

@media (max-width: 991.98px) {
  .map-neighborhood-panel {
    height: 330px;
  }
}

@media (max-width: 767.98px) {
  .map-neighborhood-panel {
    height: 300px;
  }
}

.map-list-heading {
  flex: 0 0 auto;

  padding: 20px 20px 16px;

  border-bottom: 1px solid var(--border);
}

.map-list-heading span {
  display: block;

  margin-bottom: 4px;

  color: var(--text-primary);

  font-family: 'Poppins', sans-serif;

  font-size: 16px;

  font-weight: 700;
}

.map-list-heading small {
  display: block;

  color: var(--text-secondary);

  font-size: 11px;

  line-height: 1.5;
}

.map-neighborhood-list {
  display: flex;

  flex-direction: column;

  gap: 5px;

  min-height: 0;

  padding: 12px;

  overflow-y: auto;

  overscroll-behavior: contain;
}

.map-list-item {
  display: block;

  width: 100%;

  padding: 9px 11px;

  color: var(--text-primary);

  background: transparent;

  border: 0;

  border-radius: 8px;

  font-family: 'Open Sans', sans-serif;

  font-size: 12px;

  font-weight: 600;

  line-height: 1.35;

  text-align: left;

  cursor: pointer;

  transition:
    background 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.map-list-item:hover,
.map-list-item:focus,
.map-list-item.is-active {
  color: var(--brand-primary-dark);

  background: var(--brand-primary-soft);

  outline: none;

  transform: translateX(2px);
}

.map-list-item.is-selected {
  color: #ffffff;

  background: var(--brand-primary);
}

/* ========================================
   TABLET
======================================== */

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

  .map-neighborhood-panel {
    max-height: none;
  }

  .map-neighborhood-list {
    display: grid;

    grid-template-columns: repeat(3, minmax(0, 1fr));

    max-height: 330px;
  }
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 767.98px) {
  .map-card {
    padding: 10px;

    border-radius: 14px;
  }

  .community-map-shell {
    min-height: 430px;
  }

  .community-map-svg {
    min-height: 430px;
  }

  .community-map-tooltip {
    left: 12px;

    bottom: 12px;

    max-width: calc(100% - 24px);
  }

  .map-neighborhood-list {
    grid-template-columns: repeat(2, minmax(0, 1fr));

    max-height: 360px;
  }
}

@media (max-width: 480px) {
  .community-map-shell {
    min-height: 380px;
  }

  .community-map-svg {
    min-height: 380px;
  }

  .map-neighborhood-list {
    grid-template-columns: 1fr;
  }
}

/* ========================================
   FORCE GIS POLYGONS VISIBLE
======================================== */

#community-map-svg .community-map-path {
  display: block !important;

  fill: #a9c7ef !important;
  fill-opacity: 1 !important;

  stroke: #4f6073 !important;
  stroke-width: 1.4px !important;
  stroke-opacity: 1 !important;

  opacity: 1 !important;

  visibility: visible !important;

  vector-effect: non-scaling-stroke;

  cursor: pointer;
}

#community-map-svg .community-map-path:hover,
#community-map-svg .community-map-path:focus,
#community-map-svg .community-map-path.is-active {
  fill: #1f6ae1 !important;
  fill-opacity: 0.9 !important;

  stroke: #ffffff !important;
  stroke-width: 2px !important;

  opacity: 1 !important;
}

#community-map-svg .community-map-path.is-selected {
  fill: #1756b8 !important;
  fill-opacity: 1 !important;

  stroke: #ffffff !important;
  stroke-width: 2.25px !important;
}

#community-map-svg,
#community-map-paths {
  display: block !important;

  opacity: 1 !important;

  visibility: visible !important;
}

/* ========================================
   MAP FINAL LAYOUT / VISIBILITY
======================================== */

.map-layout {
  display: grid;

  grid-template-columns:
    minmax(0, 1fr)
    300px;

  gap: 26px;

  align-items: stretch;
}

/* MAP */

.map-card {
  min-width: 0;
}

.community-map-shell {
  position: relative;

  width: 100%;
  height: 600px;

  overflow: hidden;

  background: #e7edf4;

  border-radius: 16px;
}

.community-map-svg {
  display: block !important;

  width: 100% !important;
  height: 100% !important;

  opacity: 1 !important;
  visibility: visible !important;
}

/* POLYGONS */

#community-map-svg .community-map-path {
  fill: #aecbf2 !important;

  fill-opacity: 1 !important;

  stroke: #56687a !important;

  stroke-width: 1.25px !important;

  stroke-opacity: 1 !important;

  opacity: 1 !important;

  visibility: visible !important;

  vector-effect: non-scaling-stroke;

  cursor: pointer;

  transition:
    fill 140ms ease,
    stroke 140ms ease,
    filter 140ms ease;
}

#community-map-svg .community-map-path:hover,
#community-map-svg .community-map-path:focus,
#community-map-svg .community-map-path.is-active {
  fill: var(--brand-primary) !important;

  fill-opacity: 1 !important;

  stroke: #ffffff !important;

  stroke-width: 2px !important;

  filter: drop-shadow(0 3px 6px rgba(31, 106, 225, 0.28));
}

/* ========================================
   NEIGHBORHOOD LIST
======================================== */

.map-neighborhood-list {
  display: flex;

  flex-direction: column;

  width: 100%;

  height: 600px;

  min-height: 0;

  overflow: hidden;

  background: #ffffff;

  border: 1px solid var(--border);

  border-radius: 16px;

  box-shadow: var(--shadow-soft);
}

.map-list-heading {
  flex: 0 0 auto;

  padding: 19px 18px 15px;

  background: #ffffff;

  border-bottom: 1px solid var(--border);
}

.map-list-heading span {
  display: block;

  margin-bottom: 3px;

  color: var(--text-primary);

  font-family: 'Poppins', sans-serif;

  font-size: 16px;

  font-weight: 700;
}

.map-list-heading small {
  display: block;

  color: var(--text-secondary);

  font-size: 11px;

  line-height: 1.45;
}

/*
 * The list itself scrolls.
 *
 * This prevents Portland's much larger
 * neighborhood list from making the whole
 * section thousands of pixels tall.
 */

.map-list-heading ~ .map-list-item:first-of-type {
  margin-top: 8px;
}

.map-neighborhood-list {
  overflow-y: auto;

  scrollbar-width: thin;

  scrollbar-color: #b9c6d4 transparent;
}

.map-neighborhood-list::-webkit-scrollbar {
  width: 7px;
}

.map-neighborhood-list::-webkit-scrollbar-track {
  background: transparent;
}

.map-neighborhood-list::-webkit-scrollbar-thumb {
  background: #b9c6d4;

  border-radius: 999px;
}

.map-list-item {
  flex: 0 0 auto;

  display: block;

  width: calc(100% - 20px);

  margin: 0 10px 5px;

  padding: 9px 11px;

  color: var(--text-primary);

  background: transparent;

  border: 0;

  border-radius: 8px;

  font-family: 'Open Sans', sans-serif;

  font-size: 12px;

  font-weight: 600;

  line-height: 1.35;

  text-align: left;

  cursor: pointer;

  transition:
    background 140ms ease,
    color 140ms ease,
    transform 140ms ease;
}

.map-list-item:hover,
.map-list-item:focus,
.map-list-item.is-active {
  color: var(--brand-primary-dark);

  background: var(--brand-primary-soft);

  outline: none;

  transform: translateX(2px);
}

/* TOOLTIP */

.community-map-tooltip {
  position: absolute;

  left: 16px;

  bottom: 16px;

  z-index: 5;

  max-width: calc(100% - 32px);

  padding: 12px 15px;

  color: #ffffff;

  background: rgba(24, 33, 45, 0.94);

  border-radius: 10px;

  pointer-events: none;
}

.community-map-tooltip-label {
  display: block;

  color: #9dc1ff;

  font-size: 9px;

  font-weight: 700;

  letter-spacing: 0.08em;

  text-transform: uppercase;
}

.community-map-tooltip strong {
  display: block;

  color: #ffffff;

  font-family: 'Poppins', sans-serif;

  font-size: 16px;
}

#community-map-tooltip-action {
  display: block;

  margin-top: 2px;

  color: rgba(255, 255, 255, 0.72);

  font-size: 11px;
}

/* ========================================
   TABLET
======================================== */

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

  .community-map-shell {
    height: 520px;
  }

  .map-neighborhood-list {
    height: 330px;
  }
}

/* ========================================
   MOBILE
======================================== */

@media (max-width: 767.98px) {
  .community-map-shell {
    height: 430px;
  }

  .map-neighborhood-list {
    height: 300px;
  }

  .map-list-item {
    font-size: 13px;
  }
}

.map-disclaimer {
  margin: 8px 0 0;

  color: var(--text-secondary);

  font-size: 10px;
  line-height: 1.5;

  font-style: italic;
}

/* ========================================
   COMMUNITY MAP — DESKTOP HEIGHT FIX
======================================== */

@media (min-width: 992px) {
  .neighborhood-map-section .map-layout {
    align-items: start;
  }

  /*
   * Map itself
   */

  .neighborhood-map-section .community-map-shell {
    height: 410px;

    min-height: 0;
  }

  .neighborhood-map-section .community-map-svg {
    width: 100%;
    height: 100%;

    min-height: 0;
  }

  /*
   * Source attribution sits naturally
   * underneath the map.
   */

  .neighborhood-map-section .map-card {
    height: auto;
  }

  .neighborhood-map-section .map-source {
    margin-top: 8px;
    margin-bottom: 0;

    padding-bottom: 0;
  }

  /*
   * Sidebar gets its own fixed height.
   */

  .neighborhood-map-section .map-neighborhood-panel {
    display: flex;

    flex-direction: column;

    height: 450px;

    min-height: 0;

    overflow: hidden;
  }

  .neighborhood-map-section .map-list-heading {
    flex: 0 0 auto;
  }

  .neighborhood-map-section .map-neighborhood-list {
    flex: 1 1 auto;

    min-height: 0;

    max-height: none;

    overflow-y: auto;
  }
}

/* ========================================
   COMMUNITY MAP — FINAL DESKTOP OVERRIDES
======================================== */

@media (min-width: 992px) {
  .neighborhood-map-section .map-layout {
    align-items: start !important;
  }

  /* LEFT CARD */

  .neighborhood-map-section .map-card {
    display: block !important;

    height: auto !important;
    min-height: 0 !important;

    align-self: start !important;

    padding-bottom: 0 !important;
    margin-bottom: 0 !important;
  }

  /* MAP */

  .neighborhood-map-section .community-map-shell {
    display: block;

    width: 100%;
    height: 410px !important;
    min-height: 0 !important;

    margin: 0 !important;
  }

  .neighborhood-map-section .community-map-svg {
    display: block;

    width: 100%;
    height: 100%;

    min-height: 0 !important;

    margin: 0 !important;
    padding: 0 !important;
  }

  /* SOURCE LINE */

  .neighborhood-map-section .map-source {
    display: block !important;

    height: auto !important;
    min-height: 0 !important;

    margin: 8px 0 0 !important;

    padding: 0 !important;

    line-height: 1.4;
  }

  .neighborhood-map-section .map-source a {
    margin: 0 !important;
    padding: 0 !important;
  }

  /* SIDEBAR */

  .neighborhood-map-section .map-neighborhood-panel {
    display: flex;

    flex-direction: column;

    height: 440px !important;
    min-height: 0 !important;

    overflow: hidden;
  }

  .neighborhood-map-section .map-list-heading {
    flex: 0 0 auto;
  }

  .neighborhood-map-section .map-neighborhood-list {
    flex: 1 1 auto;

    min-height: 0 !important;
    max-height: none !important;

    overflow-y: auto;
  }
}
