:root {
  --bg: #f6f1e6;
  --card: #ffffff;
  --ink: #2c2417;
  --muted: #85755c;
  --line: #eae0ca;
  --gold: #c9a227;
  --gold-ink: #8a6d12;
  --green: #2e7d4f;
  --green-ink: #1f5e3a;
  --shadow-sm: 0 1px 2px rgba(44, 36, 23, 0.06);
  --shadow: 0 2px 6px rgba(44, 36, 23, 0.05), 0 10px 24px rgba(44, 36, 23, 0.07);
  --r: 16px;
  --r-sm: 12px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Nunito", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- header ---------- */
.top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 10;
}
.brand { display: flex; align-items: center; gap: 11px; min-width: 0; }
.brand-mark {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 13px;
  background: #f6eccb;
  color: var(--gold-ink);
  display: flex;
  align-items: center;
  justify-content: center;
}
.brand-mark svg { width: 21px; height: 21px; }
.brand-text { min-width: 0; }
.brand h1 { margin: 0; font-size: 19px; font-weight: 900; letter-spacing: 0.2px; line-height: 1.2; }
/* location chip: "this is Fundi Finder, Kilifi" — more towns come later.
   Sits right-aligned in the header row, between the name and the slogan. */
.town-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px 2px 7px;
  font: inherit; font-size: 11.5px; font-weight: 800; color: var(--muted);
  background: transparent; border: 1px solid var(--line); border-radius: 999px;
  cursor: default; flex: none;
}
.town-chip .dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: var(--green-ink); flex: none;
}
.tagline {
  margin: 0; font-size: 12px; font-weight: 700; color: var(--muted);
  text-align: right; letter-spacing: 0.2px;
}
@media (max-width: 540px) {
  .tagline { display: none; }
}

/* ---------- main layout ---------- */
main { max-width: 780px; margin: 0 auto; padding: 16px 16px 40px; }
.controls { margin-bottom: 16px; }

/* ---------- search ---------- */
.search-wrap { position: relative; }
.search-wrap > svg {
  position: absolute;
  left: 15px;
  top: 50%;
  transform: translateY(-50%);
  width: 18px;
  height: 18px;
  color: var(--muted);
  pointer-events: none;
}
#search {
  width: 100%;
  padding: 13px 16px 13px 42px;
  font-size: 16px;
  font-family: inherit;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--card);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
#search:focus { border-color: var(--gold); box-shadow: 0 0 0 3px rgba(201, 162, 39, 0.18); }

/* ---------- landing grid ---------- */
.grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px;
}
.grid-tile {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: var(--r);
  padding: 14px 12px 12px;
  cursor: pointer;
  font-family: inherit;
  color: var(--ink);
  text-align: left;
  box-shadow: var(--shadow-sm);
  transition: transform 0.12s ease, border-color 0.12s ease, box-shadow 0.12s ease;
}
.grid-tile:hover { border-color: var(--gold); transform: translateY(-2px); box-shadow: var(--shadow); }
.grid-tile:active { transform: translateY(0); }
.tile-icon {
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}
.tile-icon svg { width: 20px; height: 20px; }
.tile-label { font-size: 13.5px; font-weight: 800; line-height: 1.25; }
.tile-count { font-size: 11.5px; color: var(--muted); font-weight: 600; }

/* tile tints */
.tint-clay .tile-icon { background: #f7e7de; color: #a05a2c; }
.tint-gold .tile-icon { background: #f6eccb; color: var(--gold-ink); }
.tint-sand .tile-icon { background: #f4ecd9; color: #96793a; }
.tint-slate .tile-icon { background: #e8ebf0; color: #4a5568; }
.tint-sky .tile-icon { background: #e4edf7; color: #3d5f8f; }
.tint-sea .tile-icon { background: #e2eef1; color: #2d6a7e; }
.tint-rose .tile-icon { background: #f7e5e9; color: #9c4a56; }
.tint-green .tile-icon { background: #e2efe4; color: var(--green); }
.tint-olive .tile-icon { background: #eef0dd; color: #66713a; }

/* ---------- list view ---------- */
.list-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.back-btn {
  flex: none;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease;
}
.back-btn:hover { border-color: var(--gold); }
.back-btn svg { width: 19px; height: 19px; }
.list-title { display: flex; align-items: baseline; gap: 9px; min-width: 0; }
.list-title h2 { margin: 0; font-size: 20px; font-weight: 900; line-height: 1.2; }
.group-count { font-size: 13px; color: var(--muted); font-weight: 600; white-space: nowrap; }

.entry-list { display: grid; gap: 10px; }
.entry-card {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--card);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 13px 15px;
  cursor: pointer;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.12s ease, transform 0.12s ease, box-shadow 0.12s ease;
}
.entry-card:hover { border-color: var(--gold); box-shadow: var(--shadow); }
.entry-card:active { transform: scale(0.995); }
.entry-main { min-width: 0; flex: 1; }
.entry-card .name { font-size: 16px; font-weight: 800; line-height: 1.3; }
.entry-card .meta { font-size: 13px; color: var(--muted); margin-top: 3px; }
.entry-card .meta .stars { color: var(--gold); letter-spacing: 1px; }
.entry-card .chev { flex: none; color: #c8bda4; width: 18px; height: 18px; }

/* verified-by-us badge: a small i that explains itself on tap */
.verified {
  display: inline-block;
  position: relative;
  vertical-align: 2px;
  margin-left: 7px;
}
.verified summary {
  list-style: none;
  cursor: pointer;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--green);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  line-height: 1;
  user-select: none;
}
.verified summary::-webkit-details-marker { display: none; }
.verified[open] summary { background: var(--green-ink); }
.verified .v-pop {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  top: 26px;
  z-index: 30;
  width: 250px;
  max-width: 74vw;
  background: var(--ink);
  color: #fdf9ef;
  font-size: 12.5px;
  font-weight: 400;
  font-style: normal;
  font-family: "Nunito", sans-serif;
  line-height: 1.45;
  border-radius: 10px;
  padding: 10px 12px;
  box-shadow: var(--shadow);
}

/* ---------- detail view ---------- */
.entry-detail { padding-top: 2px; }
.entry-detail .back-btn { margin-bottom: 14px; }
.entry-detail h2 { margin: 0 0 2px; font-size: 26px; font-weight: 900; line-height: 1.2; }
.aliases { font-size: 13.5px; color: var(--muted); margin-bottom: 14px; }

/* phone hero */
.phone-hero { margin: 16px 0; }
.btn-phone {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: var(--green);
  color: #fff;
  font-size: 16px;
  font-weight: 800;
  padding: 14px 22px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  font-family: inherit;
  box-shadow: var(--shadow);
  transition: background 0.12s ease, transform 0.12s ease;
}
.btn-phone:hover { background: var(--green-ink); transform: translateY(-1px); }
.btn-phone svg { width: 18px; height: 18px; }
.phone-hint { font-size: 12.5px; color: var(--muted); margin: 8px 2px 0; }
.phone-revealed {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
}
.phone-revealed .phone-link {
  font-size: 21px;
  font-weight: 900;
  color: var(--green-ink);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.phone-revealed .phone-link:hover { text-decoration: underline; }
.phone-revealed .phone-link svg { width: 20px; height: 20px; }

/* trust line: plain text, no card */
.rec-line { font-size: 14.5px; font-weight: 800; margin: 0 0 14px; }
.rec-line .stars { color: var(--gold); letter-spacing: 1px; font-weight: 700; }
.rec-line.muted { color: var(--muted); font-weight: 600; font-size: 13.5px; }
.quote { font-size: 14.5px; font-style: italic; margin: 10px 0 0; color: var(--ink); }
.quote .who { font-style: normal; color: var(--muted); font-size: 12px; margin-top: 3px; }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--green);
  background: var(--green);
  color: #fff;
  border-radius: 999px;
  padding: 10px 18px;
  font-size: 14px;
  font-weight: 800;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.12s ease;
}
.btn:hover { background: var(--green-ink); }
.btn.ghost { background: var(--card); color: var(--green-ink); border-color: var(--line); }
.btn.ghost:hover { border-color: var(--gold); background: var(--card); color: var(--gold-ink); }
.btn.sm { padding: 7px 14px; font-size: 13px; }

/* ---------- misc ---------- */
.hidden { display: none !important; }
.empty {
  color: var(--muted);
  text-align: center;
  padding: 34px 16px;
  font-size: 15px;
  font-weight: 700;
}
.empty span { display: block; font-weight: 400; font-size: 13.5px; margin-top: 4px; }
:focus-visible { outline: 3px solid rgba(201, 162, 39, 0.5); outline-offset: 2px; border-radius: 6px; }
@media (min-width: 420px) {
  .grid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 700px) {
  .grid { grid-template-columns: repeat(4, 1fr); }
}
@media (min-width: 900px) {
  .grid { grid-template-columns: repeat(5, 1fr); }
}

/* thumbs-up beside the recommendation count, on cards and detail pages */
.rec-thumb { display: inline-flex; color: var(--green-ink); margin-right: 5px; vertical-align: -2px; }
.rec-thumb svg { width: 14px; height: 14px; }
.rec-row .rec-text .rec-thumb { margin-right: 6px; margin-bottom: 2px; vertical-align: baseline; }
/* ---------- trust redesign (30 Aug): recommendation wording, badges, favourites ---------- */
.rec-strong { font-weight: 800; }
.rec-src { display: block; color: var(--muted); font-size: 12px; font-weight: 600; margin-top: 2px; }
.entry-card .meta .rec-src { font-size: 11.5px; }
.listed-line { color: var(--muted); }
.why-here { margin: 12px 0; border: 1px solid var(--line); border-radius: 10px; background: var(--card); }
.why-here summary {
  cursor: pointer; padding: 10px 14px; font-weight: 800; font-size: 14px;
  color: var(--green-ink); list-style: none;
}
.why-here summary::-webkit-details-marker { display: none; }
.why-here summary::before { content: "?  "; color: var(--gold-ink); font-weight: 900; }
.why-here[open] summary::before { content: "×  "; }
.why-body { padding: 0 14px 12px; font-size: 13.5px; color: var(--ink); }
.why-body p { margin: 6px 0; }
/* inline circled question mark beside the recommendation line */
.rec-row { display: flex; align-items: flex-start; gap: 8px; margin: 0 0 14px; }
.rec-row .rec-text { flex: 1; }
.why-inline { position: relative; margin-top: 1px; }
.why-inline summary {
  cursor: pointer; list-style: none; display: inline-flex;
  color: var(--muted); padding: 2px;
}
.why-inline summary::-webkit-details-marker { display: none; }
.why-inline summary svg { width: 17px; height: 17px; }
.why-inline summary:hover { color: var(--gold-ink); }
.why-pop {
  position: absolute; right: 0; top: 26px; z-index: 20; width: min(320px, 78vw);
  background: var(--card); border: 1px solid var(--line); border-radius: 12px;
  padding: 10px 14px; font-size: 13px; color: var(--ink);
  box-shadow: 0 6px 18px rgba(43, 34, 25, 0.12);
}
.why-pop p { margin: 6px 0; }
.how-reco {
  margin: 26px auto 8px; max-width: 640px; border: 1px solid var(--line);
  border-radius: 12px; background: var(--card); padding: 0 6px;
}
.how-reco summary {
  cursor: pointer; padding: 12px 12px; font-weight: 800; font-size: 14.5px;
  color: var(--green-ink); list-style: none;
}
.how-reco summary::-webkit-details-marker { display: none; }
.how-body { padding: 0 12px 14px; font-size: 14px; color: var(--ink); }
.how-body p { margin: 6px 0; }
.favourites { max-width: 980px; margin: 30px auto 0; padding: 0 16px; }
.fav-title { font-size: 19px; font-weight: 900; margin: 0 0 4px; }
.fav-sub { color: var(--muted); font-size: 13.5px; margin: 0 0 12px; }
.fav-row { display: flex; flex-wrap: wrap; gap: 10px; }
.fav-card {
  display: flex; flex-direction: column; gap: 3px; text-align: left;
  border: 1px solid var(--line); background: var(--card); border-radius: 12px;
  padding: 12px 14px; cursor: pointer; font: inherit; color: inherit;
  transition: border-color 0.12s ease;
}
.fav-card:hover { border-color: var(--gold); }
.fav-name { font-weight: 800; font-size: 14.5px; }
.fav-rec { color: var(--muted); font-size: 12px; font-weight: 600; }
@media (prefers-reduced-motion: reduce) {
  * { transition: none !important; }
}
