#region-map[hidden],
#kham-map-views[hidden], #atlas-views[hidden],
#kham-stop-picker[hidden], #atlas-stop-picker[hidden],
#kham-terrain-legend[hidden], #atlas-elevation-legend[hidden],
#kham-atlas-layer[hidden], [data-atlas-layer][hidden],
#kham-elevation-layer[hidden] { display: none; }

.gw-region-explorer {
  display: grid;
  grid-template-columns: minmax(0, 1.22fr) minmax(0, 1fr);
  align-items: stretch;
  margin: 0 0 36px;
  border: 1px solid #c6dbe0;
  border-radius: 12px;
  overflow: hidden;
  background: #f5fafc;
}
.gw-region-map-figure { min-width: 0; background: #e8f2f4; }
.gw-region-map-plot { position: relative; aspect-ratio: 590 / 462; }
.gw-region-map-plot img { display: block; width: 100%; height: 100%; }
.gw-region-map-caption {
  color: #42606b;
  margin: 0;
  padding: .5rem 1rem .7rem;
  font-size: .73rem;
}
.gw-map-pin {
  position: absolute;
  left: var(--pin-x);
  top: var(--pin-y);
  transform: translate(-12px, -50%);
  display: inline-flex;
  align-items: center;
  gap: .42rem;
  min-height: 44px;
  padding: 0 .55rem 0 .35rem;
  border: 0;
  border-radius: 40px;
  color: #143a46;
  background: transparent;
  cursor: pointer;
  font: 650 clamp(.72rem, 1.3vw, .96rem)/1.1 "Work Sans", sans-serif;
  white-space: nowrap;
}
.gw-map-pin::before {
  content: "";
  flex: none;
  background: #2a6877;
  width: 13px;
  height: 13px;
  border: 2px solid #fff;
  border-radius: 50%;
  box-shadow: 0 0 0 1px #2a6877;
}
.gw-map-pin span {
  background: #fafff9ed;
  padding: .36rem .52rem;
  border-radius: 40px;
  box-shadow: 0 1px 4px #143a4620;
}
.gw-map-pin:hover span { background: #e5f0ec; }
.gw-map-pin[aria-pressed="true"] span { background: #1e5668; color: white; }
.gw-map-pin[aria-pressed="true"]::before { background: #bf7750; box-shadow: 0 0 0 2px #1e5668; }
.gw-region-results { min-width: 0; padding: clamp(.95rem, 2.5vw, 1.8rem); min-height: 0; }
.gw-region-results-head { display: flex; flex-wrap: wrap; gap: .55rem 1rem; align-items: center; justify-content: space-between; }
.gw-region-results-head h3 {
  margin: 0;
  color: #193c48;
  font: 480 clamp(1.4rem, 2.1vw, 2rem)/1.1 Fraunces, Georgia, serif;
}
.gw-map-button {
  color: #214e60;
  background: #f5fafc;
  border: 1px solid #9bbbc5;
  border-radius: 28px;
  padding: .55rem .88rem;
  min-height: 44px;
  cursor: pointer;
  font: 600 .82rem/1.1 "Work Sans", sans-serif;
}
.gw-map-button:hover { background: #e7f1f5; }
.gw-map-button[aria-pressed="true"] { background: #245b6c; border-color: #245b6c; color: #fff; }
.gw-region-results p { margin: .3rem 0 .5rem; color: #46646f; font-size: .82rem; }
.gw-region-results ul { margin: 0; padding: 0 .55rem 0 0; list-style: none; max-height: clamp(14rem, 29vw, 26rem); overflow-y: auto; }
.gw-region-results li + li { border-top: 1px solid #d3e4e8; }
.gw-region-results a {
  display: flex;
  min-height: 44px;
  gap: .7rem;
  align-items: baseline;
  justify-content: space-between;
  padding: .63rem .15rem;
  color: #183f4d;
  text-decoration: none;
  font-weight: 550;
  line-height: 1.28;
}
.gw-region-results a:hover span { text-decoration: underline; }
.gw-region-results small { color: #47636b; white-space: nowrap; }

.gw-map-modes {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: .5rem;
  padding-bottom: 1rem;
}
#gw-map-load-status, #atlas-load-status { font-size: .79rem; color: #2a5867; }
#kham-elevation-layer { pointer-events: none; }
.gw-terrain-legend {
  padding: .65rem 1rem;
  color: #325764;
  background: #f5f9f7;
  border-top: 1px solid #d0dfde;
}
.gw-terrain-legend ul {
  display: flex;
  flex-wrap: wrap;
  gap: .3rem .8rem;
  margin: 0 0 .28rem;
  padding: 0;
  list-style: none;
  font-size: .73rem;
}
.gw-terrain-legend i {
  display: inline-block;
  width: .75em;
  height: .75em;
  border: 1px solid #7e8d85;
  background: var(--band);
}
.gw-terrain-legend a { text-underline-offset: .15em; }
.gw-map-stop-picker {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: .3rem .8rem;
  padding: .65rem .85rem;
  background: #edf5f7;
  color: #214e60;
  border-top: 1px solid #bed6dd;
  font-size: .85rem;
}
#kham-stop-days, .atlas-stop-days { display: flex; flex-wrap: wrap; gap: .35rem; }
#itinerary .p-day[data-map-selected] > summary { box-shadow: inset 3px 0 #317181; }
.gw-map-pin:focus-visible,
.gw-map-button:focus-visible,
.gw-region-results a:focus-visible {
  outline: 2px solid #245b6c;
  outline-offset: -2px;
}
@media (max-width: 760px) {
  .gw-region-explorer { grid-template-columns: minmax(0, 1fr); }
  .gw-region-results ul { max-height: 16.5rem; }
}
@media (max-width: 430px) {
  .gw-map-pin { gap: .22rem; min-height: 32px; padding-right: .2rem; }
  .gw-map-pin::before { width: 10px; height: 10px; }
  .gw-map-pin span { padding: .28rem .34rem; }
  .gw-map-button { padding-inline: .64rem; }
}




#gw-discovery-title, #region-map, #explore { scroll-margin-top: 85px; }

.kham-cultural-loop .p-map-stage {
  aspect-ratio: 760 / 540;
  background: #eaf0ea;
}
:is(.kham-cultural-loop, .sichuan-map-atlas) .p-map-dialog .p-map-stage {
  height: auto;
  max-height: none;
}
#kham-atlas-layer, :is(.kham-atlas-context, .atlas-context), :is(.kham-atlas-orientation, .atlas-orientation) { pointer-events: none; }
:is(#kham-atlas-routes, #atlas-reference-routes) .route-leg {
  fill: none;
  stroke: #346c75;
  stroke-width: 2.2;
  opacity: .83;
  stroke-linejoin: round;
  stroke-linecap: round;
  filter: drop-shadow(0 0 1px #fffff5);
}
:is(#kham-atlas-routes, #atlas-reference-routes) .route-leg.active {
  stroke: #095467;
  stroke-width: 4;
  opacity: 1;
}
:is(#kham-atlas-routes, #atlas-reference-routes) .route-leg.dim { opacity: .25; }
:is(.kham-atlas-context, .atlas-context) text, :is(.kham-atlas-orientation, .atlas-orientation) text {
  fill: #426371;
  stroke: #f3f5ed;
  stroke-width: 2.3px;
  paint-order: stroke fill;
  font: 530 11px "Work Sans", sans-serif;
}
:is(.kham-atlas-context, .atlas-context) circle { fill: #537d83; stroke: #f3f5ed; stroke-width: .65; }
:is(.kham-atlas-context, .atlas-context) :is(.kham-landscape-label, .atlas-landscape-label) {
  fill: #6e8482;
  letter-spacing: 1.9px;
  font-size: 14px;
}
:is(.kham-road-shield, .atlas-road-shield) rect { fill: #f4f6ed; stroke: #839e9f; stroke-width: .7px; }
:is(.kham-road-shield, .atlas-road-shield) text { font-size: 9.5px; font-weight: 650; stroke: none; }
:is(.kham-atlas-orientation, .atlas-orientation) text { fill: #1a414b; font-weight: 650; }
:is(.kham-atlas-orientation, .atlas-orientation) path {
  fill: #315760;
  stroke: #315760;
  stroke-width: 1.25px;
  paint-order: stroke fill;
}
:is(.kham-atlas-orientation, .atlas-orientation) :is(#kham-scale-bar, #atlas-scale-bar) { fill: none; }
@media(max-width:500px) {
  :is(.kham-atlas-context, .atlas-context) text { font-size: 13px; }
  :is(.kham-atlas-context, .atlas-context) :is(.kham-landscape-label, .atlas-landscape-label) { font-size: 16px; }
  :is(.kham-road-shield, .atlas-road-shield) text { font-size: 9.5px; }
  :is(.kham-atlas-orientation, .atlas-orientation) text { font-size: 13px; }
}

.sichuan-map-atlas .p-map-stage { aspect-ratio: 640 / 600; background: #eaf0ea; }
[data-atlas-layer] { pointer-events: none; }
.sichuan-map-atlas .atlas-road-key::before {
  content: '';
  display: inline-block;
  width: 18px;
  border-top: 2px solid #346c75;
}

/* Keep the full SVG frame inside the expanded atlas on narrow screens. */
#map-dialog .p-map-stage { width: 100%; min-height: 0; }
