.map-shell {
  width: var(--container);
  margin: 0 auto;
  padding: 52px 0 96px;
}

.map-hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 24px;
  align-items: end;
}

.map-hero h1 {
  margin: 0;
  font-size: clamp(2.8rem, 5vw, 4.6rem);
  line-height: 0.96;
  letter-spacing: -0.06em;
}

.map-hero__copy p:last-child {
  margin: 14px 0 0;
  max-width: 620px;
  color: var(--muted);
  font-size: 1.05rem;
}

.map-hero__stats {
  display: inline-flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 10px;
}

.map-hero__stats span {
  display: inline-flex;
  align-items: center;
  min-height: 38px;
  padding: 8px 14px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  box-shadow: var(--shadow-soft);
}

.map-stage {
  margin-top: 34px;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-2xl);
  background: linear-gradient(180deg, var(--map-stage-start), var(--map-stage-end));
  box-shadow: var(--shadow);
}

.map-box {
  position: relative;
  width: 100%;
  border-radius: 28px;
  overflow: hidden;
  border: 1px solid var(--map-stage-border);
  background:
    radial-gradient(circle at top left, var(--map-stage-glow), transparent 34%),
    var(--map-box-bg);
  box-shadow: var(--shadow-card);
}

.map-box::before {
  content: "";
  display: block;
  padding-bottom: 50%;
}

#world-map,
#pin-layer {
  position: absolute;
  inset: 0;
}

#world-map {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
  user-select: none;
}

#pin-layer {
  pointer-events: none;
}

.map-box.is-dragging #world-map {
  cursor: grabbing;
}

.map-overlay-title,
.map-legend,
.zone-label {
  z-index: 5;
}

.map-overlay-title {
  position: absolute;
  top: clamp(1rem, 2.5%, 1.5rem);
  left: clamp(1rem, 2.5%, 2rem);
  pointer-events: none;
  transition: opacity 0.45s ease;
}

.map-overlay-eyebrow {
  display: block;
  margin-bottom: 0.42rem;
  color: var(--map-eyebrow);
  font-size: 0.56rem;
  font-weight: 700;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.map-overlay-heading {
  margin: 0;
  color: var(--map-title);
  font-family: "Playfair Display", Georgia, serif;
  font-size: clamp(1.4rem, 3.2vw, 2.8rem);
  font-weight: 600;
  line-height: 1.02;
  letter-spacing: -0.03em;
}

.map-control-button {
  position: absolute;
  right: clamp(0.75rem, 2%, 1.5rem);
  z-index: 10;
  display: inline-flex;
  align-items: center;
  min-height: 34px;
  padding: 8px 12px;
  border: 1px solid var(--map-control-border);
  border-radius: 999px;
  background: var(--map-control-bg);
  color: var(--map-control-text);
  box-shadow: var(--shadow-soft);
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0;
  pointer-events: none;
  transition: opacity 220ms ease, color 220ms ease, background-color 220ms ease, transform 220ms ease;
}

.map-control-button.is-visible {
  opacity: 1;
  pointer-events: auto;
}

.map-control-button:hover {
  color: var(--text);
  transform: translateY(-2px);
}

.zoom-out-btn {
  top: clamp(0.75rem, 2%, 1.25rem);
}

.back-europe-btn {
  top: calc(clamp(0.75rem, 2%, 1.25rem) + 2.55rem);
}

.map-legend {
  position: absolute;
  bottom: clamp(0.75rem, 2%, 1.25rem);
  left: clamp(1rem, 2.5%, 2rem);
  display: flex;
  flex-direction: column;
  gap: 0.34rem;
  pointer-events: none;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--map-legend);
  font-size: 0.52rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
}

.legend-swatch {
  width: 10px;
  height: 10px;
  border-radius: 2px;
  flex: 0 0 auto;
}

.legend-swatch--lived {
  background: var(--map-lived);
}

.legend-swatch--visited {
  background: var(--map-visited);
}

.zone-label {
  position: absolute;
  bottom: clamp(0.75rem, 2%, 1.25rem);
  left: 50%;
  transform: translateX(-50%);
  color: var(--map-zone);
  font-size: 0.52rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 220ms ease;
}

.zone-label.is-visible {
  opacity: 1;
}

.map-loading {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--map-muted);
  font-size: 0.64rem;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.country {
  fill: var(--map-country);
  stroke: var(--map-country-stroke);
  stroke-width: 0.35;
  transition: fill 220ms ease;
}

.country--lived {
  fill: var(--map-lived);
}

.country--lived:hover {
  fill: var(--map-lived-hover);
  cursor: pointer;
}

.country--visited {
  fill: var(--map-visited);
}

.country--visited:hover {
  fill: var(--map-visited-hover);
  cursor: pointer;
}

.country-borders {
  fill: none;
  stroke: var(--map-country-border);
  stroke-width: 0.3;
  pointer-events: none;
}

.journey-arc {
  fill: none;
  stroke: var(--map-arc);
  pointer-events: none;
}

.city-pin {
  position: absolute;
  width: 0;
  height: 0;
  pointer-events: none;
}

.city-pin__hit {
  position: absolute;
  transform: translate(-50%, -50%);
  width: 26px;
  height: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  pointer-events: auto;
}

.city-pin__dot {
  position: relative;
  z-index: 2;
  width: 7px;
  height: 7px;
  border: 2px solid var(--map-dot-border);
  border-radius: 50%;
  background: var(--map-dot);
  flex: 0 0 auto;
  transition: transform 160ms ease, background-color 160ms ease;
}

.city-pin__hit:hover .city-pin__dot {
  transform: scale(1.6);
  background: var(--surface-elevated);
}

.city-pin.is-active .city-pin__dot {
  background: var(--accent);
}

.city-pin.is-current .city-pin__dot {
  width: 9px;
  height: 9px;
  background: var(--map-current);
}

.city-pin__ring {
  position: absolute;
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--map-current-ring);
  border-radius: 50%;
  pointer-events: none;
  animation: pinPulse 2.2s ease-out infinite;
}

@keyframes pinPulse {
  0% {
    opacity: 0.8;
    transform: scale(0.7);
  }

  100% {
    opacity: 0;
    transform: scale(2.5);
  }
}

.city-pin__card {
  position: absolute;
  left: 50%;
  bottom: 15px;
  min-width: 140px;
  padding: 0.58rem 0.85rem 0.62rem;
  border: 1px solid var(--map-panel-border);
  border-radius: 12px;
  background: var(--map-panel-bg);
  box-shadow: var(--map-panel-shadow);
  transform: translateX(-50%) translateY(5px);
  white-space: nowrap;
  pointer-events: none;
  opacity: 0;
  transition: opacity 180ms ease, transform 180ms ease;
  z-index: 100;
}

.city-pin__card::after {
  content: "";
  position: absolute;
  left: 50%;
  bottom: -6px;
  width: 2px;
  height: 6px;
  margin-left: -1px;
  background: var(--map-panel-tail);
}

.city-pin:hover .city-pin__card {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

.city-pin[data-dir="right"] .city-pin__card {
  top: 50%;
  left: 15px;
  bottom: auto;
  transform: translateY(calc(-50% + 4px));
}

.city-pin[data-dir="right"] .city-pin__card::after {
  top: 50%;
  left: -7px;
  bottom: auto;
  width: 7px;
  height: 2px;
  margin-left: 0;
  margin-top: -1px;
}

.city-pin[data-dir="right"]:hover .city-pin__card {
  transform: translateY(-50%);
}

.city-pin[data-dir="left"] .city-pin__card {
  top: 50%;
  right: 15px;
  left: auto;
  bottom: auto;
  transform: translateY(calc(-50% + 4px));
}

.city-pin[data-dir="left"] .city-pin__card::after {
  top: 50%;
  right: -7px;
  left: auto;
  bottom: auto;
  width: 7px;
  height: 2px;
  margin-left: 0;
  margin-top: -1px;
}

.city-pin[data-dir="left"]:hover .city-pin__card {
  transform: translateY(-50%);
}

.city-pin[data-dir="bottom"] .city-pin__card {
  top: 15px;
  bottom: auto;
  transform: translateX(-50%) translateY(-5px);
}

.city-pin[data-dir="bottom"] .city-pin__card::after {
  top: -6px;
  bottom: auto;
}

.city-pin[data-dir="bottom"]:hover .city-pin__card {
  transform: translateX(-50%) translateY(0);
}

.pcard-name,
.panel-city-name {
  font-family: "Playfair Display", Georgia, serif;
  line-height: 1.15;
}

.pcard-name {
  margin-bottom: 0.18rem;
  color: var(--map-panel-name);
  font-size: 0.88rem;
  font-weight: 600;
}

.pcard-period,
.panel-period {
  color: var(--map-panel-meta);
  letter-spacing: 0.06em;
}

.pcard-period {
  margin-bottom: 0.08rem;
  font-size: 0.58rem;
}

.pcard-dur,
.panel-dur {
  color: var(--map-lived);
  font-style: italic;
}

.pcard-dur {
  margin-bottom: 0.28rem;
  font-size: 0.6rem;
}

.pcard-tag,
.panel-tag {
  display: inline-block;
  padding: 0.12rem 0.46rem;
  border: 1px solid var(--map-tag-border);
  border-radius: 999px;
  color: var(--map-tag-text);
  font-size: 0.46rem;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-city-panel {
  width: 100%;
  max-height: 0;
  margin-top: 14px;
  overflow: hidden;
  opacity: 0;
  pointer-events: none;
  transition: max-height 450ms cubic-bezier(0.22, 1, 0.36, 1), opacity 300ms ease;
}

.map-city-panel.is-visible {
  max-height: 340px;
  opacity: 1;
  pointer-events: auto;
}

.panel-content {
  display: flex;
  align-items: flex-start;
  gap: 1.5rem;
  padding: 1.15rem 1.35rem;
  border: 1px solid var(--map-panel-border);
  border-radius: 20px;
  background: var(--map-panel-bg);
  box-shadow: var(--shadow-soft);
}

.panel-main {
  flex: 0 0 auto;
}

.panel-city-name {
  margin-bottom: 0.28rem;
  color: var(--map-panel-name);
  font-size: clamp(1rem, 2.2vw, 1.55rem);
  font-weight: 600;
}

.panel-period {
  margin-bottom: 0.12rem;
  font-size: 0.6rem;
}

.panel-dur {
  margin-bottom: 0.36rem;
  font-size: 0.64rem;
}

.panel-hint {
  display: none;
  margin-top: 0.42rem;
  color: var(--map-zone);
  font-size: 0.48rem;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.map-city-panel.is-europe .panel-hint {
  display: block;
}

.panel-close {
  flex: 0 0 auto;
  width: 28px;
  height: 28px;
  margin-left: auto;
  align-self: flex-start;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--map-control-border);
  border-radius: 999px;
  background: var(--surface-elevated);
  color: var(--muted);
  cursor: pointer;
  transition: transform 220ms ease, color 220ms ease, background-color 220ms ease;
}

.panel-close:hover {
  color: var(--text);
  background: var(--surface);
  transform: translateY(-1px);
}

.panel-city-detail {
  display: none;
  flex: 1;
  min-width: 0;
  padding-left: 1.4rem;
  border-left: 1px solid var(--map-detail-border);
  animation: panelDetailIn 350ms ease forwards;
}

@keyframes panelDetailIn {
  from {
    opacity: 0;
    transform: translateX(6px);
  }

  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.map-city-panel.is-city .panel-city-detail {
  display: block;
}

.panel-story {
  max-width: 52ch;
  margin: 0 0 0.7rem;
  color: var(--map-panel-body);
  font-size: 0.72rem;
  line-height: 1.78;
}

.panel-images {
  display: flex;
  gap: 0.45rem;
  overflow-x: auto;
  padding-bottom: 2px;
  scrollbar-width: none;
}

.panel-images::-webkit-scrollbar,
.map-timeline::-webkit-scrollbar {
  display: none;
}

.panel-img {
  height: 140px;
  min-width: 210px;
  object-fit: cover;
  border: 1px solid var(--map-detail-border);
  border-radius: 10px;
  background: var(--surface);
  opacity: 0.74;
  transition: opacity 220ms ease, transform 220ms ease;
  flex-shrink: 0;
  cursor: zoom-in;
}

.panel-img:hover {
  opacity: 1;
  transform: scale(1.03);
}

.map-timeline {
  display: flex;
  align-items: center;
  width: 100%;
  margin-top: 18px;
  overflow-x: auto;
  scrollbar-width: none;
  padding: 0.3rem 0;
}

.t-chip {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.12rem;
  padding: 0.45rem 0.65rem;
  border: none;
  border-radius: 10px;
  background: transparent;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color 200ms ease;
}

.t-chip + .t-chip::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 8px;
  height: 1px;
  transform: translateY(-50%);
  background: var(--map-chip-line);
}

.t-chip__city {
  color: var(--map-chip-city);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: color 200ms ease;
}

.t-chip__year {
  color: var(--map-chip-year);
  font-size: 0.5rem;
}

.t-chip:hover .t-chip__city {
  color: var(--text);
}

.t-chip.is-active {
  background: var(--map-chip-active-bg);
}

.t-chip.is-active .t-chip__city {
  color: var(--map-chip-active-city);
}

.t-chip.is-active .t-chip__year {
  color: var(--map-chip-active-year);
}

.map-hint {
  margin: 14px 0 0;
  color: var(--map-muted);
  font-size: 0.58rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  text-align: center;
}

:root {
  --map-stage-start: rgba(255, 255, 255, 0.96);
  --map-stage-end: rgba(244, 247, 251, 0.98);
  --map-stage-border: rgba(216, 221, 230, 0.92);
  --map-stage-glow: rgba(255, 255, 255, 0.42);
  --map-box-bg: #edf2f7;
  --map-country: #dfe6ee;
  --map-country-stroke: #eef3f8;
  --map-country-border: rgba(191, 201, 215, 0.8);
  --map-lived: #c28b13;
  --map-lived-hover: #db9f1d;
  --map-visited: #4e7fe6;
  --map-visited-hover: #2f68dd;
  --map-arc: rgba(194, 139, 19, 0.36);
  --map-title: rgba(15, 23, 42, 0.92);
  --map-eyebrow: rgba(194, 139, 19, 0.78);
  --map-legend: rgba(15, 23, 42, 0.5);
  --map-zone: rgba(194, 139, 19, 0.72);
  --map-muted: rgba(107, 114, 128, 0.7);
  --map-control-bg: rgba(255, 255, 255, 0.88);
  --map-control-border: rgba(216, 221, 230, 0.94);
  --map-control-text: rgba(17, 24, 39, 0.66);
  --map-panel-bg: rgba(255, 255, 255, 0.9);
  --map-panel-border: rgba(216, 221, 230, 0.94);
  --map-panel-shadow: 0 18px 44px rgba(17, 24, 39, 0.14);
  --map-panel-name: rgba(15, 23, 42, 0.94);
  --map-panel-meta: rgba(100, 116, 139, 0.66);
  --map-panel-body: rgba(71, 85, 105, 0.84);
  --map-panel-tail: rgba(216, 221, 230, 0.88);
  --map-tag-border: rgba(194, 139, 19, 0.26);
  --map-tag-text: rgba(194, 139, 19, 0.76);
  --map-detail-border: rgba(216, 221, 230, 0.92);
  --map-chip-line: rgba(148, 163, 184, 0.26);
  --map-chip-city: rgba(17, 24, 39, 0.38);
  --map-chip-year: rgba(100, 116, 139, 0.56);
  --map-chip-active-bg: rgba(37, 99, 235, 0.08);
  --map-chip-active-city: rgba(17, 24, 39, 0.96);
  --map-chip-active-year: rgba(37, 99, 235, 0.8);
  --map-dot: #c28b13;
  --map-dot-border: rgba(255, 255, 255, 0.92);
  --map-current: #22c55e;
  --map-current-ring: rgba(34, 197, 94, 0.26);
}

html[data-theme="dark"] {
  --map-stage-start: rgba(17, 25, 38, 0.96);
  --map-stage-end: rgba(12, 17, 24, 0.98);
  --map-stage-border: rgba(148, 163, 184, 0.18);
  --map-stage-glow: rgba(138, 180, 255, 0.08);
  --map-box-bg: #111110;
  --map-country: #1c1b19;
  --map-country-stroke: #282724;
  --map-country-border: #242320;
  --map-lived: #a87e04;
  --map-lived-hover: #c8a010;
  --map-visited: #1b4f8c;
  --map-visited-hover: #2563eb;
  --map-arc: rgba(196, 154, 6, 0.38);
  --map-title: rgba(245, 245, 240, 0.92);
  --map-eyebrow: rgba(196, 154, 6, 0.58);
  --map-legend: rgba(245, 245, 240, 0.38);
  --map-zone: rgba(196, 154, 6, 0.36);
  --map-muted: rgba(245, 245, 240, 0.18);
  --map-control-bg: rgba(14, 13, 12, 0.9);
  --map-control-border: rgba(196, 154, 6, 0.22);
  --map-control-text: rgba(196, 154, 6, 0.7);
  --map-panel-bg: rgba(10, 9, 8, 0.97);
  --map-panel-border: rgba(196, 154, 6, 0.18);
  --map-panel-shadow: 0 12px 36px rgba(0, 0, 0, 0.72);
  --map-panel-name: rgba(245, 245, 240, 0.95);
  --map-panel-meta: rgba(245, 245, 240, 0.32);
  --map-panel-body: rgba(245, 245, 240, 0.44);
  --map-panel-tail: rgba(196, 154, 6, 0.2);
  --map-tag-border: rgba(196, 154, 6, 0.18);
  --map-tag-text: rgba(196, 154, 6, 0.52);
  --map-detail-border: rgba(196, 154, 6, 0.1);
  --map-chip-line: rgba(196, 154, 6, 0.1);
  --map-chip-city: rgba(245, 245, 240, 0.24);
  --map-chip-year: rgba(196, 154, 6, 0.22);
  --map-chip-active-bg: rgba(240, 180, 41, 0.07);
  --map-chip-active-city: #f0b429;
  --map-chip-active-year: rgba(240, 180, 41, 0.45);
  --map-dot: #c49a06;
  --map-dot-border: #111110;
  --map-current: #4ade80;
  --map-current-ring: rgba(74, 222, 128, 0.28);
}

@media (max-width: 1080px) {
  .map-hero {
    grid-template-columns: 1fr;
    align-items: start;
  }

  .map-hero__stats {
    justify-content: flex-start;
  }
}

@media (max-width: 820px) {
  .panel-content {
    flex-direction: column;
    gap: 1rem;
  }

  .panel-city-detail {
    width: 100%;
    padding-left: 0;
    padding-top: 1rem;
    border-left: 0;
    border-top: 1px solid var(--map-detail-border);
  }
}

@media (max-width: 680px) {
  .map-shell {
    width: min(calc(100% - 28px), 1120px);
    padding: 38px 0 72px;
  }

  .map-stage {
    margin-top: 24px;
    padding: 14px;
    border-radius: 28px;
  }

  .map-box {
    border-radius: 22px;
  }

  .map-box::before {
    padding-bottom: 62%;
  }

  .map-overlay-title {
    top: 16px;
    left: 16px;
  }

  .map-overlay-heading {
    font-size: clamp(1.15rem, 7vw, 1.8rem);
  }

  .map-overlay-eyebrow,
  .legend-item,
  .zone-label,
  .map-hint {
    letter-spacing: 0.1em;
  }

  .map-legend {
    left: 16px;
    bottom: 14px;
  }

  .zoom-out-btn,
  .back-europe-btn {
    right: 12px;
    min-height: 30px;
    padding: 7px 10px;
    font-size: 0.6rem;
  }

  .back-europe-btn {
    top: calc(16px + 2.2rem);
  }

  .map-city-panel {
    margin-top: 12px;
  }

  .panel-content {
    padding: 1rem;
    border-radius: 18px;
  }

  .panel-img {
    height: 120px;
    min-width: 180px;
  }
}

@media (hover: none), (pointer: coarse) {
  .city-pin__card {
    display: none;
  }
}
