* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  min-height: 100vh;
  margin: 0;
  background: #080b10;
  color: #f4f7f8;
}

a {
  color: inherit;
}

button,
input {
  font: inherit;
}

button:focus-visible,
a:focus-visible,
input:focus-visible,
.map-canvas:focus-visible {
  outline: 3px solid #f4c95d;
  outline-offset: 3px;
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: fixed;
  top: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 0.7rem 1rem;
  border-radius: 6px;
  background: #f7f3e7;
  color: #10151b;
  transform: translateY(-160%);
  transition: transform 0.18s ease;
}

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

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

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

.top-bar,
.stage-copy,
.page-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.top-bar {
  min-height: 42px;
}

.wordmark,
.nav-link,
.action-button,
.page-footer a {
  text-decoration: none;
}

.wordmark {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 780;
}

.nav-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  padding: 0.55rem 0.85rem;
  border: 1px solid #303a44;
  border-radius: 6px;
  background: #111820;
  color: #d9e3e8;
}

.stage-copy {
  align-items: flex-end;
  padding: 0.3rem 0 0.15rem;
}

.eyebrow,
.panel-kicker {
  margin: 0 0 0.35rem;
  color: #54d6c3;
  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: #ffffff;
  font-size: clamp(2rem, 4vw, 4.25rem);
  line-height: 1;
}

.stage-deck {
  max-width: 750px;
  margin-bottom: 0;
  color: #bcc8ce;
  font-size: 1.08rem;
  line-height: 1.55;
}

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

.action-button,
.command-button,
.attribution-toggle {
  min-height: 42px;
  border: 1px solid #3c4853;
  border-radius: 6px;
  padding: 0.66rem 0.9rem;
  background: #111820;
  color: #f4f7f8;
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, transform 0.18s ease;
}

.action-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.action-button:hover,
.command-button:hover,
.attribution-toggle:hover,
.landmark-button:hover {
  border-color: #54d6c3;
  background: #18242b;
  transform: translateY(-1px);
}

.action-button.primary {
  border-color: #2a9c8d;
  background: #1d887b;
  color: #ffffff;
}

.action-button.primary:hover {
  background: #247f75;
}

.map-shell {
  position: relative;
  min-height: 700px;
  overflow: hidden;
  border: 1px solid #303a44;
  border-radius: 8px;
  background: #0a1118;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.38);
  isolation: isolate;
}

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

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

.static-map-fallback {
  z-index: 1;
  overflow: hidden;
  background-color: #0b151c;
  background-image:
    linear-gradient(rgba(120, 160, 174, 0.08) 1px, transparent 1px),
    linear-gradient(90deg, rgba(120, 160, 174, 0.08) 1px, transparent 1px);
  background-size: 44px 44px;
}

.static-water,
.static-shore,
.static-building,
.static-bridge {
  position: absolute;
  display: block;
}

.static-water {
  top: -15%;
  right: -12%;
  width: 48%;
  height: 92%;
  border-left: 2px solid rgba(84, 214, 195, 0.4);
  background: #0a3542;
  transform: rotate(8deg);
}

.static-shore {
  right: 28%;
  bottom: -8%;
  width: 28%;
  height: 55%;
  border: 2px solid rgba(84, 214, 195, 0.35);
  background: #12232a;
  transform: rotate(-18deg);
}

.static-building {
  width: 3.4rem;
  background: #406876;
  box-shadow: 16px 18px 24px rgba(0, 0, 0, 0.38);
  transform: skewY(-13deg) rotate(7deg);
}

.building-a {
  left: 28%;
  top: 30%;
  height: 8rem;
}

.building-b {
  left: 39%;
  top: 23%;
  height: 12rem;
  background: #4e948e;
}

.building-c {
  left: 49%;
  top: 37%;
  height: 7rem;
}

.building-d {
  left: 59%;
  top: 28%;
  height: 9.5rem;
  background: #8d7543;
}

.static-bridge {
  right: 8%;
  top: 18%;
  width: 30%;
  height: 7rem;
  border-top: 6px solid #9babb1;
  border-radius: 50%;
  transform: rotate(-12deg);
}

.map-loading {
  position: absolute;
  top: 50%;
  left: 50%;
  z-index: 8;
  display: inline-flex;
  align-items: center;
  gap: 0.7rem;
  padding: 0.8rem 0.95rem;
  border: 1px solid #39454f;
  border-radius: 6px;
  background: rgba(9, 15, 21, 0.9);
  color: #e3eaed;
  transform: translate(-50%, -50%);
  backdrop-filter: blur(14px);
}

.loader-ring {
  width: 1rem;
  height: 1rem;
  border: 2px solid rgba(227, 234, 237, 0.24);
  border-top-color: #54d6c3;
  border-radius: 50%;
  animation: spin 0.9s linear infinite;
}

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

.webgl-fallback {
  position: absolute;
  inset: 1rem;
  z-index: 6;
  display: grid;
  place-content: center;
  padding: 2rem;
  border: 1px solid #3b4650;
  border-radius: 8px;
  background: rgba(8, 13, 18, 0.91);
  text-align: center;
}

.control-panel,
.layer-panel,
.inspector-panel,
.attribution-panel {
  position: absolute;
  z-index: 7;
  border: 1px solid rgba(167, 188, 197, 0.22);
  border-radius: 8px;
  background: rgba(8, 14, 19, 0.84);
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
  backdrop-filter: blur(18px);
}

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

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

.inspector-panel {
  right: 1rem;
  bottom: 1rem;
  width: min(370px, calc(100% - 2rem));
  max-height: 260px;
  overflow: auto;
  padding: 1rem;
}

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

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

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

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

.place-search input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #34414a;
  border-radius: 6px;
  padding: 0 0.75rem;
  background: #101a22;
  color: #f4f7f8;
}

.place-search input::placeholder {
  color: #84969e;
}

.place-results {
  position: absolute;
  top: 4.2rem;
  left: 0;
  right: 0;
  z-index: 12;
  max-height: min(11rem, 34dvh);
  overflow: auto;
  overscroll-behavior: contain;
  touch-action: pan-y;
  -webkit-overflow-scrolling: touch;
  border: 1px solid #36434d;
  border-radius: 6px;
  background: #091016;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.38);
}

.place-result {
  display: grid;
  gap: 0.14rem;
  width: 100%;
  min-height: 56px;
  border: 0;
  border-bottom: 1px solid #26323a;
  padding: 0.65rem 0.75rem;
  background: transparent;
  color: #edf2f4;
  text-align: left;
  cursor: pointer;
}

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

.place-result:hover,
.place-result.active,
.place-result:focus-visible {
  background: #183036;
  outline: none;
}

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

.place-result span {
  color: #9fb1b9;
  font-size: 0.8rem;
}

.control-row {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.command-button {
  flex: 1 1 0;
  min-width: 0;
}

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

.landmark-button {
  flex: 0 0 auto;
  min-height: 38px;
  max-width: 190px;
  overflow: hidden;
  border: 1px solid #34414a;
  border-radius: 6px;
  padding: 0.5rem 0.7rem;
  background: #101820;
  color: #e5edef;
  text-overflow: ellipsis;
  white-space: nowrap;
  cursor: pointer;
}

.toggle-row {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  min-height: 40px;
  border-top: 1px solid rgba(167, 188, 197, 0.13);
  color: #d9e3e7;
  cursor: pointer;
}

.toggle-row input {
  width: 1.05rem;
  height: 1.05rem;
  margin: 0;
  accent-color: #54d6c3;
}

.inspector-panel p {
  margin-bottom: 0.75rem;
  color: #bac8ce;
  line-height: 1.45;
}

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

.inspector-panel dl div {
  display: grid;
  grid-template-columns: 88px minmax(0, 1fr);
  gap: 0.55rem;
  border-top: 1px solid rgba(167, 188, 197, 0.13);
  padding-top: 0.45rem;
}

.inspector-panel dt {
  color: #8499a2;
  font-size: 0.75rem;
  font-weight: 800;
}

.inspector-panel dd {
  min-width: 0;
  margin: 0;
  color: #eef3f4;
  overflow-wrap: anywhere;
}

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

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

.attribution-panel h2 {
  margin-bottom: 0.6rem;
}

.attribution-panel p {
  margin-bottom: 0.6rem;
  color: #bac8ce;
  font-size: 0.86rem;
  line-height: 1.45;
}

.attribution-panel p:last-child {
  margin-bottom: 0;
}

.data-section {
  display: grid;
  grid-template-columns: minmax(260px, 0.72fr) minmax(0, 1.28fr);
  gap: clamp(1.5rem, 4vw, 4rem);
  padding: clamp(3rem, 7vw, 6rem) 0;
  border-top: 1px solid #29333b;
}

.section-copy h2 {
  margin-bottom: 0.8rem;
  font-size: clamp(1.65rem, 3vw, 2.8rem);
  line-height: 1.08;
}

.section-copy p:last-child {
  margin-bottom: 0;
  color: #aebdc4;
  line-height: 1.6;
}

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

.source-card {
  min-width: 0;
  border: 1px solid #303a44;
  border-top: 3px solid #54d6c3;
  border-radius: 8px;
  padding: 1rem;
  background: #0e141a;
}

.source-card:nth-child(2) {
  border-top-color: #f4c95d;
}

.source-card:nth-child(3) {
  border-top-color: #7ebc72;
}

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

.source-card p {
  margin-bottom: 0;
  color: #aebdc4;
  line-height: 1.5;
}

.page-footer {
  min-height: 78px;
  border-top: 1px solid #29333b;
  color: #94a5ad;
}

.page-footer a {
  color: #76d9cc;
}

.noscript-note {
  position: fixed;
  right: 1rem;
  bottom: 1rem;
  left: 1rem;
  z-index: 50;
  padding: 1rem;
  border-radius: 6px;
  background: #f7f3e7;
  color: #10151b;
}

.maplibregl-ctrl-attrib {
  background: rgba(5, 10, 14, 0.8) !important;
  color: #c1cdd2 !important;
}

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

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

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

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

@media (max-width: 720px) {
  .map-shell {
    min-height: 920px;
  }

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

  .control-panel {
    top: 0.7rem;
  }

  .layer-panel {
    top: 15.8rem;
  }

  .inspector-panel {
    bottom: 0.7rem;
    max-height: 230px;
  }

  .attribution-toggle {
    left: 0.7rem;
    bottom: 15.9rem;
  }

  .attribution-panel {
    right: 0.7rem;
    bottom: 19.6rem;
    left: 0.7rem;
    width: auto;
  }
}

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

  h1 {
    font-size: 2.35rem;
  }

  .stage-deck {
    font-size: 1rem;
  }

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

  .action-button {
    flex: 1 1 100%;
  }

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

  .place-results {
    max-height: min(8.5rem, 22dvh);
  }

  .layer-panel {
    top: 16.15rem;
  }

  .page-footer {
    align-items: flex-start;
    flex-direction: column;
    justify-content: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }

  *,
  *::before,
  *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


.map-menu {
  padding: 0;
}

.map-menu:not([open]) > :not(summary) {
  display: none;
}

.map-menu summary {
  min-height: 42px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.65rem;
  padding: 0.65rem 0.8rem;
  color: #edf7fb;
  background: rgba(8, 18, 27, 0.92);
  font-weight: 800;
  cursor: pointer;
  list-style: none;
}

.map-menu summary::-webkit-details-marker {
  display: none;
}

.map-menu summary::after {
  content: "+";
  width: 1.25rem;
  color: #77d6ff;
  font-size: 1.2rem;
  line-height: 1;
  text-align: center;
}

.map-menu[open] summary::after {
  content: "−";
}

.map-menu-content {
  padding: 0.35rem 0.75rem 0.75rem;
}

.attractions-menu {
  border: 1px solid rgba(190, 218, 236, 0.16);
  border-radius: 8px;
  overflow: hidden;
}

.attractions-menu .landmark-rail {
  display: grid;
  gap: 0.35rem;
  max-height: min(18rem, 42dvh);
  overflow-y: auto;
  padding: 0.45rem;
}

.attractions-menu .landmark-button {
  width: 100%;
  max-width: none;
  text-align: left;
  white-space: normal;
}

@media (max-width: 980px) {
  .layer-panel {
    top: 32rem;
    right: 0.75rem;
    left: auto;
    bottom: auto;
    width: auto;
    max-width: min(290px, calc(100% - 1.5rem));
    display: block;
  }

  .layer-panel[open] {
    width: min(290px, calc(100% - 1.5rem));
  }

  .layer-panel .map-menu-content {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.25rem;
    max-height: min(24rem, 48dvh);
    overflow-y: auto;
  }

  .layer-panel .toggle-row {
    margin: 0;
  }
}

@media (max-width: 620px) {
  .map-shell.is-immersive .layer-panel,
  .map-shell:fullscreen .layer-panel {
    display: block;
    top: max(4.5rem, calc(env(safe-area-inset-top) + 3.75rem));
    right: max(0.75rem, env(safe-area-inset-right));
  }

  .map-shell.is-immersive .layer-panel[open],
  .map-shell:fullscreen .layer-panel[open] {
    max-height: calc(100dvh - 9rem);
  }
}


.mobile-controls-toggle {
  display: none;
}

.mobile-controls-content {
  display: block;
}

@media (max-width: 620px) {
  .mobile-controls-toggle {
    width: 100%;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.6rem;
    padding: 0 0.75rem;
    border: 1px solid rgba(84, 214, 195, 0.42);
    border-radius: 6px;
    background: rgba(9, 16, 22, 0.94);
    color: #edf7fb;
    font: inherit;
    font-weight: 800;
    text-align: left;
    cursor: pointer;
  }

  .mobile-controls-toggle .toggle-chevron {
    margin-left: auto;
    transition: transform 170ms ease;
  }

  .mobile-controls-toggle svg {
    width: 18px;
    height: 18px;
    fill: none;
    stroke: currentColor;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
  }

  .control-panel.controls-open .toggle-chevron {
    transform: rotate(180deg);
  }

  .control-panel:not(.controls-open) {
    padding: 0.55rem;
  }

  .control-panel:not(.controls-open) .mobile-controls-content {
    display: none;
  }

  .control-panel.controls-open .mobile-controls-content {
    padding-top: 0.85rem;
  }

  .layer-panel {
    top: 5.75rem;
  }

  .control-panel.controls-open ~ .layer-panel {
    display: none;
  }
}
