@font-face {
  font-family: "Geist Variable";
  src: url("./nudge-geist.woff2") format("woff2");
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
}

.place-nudge {
  --nudge-card: #fff;
  --nudge-foreground: #0a0a0a;
  --nudge-muted: #737373;
  --nudge-accent: #0b7038;
  position: fixed;
  z-index: 2;
  bottom: max(24px, env(safe-area-inset-bottom));
  left: 50%;
  width: min(320px, calc(100% - 32px));
  transform: translateX(-50%);
  padding: 16px;
  border-radius: 22px;
  corner-shape: superellipse(1.45);
  background: var(--nudge-card);
  color: var(--nudge-foreground);
  box-shadow:
    0 0 0 1px color-mix(in srgb, var(--nudge-foreground) 10%, transparent),
    0 8px 24px -6px oklch(0 0 0 / 0.18), 0 2px 6px -2px oklch(0 0 0 / 0.12);
  font: 14px/20px "Geist Variable", system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  pointer-events: none;
}

[data-theme="dark"] .place-nudge {
  --nudge-card: #171717;
  --nudge-foreground: #fafafa;
  --nudge-muted: #a1a1a1;
}

.place-nudge[hidden], .place-nudge button[hidden] { display: none; }

.place-nudge__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.place-nudge__eyebrow {
  margin: 0;
  color: var(--nudge-muted);
  font-size: 12px;
  line-height: 16px;
  font-weight: 500;
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

.place-nudge__close {
  display: grid;
  place-items: center;
  flex: none;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 50%;
  color: var(--nudge-muted);
  background: transparent;
  cursor: pointer;
  pointer-events: auto;
}

.place-nudge__close:hover {
  color: var(--nudge-foreground);
  background: color-mix(in srgb, var(--nudge-foreground) 7%, transparent);
}

.place-nudge__close svg { width: 16px; height: 16px; }
.place-nudge__body { display: grid; gap: 4px; }

.place-nudge__title {
  margin: 0;
  color: var(--nudge-foreground);
  font-size: 18px;
  line-height: 1.25;
  font-weight: 600;
  overflow-wrap: anywhere;
}

.place-nudge__detail {
  margin: 0;
  color: var(--nudge-muted);
  overflow-wrap: anywhere;
}

.place-nudge__retry {
  width: 100%;
  min-height: 48px;
  margin-top: 16px;
  border: 0;
  border-radius: 999px;
  color: #fafafa;
  background: var(--nudge-accent);
  font: 500 16px/24px "Geist Variable", system-ui, sans-serif;
  cursor: pointer;
  pointer-events: auto;
}

.place-nudge__retry:hover {
  background: color-mix(in oklch, var(--nudge-accent) 88%, black);
}

.place-nudge button:focus-visible {
  outline: 2px solid var(--nudge-accent);
  outline-offset: 2px;
}

@media (max-width: 480px) {
  .place-nudge { bottom: max(24px, env(safe-area-inset-bottom)); }
  .corner { bottom: calc(max(24px, env(safe-area-inset-bottom)) + var(--place-nudge-height, 0px) + 12px); }
}

.place-nudge__detail[hidden] { display: none; }

.place-nudge--result {
  display: flex;
  flex-direction: column;
  width: min(360px, calc(100% - 32px));
  height: 124px;
}

.place-nudge--result .place-nudge__body {
  flex: 1;
  min-height: 0;
  grid-template-rows: minmax(0, 1fr) auto;
}

.place-nudge__location {
  position: relative;
  min-height: 0;
  padding-inline-end: 28px;
  overflow: hidden;
}

.place-nudge--result .place-nudge__close {
  position: absolute;
  top: 14px;
  right: 10px;
  z-index: 1;
}

.place-nudge--result .place-nudge__title {
  font-size: 19px;
  line-height: 22px;
  text-wrap: pretty;
}

.place-nudge--result .place-nudge__title,
.place-nudge__location > .place-nudge__detail:not([hidden]) {
  display: -webkit-box;
  -webkit-box-orient: vertical;
  overflow: hidden;
  -webkit-line-clamp: 2;
}

.place-nudge__location > .place-nudge__detail {
  margin-top: 3px;
  line-height: 18px;
  text-wrap: pretty;
}

.place-nudge--result[data-context-lines="1"] .place-nudge__location > .place-nudge__detail {
  -webkit-line-clamp: 1;
}

.place-nudge__body:has(.place-nudge__footer[hidden]) .place-nudge__location > .place-nudge__detail {
  -webkit-line-clamp: 3;
}

.place-nudge--result .place-nudge__retry {
  min-height: 44px;
  margin-top: 8px;
}

.place-nudge__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
  height: 23px;
  border-top: 1px solid color-mix(in srgb, var(--nudge-foreground) 10%, transparent);
}

.place-nudge__footer[hidden] {
  display: none;
}

.place-nudge__coordinates {
  margin: 0;
  color: var(--nudge-muted);
  font-size: 12px;
  line-height: 16px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.02em;
}


.place-nudge__location > :is(h1, p) {
  pointer-events: auto;
  user-select: text;
}

@media (max-width: 640px) {
  #map .maplibregl-ctrl-bottom-left {
    top: 16px;
    right: 12px;
    bottom: auto;
    left: auto;
    z-index: 3;
  }

  #map .maplibregl-ctrl-bottom-left > .maplibregl-ctrl-attrib.maplibregl-compact {
    width: 40px;
    height: 40px;
    min-height: 0;
    margin: 0;
    padding: 0;
    border-radius: 50%;
    box-sizing: border-box;
    background: radial-gradient(circle, var(--bg) 0 10px, transparent 11px);
  }

  #map .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-button {
    inset: 0;
    width: 100%;
    height: 100%;
    border-radius: inherit;
    background-color: transparent;
    background-position: center;
    background-size: 22px;
    background-repeat: no-repeat;
  }

  #map .maplibregl-ctrl-attrib-button:focus:not(:focus-visible) {
    outline: none;
    box-shadow: none;
  }

  #map .maplibregl-ctrl-bottom-left .maplibregl-ctrl-attrib-inner {
    position: absolute;
    top: calc(100% + 4px);
    right: 4px;
    width: max-content;
    max-width: calc(100vw - 32px);
    padding: 8px 12px;
    border-radius: 12px;
    background: var(--bg);
    box-shadow: 0 0 0 1px var(--rim), var(--shadow);
  }
}

.asset-status {
  position: fixed;
  top: 21px;
  left: 50%;
  z-index: 2;
  display: flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 11px;
  transform: translateX(-50%);
  border-radius: 999px;
  background: var(--bg);
  color: var(--fg);
  box-shadow: 0 0 0 1px var(--rim), var(--shadow);
  font: 500 12px/16px "Geist Variable", system-ui, sans-serif;
  white-space: nowrap;
  pointer-events: none;
}

.asset-status[hidden] { display: none; }

.asset-status--retry {
  border: 0;
  pointer-events: auto;
  cursor: pointer;
}

.asset-status--retry:hover {
  background: color-mix(in srgb, var(--bg) 92%, var(--fg));
}

.asset-status__retry-icon {
  width: 13px;
  height: 13px;
}

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


.asset-status__spinner {
  width: 13px;
  height: 13px;
  border: 2px solid var(--rim);
  border-top-color: var(--fg);
  border-radius: 50%;
  animation: asset-turn 800ms linear infinite;
}

.asset-status:not([data-mode="loading"]) .asset-status__spinner { display: none; }

.asset-status__progress {
  width: 13px;
  height: 13px;
  border-radius: 50%;
  background: conic-gradient(var(--fg) var(--asset-progress, 0%), var(--rim) 0);
  mask-image: radial-gradient(farthest-side, transparent calc(100% - 2px), #000 calc(100% - 1px));
}

@keyframes asset-turn {
  to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
  .asset-status__spinner { animation: none; }
}
