/* Maranyane: Facebook's frame (white bar, grey canvas, white cards, left menu)
   around Craigslist's content (a directory and dense text rows).
   Signature: the Botswana flag band under the top bar. No emojis. */
:root {
  --canvas: #f0f2f5;
  --card: #ffffff;
  --line: #dadde1;
  --ink: #1c1e21;
  --muted: #65676b;
  --blue: #1d5fa0;          /* links + buttons */
  --blue-hover: #174d83;
  --flag-blue: #75aadb;     /* Botswana flag blue: band only */
  --visited: #6a3d9a;       /* Craigslist-style visited links */
  --hover-bg: #e4e6eb;
  --featured-bg: #fff4d6;
  --featured-ink: #7a5200;
  --urgent: #c4320a;
  --ok: #1e7e45;
  --danger: #b42318;
  --radius: 8px;
  --display: "Archivo", system-ui, sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root {
    --canvas: #18191a; --card: #242526; --line: #3a3b3c; --ink: #e4e6eb; --muted: #b0b3b8;
    --blue: #5aa0e6; --blue-hover: #7cb4ec; --visited: #b392d8; --hover-bg: #3a3b3c;
    --featured-bg: #3d3214; --featured-ink: #f2c763;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--canvas); color: var(--ink);
  font: 15px/1.45 system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--blue); outline-offset: 2px; border-radius: 4px; }
img { max-width: 100%; display: block; }
h1, h2, h3 { font-family: var(--display); letter-spacing: -0.01em; line-height: 1.2; }
h1 { font-size: 1.5rem; font-weight: 700; margin: 0 0 4px; }
h2 { font-size: 1.05rem; font-weight: 700; margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: .85rem; }

/* ---------- Top bar + flag band ---------- */
.topbar { position: sticky; top: 0; z-index: 20; background: var(--card); box-shadow: 0 1px 2px rgba(0,0,0,.08); }
.topbar-inner { max-width: 1180px; margin: 0 auto; display: flex; align-items: center; gap: 12px; padding: 8px 16px; }
.brand { display: flex; align-items: center; gap: 8px; color: var(--ink); }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; flex: none; }
.brand-mark line { stroke: var(--ink); stroke-width: 2.4; }
.brand-mark circle { fill: var(--ink); }
.brand-mark .dot-blue { fill: var(--flag-blue); }
.brand-word { font-family: var(--display); font-weight: 800; font-stretch: 87.5%; font-size: 1.35rem; letter-spacing: -0.02em; display: none; }
.search { flex: 1; max-width: 520px; }
.search input {
  width: 100%; padding: 9px 14px; font: inherit; color: var(--ink);
  background: var(--canvas); border: 0; border-radius: 999px;
}
.flag {
  height: 12px;  /* flag stripes, compressed: blue 3.5 / white 1 / black 3 / white 1 / blue 3.5 px */
  background: linear-gradient(to bottom,
    var(--flag-blue) 0 29%, #fff 29% 37.5%, #1c1e21 37.5% 62.5%, #fff 62.5% 71%, var(--flag-blue) 71% 100%);
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 8px 14px; border-radius: 6px; border: 0; background: var(--hover-bg); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none;
}
.btn:hover { filter: brightness(.96); text-decoration: none; }
.btn-primary { background: var(--blue); color: #fff; }
.btn-primary:hover { background: var(--blue-hover); filter: none; }
.btn-contact { background: var(--ok); color: #fff; width: 100%; padding: 12px; font-size: 1.05rem; }
.btn-danger { color: var(--danger); }
.btn-small { padding: 6px 10px; font-size: .9rem; }
.btn-tiny { padding: 2px 8px; font-size: .8rem; }
.btn-wide { width: 100%; padding: 12px; font-size: 1rem; }
.post-btn { white-space: nowrap; }
.account { margin-left: auto; display: flex; align-items: center; gap: 12px; font-size: .9rem; font-weight: 600; white-space: nowrap; }
.account form { display: contents; }
.account .muted { display: none; }
@media (min-width: 640px) { .account .muted { display: inline; font-weight: 400; } }
.linklike { background: none; border: 0; padding: 0; font: inherit; color: var(--blue); cursor: pointer; }
.linklike:hover { text-decoration: underline; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: start; }
.inline-form .field { flex: 1; min-width: 200px; margin: 0; }
.inline-form input { width: 100%; padding: 9px 12px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }

/* ---------- Layout ---------- */
.layout { max-width: 1180px; margin: 0 auto; padding: 12px 12px 32px; }
.sidebar { display: none; }
.main { min-width: 0; }
.cats-mobile { display: flex; gap: 6px; overflow-x: auto; padding: 0 0 10px; scrollbar-width: none; }
.cats-mobile a {
  flex: none; padding: 6px 12px; border-radius: 999px; background: var(--card);
  border: 1px solid var(--line); color: var(--ink); font-size: .9rem; font-weight: 600;
}
.cats-mobile a.active { background: var(--blue); border-color: var(--blue); color: #fff; }

@media (min-width: 900px) {
  .brand-word { display: inline; }
  .cats-mobile { display: none; }
  .layout { display: grid; grid-template-columns: 240px minmax(0, 1fr); gap: 20px; padding-top: 16px; }
  .sidebar { display: block; position: sticky; top: 72px; align-self: start; }
  .nav-link {
    display: flex; align-items: baseline; gap: 8px; padding: 7px 10px; border-radius: 6px;
    color: var(--ink); font-weight: 600;
  }
  .nav-link:hover, .nav-link.active { background: var(--hover-bg); text-decoration: none; }
  .nav-link .count { margin-left: auto; color: var(--muted); font-weight: 400; font-size: .85rem; }
  .nav-sub { padding: 2px 10px 8px 10px; color: var(--muted); font-size: .8rem; margin-top: -6px; }
  .sidebar hr { border: 0; border-top: 1px solid var(--line); margin: 10px 4px; }
  .nav-quiet { display: block; padding: 5px 10px; color: var(--muted); font-size: .9rem; }
}

/* ---------- Location ---------- */
.loc-chip { background: var(--ink) !important; color: var(--card) !important; border-color: var(--ink) !important; }
.loc-side {
  display: grid; grid-template-columns: 1fr auto; gap: 0 8px; align-items: baseline;
  padding: 10px; margin-bottom: 10px; border-radius: var(--radius); background: var(--card);
  color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.loc-side .muted { grid-column: 1 / -1; }
.loc-side:hover { text-decoration: none; background: var(--hover-bg); }
.loc-side .small { color: var(--blue); }
.town-all { display: inline-block; font-weight: 700; margin-bottom: 12px; }
.towns { display: grid; grid-template-columns: repeat(2, 1fr); gap: 4px 24px; }
@media (min-width: 640px) { .towns { grid-template-columns: repeat(4, 1fr); } }
.towns h2 { font-size: .95rem; margin: 8px 0 4px; color: var(--muted); }
.town-list { list-style: none; margin: 0; padding: 0; }
.town-list li { padding: 3px 0; }
.town-list a.active, .town-all.active { color: var(--ink); font-weight: 700; }
.town-list a.active::before, .town-all.active::before { content: "\2713  "; color: var(--ok); }
.subcats { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.subcats a { padding: 5px 10px; border-radius: 999px; background: var(--canvas); color: var(--ink); font-size: .88rem; font-weight: 600; }
.subcats a.active { background: var(--blue); color: #fff; }
.subcats a:hover { text-decoration: none; background: var(--hover-bg); }
.subcats a.active:hover { background: var(--blue-hover); }

/* ---------- Cards ---------- */
.card {
  background: var(--card); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(0,0,0,.1);
  padding: 14px 16px; margin: 0 0 12px;
}
.card-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 6px; }
.card-head h2 { margin: 0; }

/* Composer (Facebook "What's on your mind?") */
.composer { display: flex; gap: 10px; align-items: center; }
.composer-box {
  flex: 1; padding: 10px 14px; border-radius: 999px; background: var(--canvas); color: var(--muted);
}
.composer-box:hover { background: var(--hover-bg); text-decoration: none; }

/* Craigslist-style directory */
.directory { columns: 2 150px; column-gap: 20px; }
@media (min-width: 900px) { .directory { columns: 3 180px; } }
.dir-section { break-inside: avoid; margin-bottom: 14px; }
.dir-head { display: block; font-family: var(--display); font-weight: 700; font-size: 1rem; color: var(--ink); border-bottom: 1px solid var(--line); padding-bottom: 3px; margin-bottom: 3px; }
.dir-head .count { font-family: system-ui, sans-serif; font-weight: 400; font-size: .8rem; color: var(--muted); }
.dir-tn { display: block; color: var(--muted); font-size: .78rem; margin-bottom: 2px; }
.dir-sub { display: block; padding: 1px 0; font-size: .9rem; }
.dir-sub:visited { color: var(--visited); }
@media (max-width: 639px) { .dir-sub, .dir-tn { display: none; } .dir-section { margin-bottom: 6px; } }  /* phones: section names only; sub-categories live on section pages */

/* "People are looking for" */
.wanted-list { margin: 0; padding: 0; list-style: none; }
.wanted-list li { padding: 6px 0; border-top: 1px solid var(--line); }
.wanted-list li:first-child { border-top: 0; }
.wanted-list a:visited, .row-title:visited { color: var(--visited); }

/* ---------- Listing rows (the core of the site) ---------- */
.rows { margin: 0; padding: 0; list-style: none; }
.row { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.row:first-child { border-top: 0; padding-top: 2px; }
.row-thumb {
  flex: none; width: 72px; height: 72px; border-radius: 6px; object-fit: cover; background: var(--canvas);
}
.row-thumb-empty {
  display: grid; place-items: center; font-family: var(--display); font-weight: 700;
  font-size: 1.4rem; color: var(--muted);
}
.row-body { min-width: 0; flex: 1; }
.row-title { font-weight: 600; font-size: 1rem; overflow-wrap: anywhere; }
.row-price { font-weight: 700; margin: 1px 0; }
.row-meta { color: var(--muted); font-size: .85rem; }
.row-featured { background: var(--featured-bg); margin: 0 -16px; padding-left: 16px; padding-right: 16px; border-top-color: transparent; }
.row-featured + .row { border-top-color: transparent; }
@media (min-width: 640px) { .row-thumb { width: 96px; height: 72px; } }

.badge {
  display: inline-block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em;
  padding: 1px 6px; border-radius: 4px; margin-right: 4px; vertical-align: 1px;
}
.badge-featured { background: var(--featured-ink); color: var(--card); }
.badge-urgent { color: var(--urgent); border: 1px solid currentColor; }
.badge-wanted { color: var(--blue); border: 1px solid currentColor; }
.badge-sold { background: var(--muted); color: var(--card); }

/* ---------- Detail ---------- */
.detail { display: grid; gap: 12px; grid-template-areas: "photo" "info" "desc"; }
.d-photo { grid-area: photo; } .d-info { grid-area: info; } .d-desc { grid-area: desc; margin: 0; }
.d-info .card { margin-bottom: 12px; }
@media (min-width: 900px) {
  .detail { grid-template-columns: minmax(0, 1.4fr) minmax(280px, 1fr); grid-template-areas: "photo info" "desc info"; align-items: start; }
}
.detail-photo { width: 100%; max-height: 560px; object-fit: contain; background: #000; border-radius: var(--radius); }
.detail-price { font-size: 1.4rem; font-weight: 700; margin: 2px 0 6px; }
.detail-desc { overflow-wrap: anywhere; }
.detail-desc p { margin: 0 0 .8em; }
.crumbs { font-size: .85rem; margin-bottom: 8px; }
.share { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.share form { display: contents; }
.notice { padding: 10px 12px; border-radius: 6px; background: var(--canvas); font-size: .9rem; margin-top: 12px; }
.report summary { cursor: pointer; color: var(--muted); font-size: .9rem; }
.report form { display: grid; gap: 8px; margin-top: 8px; }
.report ul { list-style: none; padding: 0; margin: 0; display: grid; grid-template-columns: 1fr 1fr; gap: 2px 10px; }
.report input[type=text] { padding: 8px 10px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }

/* ---------- Forms ---------- */
.form fieldset { border: 0; padding: 0; margin: 0 0 8px; }
.form legend { font-family: var(--display); font-weight: 700; font-size: 1.05rem; margin-bottom: 8px; }
.field { display: grid; gap: 4px; margin-bottom: 14px; }
.field label { font-weight: 600; }
.field input:not([type=checkbox]):not([type=radio]), .field select, .field textarea {
  width: 100%; padding: 10px 12px; font: inherit; color: var(--ink);
  background: var(--card); border: 1px solid var(--line); border-radius: 6px;
}
.field textarea { resize: vertical; }
.field-check { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.field-check small { flex-basis: 100%; }
.field ul { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.field-error input, .field-error select, .field-error textarea { border-color: var(--danger); }
.error { color: var(--danger); }
.hp { position: absolute; left: -9999px; }

/* ---------- Messages ---------- */
.flash { padding: 10px 14px; border-radius: var(--radius); margin-bottom: 12px; background: var(--card); border-left: 4px solid var(--blue); box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.flash-success { border-color: var(--ok); }
.flash-error { border-color: var(--danger); }

/* ---------- Manage + checkout ---------- */
.stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 12px; }
.stat { background: var(--card); border-radius: var(--radius); padding: 10px; text-align: center; box-shadow: 0 1px 2px rgba(0,0,0,.1); }
.stat strong { display: block; font-family: var(--display); font-size: 1.5rem; }
.stat span { color: var(--muted); font-size: .85rem; }
.promo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 8px; }
.promo { display: grid; gap: 6px; align-content: start; padding: 12px; border: 1px solid var(--line); border-radius: 6px; }
.pay-methods { display: grid; gap: 6px; margin-bottom: 10px; }
.pay-method { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: center; gap: 6px; padding: 10px; border: 1px solid var(--line); border-radius: 6px; }
.plain { padding-left: 18px; margin: 0; }
.search-inline { display: grid; gap: 8px; margin-top: 10px; }
.search-inline input { padding: 9px 12px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--card); color: var(--ink); }
@media (min-width: 640px) { .search-inline { grid-template-columns: 1fr auto; } }

.empty { text-align: center; padding: 28px 16px; }
.pager { display: flex; justify-content: center; align-items: center; gap: 12px; margin: 14px 0 4px; }
.prose { max-width: 720px; }
.prose li { margin-bottom: 6px; }
.footer { text-align: center; padding: 8px 16px 40px; color: var(--muted); font-size: .85rem; }
.footer p { margin: 4px 0; }
.footer a { color: var(--muted); }

/* ---------- Accounts + forums ---------- */
.narrow { max-width: 460px; margin-left: auto; margin-right: auto; }
.board-row { align-items: center; }
.board-stats { flex: none; text-align: right; font-size: .85rem; color: var(--muted); min-width: 90px; }
.board-stats strong { color: var(--ink); }
.board-stats span { display: block; font-size: .78rem; }
.post-meta { margin: 0 0 6px; font-size: .88rem; color: var(--muted); }
.post-meta strong { color: var(--ink); }
.post-body { overflow-wrap: anywhere; }
.post-body p { margin: 0 0 .7em; }
.reply { padding: 12px 0; border-top: 1px solid var(--line); }
.reply:first-of-type { border-top: 0; padding-top: 0; }
.reply:target { background: var(--featured-bg); margin: 0 -16px; padding-left: 16px; padding-right: 16px; }
.report input[type=text] { flex: 1; }

/* ---------- Staff: invites ---------- */
.dm-box { width: 100%; padding: 10px 12px; font: inherit; border: 1px solid var(--line); border-radius: 6px; background: var(--canvas); color: var(--ink); resize: vertical; }
.stats-4 { grid-template-columns: repeat(2, 1fr); }
@media (min-width: 640px) { .stats-4 { grid-template-columns: repeat(4, 1fr); } }

/* ---------- Staff: Today ---------- */
.count-pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; background: var(--urgent); color: #fff; font: 700 .75rem/1.5 system-ui, sans-serif; text-align: center; vertical-align: 2px; }
.todo { display: flex; gap: 12px; align-items: flex-start; justify-content: space-between; padding: 10px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.todo:first-of-type { border-top: 0; }
.todo-body { flex: 1; min-width: 220px; }
.todo-text { font-size: .88rem; margin-top: 4px; overflow-wrap: anywhere; }
.todo-actions { display: flex; gap: 6px; flex: none; }

/* ---------- Photo gallery: native scroll-snap, swipe on phones, no JS ---------- */
.gallery { display: flex; gap: 8px; overflow-x: auto; scroll-snap-type: x mandatory; border-radius: var(--radius); scrollbar-width: thin; }
.gallery .detail-photo { flex: 0 0 100%; scroll-snap-align: center; margin: 0; }
.gallery-hint { margin: 4px 0 0; }
