/* Barterstead: warm, earthy, farm-stand-chalkboard feel. Sage + soil + sunflower on cream. */
:root {
  --cream: #faf6ee;
  --paper: #ffffff;
  --ink: #2a2a24;
  --muted: #6b6a5e;
  --line: #e6dfd0;
  --sage: #2f5d3a;
  --sage-deep: #234a2c;
  --sage-soft: #e6efe3;
  --sun: #f3c64b;
  --sun-soft: #fdf3d4;
  --clay: #c0643b;
  --clay-soft: #f8e4da;
  --radius: 14px;
  --shadow: 0 1px 2px rgba(42,42,36,.06), 0 4px 16px rgba(42,42,36,.06);
  --display: "Fraunces", Georgia, serif;
  --body: "Inter", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: var(--body); font-size: 16px; line-height: 1.55; color: var(--ink); background: var(--cream); -webkit-font-smoothing: antialiased; }
h1, h2, h3 { font-family: var(--display); font-weight: 700; line-height: 1.15; letter-spacing: -.01em; margin: 0 0 .5rem; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); }
h2 { font-size: 1.4rem; }
h3 { font-size: 1.1rem; }
p { margin: 0 0 1rem; }
a { color: var(--sage); }
.wrap { max-width: 1040px; margin: 0 auto; padding: 0 16px; }
.main { padding-top: 24px; padding-bottom: 64px; min-height: 70vh; }
.muted { color: var(--muted); }
.small { font-size: .875rem; }
.stack > * + * { margin-top: 1rem; }
.row { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.row--between { justify-content: space-between; }
.inline { display: inline; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* top bar */
.topbar { background: var(--paper); border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 10; }
.topbar__inner { display: flex; align-items: center; justify-content: space-between; height: 60px; gap: 12px; }
.brand { display: flex; align-items: center; gap: 8px; font-family: var(--display); font-weight: 700; font-size: 1.25rem; color: var(--ink); text-decoration: none; }
.brand__mark { width: 30px; height: 30px; }
.nav { display: flex; align-items: center; gap: 14px; }
.nav__link { color: var(--ink); text-decoration: none; font-weight: 500; }
.nav__link:hover { color: var(--sage); }
.nav__me { text-decoration: none; }
.pill { display: inline-block; background: var(--clay); color: #fff; border-radius: 99px; font-size: .75rem; padding: 0 7px; line-height: 1.5; font-weight: 600; }
@media (max-width: 480px) { .brand span { display: none; } .nav { gap: 10px; } }

/* buttons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; background: var(--sage); color: #fff; border: 0; border-radius: 99px; padding: 11px 20px; font: 600 1rem var(--body); text-decoration: none; cursor: pointer; transition: background .15s; }
.btn:hover { background: var(--sage-deep); }
.btn--small { padding: 7px 14px; font-size: .9rem; }
.btn--ghost { background: transparent; color: var(--sage); box-shadow: inset 0 0 0 1.5px var(--sage); }
.btn--ghost:hover { background: var(--sage-soft); }
.btn--sun { background: var(--sun); color: var(--ink); }
.btn--sun:hover { background: #e8b72f; }
.btn--danger { background: transparent; color: var(--clay); box-shadow: inset 0 0 0 1.5px var(--clay); }
.btn--danger:hover { background: var(--clay-soft); }
.btn--block { width: 100%; }
.linklike { background: none; border: 0; padding: 0; color: var(--sage); font: inherit; cursor: pointer; text-decoration: underline; }
form.button_to { display: inline; }

/* flash */
.flash { padding: 12px 16px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 500; }
.flash--notice { background: var(--sage-soft); color: var(--sage-deep); }
.flash--confirm { background: var(--sun-soft); color: var(--ink); font-weight: 400; }
.flash--alert { background: var(--clay-soft); color: #8a3d1b; }

/* cards */
.card { background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.grid { display: grid; gap: 16px; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); }
.listing-card { display: flex; flex-direction: column; gap: 10px; text-decoration: none; color: inherit; transition: transform .12s, box-shadow .12s; }
.listing-card:hover { transform: translateY(-2px); box-shadow: 0 2px 4px rgba(42,42,36,.08), 0 10px 28px rgba(42,42,36,.10); }
.listing-card__title { font-family: var(--display); font-size: 1.15rem; font-weight: 700; margin: 0; }
.listing-card__meta { display: flex; align-items: center; gap: 8px; font-size: .875rem; color: var(--muted); margin-top: auto; }
.kind { display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; padding: 2px 8px; border-radius: 6px; }
.kind--offer { background: var(--sage-soft); color: var(--sage-deep); }
.kind--request { background: var(--sun-soft); color: #7a5a00; }
.cat { font-size: .8rem; color: var(--muted); }
.chip { display: inline-block; background: #f1ece1; color: var(--ink); font-size: .8rem; padding: 3px 10px; border-radius: 99px; margin: 0 4px 4px 0; }
.chip--match { background: var(--sun); font-weight: 600; }
.badge { display: inline-block; font-size: .75rem; font-weight: 600; padding: 3px 10px; border-radius: 99px; }
.badge--pending { background: var(--sun-soft); color: #7a5a00; }
.badge--accepted { background: var(--sage-soft); color: var(--sage-deep); }
.badge--completed { background: var(--sage); color: #fff; }
.badge--move { background: var(--clay); color: #fff; }
.badge--declined, .badge--cancelled { background: #eee; color: var(--muted); }

/* avatar */
.avatar { display: inline-flex; align-items: center; justify-content: center; border-radius: 50%; font-weight: 600; color: #fff; background: hsl(var(--hue) 35% 42%); flex-shrink: 0; }
.avatar--sm { width: 30px; height: 30px; font-size: .75rem; }
.avatar--md { width: 40px; height: 40px; font-size: .9rem; }
.avatar--lg { width: 72px; height: 72px; font-size: 1.5rem; }

/* hero */
.hero { display: grid; gap: 28px; grid-template-columns: 1.2fr 1fr; align-items: center; padding: 24px 0 40px; }
.hero__lede { font-size: 1.15rem; color: var(--muted); max-width: 34rem; }
.hero__art { background: var(--sage); color: var(--cream); border-radius: 22px; padding: 28px; font-family: var(--display); font-size: 1.15rem; line-height: 1.5; box-shadow: var(--shadow); }
.hero__art p { margin: 0 0 12px; }
.hero__art .swap { color: var(--sun); font-weight: 700; }
.stats { display: flex; gap: 24px; margin-top: 18px; color: var(--muted); font-size: .9rem; }
.stats strong { display: block; font-family: var(--display); color: var(--ink); font-size: 1.5rem; }
.steps { display: grid; gap: 16px; grid-template-columns: repeat(3, 1fr); margin: 8px 0 40px; }
.step__n { display: inline-flex; width: 30px; height: 30px; border-radius: 50%; background: var(--sun); align-items: center; justify-content: center; font-weight: 700; margin-bottom: 8px; }
@media (max-width: 760px) { .hero, .steps { grid-template-columns: 1fr; } }

/* forms */
.form { max-width: 620px; }
.form--narrow { max-width: 420px; margin: 0 auto; }
.field { margin-bottom: 18px; }
.field label, .field__label { display: block; font-weight: 600; margin-bottom: 6px; }
.field__hint { font-size: .85rem; color: var(--muted); margin: -2px 0 8px; }
input[type=text], input[type=email], input[type=password], input[type=number], input[type=search], input[type=datetime-local], textarea, select {
  width: 100%; font: inherit; padding: 11px 13px; border: 1.5px solid var(--line); border-radius: 10px; background: var(--paper); color: var(--ink);
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--sage); box-shadow: 0 0 0 3px var(--sage-soft); }
textarea { min-height: 110px; resize: vertical; }
.checks { display: flex; flex-wrap: wrap; gap: 8px; }
.check { display: inline-flex; align-items: center; gap: 0; cursor: pointer; }
.check input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.check span { display: inline-block; padding: 8px 14px; border: 1.5px solid var(--line); border-radius: 99px; background: var(--paper); font-weight: 500; font-size: .92rem; user-select: none; }
.check input:checked + span { background: var(--sage); border-color: var(--sage); color: #fff; }
.check input:focus-visible + span { box-shadow: 0 0 0 3px var(--sage-soft); }
.segmented { display: inline-flex; border: 1.5px solid var(--line); border-radius: 99px; overflow: hidden; background: var(--paper); }
.segmented label { margin: 0; }
.segmented input { position: absolute; opacity: 0; }
.segmented span { display: inline-block; padding: 9px 18px; font-weight: 600; cursor: pointer; }
.segmented input:checked + span { background: var(--sage); color: #fff; }
.money-input { position: relative; max-width: 200px; }
.money-input::before { content: "$"; position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--muted); }
.money-input input { padding-left: 26px; }
.errors { background: var(--clay-soft); color: #8a3d1b; border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; }
.errors ul { margin: 0; padding-left: 18px; }

/* filters */
.filters { display: grid; grid-template-columns: 2fr 1fr 1fr 1fr auto; gap: 10px; margin-bottom: 22px; }
@media (max-width: 760px) { .filters { grid-template-columns: 1fr 1fr; } .filters .q { grid-column: 1 / -1; } }

/* listing detail */
.detail { display: grid; grid-template-columns: 1.6fr 1fr; gap: 24px; align-items: start; }
@media (max-width: 760px) { .detail { grid-template-columns: 1fr; } }
.desc { white-space: pre-line; }
.person { display: flex; gap: 12px; align-items: center; text-decoration: none; color: inherit; }
.person__name { font-weight: 600; }
.match-note { background: var(--sun-soft); border-radius: 10px; padding: 10px 14px; font-size: .92rem; }

/* trades */
.trade-row { display: flex; gap: 14px; align-items: center; text-decoration: none; color: inherit; padding: 14px 0; border-bottom: 1px solid var(--line); }
.trade-row:last-child { border-bottom: 0; }
.trade-row__body { flex: 1; min-width: 0; }
.trade-row__title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.thread { display: flex; flex-direction: column; gap: 10px; margin: 12px 0; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; background: #f1ece1; white-space: pre-line; }
.bubble--me { align-self: flex-end; background: var(--sage); color: #fff; }
.bubble__meta { font-size: .72rem; opacity: .7; margin-top: 2px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { padding: 6px 0 6px 26px; position: relative; color: var(--muted); }
.timeline li::before { content: ""; position: absolute; left: 6px; top: 13px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--sage); }
.timeline li.now { color: var(--ink); font-weight: 600; }
.timeline li.now::before { background: var(--sun); box-shadow: 0 0 0 3px var(--sun-soft); }
.kudos-pick { display: flex; gap: 8px; }
.kudos-pick input { position: absolute; opacity: 0; }
.kudos-pick span { display: inline-block; padding: 8px 14px; border-radius: 99px; border: 1.5px solid var(--line); cursor: pointer; font-weight: 600; background: var(--paper); }
.kudos-pick input:checked + span { background: var(--sun); border-color: var(--sun); }

/* profile */
.profile-head { display: flex; gap: 18px; align-items: center; margin-bottom: 20px; }
.kudo { padding: 12px 0; border-bottom: 1px solid var(--line); }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.footer { border-top: 1px solid var(--line); background: var(--paper); font-size: .875rem; color: var(--muted); }
.footer__inner { display: flex; justify-content: space-between; gap: 12px; padding: 18px 16px; flex-wrap: wrap; }
