/* Our Pasture: a meadow sunrise. Warm oat paper, deep field green,
   sunrise gold and green, frosted glass. Serif headlines, plain body text. */

:root {
  /* paper and ink */
  --paper: #faf4e8;
  --paper-2: #f3ead7;
  --card: #fffdf7;
  --ink: #20281f;
  --muted: #5c6350;
  --cream: #fbf7ec;

  /* lines */
  --line: rgba(45, 74, 55, 0.16);
  --line-soft: rgba(45, 74, 55, 0.10);

  /* greens */
  --forest: #2d4a37;
  --forest-deep: #1b3125;
  --moss: #476b3f;

  /* meadow sunrise */
  --feijoa: #a8d779;
  --saffron: #f6d12c;
  --ecstasy: #f67e23;
  --mandy: #e94e77;
  --havelock: #4b91e2;
  --saffron-soft: rgba(246, 209, 44, 0.35);
  --rise: linear-gradient(100deg, var(--feijoa), var(--saffron) 52%, var(--ecstasy));

  /* glass-style fills; no backdrop blur, which is costly on slow devices */
  --glass: rgba(255, 252, 244, 0.88);
  --glass-strong: rgba(255, 253, 248, 0.94);
  --glass-edge: rgba(255, 255, 255, 0.6);

  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 20px;
  --radius-lg: 26px;
  --map-h: clamp(400px, 62vh, 640px);
  --shadow-sm: 0 1px 2px rgba(32, 40, 31, 0.05), 0 12px 24px -18px rgba(45, 74, 55, 0.38);
  --shadow: 0 2px 4px rgba(32, 40, 31, 0.05), 0 26px 52px -32px rgba(45, 74, 55, 0.55);
}

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

body {
  margin: 0;
  background-color: var(--paper);
  background-image:
    radial-gradient(rgba(45, 74, 55, 0.045) 1px, transparent 1px),
    radial-gradient(1100px 700px at 12% -12%, rgba(246, 209, 44, 0.26), transparent 62%),
    radial-gradient(1000px 780px at 92% -8%, rgba(168, 215, 121, 0.32), transparent 60%),
    radial-gradient(920px 700px at 98% 78%, rgba(75, 145, 226, 0.10), transparent 62%),
    radial-gradient(1000px 760px at 2% 96%, rgba(246, 126, 35, 0.13), transparent 60%),
    radial-gradient(760px 560px at 76% 108%, rgba(233, 78, 119, 0.07), transparent 60%);
  background-size: 22px 22px, auto, auto, auto, auto, auto;
  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: rgba(168, 215, 121, 0.55); }

.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: var(--glass);
  border-bottom: 1px solid var(--glass-edge);
  box-shadow: 0 12px 32px -28px rgba(45, 74, 55, 0.55);
}
.site-head::after {
  content: ""; display: block; height: 2px;
  background: linear-gradient(90deg, transparent, rgba(168, 215, 121, 0.8) 18%, rgba(246, 209, 44, 0.85) 46%, rgba(246, 126, 35, 0.7) 74%, transparent);
  opacity: 0.75;
}
.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: 8px;
  box-shadow: 0 2px 8px -3px rgba(45, 74, 55, 0.5), 0 0 0 4px rgba(246, 209, 44, 0.16);
}
.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.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease, box-shadow 0.18s ease;
}
.btn.primary {
  background: linear-gradient(140deg, var(--forest), var(--forest-deep));
  color: var(--cream);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 12px 22px -16px rgba(27, 49, 37, 0.9);
}
.btn.primary:hover { transform: translateY(-1px); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14), 0 16px 26px -16px rgba(27, 49, 37, 0.9); }
.btn.ghost {
  background: var(--glass);
  border-color: var(--line);
  color: var(--forest);
}
.btn.ghost:hover { background: var(--glass-strong); border-color: rgba(45, 74, 55, 0.3); transform: translateY(-1px); }
.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(--forest); outline-offset: 2px;
  box-shadow: 0 0 0 5px var(--saffron-soft);
}

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

.intro { padding-top: 40px; }
.intro h1 {
  display: inline-block;
  font-size: clamp(36px, 4.6vw, 54px);
  line-height: 1.02;
  letter-spacing: -0.035em;
  padding-bottom: 12px;
  text-wrap: balance;
  position: relative;
}
.intro h1::after {
  content: ""; position: absolute; left: 0; right: 8%; bottom: 0; height: 8px;
  border-radius: 999px; background: var(--rise); opacity: 0.6;
}
.lede { font-size: 17.5px; line-height: 1.55; color: var(--muted); max-width: 62ch; margin: 14px 0 0; }

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

.controls { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: 12px 20px; margin-top: 26px; align-items: center; }
.search { position: relative; display: flex; align-items: center; }
.search svg { position: absolute; left: 17px; color: var(--forest); opacity: 0.7; pointer-events: none; }
.search input {
  width: 100%; padding: 13px 18px 13px 46px;
  border: 1px solid var(--glass-edge); border-radius: 999px;
  background: var(--glass);
  box-shadow: var(--shadow-sm);
  font-size: 15.5px;
  transition: box-shadow 0.18s ease, border-color 0.18s ease, background-color 0.18s ease;
}
.search input::placeholder { color: var(--muted); }
.search:focus-within input {
  background: var(--glass-strong);
  border-color: rgba(45, 74, 55, 0.35);
  box-shadow: 0 0 0 4px var(--saffron-soft), var(--shadow-sm);
  outline: none;
}
.distance { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.distance-head { display: flex; flex-wrap: nowrap; align-items: center; 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: 12.5px; font-weight: 700; color: var(--forest-deep); white-space: nowrap;
  padding: 2px 9px; border-radius: 999px;
  background: linear-gradient(120deg, rgba(168, 215, 121, 0.34), rgba(246, 209, 44, 0.4));
  border: 1px solid rgba(246, 209, 44, 0.45);
}

/* the distance slider: the filled part is the sunrise */
.distance input[type="range"] {
  -webkit-appearance: none; appearance: none;
  width: 100%; height: 28px; 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: 8px; border-radius: 999px;
  background-image:
    linear-gradient(90deg, var(--feijoa), var(--saffron) 55%, var(--ecstasy)),
    linear-gradient(90deg, transparent var(--fill), rgba(45, 74, 55, 0.14) var(--fill));
  background-color: rgba(45, 74, 55, 0.14);
}
.distance input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 22px; height: 22px; margin-top: -7px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffdf6 0 42%, #f6e7bf 100%);
  border: 2px solid var(--forest);
  box-shadow: 0 2px 6px rgba(45, 74, 55, 0.35), 0 0 0 4px rgba(246, 209, 44, 0.22);
}
.distance input[type="range"]::-moz-range-track {
  height: 8px; border-radius: 999px;
  background-image:
    linear-gradient(90deg, var(--feijoa), var(--saffron) 55%, var(--ecstasy)),
    linear-gradient(90deg, transparent var(--fill), rgba(45, 74, 55, 0.14) var(--fill));
  background-color: rgba(45, 74, 55, 0.14);
}
.distance input[type="range"]::-moz-range-thumb {
  width: 20px; height: 20px; border-radius: 50%;
  background: radial-gradient(circle at 35% 30%, #fffdf6 0 42%, #f6e7bf 100%);
  border: 2px solid var(--forest);
  box-shadow: 0 2px 6px rgba(45, 74, 55, 0.35), 0 0 0 4px rgba(246, 209, 44, 0.22);
}

/* ---------------------------------------------------------------- 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(--glass);
  padding: 7px 13px 7px 11px; font-size: 13.5px; line-height: 1.3;
  color: var(--forest); cursor: pointer;
  transition: background-color 0.18s ease, color 0.18s ease, border-color 0.18s ease,
    transform 0.18s ease, box-shadow 0.18s ease;
}
.chip:hover { border-color: rgba(45, 74, 55, 0.3); background: var(--glass-strong); transform: translateY(-1px); box-shadow: var(--shadow-sm); }
.chip svg { flex: none; color: var(--chip-mark, var(--forest)); }
.chip-label { white-space: nowrap; }
.chip-n {
  min-width: 20px; padding: 1px 7px; border-radius: 999px;
  background: rgba(45, 74, 55, 0.10); color: var(--forest-deep);
  font-size: 11.5px; font-weight: 700; text-align: center;
}
.chip[aria-pressed="true"] {
  background: linear-gradient(140deg, var(--forest), var(--forest-deep));
  border-color: var(--forest); color: var(--cream);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.12), 0 12px 22px -18px rgba(27, 49, 37, 0.9);
}
.chip[aria-pressed="true"] svg { color: var(--cream); }
.chip[aria-pressed="true"] .chip-n { background: rgba(251, 247, 236, 0.22); color: var(--cream); }
.chip-clear { background: transparent; border-style: dashed; color: var(--muted); padding: 7px 13px; }
.chip-clear:hover { color: var(--forest); background: var(--glass); }
.chip[data-category="vegetables"] { --chip-mark: #4c7a2f; }
.chip[data-category="fruit"] { --chip-mark: #b83a5c; }
.chip[data-category="meat"] { --chip-mark: #a64b18; }
.chip[data-category="eggs"] { --chip-mark: #8a6a00; }
.chip[data-category="dairy"] { --chip-mark: #2f6fb0; }
.chip[data-category="bakery"] { --chip-mark: #8a5a2b; }
.chip[data-category="sweeteners"] { --chip-mark: #956600; }
.chip[data-category="plants"] { --chip-mark: #3f7a45; }
.chip[data-category="farm-goods"] { --chip-mark: #6b5b33; }
.map-col { min-width: 0; }

.map-stage {
  position: relative;
  border: 1px solid var(--glass-edge);
  border-radius: var(--radius-lg);
  overflow: hidden;
  background: #eef0e4;
  isolation: isolate;
  box-shadow: var(--shadow), inset 0 0 0 1px rgba(45, 74, 55, 0.05);
}
.map-stage.is-picking { border-color: var(--forest); box-shadow: 0 0 0 3px var(--saffron-soft), var(--shadow); }
.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(45, 74, 55, 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: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--glass-edge);
  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;
  scrollbar-color: rgba(45, 74, 55, 0.3) transparent;
  padding: 2px 4px 4px 2px;
}

.farm {
  background: linear-gradient(165deg, rgba(255, 253, 248, 0.9), rgba(255, 248, 235, 0.55));
  border: 1px solid var(--glass-edge); border-radius: var(--radius);
  padding: 16px 18px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.75), var(--shadow-sm);
  content-visibility: auto;
  contain-intrinsic-size: 180px;
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.farm:hover { transform: translateY(-2px); border-color: rgba(45, 74, 55, 0.26); box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.8), var(--shadow); }
.farm.is-active {
  border-color: var(--forest);
  box-shadow: 0 0 0 3px var(--saffron-soft), inset 0 1px 0 rgba(255, 255, 255, 0.8), 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(--rise); color: var(--ink);
  font-size: 12px; font-weight: 700; padding: 4px 10px; border-radius: 999px;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.55);
}
.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;
  background: rgba(255, 255, 255, 0.5);
  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(--glass);
  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-loading {
  position: absolute; inset: 0; z-index: 2; margin: 0;
  display: flex; align-items: center; justify-content: center;
  color: var(--muted); font-size: 13px; pointer-events: none;
}
.map-credit {
  position: absolute; right: 8px; bottom: 8px; z-index: 4; margin: 0;
  padding: 2px 8px; border-radius: 8px;
  background: rgba(255, 253, 248, 0.94);
  border: 1px solid var(--glass-edge);
  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: 30px; height: 30px; padding: 0; cursor: pointer;
  background: transparent; border: 0; color: var(--forest);
}
.map-tools .map-tool:hover { background: rgba(246, 209, 44, 0.2); }
.map-tools .map-tool[aria-pressed="true"] { background: rgba(168, 215, 121, 0.35); color: var(--forest-deep); }

.maplibregl-map { font-family: var(--sans); background: #eef0e4; }
.maplibregl-ctrl-group {
  background: rgba(255, 253, 248, 0.92);
  border: 1px solid var(--glass-edge);
  border-radius: 14px;
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.maplibregl-ctrl-group button { color: var(--forest); }
.maplibregl-ctrl-group button:hover { background: rgba(246, 209, 44, 0.18); }
.maplibregl-ctrl-scale {
  border-color: rgba(45, 74, 55, 0.5); color: var(--forest);
  background: rgba(255, 253, 248, 0.92);
  border-radius: 6px; padding: 1px 6px;
  font-family: var(--sans);
}
.maplibregl-ctrl-attrib { border-radius: 8px; }
.maplibregl-ctrl-attrib a { color: var(--forest); }
.maplibregl-popup-content {
  border-radius: 18px; padding: 14px 16px;
  background: rgba(255, 253, 248, 0.96);
  border: 1px solid var(--glass-edge);
  box-shadow: var(--shadow);
}
.maplibregl-popup-close-button { font-size: 18px; padding: 2px 7px; color: var(--muted); }

.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: var(--havelock); border: 3px solid #fff;
  box-shadow: 0 0 0 6px rgba(75, 145, 226, 0.22);
}

.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(--rise); color: var(--ink);
  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: 7px; }
  .intro { padding-top: 26px; }
  .intro h1 { font-size: clamp(34px, 9vw, 44px); padding-bottom: 10px; }
  .intro h1::after { height: 6px; right: 4%; }
  .lede { font-size: 16px; }
  .controls { grid-template-columns: 1fr; margin-top: 20px; }
  .distance input[type="range"] { height: 34px; }
  .distance input[type="range"]::-webkit-slider-thumb { width: 26px; height: 26px; margin-top: -9px; }
  .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;
    /* room for the focus ring, which the scroll box would otherwise clip */
    padding: 5px 24px 5px 5px; margin: -5px -24px -5px -5px;
  }
  .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: 15px 16px; }
  .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; }
}
