/* Shared Atlas map presentation; Home and About supply their own composition. */

.home-map svg#discovery-map{display:block;width:100%;touch-action:pan-x pan-y;font-size:var(--tyit-type-subheading);--atlas-count-size:var(--tyit-type-standard);--atlas-detail-size:var(--tyit-type-standard);--atlas-country-size:var(--tyit-type-small);--atlas-marker-size:calc(var(--atlas-count-size) * 2.61538)}
.home-map{--atlas-map-surface:#e9ede8;--atlas-active-marker:#315b4b;position:relative;background:var(--atlas-map-surface);border:1px solid var(--line);border-radius:var(--radius-control);overflow:hidden;isolation:isolate}

.country-shape{fill:#dfe3dd;stroke:#f8f8f2;stroke-width:.65;vector-effect:non-scaling-stroke}.country-shape.is-shaded{fill:color-mix(in oklab,var(--region-color) 54%,#e5e9e2);fill-opacity:1}
.country-label{font-family:var(--tyit-font-structural);fill:#364f49;paint-order:stroke;stroke:#f4f5ef;stroke-width:3;stroke-linejoin:round;pointer-events:none}.label-leader{stroke:#71857b;stroke-width:.6;vector-effect:non-scaling-stroke;pointer-events:none}
#map-back{position:absolute;top:14px;z-index:7;background:#f8faf450;border:1px solid var(--line);color:var(--forest);cursor:pointer;font:22px var(--tyit-font-structural);backdrop-filter:blur(2px)}
#map-back{left:14px}
/* Compact world navigation keeps the standard top-left corner with a tighter inset. */
@container atlas-stage (max-width:600px){
  .home-map.is-world #map-back{top:2px;left:2px}
}
/* Explicitly honour the hidden state: positioned button styles override the UA rule. */
#map-back[hidden]{display:none}
.map-context{font-size:14px;line-height:1.5;color:#53685f;margin:14px 0 24px;max-width:1000px}
.discovery-route{fill:none;stroke:#b66042;stroke-width:1.6;stroke-linecap:round;stroke-linejoin:round;vector-effect:non-scaling-stroke;cursor:pointer}
.route-hit{fill:none;stroke:transparent;stroke-width:18;vector-effect:non-scaling-stroke;pointer-events:stroke;cursor:pointer}.route-muted .discovery-route{stroke:#a4aca7;opacity:.55}
.map-cluster{cursor:pointer}.marker-hit{fill:transparent;stroke:none;pointer-events:all;cursor:pointer;outline:none}.marker-hit:focus-visible{stroke:#b66042;stroke-width:1.6;stroke-dasharray:3 3;vector-effect:non-scaling-stroke}.cluster-disc{transform:scale(1);transition:transform .18s;pointer-events:none}.map-cluster.is-near .cluster-disc,.map-cluster:focus .cluster-disc{transform:scale(1.18)}
.cluster-core{fill:var(--atlas-active-marker);stroke:#fffdf8;stroke-width:2;vector-effect:non-scaling-stroke}.is-muted .cluster-core{fill:#a2aba5}.cluster-count{font-family:var(--tyit-font-structural);fill:#fff;font-weight:700}.cluster-pulse{fill:none;stroke:var(--atlas-active-marker);stroke-width:2;vector-effect:non-scaling-stroke;transform-origin:0 0;animation:cluster-pulse 2.4s ease-out infinite}
.cluster-leader,.card-leader{stroke:#71847a;stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none}.card-leader{stroke-dasharray:3 3;opacity:.6}
@keyframes cluster-pulse{0%{transform:scale(.9);opacity:.7}100%{transform:scale(1.45);opacity:0}}
#map-trip-cards{position:absolute;inset:0;pointer-events:none}
@media(prefers-reduced-motion:reduce){
.cluster-pulse{animation:none}
.cluster-disc{transition:none}
}
.group-label{font-family:var(--tyit-font-structural);font-weight:650;paint-order:stroke;stroke:#f1f3ee;stroke-width:3;pointer-events:none}

#map-perspective-card{position:absolute;left:14px;bottom:14px;z-index:5;pointer-events:none;}
@container atlas-stage (max-width:600px){
  .home-map.is-world #map-perspective-card:not([hidden]){bottom:2px}
}

/* Atlas geography is always a fixed frame; only the independent selector rails scroll. */
.map-scroll{overflow:hidden}


/* A self-contained selection stage occupies one available viewport. */
/* M73 target-state proof: Atlas controls use their own stage width. */
.discovery-stage{container:atlas-stage/inline-size;height:100svh;max-height:760px;min-height:240px;display:flex;flex-direction:column;gap:8px;padding:8px 0;box-sizing:border-box}
.discovery-stage .home-map{flex:1;min-height:120px}
.discovery-stage .map-scroll{height:100%}
.discovery-stage .home-map svg#discovery-map{height:100%!important}
@media(max-width:650px){
.discovery-stage{gap:6px;max-height:none}
}
/* Cards expand from their stable anchor; other cards remain visible and muted. */
.discovery-stage #map-trip-cards:not(:empty){position:absolute;inset:0;margin:0;display:block;pointer-events:none}
.discovery-stage .map-trip-card{pointer-events:auto}
.discovery-stage .map-trip-card.is-expanded{min-height:82px}
.discovery-stage .map-trip-card .map-trip-toggle{min-height:82px}


.subregion-label-link{stroke-width:1;vector-effect:non-scaling-stroke;pointer-events:none;opacity:.65}
#map-back:not([hidden]){display:grid;place-items:center;box-shadow:none}
#map-back:focus-visible{outline:3px solid var(--clay);outline-offset:2px}



/* M17: short landscapes must scroll vertically rather than compress the Atlas
   into an unusable sliver. Its minimum accommodates 92px journey previews. */
@media (max-height:600px) {

  .discovery-stage{height:auto;min-height:100svh;max-height:none;}
  .discovery-stage .home-map{flex:1 0 620px;min-height:620px;}
}

/* On narrow phones, only an expanded preview needs additional map space.
   Collapsed previews keep the natural viewport sizing, even below 360px. */
@container atlas-stage (max-width:386px){

  .home-map.has-expanded-preview{flex:1 0 400px;min-height:400px}
}
/* Allow the stage to grow whenever a narrow expanded preview needs more map height. */
.discovery-stage:has(.home-map.has-expanded-preview){min-height:100svh}
@media(max-height:600px){

  .discovery-stage .home-map.has-expanded-preview{flex:1 0 400px;min-height:400px}
}
#map-perspective-card{width:max-content;max-width:calc(100% - 28px)}
#map-perspective-card .selector-card--label-right{max-width:100%;pointer-events:none}
#map-perspective-card .selector-card--label-right .selector-card__label{color:var(--forest)}

/* M47: selected preview is the only visible journey card. */
.discovery-stage .map-trip-card[hidden]{display:none!important}

/* Map labels retain a constant screen-space halo at every geographic zoom. */
.country-label,.group-label{vector-effect:non-scaling-stroke}



/* M87B: expanded journey text uses natural card height, never a nested scrollport. */
.discovery-stage .map-trip-card.is-expanded{max-height:none;overflow:visible}
.discovery-stage .map-trip-card.is-expanded .trip-card-text{overflow:visible;min-height:min-content}

/* M87D: geographic identity on Home map cards; shared card geometry stays unchanged. */
.discovery-stage .map-trip-card{border-color:color-mix(in srgb,var(--trip-region-tint,#53796f) 55%,#ffffff 45%);box-shadow:inset 0 3px 0 color-mix(in srgb,var(--trip-region-tint,#53796f) 60%,transparent)}

/* M129 experimental: full-latitude, 280-degree cropped world at natural ratio. */
@media(max-width:650px){

.discovery-stage:has(.home-map.is-world){height:auto;min-height:0;max-height:none}
.discovery-stage .home-map.is-world{flex:none;min-height:0;aspect-ratio:280/180}
.discovery-stage .home-map.is-world .map-scroll{overflow-x:hidden}
}

/* M129 narrow exploration: one 3:5 frame, independent of device orientation. */
@media (max-width:650px){

  .discovery-stage:has(.home-map.is-regional),.discovery-stage:has(.home-map.is-group){height:auto;min-height:0;max-height:none}
  .discovery-stage .home-map.is-regional,.discovery-stage .home-map.is-group{flex:none;min-height:0;aspect-ratio:3/5}
  .discovery-stage .home-map{transition:height 560ms cubic-bezier(.22,1,.36,1)}
  .discovery-stage .home-map .map-scroll{overflow-x:hidden}
}
@media (prefers-reduced-motion:reduce){

  .discovery-stage .home-map{transition:none!important}
}

/* Atlas China province polygons are shade masks, not administrative borders. */
.country-shape.province-fill-mask{stroke:none}
.map-cluster.is-unavailable .cluster-core{fill:#aeb9ae;opacity:.55}
.map-cluster.is-unavailable .cluster-count{fill:#f7f7f1}

/* Atlas narrow journey rail: reuse the canonical map-trip-card and its
   compact width. The rail owns only flow and the selected-label presentation. */
@media(max-width:650px){

  .home-map.has-journey-rail #map-journey-rail{position:absolute;z-index:8;left:0;right:0;bottom:0;display:flex;gap:10px;overflow-x:auto;overflow-y:hidden;scroll-snap-type:x mandatory;scroll-padding-inline:12px;overscroll-behavior-inline:contain;padding:8px 12px 12px;background:linear-gradient(transparent,var(--atlas-map-surface) 15%);scrollbar-width:none}
  #map-journey-rail::-webkit-scrollbar{display:none}
  .home-map.has-journey-rail #map-journey-rail .rail-trip-card{position:relative;left:auto;top:auto;flex:0 0 144px;width:144px;min-width:144px;height:92px;min-height:92px;max-height:92px;scroll-snap-align:start;transition:height .24s ease,min-height .24s ease,opacity .24s ease}
  #map-journey-rail .rail-trip-card .map-trip-toggle{height:100%;padding:9px 24px 7px 12px}
  #map-journey-rail .rail-trip-card .trip-card-detail{display:none}
  .home-map.has-journey-rail #map-journey-rail.is-selection .rail-trip-card{height:40px;min-height:40px;max-height:40px;grid-template-rows:minmax(0,1fr)}
  .discovery-stage #map-journey-rail .rail-trip-card.is-rail-label .map-trip-toggle{padding:0 8px;display:flex;align-items:center;justify-content:flex-start;text-align:left;min-width:0;min-height:0}
  #map-journey-rail .rail-trip-card.is-rail-label .trip-card-text{width:100%;min-width:0;min-height:0;display:flex;flex-direction:column;justify-content:center}
  #map-journey-rail .rail-trip-card.is-rail-label .map-trip-toggle small{flex:1;min-width:0;overflow-wrap:normal;text-wrap:balance}
  #map-journey-rail .rail-trip-card.is-rail-label h3,#map-journey-rail .rail-trip-card.is-rail-label .trip-card-compact-arrow{display:none}
  #map-journey-rail .rail-trip-card.is-rail-active{border-color:#e5c982;box-shadow:inset 0 0 0 2px #e5c982}
  #map-markers [data-journey].is-rail-visible .cluster-pulse{opacity:1}
  #map-markers [data-journey].is-rail-selected .cluster-core{stroke:#e5c982;stroke-width:3}
}
@media(prefers-reduced-motion:reduce){
#map-journey-rail .rail-trip-card{transition:none!important}
}
@media(max-width:650px){

  .home-map.has-journey-rail #map-markers .map-cluster .cluster-pulse{animation:none;opacity:0}
  .home-map.has-journey-rail:not(.has-expanded-preview) #map-markers .map-cluster:has(.is-rail-visible) .cluster-pulse{animation:cluster-pulse 2.4s ease-out infinite;opacity:1}
  .home-map.has-journey-rail #map-markers .map-cluster:has(.is-rail-selected) .cluster-core{stroke:#e5c982;stroke-width:3}
}

@media(max-width:650px){
.discovery-stage .map-trip-card{background-position:var(--trip-image-position-mobile,var(--trip-image-position,center))}
}

/* Internal administrative seams, independent of regional fill masks. */
.country-shape.us-state-mask{stroke:none}
.atlas-admin1-boundary{fill:none;stroke:#f8f8f2;stroke-width:.45;stroke-linejoin:round;stroke-linecap:round;vector-effect:non-scaling-stroke;pointer-events:none}
/* M163: grow ordinary wide-screen Home copy without changing approved narrow labels. */
@media (min-width: 761px) {

 .discovery-stage .map-trip-card p{font-size:var(--tyit-type-standard)}
}

@media(max-width:650px){
.home-map svg#discovery-map{font-size:13px;--atlas-count-size:13px;--atlas-detail-size:12px;--atlas-country-size:12px}
}
