* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

html {
  background: #05080d;
  color: #f3f7fb;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at 14% 4%, rgba(67, 187, 255, 0.28), transparent 30rem),
    radial-gradient(circle at 76% 18%, rgba(106, 211, 177, 0.16), transparent 28rem),
    linear-gradient(145deg, #05080d 0%, #0b1220 42%, #0e1620 100%);
  color: #f3f7fb;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

.skip-link {
  position: fixed;
  left: 1rem;
  top: 1rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  border-radius: 999px;
  background: #eef8ff;
  color: #06101d;
  transform: translateY(-150%);
  transition: transform 0.2s ease;
}

.skip-link:focus {
  transform: translateY(0);
}

.map-page {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
}

.map-stage {
  min-height: 100vh;
  display: grid;
  grid-template-rows: auto auto 1fr;
  gap: 1rem;
  padding: 1rem 0 1.25rem;
}

.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 0.35rem 0;
}

.wordmark,
.nav-link,
.action-button,
.icon-button,
.attribution-toggle {
  text-decoration: none;
}

.wordmark {
  color: #f7fbff;
  font-size: 0.95rem;
  font-weight: 750;
  letter-spacing: 0;
}

.nav-link {
  border: 1px solid rgba(190, 218, 236, 0.2);
  border-radius: 999px;
  padding: 0.65rem 0.9rem;
  color: #cae4f5;
  background: rgba(12, 22, 35, 0.7);
}

.stage-copy {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1rem;
  align-items: end;
  padding: 0.35rem 0 0.15rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.35rem;
  color: #77d6ff;
  font-size: 0.76rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 0.4rem;
  color: #f7fbff;
  font-size: clamp(2rem, 4vw, 4.5rem);
  line-height: 0.95;
}

.stage-deck {
  max-width: 760px;
  margin-bottom: 0;
  color: #c5d6e6;
  font-size: clamp(1rem, 1.5vw, 1.2rem);
  line-height: 1.55;
}

.stage-actions {
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 0.65rem;
}

.action-button,
.icon-button,
.attribution-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  min-height: 42px;
  border: 1px solid rgba(190, 218, 236, 0.22);
  border-radius: 999px;
  padding: 0.7rem 1rem;
  color: #eff8ff;
  background: rgba(9, 18, 31, 0.74);
  cursor: pointer;
  transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.action-button svg,
.icon-button svg,
.attribution-toggle svg {
  width: 1rem;
  height: 1rem;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.action-button:hover,
.icon-button:hover,
.attribution-toggle:hover,
.landmark-button:hover {
  border-color: rgba(119, 214, 255, 0.65);
  background: rgba(16, 40, 60, 0.9);
  transform: translateY(-1px);
}

.action-button.primary {
  border-color: rgba(119, 214, 255, 0.48);
  background: linear-gradient(135deg, rgba(48, 168, 232, 0.95), rgba(53, 136, 212, 0.85));
  color: #ffffff;
  box-shadow: 0 22px 60px rgba(42, 155, 220, 0.22);
}

.map-shell {
  position: relative;
  min-height: 690px;
  overflow: hidden;
  border: 1px solid rgba(170, 207, 230, 0.2);
  border-radius: 8px;
  background: #08111d;
  box-shadow: 0 24px 90px rgba(0, 0, 0, 0.42);
  isolation: isolate;
}

.map-canvas,
.static-map-fallback {
  position: absolute;
  inset: 0;
}

.map-canvas {
  z-index: 2;
}

.static-map-fallback {
  z-index: 1;
  background:
    linear-gradient(130deg, rgba(9, 31, 46, 0.94), rgba(5, 12, 22, 0.96)),
    repeating-linear-gradient(0deg, transparent 0 40px, rgba(120, 218, 255, 0.06) 41px 42px),
    repeating-linear-gradient(90deg, transparent 0 40px, rgba(120, 218, 255, 0.06) 41px 42px);
}

.grid-line,
.static-building,
.static-river {
  position: absolute;
  display: block;
}

.grid-line {
  height: 2px;
  background: linear-gradient(90deg, transparent, rgba(117, 217, 255, 0.34), transparent);
  transform: rotate(-22deg);
}

.grid-line-a {
  left: 8%;
  top: 42%;
  width: 84%;
}

.grid-line-b {
  left: 18%;
  top: 62%;
  width: 64%;
}

.static-building {
  width: 4rem;
  height: 7rem;
  background: linear-gradient(180deg, rgba(130, 230, 255, 0.8), rgba(45, 106, 165, 0.9));
  transform: skewY(-18deg) rotate(8deg);
  box-shadow: 18px 18px 28px rgba(0, 0, 0, 0.35);
  opacity: 0.78;
}

.building-a {
  left: 30%;
  top: 34%;
}

.building-b {
  left: 43%;
  top: 25%;
  height: 10rem;
}

.building-c {
  left: 54%;
  top: 39%;
  height: 6rem;
}

.building-d {
  left: 65%;
  top: 28%;
  height: 8rem;
}

.static-river {
  left: -5%;
  right: -5%;
  bottom: 10%;
  height: 18%;
  border-radius: 50%;
  background: rgba(32, 137, 188, 0.26);
  transform: rotate(-4deg);
}

.map-loading {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.9rem 1rem;
  border: 1px solid rgba(190, 218, 236, 0.25);
  border-radius: 999px;
  background: rgba(7, 15, 25, 0.86);
  color: #d8ecfa;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(18px);
}

.loader-ring {
  width: 1.05rem;
  height: 1.05rem;
  border: 2px solid rgba(216, 236, 250, 0.22);
  border-top-color: #77d6ff;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

.webgl-fallback {
  position: absolute;
  inset: 1rem;
  z-index: 5;
  display: grid;
  place-content: center;
  padding: 2rem;
  border: 1px solid rgba(255, 255, 255, 0.16);
  border-radius: 8px;
  background: rgba(6, 12, 20, 0.86);
  text-align: center;
}

.webgl-fallback h2 {
  margin-bottom: 0.5rem;
}

.control-panel,
.layer-panel,
.inspector-panel,
.attribution-panel {
  position: absolute;
  z-index: 7;
  border: 1px solid rgba(190, 218, 236, 0.18);
  border-radius: 8px;
  background: rgba(5, 12, 22, 0.78);
  box-shadow: 0 22px 70px rgba(0, 0, 0, 0.26);
  backdrop-filter: blur(20px);
}

.control-panel {
  left: 1rem;
  top: 1rem;
  z-index: 9;
  width: min(380px, calc(100% - 2rem));
  padding: 1rem;
}

.layer-panel {
  right: 1rem;
  top: 1rem;
  width: min(320px, calc(100% - 2rem));
  padding: 1rem;
}

.inspector-panel {
  right: 1rem;
  bottom: 1rem;
  width: min(360px, calc(100% - 2rem));
  padding: 1rem;
}

.panel-heading {
  margin-bottom: 0.85rem;
}

.panel-heading h2,
.inspector-panel h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

.control-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin-bottom: 0.85rem;
}

.place-search {
  position: relative;
  display: grid;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.place-search label {
  color: #9ab7ca;
  font-size: 0.78rem;
  font-weight: 800;
}

.place-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid rgba(190, 218, 236, 0.18);
  border-radius: 8px;
  padding: 0 0.8rem;
  color: #eff8ff;
  background: rgba(10, 22, 36, 0.78);
  outline: none;
}

.place-search input:focus {
  border-color: rgba(119, 214, 255, 0.68);
  box-shadow: 0 0 0 3px rgba(119, 214, 255, 0.13);
}

.place-results {
  position: absolute;
  left: 0;
  right: 0;
  top: calc(100% + 0.35rem);
  z-index: 12;
  max-height: 15rem;
  overflow: auto;
  border: 1px solid rgba(190, 218, 236, 0.2);
  border-radius: 8px;
  background: rgba(5, 12, 22, 0.96);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.32);
}

.place-result {
  width: 100%;
  display: grid;
  gap: 0.15rem;
  border: 0;
  border-bottom: 1px solid rgba(190, 218, 236, 0.1);
  padding: 0.7rem 0.8rem;
  color: #eff8ff;
  background: transparent;
  text-align: left;
  cursor: pointer;
}

.place-result:last-child {
  border-bottom: 0;
}

.place-result:hover,
.place-result:focus-visible {
  background: rgba(119, 214, 255, 0.12);
  outline: none;
}

.place-result strong,
.place-result span {
  display: block;
}

.place-result span {
  color: #a8c2d4;
  font-size: 0.82rem;
}

.icon-button {
  min-width: 116px;
  padding: 0.65rem 0.82rem;
}

.landmark-rail {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.2rem;
  scrollbar-width: thin;
}

.landmark-button {
  flex: 0 0 auto;
  min-height: 38px;
  max-width: 185px;
  border: 1px solid rgba(190, 218, 236, 0.16);
  border-radius: 999px;
  padding: 0.55rem 0.75rem;
  color: #e5f3fd;
  background: rgba(12, 24, 38, 0.72);
  cursor: pointer;
  white-space: nowrap;
}

.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.8rem;
  min-height: 42px;
  margin: 0.35rem 0;
  padding: 0.58rem 0.65rem;
  border: 1px solid rgba(190, 218, 236, 0.14);
  border-radius: 8px;
  color: #e2f2fd;
  background: rgba(12, 24, 38, 0.58);
}

.toggle-row input {
  width: 1.2rem;
  height: 1.2rem;
  accent-color: #77d6ff;
}

.toggle-row.muted {
  color: #8699a8;
}

.inspector-panel p {
  color: #c8d9e7;
  line-height: 1.5;
}

.inspector-panel dl {
  display: grid;
  gap: 0.55rem;
  margin: 0;
}

.inspector-panel div {
  display: grid;
  grid-template-columns: 110px 1fr;
  gap: 0.75rem;
  align-items: start;
}

.inspector-panel dt {
  color: #7d9aad;
  font-size: 0.78rem;
  text-transform: uppercase;
}

.inspector-panel dd {
  margin: 0;
  color: #f3f7fb;
}

.attribution-toggle {
  position: absolute;
  left: 1rem;
  bottom: 1rem;
  z-index: 8;
}

.attribution-panel {
  left: 1rem;
  bottom: 4.6rem;
  width: min(460px, calc(100% - 2rem));
  padding: 1rem;
}

.attribution-panel h2 {
  margin-bottom: 0.45rem;
  font-size: 1rem;
}

.attribution-panel p {
  color: #cce0ee;
  line-height: 1.5;
}

.data-section {
  display: grid;
  grid-template-columns: minmax(0, 0.75fr) minmax(0, 1.25fr);
  gap: 1rem;
  padding: 1.5rem 0 3rem;
}

.section-copy h2 {
  margin-bottom: 0.55rem;
  font-size: clamp(1.5rem, 2.6vw, 2.5rem);
}

.section-copy p {
  color: #c5d6e6;
  line-height: 1.55;
}

.source-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 0.85rem;
}

.source-card {
  min-height: 190px;
  padding: 1rem;
  border: 1px solid rgba(190, 218, 236, 0.16);
  border-radius: 8px;
  background: rgba(8, 17, 28, 0.7);
}

.source-card h3 {
  margin-bottom: 0.5rem;
}

.source-card p {
  color: #c8d9e7;
  line-height: 1.55;
}

.page-footer {
  width: min(1480px, calc(100% - 32px));
  margin: 0 auto;
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.5rem 0 2rem;
  color: #8fa7ba;
}

.page-footer a {
  color: #bdeaff;
}

.noscript-note {
  position: fixed;
  inset: auto 1rem 1rem 1rem;
  z-index: 50;
  padding: 1rem;
  border-radius: 8px;
  background: #eef8ff;
  color: #06101d;
}

.maplibregl-ctrl-attrib {
  background: rgba(4, 10, 18, 0.72) !important;
  color: #c5d6e6 !important;
}

.maplibregl-ctrl-attrib a {
  color: #bdeaff !important;
}

@media (max-width: 980px) {
  .stage-copy,
  .data-section {
    grid-template-columns: 1fr;
  }

  .stage-actions {
    justify-content: flex-start;
  }

  .map-shell {
    min-height: 760px;
  }

  .control-panel,
  .layer-panel,
  .inspector-panel {
    left: 0.75rem;
    right: 0.75rem;
    width: auto;
  }

  .control-panel {
    top: 0.75rem;
  }

  .layer-panel {
    top: auto;
    bottom: 10rem;
  }

  .inspector-panel {
    bottom: 0.75rem;
  }

  .attribution-toggle {
    left: 0.75rem;
    right: auto;
    top: 12.75rem;
    bottom: auto;
  }

  .attribution-panel {
    left: 0.75rem;
    right: 0.75rem;
    top: 16.25rem;
    bottom: auto;
    width: auto;
    max-height: 18rem;
    overflow: auto;
  }

  .source-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 620px) {
  .map-page,
  .page-footer {
    width: min(100% - 20px, 1480px);
  }

  .top-bar,
  .page-footer {
    align-items: flex-start;
    flex-direction: column;
  }

  h1 {
    font-size: clamp(2rem, 14vw, 3rem);
  }

  .stage-actions,
  .control-row {
    flex-direction: column;
  }

  .action-button,
  .icon-button {
    width: 100%;
  }

  .map-shell {
    min-height: 820px;
  }

  .control-panel,
  .layer-panel,
  .inspector-panel,
  .attribution-panel {
    padding: 0.85rem;
  }

  .toggle-row {
    min-height: 46px;
  }

  .inspector-panel div {
    grid-template-columns: 1fr;
    gap: 0.2rem;
  }

  .attribution-toggle {
    top: 14.75rem;
    bottom: auto;
  }

  .attribution-panel {
    top: 18.35rem;
    bottom: auto;
  }
}

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