/* =========================================================
   Þjóðlendur – gagnvirkt kort
   ========================================================= */

:root {
  color-scheme: light;
  --ink: #16241c;
  --ink-soft: #34463b;
  --muted: #657468;
  --muted-2: #859187;
  --forest: #1e4a35;
  --forest-2: #2f6b4f;
  --forest-3: #4b8a68;
  --glacier: #527f95;
  --glacier-2: #7fa7ba;
  --sand: #d8c49a;
  --paper: #f7f6f0;
  --paper-2: #f0efe7;
  --white: #fffefb;
  --line: rgba(22, 36, 28, 0.12);
  --line-strong: rgba(22, 36, 28, 0.2);
  --shadow-sm: 0 4px 16px rgba(19, 36, 26, 0.1);
  --shadow: 0 16px 44px rgba(17, 35, 24, 0.16), 0 2px 8px rgba(17, 35, 24, 0.07);
  --shadow-lg: 0 28px 80px rgba(14, 31, 21, 0.24);
  --radius: 18px;
  --radius-sm: 12px;
  --header-height: 74px;
  --font-sans: "Manrope", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --font-serif: "Fraunces", "Iowan Old Style", Georgia, serif;
  --font-mono: ui-monospace, "SF Mono", SFMono-Regular, Menlo, Consolas, monospace;
  --focus: 0 0 0 3px rgba(47, 107, 79, 0.28);
}

* {
  box-sizing: border-box;
}

html,
body {
  height: 100%;
}

body {
  margin: 0;
  overflow: hidden;
  color: var(--ink);
  background: #dfe5dd;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button,
input {
  font: inherit;
  color: inherit;
}

button {
  border: 0;
  touch-action: manipulation;
}

a {
  color: var(--forest-2);
  text-decoration-thickness: 1px;
  text-underline-offset: 2px;
}

svg {
  display: block;
}

[hidden] {
  display: none !important;
}

::selection {
  color: var(--white);
  background: var(--forest-2);
}

:focus-visible {
  outline: 2px solid var(--forest-2);
  outline-offset: 2px;
}

.svg-sprite {
  position: absolute;
  width: 0;
  height: 0;
  overflow: hidden;
}

/* ---------- Grind ---------- */

.app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
  min-height: 100%;
}

.topbar {
  position: relative;
  z-index: 1300;
  display: grid;
  grid-template-columns: minmax(205px, 0.8fr) minmax(300px, 650px) minmax(205px, 0.8fr);
  align-items: center;
  gap: 26px;
  min-height: var(--header-height);
  padding: calc(11px + env(safe-area-inset-top, 0px)) 22px 11px;
  background: rgba(247, 246, 240, 0.94);
  border-bottom: 1px solid var(--line);
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.7);
  backdrop-filter: blur(18px) saturate(115%);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 11px;
  width: fit-content;
  color: var(--ink);
  text-decoration: none;
  border-radius: 12px;
}

.brand-mark {
  width: 43px;
  height: 43px;
  flex: none;
  filter: drop-shadow(0 2px 4px rgba(20, 41, 28, 0.16));
}

.brand-mark svg {
  width: 100%;
  height: 100%;
}

.brand-copy {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.brand-title {
  font-family: var(--font-serif);
  font-size: 29px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1;
}

.brand-sub {
  color: var(--muted);
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.075em;
  line-height: 1.3;
  text-transform: uppercase;
  white-space: nowrap;
}

.topbar-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 9px;
}

/* ---------- Leit ---------- */

.search-shell {
  position: relative;
  width: 100%;
  max-width: 650px;
  justify-self: center;
}

.search-form {
  position: relative;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 9px;
  height: 49px;
  padding: 0 10px 0 15px;
  background: var(--white);
  border: 1px solid var(--line-strong);
  border-radius: 14px;
  box-shadow: 0 2px 7px rgba(23, 42, 29, 0.05);
  transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.search-form:focus-within {
  background: #fff;
  border-color: rgba(47, 107, 79, 0.72);
  box-shadow: 0 0 0 4px rgba(47, 107, 79, 0.1), 0 4px 12px rgba(23, 42, 29, 0.07);
}

.search-icon {
  flex: none;
  color: var(--muted);
}

.search-input {
  width: 100%;
  touch-action: manipulation;
  min-width: 0;
  height: 100%;
  padding: 0;
  background: transparent;
  border: 0;
  outline: 0;
  font-size: 14.5px;
  font-weight: 500;
  letter-spacing: -0.005em;
  -webkit-appearance: none;
  appearance: none;
}

.search-input::-webkit-search-cancel-button,
.search-input::-webkit-search-decoration {
  display: none;
}

.search-input::placeholder {
  color: #7c887e;
  opacity: 1;
}

.search-kbd {
  flex: none;
  padding: 3px 7px;
  color: var(--muted);
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 6px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1.3;
  white-space: nowrap;
}

.search-clear {
  display: grid;
  place-items: center;
  width: 26px;
  height: 26px;
  flex: none;
  padding: 0;
  color: var(--muted);
  background: var(--paper-2);
  border-radius: 50%;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease;
}

.search-clear:hover {
  color: var(--ink);
  background: #e5e7df;
}

.search-popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  left: 0;
  z-index: 5;
  max-height: min(63vh, 540px);
  padding: 7px;
  overflow-x: hidden;
  overflow-y: auto;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 17px;
  box-shadow: var(--shadow);
  overscroll-behavior: contain;
  animation: pop-in 160ms ease both;
}

@keyframes pop-in {
  from {
    opacity: 0;
    transform: translateY(-4px) scale(0.995);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.search-group-label {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 8px 10px 4px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.search-group-label span {
  font-weight: 600;
  letter-spacing: 0.02em;
  text-transform: none;
}

.search-result {
  display: grid;
  grid-template-columns: 36px minmax(0, 1fr) auto;
  align-items: center;
  gap: 11px;
  width: 100%;
  padding: 9px 10px;
  text-align: left;
  background: transparent;
  border-radius: 11px;
  cursor: pointer;
  transition: background 120ms ease;
}

.search-result:hover,
.search-result.is-active {
  background: #f0f3ec;
}

.search-result-icon {
  display: grid;
  place-items: center;
  width: 36px;
  height: 36px;
  color: var(--forest-2);
  background: #e7eee5;
  border-radius: 11px;
}

.search-result-icon.is-coordinate {
  color: #486c7f;
  background: #e4eef2;
}

.search-result-icon.is-osm {
  color: #7b7046;
  background: #f0ebdb;
}

.search-result-copy {
  min-width: 0;
}

.search-result-title {
  display: block;
  overflow: hidden;
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: -0.012em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-subtitle {
  display: block;
  margin-top: 1px;
  overflow: hidden;
  color: var(--muted);
  font-size: 11.5px;
  font-weight: 500;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-result-meta {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.065em;
  text-transform: uppercase;
  white-space: nowrap;
}

.search-result-meta.is-coordinate {
  color: #486c7f;
}

.search-hint {
  padding: 14px 12px 12px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.55;
}

.search-hint strong {
  color: var(--ink-soft);
  font-weight: 700;
}

.search-hint code {
  padding: 1px 4px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  white-space: normal;
  overflow-wrap: anywhere;
}

.quick-landmarks {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  padding: 4px 4px 8px;
}

.quick-landmark {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  color: var(--ink-soft);
  text-align: left;
  background: #f2f3ed;
  border-radius: 9px;
  cursor: pointer;
  transition: background 130ms ease, color 130ms ease;
}

.quick-landmark:hover {
  color: var(--forest);
  background: #e9eee6;
}

.quick-landmark svg {
  flex: none;
  color: var(--forest-3);
}

.quick-landmark span {
  display: block;
  overflow: hidden;
  font-size: 12px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.search-state {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 15px 12px;
  color: var(--muted);
  font-size: 12.5px;
}

.spinner {
  width: 16px;
  height: 16px;
  flex: none;
  border: 2px solid rgba(47, 107, 79, 0.2);
  border-top-color: var(--forest-2);
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}

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

/* ---------- hnappar ---------- */

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  min-height: 38px;
  padding: 8px 14px;
  border-radius: 10px;
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
  white-space: nowrap;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, box-shadow 140ms ease, transform 140ms ease;
}

.button:active {
  transform: translateY(1px);
}

.button-primary {
  color: #fff;
  background: var(--forest);
  box-shadow: 0 3px 9px rgba(30, 74, 53, 0.2);
}

.button-primary:hover {
  background: #173e2c;
}

.button-primary[aria-pressed="true"] {
  color: var(--forest);
  background: #dce9dc;
  box-shadow: inset 0 0 0 1px rgba(47, 107, 79, 0.22);
}

.button-secondary {
  color: var(--forest);
  background: #e9eee5;
}

.button-secondary:hover {
  background: #dfe8da;
}

.icon-button {
  display: grid;
  place-items: center;
  width: 39px;
  height: 39px;
  flex: none;
  padding: 0;
  color: var(--ink-soft);
  background: #ecece4;
  border-radius: 50%;
  text-decoration: none;
  cursor: pointer;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

.icon-button:hover {
  color: var(--ink);
  background: #e3e5dc;
}

.icon-button-small {
  width: 28px;
  height: 28px;
}

.icon-button-light {
  color: var(--ink-soft);
  background: rgba(22, 36, 28, 0.07);
}

.icon-button-light:hover {
  background: rgba(22, 36, 28, 0.11);
}

.text-button {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 0;
  color: var(--forest-2);
  font-size: 11.5px;
  font-weight: 750;
  text-align: left;
  background: transparent;
  cursor: pointer;
}

.text-button:hover {
  color: var(--forest);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.text-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  color: var(--forest-2);
  font-size: 12px;
  font-weight: 750;
  text-decoration: none;
  white-space: nowrap;
}

.text-link:hover {
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ---------- Kortsvið ---------- */

.map-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
  background: #dfe5dd;
}

.map {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #dfe5dd;
}

.map-loading {
  position: absolute;
  inset: 0;
  z-index: 1250;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 13px;
  color: var(--muted);
  background: var(--paper);
  font-size: 12px;
  font-weight: 650;
  letter-spacing: 0.01em;
  opacity: 0;
  animation: loader-in 280ms ease 280ms forwards;
  transition: opacity 240ms ease;
}

.map-loading.is-done {
  animation: none;
  opacity: 0;
  pointer-events: none;
}

@keyframes loader-in {
  to {
    opacity: 1;
  }
}

.map-loading-mark {
  width: 54px;
  height: 54px;
  filter: drop-shadow(0 5px 12px rgba(21, 42, 28, 0.18));
}

.map-loading-mark svg {
  width: 100%;
  height: 100%;
}

.map-loading .spinner {
  width: 18px;
  height: 18px;
}

/* ---------- Spjöld ---------- */

.panel {
  background: rgba(250, 249, 244, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.75);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  backdrop-filter: blur(18px) saturate(115%);
  -webkit-backdrop-filter: blur(18px) saturate(115%);
}

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  width: 100%;
  padding: 13px 15px;
  text-align: left;
  background: transparent;
  cursor: pointer;
  border-radius: var(--radius);
}

.panel-title {
  display: flex;
  flex-direction: column;
  gap: 1px;
  min-width: 0;
}

.panel-kicker {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.35;
  text-transform: uppercase;
}

.panel-title strong {
  overflow: hidden;
  font-family: var(--font-serif);
  font-size: 19px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.15;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.panel-chevron {
  display: grid;
  place-items: center;
  width: 27px;
  height: 27px;
  flex: none;
  color: var(--muted);
  background: rgba(22, 36, 28, 0.055);
  border-radius: 50%;
  transition: transform 180ms ease, background 180ms ease;
}

.panel-header:hover .panel-chevron {
  background: rgba(22, 36, 28, 0.09);
}

.bottom-stack {
  position: absolute;
  bottom: 18px;
  left: 18px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 10px;
  max-width: calc(100% - 36px);
  pointer-events: none;
}

.bottom-stack > * {
  pointer-events: auto;
}

/* Kortlykill er efst vinstra megin, við hlið Kortalags */
.legend-wrap {
  position: absolute;
  top: 16px;
  left: 18px;
  z-index: 1000;
  max-width: calc(100% - 300px);
  pointer-events: none;
}

.legend-wrap > * {
  pointer-events: auto;
}

/* ---------- Staðsetning ---------- */

.location-card {
  width: 345px;
  max-width: 100%;
  padding: 13px 14px 11px;
  animation: rise-in 220ms ease both;
}

@keyframes rise-in {
  from {
    opacity: 0;
    transform: translateY(7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.location-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}

.live-dot {
  position: relative;
  width: 9px;
  height: 9px;
  flex: none;
  margin-top: 5px;
  background: #2f7c58;
  border-radius: 50%;
}

.live-dot::after {
  content: "";
  position: absolute;
  inset: -4px;
  border: 1px solid rgba(47, 124, 88, 0.45);
  border-radius: 50%;
  animation: live-pulse 1.9s ease-out infinite;
}

@keyframes live-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
  }
  75%,
  100% {
    opacity: 0;
    transform: scale(1.55);
  }
}

.location-title {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-width: 0;
  gap: 1px;
}

.eyebrow {
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.11em;
  line-height: 1.5;
  text-transform: uppercase;
}

.location-title strong {
  overflow: hidden;
  font-size: 12.5px;
  font-weight: 700;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-status {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  margin: 10px 0;
  padding: 8px 10px;
  color: var(--ink-soft);
  background: rgba(22, 36, 28, 0.045);
  border-radius: 9px;
  font-size: 11.5px;
  font-weight: 600;
  line-height: 1.4;
}

.status-dot {
  width: 7px;
  height: 7px;
  flex: none;
  margin-top: 4px;
  background: var(--muted-2);
  border-radius: 50%;
}

.location-status.is-th {
  background: rgba(47, 107, 79, 0.1);
}

.location-status.is-th .status-dot {
  background: var(--forest-2);
  box-shadow: 0 0 0 3px rgba(47, 107, 79, 0.13);
}

.location-status.is-context {
  background: rgba(182, 132, 53, 0.1);
}

.location-status.is-context .status-dot {
  background: #b68435;
}

.location-status.is-outside .status-dot {
  background: #99a49a;
}

.coordinate-list {
  display: grid;
  gap: 3px;
}

.coordinate-row {
  display: grid;
  grid-template-columns: 47px minmax(0, 1fr) auto;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 5px 6px;
  text-align: left;
  background: transparent;
  border-radius: 7px;
  cursor: pointer;
  transition: background 120ms ease;
}

.coordinate-row:hover {
  background: rgba(22, 36, 28, 0.055);
}

.coordinate-row svg {
  color: var(--muted-2);
  opacity: 0;
  transition: opacity 120ms ease;
}

.coordinate-row:hover svg,
.coordinate-row:focus-visible svg {
  opacity: 1;
}

.coordinate-label {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
}

.coordinate-row code {
  overflow: hidden;
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: -0.02em;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.location-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 8px;
  padding-top: 8px;
  border-top: 1px solid var(--line);
}

.location-updated {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 600;
  white-space: nowrap;
}

/* ---------- Lykill ---------- */

.legend {
  width: 330px;
  max-width: 100%;
  overflow: hidden;
}

.legend-body {
  max-height: min(54vh, 530px);
  padding: 0 15px 13px;
  overflow-y: auto;
  overscroll-behavior: contain;
  scrollbar-width: thin;
}

.legend.is-collapsed .legend-body {
  display: none;
}

.legend.is-collapsed .panel-header {
  padding-bottom: 14px;
}

.legend.is-collapsed .panel-chevron {
  transform: rotate(-90deg);
}

.legend-section {
  padding-top: 10px;
}

.legend-section + .legend-section {
  margin-top: 10px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.legend-eyebrow-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.legend-eyebrow {
  margin: 0 0 3px;
  color: var(--ink-soft);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.legend-tag {
  color: var(--muted);
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.legend-list {
  display: grid;
  gap: 1px;
}

.layer-row {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 33px;
  padding: 4px 3px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease;
}

.layer-row:hover {
  background: rgba(22, 36, 28, 0.04);
}

.layer-row.is-loading {
  opacity: 0.62;
  cursor: wait;
}

.layer-row input {
  position: relative;
  width: 27px;
  height: 15px;
  flex: none;
  margin: 0;
  padding: 0;
  background: #d6dbd2;
  border: 0;
  border-radius: 999px;
  outline: none;
  cursor: pointer;
  transition: background 150ms ease;
  -webkit-appearance: none;
  appearance: none;
}

.layer-row input::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 11px;
  height: 11px;
  background: #fff;
  border-radius: 50%;
  box-shadow: 0 1px 2px rgba(22, 36, 28, 0.2);
  transition: transform 150ms ease;
}

.layer-row input:checked {
  background: var(--forest-2);
}

.layer-row input:checked::after {
  transform: translateX(12px);
}

.layer-row input:focus-visible {
  box-shadow: var(--focus);
}

.layer-row input:disabled {
  cursor: wait;
}

.layer-swatch {
  width: 11px;
  height: 11px;
  flex: none;
  background: var(--swatch, var(--forest-3));
  border: 1px solid rgba(22, 36, 28, 0.14);
  border-radius: 3px;
}

.layer-copy {
  display: flex;
  flex: 1;
  align-items: baseline;
  justify-content: space-between;
  gap: 8px;
  min-width: 0;
}

.layer-name {
  overflow: hidden;
  font-size: 12px;
  font-weight: 650;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-row[data-type="TH_OTHER"] .layer-name,
.layer-info-copy .layer-name {
  line-height: 1.35;
  white-space: normal;
}

.layer-count {
  color: var(--muted-2);
  font-size: 9.5px;
  font-weight: 650;
  white-space: nowrap;
}

/* Skýringarflokkur fyrir önnur óbein eignarréttindi sem ekki eru í WFS */
.layer-info-row {
  display: flex;
  align-items: flex-start;
  gap: 9px;
  padding: 5px 3px 9px 39px;
}

.layer-info-row .layer-swatch {
  margin-top: 1px;
}

.layer-swatch-hatch {
  background-color: #e5eddf;
  background-image: radial-gradient(#5f7a63 0.7px, transparent 0.8px);
  background-size: 5px 5px;
  border-color: rgba(44, 99, 71, 0.35);
}

.layer-info-copy {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.layer-info-link {
  overflow: hidden;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 650;
  text-decoration: none;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.layer-info-link:hover {
  color: var(--forest-2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.legend-note {
  margin: 11px 0 8px;
  color: var(--muted);
  font-size: 10.5px;
  line-height: 1.5;
}

.legend-reset {
  font-size: 11px;
}

.legend-section-landregistry {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}

.legend-note-compact {
  margin: 6px 0 0;
}

.layer-swatch-landregistry {
  background:
    repeating-linear-gradient(45deg, #d4a017 0 1px, transparent 1px 3px),
    #fdf0b0;
  border-color: rgba(212, 160, 23, 0.4);
}

.layer-swatch-aaetlun {
  background:
    repeating-linear-gradient(45deg, #7c3aed 0 1px, transparent 1px 3px),
    #ede9fe;
  border-color: rgba(124, 58, 237, 0.35);
}

.legend-footer {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 10px;
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.source-line {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  color: var(--muted);
  font-size: 9.5px;
  font-weight: 600;
  line-height: 1.45;
}

.source-dot {
  width: 6px;
  height: 6px;
  flex: none;
  margin-top: 4px;
  background: var(--forest-3);
  border-radius: 50%;
}

.legend-footer .text-button {
  flex: none;
  font-size: 10px;
}

/* ---------- Kortalag ---------- */

.map-controls {
  position: absolute;
  top: 16px;
  right: 18px;
  z-index: 1000;
}

.basemap-control {
  width: 232px;
  overflow: hidden;
}

.basemap-header {
  padding: 11px 13px;
}

.basemap-header .panel-title strong {
  font-family: var(--font-sans);
  font-size: 12.5px;
  font-weight: 750;
  letter-spacing: -0.01em;
}

.basemap-header .panel-kicker {
  font-size: 8.5px;
}

.basemap-control.is-open .basemap-header {
  border-bottom: 1px solid var(--line);
  border-radius: var(--radius) var(--radius) 0 0;
}

.basemap-body {
  display: grid;
  gap: 3px;
  padding: 6px;
}

.basemap-option {
  position: relative;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 5px;
  border-radius: 10px;
  cursor: pointer;
  transition: background 120ms ease;
}

.basemap-option:hover {
  background: rgba(22, 36, 28, 0.045);
}

.basemap-option.is-active {
  background: #e8eee4;
}

.basemap-option input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}

.basemap-option:has(input:focus-visible) {
  box-shadow: var(--focus);
}

.basemap-thumb {
  position: relative;
  width: 43px;
  height: 33px;
  flex: none;
  overflow: hidden;
  background-color: #dce3d8;
  border: 1px solid rgba(22, 36, 28, 0.1);
  border-radius: 6px;
}

.basemap-thumb::before,
.basemap-thumb::after {
  content: "";
  position: absolute;
}

.thumb-streets {
  background:
    linear-gradient(118deg, transparent 44%, #fff 45%, #fff 50%, transparent 51%),
    linear-gradient(24deg, transparent 53%, #c2d2bd 54%, #c2d2bd 58%, transparent 59%),
    #dfe6d9;
}

.thumb-streets::before {
  inset: 0;
  background:
    linear-gradient(90deg, transparent 65%, rgba(164, 189, 167, 0.8) 66%, rgba(164, 189, 167, 0.8) 72%, transparent 73%),
    linear-gradient(0deg, transparent 70%, rgba(255, 255, 255, 0.9) 71%, rgba(255, 255, 255, 0.9) 75%, transparent 76%);
}

.thumb-streets::after {
  right: 6px;
  bottom: 5px;
  width: 7px;
  height: 7px;
  background: var(--forest-3);
  border: 1.5px solid #fff;
  border-radius: 50%;
}

.thumb-terrain {
  background:
    radial-gradient(ellipse at 25% 30%, #d6d0b1 0 18%, transparent 19%),
    radial-gradient(ellipse at 78% 68%, #c6b98e 0 24%, transparent 25%),
    linear-gradient(155deg, #dce3cf 0 40%, #c8d4b9 41% 63%, #dfe4c9 64%);
}

.thumb-terrain::before {
  inset: 0;
  background: repeating-linear-gradient(155deg, transparent 0 6px, rgba(132, 148, 104, 0.35) 7px, transparent 8px);
}

.thumb-satellite {
  background:
    radial-gradient(ellipse at 72% 30%, rgba(198, 190, 160, 0.75) 0 17%, transparent 18%),
    radial-gradient(ellipse at 27% 70%, rgba(101, 124, 80, 0.9) 0 25%, transparent 26%),
    linear-gradient(135deg, #4d6750 0 36%, #7c8d67 37% 58%, #344b3c 59% 100%);
}

.thumb-satellite::before {
  inset: 0;
  background: linear-gradient(73deg, transparent 40%, rgba(205, 214, 202, 0.5) 41%, rgba(205, 214, 202, 0.5) 43%, transparent 44%);
}

.basemap-copy {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.basemap-copy strong {
  font-size: 11.5px;
  font-weight: 750;
}

.basemap-copy small {
  color: var(--muted);
  font-size: 9px;
  font-weight: 500;
}

/* ---------- Svæðaspjald ---------- */

.area-panel {
  position: absolute;
  top: 84px;
  right: 18px;
  z-index: 1100;
  display: flex;
  flex-direction: column;
  width: 380px;
  max-height: calc(100% - 102px);
  overflow: hidden;
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 21px;
  box-shadow: var(--shadow-lg);
  animation: area-in 230ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes area-in {
  from {
    opacity: 0;
    transform: translateX(14px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.area-accent {
  height: 5px;
  flex: none;
  background: var(--accent, var(--forest-2));
}

.area-head {
  position: relative;
  flex: none;
  padding: 21px 23px 18px;
  border-bottom: 1px solid var(--line);
}

.area-kicker {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--accent, var(--forest-2));
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.area-kicker::before {
  content: "";
  width: 7px;
  height: 7px;
  background: currentColor;
  border-radius: 50%;
}

.area-head h2 {
  max-width: calc(100% - 30px);
  margin: 7px 0 7px;
  font-family: var(--font-serif);
  font-size: 31px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.08;
  text-wrap: balance;
}

.area-lede {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}

.area-expand {
  display: none;
}

.area-head .icon-button {
  position: absolute;
  top: 17px;
  right: 17px;
}

.landeign-owners {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.landeign-owners-head {
  color: #a16207;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landeign-owners-loading,
.landeign-owners-note {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.45;
}

.landeign-owners-note a {
  color: #a16207;
  font-weight: 750;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.landeign-owners-list {
  margin-top: 4px;
}

.landeign-owner {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 4px 0;
  border-bottom: 1px dashed var(--line);
  color: var(--ink-soft);
  font-size: 10.5px;
  line-height: 1.35;
}

.landeign-owner:last-child {
  border-bottom: 0;
}

.landeign-owner span:last-child {
  flex: none;
  color: var(--muted);
  font-weight: 700;
}

.landeign-plan-section {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--line);
}

.landeign-plan-section h4 {
  margin: 0 0 8px;
  color: #6d28d9;
  font-size: 9.5px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.landeign-plan {
  margin-bottom: 9px;
  padding: 9px 10px;
  background: #f5f3ff;
  border: 1px solid #ddd6fe;
  border-radius: 10px;
}

.landeign-plan-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  color: var(--ink);
  font-size: 10.5px;
  font-weight: 700;
}

.landeign-plan-head span:last-child {
  flex: none;
  color: #6d28d9;
  font-size: 10px;
  font-weight: 800;
}

.landeign-plan-meta {
  margin: 4px 0 6px;
  color: var(--muted);
  font-size: 10px;
  line-height: 1.4;
}

.landeign-plan-comment {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed #ddd6fe;
}

.landeign-plan-comment span {
  display: block;
  margin-bottom: 2px;
  color: #6d28d9;
  font-size: 8.5px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.landeign-plan-comment p {
  max-height: 150px;
  margin: 0;
  overflow: auto;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1.45;
  white-space: pre-line;
}

.area-content {
  flex: 1;
  padding: 17px 23px 19px;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.facts {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px 16px;
  margin: 0;
}

.fact {
  min-width: 0;
}

.fact dt {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.09em;
  text-transform: uppercase;
}

.fact dd {
  margin: 0;
  color: var(--ink-soft);
  font-size: 12.5px;
  font-weight: 650;
  line-height: 1.35;
  overflow-wrap: anywhere;
}

.fact.is-wide {
  grid-column: 1 / -1;
}

.area-note {
  display: flex;
  gap: 8px;
  margin: 20px 0 0;
  padding: 11px 12px;
  color: var(--muted);
  background: var(--paper-2);
  border-radius: 10px;
  font-size: 10.5px;
  line-height: 1.5;
}

.area-note svg {
  flex: none;
  margin-top: 1px;
  color: var(--muted-2);
}

.area-panel.is-landeign .area-footer .text-link {
  display: none;
}

.area-panel.is-landeign:not(.has-landeign-geometry) .area-footer {
  display: none;
}

.area-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  flex: none;
  padding: 13px 23px;
  background: rgba(247, 246, 240, 0.72);
  border-top: 1px solid var(--line);
}

.area-footer .button {
  min-height: 34px;
  padding: 7px 12px;
  font-size: 11.5px;
}

/* ---------- Kortapoppar ---------- */

.map-popup {
  width: 258px;
  padding: 15px 16px 14px;
}

.map-popup-kicker {
  color: var(--muted);
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.map-popup h3 {
  margin: 3px 0 2px;
  font-family: var(--font-serif);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  line-height: 1.1;
}

.map-popup-sub {
  margin: 0;
  color: var(--muted);
  font-size: 11px;
  line-height: 1.45;
}

.map-popup-area {
  display: flex;
  align-items: flex-start;
  gap: 7px;
  margin: 11px 0;
  padding: 8px 9px;
  color: var(--ink-soft);
  background: #edf2e9;
  border-radius: 8px;
  font-size: 10.5px;
  font-weight: 650;
  line-height: 1.4;
}

.map-popup-area.is-context {
  background: #f3eee2;
}

.map-popup-area.is-outside {
  color: var(--muted);
  background: var(--paper-2);
}

.map-popup-area .dot {
  width: 6px;
  height: 6px;
  flex: none;
  margin-top: 4px;
  background: var(--forest-3);
  border-radius: 50%;
}

.map-popup-area.is-context .dot {
  background: #b68435;
}

.map-popup-area.is-outside .dot {
  background: var(--muted-2);
}

.map-popup-coords {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 9px;
  padding-top: 9px;
  border-top: 1px solid var(--line);
  color: var(--ink-soft);
  font-family: var(--font-mono);
  font-size: 10px;
}

.map-popup-copy {
  display: grid;
  place-items: center;
  width: 25px;
  height: 25px;
  flex: none;
  color: var(--muted);
  background: var(--paper-2);
  border-radius: 7px;
  cursor: pointer;
}

.map-popup-copy:hover {
  color: var(--ink);
  background: #e6e8df;
}

.map-popup-link {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  margin-top: 10px;
  padding: 0;
  color: var(--forest-2);
  font-size: 11px;
  font-weight: 750;
  background: transparent;
  cursor: pointer;
}

.map-popup-link:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

/* ---------- Leaflet sérstilling ---------- */

.landregistry-plan-tiles,
.landregistry-plan-overview {
  filter: grayscale(1) sepia(1) hue-rotate(205deg) saturate(3.2) brightness(0.95);
}

.leaflet-container {
  font-family: var(--font-sans);
  background: #dfe5dd;
}

/* Mýkja skipti á flísum og kvarðanum þegar zoom-ar */
.basemap-tiles .leaflet-tile {
  transition: opacity 180ms linear;
}

.leaflet-control-scale {
  transition: opacity 220ms ease;
}

.leaflet-control-scale.is-fading {
  opacity: 0;
}

.leaflet-container a {
  color: var(--forest-2);
}

.leaflet-control-zoom {
  overflow: hidden;
  border: 0 !important;
  border-radius: 12px !important;
  box-shadow: var(--shadow-sm) !important;
}

.leaflet-control-zoom a {
  width: 34px !important;
  height: 32px !important;
  color: var(--ink-soft) !important;
  background: rgba(250, 249, 244, 0.96) !important;
  border-bottom: 1px solid var(--line) !important;
  font-size: 18px !important;
  line-height: 31px !important;
}

.leaflet-control-zoom a:last-child {
  border-bottom: 0 !important;
}

.leaflet-control-zoom a:hover {
  background: #fff !important;
}

.leaflet-control-scale-line {
  color: var(--ink-soft);
  background: rgba(250, 249, 244, 0.82);
  border-color: rgba(22, 36, 28, 0.45);
  font-size: 9px;
  font-weight: 650;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.leaflet-control-attribution {
  max-width: min(72vw, 780px);
  padding: 3px 7px !important;
  color: var(--muted) !important;
  background: rgba(250, 249, 244, 0.83) !important;
  font-size: 9px !important;
  line-height: 1.4 !important;
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.leaflet-control-attribution a {
  color: var(--forest-2) !important;
}

.leaflet-popup-content-wrapper {
  padding: 0;
  overflow: hidden;
  background: var(--white);
  border-radius: 16px;
  box-shadow: var(--shadow);
}

.leaflet-popup-content {
  width: auto !important;
  margin: 0;
  font-family: var(--font-sans);
  line-height: 1.45;
}

.leaflet-popup-tip {
  background: var(--white);
  box-shadow: none;
}

.leaflet-container a.leaflet-popup-close-button {
  top: 9px;
  right: 9px;
  z-index: 2;
  display: grid;
  place-items: center;
  width: 24px;
  height: 24px;
  color: var(--muted);
  background: rgba(22, 36, 28, 0.055);
  border-radius: 50%;
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 22px;
}

.leaflet-container a.leaflet-popup-close-button:hover {
  color: var(--ink);
  background: rgba(22, 36, 28, 0.1);
}

.leaflet-tooltip.area-tooltip {
  padding: 6px 9px;
  color: var(--ink-soft);
  background: rgba(255, 254, 251, 0.97);
  border: 0;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(18, 35, 24, 0.16);
  font-family: var(--font-sans);
  font-size: 11px;
  font-weight: 750;
  white-space: nowrap;
}

.leaflet-tooltip.area-tooltip::before {
  border-top-color: rgba(255, 254, 251, 0.97);
}

.leaflet-interactive:focus {
  outline: none;
}

/* punktar */

.map-pin {
  width: 38px;
  height: 45px;
  transform-origin: 50% 100%;
  animation: pin-drop 300ms cubic-bezier(0.2, 0.8, 0.3, 1.2) both;
  filter: drop-shadow(0 5px 8px rgba(18, 35, 24, 0.3));
}

.map-pin svg {
  width: 100%;
  height: 100%;
}

@keyframes pin-drop {
  from {
    opacity: 0;
    transform: translateY(-8px) scale(0.8);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.user-location-marker {
  width: 30px;
  height: 30px;
}

.user-marker {
  position: relative;
  width: 30px;
  height: 30px;
}

.user-marker .user-dot {
  position: absolute;
  top: 8px;
  left: 8px;
  width: 14px;
  height: 14px;
  background: #2163d5;
  border: 2.5px solid #fff;
  border-radius: 50%;
  box-shadow: 0 2px 6px rgba(17, 45, 90, 0.34);
}

.user-marker .user-pulse {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 26px;
  height: 26px;
  background: rgba(33, 99, 213, 0.25);
  border-radius: 50%;
  animation: user-pulse 2.1s ease-out infinite;
}

@keyframes user-pulse {
  0% {
    opacity: 0.9;
    transform: scale(0.55);
  }
  75%,
  100% {
    opacity: 0;
    transform: scale(1.75);
  }
}

/* ---------- Tilkynningar ---------- */

.toast {
  position: absolute;
  bottom: 26px;
  left: 50%;
  z-index: 1500;
  max-width: min(440px, calc(100% - 30px));
  padding: 10px 14px;
  color: #fff;
  background: #1f3026;
  border: 1px solid rgba(255, 255, 255, 0.14);
  border-radius: 11px;
  box-shadow: var(--shadow);
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  text-align: center;
  transform: translateX(-50%);
  animation: toast-in 180ms ease both;
}

@keyframes toast-in {
  from {
    opacity: 0;
    transform: translate(-50%, 5px);
  }
  to {
    opacity: 1;
    transform: translate(-50%, 0);
  }
}

.noscript {
  position: absolute;
  inset: 0;
  z-index: 2000;
  display: grid;
  place-items: center;
  padding: 24px;
  color: var(--ink);
  background: var(--paper);
  font-size: 16px;
  font-weight: 700;
  text-align: center;
}

/* ---------- Um vefinn ---------- */

.about-dialog {
  width: min(870px, calc(100vw - 30px));
  max-height: min(88vh, 820px);
  padding: 0;
  overflow: auto;
  color: var(--ink);
  background: var(--white);
  border: 1px solid rgba(255, 255, 255, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow-lg);
  overscroll-behavior: contain;
}

.about-dialog::backdrop {
  background: rgba(15, 30, 21, 0.42);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.about-dialog[open] {
  animation: dialog-in 220ms cubic-bezier(0.2, 0.75, 0.25, 1) both;
}

@keyframes dialog-in {
  from {
    opacity: 0;
    transform: translateY(10px) scale(0.985);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

.about-top {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 22px 25px 18px;
  border-bottom: 1px solid var(--line);
}

.about-mark {
  width: 46px;
  height: 46px;
  flex: none;
}

.about-mark svg {
  width: 100%;
  height: 100%;
}

.about-top > div {
  flex: 1;
}

.about-top h2 {
  margin: 0;
  font-family: var(--font-serif);
  font-size: 30px;
  font-weight: 600;
  letter-spacing: -0.035em;
  line-height: 1.05;
}

.about-body {
  padding: 22px 25px 26px;
}

.about-lead {
  max-width: 70ch;
  margin: 0 0 24px;
  color: var(--ink-soft);
  font-size: 14px;
  line-height: 1.6;
}

.about-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 22px 30px;
}

.about-grid h3 {
  margin: 0 0 5px;
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.about-grid p {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.65;
}

.about-grid code {
  padding: 1px 4px;
  color: var(--ink-soft);
  background: var(--paper-2);
  border-radius: 4px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  overflow-wrap: anywhere;
}

.about-links {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 14px;
  margin-top: 8px !important;
}

.about-links a {
  font-weight: 750;
  text-decoration: none;
}

.about-links a:hover {
  text-decoration: underline;
  text-underline-offset: 2px;
}

.about-note {
  margin-top: 24px;
  padding: 13px 15px;
  color: var(--muted);
  background: var(--paper-2);
  border-left: 3px solid var(--sand);
  border-radius: 4px 10px 10px 4px;
  font-size: 11px;
  line-height: 1.6;
}

.about-note strong {
  color: var(--ink-soft);
}

.about-credits {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 6px 20px;
  margin-top: 20px;
  padding-top: 14px;
  color: var(--muted-2);
  border-top: 1px solid var(--line);
  font-size: 9.5px;
  font-weight: 600;
}

/* ---------- Skjábreiddir ---------- */

@media (max-width: 1120px) {
  .topbar {
    grid-template-columns: auto minmax(260px, 1fr) auto;
    gap: 18px;
  }

  .brand-sub {
    display: none;
  }

  .area-panel {
    width: 355px;
  }
}

@media (max-width: 820px) {
  .topbar {
    grid-template-areas:
      "brand actions"
      "search search";
    grid-template-columns: 1fr auto;
    gap: 8px 12px;
    min-height: 0;
    padding: calc(9px + env(safe-area-inset-top, 0px)) 13px 11px;
  }

  .brand {
    grid-area: brand;
  }

  .brand-mark {
    width: 37px;
    height: 37px;
  }

  .brand-title {
    font-size: 26px;
  }

  .search-shell {
    grid-area: search;
    max-width: none;
  }

  .search-form {
    height: 45px;
  }

  .topbar-actions {
    grid-area: actions;
  }

  .search-kbd {
    display: none;
  }

  .map-controls {
    top: 12px;
    right: 12px;
  }

  .legend-wrap {
    top: 12px;
    left: 12px;
    width: 160px;
    max-width: none;
  }

  .legend-wrap.is-expanded {
    top: 76px;
    right: 12px;
    width: auto;
  }

  .legend {
    width: 100%;
  }

  .legend .panel-header {
    padding: 10px 11px;
  }

  .legend .panel-title strong {
    font-size: 15px;
    line-height: 1.15;
    white-space: normal;
  }

  .legend .panel-kicker {
    font-size: 8.5px;
  }

  .legend .panel-chevron {
    width: 24px;
    height: 24px;
  }

  .search-input {
    font-size: 16px;
  }

  .leaflet-control-zoom {
    display: none;
  }

  .leaflet-bottom.leaflet-right {
    bottom: var(--leaflet-control-offset, 0px);
    transition: bottom 180ms ease;
  }

  .leaflet-control-attribution {
    max-width: calc(100vw - 24px);
  }

  .basemap-control {
    width: 190px;
  }

  .bottom-stack {
    bottom: calc(12px + env(safe-area-inset-bottom, 0px));
    left: 12px;
    max-width: calc(100% - 24px);
  }

  .location-card {
    width: min(345px, calc(100vw - 24px));
  }

  .coordinate-row svg {
    opacity: 0.5;
  }

  .area-panel {
    top: auto;
    right: 8px;
    bottom: calc(8px + env(safe-area-inset-bottom, 0px));
    left: 8px;
    width: auto;
    max-height: 72vh;
    border-radius: 22px;
    animation-name: area-up;
  }

  @keyframes area-up {
    from {
      opacity: 0;
      transform: translateY(18px);
    }
    to {
      opacity: 1;
      transform: none;
    }
  }

  .area-head {
    padding: 17px 20px 15px;
  }

  .area-head h2 {
    margin-top: 5px;
    max-width: calc(100% - 92px);
    font-size: 27px;
  }

  .area-head .area-expand {
    position: absolute;
    top: 17px;
    right: 57px;
    display: grid;
  }

  .area-expand svg {
    transform: rotate(180deg);
    transition: transform 180ms ease;
  }

  .area-panel.is-expanded .area-expand svg {
    transform: rotate(0deg);
  }

  .area-panel.is-collapsed .area-lede,
  .area-panel.is-collapsed .area-content,
  .area-panel.is-collapsed .area-footer {
    display: none;
  }

  .area-panel.is-collapsed .area-head {
    border-bottom: 0;
    padding-bottom: 18px;
  }

  .area-content {
    padding: 15px 20px 17px;
  }

  .area-footer {
    padding: 11px 20px;
  }

  .toast {
    bottom: 90px;
  }

  .about-dialog {
    border-radius: 20px;
  }

  .about-top {
    padding: 18px 20px 15px;
  }

  .about-top h2 {
    font-size: 25px;
  }

  .about-body {
    padding: 18px 20px 22px;
  }

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

@media (max-width: 520px) {
  .topbar {
    padding-right: 10px;
    padding-left: 10px;
  }

  .brand-mark {
    width: 34px;
    height: 34px;
  }

  .brand-title {
    font-size: 24px;
  }

  .brand {
    gap: 8px;
  }

  .locate-button {
    width: 38px;
    min-height: 38px;
    padding: 0;
    border-radius: 50%;
  }

  .locate-button span {
    display: none;
  }

  .topbar-actions {
    gap: 6px;
  }

  .icon-button {
    width: 36px;
    height: 36px;
  }

  .basemap-control {
    width: 190px;
  }

  .location-card {
    width: calc(100vw - 24px);
  }

  .bottom-stack {
    max-width: calc(100% - 24px);
  }

  .legend-body {
    max-height: 54vh;
  }

  .map-popup {
    width: 234px;
  }

  .facts {
    grid-template-columns: 1fr;
    gap: 12px;
  }

  .fact.is-wide {
    grid-column: auto;
  }

  .area-footer {
    flex-wrap: wrap;
    gap: 8px;
  }

  .toast {
    bottom: 78px;
  }
}

@media (pointer: coarse) {
  .search-input {
    font-size: 16px;
  }
}

@media (max-height: 720px) and (min-width: 821px) {
  .legend-body {
    max-height: 43vh;
  }

  .area-panel {
    bottom: 12px;
    max-height: calc(100% - 96px);
  }
}

@media (max-width: 380px) {
  .legend-wrap {
    width: 130px;
  }

  .legend .panel-title strong {
    font-size: 13px;
  }

  .basemap-control {
    width: 160px;
  }

  .basemap-header {
    padding: 9px 10px;
  }

  .basemap-header .panel-title strong {
    font-size: 11px;
  }
}

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