/* Minimal, non-decorative styles: only the things Tailwind utilities can't express
   cleanly (spinner keyframes + info popover placement via CSS anchor positioning). */

/* ---- Loading spinner: a ring of small round dots that rotates. ----
   All dots share one light color; the ring simply spins. The larger spinner
   uses more dots. --dot is the dot size (smaller = more spacing between dots). */
.spinner {
  display: inline-block;
  width: 1em;
  height: 1em;
  aspect-ratio: 1;
  --dot: 13%;
  --dot-color: color-mix(in srgb, currentColor 40%, transparent);
  --d: radial-gradient(circle closest-side, var(--dot-color) 95%, transparent);
  background:
    var(--d) 50% 0 / var(--dot) var(--dot) no-repeat,
    var(--d) 79% 9% / var(--dot) var(--dot) no-repeat,
    var(--d) 91% 50% / var(--dot) var(--dot) no-repeat,
    var(--d) 79% 91% / var(--dot) var(--dot) no-repeat,
    var(--d) 50% 100% / var(--dot) var(--dot) no-repeat,
    var(--d) 21% 91% / var(--dot) var(--dot) no-repeat,
    var(--d) 9% 50% / var(--dot) var(--dot) no-repeat,
    var(--d) 21% 9% / var(--dot) var(--dot) no-repeat;
  animation: spin 0.9s linear infinite;
  vertical-align: middle;
}
/* Larger = more dots (12 instead of 8). */
.spinner-lg {
  width: 2rem;
  height: 2rem;
  --dot: 9%;
  background:
    var(--d) 50% 0 / var(--dot) var(--dot) no-repeat,
    var(--d) 75% 7% / var(--dot) var(--dot) no-repeat,
    var(--d) 93% 25% / var(--dot) var(--dot) no-repeat,
    var(--d) 100% 50% / var(--dot) var(--dot) no-repeat,
    var(--d) 93% 75% / var(--dot) var(--dot) no-repeat,
    var(--d) 75% 93% / var(--dot) var(--dot) no-repeat,
    var(--d) 50% 100% / var(--dot) var(--dot) no-repeat,
    var(--d) 25% 93% / var(--dot) var(--dot) no-repeat,
    var(--d) 7% 75% / var(--dot) var(--dot) no-repeat,
    var(--d) 0 50% / var(--dot) var(--dot) no-repeat,
    var(--d) 7% 25% / var(--dot) var(--dot) no-repeat,
    var(--d) 25% 7% / var(--dot) var(--dot) no-repeat;
}
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* ---- Info button ("ⓘ") + popover explainer ----
   Icon and popover text share one light gray, consistent across every tooltip. */
.info-btn {
  cursor: help;
  line-height: 1;
  color: #6b7280; /* gray-500 — light hint styling */
  /* Fixed size so every ⓘ is identical regardless of the surrounding text size. */
  font-size: 0.8125rem;
}

.info-pop {
  max-width: 34rem;
  padding: 0.75rem 1rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: white;
  color: #6b7280; /* gray-500 — matches the .info-btn hint styling */
  font-size: 0.8125rem;
  font-weight: 400;
  line-height: 1.4;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08); /* same drop shadow as the map tooltip */
}
/* Standardize the body weight; keep <strong> labels bold. */
.info-pop * {
  font-weight: 400;
}
.info-pop strong,
.info-pop b {
  font-weight: 600;
}
.info-pop p {
  margin: 0 0 0.5rem;
}
.info-pop p:last-child {
  margin-bottom: 0;
}
.info-pop code {
  font-size: 0.75rem;
  word-break: break-all;
  background: #f3f4f6;
  padding: 0.05rem 0.25rem;
  border-radius: 0.2rem;
}
.info-pop a {
  text-decoration: underline;
}

/* ---- Map dots + hover tooltip ---- */
.map-dot {
  cursor: pointer;
  pointer-events: all; /* the transparent stroke counts as a hit target too */
}
.map-dot:hover {
  /* Categorized points carry a darker/more-saturated --dot-hover; others fall back to blue. */
  fill: var(--dot-hover, #2563eb);
  fill-opacity: 1;
}
.map-tip {
  position: fixed;
  z-index: 2147483647; /* always on top */
  pointer-events: none; /* never steals the hover from the dot underneath */
  max-width: 18rem;
  padding: 0.375rem 0.5rem;
  border: 1px solid #d1d5db;
  border-radius: 0.375rem;
  background: white;
  color: #6b7280; /* matches the tooltip hint styling */
  font-size: 0.75rem;
  line-height: 1.35;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.08);
}
.map-tip-head {
  display: flex;
  align-items: center;
  gap: 0.375rem;
}
.map-tip-glyph {
  flex: none;
}
.map-tip-name {
  font-weight: 600;
  color: #374151; /* gray-700 */
}
.map-tip-addr {
  display: block;
  margin-top: 0.125rem;
}

/* ---- Sticky layout (desktop only) ----
   On >=768px the header and left panel stay put and only the right column scrolls
   with the page. Below 768px none of this applies, so the whole page scrolls.
   --header-h is measured in app.js so the panel offset tracks the real header. */
@media (min-width: 768px) {
  .sticky-header {
    position: sticky;
    top: 0;
    z-index: 20;
  }
  .sticky-panel {
    position: sticky;
    align-self: flex-start;
    top: var(--header-h, 88px);
    /* Always fill at least the rest of the viewport below the header. */
    min-height: calc(100vh - var(--header-h, 88px));
    max-height: calc(100vh - var(--header-h, 88px));
    overflow-y: auto;
  }
}

/* Float the popover next to its anchor where CSS anchor positioning is supported.
   Where it isn't (older browsers), the native Popover API still centers it — fine. */
@supports (anchor-name: --x) {
  .info-pop {
    position: absolute;
    margin: 0.25rem 0 0 0;
    inset: auto;
    top: anchor(bottom);
    left: anchor(left);
    position-try-fallbacks: flip-block, flip-inline;
  }
}
