/* ==========================================================================
   Wildsforge base spot finder (/tools/base-finder/).
   Needs /assets/site.css (tokens) and /assets/map.css (map frame, notice, popups) loaded first.
   ========================================================================== */

.bf-intro { max-width: 760px; margin: 10px 0 16px; }
.bf-intro h1 { font-size: clamp(26px, 4.2vw, 38px); }
.bf-intro p { margin: 10px 0 0; color: var(--muted); font-size: 16.5px; }

/* Layout: choices on the left; map and results on the right */
.bf-app {
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-areas: "side map" "side results";
  gap: 16px;
  align-items: start;
}
.bf-side { grid-area: side; display: grid; gap: 16px; position: sticky; top: 12px; max-height: calc(100vh - 24px); overflow-y: auto; overscroll-behavior: contain; }
.bf-mapwrap { grid-area: map; }
.bf-results-wrap { grid-area: results; }

.bf-card {
  border: 1px solid var(--border);
  border-radius: 14px;
  background: var(--surface);
}
.bf-quick, .bf-detail { padding: 16px; }
.bf-step { margin: 0 0 6px; color: var(--accent); font-size: 12px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; }
.bf-side h2 { margin: 0 0 10px; font-size: 17px; }
.bf-block + .bf-block { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }

/* Preset chips */
.bf-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.bf-chip {
  padding: 7px 12px;
  border: 1px solid var(--border);
  border-radius: 999px;
  background: var(--bg);
  color: var(--text);
  font: inherit;
  font-size: 14px;
  cursor: pointer;
  transition: border-color 0.15s, background 0.15s;
}
.bf-chip:hover { border-color: var(--accent); }
.bf-chip[aria-pressed="true"] { border-color: var(--accent); background: var(--accent); color: var(--accent-text); font-weight: 600; }

/* Walking distance and other options */
.bf-options { display: grid; gap: 12px; }
.bf-distance { display: flex; border: 1px solid var(--border); border-radius: 10px; overflow: hidden; }
.bf-distance label { flex: 1; }
.bf-distance input { position: absolute; opacity: 0; pointer-events: none; }
.bf-distance span { display: block; padding: 8px 6px; text-align: center; font-size: 14px; cursor: pointer; }
.bf-distance label + label span { border-left: 1px solid var(--border); }
.bf-distance input:checked + span { background: var(--logo-bg); color: var(--accent); font-weight: 700; }
.bf-distance input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }
.bf-toggle { display: flex; align-items: flex-start; gap: 10px; font-size: 14px; cursor: pointer; }
.bf-toggle input { margin-top: 3px; accent-color: var(--accent); }
.bf-toggle small { display: block; color: var(--muted); font-size: 12.5px; }

/* Criteria: one row per resource with an Off / Nice / Must switch */
.bf-section + .bf-section { margin-top: 14px; }
.bf-section__title { display: flex; align-items: center; gap: 8px; margin: 0 0 6px; font-size: 14px; }
.bf-swatch { width: 18px; height: 18px; flex: none; }
.bf-items { margin: 0; padding: 0; list-style: none; }
.bf-item { display: flex; align-items: center; gap: 10px; padding: 5px 0; }
.bf-item__label { flex: 1; font-size: 14px; }
.bf-seg { display: inline-flex; border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.bf-seg input { position: absolute; opacity: 0; pointer-events: none; }
.bf-seg span { display: block; min-width: 44px; padding: 4px 8px; text-align: center; font-size: 12.5px; color: var(--muted); cursor: pointer; }
.bf-seg label + label span { border-left: 1px solid var(--border); }
.bf-seg input:checked + span { color: var(--text); font-weight: 700; background: var(--surface-2); }
.bf-seg input[value="nice"]:checked + span { background: var(--logo-bg); color: var(--accent); }
.bf-seg input[value="must"]:checked + span { background: var(--accent); color: var(--accent-text); }
.bf-seg input:focus-visible + span { outline: 2px solid var(--focus); outline-offset: -2px; }

/* The map */
.bf-mapwrap { position: relative; overflow: hidden; }
.bf-map { height: min(62vh, 640px); min-height: 380px; background: #677775; }
.bf-heat { image-rendering: auto; mix-blend-mode: normal; }
.bf-legend {
  position: absolute;
  left: 12px;
  bottom: 12px;
  z-index: 1000;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface);
  font-size: 12px;
  pointer-events: none;
}
.bf-legend__bar { width: 150px; height: 8px; margin: 4px 0 2px; border-radius: 4px; background: linear-gradient(90deg, rgb(196 69 54), rgb(224 168 46), rgb(63 160 70)); }
.bf-legend__ends { display: flex; justify-content: space-between; color: var(--muted); }

/* Numbered best-spot pins */
.bf-pin span {
  display: grid;
  place-items: center;
  width: 30px;
  height: 30px;
  border: 2px solid #fff;
  border-radius: 50%;
  background: var(--accent);
  color: var(--accent-text);
  font-weight: 800;
  font-size: 14px;
  box-shadow: 0 3px 10px rgb(0 0 0 / 0.4);
}

/* Pop-up for a clicked spot */
.bf-pop__title { margin: 0; font-weight: 700; font-size: 15px; }
.bf-pop__meta { margin: 2px 0 8px; color: var(--muted); font-size: 12.5px; }
.bf-pop__hint { margin: 8px 0 0; color: var(--muted); font-size: 12px; }

/* Best spots */
.bf-results-wrap { padding: 16px; }
.bf-results-wrap h2 { margin: 0 0 4px; font-size: 18px; }
.bf-results-wrap > p { margin: 0 0 12px; color: var(--muted); font-size: 14px; }
.bf-results { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px; margin: 0; padding: 0; list-style: none; }
.bf-spot { display: flex; flex-direction: column; gap: 8px; padding: 12px; border: 1px solid var(--border); border-radius: 12px; background: var(--bg); }
.bf-spot__head { display: flex; align-items: center; gap: 10px; }
.bf-spot__rank { display: grid; place-items: center; width: 30px; height: 30px; flex: none; border-radius: 50%; background: var(--accent); color: var(--accent-text); font-weight: 800; }
.bf-spot__title { margin: 0; font-weight: 700; }
.bf-spot__near { margin: 0; color: var(--muted); font-size: 12.5px; }
.bf-meter { height: 6px; border-radius: 3px; background: var(--surface-2); overflow: hidden; }
.bf-meter span { display: block; height: 100%; border-radius: 3px; background: linear-gradient(90deg, rgb(224 168 46), rgb(63 160 70)); }
.bf-haves { display: grid; gap: 4px; margin: 0; padding: 0; list-style: none; font-size: 13px; }
.bf-have { display: flex; align-items: center; gap: 6px; }
.bf-have.is-missing { color: var(--muted); }
.bf-have.is-missing .bf-swatch { opacity: 0.4; }
.bf-spot__go {
  margin-top: auto;
  padding: 7px 10px;
  border: 1px solid var(--accent);
  border-radius: 8px;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}
.bf-spot__go:hover { background: var(--accent); color: var(--accent-text); }
.bf-empty { margin: 0; color: var(--muted); }

.bf-notes { max-width: 760px; margin: 22px 0 0; }
.bf-notes h2 { font-size: 20px; }
.bf-notes ul { color: var(--muted); padding-left: 20px; }
.bf-notes li { margin: 6px 0; }

/* Phones: quick settings and map first, then the best spots, then the detailed choices */
@media (max-width: 860px) {
  .bf-app { grid-template-columns: minmax(0, 1fr); grid-template-areas: "quick" "map" "results" "detail"; }
  .bf-side { display: contents; }
  .bf-quick { grid-area: quick; }
  .bf-detail { grid-area: detail; }
  .bf-map { height: 58vh; min-height: 340px; }
}
.bf-notes h3 { margin: 16px 0 4px; font-size: 16px; }
.bf-notes p { color: var(--muted); }
