/* Three Mile Creek Greenway trail map. Only loaded on the /3mctrailmap/ page. */

/* ---- Full-screen map page: hide the site chrome ---- */
body { overflow: hidden; height: 100%; }
#header-space, #header-outer, #footer-outer { display: none; }

/* Pin the map app to the window so map and sidebar always fill it exactly (no page scroll) */
#trailmap {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  z-index: 100;
}
.admin-bar #trailmap { top: 32px; }
@media screen and (max-width: 782px) {
  .admin-bar #trailmap { top: 46px; }
}

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

/* ---- Basemap switcher (streets / satellite) ---- */
#basemapmenu {
  position: absolute;
  right: 50%;
  top: 10px;
  display: flex;
  border-radius: 4px;
  background: #fff;
  box-shadow: 0 4px 8px rgba(0,0,0,0.10);
}

#basemapmenu button {
  all: unset;
  padding: 6px 10px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.5;
  color: #ccc;
  background: #fff;
  cursor: pointer;
  border-right: 1px solid #999;
}
#basemapmenu button:first-child { border-radius: 4px 0 0 4px; }
#basemapmenu button:last-child  { border-radius: 0 4px 4px 0; }
#basemapmenu button:hover { background: #efefef; }
#basemapmenu button:focus-visible { outline: 2px solid #476f3e; }
#basemapmenu button.menuitemactive { color: #222; }

/* ---- Sidebar ---- */
#sidemenu {
  width: 400px;
  background-color: #fff;
  height: 100%;
  overflow-y: scroll;
  position: absolute;
  top: 0;
  right: 0;
  padding-top: 0;
  transition: 0.600s ease;
  box-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
}

.toggle-collapse {
  z-index: 999;
  position: fixed;
  margin-left: -1.8em;
  margin-top: 1.5em;
  width: 55px;
  height: 55px;
  background-color: #fff;
  outline: inherit;
  border: 0px;
  font-size: 28px;
  color: #ccc;
  box-shadow: -6px 4px 8px 0 rgba(0, 0, 0, 0.2) !important;
}
.toggle-collapse:hover {
  color: #777;
  cursor: pointer;
}

/* ---- Legend ---- */
#legend {
  background-color: #fff;
  font-size: 13.7px !important;
  line-height: 19px;
  margin: 35px 25px 25px 25px;
  padding-bottom: 30px; /* clear the Mapbox attribution, which overlaps the sidebar's bottom edge */
}

#legend h3 {
  text-align: center;
  line-height: .9em;
  margin-bottom: 25px;
}
#legend h3 > span {
  font-weight: normal;
  font-size: 16px;
  display: block;
}

#legend .legend-intro {
  font-size: inherit;
  line-height: inherit;
  padding: 0;
  margin: 0;
}

.legenditem {
  padding-top: 6px;
  padding-bottom: 6px;
  font-weight: normal;
}

/* Each legend row contains its own floated icon, whatever the font's line height (without this,
   short rows let the icons stack diagonally, e.g. with Gotham on the live site) */
#legend .legenditem, #legend .subitem { display: flow-root; }

/* Status key rows (line swatches): swatch and label side by side, closer together than other items */
#legend .legenditem.swatchitem {
  display: flex;
  align-items: center;
  padding-top: 2px;
  padding-bottom: 2px;
  line-height: 1.5;
}
#legend .legenditem.swatchitem .icon.swatch {
  float: none;
  flex: none;
}

.subitem {
  margin: 0 0 8px 40px;
  font-weight: normal;
}

.Btn {
  cursor: pointer;
  color: #555;
  padding-bottom: 2px;
  border-bottom: 1px solid #ccc;
  font-weight: bold;
}
.Btn:hover,
.Btn:focus-visible {
  color: #111;
  border-bottom: 1px solid #333;
  outline: none;
}

#legend .legend-heading {
  clear: both;
  margin: 18px 0 2px 0;
  padding: 0;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #6b7280;
}

/* "Project page" button next to a segment (config.trails[].page) */
#legend a.legend-link {
  display: inline-block;
  margin-left: 8px;
  padding: 1px 8px;
  border: 1px solid #d1d5db;
  border-radius: 10px;
  color: #6b7280 !important;
  background: #fff;
  font-size: 10px;
  font-weight: 600;
  line-height: 16px;
  letter-spacing: .06em;
  text-transform: uppercase;
  text-decoration: none !important;
  vertical-align: 2px;
  white-space: nowrap;
}
#legend a.legend-link:hover,
#legend a.legend-link:focus-visible {
  border-color: #6b7280;
  background: #6b7280;
  color: #fff !important;
}

/* Space after the greenway status + segment list */
#legend .greenwaygroup { margin-bottom: 18px; }

/* "Open today" / "Coming" under Trail status */
#legend .legend-subheading {
  clear: both;
  margin: 10px 0 2px 0;
  padding: 0;
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0;
  text-transform: none;
  color: #374151;
}

/* Line swatches for trail status / type (SVG from app.js) */
#legend .icon.swatch {
  height: 19px;
  margin-top: 0;
  display: flex;
  align-items: center;
}
#legend .subitem .icon.swatch {
  margin-left: -38px;
}

/* Groups marked dimUntilDetailZoom in config.js; app.js un-dims them on zoom */
.amenitygroup {
  opacity: .3;
}

/* Legend icons: image comes from config.js, size from iconStyle */
#legend .icon {
  display: block;
  float: left;
  margin: -5px 5px 0 5px;
  height: 30px;
  width: 28px;
  background-repeat: no-repeat;
  background-position: 0 0;
  background-size: 1.7rem 1.9rem;
}
#legend .icon[data-icon-style="line"] {
  height: 25px;
  background-position: 0 .2rem;
  background-size: 2rem 1.5rem;
}
#legend .icon[data-icon-style="area"]   { background-size: 1.8rem 1.7rem; }
#legend .icon[data-icon-style="small"]  { background-size: 1.8rem 2rem; }
#legend .icon[data-icon-style="access"] {
  background-position: .1rem .4rem;
  background-size: 1.8rem 1.4rem;
}

#legend .park-status {
  display: block;
  color: #6b7280;
  font-size: .9em;
}
#legend .park-status:empty { display: none; }

#legend .icon[data-icon-style="pin"] {
  background-position: .2rem 0;
  background-size: 1.3rem 1.6rem;
}
#legend .icon[data-icon-style="pin-small"] {
  background-position: .35rem .25rem;
  background-size: 1rem 1.2rem;
}

/* ---- Photo layer: hover preview ---- */
/* Look-only: the pointer passes through to the map, so the preview can't steal the hover from its pin */
.photo-preview { pointer-events: none; }

.photo-preview .mapboxgl-popup-content {
  padding: 0;
  overflow: hidden;
  border-radius: 6px;
  box-shadow: 0 4px 18px rgba(0, 0, 0, .25);
}
.photo-preview img {
  display: block;
  width: 280px;
  max-width: 100%;
  height: auto;
}
.photo-preview p { margin: 6px 10px !important; }
.photo-preview .photo-preview-meta {
  margin-bottom: 0 !important;
  font-size: 11px !important;
  letter-spacing: .04em;
  text-transform: uppercase;
  color: #6b7280;
}
.photo-preview .photo-preview-caption { line-height: 1.35; }
.photo-preview .photo-preview-more { color: #6b7280; font-size: 12px !important; }

/* ---- Photo layer: lightbox ---- */
body.trailmap-lightbox-open { overflow: hidden; }
#trailmap-lightbox {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  padding: 24px 16px;
  background: rgba(10, 14, 20, .9);
  font-family: "Gotham A","Gotham B","Montserrat",sans-serif;
}
#trailmap-lightbox[hidden] { display: none; }
#trailmap-lightbox figure {
  margin: 0;
  max-width: min(1400px, 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  min-width: 0;
}
#trailmap-lightbox img {
  display: block;
  max-width: 100%;
  max-height: calc(100vh - 170px);
  object-fit: contain;
  border-radius: 4px;
  background: #222;
}
#trailmap-lightbox figcaption {
  width: 100%;
  max-width: 900px;
  margin-top: 12px;
  color: #f3f4f6;
  text-align: center;
}
#trailmap-lightbox figcaption p { margin: 2px 0; padding: 0; color: inherit; line-height: 1.4; }
#trailmap-lightbox .lb-meta {
  font-size: 11px;
  letter-spacing: .06em;
  text-transform: uppercase;
  color: #9ca3af;
}
#trailmap-lightbox .lb-caption { font-size: 15px; }
#trailmap-lightbox .lb-count { font-size: 12px; color: #9ca3af; }
#trailmap-lightbox button {
  all: unset;
  cursor: pointer;
  color: #fff;
  font-size: 44px;
  line-height: 1;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, .08);
  flex: none;
}
#trailmap-lightbox button:hover { background: rgba(255, 255, 255, .18); }
#trailmap-lightbox button:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }
#trailmap-lightbox button[hidden] { visibility: hidden; display: flex; }
#trailmap-lightbox .lb-close {
  position: absolute;
  top: 14px;
  right: 14px;
  font-size: 34px;
}
@media screen and (max-width: 600px) {
  #trailmap-lightbox { padding: 60px 4px 16px; gap: 2px; }
  #trailmap-lightbox button { width: 36px; height: 36px; font-size: 34px; }
  #trailmap-lightbox .lb-close { font-size: 28px; }
}

/* Editors: "Copied: lat …, lng …" after Option/Alt-click */
#trailmap-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  z-index: 100001;
  padding: 8px 14px;
  border-radius: 6px;
  background: #111827;
  color: #fff;
  font: 13px/1.3 ui-monospace, Menlo, monospace;
}
#trailmap-toast[hidden] { display: none; }
#trailmap-toast .toast-line { user-select: all; -webkit-user-select: all; }

/* ---- Map popups + controls ---- */
.mapboxgl-popup, .mapboxgl-popup p {
  font-size: 13px !important;
  font-family: "Gotham A","Gotham B","Montserrat",sans-serif;
  margin: 0;
  padding: 0;
}

.popup p, .popup h2, .popup h4 { margin: 10px; }
.popup .popup-kicker { margin-bottom: -4px; color: #6b7280; }
.popup .popup-list { margin: 6px 10px 10px 28px; padding: 0; }
.popup .popup-list li { margin: 0; padding: 0; font-size: 13px; list-style: disc; }
.popup .status-dot {
  display: inline-block;
  width: 10px;
  height: 10px;
  margin-right: 6px;
  border-radius: 50%;
  vertical-align: -1px;
}
.mapboxgl-popup h4 {
  font-weight: bold !important;
  line-height: 1em !important;
}

input[type=text].mapboxgl-ctrl-geocoder--input { padding-left: 35px !important; }

/* ---- Phones: map on top, legend underneath ---- */
@media screen and (max-width: 600px) {
  #map { height: 50%; }
  #sidemenu {
    width: 100%;
    top: 50%;
    height: 50%;
    right: 0;
    z-index: 999;
  }
  .toggle-collapse {
    margin-left: -1.9em;
  }
  /* bottom-right of the map, clear of the full-width search box */
  #basemapmenu {
    top: calc(50% - 70px);
    right: 10px;
  }
}
