/* Our Pasture: warm paper, deep green, a little clay.
   Serif headlines, plain body text. Map first, list beside it. */

:root {
  --paper: #f7f2e6;
  --card: #fffdf6;
  --ink: #23261e;
  --muted: #6f6a5c;
  --line: #ddd2ba;
  --line-soft: #e8dfcb;
  --forest: #274233;
  --forest-deep: #1b3026;
  --cream: #f7f2e6;
  --clay: #ad4f29;
  --sage: #dfe8d9;
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 18px;
  --map-h: clamp(400px, 62vh, 640px);
  --shadow: 0 22px 44px -34px rgba(39, 66, 51, 0.45);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { scroll-behavior: smooth; }

body {
  margin: 0;
  background-color: var(--paper);
  background-image: radial-gradient(rgba(39, 66, 51, 0.05) 1px, transparent 1px);
  background-size: 22px 22px;
  color: var(--ink);
  font-family: var(--sans);
  font-size: 16px;
  line-height: 1.55;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { font-family: var(--serif); font-weight: 600; letter-spacing: -0.015em; margin: 0; color: var(--ink); }
p { margin: 0 0 12px; }
a { color: var(--forest); }
button, input, select { font: inherit; color: inherit; }
::selection { background: var(--sage); }

.wrap { width: min(1180px, 100%); margin: 0 auto; padding: 0 24px; }
.sr-only {
  position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

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

/* ------------------------------------------------------------------ head */

.site-head {
  position: sticky; top: 0; z-index: 30;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.head-inner { display: flex; align-items: center; justify-content: space-between; gap: 16px; height: 66px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-icon { display: block; width: 30px; height: 30px; border-radius: 7px; box-shadow: 0 2px 6px -3px rgba(39, 66, 51, 0.45); }
.brand .mark { font-family: var(--serif); font-size: 25px; letter-spacing: -0.02em; color: var(--ink); }
.brand .tag {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.14em;
  text-transform: uppercase; color: var(--muted);
}

/* ---------------------------------------------------------------- buttons */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 11px 19px; border-radius: 999px; border: 1px solid transparent;
  font-size: 15px; font-weight: 600; line-height: 1.2; cursor: pointer;
  text-decoration: none;
  transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}
.btn.primary { background: var(--forest); color: var(--cream); }
.btn.primary:hover { background: var(--forest-deep); }
.btn.ghost { background: transparent; border-color: var(--line); color: var(--forest); }
.btn.ghost:hover { background: var(--card); border-color: var(--forest); }
.btn.small { padding: 7px 14px; font-size: 13.5px; }
.btn:focus-visible, input:focus-visible, select:focus-visible, .map-tool:focus-visible, .chip:focus-visible {
  outline: 2px solid var(--clay); outline-offset: 2px;
}

/* ------------------------------------------------------------------ intro */

.intro { padding-top: 34px; }
.intro h1 { font-size: clamp(32px, 4vw, 46px); line-height: 1.03; letter-spacing: -0.03em; }
.lede { font-size: 17px; line-height: 1.55; color: var(--muted); max-width: 62ch; margin: 12px 0 0; }

/* --------------------------------------------------------------- controls */

.controls { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px 20px; margin-top: 24px; align-items: center; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 17px; color: var(--muted); pointer-events: none; }
.search input {
  width: 100%; padding: 13px 18px 13px 46px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  font-size: 15.5px;
}
.search input::placeholder { color: var(--muted); }
.distance { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.distance-head { display: flex; flex-wrap: nowrap; align-items: baseline; justify-content: space-between; gap: 10px; }
.distance label { font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.distance output { font-size: 13.5px; font-weight: 600; color: var(--forest); white-space: nowrap; }

/* the distance slider: the track fills up to the thumb */
.distance input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 26px; margin: 0; background: transparent; cursor: pointer;
  /* If a browser skips the custom track below, the native slider is still green. */
  accent-color: var(--forest);
  --fill: 100%;
}
.distance input[type="range"]::-webkit-slider-runnable-track {
  height: 7px; border-radius: 999px;
  background: linear-gradient(to right, var(--forest) var(--fill), var(--line) var(--fill));
}
.distance input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -8px; border-radius: 50%;
  background: var(--card); border: 2.5px solid var(--forest);
  box-shadow: 0 1px 3px rgba(39, 66, 51, 0.35);
}
.distance input[type="range"]::-moz-range-track {
  height: 7px; border-radius: 999px;
  background: linear-gradient(to right, var(--forest) var(--fill), var(--line) var(--fill));
}
.distance input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: var(--card); border: 2.5px solid var(--forest);
  box-shadow: 0 1px 3px rgba(39, 66, 51, 0.35);
}

/* ---------------------------------------------------------------- finder */

.finder {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(340px, 0.95fr);
  gap: 24px;
  align-items: start;
  margin-top: 14px;
}
.loc-status { margin-top: 10px; font-size: 14px; color: var(--muted); }

/* ------------------------------------------------------------- categories */

.categories { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin-top: 14px; }
.category-label {
  margin: 0; font-size: 12.5px; font-weight: 700; letter-spacing: 0.08em;
  text-transform: uppercase; color: var(--muted);
}
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  display: inline-flex; align-items: center; gap: 7px;
  border: 1px solid var(--line); border-radius: 999px; background: var(--card);
  padding: 7px 13px 7px 11px; font-size: 13.5px; line-height: 1.3;
  color: var(--forest); cursor: pointer;
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chip:hover { border-color: var(--forest); }
.chip svg { flex: none; }
.chip-label { white-space: nowrap; }
.chip-n {
  min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: var(--sage); color: var(--forest-deep);
  font-size: 11.5px; font-weight: 700; text-align: center;
}
.chip[aria-pressed="true"] { background: var(--forest); border-color: var(--forest); color: var(--cream); }
.chip[aria-pressed="true"] .chip-n { background: rgba(247, 242, 230, 0.22); color: var(--cream); }
.chip-clear { background: transparent; border-style: dashed; color: var(--muted); padding: 7px 13px; }
.chip-clear:hover { color: var(--forest); }
.map-col { min-width: 0; }

.map-stage {
  position: relative;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: #e8e4d6;
  isolation: isolate;
}
.map-stage.is-picking { border-color: var(--forest); box-shadow: 0 0 0 2px var(--sage); }
.map { width: 100%; height: var(--map-h); }
.map-note { margin: 9px 2px 0; }

/* the pin that stays in the middle while you move the map */
.spot-pin {
  position: absolute; left: 50%; top: 50%;
  transform: translate(-50%, -100%);
  pointer-events: none; z-index: 5;
  filter: drop-shadow(0 6px 8px rgba(23, 36, 29, 0.35));
}
.spot-tip {
  position: absolute; left: 50%; bottom: -4px;
  width: 8px; height: 8px; border-radius: 50%;
  background: rgba(39, 66, 51, 0.35);
  transform: translate(-50%, 0);
}
.spot-bar {
  position: absolute; left: 50%; bottom: 40px; z-index: 6;
  transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px;
  width: min(92%, 380px);
  padding: 12px 14px;
  background: var(--card); border: 1px solid var(--line);
  border-radius: 16px; box-shadow: var(--shadow);
}
.spot-text { margin: 0; font-size: 13.5px; color: var(--ink); }
.spot-actions { display: flex; gap: 8px; }
.spot-actions .btn { flex: 1; }

/* list column */
.list-col {
  position: sticky; top: 84px;
  display: flex; flex-direction: column;
  max-height: var(--map-h);
  min-width: 0;
}
.list-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; min-height: 22px; margin-bottom: 10px; }
.result-count { margin: 0; font-size: 12.5px; color: var(--muted); letter-spacing: 0.02em; }
.results {
  display: grid; gap: 12px;
  overflow-y: auto; overscroll-behavior: contain;
  scrollbar-gutter: stable;
  padding: 2px 4px 4px 2px;
}

.farm {
  background: var(--card); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 15px 17px; box-shadow: var(--shadow);
}
.farm.is-active { border-color: var(--forest); box-shadow: 0 0 0 2px var(--sage), var(--shadow); }
.farm-top { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: start; gap: 10px; }
.farm h2 { font-size: 20px; line-height: 1.15; }
.where { color: var(--muted); font-size: 13px; margin: 7px 0 0; }
.farm-distance {
  flex: 0 0 auto; background: var(--sage); color: var(--forest-deep);
  font-size: 12px; font-weight: 700; padding: 4px 9px; border-radius: 999px;
  white-space: nowrap;
}
.goods { list-style: none; display: flex; flex-wrap: wrap; gap: 6px; padding: 0; margin: 6px 0 0; }
.goods li {
  border: 1px solid var(--line-soft); border-radius: 999px;
  padding: 2px 9px; font-size: 12px; color: var(--ink);
}
.note { font-size: 13px; color: var(--muted); margin: 8px 0 0; }
.goods-empty { font-size: 12.5px; color: var(--muted); margin: 6px 0 0; }
.call, .page-link { font-size: 12.5px; font-weight: 600; color: var(--forest); text-decoration: none; white-space: nowrap; }
.call:hover, .page-link:hover { text-decoration: underline; }
.farm-foot {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  margin-top: 11px; padding-top: 10px; border-top: 1px dashed var(--line);
  flex-wrap: wrap;
}
.farm-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-left: auto; }
.hours { font-size: 12.5px; color: var(--muted); }

.empty {
  background: var(--card); border: 1px dashed var(--line); border-radius: var(--radius);
  padding: 32px 22px; text-align: center;
}
.empty h2 { font-size: 20px; }
.empty p { margin: 8px 0 0; }
.empty-action { margin-top: 14px; }

/* -------------------------------------------------------------------- map */

.map-fallback { padding: 24px; text-align: center; color: var(--muted); }
.map-credit {
  position: absolute; right: 8px; bottom: 8px; z-index: 4; margin: 0;
  padding: 2px 8px; border-radius: 7px;
  background: color-mix(in srgb, var(--card) 86%, transparent);
  font-size: 10.5px; line-height: 1.5; color: var(--muted);
}
.map-credit { pointer-events: none; }
.map-credit a { color: var(--forest); text-decoration: none; pointer-events: auto; }
.map-credit a:hover { text-decoration: underline; }

.map-tools .map-tool {
  display: flex; align-items: center; justify-content: center;
  width: 29px; height: 29px; padding: 0; cursor: pointer;
  background: transparent; border: 0; color: var(--forest);
}
.map-tools .map-tool:hover { background: var(--sage); }
.map-tools .map-tool[aria-pressed="true"] { background: var(--sage); color: var(--forest-deep); }

.maplibregl-map { font-family: var(--sans); background: #e8e4d6; }
.maplibregl-ctrl-group { background: var(--card); box-shadow: var(--shadow); }
.maplibregl-ctrl-group button { color: var(--forest); }
.maplibregl-ctrl-scale {
  border-color: var(--forest); color: var(--forest);
  background: color-mix(in srgb, var(--card) 88%, transparent);
  font-family: var(--sans);
}
.maplibregl-ctrl-attrib { font-size: 10.5px; }
.maplibregl-ctrl-attrib a { color: var(--forest); }
.maplibregl-popup-content { border-radius: 14px; padding: 14px 16px; }
.maplibregl-popup-close-button { font-size: 18px; padding: 2px 7px; color: var(--muted); }

.farm-pin {
  display: block; width: 30px; height: 40px; padding: 0; margin: 0;
  background: transparent; border: 0; cursor: pointer;
  filter: drop-shadow(0 2px 3px rgba(23, 36, 29, 0.35));
  transition: transform 0.12s ease;
}
.farm-pin:hover, .farm-pin:focus-visible { transform: translateY(-2px) scale(1.06); }
.farm-pin:focus-visible { outline: none; }
.farm-pin.is-offscreen { display: none; }
.you-pin {
  display: flex; align-items: center; justify-content: center;
  width: 26px; height: 26px; pointer-events: none;
}
.you-pin-dot {
  display: block; width: 16px; height: 16px; border-radius: 50%;
  background: #2f6fd0; border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(47, 111, 208, 0.2);
}

.popup h3 { font-size: 17px; line-height: 1.25; margin: 0; font-family: var(--serif); }
.popup-where { font-size: 12.5px; color: var(--muted); margin: 2px 0 0; }
.popup-goods { list-style: none; display: flex; flex-wrap: wrap; gap: 5px; padding: 0; margin: 8px 0 0; }
.popup-goods li { border: 1px solid var(--line-soft); border-radius: 999px; padding: 1px 8px; font-size: 11.5px; }
.popup-hours { font-size: 12px; color: var(--muted); margin: 8px 0 0; }
.popup-link { font-size: 12.5px; font-weight: 600; color: var(--forest); }
.popup-links { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 0; }
.popup-distance { background: var(--sage); color: var(--forest-deep); border-radius: 999px; padding: 1px 7px; font-size: 11px; font-weight: 700; margin-left: 4px; white-space: nowrap; }

/* ------------------------------------------------------------------- foot */

.site-foot { border-top: 1px solid var(--line); padding: 20px 0 42px; margin-top: 32px; color: var(--muted); font-size: 13px; }
.foot-inner { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }

/* -------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  .finder { grid-template-columns: minmax(0, 1fr); gap: 18px; }
  .list-col { position: static; max-height: none; }
  .results { overflow: visible; padding: 0; max-height: none; }
  .map { height: clamp(320px, 52vh, 520px); }
}

@media (max-width: 720px) {
  .head-inner { height: auto; padding: 10px 0; flex-wrap: wrap; gap: 10px; }
  .brand-icon { width: 26px; height: 26px; border-radius: 6px; }
  .intro { padding-top: 24px; }
  .lede { font-size: 16px; }
  .controls { grid-template-columns: 1fr; margin-top: 18px; }
  .distance input[type="range"] { height: 32px; }
  .distance input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -10px; }
  .categories { display: block; margin-top: 12px; }
  .category-label { margin-bottom: 8px; }
  /* One swipeable line keeps the map near the top of the phone screen. */
  .chips {
    flex-wrap: nowrap; overflow-x: auto; overscroll-behavior-x: contain;
    scrollbar-width: none; padding-right: 24px; margin-right: -24px;
  }
  .chips::-webkit-scrollbar { display: none; }
  .chip { flex: 0 0 auto; font-size: 13px; padding: 7px 12px 7px 10px; min-height: 36px; }
  .chip-clear { flex: 0 0 auto; padding: 7px 12px; min-height: 36px; }
  .farm { padding: 14px 15px; }
  .farm-foot { flex-wrap: wrap; }
  .map { height: 46vh; min-height: 300px; }
  .spot-bar { bottom: 36px; width: min(94%, 360px); }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  * { transition: none !important; }
}
