/*
 * LiGaiZiT city-first atlas redesign.
 * Translucent surfaces are a web approximation of spatial materials.
 */

:root {
  --bg: #e8efec;
  --bg-deep: #dbe7e2;
  --surface: rgba(247, 251, 249, 0.78);
  --surface-solid: #f4f8f6;
  --surface-soft: rgba(222, 234, 229, 0.86);
  --text: #14231f;
  --text-soft: #5b6c66;
  --text-faint: #7b8b85;
  --hairline: rgba(24, 54, 45, 0.16);
  --glass-edge: rgba(255, 255, 255, 0.78);
  --sea: #c8d9d3;
  --grid: rgba(39, 82, 68, 0.14);
  --land: #aab7b3;
  --land-hover: #94a7a0;
  --accent: #183f35;
  --accent-text: #f3f8f6;
  --visited: #2f7f67;
  --planned: #d97832;
  --guide: #d7a62d;
  --unvisited: #8f9d98;
  --shadow: 0 28px 90px rgba(29, 65, 53, 0.15);
  --shadow-small: 0 14px 44px rgba(29, 65, 53, 0.12);
  --radius-map: 28px;
  --radius-card: 22px;
  --content-width: 1820px;
}

:root[data-theme="dark"] {
  --bg: #101a17;
  --bg-deep: #0b1311;
  --surface: rgba(25, 39, 35, 0.8);
  --surface-solid: #192824;
  --surface-soft: rgba(34, 52, 46, 0.9);
  --text: #edf5f1;
  --text-soft: #a8b8b2;
  --text-faint: #879a93;
  --hairline: rgba(222, 240, 234, 0.14);
  --glass-edge: rgba(255, 255, 255, 0.15);
  --sea: #192b26;
  --grid: rgba(186, 222, 210, 0.11);
  --land: #42534d;
  --land-hover: #576b63;
  --accent: #dcece6;
  --accent-text: #10201b;
  --visited: #67b997;
  --planned: #ed9a50;
  --guide: #efc55b;
  --unvisited: #67766f;
  --shadow: 0 30px 96px rgba(0, 0, 0, 0.36);
  --shadow-small: 0 15px 46px rgba(0, 0, 0, 0.27);
}

body {
  background:
    radial-gradient(circle at 8% 2%, rgba(255, 255, 255, 0.58), transparent 28rem),
    radial-gradient(circle at 92% 16%, color-mix(in srgb, var(--visited) 8%, transparent), transparent 32rem),
    var(--bg);
}

.atlas {
  display: block;
  min-height: 100dvh;
  padding: 0 max(1rem, env(safe-area-inset-right)) env(safe-area-inset-bottom) max(1rem, env(safe-area-inset-left));
}

.site-header {
  position: relative;
  display: flex;
  width: min(100%, var(--content-width));
  height: 4.35rem;
  margin: 0 auto;
  padding: 0 0.35rem;
}

.brand-mark {
  width: 2.25rem;
  height: 2.25rem;
  background: var(--accent);
  box-shadow: 0 8px 22px color-mix(in srgb, var(--accent) 18%, transparent);
}

.brand-name {
  font-size: 0.72rem;
  letter-spacing: 0.19em;
}

.hero-copy,
:root[data-atlas-level="country"] .hero-copy,
:root[data-atlas-level="region"] .hero-copy {
  position: relative;
  z-index: 3;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(16rem, 29rem);
  align-items: end;
  width: min(100%, var(--content-width));
  margin: 0 auto;
  padding: clamp(1.25rem, 3vw, 3.3rem) 0.35rem clamp(1.6rem, 3.2vw, 3.5rem);
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

.hero-copy .eyebrow {
  grid-column: 1 / -1;
  margin: 0 0 0.85rem;
  color: var(--visited);
  font-size: 0.67rem;
  letter-spacing: 0.22em;
}

.hero-copy h1 {
  max-width: 13ch;
  margin: 0;
  font-size: clamp(3rem, 5.7vw, 6.8rem);
  font-weight: 690;
  letter-spacing: -0.07em;
  line-height: 0.87;
  text-wrap: balance;
}

.hero-copy h1 em {
  display: block;
  margin-top: 0.12em;
  color: var(--visited);
  font-size: 0.73em;
  font-style: normal;
  font-weight: 650;
  letter-spacing: -0.065em;
  line-height: 1;
}

.hero-copy .lede {
  max-width: 27rem;
  margin: 0 0 0.35rem;
  color: var(--text-soft);
  font-size: clamp(0.98rem, 1.2vw, 1.16rem);
  line-height: 1.8;
}

.glass-web-approx {
  border: 1px solid var(--glass-edge);
  background:
    linear-gradient(142deg, rgba(255, 255, 255, 0.26), rgba(255, 255, 255, 0.045)),
    var(--surface);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.28), var(--shadow-small);
  -webkit-backdrop-filter: blur(26px) saturate(155%);
  backdrop-filter: blur(26px) saturate(155%);
}

.map-shell {
  position: relative;
  z-index: 2;
  width: min(100%, var(--content-width));
  min-height: 0;
  margin: 0 auto;
}

.map-toolbar,
.map-shell.has-detail-panel .map-toolbar {
  position: relative;
  top: auto;
  right: auto;
  left: auto;
  display: grid;
  grid-template-columns: minmax(15rem, 1fr) auto;
  width: 100%;
  min-height: 5rem;
  margin: 0 0 0.75rem;
  padding: 0.72rem 0.85rem 0.72rem 1.15rem;
  border-radius: var(--radius-card);
  transform: none;
}

.map-heading {
  display: grid;
  min-width: 0;
  align-content: center;
}

.map-toolbar h2 {
  font-size: 1rem;
  letter-spacing: -0.025em;
}

.map-toolbar p {
  color: var(--text-soft);
  font-size: 0.72rem;
}

.map-toolbar-actions {
  gap: 0.6rem;
}

.search-toggle {
  min-height: 2.8rem;
  padding: 0 1rem;
  border-color: var(--hairline);
  background: color-mix(in srgb, var(--surface-solid) 74%, transparent);
}

.filter-group {
  padding: 0.18rem;
  border: 1px solid var(--hairline);
  border-radius: 999px;
  background: color-mix(in srgb, var(--surface-soft) 58%, transparent);
}

.filter-button {
  min-height: 2.55rem;
}

.filter-button.is-active {
  background: var(--accent);
  box-shadow: 0 7px 20px color-mix(in srgb, var(--accent) 19%, transparent);
}

.map-stage {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(19rem, 22rem);
  height: clamp(39rem, 71dvh, 53rem);
  min-height: 0;
  gap: 0.75rem;
}

.map-frame {
  position: relative;
  inset: auto;
  height: 100%;
  min-width: 0;
  min-height: 0;
  border-radius: var(--radius-map);
  background:
    radial-gradient(circle at 68% 28%, rgba(255, 255, 255, 0.49), transparent 31%),
    linear-gradient(145deg, color-mix(in srgb, var(--sea) 84%, white), var(--sea));
  box-shadow: var(--shadow);
}

.map-frame::before {
  position: absolute;
  inset: 0;
  z-index: 0;
  border-radius: inherit;
  background:
    linear-gradient(115deg, rgba(255, 255, 255, 0.13), transparent 28%),
    repeating-radial-gradient(circle at 35% 42%, transparent 0 48px, color-mix(in srgb, var(--grid) 42%, transparent) 49px 50px);
  content: "";
  opacity: 0.45;
  pointer-events: none;
}

#world-map {
  z-index: 1;
}

.country {
  stroke: color-mix(in srgb, var(--text) 23%, var(--sea));
  stroke-width: 0.78;
}

.country.is-interactive:hover,
.country.is-highlighted {
  stroke: color-mix(in srgb, var(--text) 82%, transparent);
  stroke-width: 1.9;
}

.admin-region {
  stroke: color-mix(in srgb, var(--text) 78%, var(--sea));
  stroke-width: 2.15;
}

.admin-region:hover,
.admin-region:focus-visible,
.admin-region.is-highlighted {
  stroke-width: 3.65;
  filter: drop-shadow(0 0 4px color-mix(in srgb, var(--text) 32%, transparent));
}

.map-marker .marker-core {
  stroke-width: 3.5;
}

.map-marker .marker-ring {
  stroke-width: 2.25;
  opacity: 0.68;
}

.map-marker .marker-label-bg {
  fill: color-mix(in srgb, var(--surface-solid) 94%, transparent);
}

.map-marker .marker-label {
  font-size: 12.5px;
  font-weight: 760;
}

.map-marker.is-label-hidden .marker-label,
.map-marker.is-label-hidden .marker-label-bg {
  opacity: 0;
  pointer-events: none;
}

.map-marker.is-label-hidden:hover .marker-label,
.map-marker.is-label-hidden:hover .marker-label-bg,
.map-marker.is-label-hidden:focus-visible .marker-label,
.map-marker.is-label-hidden:focus-visible .marker-label-bg,
.map-marker.is-active .marker-label,
.map-marker.is-active .marker-label-bg {
  opacity: 1;
}

.map-route-world {
  stroke-width: 2.6;
  opacity: 0.72;
}

.zoom-controls {
  right: 1rem;
  bottom: 1rem;
  z-index: 14;
}

.map-frame.has-detail .zoom-controls {
  right: 23.5rem;
}

.map-footer {
  position: absolute;
  bottom: 1.2rem;
  left: 1.35rem;
  z-index: 7;
}

.travel-stats {
  gap: 1.05rem;
  padding: 0.62rem 0.72rem;
  border: 1px solid color-mix(in srgb, var(--glass-edge) 74%, transparent);
  border-radius: 1rem;
  background: color-mix(in srgb, var(--surface) 58%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(145%);
  backdrop-filter: blur(16px) saturate(145%);
}

.travel-stats dd {
  font-size: 1.25rem;
}

.gesture-hint {
  padding: 0.4rem 0.55rem;
  border-radius: 0.65rem;
  background: color-mix(in srgb, var(--surface) 50%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}

.destination-dock {
  position: relative;
  z-index: 8;
  display: grid;
  grid-column: 2;
  grid-row: 1;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: auto auto minmax(0, 1fr) auto;
  width: auto;
  min-width: 0;
  height: 100%;
  margin: 0;
  padding: 0.85rem;
  overflow: hidden;
  border-radius: var(--radius-map);
}

.dock-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0.35rem 0.9rem;
}

.dock-header p,
.dock-header h3 {
  margin: 0;
}

.dock-header p {
  color: var(--visited);
  font-size: 0.64rem;
  font-weight: 760;
  letter-spacing: 0.12em;
}

.dock-header h3 {
  margin-top: 0.18rem;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: -0.045em;
}

.dock-header > span {
  flex: 0 0 auto;
  margin-top: 0.18rem;
  padding: 0.38rem 0.52rem;
  border: 1px solid var(--hairline);
  border-radius: 0.7rem;
  color: var(--text-soft);
  font-size: 0.66rem;
  font-variant-numeric: tabular-nums;
}

.dock-search {
  position: relative;
  display: block;
  margin-bottom: 0.65rem;
}

.dock-search > span {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

.dock-search input {
  width: 100%;
}

.dock-search input {
  min-height: 2.85rem;
  padding: 0 0.88rem;
  border: 1px solid var(--hairline);
  border-radius: 0.9rem;
  outline: none;
  background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
  color: var(--text);
  font: inherit;
  font-size: 0.78rem;
}

.dock-search input::placeholder {
  color: var(--text-faint);
}

.dock-search input:focus {
  border-color: color-mix(in srgb, var(--visited) 72%, transparent);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--visited) 15%, transparent);
}

.dock-items {
  display: grid;
  min-height: 0;
  align-content: start;
  gap: 0.22rem;
  overflow-x: hidden;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 0.1rem 0.12rem 0.45rem;
  scroll-snap-type: none;
  scrollbar-color: color-mix(in srgb, var(--text-soft) 32%, transparent) transparent;
  scrollbar-width: thin;
}

.dock-items .destination-button {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  flex: none;
  width: 100%;
  min-height: 3.8rem;
  gap: 0.7rem;
  padding: 0.62rem 0.7rem;
  border-radius: 0.95rem;
  scroll-snap-align: none;
}

.dock-items .destination-button:hover,
.dock-items .destination-button:focus-visible,
.dock-items .destination-button.is-active {
  background: color-mix(in srgb, var(--surface-solid) 92%, transparent);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--hairline) 68%, transparent);
}

.destination-button small {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dock-group-title {
  position: sticky;
  top: -0.1rem;
  z-index: 2;
  margin: 0.65rem 0 0.2rem;
  padding: 0.38rem 0.68rem;
  background: color-mix(in srgb, var(--surface-solid) 90%, transparent);
  color: var(--text-soft);
  font-size: 0.64rem;
  font-weight: 760;
  letter-spacing: 0.06em;
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
}

.dock-more {
  min-height: 2.8rem;
  margin-top: 0.55rem;
  border: 1px solid var(--hairline);
  border-radius: 0.9rem;
  background: color-mix(in srgb, var(--surface-solid) 76%, transparent);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 720;
  cursor: pointer;
}

.dock-empty {
  padding: 3rem 1rem;
  color: var(--text);
  text-align: center;
}

.dock-empty strong,
.dock-empty p {
  display: block;
  margin: 0;
}

.dock-empty strong {
  font-size: 0.86rem;
}

.dock-empty p {
  margin-top: 0.35rem;
  color: var(--text-soft);
  font-size: 0.7rem;
}

.detail-sheet {
  top: 50%;
  right: 1rem;
  width: min(21.5rem, calc(100% - 2rem));
  max-height: calc(100% - 2rem);
}

.explorer-panel {
  top: 1rem;
  right: 1rem;
  bottom: 1rem;
}

.map-notice {
  top: 1rem;
}

.site-footer {
  display: flex;
  width: min(100%, var(--content-width));
  min-height: 4.5rem;
  margin: 0 auto;
  padding: 0 0.35rem;
}

@media (prefers-reduced-motion: no-preference) {
  .hero-copy .eyebrow {
    animation: city-first-reveal 640ms 90ms both cubic-bezier(0.16, 1, 0.3, 1);
  }

  .hero-copy h1 {
    animation: city-first-reveal 820ms 150ms both cubic-bezier(0.16, 1, 0.3, 1);
  }

  .hero-copy .lede {
    animation: city-first-reveal 740ms 230ms both cubic-bezier(0.16, 1, 0.3, 1);
  }

  .map-toolbar {
    animation: city-first-reveal 700ms 260ms both cubic-bezier(0.16, 1, 0.3, 1);
  }

  .map-stage {
    animation: city-first-stage 900ms 310ms both cubic-bezier(0.16, 1, 0.3, 1);
  }
}

@keyframes city-first-reveal {
  from { opacity: 0; transform: translate3d(0, 18px, 0); }
  to { opacity: 1; transform: translate3d(0, 0, 0); }
}

@keyframes city-first-stage {
  from { opacity: 0; transform: translate3d(0, 22px, 0) scale(0.992); }
  to { opacity: 1; transform: translate3d(0, 0, 0) scale(1); }
}

@media (max-width: 1120px) {
  .hero-copy,
  :root[data-atlas-level="country"] .hero-copy,
  :root[data-atlas-level="region"] .hero-copy {
    display: grid;
    width: min(100%, var(--content-width));
    margin: 0 auto;
  }

  .map-stage {
    grid-template-columns: minmax(0, 1fr) minmax(17.5rem, 19rem);
  }

  .map-toolbar-actions {
    max-width: none;
  }
}

@media (max-width: 900px) {
  .hero-copy,
  :root[data-atlas-level="country"] .hero-copy,
  :root[data-atlas-level="region"] .hero-copy {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .hero-copy h1 {
    max-width: 13ch;
  }

  .hero-copy .lede {
    max-width: 34rem;
    margin: 0;
  }

  .map-stage {
    grid-template-columns: 1fr;
    height: auto;
    min-height: 0;
  }

  .map-frame {
    height: auto;
    min-height: clamp(39rem, 71dvh, 53rem);
  }

  .destination-dock {
    grid-column: 1;
    grid-row: 2;
    height: 22rem;
    border-radius: var(--radius-card);
  }
}

@media (max-width: 760px) {
  :root {
    --radius-map: 22px;
    --radius-card: 18px;
  }

  .atlas {
    padding-right: max(0.62rem, env(safe-area-inset-right));
    padding-left: max(0.62rem, env(safe-area-inset-left));
  }

  .site-header {
    height: 3.9rem;
    padding: 0 0.15rem;
  }

  .hero-copy,
  :root[data-atlas-level="country"] .hero-copy,
  :root[data-atlas-level="region"] .hero-copy {
    display: grid;
    width: 100%;
    margin: 0;
    padding: 1rem 0.15rem 1.5rem;
    opacity: 1;
    transform: none;
  }

  .hero-copy .eyebrow {
    margin-bottom: 0.55rem;
    font-size: 0.58rem;
  }

  .hero-copy h1 {
    max-width: 12ch;
    font-size: clamp(2.5rem, 13vw, 4rem);
    line-height: 0.91;
  }

  .hero-copy .lede {
    max-width: 28rem;
    font-size: 0.88rem;
    line-height: 1.65;
  }

  .map-toolbar,
  .map-shell.has-detail-panel .map-toolbar {
    position: relative;
    top: auto;
    right: auto;
    left: auto;
    display: grid;
    width: 100%;
    margin-bottom: 0.55rem;
    padding: 0.65rem;
  }

  .map-frame {
    min-height: max(34rem, 66dvh);
  }

  #world-map {
    top: 0;
    height: 100%;
  }

  .map-stage {
    gap: 0.55rem;
  }

  .destination-dock {
    display: grid;
    width: 100%;
    height: 20rem;
    margin: 0;
    padding: 0.72rem;
    overflow: hidden;
  }

  .dock-header {
    padding: 0.2rem 0.25rem 0.68rem;
  }

  .dock-header h3 {
    font-size: 1.25rem;
  }
  .dock-items {
    display: flex;
    gap: 0.35rem;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x proximity;
  }

  .dock-items .destination-button {
    display: grid;
    flex: 0 0 11.5rem;
    width: 11.5rem;
    min-height: 5rem;
    align-content: center;
    scroll-snap-align: start;
  }

  .dock-group-title {
    position: static;
    flex: 0 0 auto;
    align-self: stretch;
    margin: 0;
    padding: 0.55rem 0.4rem;
    writing-mode: vertical-rl;
  }

  .dock-more {
    margin-top: 0.45rem;
  }

  .map-frame.has-detail .zoom-controls {
    right: 0.72rem;
    opacity: 0;
    pointer-events: none;
  }

  .map-footer {
    position: absolute;
    bottom: 21.2rem;
    left: 0.8rem;
  }

  .detail-sheet {
    top: auto;
    right: 0.68rem;
    bottom: 0.68rem;
    left: 0.68rem;
    width: auto;
    max-height: calc(100% - 1.36rem);
  }

  .explorer-panel {
    top: auto;
    right: 0.68rem;
    bottom: 0.68rem;
    left: 0.68rem;
  }

  .site-footer {
    min-height: 4.2rem;
    padding: 0 0.15rem;
  }
}

@media (max-width: 430px) {
  .hero-copy h1 {
    font-size: clamp(2.3rem, 12.5vw, 3.25rem);
  }

  .hero-copy h1 em {
    font-size: 0.69em;
  }

  .map-toolbar h2 {
    font-size: 0.84rem;
  }

  .destination-dock {
    height: 18.5rem;
  }

  .map-footer {
    bottom: 19.7rem;
  }
}

@media (prefers-reduced-transparency: reduce) {
  .glass-web-approx,
  .travel-stats,
  .gesture-hint,
  .dock-group-title {
    background: var(--surface-solid);
    -webkit-backdrop-filter: none;
    backdrop-filter: none;
  }
}

@media (prefers-contrast: more) {
  .admin-region {
    stroke: var(--text);
    stroke-width: 2.8;
  }

  .admin-region:hover,
  .admin-region:focus-visible,
  .admin-region.is-highlighted {
    stroke-width: 4.2;
  }

  .country,
  .destination-button,
  .dock-search input {
    border-color: var(--text);
  }
}
