/* Kindred — tokens, base, layout, shared components, You / Discover / Stretch styles.
   Builder C's css/views-c.css uses only these tokens and shared classes. */

/* ------------------------------------------------------------------ tokens */
:root {
  --bg: #FBF7F0;
  --surface: #FFFFFF;
  --ink: #1F2328;
  --muted: #6B6F76;
  --line: #E8E2D6;
  --accent: #E4572E;
  --accent-ink: #FFFFFF;
  --accent-2: #2A9D8F;
  --amber: #B7791F;
  --amber-bg: #FFF4D6;
  --green: #2F855A;
  --green-bg: #E6F6EC;
  --radius: 14px;
  --radius-sm: 8px;
  --shadow: 0 2px 10px rgba(31, 35, 40, .08);
  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --font: ui-rounded, "SF Pro Rounded", "Nunito", "Segoe UI", system-ui, sans-serif;

  /* Derived helpers (same palette, tuned for text contrast on tinted backgrounds). */
  --accent-strong: #B83E1B;        /* white on this is about 5.6:1 */
  --accent-strong-hover: #9E3415;
  --accent-deep: #7E2A10;
  --accent-soft: #FDE9E2;
  --muted-strong: #5C6067;         /* muted text on --sand (about 5.4:1) */
  --accent-2-soft: #E2F3F1;
  --accent-2-ink: #1D6E64;
  --amber-ink: #7A4F0E;
  --green-ink: #22643F;
  --sand: #F3EDE2;
  --sand-strong: #E9E1D2;
  --focus: var(--accent-2);
  --shadow-lift: 0 6px 22px rgba(31, 35, 40, .12);
  --header-h: 64px;            /* app.js keeps this in sync with the real header height */
  --max-w: 1200px;
}

/* -------------------------------------------------------------------- base */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }

body {
  margin: 0;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font);
  font-size: 1rem;
  line-height: 1.5;
}

h1, h2, h3, h4 { line-height: 1.2; margin: 0; letter-spacing: -0.01em; }
h1 { font-size: clamp(1.6rem, 1.2rem + 1.6vw, 2.25rem); font-weight: 800; }
h2 { font-size: 1.25rem; font-weight: 750; }
h3 { font-size: 1.0625rem; font-weight: 700; }
p { margin: 0; }
ul, ol { margin: 0; padding: 0; }
img, svg { max-width: 100%; }

a { color: var(--accent-strong); text-underline-offset: 2px; }
a:hover { color: var(--ink); }

button, input, select, textarea { font: inherit; color: inherit; }

[hidden] { display: none !important; }

:focus-visible {
  outline: 3px solid var(--focus);
  outline-offset: 2px;
  border-radius: var(--radius-sm);
}
[tabindex="-1"]:focus { outline: none; }
[tabindex="-1"]:focus-visible { outline: 3px solid var(--focus); outline-offset: 4px; }

::selection { background: var(--accent-soft); }

.skip-link {
  position: absolute;
  left: var(--space-3);
  top: -60px;
  z-index: 3000;
  padding: var(--space-2) var(--space-4);
  background: var(--ink);
  color: #fff;
  border-radius: var(--radius-sm);
  text-decoration: none;
  font-weight: 700;
}
.skip-link:focus { top: var(--space-3); color: #fff; }

.noscript {
  max-width: var(--max-w);
  margin: var(--space-4) auto;
  padding: var(--space-4);
  background: var(--amber-bg);
  color: var(--amber-ink);
  border-radius: var(--radius);
  text-align: center;
  font-weight: 600;
}

/* ------------------------------------------------------------------ header */
.site-header {
  position: sticky;
  top: 0;
  z-index: 1100;               /* above Leaflet panes and controls */
  background: rgba(251, 247, 240, .92);
  -webkit-backdrop-filter: saturate(1.4) blur(10px);
  backdrop-filter: saturate(1.4) blur(10px);
  border-bottom: 1px solid var(--line);
}
.site-header-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-3) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-4);
}
.brand {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  min-width: 0;
}
.brand-mark { font-size: 1.5rem; align-self: center; display: inline-block; transform-origin: 50% 70%; }
.brand:hover .brand-mark { animation: brand-wiggle .6s ease; }
.brand-name {
  font-size: 1.5rem;
  font-weight: 850;
  letter-spacing: -0.03em;
  background: linear-gradient(100deg, var(--accent) 10%, #E9864B 55%, var(--accent-2) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}
.brand-tag {
  font-size: .8125rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
@media (max-width: 1080px) { .brand-tag { display: none; } }

@keyframes brand-wiggle {
  0%, 100% { transform: rotate(0); }
  30% { transform: rotate(-12deg) scale(1.08); }
  60% { transform: rotate(8deg); }
}

/* nav as pill tabs */
nav[data-nav] {
  display: flex;
  gap: 2px;
  padding: 4px;
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: 999px;
}
nav[data-nav] a {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-height: 36px;
  padding: 6px 16px;
  border-radius: 999px;
  color: var(--ink);
  font-weight: 650;
  font-size: .9375rem;
  text-decoration: none;
  white-space: nowrap;
  transition: background-color .15s ease, box-shadow .15s ease, color .15s ease;
}
nav[data-nav] a:hover { background: var(--sand-strong); color: var(--ink); }
nav[data-nav] a[aria-current="page"] {
  background: var(--surface);
  color: var(--accent-strong);
  font-weight: 800;
  box-shadow: var(--shadow), inset 0 -3px 0 var(--accent);
}
nav[data-nav] a:focus-visible { border-radius: 999px; }

@media (max-width: 720px) {
  .site-header-inner {
    flex-direction: column;
    align-items: stretch;
    gap: var(--space-2);
    padding: var(--space-2) var(--space-3);
  }
  .brand { justify-content: center; }
  .brand-name, .brand-mark { font-size: 1.25rem; }
  nav[data-nav] a {
    flex: 1 1 0;
    min-width: 0;
    padding: 6px 4px;
    font-size: .875rem;
  }
}
@media (max-width: 400px) {
  nav[data-nav] a { font-size: .8125rem; letter-spacing: -0.01em; }
}

/* -------------------------------------------------------------- main/footer */
.site-main {
  flex: 1 0 auto;
  width: 100%;
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-5) var(--space-5) var(--space-6);
}
.site-main:focus { outline: none; }
@media (max-width: 720px) {
  .site-main { padding: var(--space-4) var(--space-3) var(--space-6); }
}

.view { display: flex; flex-direction: column; gap: var(--space-5); }
.view-head { display: flex; flex-direction: column; gap: var(--space-2); }
.view-head .lede { color: var(--muted); font-size: 1.0625rem; max-width: 60ch; }
.view-error { margin-top: var(--space-4); }

.site-footer {
  border-top: 1px solid var(--line);
  background: var(--sand);
}
.site-footer-inner {
  max-width: var(--max-w);
  margin: 0 auto;
  padding: var(--space-4) var(--space-5);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3) var(--space-5);
  flex-wrap: wrap;
}
.footer-banner { color: var(--muted-strong); font-size: .875rem; max-width: 70ch; }
.footer-banner strong { color: var(--amber-ink); }
/* Two-step reset: replaces the button until the person answers */
.footer-confirm {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  font-size: .875rem;
  font-weight: 600;
  color: var(--ink);
}
@media (max-width: 720px) { .site-footer-inner { padding: var(--space-4) var(--space-3); } }

/* ------------------------------------------------------- shared: utilities */
.muted { color: var(--muted); }
.stack { display: flex; flex-direction: column; gap: var(--space-3); }
.row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2); }
.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  clip-path: inset(50%);
  white-space: nowrap;
  border: 0;
}

/* ---------------------------------------------------------- shared: buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: 42px;
  padding: 8px 18px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-weight: 700;
  font-size: .9375rem;
  line-height: 1.2;
  text-align: center;
  text-decoration: none;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, box-shadow .15s ease, transform .12s ease;
}
.btn:hover { border-color: #D6CCBA; background: #FFFBF5; color: var(--ink); }
.btn:active { transform: translateY(1px); }
.btn:disabled, .btn[aria-disabled="true"] {
  opacity: .5;
  cursor: not-allowed;
  transform: none;
}
.btn:focus-visible { border-radius: 999px; }

/* White text sits on --accent-strong (about 5.6:1), never on --accent (3.7:1). */
.btn-primary {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
  box-shadow: 0 2px 0 var(--accent-deep);
}
.btn-primary:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); color: var(--accent-ink); }
.btn-primary:active { box-shadow: 0 1px 0 var(--accent-deep); }
.btn-primary:disabled:hover { background: var(--accent-strong); border-color: var(--accent-strong); }

.btn-ghost {
  background: transparent;
  border-color: transparent;
  color: var(--ink);
  text-decoration: underline;
  text-decoration-color: rgba(31, 35, 40, .3);
  text-underline-offset: 3px;
}
.btn-ghost:hover { background: var(--sand); border-color: transparent; text-decoration-color: currentColor; }
.btn-ghost:disabled:hover { background: transparent; }

.btn-small {
  min-height: 34px;
  padding: 4px 12px;
  font-size: .875rem;
  gap: 6px;
}

.btn[aria-pressed="true"] {
  background: var(--accent-2-soft);
  border-color: var(--accent-2);
  color: var(--accent-2-ink);
}
.btn-check[aria-pressed="true"]::before { content: "✓"; font-weight: 800; }

/* ------------------------------------------------------------ shared: chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 36px;
  padding: 5px 13px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--ink);
  font-size: .9375rem;
  font-weight: 600;
  line-height: 1.2;
  cursor: pointer;
  user-select: none;
  -webkit-tap-highlight-color: transparent;
  transition: background-color .15s ease, border-color .15s ease, color .15s ease, box-shadow .15s ease;
}
.chip:hover { border-color: #D6CCBA; background: #FFFBF5; }
.chip:focus-visible { border-radius: 999px; }
.chip.is-on {
  background: var(--accent-strong);
  border-color: var(--accent-strong);
  color: var(--accent-ink);
  font-weight: 700;
  box-shadow: 0 2px 0 var(--accent-deep);
}
.chip.is-on:hover { background: var(--accent-strong-hover); border-color: var(--accent-strong-hover); color: var(--accent-ink); }
.chip:disabled { opacity: .5; cursor: not-allowed; }
.chip .chip-x {
  display: inline-grid;
  place-items: center;
  width: 18px; height: 18px;
  margin-right: -4px;
  border-radius: 50%;
  background: rgba(255, 255, 255, .25);
  font-size: .8125rem;
  line-height: 1;
}
.chip:not(.is-on) .chip-x { background: var(--sand); }

@keyframes chip-bounce {
  0% { transform: scale(1); }
  35% { transform: scale(1.1); }
  65% { transform: scale(.96); }
  100% { transform: scale(1); }
}
.chip.is-bouncing { animation: chip-bounce .34s cubic-bezier(.3, 1.4, .6, 1); }

/* ------------------------------------------------------------ shared: cards */
.card {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: var(--space-2);
  padding: var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  min-width: 0;
  transition: border-color .15s ease, box-shadow .2s ease, transform .2s ease;
}
.card.is-active {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-lift);
}

/* ----------------------------------------------------------- shared: badges */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 9px;
  border: 1px solid transparent;
  border-radius: 999px;
  background: var(--sand);
  color: var(--ink);
  font-size: .75rem;
  font-weight: 750;
  line-height: 1.5;
  letter-spacing: .01em;
  white-space: nowrap;
}
.badge-example { background: var(--amber-bg); color: var(--amber-ink); border-color: var(--amber); }
.badge-real { background: var(--green-bg); color: var(--green-ink); border-color: var(--green); }
.badge-kind-space { background: var(--accent-2-soft); color: var(--accent-2-ink); }
.badge-kind-group { background: var(--accent-soft); color: var(--accent-strong); }
.badge-kind-online { background: #ECEBFB; color: #44409A; }
.badge-seed { background: #EAF5DD; color: #3D6A16; }
.badge-yours { background: var(--ink); color: #fff; }
.badge[title] { cursor: help; }

/* ------------------------------------------------------------ shared: forms */
.field { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.field > label, .field > .field-label { font-weight: 700; font-size: .9375rem; }
.field .hint { color: var(--muted); font-size: .8125rem; }
.field input:not([type="checkbox"]):not([type="radio"]),
.field select,
.field textarea,
.input {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border: 1px solid #DCD4C5;
  border-radius: var(--radius-sm);
  background: var(--surface);
  color: var(--ink);
  font: inherit;
  transition: border-color .15s ease, box-shadow .15s ease;
}
.field textarea { min-height: 88px; resize: vertical; }
.field input:not([type="checkbox"]):not([type="radio"]):focus,
.field select:focus,
.field textarea:focus,
.input:focus {
  outline: none;
  border-color: var(--accent-2);
  box-shadow: 0 0 0 3px rgba(42, 157, 143, .25);
}
.field input::placeholder, .field textarea::placeholder, .input::placeholder { color: #8C9096; }

select.input, .field select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 34px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%),
                    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 18px) 52%, calc(100% - 13px) 52%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

/* plain checkbox with a label */
.check {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  min-height: 40px;
  cursor: pointer;
  font-weight: 600;
}
.check input[type="checkbox"] {
  width: 20px; height: 20px;
  margin: 0;
  accent-color: var(--accent);
  cursor: pointer;
}

/* ---------------------------------------------------- shared: toggle switch
   Works as <input type="checkbox" class="toggle"> or as a label.toggle wrapping
   a checkbox. Add role="switch" to the input. Knob is a gradient, so no pseudo
   elements are needed on the input. */
.toggle {
  display: inline-flex;
  align-items: center;
  gap: var(--space-3);
  cursor: pointer;
}
input.toggle[type="checkbox"],
.toggle input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  flex: none;
  width: 46px;
  height: 28px;
  margin: 0;
  border: 0;
  border-radius: 999px;
  background-color: #CFC7B8;
  background-image: radial-gradient(circle at center, #FFFFFF 0 10px, rgba(255, 255, 255, 0) 11px);
  background-size: 28px 28px;
  background-repeat: no-repeat;
  background-position: 0 0;
  box-shadow: inset 0 1px 2px rgba(31, 35, 40, .18);
  cursor: pointer;
  vertical-align: middle;
  transition: background-color .18s ease, background-position .18s ease;
}
input.toggle[type="checkbox"]:checked,
.toggle input[type="checkbox"]:checked {
  background-color: var(--accent-2);
  background-position: 18px 0;
}
input.toggle[type="checkbox"]:disabled,
.toggle input[type="checkbox"]:disabled { opacity: .5; cursor: not-allowed; }
input.toggle[type="checkbox"]:focus-visible,
.toggle input[type="checkbox"]:focus-visible { outline-offset: 3px; border-radius: 999px; }

/* ------------------------------------------------------------ shared: toast */
.toast {
  position: fixed;
  left: 50%;
  bottom: max(var(--space-5), env(safe-area-inset-bottom));
  z-index: 2000;
  width: max-content;
  max-width: calc(100vw - 32px);
  padding: 12px 18px;
  border-radius: var(--radius);
  background: var(--ink);
  color: #fff;
  font-weight: 650;
  font-size: .9375rem;
  box-shadow: 0 10px 30px rgba(31, 35, 40, .25);
  opacity: 0;
  transform: translate(-50%, 12px);
  pointer-events: none;
  transition: opacity .2s ease, transform .2s ease;
}
.toast:empty { visibility: hidden; }
.toast.is-shown { opacity: 1; transform: translate(-50%, 0); }
.toast.is-error { background: #7A1F12; }

/* ------------------------------------------------------------ shared: empty */
.empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .5);
  color: var(--muted);
  text-align: center;
}
.empty .empty-emoji { font-size: 2rem; line-height: 1; }
.empty .row { justify-content: center; }
.empty strong, .empty .empty-title { color: var(--ink); font-size: 1.0625rem; }

/* ============================================================ YOU (4.1) */
.you-search { max-width: 520px; }
.you-search-row { display: flex; gap: var(--space-2); align-items: stretch; }
.you-search-row .input { flex: 1; }
.you-add-custom { align-self: flex-start; }

.you-groups { display: grid; gap: var(--space-4) var(--space-5); grid-template-columns: repeat(auto-fill, minmax(min(100%, 340px), 1fr)); }
.you-group { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.you-group h3 { font-size: .9375rem; color: var(--muted); text-transform: uppercase; letter-spacing: .06em; display: flex; gap: 6px; align-items: center; }
.you-group h3 .cat-emoji { font-size: 1.05rem; }
.you-group.is-yours h3 { color: var(--accent-strong); }
.you-nomatch { color: var(--muted); }

.you-panel {
  padding: var(--space-5);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.you-panel > h2 + p { margin-top: var(--space-1); }

.grows-grid {
  display: grid;
  gap: var(--space-3);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 240px), 1fr));
  margin-top: var(--space-3);
}
.grow-toggle {
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg);
  transition: border-color .15s ease, background-color .15s ease;
}
.grow-toggle:hover { border-color: #D6CCBA; }
.grow-toggle:has(input:checked) { border-color: var(--accent-2); background: var(--accent-2-soft); }
.grow-text { display: flex; flex-direction: column; min-width: 0; }
.grow-text strong { font-size: 1rem; }
.grow-text span { font-size: .8125rem; color: var(--muted); }

.you-newbie { display: flex; flex-direction: column; gap: 0; margin-top: var(--space-4); }
.you-newbie .muted { font-size: .875rem; padding-left: 28px; }

.you-actions {
  position: sticky;
  bottom: 0;
  z-index: 5;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-3) var(--space-4);
  padding: var(--space-3) 0;
  background: linear-gradient(to bottom, rgba(251, 247, 240, 0), var(--bg) 30%);
}
.you-count { font-weight: 700; }
.you-count .muted { font-weight: 500; }

/* ======================================================== DISCOVER (4.2) */
.discover-location {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: var(--space-2) var(--space-3);
  padding: var(--space-3) var(--space-4);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}
.loc-text { font-size: 1.0625rem; flex: 1 1 220px; min-width: 0; }
.loc-text strong { color: var(--accent-strong); }
.loc-controls { display: flex; flex-wrap: wrap; gap: var(--space-2); align-items: center; }
.loc-controls select { min-height: 34px; padding: 4px 34px 4px 12px; border-radius: 999px; font-size: .875rem; font-weight: 600; width: auto; }
.loc-note { flex-basis: 100%; font-size: .875rem; color: var(--amber-ink); background: var(--amber-bg); border-radius: var(--radius-sm); padding: 6px 10px; }

.discover-filters { display: flex; flex-direction: column; gap: var(--space-2); }
.filter-row { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-2) var(--space-4); }
.filter-group { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin: 0; padding: 0; border: 0; min-width: 0; }
.filter-label { font-size: .8125rem; font-weight: 750; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-right: 2px; }
.filter-group .chip { min-height: 32px; padding: 4px 11px; font-size: .875rem; }
.my-interests .chip { min-height: 30px; padding: 3px 10px; font-size: .8125rem; }

.discover-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2) var(--space-3);
  margin-bottom: calc(-1 * var(--space-2));
}
.discover-count { font-weight: 750; font-size: 1.0625rem; }
.discover-count .muted { font-weight: 500; }
.pane-toggle { display: none; padding: 3px; background: var(--sand); border: 1px solid var(--line); border-radius: 999px; gap: 2px; }
.pane-toggle .btn { min-height: 32px; border-color: transparent; background: transparent; }
.pane-toggle .btn[aria-pressed="true"] { background: var(--surface); color: var(--ink); border-color: var(--line); box-shadow: var(--shadow); }

.discover-grid {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: var(--space-5);
  align-items: start;
}
.discover-list-col, .discover-map-col { min-width: 0; }
.discover-map-col {
  position: sticky;
  top: calc(var(--header-h) + var(--space-3));
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}
.discover-map {
  position: relative;
  isolation: isolate;          /* keeps Leaflet's z-indexes inside the map */
  min-height: 420px;
  height: max(420px, calc(100vh - var(--header-h) - 220px));
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--sand);
  box-shadow: var(--shadow);
}
.discover-map-fallback {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: var(--space-5);
  text-align: center;
  color: var(--muted);
}

@media (max-width: 899px) {
  .discover-grid { grid-template-columns: minmax(0, 1fr); }
  .discover-map-col { position: static; }
  .discover-bar {
    position: sticky;
    top: var(--header-h);
    z-index: 1050;
    margin: 0 calc(-1 * var(--space-3)) calc(-1 * var(--space-3));
    padding: var(--space-2) var(--space-3);
    background: rgba(251, 247, 240, .94);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    border-bottom: 1px solid var(--line);
  }
  .pane-toggle { display: inline-flex; }
  .discover-map { height: max(420px, calc(100vh - var(--header-h) - 200px)); }
}

.discover-list { display: flex; flex-direction: column; gap: var(--space-3); }
.discover-list .card { scroll-margin-top: calc(var(--header-h) + 64px); scroll-margin-bottom: var(--space-5); }
.list-section-head { display: flex; align-items: baseline; gap: var(--space-2); margin-top: var(--space-3); }
.list-section-head .muted { font-size: .875rem; }

/* community card anatomy */
.community-card { cursor: pointer; }
.community-card:hover { border-color: #D6CCBA; box-shadow: var(--shadow-lift); }
.card.is-active, .card.is-active:hover {
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent), var(--shadow-lift);
}
.card-head { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--space-2); }
.card-title { flex: 1 1 200px; min-width: 0; font-size: 1.0625rem; overflow-wrap: anywhere; }
.card-title-btn {
  padding: 0;
  border: 0;
  background: none;
  color: var(--ink);
  font: inherit;
  font-weight: 750;
  text-align: left;
  cursor: pointer;
  overflow-wrap: anywhere;
}
.card-title-btn:hover { color: var(--accent-strong); text-decoration: underline; text-underline-offset: 3px; }
.card-badges { gap: 6px; }
.card-summary { color: #3A3F45; }
.card-matches { font-size: .9375rem; }
.card-matches strong { color: var(--accent-2-ink); }
/* One wrapping meta row: grows · cadence · cost · beginner · place */
.card-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 2px 0;
  margin: 0;
  padding: 0;
  list-style: none;
  font-size: .875rem;
  color: var(--muted);
}
.card-meta li { display: inline-flex; align-items: baseline; gap: 4px; }
.card-meta li + li::before { content: "·"; margin: 0 8px; color: #B9B1A3; }
.card-meta li.is-match { color: var(--ink); font-weight: 700; }
.card-foot {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-2);
  padding-top: var(--space-2);
  border-top: 1px dashed var(--line);
}
.card-source { font-size: .8125rem; color: var(--muted); }
.card-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.card-why { font-size: .875rem; }
.card-why summary {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--accent-2-ink);
  font-weight: 700;
  border-radius: var(--radius-sm);
  list-style: none;
}
.card-why summary::-webkit-details-marker { display: none; }
.card-why summary::before { content: "▸"; display: inline-block; transition: transform .15s ease; }
.card-why[open] summary::before { transform: rotate(90deg); }
.card-why ul { margin: var(--space-2) 0 0; padding-left: 1.2em; color: #3A3F45; }
.card-why li + li { margin-top: 2px; }
.card-why .score { margin-top: var(--space-1); color: var(--muted); }
.card-why .card-prov { margin-top: var(--space-2); padding-top: var(--space-2); border-top: 1px dashed var(--line); color: var(--muted); }

/* "Nothing nearby matches …" notice above the list */
.discover-notice {
  padding: var(--space-3) var(--space-4);
  border: 1px solid var(--amber);
  border-radius: var(--radius);
  background: var(--amber-bg);
  color: var(--amber-ink);
}
.discover-notice strong { color: var(--ink); }
.discover-notice a { color: var(--amber-ink); font-weight: 700; }
.link-btn {
  display: inline;
  padding: 0;
  border: 0;
  background: none;
  color: inherit;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  text-underline-offset: 2px;
  cursor: pointer;
}
.link-btn:hover { color: var(--ink); }

/* Online mode: the map gives way to this note */
.discover-map-note {
  padding: var(--space-4);
  border: 2px dashed var(--line);
  border-radius: var(--radius);
  background: rgba(255, 255, 255, .5);
  color: var(--muted);
  text-align: center;
}

/* seed card */
.seed-card { background: linear-gradient(180deg, #FBFEF6, var(--surface) 60%); border-style: dashed; border-color: #CFE3B8; }
.seed-card .seed-sprout { margin-right: 4px; }
.seed-count { font-weight: 700; font-size: .875rem; }

/* online rail */
.discover-online { min-width: 0; }
.rail-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-2); margin-bottom: 6px; }
.rail-head h2 { font-size: .9375rem; }
.rail-head .muted { font-size: .8125rem; }
.rail {
  display: flex;
  gap: var(--space-2);
  overflow-x: auto;
  list-style: none;
  padding: 2px 2px var(--space-2);
  scroll-snap-type: x proximity;
  scrollbar-width: thin;
}
.rail-item {
  flex: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  max-width: 320px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  scroll-snap-align: start;
}
.rail-item .badge { flex: none; font-size: .6875rem; padding: 0 7px; }
.rail-item.is-active { border-color: var(--accent); box-shadow: 0 0 0 1px var(--accent); }
.rail-name {
  min-width: 0;
  padding: 6px 4px 6px 12px;
  border: 0;
  background: none;
  font-weight: 650;
  font-size: .875rem;
  cursor: pointer;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-radius: 999px 0 0 999px;
}
.rail-link {
  flex: none;
  display: inline-grid;
  place-items: center;
  width: 32px; height: 32px;
  margin-right: 2px;
  border-radius: 50%;
  text-decoration: none;
  font-weight: 800;
  color: var(--accent-strong);
}
.rail-link:hover { background: var(--accent-soft); }

/* ========================================================= STRETCH (4.3) */
.stretch-grid {
  display: grid;
  gap: var(--space-4);
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 330px), 1fr));
  align-items: start;
}
.stretch-item {
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-4);
  background: var(--sand);
  border: 1px solid var(--line);
  border-radius: calc(var(--radius) + 4px);
  min-width: 0;
}
.stretch-why { font-size: 1rem; }
.stretch-from { font-size: .8125rem; color: var(--muted-strong); }
.stretch-item .muted, .stretch-more .muted { color: var(--muted-strong); }
.stretch-item .card { box-shadow: none; }
.stretch-item .community-card { cursor: auto; }
.stretch-item .community-card:hover { box-shadow: none; border-color: var(--line); }
.stretch-none { font-size: .9375rem; color: var(--muted); padding: var(--space-3); border: 1px dashed var(--line); border-radius: var(--radius); background: var(--surface); }
.stretch-actions { display: flex; flex-wrap: wrap; gap: var(--space-2); }
.stretch-more { display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-3); }

/* ---------------------------------------------------------- reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: .01ms !important;
    scroll-behavior: auto !important;
  }
  .chip.is-bouncing, .brand:hover .brand-mark { animation: none !important; }
}
