/* The map, station sheet and itinerary share one fixed-height workspace. */
.atlas-grid {
  flex: 1 1 0;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr);
}
.atlas-grid .map-card {
  min-height: 0;
  align-self: stretch;
}
.atlas-grid .map-window {
  height: auto;
  min-height: 0;
  flex: 1 1 0;
}
.map-scroll {
  scrollbar-width: none;
}
.map-scroll::-webkit-scrollbar {
  display: none;
}
.atlas-grid .map-caption {
  min-height: 32px;
  padding-block: 4px;
}
.atlas-grid .side-panel {
  container: station / size;
  min-width: 0;
  min-height: 0;
  max-height: none;
  overflow: visible;
  gap: clamp(6px, 1.4vh, 13px);
  padding: clamp(12px, 1.6vw, 25px);
}
.map-title,
.map-peek,
.map-peek > span:first-child {
  display: flex;
  align-items: center;
}
.map-title {
  justify-content: space-between;
  gap: 8px;
}
.map-title h2 {
  margin: 0;
}
.map-tabs {
  display: flex;
  gap: 14px;
  align-items: stretch;
  flex: none;
  border-bottom: 1px solid var(--hair);
}
.map-tab {
  display: inline-flex;
  align-items: center;
  padding: 3px 0 5px;
  border-bottom: 2px solid transparent;
  color: var(--dim);
  font-size: 14px;
}
.map-tab[aria-current="page"] {
  color: var(--teal);
  font-weight: 650;
  border-bottom-color: var(--teal);
}
.station-content {
  flex: 1 1 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.map-summary {
  flex: none;
}
.map-summary .water-note {
  margin-top: 5px;
}
.map-plate-preview {
  flex: 1 1 0;
  min-height: 0;
  max-height: 210px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  justify-content: flex-end;
  position: relative;
}
.map-plate-preview img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  background: #f0ead9;
}
.map-plate-preview span {
  position: relative;
  margin: 6px;
  font-size: 13px;
  background: #f8f2deed;
  padding: 1px 7px;
}
.map-animals {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(74px, 100%), 1fr));
  gap: 6px;
  min-height: 0;
  align-items: start;
}
.map-animals .small-animal {
  display: flex;
  flex-direction: column;
  align-items: stretch;
  gap: 0;
  justify-content: flex-start;
  margin: 0;
  padding: 0;
  min-width: 0;
}
.map-animals .small-animal img {
  display: block;
  width: 100%;
  height: auto;
  max-height: 125px;
  object-fit: cover;
}
.map-animals .small-animal strong {
  display: block;
  padding: 2px 5px;
  font-size: 16px;
  text-align: center;
}
.atlas-grid .panel-foot {
  flex: none;
  margin-top: auto;
}
.map-peek,
.map-back,
.station-select {
  display: none;
}
main > .itinerary {
  flex: none;
  margin-top: 12px;
  padding: 8px 0 0;
}
.itinerary .section-heading {
  margin-bottom: 5px;
}
.itinerary .section-heading h2 {
  font-size: 19px;
}
.itinerary .route-stop {
  padding-block: 5px;
}
.map-prose {
  flex: 0 1 auto;
  min-height: 0;
}
.map-prose .quote {
  margin-top: 0;
}
.map-product .panel-head .icon-btn {
  width: 30px;
  height: 30px;
}

@container station (max-height: 350px) {
  .map-plate-preview {
    display: none;
  }
  .map-title h2 {
    font-size: 29px;
  }
  .map-animals .small-animal img {
    max-height: 85px;
  }
  .map-summary .summary,
  .map-prose .summary {
    font-size: 15px;
    line-height: 1.5;
  }
  .map-animals {
    display: flex;
    flex-wrap: wrap;
  }
  .map-animals .small-animal {
    flex: 1 1 0;
    min-width: 66px;
  }
  .panel-foot {
    gap: 4px 12px;
    padding-top: 6px;
  }
}

@media (max-width: 730px), (max-height: 520px) {
  .atlas-grid {
    grid-template: minmax(0, 1fr) auto / minmax(0, 1fr);
    gap: 6px;
  }
  .atlas-grid .map-peek {
    display: flex;
    justify-content: space-between;
    gap: 10px;
    padding: 6px 12px;
    border: 1px solid var(--hair);
    border-left: 3px solid var(--teal);
    background: var(--panel);
    color: var(--teal);
    font-size: 14px;
  }
  .map-peek > span:first-child {
    gap: 12px;
  }
  .map-peek small {
    color: var(--dim);
    font-size: 13px;
  }
  .map-peek strong {
    font: 700 22px var(--serif);
    color: var(--ink);
  }
  .atlas-grid > .side-panel {
    display: none;
  }
  .atlas-grid.show-station {
    grid-template: minmax(0, 1fr) / minmax(0, 1fr);
  }
  .atlas-grid.show-station .map-card,
  .atlas-grid.show-station .map-peek {
    display: none;
  }
  .atlas-grid.show-station .side-panel {
    display: flex;
  }
  .map-back {
    display: inline-flex;
  }
  .itinerary .route-list {
    display: none;
  }
  .itinerary .section-heading {
    margin: 0;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
  }
  .itinerary .section-heading h2 {
    font-size: 16px;
  }
  .itinerary .station-select {
    display: inline-block;
    flex: 0 1 auto;
    min-width: 0;
    max-width: 55%;
    border: 1px solid var(--hair);
    border-radius: 2px;
    padding: 4px 5px;
    font: 14px/1.4 var(--sans);
    color: var(--ink);
    background: var(--panel);
  }
  main > .itinerary {
    margin: 6px 0 0;
    padding: 5px 0 0;
  }
}
@media (max-height: 530px) {
  .atlas-grid .side-panel {
    gap: 4px;
    padding: 7px 12px;
  }
  .atlas-grid .panel-head {
    padding-bottom: 0;
  }
  .map-title h2 {
    font-size: 24px;
  }
  .map-title .text-action {
    font-size: 13px;
  }
  .map-tab {
    padding: 1px 0 2px;
  }
  .map-product .quote {
    line-height: 1.4;
    font-size: 16px;
    margin-bottom: 3px;
  }
  .map-plate-preview {
    display: none;
  }
  .map-animals .small-animal {
    flex-direction: row;
    align-items: center;
  }
  .map-animals .small-animal img {
    width: min(45%, 75px);
    height: 36px;
  }
  .atlas-grid .panel-foot {
    padding-top: 4px;
  }
}

@container station (min-height: 351px) and (max-height: 470px) {
  .map-plate-preview {
    flex-direction: row;
    align-items: center;
    justify-content: flex-start;
    gap: 12px;
    max-height: 83px;
    border: 1px solid var(--hair);
    background: #f6f0e2;
  }
  .map-plate-preview img {
    position: static;
    width: auto;
    max-width: 45%;
    height: 100%;
  }
  .map-plate-preview span {
    margin: 0;
    padding: 0;
    font-family: var(--serif);
    font-size: 16px;
    color: var(--teal);
    background: none;
  }
}
@media (min-width: 520px) and (max-height: 460px) {
  .atlas-grid.show-station .side-panel {
    display: grid;
    grid-template: "title tabs" auto "content content" minmax(
        0,
        1fr
      ) "foot foot" auto / minmax(0, 1fr) auto;
    gap: 5px 15px;
  }
  .side-panel:not(.map-product) .panel-head {
    display: none;
  }
  .map-title {
    grid-area: title;
    justify-content: flex-start;
  }
  .map-tabs {
    grid-area: tabs;
  }
  .station-content,
  .map-prose {
    grid-area: content;
  }
  .atlas-grid .panel-foot {
    grid-area: foot;
  }
  .map-product .panel-head {
    grid-area: tabs;
    gap: 12px;
  }
}
