:root {
  --bg: #f5efeb;
  --ink: #232846;
  --muted: #5e6180;
  --sea: #cdd3e4;
  --accent: #5a6894;
  --accent-text: #8a4a6e;
  --frame: #c2627a;
  --peach: #f2b49b;
  --rose: #d98a9b;
  --violet: #9b7fb0;
  --indigo: #3a4570;
}

* {
  box-sizing: border-box;
}

[hidden] {
  display: none !important;
}

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

body {
  background: var(--bg);
  color: var(--ink);
  font-family: "Instrument Sans", system-ui, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
}

a {
  color: var(--ink);
}

a:hover {
  color: var(--accent-text);
}

h1,
h2,
p,
dl,
dd {
  margin: 0;
}

.app {
  display: flex;
  height: 100%;
}

.panel {
  flex: 0 0 380px;
  height: 100%;
  overflow-y: auto;
  padding: 28px 28px 40px;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

.stage {
  position: relative;
  flex: 1 1 auto;
  min-width: 0;
  overflow: hidden;
  background: #ebe3e3;
}

.map {
  position: absolute;
  inset: 0;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 4;
  margin: -28px -28px 0;
  padding: 16px 28px 12px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  background: var(--bg);
}

.brand-name {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 26px;
  font-weight: 400;
  line-height: 1;
  cursor: pointer;
}

.logo {
  width: 32px;
  height: 24px;
  flex: none;
}

.muted {
  color: var(--muted);
}

.small {
  font-size: 13px;
}

.label {
  font-size: 13px;
  color: var(--muted);
}

.search {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.search input {
  font: inherit;
  font-size: 16px;
  height: 48px;
  padding: 0 16px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
}

.search input:focus-visible,
button:focus-visible,
a:focus-visible {
  outline: 3px solid var(--violet);
  outline-offset: 2px;
}

.results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  z-index: 5;
  margin: 4px 0 0;
  padding: 4px;
  list-style: none;
  background: #fff;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
}

.results button {
  width: 100%;
  min-height: 44px;
  padding: 8px 12px;
  border: 0;
  border-radius: 4px;
  background: transparent;
  text-align: left;
  font: inherit;
  cursor: pointer;
}

.results button:hover {
  background: var(--bg);
}

.results span {
  color: var(--muted);
}

.place {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.place h1 {
  font-family: "Instrument Serif", Georgia, serif;
  font-size: 44px;
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.01em;
  text-wrap: balance;
}

.region {
  margin-top: 6px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.meta {
  font-size: 13px;
  color: var(--muted);
}

.group {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.group h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.note {
  color: var(--accent-text);
}

.sources-list {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.sources-list li {
  display: grid;
  grid-template-columns: 64px minmax(0, 1fr);
  column-gap: 14px;
  align-items: baseline;
}

.sources-list .res {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.1;
  white-space: nowrap;
}

.src-name {
  font-size: 15px;
  font-weight: 400;
}

.sources-list .logo {
  width: 32px;
  height: 24px;
  flex: none;
}

.muted {
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.setting {
  display: grid;
  grid-template-columns: 76px minmax(0, 1fr);
  align-items: center;
  column-gap: 12px;
}

.chips {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: minmax(0, 1fr);
}

.chips button {
  height: 44px;
  padding: 0 4px;
  margin-left: -1.5px;
  border: 1.5px solid var(--ink);
  border-radius: 0;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.chips button:first-child {
  margin-left: 0;
  border-radius: 6px 0 0 6px;
}

.chips button:last-child {
  border-radius: 0 6px 6px 0;
}

.settings .primary {
  margin-top: 8px;
}

.downloads {
  display: flex;
  gap: 8px;
}

.downloads .primary {
  flex: 1 1 0;
  height: 48px;
  font-size: 15px;
}

.chips button[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.primary {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 52px;
  border: 0;
  border-radius: 6px;
  background: var(--accent);
  color: #fff;
  font: inherit;
  font-size: 17px;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.primary:hover {
  color: #fff;
  background: #4a5784;
}

.primary:disabled {
  background: #aba7bb;
  cursor: default;
}

.download {
  background: var(--ink);
}

.download:hover {
  background: #000;
}

.sea {
  background: #7a5f95;
}

.sea:hover {
  background: #6a5185;
}

.credits {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.docs h2,
.credits h2 {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}

.docs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.doc-links {
  margin: 0;
  padding: 0;
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.report dl {
  display: grid;
  grid-template-columns: 84px minmax(0, 1fr);
  column-gap: 14px;
  row-gap: 6px;
  font-size: 14px;
}

.report dt {
  font-weight: 600;
}

.frame {
  position: absolute;
  left: 50%;
  top: 50%;
  width: var(--frame);
  height: var(--frame);
  transform: translate(-50%, -50%);
  border: 3px solid var(--frame);
  box-shadow: 0 0 0 100vmax rgb(35 40 70 / 0.16);
  pointer-events: none;
}

.far .frame {
  display: none;
}

.hint {
  position: absolute;
  left: 20px;
  top: 16px;
  padding: 6px 10px;
  border-radius: 4px;
  background: var(--bg);
  color: var(--accent-text);
  font-size: 14px;
  font-weight: 600;
  pointer-events: none;
}

.map-tools {
  position: absolute;
  right: 16px;
  top: 12px;
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-end;
  gap: 8px;
}

.tool {
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.tool[aria-pressed="true"] {
  background: var(--ink);
  color: var(--bg);
}

.viewer {
  position: absolute;
  inset: 0;
  z-index: 3;
  background: var(--bg);
}

.viewer canvas {
  display: block;
  width: 100%;
  height: 100%;
  touch-action: none;
  cursor: grab;
}

.viewer-back {
  position: absolute;
  left: 16px;
  top: 12px;
  height: 44px;
  padding: 0 14px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: var(--bg);
  color: var(--ink);
  font: inherit;
  font-size: 15px;
  cursor: pointer;
}

.viewer-hint {
  position: absolute;
  left: 20px;
  bottom: 16px;
  color: var(--muted);
  font-size: 14px;
  pointer-events: none;
}

.welcome {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.welcome h1 {
  margin: 0;
  font-family: "Instrument Serif", Georgia, serif;
  font-size: clamp(44px, 4.2vw, 60px);
  line-height: 1;
  font-weight: 400;
  letter-spacing: -0.01em;
}

.welcome-lead {
  font-size: 20px;
  line-height: 1.35;
}

.welcome-steps {
  margin: 0;
  padding-left: 1.4em;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.app:not(.welcoming) .welcome,
.app:not(.welcoming) .welcome-small,
.app.welcoming .place,
.app.welcoming .sources,
.app.welcoming .settings,
.app.welcoming .make,
.app.welcoming .report,
.app.welcoming .credits,
.app.welcoming .hint {
  display: none;
}

.secondary {
  height: 56px;
  padding: 0 20px;
  border: 1.5px solid var(--ink);
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  font: inherit;
  font-size: 17px;
  cursor: pointer;
}

.top-links {
  display: flex;
  gap: 14px;
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  text-decoration: underline;
  cursor: pointer;
}

.maplibregl-ctrl-attrib {
  font-family: inherit;
}

@media (max-width: 760px) {
  .app {
    flex-direction: column-reverse;
    height: 100%;
    height: 100dvh;
    padding-top: 52px;
    box-sizing: border-box;
  }

  .stage {
    flex: 0 0 44%;
  }

  .panel {
    flex: 1 1 auto;
    min-height: 0;
    height: auto;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
    padding: 20px 20px 40px;
    gap: 28px;
  }

  .topbar {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    height: 52px;
    margin: 0;
    padding: 0 16px;
    align-items: center;
    z-index: 10;
  }

  .brand-name {
    font-size: 22px;
  }

  .place h1 {
    font-size: 36px;
  }

  .maplibregl-ctrl-attrib.maplibregl-compact {
    margin: 0 6px 6px 0;
  }
}

.link {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font-family: inherit;
  line-height: inherit;
  text-align: left;
  text-decoration: underline;
  cursor: pointer;
}

.link:hover {
  color: var(--accent-text);
}
