/* Map widgets: region map (/sponsor/:id/map/) and tour (/tour/:id/). The map fills the
   iframe (tour: below the header); the location panel overlays the map on the left (wide) or
   as a bottom sheet (narrow). */

@font-face {
  font-family: 'Maven Pro';
  src: url('../fonts/MavenPro-VariableFont_wght.ttf');
  font-weight: normal;
  font-display: swap;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
  margin: 0;
}

body {
  position: relative;
  overflow: hidden;
  font-family: 'Maven Pro', system-ui, -apple-system, sans-serif;
  color: #212529;
  background: #e9ecef;
  -webkit-font-smoothing: antialiased;
}

#map {
  position: absolute;
  inset: 0;
}

#panel {
  position: absolute;
  z-index: 3;
  top: 0.75rem;
  bottom: 0.75rem;
  left: 0.75rem;
  width: min(22rem, calc(100% - 4.5rem));
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 0.5rem;
  box-shadow: 0 2px 12px rgb(0 0 0 / 0.25);
  overflow: hidden;
}

#panel[hidden] {
  display: none;
}

@media (max-width: 599px) {
  #panel {
    top: auto;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    height: 55%;
    border-radius: 0.75rem 0.75rem 0 0;
  }
}

.panel-close {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  z-index: 1;
  width: 2rem;
  height: 2rem;
  border: 0;
  border-radius: 50%;
  background: rgb(255 255 255 / 0.9);
  box-shadow: 0 1px 4px rgb(0 0 0 / 0.3);
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.panel-body {
  flex: 1;
  overflow-y: auto;
  padding-bottom: 1rem;
  line-height: 1.4;
}

.panel-body > :not(.panel-image) {
  margin-inline: 1rem;
}

.panel-image {
  display: block;
  width: 100%;
  aspect-ratio: 3 / 2;
  object-fit: cover;
}

.panel-title {
  margin-block: 0.75rem 0.5rem;
  padding-right: 2rem;
  font-size: 1.35rem;
  font-weight: normal;
  font-variation-settings: 'wght' 600;
  line-height: 1.2;
}

.panel-title a {
  color: inherit;
  text-decoration: none;
}

.panel-title a:hover,
.panel-title a:focus-visible {
  text-decoration: underline;
}

.panel-description {
  font-size: 0.875rem;
}

.panel-description :is(p, ul, ol) {
  margin-block: 0 0.5rem;
}

.panel-description a {
  color: #006585;
}

.panel-heading {
  margin-block: 1rem 0.5rem;
  font-size: 1rem;
  font-weight: normal;
  font-variation-settings: 'wght' 600;
}

.panel-loading,
.panel-empty {
  color: #495057;
  font-size: 0.875rem;
}

.panel-checkins {
  list-style: none;
  padding: 0;
  display: grid;
  gap: 0.75rem;
}

.panel-checkins li {
  display: grid;
  grid-template-columns: 4rem 1fr;
  gap: 0.75rem;
  align-items: start;
  font-size: 0.875rem;
}

.panel-checkins li > :only-child {
  grid-column: 1 / -1;
}

.panel-checkins img {
  width: 4rem;
  height: 4rem;
  object-fit: cover;
  border-radius: 0.25rem;
}

.panel-checkins .checkin-user {
  display: block;
  font-variation-settings: 'wght' 600;
}

.panel-checkins time {
  color: #495057;
  font-size: 0.8rem;
}

.panel-checkins p {
  margin: 0.25rem 0 0;
  overflow-wrap: anywhere;
}

/* --- Tour widget: header (title, stats, region logo), map, footer --- */

body.tour {
  display: flex;
  flex-direction: column;
  background: #fff;
}

.map-wrap {
  position: relative;
  flex: 1;
  min-height: 12rem;
  background: #e9ecef;
}

.tour-header {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
}

.tour-info {
  flex: 1;
  min-width: 0;
}

.tour-header h1 {
  margin: 0 0 0.25rem;
  font-size: 1.35rem;
  font-weight: normal;
  font-variation-settings: 'wght' 600;
  line-height: 1.25;
  overflow-wrap: anywhere;
  hyphens: auto;
}

.tour-header h1 a {
  color: inherit;
  text-decoration: none;
}

.tour-header h1 a:hover,
.tour-header h1 a:focus-visible {
  text-decoration: underline;
}

.tour-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin: 0;
}

.tour-stats div {
  display: flex;
  flex-direction: column-reverse;
}

.tour-stats dt {
  color: #495057;
  font-size: 0.75rem;
}

.tour-stats dd {
  margin: 0;
  font-variation-settings: 'wght' 600;
}

.tour-region {
  flex: 0 0 auto;
  color: inherit;
  font-size: 0.875rem;
  text-align: right;
  text-decoration: none;
}

.tour-region img {
  display: block;
  max-width: 8rem;
  max-height: 3.5rem;
  object-fit: contain;
}

.tour-footer {
  padding: 0.4rem 1rem;
  color: #495057;
  font-size: 0.8rem;
  text-align: center;
}

.tour-footer a {
  color: inherit;
}

@media (max-width: 599px) {
  .tour-header {
    padding: 0.5rem 0.75rem;
  }

  .tour-header h1 {
    font-size: 1.1rem;
  }

  .tour-stats {
    gap: 0.25rem 0.9rem;
    font-size: 0.875rem;
  }

  .tour-region img {
    max-width: 5rem;
    max-height: 2.5rem;
  }
}

/* Elevation profile (Maptoolkit control) in the SummitLynx colours, never wider than the map. */
.maplibre-elevation-control {
  --elevation-control-width: min(420px, calc(100vw - 20px));
}

.maplibre-elevation-control .maptoolkit-elevation-profile {
  --maptoolkit-elevation-profile-fill: #006585;
  --maptoolkit-elevation-profile-line: #006585;
  --maptoolkit-elevation-profile-accent: #e5b900;
  /* Font: the plugin's own. Maven Pro is wider and clips 4-digit axis labels ("2000 m"). */
}

.maplibre-elevation-control .maptoolkit-elevation-profile .maptoolkit-elevation-profile-line {
  stroke: #006585;
}
