@import url("/assets/css/site.css");
@import url("/assets/css/language-search.css");

:root {
  --black: #302e2f;
  --navy: #353e50;
  --gray: #787d86;
  --light-gray: #bbbcbc;
  --white: #f1f2f2;
  --panel: rgba(248, 249, 249, 0.92);
  --line: rgba(120, 125, 134, 0.25);
  --shadow: 0 18px 55px rgba(48, 46, 47, 0.14);
  --map-ocean: #6d7b82;
  --map-ocean-deep: #5f6e75;
  --map-land: #f7f8f6;
}

* { box-sizing: border-box; }

html,
body {
  width: 100%;
  min-height: 100%;
  margin: 0;
}

body {
  overflow: hidden;
  background: var(--white);
  color: var(--black);
  font-family: "Noto Sans", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select { font: inherit; }

button,
a,
select { -webkit-tap-highlight-color: transparent; }

:focus-visible {
  outline: 3px solid rgba(53, 62, 80, 0.3);
  outline-offset: 3px;
}

.map-page {
  height: 100svh;
  display: grid;
  grid-template-rows: 92px minmax(0, 1fr);
}

.map-topbar {
  position: relative;
  z-index: 1000;
  display: grid;
  grid-template-columns: minmax(180px, 1fr) auto minmax(310px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 0 var(--site-gutter);
  border-bottom: 1px solid var(--line);
  background: rgba(241, 242, 242, 0.9);
  backdrop-filter: blur(18px);
}

.map-logo-link {
  display: inline-flex;
  align-items: center;
  width: fit-content;
}

.map-logo {
  display: block;
  width: var(--site-logo-width);
  height: auto;
}

.map-page-title { text-align: center; }

.map-page-title p {
  margin: 0 0 4px;
  color: var(--gray);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.12em;
  line-height: 1;
  text-transform: uppercase;
}

.map-page-title h1 {
  margin: 0;
  font-size: clamp(1.18rem, 2vw, 1.55rem);
  font-weight: 900;
  letter-spacing: -0.055em;
  line-height: 1;
}

.map-nav {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--site-nav-gap);
}

.map-nav a {
  min-height: var(--site-nav-height);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 var(--site-nav-padding);
  border: 2px solid rgba(187, 188, 188, 0.72);
  border-radius: 999px;
  background: rgba(241, 242, 242, 0.7);
  color: var(--black);
  font-size: var(--site-nav-font-size);
  font-weight: 800;
  letter-spacing: -0.025em;
  line-height: 1;
  text-decoration: none;
}

.map-nav a:hover { background: rgba(255, 255, 255, 0.82); }

.map-workspace {
  position: relative;
  min-height: 0;
  overflow: hidden;
  isolation: isolate;
}

.language-map-canvas {
  position: absolute;
  inset: 0;
  z-index: 1;
  background:
    radial-gradient(circle at 28% 18%, rgba(255, 255, 255, 0.08), transparent 38%),
    linear-gradient(155deg, var(--map-ocean), var(--map-ocean-deep));
}

.language-map-canvas.leaflet-container { background-color: var(--map-ocean-deep); }

.lexiark-world-land {
  pointer-events: none;
  user-select: none;
}

.lexiark-language-surface {
  pointer-events: none;
  user-select: none;
  overflow: visible !important;
  filter: blur(8px) saturate(0.96);
  backface-visibility: hidden;
  will-change: transform;
}

.lexiark-language-surface path {
  mix-blend-mode: screen;
}

.map-control-panel {
  position: absolute;
  z-index: 600;
  top: 22px;
  left: var(--site-gutter);
  width: min(360px, calc(100% - 40px));
  overflow: visible;
  border: 1px solid rgba(255, 255, 255, 0.78);
  border-radius: 24px;
  background: var(--panel);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px);
}

.map-control-heading {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 20px 20px 16px;
}

.map-eyebrow {
  margin: 0 0 5px;
  color: var(--gray);
  font-size: 0.64rem;
  font-weight: 900;
  letter-spacing: 0.11em;
  line-height: 1;
  text-transform: uppercase;
}

.map-control-heading h2 {
  margin: 0;
  font-size: 1.28rem;
  font-weight: 900;
  letter-spacing: -0.05em;
  line-height: 1.08;
}

.map-panel-toggle {
  width: 36px;
  height: 36px;
  display: grid;
  place-items: center;
  flex: 0 0 auto;
  border: 1px solid var(--line);
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.72);
  color: var(--navy);
  cursor: pointer;
  font-weight: 900;
  transition: transform 180ms ease;
}

.map-control-panel.is-collapsed .map-panel-toggle { transform: rotate(180deg); }
.map-control-panel.is-collapsed .map-control-body { display: none; }

.map-control-body { padding: 0 20px 20px; }

.map-search-wrap { position: relative; }

.map-search-control {
  min-height: 50px;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 0 15px;
  border: 2px solid rgba(187, 188, 188, 0.72);
  border-radius: 16px;
  background: rgba(255, 255, 255, 0.78);
}

.map-search-control:focus-within {
  border-color: rgba(53, 62, 80, 0.72);
  box-shadow: 0 0 0 4px rgba(53, 62, 80, 0.08);
}

.map-search-control img { width: 20px; height: 20px; opacity: 0.7; }

.map-search-control input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  background: transparent;
  color: var(--black);
  font-size: 0.92rem;
  font-weight: 700;
}

.map-search-results {
  position: absolute;
  z-index: 1000;
  top: calc(100% + 8px);
  left: 0;
  right: 0;
  max-height: min(360px, 44vh);
  overflow-y: auto;
  padding: 7px;
  border: 1px solid rgba(120, 125, 134, 0.2);
  border-radius: 18px;
  background: rgba(255, 255, 255, 0.98);
  box-shadow: 0 18px 45px rgba(48, 46, 47, 0.17);
}

.map-search-result {
  width: 100%;
  display: grid;
  grid-template-columns: 38px minmax(0, 1fr) auto;
  align-items: center;
  gap: 10px;
  padding: 9px 10px;
  border: 0;
  border-radius: 13px;
  background: transparent;
  color: var(--black);
  text-align: left;
  cursor: pointer;
}

.map-search-result:hover,
.map-search-result.is-active { background: var(--language-soft, rgba(53, 62, 80, 0.1)); }

.map-result-swatch {
  width: 34px;
  height: 34px;
  border-radius: 11px;
  background: var(--language-color, var(--navy));
  box-shadow: 0 0 0 5px var(--language-soft, rgba(53, 62, 80, 0.1));
}

.map-search-result strong,
.map-search-result small { display: block; }
.map-search-result strong { font-size: 0.84rem; font-weight: 900; line-height: 1.15; }
.map-search-result small { margin-top: 3px; color: var(--gray); font-size: 0.68rem; font-weight: 700; }
.map-result-state { color: var(--gray); font-size: 0.62rem; font-weight: 800; white-space: nowrap; }

.map-field {
  display: grid;
  gap: 7px;
  margin-top: 16px;
}

.map-field > span {
  color: var(--gray);
  font-size: 0.7rem;
  font-weight: 900;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.map-field select {
  width: 100%;
  min-height: 46px;
  padding: 0 14px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: rgba(255, 255, 255, 0.74);
  color: var(--black);
  font-weight: 750;
}

.map-actions {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 9px;
  margin-top: 16px;
}

.map-primary-button,
.map-secondary-button {
  min-height: 42px;
  padding: 0 15px;
  border-radius: 999px;
  cursor: pointer;
  font-size: 0.78rem;
  font-weight: 900;
  line-height: 1;
}

.map-primary-button { border: 2px solid var(--navy); background: var(--navy); color: white; }
.map-secondary-button { border: 2px solid rgba(187, 188, 188, 0.72); background: rgba(255, 255, 255, 0.7); color: var(--black); }

.map-status {
  margin: 16px 0 0;
  padding-top: 15px;
  border-top: 1px solid var(--line);
  color: var(--gray);
  font-size: 0.75rem;
  font-weight: 700;
  line-height: 1.45;
}

.map-key {
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-top: 12px;
  color: var(--gray);
  font-size: 0.66rem;
  font-weight: 750;
}

.map-key span { display: inline-flex; align-items: center; gap: 6px; }
.map-key i { width: 12px; height: 12px; border-radius: 4px; }
.map-key .mapped {
  background: rgba(53, 62, 80, 0.42);
  box-shadow: 0 0 6px 3px rgba(53, 62, 80, 0.2);
}
.map-key .land { background: var(--map-land); border: 1px solid rgba(48, 46, 47, 0.12); }

.map-credit {
  position: absolute;
  z-index: 500;
  right: 56px;
  bottom: 10px;
  margin: 0;
  padding: 5px 9px;
  border-radius: 8px;
  background: rgba(48, 46, 47, 0.68);
  color: rgba(255, 255, 255, 0.8);
  font-size: 0.6rem;
  font-weight: 700;
  backdrop-filter: blur(8px);
}

.leaflet-container { font-family: inherit; }
.leaflet-control-zoom { overflow: hidden; border: 0 !important; border-radius: 14px !important; box-shadow: var(--shadow) !important; }
.leaflet-control-zoom a { width: 38px !important; height: 38px !important; line-height: 36px !important; border: 0 !important; color: var(--navy) !important; font-weight: 900; }
.leaflet-control-zoom a + a { border-top: 1px solid var(--line) !important; }

.language-map-popup .leaflet-popup-content-wrapper {
  border-radius: 18px;
  box-shadow: 0 18px 48px rgba(48, 46, 47, 0.2);
}

.language-map-popup .leaflet-popup-content { margin: 15px 17px; }
.map-location-popup { min-width: 230px; }

.map-location-eyebrow {
  margin: 0;
  color: var(--gray);
  font-size: 0.61rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.map-location-popup h3 {
  margin: 4px 0 12px;
  font-size: 1rem;
  font-weight: 900;
  letter-spacing: -0.04em;
  line-height: 1.15;
}

.map-location-popup ul {
  max-height: 268px;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  overflow-x: hidden;
  border: 1px solid rgba(120, 125, 134, 0.18);
  border-radius: 15px;
  list-style: none;
}

.map-location-popup li + li { border-top: 1px solid rgba(120, 125, 134, 0.12); }

.map-location-popup .language-search-result {
  display: grid;
  grid-template-columns: 34px minmax(0, 1fr);
  align-items: center;
  gap: 12px;
  min-height: 58px;
  padding: 10px 12px;
  border-bottom: 0;
}

.map-location-popup .language-search-result-flag {
  justify-self: center;
  align-self: center;
}

.map-location-note {
  margin: 0;
  color: var(--gray);
  font-size: 0.74rem;
  font-weight: 650;
  line-height: 1.45;
}

@media (max-width: 860px) {
  .map-page { grid-template-rows: 78px minmax(0, 1fr); }
  .map-topbar { grid-template-columns: 1fr auto; }
  .map-page-title { display: none; }
}

@media (max-width: 620px) {
  .map-page { grid-template-rows: 68px minmax(0, 1fr); }
  .map-topbar { padding: 0 16px; gap: 12px; }
  .map-logo { width: 116px; }
  .map-nav a { min-height: 34px; padding: 0 11px; font-size: 0.7rem; }
  .map-control-panel { top: auto; bottom: 16px; left: 14px; width: calc(100% - 28px); border-radius: 22px; }
  .map-control-heading { padding: 16px 17px 13px; }
  .map-control-body { padding: 0 17px 17px; }
  .map-credit { display: none; }
  .leaflet-bottom.leaflet-right { bottom: 12px; }
  .map-workspace:has(.map-control-panel:not(.is-collapsed)) .leaflet-bottom.leaflet-right { bottom: 330px; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}
