/* Give & Trade. Paper and ink, three colors that mean something:
   green = free, amber = trade, blue = looking for. */
:root {
  --paper: #faf6ee; --card: #ffffff; --ink: #1f1c17; --muted: #6b645a; --line: #e6dfd2;
  --give: #1f8a4c; --give-soft: #e3f3e8; --trade: #b86e00; --trade-soft: #fbefd9;
  --want: #2f5fb3; --want-soft: #e4ecfa; --accent: #1f1c17; --danger: #b3261e;
  --radius: 14px; --shadow: 0 1px 2px rgba(31, 28, 23, .06), 0 6px 18px rgba(31, 28, 23, .06);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #16140f; --card: #211e18; --ink: #f2ede3; --muted: #a59d90; --line: #36312a;
    --give: #4fc07d; --give-soft: #1b2e22; --trade: #f0a53a; --trade-soft: #33270f;
    --want: #7ea3ec; --want-soft: #1c2638; --accent: #f2ede3; --danger: #ff8a80;
    --shadow: none; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 16px/1.5 "Atkinson Hyperlegible", system-ui, -apple-system, "Segoe UI", sans-serif;
}
a { color: inherit; }
img { max-width: 100%; display: block; }
.wrap { max-width: 1080px; margin: 0 auto; padding-inline: max(16px, env(safe-area-inset-left)); }

/* header */
.top { border-bottom: 1px solid var(--line); background: var(--paper); position: sticky; top: 0; z-index: 5; }
.top .wrap { display: flex; align-items: center; gap: 12px; min-height: 60px; flex-wrap: wrap; }
.brand { font: 800 1.35rem/1 "Bricolage Grotesque", system-ui, sans-serif; text-decoration: none; letter-spacing: -.02em; }
.brand .amp { color: var(--trade); }
.top nav { margin-left: auto; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.top nav a, .linkbtn { text-decoration: none; padding: 8px 10px; border-radius: 10px; color: var(--muted); font-weight: 600; }
.top nav a:hover { color: var(--ink); background: var(--card); }
.badge { background: var(--danger); color: #fff; border-radius: 99px; font-size: .75rem; padding: 1px 7px; margin-left: 2px; }
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px; cursor: pointer;
  border: 0; border-radius: 12px; padding: 12px 18px; font: inherit; font-weight: 700; text-decoration: none;
  background: var(--accent); color: var(--paper); min-height: 44px;
}
.btn.ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); }
.btn.give { background: var(--give); color: #fff; }
.btn.small { padding: 8px 12px; min-height: 36px; font-size: .9rem; }
.btn:disabled { opacity: .5; }

/* hero + filters */
.hero { padding: 28px 0 8px; }
.hero h1 { font: 800 clamp(1.8rem, 5vw, 2.8rem)/1.05 "Bricolage Grotesque", system-ui, sans-serif; margin: 0 0 8px; letter-spacing: -.03em; text-wrap: balance; }
.hero p { margin: 0 0 16px; color: var(--muted); max-width: 60ch; }
.filters { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0 20px; }
.chip { text-decoration: none; border: 1px solid var(--line); background: var(--card); border-radius: 99px; padding: 7px 14px; font-weight: 600; font-size: .92rem; }
.chip.on { background: var(--ink); color: var(--paper); border-color: var(--ink); }
.search { flex: 1 1 220px; display: flex; gap: 8px; }
.search input { flex: 1; min-width: 0; }
input[type=text], input[type=email], input[type=search], textarea, select {
  width: 100%; font: inherit; color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 12px; padding: 11px 13px;
}
textarea { resize: vertical; }

/* cards */
.grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(230px, 1fr)); gap: 16px; padding-bottom: 40px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; text-decoration: none; display: flex; flex-direction: column; box-shadow: var(--shadow); min-width: 0; }
.card .pic { aspect-ratio: 4 / 3; background: var(--line); display: grid; place-items: center; overflow: hidden; }
.card .pic img { width: 100%; height: 100%; object-fit: cover; }
.card .pic .none { font-size: 2.2rem; opacity: .5; }
.card .txt { padding: 12px 14px 14px; display: grid; gap: 4px; }
.card h3 { margin: 0; font-size: 1.02rem; line-height: 1.3; overflow-wrap: anywhere; }
.meta { color: var(--muted); font-size: .86rem; }
.kind { justify-self: start; font-size: .75rem; font-weight: 800; letter-spacing: .04em; text-transform: uppercase; border-radius: 6px; padding: 2px 7px; }
.kind.give { background: var(--give-soft); color: var(--give); }
.kind.trade { background: var(--trade-soft); color: var(--trade); }
.kind.want { background: var(--want-soft); color: var(--want); }
.empty { text-align: center; padding: 48px 16px; color: var(--muted); }

/* panels and forms */
.page { padding: 24px 0 48px; }
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); }
.narrow { max-width: 560px; margin: 0 auto; }
.stack { display: grid; gap: 16px; }
.field label, .field > span { display: block; font-weight: 700; margin-bottom: 6px; }
.field .help { color: var(--muted); font-size: .88rem; margin-top: 4px; }
.errorlist { color: var(--danger); margin: 4px 0 0; padding: 0; list-style: none; font-size: .9rem; }
.kinds { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 8px; }
.kinds label { border: 2px solid var(--line); border-radius: 12px; padding: 12px; cursor: pointer; font-weight: 700; display: flex; gap: 8px; align-items: center; }
.kinds input { accent-color: var(--ink); }
.kinds label:has(input:checked) { border-color: var(--ink); }
.flash { padding: 12px 14px; border-radius: 12px; margin: 16px 0 0; background: var(--give-soft); color: var(--ink); }
.flash.error { background: #fde8e6; color: #5c1410; }
.steps { counter-reset: s; list-style: none; padding: 0; margin: 0; display: grid; gap: 10px; }
.steps li { counter-increment: s; display: flex; gap: 12px; align-items: flex-start; }
.steps li::before { content: counter(s); flex: 0 0 28px; height: 28px; border-radius: 50%; background: var(--ink); color: var(--paper); display: grid; place-items: center; font-weight: 800; }

/* listing page */
.item { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 24px; align-items: start; }
@media (max-width: 760px) { .item { grid-template-columns: 1fr; } }
.item .photo { border-radius: var(--radius); overflow: hidden; background: var(--line); }
.item h1 { font: 800 1.8rem/1.15 "Bricolage Grotesque", system-ui, sans-serif; margin: 6px 0; text-wrap: balance; overflow-wrap: anywhere; }
.item .body { white-space: pre-line; overflow-wrap: anywhere; }
.tags { display: flex; flex-wrap: wrap; gap: 6px; }
.tags a { font-size: .85rem; color: var(--muted); text-decoration: none; border: 1px solid var(--line); padding: 2px 9px; border-radius: 99px; }

/* messages */
.thread { display: grid; gap: 10px; margin: 16px 0; }
.bubble { max-width: 80%; padding: 10px 14px; border-radius: 16px; background: var(--card); border: 1px solid var(--line); white-space: pre-line; overflow-wrap: anywhere; }
.bubble.me { justify-self: end; background: var(--ink); color: var(--paper); border-color: var(--ink); }
.bubble small { display: block; opacity: .65; font-size: .75rem; margin-top: 4px; }
.rows { display: grid; gap: 8px; }
.row { display: flex; gap: 12px; align-items: center; text-decoration: none; padding: 12px 14px; background: var(--card); border: 1px solid var(--line); border-radius: 12px; min-width: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .grow div { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dot { width: 10px; height: 10px; border-radius: 50%; background: var(--danger); flex: 0 0 10px; }

footer { border-top: 1px solid var(--line); color: var(--muted); font-size: .88rem; padding: 20px 0 40px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
