/* Shared map controls use CSS pixels: Leaflet embeds must stay readable
   independently of the surrounding editorial type scale. */
.map-ux { font-family: var(--sans); }
.map-ux .map-gallery { margin: 0; min-width: 0; width: 100%; }
.map-ux .map-gallery-frame { width: 100%; aspect-ratio: 16 / 9; overflow: hidden; background: #f3f6f6; border-radius: 4px; }
.map-ux .map-gallery-frame img { display: block; width: 100%; height: 100%; max-height: none; object-fit: cover; margin: 0; }
.map-ux .map-gallery-controls { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.map-ux .leaflet-popup-content .map-gallery-controls button { width: 44px; height: 44px; padding: 0; border: 0; background: #fff; color: #102828; border-radius: 4px; font-size: 28px !important; cursor: pointer; }
.map-ux .map-gallery-controls button:hover { background: #eef4f4; }
.map-ux .map-gallery figcaption { color: #4c6265; margin: 4px 0 0; }
.map-ux .map-booking { display: grid; gap: 6px; }
.map-ux .map-booking-cta { justify-content: center; text-align: center; background: #174f59; color: #fff; font-weight: 750; text-decoration: none; padding: 12px; border-radius: 4px; }
.map-ux .map-booking-cta:hover { background: #103b44; }
.map-ux .map-booking small { color: #4c6265; }
.intl-map-section .map-place-chooser { max-width: 32rem; }
.map-ux .leaflet-popup-content-wrapper { border-radius: 8px; }
.map-ux .leaflet-popup-content {
  margin: 42px 16px 16px;
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}
.map-ux .leaflet-popup-content :is(.map-point-popup, .food-map-popup, .charger-popup, .map-cluster-popup) {
  display: grid;
  gap: 12px;
  min-width: 0;
  max-width: none;
  width: 100%;
}
.map-ux .leaflet-popup-content :is(p, span, a, button, dt, dd) {
  font-family: inherit;
  font-size: 15px !important;
  line-height: 1.45;
}
.map-ux .leaflet-popup-content p { margin: 0; max-width: none; }
.map-ux .leaflet-popup-content :is(small, figcaption) {
  font-size: 13px;
  line-height: 1.45;
}
.map-ux .leaflet-popup-content > div > strong {
  font-family: var(--sans);
  font-size: 20px;
  font-weight: 750;
  line-height: 1.2;
}
.map-ux .leaflet-popup-content .map-point-popup > span {
  color: var(--ink-soft);
  letter-spacing: 0;
  text-transform: none;
}
.map-ux .leaflet-popup-content a:not(.map-source-details a, figcaption a) {
  min-height: 44px;
  display: flex;
  align-items: center;
}
.map-ux .leaflet-popup-content button { min-height: 44px; }
.map-ux .leaflet-popup-scrolled { overscroll-behavior: contain; border: 0; padding-right: 6px; }
.map-ux :is(a.leaflet-popup-close-button, .leaflet-control-zoom a) {
  width: 44px;
  height: 44px;
  line-height: 44px;
  color: var(--ink);
  background: #fff;
  font-size: 26px;
}
.map-ux :is(button, a, .leaflet-marker-icon):focus-visible {
  outline: 3px solid #176d85;
  outline-offset: 2px;
}
.map-ux .map-pin { display: grid; place-items: center; }
.map-ux .map-cluster-pin span { display: grid; place-items: center; width: 34px; height: 34px; font-size: 15px; }
.map-ux-control button,
.map-ux-warning button {
  min-height: 44px;
  max-width: 100%;
  padding: 10px 12px;
  border: 1px solid #c6d2d4;
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 700 14px/1.3 var(--sans);
  cursor: pointer;
}
.map-ux-control button:hover { background: #eef4f4; }
.map-ux-warning {
  display: grid;
  gap: 8px;
  max-width: min(270px, calc(100vw - 80px));
  padding: 12px;
  background: #fff;
  color: var(--ink);
  box-shadow: 0 2px 12px #0b242425;
  font: 14px/1.4 var(--sans);
}
.map-ux-warning[hidden] { display: none; }
.map-feedback { margin: 8px 0; font-size: 15px; color: var(--ink-soft); }
.map-feedback:empty { display: none; }
.map-results { margin: 24px 0 32px; }
.map-results-heading h2 { font: 750 24px/1.2 var(--sans); margin-bottom: 8px; }
.map-results-heading p { font-size: 16px; margin: 0 0 16px; }
.map-result-list { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; }
.map-result-button, .map-result-more, .map-result-reset, .food-show-on-map, .map-copy-button, .map-retry {
  min-height: 44px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 4px;
  background: #fff;
  color: var(--ink);
  font: 650 15px/1.4 var(--sans);
  cursor: pointer;
}
.map-result-button { display: grid; gap: 4px; align-content: start; text-align: left; overflow-wrap: anywhere; }
.map-result-button span { color: var(--ink-soft); font-size: 14px; }
.map-result-more { grid-column: 1 / -1; justify-self: start; }
:is(.map-result-button, .map-result-more, .map-result-reset, .food-show-on-map, .map-copy-button, .map-retry):hover { background: #eef4f4; }
:is(.map-result-button, .map-result-more, .map-result-reset, .food-show-on-map, .map-copy-button, .map-retry):focus-visible { outline: 3px solid #176d85; outline-offset: 2px; }
.map-place-chooser { display: grid; gap: 8px; margin: 16px 0; font: 650 15px/1.4 var(--sans); }
.map-place-chooser select { min-height: 44px; width: 100%; min-width: 0; max-width: 100%; font: 16px/1.4 var(--sans); padding: 10px; color: var(--ink); background: #fff; border: 1px solid var(--line); border-radius: 4px; }
.map-popup-facts, .map-ux .map-trail-facts { margin: 0; display: grid; grid-template-columns: 1fr; gap: 10px; }
.map-popup-facts > div, .map-ux .map-trail-facts > div { display: grid; gap: 2px; }
.map-popup-facts dt, .map-ux .map-trail-facts dt { font-weight: 750; text-transform: none; letter-spacing: 0; }
.map-popup-facts dd, .map-ux .map-trail-facts dd { margin: 0; color: var(--ink-soft); }
.map-source-details summary { display: list-item; min-height: 44px; padding: 12px 0; font-size: 14px; cursor: pointer; }
.map-ux .map-source-details small { display: block; border: 0; padding: 0; }
.map-ux .map-location-note { color: var(--ink-soft); }
.charger-result-card.is-selected { outline: 2px solid var(--moss); outline-offset: -2px; background: #f4f8f8; }

.map-coordinate-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: .45rem;
  padding-top: .55rem;
  border-top: 1px solid var(--line);
}

.map-coordinate-actions > a,
.map-coordinate-actions > button {
  min-height: 2.65rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: .55rem .7rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  font-weight: 750;
  line-height: 1.25;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
}

.map-coordinate-actions > a {
  background: var(--ink);
  color: var(--white);
}

.map-coordinate-actions > a:hover,
.map-coordinate-actions > button:hover { background: var(--moss); color: var(--white); }

.map-copy-status {
  min-height: 1.1em;
  grid-column: 1 / -1;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.4;
}

.hike-map-detail-close { display: none; }
.hike-map-detail { background: #fff; }
.hike-map-detail > p:not(.eyebrow), .hike-map-detail > a { font-size: 16px; }
.hike-map-detail h3 { font-family: var(--sans); font-size: 26px; line-height: 1.2; }
.hike-detail-actions { margin-top: .15rem; }

.hike-detail-media {
  margin: 0;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f1f5f4;
}

.hike-detail-media img {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
}

.hike-detail-media figcaption {
  padding: .38rem .5rem;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.4;
}

.hike-detail-media figcaption a { color: inherit; }

.food-map-popup-media {
  margin: 0 0 .15rem;
  overflow: hidden;
  border: 1px solid var(--line);
  background: #f1f5f4;
}

.food-map-popup-media img {
  width: 100%;
  height: auto;
  max-height: 9rem;
  aspect-ratio: 16 / 9;
  display: block;
  object-fit: cover;
}

.food-map-popup-media figcaption {
  padding: .32rem .45rem;
  color: var(--ink-soft);
  font-size: 13px;
  line-height: 1.35;
}

.food-map-popup-group > [role="list"] { display: grid; gap: 8px; }
.food-map-popup-group [role="listitem"] { display: grid; }

.food-map-cluster-zoom {
  min-height: 2.75rem;
  width: 100%;
  padding: .65rem .8rem;
  border: 1px solid var(--ink);
  border-radius: 0;
  background: var(--ink);
  color: var(--white);
  font: inherit;
  font-size: .68rem;
  font-weight: 760;
  cursor: pointer;
}

.food-map-cluster-zoom:hover { background: var(--moss); }
.food-map-cluster-zoom:disabled { background: #526665; cursor: default; opacity: .78; }

.food-map-place-select {
  width: 100%;
  min-height: 44px;
  padding: .65rem .75rem;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  text-align: left;
  cursor: pointer;
}

.food-map-place-select:hover { background: #edf2ee; }
.food-map-place-select:focus-visible,
.food-map-cluster-zoom:focus-visible { outline: 3px solid var(--moss); outline-offset: 2px; }

@media (max-width: 63.99rem) {
  .map-result-list { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .hike-map-layout { overflow: visible; }

  .hike-map-detail {
    position: fixed;
    z-index: 1200;
    right: max(.75rem, env(safe-area-inset-right));
    bottom: max(.75rem, env(safe-area-inset-bottom));
    left: max(.75rem, env(safe-area-inset-left));
    max-height: min(72vh, 36rem);
    max-height: min(72svh, 36rem);
    overflow-y: auto;
    padding: 1rem;
    border: 1px solid var(--ink);
    border-radius: .25rem;
    background: var(--white);
    box-shadow: 0 .75rem 2.4rem rgb(7 32 34 / .2);
    opacity: 0;
    visibility: hidden;
    transform: translateY(calc(100% + 2rem));
    transition: transform 220ms cubic-bezier(.22, 1, .36, 1), opacity 160ms ease-out, visibility 0s linear 220ms;
  }

  .hike-map-detail.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    transition-delay: 0s;
  }

  .hike-map-detail-close {
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    justify-self: end;
    padding: .45rem .7rem;
    border: 1px solid var(--line);
    border-radius: 0;
    background: var(--white);
    color: var(--ink);
    font: inherit;
    font-size: 15px;
    font-weight: 750;
    cursor: pointer;
  }
}

@media (max-width: 29.99rem) {
  /* On narrow maps a readable popup fills the width occupied by zoom controls. */
  #lofoten-map:has(.leaflet-popup) .leaflet-control-zoom,
  #food-map:has(.leaflet-popup) .leaflet-control-zoom { visibility: hidden; }
  .map-ux:has(.leaflet-popup) .map-ux-control { visibility: hidden; }
  .map-coordinate-actions { grid-template-columns: 1fr; }
  .map-copy-status { grid-column: 1; }
}

@media (prefers-reduced-motion: reduce) {
  .hike-map-detail { transition: none; }
}
