/* Countries map page — extends styles.css + travel.css tokens */

.map-hero{
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 20px var(--gutter) 8px;
}
.map-hero h1{
  font-weight: 700;
  font-size: clamp(2rem, 4.2vw, 2.75rem);
  letter-spacing: -0.02em;
  line-height: 1.15;
  margin: 0 0 10px;
}
.map-hero-sub{
  color: var(--ink-soft);
  font-size: 1.05rem;
  max-width: 62ch;
  margin: 0;
}

.map-main{
  max-width: var(--max-width);
  margin: 0 auto;
  padding: 28px var(--gutter) 8px;
}

/* Stat tiles */
.map-stats{
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(170px, 1fr));
  gap: 16px;
  margin-bottom: 20px;
}
.map-stat{
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.map-stat .num{
  font-family: var(--font-mono);
  font-size: 1.85rem;
  font-weight: 500;
  line-height: 1.1;
  color: var(--navy);
}
.map-stat .lbl{
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--ink-soft);
  margin-top: 4px;
}

/* Map card */
.map-card{
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 16px;
}
.map-toolbar{
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 4px 4px 14px;
}
.region-pills{
  display: inline-flex;
  flex-wrap: wrap;
  gap: 2px;
  background: var(--fill);
  border-radius: 999px;
  padding: 4px;
}
.region-pills button{
  border: 0;
  background: transparent;
  color: var(--ink-soft);
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.84rem;
  padding: 8px 14px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.region-pills button:hover{ color: var(--navy); }
.region-pills button.active{ background: var(--navy); color: #fff; }

.map-legend{
  display: flex;
  flex-wrap: wrap;
  gap: 8px 18px;
  font-size: 0.8rem;
  color: var(--ink-soft);
}
.map-legend .item{ display: inline-flex; align-items: center; gap: 7px; }
.map-legend .sw{ width: 12px; height: 12px; border-radius: 4px; display: inline-block; }
.sw-visited{ background: var(--navy); }
.sw-home{ background: var(--teal); }
.sw-other{ background: #D5DCE4; }

.map-stage{
  position: relative;
  background: #EAF0F6;
  border-radius: var(--radius-md);
  overflow: hidden;
}
.map-stage svg{
  display: block;
  width: 100%;
  height: auto;
  cursor: grab;
  touch-action: none;
}
.map-stage svg:active{ cursor: grabbing; }

.graticule{ fill: none; stroke: rgba(29,63,114,0.07); stroke-width: 0.6; vector-effect: non-scaling-stroke; }
.country{
  fill: #D5DCE4;
  stroke: #fff;
  stroke-width: 0.5;
  vector-effect: non-scaling-stroke;
  transition: fill 0.25s ease;
}
.country.visited{ fill: var(--navy); cursor: pointer; }
.country.home{ fill: var(--teal); cursor: pointer; }
.country.visited:hover, .country.visited.hl{ fill: #2C5A9C; }
.country.home:hover, .country.home.hl{ fill: #2C9497; }
.country.selected{ fill: #2C5A9C; stroke: #fff; stroke-width: 1.6; }
.country.pending{ fill: #D5DCE4; }

.marker{
  fill: var(--navy);
  stroke: #fff;
  stroke-width: 1.5;
  vector-effect: non-scaling-stroke;
  cursor: pointer;
}
.marker.home{ fill: var(--teal); }
.marker.hl, .marker:hover, .marker.selected{ fill: #2C5A9C; }

/* Zoom buttons */
.zoom-controls{
  position: absolute;
  right: 12px;
  bottom: 12px;
  display: flex;
  flex-direction: column;
  background: #fff;
  border-radius: 14px;
  box-shadow: var(--shadow);
  overflow: hidden;
}
.zoom-controls button{
  width: 40px;
  height: 40px;
  border: 0;
  background: #fff;
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 1.2rem;
  line-height: 1;
  cursor: pointer;
}
.zoom-controls button + button{ border-top: 1px solid var(--line); }
.zoom-controls button:hover{ background: var(--fill); color: var(--navy); }

/* Hover label */
.map-tip{
  position: absolute;
  pointer-events: none;
  background: var(--ink);
  color: #fff;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 6px 10px;
  border-radius: 8px;
  white-space: nowrap;
  transform: translate(-50%, calc(-100% - 12px));
  opacity: 0;
  transition: opacity 0.12s ease;
  z-index: 3;
}
.map-tip.show{ opacity: 1; }
.map-tip .sub{ display: block; font-weight: 400; color: #C3D3E8; font-size: 0.75rem; }

.map-status{
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 24px;
  font-size: 0.92rem;
  color: var(--ink-soft);
}

.map-hint{
  margin: 10px 4px 0;
  font-size: 0.8rem;
  color: var(--ink-soft);
}

/* Selected country detail */
.country-detail{
  margin-top: 14px;
  background: var(--fill);
  border-radius: var(--radius-md);
  padding: 18px 20px;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 12px 24px;
  min-height: 72px;
}
.country-detail h2{
  margin: 0;
  font-size: 1.2rem;
  font-weight: 700;
}
.country-detail .region{
  font-size: 0.82rem;
  color: var(--ink-soft);
  margin-top: 2px;
}
.country-detail .placeholder{ color: var(--ink-soft); font-size: 0.92rem; margin: 0; }
.trip-links{ display: flex; flex-wrap: wrap; gap: 8px; }
.trip-links a{
  display: inline-block;
  background: var(--navy);
  color: #fff;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 9px 16px;
  border-radius: 999px;
}
.trip-links a:hover{ background: var(--navy-deep); color: #fff; }
.trip-links .none{ font-size: 0.85rem; color: var(--ink-soft); }

/* Country list by region */
.country-list{ margin-top: 36px; }
.country-list h2{
  font-size: clamp(1.4rem, 2.4vw, 1.7rem);
  font-weight: 700;
  margin: 0 0 4px;
}
.country-list > p{ color: var(--ink-soft); margin: 0 0 20px; }
.region-groups{
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
  align-items: start;
}
.region-group{
  background: var(--card);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  padding: 20px 22px;
}
.region-group h3{
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin: 0 0 12px;
  font-size: 1rem;
  font-weight: 700;
}
.region-group h3 .count{
  font-family: var(--font-mono);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--navy);
}
.country-chips{ display: flex; flex-wrap: wrap; gap: 6px; }
.country-chips button{
  border: 0;
  background: var(--navy-tint);
  color: var(--navy);
  font-family: var(--font-sans);
  font-size: 0.84rem;
  font-weight: 600;
  padding: 7px 13px;
  border-radius: 999px;
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.country-chips button:hover,
.country-chips button.active{ background: var(--navy); color: #fff; }
.country-chips button.home{ background: rgba(35,119,122,0.12); color: var(--teal); }
.country-chips button.home:hover,
.country-chips button.home.active{ background: var(--teal); color: #fff; }

@media (max-width: 560px){
  .map-stats{ grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .map-stat{ padding: 16px; border-radius: var(--radius-md); }
  .map-card{ padding: 10px; }
  .zoom-controls{ right: 8px; bottom: 8px; }
  .zoom-controls button{ width: 36px; height: 36px; }
}
