/* Project map action sheet. The >=1024px horizontal split is untouched. */
.project-map-count--sheet { display: none; }

.project-map-placeholder {
  position: absolute;
  inset: 0;
  z-index: 450;
  overflow: hidden;
  background:
    linear-gradient(35deg, transparent 46%, rgba(134, 144, 133, 0.18) 47% 49%, transparent 50%),
    linear-gradient(145deg, transparent 55%, rgba(134, 144, 133, 0.14) 56% 58%, transparent 59%),
    #e8ebe5;
  opacity: 1;
  visibility: visible;
  pointer-events: none;
  transition: opacity 260ms ease, visibility 260ms ease;
}

.project-map-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(100deg, transparent 30%, rgba(255, 255, 255, 0.5) 48%, transparent 66%);
  transform: translateX(-100%);
  animation: projectMapGhost 1.5s ease-in-out infinite;
}

.project-map-placeholder__content {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 2;
  display: grid;
  width: min(360px, calc(100% - 40px));
  justify-items: center;
  gap: 8px;
  padding: 24px;
  color: var(--color-ink);
  text-align: center;
  transform: translate(-50%, -50%);
}

.project-map-placeholder__content > i {
  display: grid;
  width: 48px;
  height: 48px;
  margin-bottom: 4px;
  place-items: center;
  border: 1px solid rgba(36, 72, 60, 0.18);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.76);
  color: var(--color-brand);
  font-size: 1.4rem;
}

.project-map-placeholder__content h2 {
  margin: 0;
  font-size: clamp(1.1rem, 2vw, 1.35rem);
  line-height: 1.15;
}

.project-map-placeholder__content p {
  max-width: 30ch;
  margin: 0;
  color: var(--color-muted);
  font-size: 0.86rem;
  line-height: 1.4;
}

.project-map-placeholder > span {
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50% 50% 50% 0;
  background: rgba(36, 72, 60, 0.22);
  transform: rotate(-45deg);
}

.project-map-placeholder > span:nth-of-type(1) { top: 28%; left: 28%; }
.project-map-placeholder > span:nth-of-type(2) { top: 48%; left: 62%; }
.project-map-placeholder > span:nth-of-type(3) { top: 68%; left: 43%; }

.project-map-placeholder.is-retired {
  opacity: 0;
  visibility: hidden;
}

@keyframes projectMapGhost {
  to { transform: translateX(100%); }
}

@media (prefers-reduced-motion: reduce) {
  .project-map-placeholder::after { animation: none; }
}

.project-map-page .leaflet-control-attribution,
.project-map-page .leaflet-control-attribution a,
.project-map-page .maplibregl-ctrl-attrib,
.project-map-page .maplibregl-ctrl-attrib a {
  padding: 1px 2px;
  font-size: 7px !important;
  line-height: 1 !important;
}

@media (min-width: 1024px) {
  .project-map-page {
    --project-map-top: var(--header-height, 77px);
    display: grid;
    height: 100vh;
    height: 100dvh;
    min-height: 100vh;
    min-height: 100dvh;
    grid-template-columns: minmax(330px, 29vw) minmax(0, 1fr);
    padding-top: var(--project-map-top);
    overflow: hidden;
  }

  .project-map-panel {
    position: relative;
    inset: auto;
    order: initial;
    width: auto;
    height: calc(100dvh - var(--project-map-top));
    max-height: none;
    border-right: 1px solid var(--color-line);
    border-bottom: 0;
  }

  .project-map-list-view {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-row: 1 / -1;
    grid-template-rows: auto auto minmax(0, 1fr);
  }

  .project-map-list-shell {
    max-height: none;
  }

  .project-map-stage {
    order: initial;
    width: auto;
    height: calc(100dvh - var(--project-map-top));
    min-height: 0;
  }

  .project-map-selection-stack {
    bottom: 24px;
    width: min(520px, calc(100% - 48px));
  }

  .project-map-selection {
    grid-template-columns: 1fr;
    overflow: hidden;
  }

  .project-map-selection__body {
    display: grid;
    grid-template-columns: minmax(0, 1fr) 150px;
    grid-template-rows: auto auto minmax(0, 1fr) auto;
    column-gap: 16px;
    padding: 16px;
  }

  .project-map-selection__back-row { display: none; }

  .project-map-selection__body > :not(.project-map-selection__image) {
    grid-column: 1;
  }

  .project-map-selection__image {
    width: 100%;
    height: auto;
    min-height: 0;
    aspect-ratio: 1;
    grid-column: 2;
    grid-row: 1 / -1;
    align-self: center;
    object-fit: cover;
  }

  .project-map-selection__title {
    display: -webkit-box;
    margin: 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    line-clamp: 2;
  }

  .project-map-selection__description {
    display: -webkit-box;
    margin: 8px 0 0;
    overflow: hidden;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 3;
    line-clamp: 3;
  }

  .project-map-selection__footer {
    margin-top: 12px;
  }

  .project-map-selection__footer > .home-media-hero__button--primary {
    border-color: #111;
    background: #111;
    color: #fff;
  }
}

@media (max-width: 1023.98px) {
  html:has(.project-map-page),
  body:has(.project-map-page) {
    height: 100%;
    overflow: hidden;
    overscroll-behavior: none;
  }

  body:has(.project-map-page) .header {
    position: fixed;
    inset: 0 0 auto;
    width: 100%;
  }

  .project-map-page {
    --project-map-top: var(--header-height, 68px);
    position: fixed;
    inset: 0;
    display: block;
    width: 100%;
    height: 100vh;
    height: 100dvh;
    min-height: 0;
    padding-top: var(--project-map-top);
    overflow: hidden;
    background: #fff;
  }

  .project-map-stage {
    position: absolute;
    inset: var(--project-map-top) 0 auto;
    width: 100%;
    height: calc((100dvh - var(--project-map-top)) / 2);
    min-height: 0;
  }

  .project-map-page__canvas {
    width: 100%;
    height: 100%;
    min-height: 0;
    border: 0;
  }

  .project-map-panel {
    position: absolute;
    inset: auto 0 0;
    z-index: 500;
    display: grid;
    width: 100%;
    height: calc((100dvh - var(--project-map-top)) / 2);
    max-height: none;
    grid-template-rows: minmax(0, 1fr);
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: 0 -16px 44px rgba(17, 17, 17, 0.18);
  }

  .project-map-list-view {
    display: grid;
    height: 100%;
    min-height: 0;
    grid-template-rows: auto minmax(0, 1fr) auto;
  }

  .project-map-list-view[hidden],
  .project-map-selection-stack[hidden] { display: none !important; }

  .project-map-panel::before {
    display: none;
  }

  .project-map-panel__header {
    position: relative;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: start;
    padding: 22px 18px 10px;
  }

  .project-map-panel__header > p:not(.project-map-count),
  .project-map-panel__eyebrow {
    display: none;
  }

  .project-map-panel__header .project-map-count--sheet {
    display: block;
    grid-column: 2;
    margin: 2px 0 0 12px;
    color: var(--color-muted);
    white-space: nowrap;
  }

  .project-map-count--desktop { display: none; }

  .project-map-panel__header h1 {
    font-size: clamp(1.25rem, 4.5vw, 1.7rem) !important;
    line-height: 1.1 !important;
  }

  .project-map-list-shell {
    min-height: 0;
    max-height: none;
    overflow: hidden;
    overscroll-behavior: contain;
    scrollbar-gutter: stable;
    -webkit-overflow-scrolling: touch;
  }

  .project-map-list { padding-bottom: 10px; }

  .project-map-list__item {
    min-height: 72px;
    padding: 8px 18px;
  }

  .project-map-panel__tools {
    position: relative;
    z-index: 3;
    order: 3;
    padding: 10px 14px max(10px, env(safe-area-inset-bottom));
    border-top: 1px solid var(--color-line);
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 -12px 30px rgba(17, 17, 17, 0.08);
  }

  .project-map-search { min-height: 48px; }

  .project-map-selection-stack {
    position: relative;
    inset: auto;
    z-index: auto;
    display: block;
    width: 100%;
    height: 100%;
    transform: none;
    pointer-events: auto;
  }

  .project-map-overview {
    position: absolute;
    top: 14px;
    left: 14px;
    z-index: 2;
    min-height: 40px;
    pointer-events: auto;
  }

  .project-map-selection {
    position: relative;
    inset: auto;
    display: grid;
    width: 100%;
    height: 100%;
    grid-template-columns: 1fr;
    overflow: hidden;
    border: 0;
    border-radius: 0;
    background: #fff;
    box-shadow: none;
    transform: none;
    pointer-events: auto;
  }

  .project-map-selection::after {
    content: "";
    position: absolute;
    right: 0;
    bottom: 0;
    left: 0;
    z-index: 4;
    height: 8rem;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), #fff 88%);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 160ms ease, visibility 160ms ease;
  }

  .project-map-selection.has-detail-overflow-end::after {
    opacity: 1;
    visibility: visible;
  }

  .project-map-selection[hidden] { display: none; }

  .project-map-selection__body {
    display: flex;
    height: 100%;
    min-height: 100%;
    align-content: initial;
    flex-direction: column;
    padding: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
  }

  .project-map-selection__back-row {
    position: sticky;
    top: 0;
    z-index: 4;
    display: flex;
    width: 100%;
    min-height: 64px;
    min-width: 0;
    align-items: center;
    margin: 0;
    padding-inline: 9px;
    border-bottom: 1px solid rgba(17, 17, 17, 0.12);
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 1;
    transform: none;
    transition: none;
  }

  .project-map-selection__back {
    display: inline-flex;
    width: max-content;
    min-width: 0;
    height: 44px;
    min-height: 44px;
    flex: 0 0 auto;
    position: relative;
    z-index: 2;
    margin: 0;
    padding: 0 4px;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border: 0;
    background: transparent;
    color: var(--color-ink);
    font: 600 0.9rem/1 var(--font-sans);
    white-space: nowrap;
    transform: translateY(1px);
  }

  .project-map-selection__sheet-title {
    position: absolute;
    top: 50%;
    left: 50%;
    width: calc(100% - 140px);
    max-width: 520px;
    min-width: 0;
    margin: 0 !important;
    padding: 0;
    overflow: hidden;
    font-size: 1.15rem !important;
    line-height: 1.2 !important;
    text-align: center;
    text-overflow: ellipsis;
    transform: translate(-50%, -50%);
    white-space: nowrap;
    pointer-events: none;
  }

  .project-map-selection__meta { display: none; }

  .project-map-selection__body > .project-map-selection__title { display: none; }

  .project-map-selection__image {
    width: 100%;
    height: clamp(150px, 22dvh, 230px);
    margin: 0 0 14px;
    padding-inline: 9px;
    object-fit: cover;
  }

  .project-map-selection__body > .project-map-selection__description {
    display: block;
    margin: 0 9px;
    padding-inline: 9px;
    padding-top: 0;
    padding-bottom: 15rem;
    opacity: 1;
    transform: none;
    transition: none;
  }

  .project-map-selection__footer {
    position: absolute;
    right: 0;
    bottom: max(14px, env(safe-area-inset-bottom));
    left: 0;
    z-index: 5;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 14px;
    border: 0;
    background: transparent;
    box-shadow: none;
    pointer-events: none;
  }

  .project-map-selection__footer > .home-media-hero__button--primary {
    border-color: #111;
    background: #111;
    color: #fff;
    box-shadow: 0 8px 20px rgba(17, 17, 17, 0.16);
    pointer-events: auto;
  }

  .project-map-selection__approximate { display: none; }
}

@media (max-width: 560px) {
  .project-map-selection__body {
    padding-right: 0;
    padding-left: 0;
  }

  .project-map-selection h2 { font-size: 1.25rem !important; }
}
