#013 style light mobile: high Raw-Web & Utilitarian

Craigslist Utilitarian Hypertext

Hyper-dense utilitarian classifieds matrix with classic blue/purple links, instant search, and zero visual fluff.

Inspired by Craigslist ↗

Download .html
Fullscreen ↗

WHY THIS AESTHETIC IS UNIQUE

Proves that raw information density and instant scanability outlast every design trend: a three-region utilitarian frame with scannable category columns, classic browser-blue links, and zero wasted pixels.

BEST FOR

Community classifieds & job boardsDense internal knowledge directoriesMarketplace link hubs & swap meetsLow-bandwidth civic portals

TAGS

COLOR PALETTE (CLICK TO COPY HEX)

TYPOGRAPHY

Display
Georgia, Times New Roman, serif
Body
Arial, Helvetica, -apple-system, sans-serif
Mono
Courier New, ui-monospace, monospace
Scale
Zero webfont overhead: classic serif masthead with crisp 13-14px system sans directory links and monospace posting dates.

ARCHITECTURE & MOBILE NOTES

LAYOUT

Left utilitarian search-and-calendar rail, central multi-column category matrix with #F4F4F4 boxed headers, and right region/city switcher column.

INTERACTION

Real-time keyword search filtering live classifieds listings, city/region switcher updating local header and posts, and a no-nonsense modal posting viewer with reply/flag toggles.

MOBILE

Three-pane desktop layout collapses into a top search bar, compact region picker, and collapsible category accordions with >=44px tap links at 390px.

AI AGENT GUARDRAILS

DO

  • Prioritize maximum scannable link density and sub-second system font rendering
  • Use #0000EE unvisited and #551A8B visited link semantics
  • Keep surfaces strictly flat (#FFFFFF and #F4F4F4) with 1px #CCCCCC rules

DON'T

  • Do not add hero banners, stock photography, or decorative animations
  • Do not hide top-level categories behind mega-menus on desktop
STANDALONE SOURCE · demos/craigslist-hypertext.html (35.6 KB)
<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1">
  <title>baylist: classifieds for housing, for sale, gigs, community &amp; services</title>
  <style>
    :root {
      --canvas: #FFFFFF;
      --surface: #F4F4F4;
      --ink: #1A1A1A;
      --accent: #0000EE;
      --visited: #551A8B;
      --muted: #666666;
      --line: #CCCCCC;
      --line-soft: #E4E4E4;
      --font-ui: Arial, Helvetica, sans-serif;
      --font-serif: Georgia, 'Times New Roman', serif;
      --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
    }

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

    html, body {
      margin: 0;
      padding: 0;
      background: var(--canvas);
      color: var(--ink);
      font-family: var(--font-ui);
      font-size: 14px;
      line-height: 1.4;
      overflow-x: hidden;
    }

    a {
      color: var(--accent);
      text-decoration: none;
    }

    a:hover {
      text-decoration: underline;
    }

    a:visited {
      color: var(--visited);
    }

    /* Page Shell */
    .page-shell {
      max-width: 1120px;
      margin: 0 auto;
      padding: 0.75rem 1rem 2.5rem;
      display: grid;
      grid-template-columns: 205px minmax(0, 1fr) 155px;
      gap: 1.25rem;
      align-items: start;
    }

    /* Left Sidebar */
    .left-rail {
      background: var(--surface);
      border: 1px solid var(--line-soft);
      padding: 0.85rem 0.75rem;
      display: flex;
      flex-direction: column;
      gap: 0.9rem;
    }

    .brand-logo {
      font-family: var(--font-serif);
      font-size: 1.85rem;
      font-weight: 400;
      color: var(--visited);
      text-align: center;
      margin: 0;
      letter-spacing: -0.02em;
    }

    .post-link {
      display: flex;
      align-items: center;
      justify-content: center;
      min-height: 44px;
      background: #FFFFCC;
      border: 1px solid #CCCC99;
      color: var(--accent) !important;
      font-weight: 700;
      font-size: 0.9rem;
      text-align: center;
    }

    .search-box label {
      display: block;
      font-size: 0.78rem;
      color: var(--muted);
      margin-bottom: 0.25rem;
      font-weight: 700;
      text-transform: lowercase;
    }

    .search-input {
      width: 100%;
      min-height: 44px;
      padding: 0.45rem 0.55rem;
      border: 1px solid #999999;
      font-family: var(--font-ui);
      font-size: 14px;
      background: var(--canvas);
      color: var(--ink);
    }

    .mini-cal {
      width: 100%;
      border-collapse: collapse;
      font-size: 0.75rem;
      text-align: center;
      background: var(--canvas);
      border: 1px solid var(--line);
    }

    .mini-cal caption {
      font-weight: 700;
      font-size: 0.78rem;
      padding: 0.25rem;
      background: var(--surface);
      border: 1px solid var(--line);
      border-bottom: none;
    }

    .mini-cal th, .mini-cal td {
      border: 1px solid var(--line-soft);
      padding: 0.18rem 0;
    }

    .mini-cal td.today {
      background: #FFFFCC;
      font-weight: 700;
    }

    .rail-links {
      list-style: none;
      margin: 0;
      padding: 0;
      font-size: 0.82rem;
      display: flex;
      flex-direction: column;
      gap: 0.3rem;
    }

    /* Center Column */
    .center-col {
      min-width: 0;
    }

    .region-banner {
      background: var(--surface);
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      padding: 0.65rem 0.85rem;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 0.65rem;
      margin-bottom: 1rem;
    }

    .region-banner h1 {
      margin: 0;
      font-family: var(--font-serif);
      font-size: 1.45rem;
      font-weight: 400;
      color: var(--ink);
    }

    .region-select-wrap {
      display: flex;
      align-items: center;
      gap: 0.45rem;
      font-size: 0.82rem;
      color: var(--muted);
    }

    .region-select {
      min-height: 44px;
      padding: 0.25rem 0.5rem;
      border: 1px solid #999999;
      background: var(--canvas);
      color: var(--ink);
      font-family: var(--font-ui);
      font-size: 0.88rem;
    }

    /* High-Density Category Matrix */
    .cat-matrix {
      display: grid;
      grid-template-columns: repeat(3, minmax(0, 1fr));
      gap: 1rem 1.25rem;
      margin-bottom: 1.5rem;
    }

    .cat-block {
      min-width: 0;
    }

    .cat-block summary {
      list-style: none;
      cursor: pointer;
      background: var(--surface);
      border-top: 1px solid var(--line);
      border-bottom: 1px solid var(--line);
      padding: 0.35rem 0.5rem;
      font-weight: 700;
      font-size: 0.92rem;
      color: var(--accent);
      display: flex;
      align-items: center;
      justify-content: space-between;
    }

    .cat-block summary::-webkit-details-marker {
      display: none;
    }

    .cat-caret {
      display: none;
      font-size: 0.75rem;
      color: var(--muted);
    }

    .subcat-list {
      list-style: none;
      margin: 0.35rem 0 0;
      padding: 0;
      columns: 2;
      column-gap: 0.6rem;
    }

    .subcat-list.single-col {
      columns: 1;
    }

    .subcat-list li {
      break-inside: avoid;
      border-bottom: 1px solid #EFEFEF;
    }

    .subcat-list button {
      width: 100%;
      text-align: left;
      background: none;
      border: none;
      padding: 0.26rem 0.15rem;
      font-family: var(--font-ui);
      font-size: 0.82rem;
      color: var(--accent);
      cursor: pointer;
    }

    .subcat-list button:hover {
      text-decoration: underline;
      background: var(--surface);
    }

    .subcat-list button.active-sub {
      font-weight: 700;
      background: #FFFFCC;
      color: var(--ink);
    }

    /* Live Listings Stream */
    .listings-section {
      border-top: 2px solid var(--line);
      padding-top: 0.9rem;
    }

    .listings-head {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      justify-content: space-between;
      gap: 0.5rem;
      margin-bottom: 0.75rem;
    }

    .listings-head h2 {
      margin: 0;
      font-size: 1rem;
      font-weight: 700;
    }

    .filter-pill-bar {
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.45rem;
    }

    .mini-btn {
      min-height: 36px;
      padding: 0.25rem 0.6rem;
      background: var(--surface);
      border: 1px solid var(--line);
      font-size: 0.8rem;
      color: var(--ink);
      cursor: pointer;
    }

    .mini-btn:hover {
      background: #E9E9E9;
    }

    .listing-rows {
      list-style: none;
      margin: 0;
      padding: 0;
    }

    .listing-item {
      padding: 0.55rem 0.4rem;
      border-bottom: 1px solid var(--line-soft);
      display: flex;
      flex-wrap: wrap;
      align-items: baseline;
      gap: 0.45rem;
    }

    .listing-item:hover {
      background: var(--surface);
    }

    .listing-date {
      color: var(--muted);
      font-family: var(--font-mono);
      font-size: 0.78rem;
      min-width: 56px;
    }

    .listing-title-btn {
      background: none;
      border: none;
      padding: 0.15rem 0;
      font-family: var(--font-ui);
      font-size: 0.94rem;
      color: var(--accent);
      text-align: left;
      cursor: pointer;
      text-decoration: underline;
    }

    .listing-title-btn.visited {
      color: var(--visited);
    }

    .listing-price {
      font-family: var(--font-mono);
      font-size: 0.8rem;
      padding: 0.08rem 0.35rem;
      border: 1px solid var(--line);
      background: var(--canvas);
      color: var(--ink);
    }

    .listing-hood {
      color: var(--muted);
      font-size: 0.82rem;
    }

    .listing-cat-tag {
      margin-left: auto;
      font-size: 0.74rem;
      color: var(--muted);
      font-family: var(--font-mono);
    }

    /* Right Cities Rail */
    .right-rail {
      background: var(--surface);
      border: 1px solid var(--line-soft);
      padding: 0.75rem;
      font-size: 0.8rem;
    }

    .right-rail h3 {
      margin: 0 0 0.45rem;
      font-size: 0.8rem;
      text-transform: lowercase;
      border-bottom: 1px solid var(--line);
      padding-bottom: 0.25rem;
      color: var(--muted);
    }

    .city-list {
      list-style: none;
      margin: 0 0 1rem;
      padding: 0;
      display: flex;
      flex-direction: column;
      gap: 0.2rem;
    }

    .city-list button {
      width: 100%;
      text-align: left;
      background: none;
      border: none;
      padding: 0.2rem 0.15rem;
      color: var(--accent);
      font-size: 0.8rem;
      cursor: pointer;
    }

    .city-list button:hover {
      text-decoration: underline;
    }

    .city-list button.active-city {
      font-weight: 700;
      color: var(--ink);
      background: #FFFFCC;
    }

    /* Listing Detail Modal */
    .modal-backdrop {
      position: fixed;
      inset: 0;
      background: rgba(0, 0, 0, 0.45);
      display: none;
      align-items: center;
      justify-content: center;
      padding: 1rem;
      z-index: 80;
    }

    .modal-backdrop.open {
      display: flex;
    }

    .modal-box {
      width: min(620px, 100%);
      max-height: 88vh;
      overflow-y: auto;
      background: var(--canvas);
      border: 2px solid var(--ink);
      padding: 1.15rem 1.25rem;
    }

    .modal-top {
      display: flex;
      justify-content: space-between;
      align-items: flex-start;
      gap: 0.75rem;
      border-bottom: 1px solid var(--line);
      padding-bottom: 0.65rem;
      margin-bottom: 0.85rem;
    }

    .modal-top h3 {
      margin: 0;
      font-size: 1.15rem;
      font-family: var(--font-serif);
    }

    .modal-close {
      min-width: 44px;
      min-height: 44px;
      background: var(--surface);
      border: 1px solid var(--ink);
      font-size: 1.1rem;
      cursor: pointer;
    }

    .modal-meta {
      display: flex;
      flex-wrap: wrap;
      gap: 0.75rem;
      font-size: 0.82rem;
      color: var(--muted);
      margin-bottom: 0.85rem;
      font-family: var(--font-mono);
    }

    .modal-diagram {
      border: 1px solid var(--line);
      background: var(--surface);
      margin-bottom: 0.85rem;
    }

    .modal-diagram svg {
      width: 100%;
      height: auto;
      display: block;
    }

    .modal-body-text {
      margin: 0 0 1rem;
      line-height: 1.55;
      font-size: 0.94rem;
    }

    .reply-area {
      border-top: 1px solid var(--line);
      padding-top: 0.85rem;
      display: flex;
      flex-wrap: wrap;
      align-items: center;
      gap: 0.75rem;
    }

    .reply-btn {
      min-height: 44px;
      padding: 0 1rem;
      background: #E8E8FF;
      border: 1px solid var(--accent);
      color: var(--accent);
      font-weight: 700;
      cursor: pointer;
    }

    .relay-box {
      font-family: var(--font-mono);
      font-size: 0.82rem;
      background: #FFFFCC;
      border: 1px solid #CCCC99;
      padding: 0.45rem 0.65rem;
      display: none;
    }

    .relay-box.visible {
      display: inline-block;
    }

    footer {
      max-width: 1120px;
      margin: 0 auto;
      border-top: 1px solid var(--line);
      padding: 0.85rem 1rem 2rem;
      font-size: 0.78rem;
      color: var(--muted);
      display: flex;
      flex-wrap: wrap;
      justify-content: center;
      gap: 0.85rem;
    }

    /* Responsive */
    @media (max-width: 920px) {
      .page-shell {
        grid-template-columns: 190px minmax(0, 1fr);
      }
      .right-rail {
        grid-column: 1 / -1;
      }
      .city-list {
        flex-direction: row;
        flex-wrap: wrap;
        gap: 0.4rem;
      }
      .city-list button {
        width: auto;
        min-height: 44px;
        padding: 0.3rem 0.65rem;
        border: 1px solid var(--line);
        background: var(--canvas);
      }
      .cat-matrix {
        grid-template-columns: repeat(2, minmax(0, 1fr));
      }
    }

    @media (max-width: 640px) {
      .page-shell {
        grid-template-columns: 1fr;
        gap: 0.9rem;
        padding: 0.6rem 0.75rem 2rem;
      }
      .cat-matrix {
        grid-template-columns: 1fr;
        gap: 0.6rem;
      }
      .cat-block summary {
        min-height: 44px;
      }
      .cat-caret {
        display: inline;
      }
      .subcat-list button {
        min-height: 44px;
        display: flex;
        align-items: center;
      }
      .mini-btn {
        min-height: 44px;
      }
      .listing-title-btn {
        min-height: 44px;
        display: inline-flex;
        align-items: center;
      }
      .listing-cat-tag {
        margin-left: 0;
        width: 100%;
      }
    }
  </style>
</head>
<body>
  <div class="page-shell">
    <aside class="left-rail" aria-label="Directory controls">
      <p class="brand-logo">baylist</p>
      <a href="#listings" class="post-link" id="quickPostBtn">create a posting</a>

      <div class="search-box">
        <label for="keywordInput">search baylist</label>
        <input id="keywordInput" class="search-input" type="search" placeholder="bike, studio, synth, mover..." autocomplete="off">
      </div>

      <table class="mini-cal" aria-label="Event calendar">
        <caption>december 2026</caption>
        <thead>
          <tr><th>S</th><th>M</th><th>T</th><th>W</th><th>T</th><th>F</th><th>S</th></tr>
        </thead>
        <tbody>
          <tr><td></td><td></td><td>1</td><td>2</td><td>3</td><td>4</td><td>5</td></tr>
          <tr><td class="today">6</td><td>7</td><td>8</td><td>9</td><td>10</td><td>11</td><td>12</td></tr>
          <tr><td>13</td><td>14</td><td>15</td><td>16</td><td>17</td><td>18</td><td>19</td></tr>
          <tr><td>20</td><td>21</td><td>22</td><td>23</td><td>24</td><td>25</td><td>26</td></tr>
        </tbody>
      </table>

      <ul class="rail-links">
        <li><a href="#listings" id="showAllLink">all recent postings</a></li>
        <li><a href="#listings" data-quick-cat="for sale">free stuff &amp; bicycles</a></li>
        <li><a href="#listings" data-quick-cat="housing">apts / housing</a></li>
        <li><a href="#listings" data-quick-cat="gigs">weekend gigs</a></li>
      </ul>
    </aside>

    <main class="center-col">
      <header class="region-banner">
        <h1 id="regionTitle">san francisco bay area</h1>
        <div class="region-select-wrap">
          <label for="regionSelect">switch city:</label>
          <select id="regionSelect" class="region-select">
            <option value="sf">san francisco bay area</option>
            <option value="nyc">new york city</option>
            <option value="pdx">portland, OR</option>
            <option value="chi">chicago</option>
            <option value="atx">austin, TX</option>
          </select>
        </div>
      </header>

      <section class="cat-matrix" aria-label="Classifieds category directory">
        <details class="cat-block" open>
          <summary>housing <span class="cat-caret">[+]</span></summary>
          <ul class="subcat-list single-col">
            <li><button type="button" data-cat="housing">apts / housing</button></li>
            <li><button type="button" data-cat="housing">rooms / shared</button></li>
            <li><button type="button" data-cat="housing">sublets / temporary</button></li>
            <li><button type="button" data-cat="housing">studio / workshop</button></li>
          </ul>
        </details>

        <details class="cat-block" open>
          <summary>for sale <span class="cat-caret">[+]</span></summary>
          <ul class="subcat-list">
            <li><button type="button" data-cat="for sale">bicycles</button></li>
            <li><button type="button" data-cat="for sale">electronics</button></li>
            <li><button type="button" data-cat="for sale">furniture</button></li>
            <li><button type="button" data-cat="for sale">musical instr</button></li>
            <li><button type="button" data-cat="for sale">photo+video</button></li>
            <li><button type="button" data-cat="for sale">free</button></li>
          </ul>
        </details>

        <details class="cat-block" open>
          <summary>gigs <span class="cat-caret">[+]</span></summary>
          <ul class="subcat-list single-col">
            <li><button type="button" data-cat="gigs">computer</button></li>
            <li><button type="button" data-cat="gigs">creative</button></li>
            <li><button type="button" data-cat="gigs">labor / moving</button></li>
            <li><button type="button" data-cat="gigs">writing / editing</button></li>
          </ul>
        </details>

        <details class="cat-block" open>
          <summary>community <span class="cat-caret">[+]</span></summary>
          <ul class="subcat-list">
            <li><button type="button" data-cat="community">activities</button></li>
            <li><button type="button" data-cat="community">artists</button></li>
            <li><button type="button" data-cat="community">classes</button></li>
            <li><button type="button" data-cat="community">musicians</button></li>
            <li><button type="button" data-cat="community">volunteers</button></li>
            <li><button type="button" data-cat="community">lost+found</button></li>
          </ul>
        </details>

        <details class="cat-block" open>
          <summary>services <span class="cat-caret">[+]</span></summary>
          <ul class="subcat-list single-col">
            <li><button type="button" data-cat="services">cycle repair</button></li>
            <li><button type="button" data-cat="services">skilled trade</button></li>
            <li><button type="button" data-cat="services">lessons &amp; tutoring</button></li>
            <li><button type="button" data-cat="services">small biz ads</button></li>
          </ul>
        </details>
      </section>

      <section class="listings-section" id="listings" aria-label="Recent classified listings">
        <div class="listings-head">
          <h2 id="listingsHeading">recent postings (10)</h2>
          <div class="filter-pill-bar">
            <span id="activeFilterLabel" style="font-size:0.8rem;color:var(--muted);">all categories</span>
            <button type="button" class="mini-btn" id="clearFilterBtn">clear filter</button>
          </div>
        </div>
        <ul class="listing-rows" id="listingRows"></ul>
      </section>
    </main>

    <aside class="right-rail" aria-label="Nearby cities">
      <h3>nearby cities</h3>
      <ul class="city-list" id="cityList">
        <li><button type="button" class="active-city" data-city="sf">sf bay area</button></li>
        <li><button type="button" data-city="nyc">new york</button></li>
        <li><button type="button" data-city="pdx">portland</button></li>
        <li><button type="button" data-city="chi">chicago</button></li>
        <li><button type="button" data-city="atx">austin</button></li>
      </ul>
      <h3>safety</h3>
      <p style="margin:0;color:var(--muted);line-height:1.45;">Deal locally, face-to-face. Never wire funds or ship sight unseen.</p>
    </aside>
  </div>

  <footer>
    <span>&copy; 2026 baylist</span>
    <a href="#listings">help</a>
    <a href="#listings">safety</a>
    <a href="#listings">privacy</a>
    <a href="#listings">terms</a>
    <a href="#listings">about</a>
  </footer>

  <!-- Listing Detail Modal -->
  <div class="modal-backdrop" id="modalBackdrop" role="dialog" aria-modal="true" aria-labelledby="modalTitle">
    <div class="modal-box">
      <div class="modal-top">
        <h3 id="modalTitle">Listing title</h3>
        <button type="button" class="modal-close" id="closeModalBtn" aria-label="Close listing">&times;</button>
      </div>
      <div class="modal-meta" id="modalMeta"></div>
      <div class="modal-diagram" id="modalDiagram"></div>
      <p class="modal-body-text" id="modalBody"></p>
      <div class="reply-area">
        <button type="button" class="reply-btn" id="revealReplyBtn">reply to posting</button>
        <span class="relay-box" id="relayBox"></span>
      </div>
    </div>
  </div>

  <script>
    (function () {
      const REGIONS = {
        sf: { name: 'san francisco bay area', hoods: ['mission district', 'oakland temescal', 'inner sunset', 'berkeley northside', 'soma'] },
        nyc: { name: 'new york city', hoods: ['astoria', 'crown heights', 'lower east side', 'park slope', 'greenpoint'] },
        pdx: { name: 'portland, OR', hoods: ['hawthorne', 'alberta arts', 'st johns', 'sellwood', 'division'] },
        chi: { name: 'chicago', hoods: ['logan square', 'pilsen', 'andersonville', 'hyde park', 'wicker park'] },
        atx: { name: 'austin, TX', hoods: ['east cesar chavez', 'hyde park', 'south congress', 'mueller', 'north loop'] }
      };

      const LISTINGS = [
        {
          id: 101,
          date: 'Dec 06',
          title: 'Sunny 1BR garden flat with wood floors + bike shed',
          price: '$2,150',
          cat: 'housing',
          hoodIdx: 0,
          relay: 'x8k2m-77101@hous.baylist.org',
          body: 'Quiet rear-facing one-bedroom unit on a tree-lined block. Freshly refinished Douglas fir floors, gas stove, coin-free shared laundry, and locked bicycle shed in the courtyard. Cats welcome. One-year lease, water & garbage included.',
          svgType: 'floorplan'
        },
        {
          id: 102,
          date: 'Dec 06',
          title: '1987 Bridgestone MB-3 steel touring bicycle — 56cm',
          price: '$420',
          cat: 'for sale',
          hoodIdx: 1,
          relay: 'p4r9q-77102@sale.baylist.org',
          body: 'Classic lugged chromoly frame, recently tuned with new Panaracer Pasela 26x1.75 tires, Suntour thumb shifters, and rear alloy rack. Straight wheels, zero dents, ready to commute today. Cash or Venmo in person.',
          svgType: 'bike'
        },
        {
          id: 103,
          date: 'Dec 06',
          title: 'Roland Juno-106 analog synth (all 6 voice chips serviced)',
          price: '$1,350',
          cat: 'for sale',
          hoodIdx: 2,
          relay: 'v9t1w-77103@sale.baylist.org',
          body: 'Clean studio-kept Juno-106 with clone voice chips installed last year. Chorus is quiet and lush, all sliders smooth, MIDI tested. Comes with original hardshell case and power cord. Happy to demo through monitors.',
          svgType: 'synth'
        },
        {
          id: 104,
          date: 'Dec 05',
          title: 'Need static HTML/CSS polish for local bakery menu site',
          price: '$350 flat',
          cat: 'gigs',
          hoodIdx: 3,
          relay: 'm2n8c-77104@gigs.baylist.org',
          body: 'Small neighborhood sourdough bakery needs our single-page HTML menu cleaned up for mobile phones and printouts. No WordPress or React—just fast plain HTML/CSS. Send 2 links to simple sites you built.',
          svgType: 'note'
        },
        {
          id: 105,
          date: 'Dec 05',
          title: 'Shared printmaking & risograph studio bench available',
          price: '$290/mo',
          cat: 'housing',
          hoodIdx: 4,
          relay: 'k7b3d-77105@hous.baylist.org',
          body: '24/7 keycard access to a sunlit ground-floor co-op studio with 2-drum Riso MZ770, paper guillotine, flat files, and slop sink. Ideal for illustrators, bookbinders, or zine publishers.',
          svgType: 'floorplan'
        },
        {
          id: 106,
          date: 'Dec 05',
          title: 'FREE solid oak drafting table (heavy, bring 2 people)',
          price: '$0',
          cat: 'for sale',
          hoodIdx: 0,
          relay: 'f3j5s-77106@sale.baylist.org',
          body: '48x32 inch tilting architect drafting table with parallel rule bar. Some ink stains on the top that give it character. Ground floor pickup near transit, first come first served.',
          svgType: 'note'
        },
        {
          id: 107,
          date: 'Dec 04',
          title: 'Weekend analog darkroom group — looking for 3 members',
          price: 'co-op',
          cat: 'community',
          hoodIdx: 1,
          relay: 'c6h4e-77107@comm.baylist.org',
          body: 'Friendly black-and-white 35mm and medium format darkroom collective meeting Sunday afternoons. We split chemistry costs and share two Beseler 23C enlargers. Beginners welcome.',
          svgType: 'note'
        },
        {
          id: 108,
          date: 'Dec 04',
          title: 'Mobile bicycle mechanic — tuneups & wheel truing at your door',
          price: '$65',
          cat: 'services',
          hoodIdx: 2,
          relay: 's1w9p-77108@serv.baylist.org',
          body: '14 years shop experience. Full safety check, brake/derailleur adjustment, cable replacement, and wheel truing right outside your apartment or office. Same-week bookings available.',
          svgType: 'bike'
        },
        {
          id: 109,
          date: 'Dec 03',
          title: 'Two helpers needed Saturday 9am–12pm to load cargo van',
          price: '$120 each',
          cat: 'gigs',
          hoodIdx: 3,
          relay: 'g5r2z-77109@gigs.baylist.org',
          body: 'Moving boxed books, a sofa, and two desks from a 1st-floor flat into a parked Sprinter van. Dollies and straps provided, coffee and bagels on us. Cash paid immediately upon finish.',
          svgType: 'note'
        },
        {
          id: 110,
          date: 'Dec 03',
          title: 'Community tool library — winter volunteer orientation',
          price: 'volunteer',
          cat: 'community',
          hoodIdx: 4,
          relay: 't8y6u-77110@comm.baylist.org',
          body: 'Help neighbors check out drills, saws, sewing machines, and ladders for 3 hours every other Saturday. Great way to meet local makers and learn basic tool maintenance.',
          svgType: 'note'
        }
      ];

      let currentRegion = 'sf';
      let currentCat = 'ALL';
      let currentQuery = '';
      const visitedIds = new Set();

      const regionTitle = document.getElementById('regionTitle');
      const regionSelect = document.getElementById('regionSelect');
      const keywordInput = document.getElementById('keywordInput');
      const listingRows = document.getElementById('listingRows');
      const listingsHeading = document.getElementById('listingsHeading');
      const activeFilterLabel = document.getElementById('activeFilterLabel');
      const modalBackdrop = document.getElementById('modalBackdrop');
      const modalTitle = document.getElementById('modalTitle');
      const modalMeta = document.getElementById('modalMeta');
      const modalDiagram = document.getElementById('modalDiagram');
      const modalBody = document.getElementById('modalBody');
      const relayBox = document.getElementById('relayBox');
      const revealReplyBtn = document.getElementById('revealReplyBtn');

      let activeModalItem = null;

      function makeDiagram(type, hood) {
        if (type === 'floorplan') {
          return `<svg viewBox="0 0 540 150" aria-hidden="true">
            <rect width="540" height="150" fill="#F9F9F9"/>
            <rect x="20" y="18" width="220" height="114" fill="#FFF" stroke="#1A1A1A" stroke-width="1.5"/>
            <line x1="130" y1="18" x2="130" y2="132" stroke="#1A1A1A" stroke-width="1.2"/>
            <text x="38" y="80" font-family="monospace" font-size="12" fill="#1A1A1A">LIVING / STUDIO</text>
            <text x="150" y="80" font-family="monospace" font-size="12" fill="#1A1A1A">BED / KITCHEN</text>
            <rect x="270" y="18" width="250" height="114" fill="#FFF" stroke="#CCCCCC" stroke-width="1"/>
            <line x1="270" y1="75" x2="520" y2="75" stroke="#DDDDDD" stroke-width="4"/>
            <line x1="395" y1="18" x2="395" y2="132" stroke="#DDDDDD" stroke-width="4"/>
            <circle cx="395" cy="75" r="18" fill="#0000EE" fill-opacity="0.16" stroke="#0000EE" stroke-width="1.5"/>
            <text x="284" y="120" font-family="monospace" font-size="11" fill="#666666">approx area: ${hood}</text>
          </svg>`;
        }
        if (type === 'bike') {
          return `<svg viewBox="0 0 540 150" aria-hidden="true">
            <rect width="540" height="150" fill="#F9F9F9"/>
            <circle cx="150" cy="96" r="36" fill="none" stroke="#1A1A1A" stroke-width="2"/>
            <circle cx="330" cy="96" r="36" fill="none" stroke="#1A1A1A" stroke-width="2"/>
            <polyline points="150,96 225,52 300,52 245,96 150,96" fill="none" stroke="#0000EE" stroke-width="2"/>
            <line x1="300" y1="52" x2="330" y2="96" stroke="#0000EE" stroke-width="2"/>
            <line x1="215" y1="42" x2="238" y2="42" stroke="#1A1A1A" stroke-width="3"/>
            <text x="392" y="74" font-family="monospace" font-size="12" fill="#1A1A1A">LOCAL PICKUP</text>
            <text x="392" y="94" font-family="monospace" font-size="11" fill="#666666">${hood}</text>
          </svg>`;
        }
        if (type === 'synth') {
          return `<svg viewBox="0 0 540 150" aria-hidden="true">
            <rect width="540" height="150" fill="#F9F9F9"/>
            <rect x="40" y="24" width="460" height="102" fill="#222" stroke="#000" stroke-width="1.5"/>
            <rect x="56" y="36" width="428" height="28" fill="#3A3A3A"/>
            <rect x="56" y="72" width="428" height="44" fill="#FFFFFF"/>
            <g fill="#1A1A1A">
              <rect x="86" y="72" width="14" height="26"/><rect x="114" y="72" width="14" height="26"/>
              <rect x="164" y="72" width="14" height="26"/><rect x="192" y="72" width="14" height="26"/>
              <rect x="220" y="72" width="14" height="26"/><rect x="270" y="72" width="14" height="26"/>
              <rect x="298" y="72" width="14" height="26"/><rect x="348" y="72" width="14" height="26"/>
              <rect x="376" y="72" width="14" height="26"/><rect x="404" y="72" width="14" height="26"/>
            </g>
            <text x="66" y="54" font-family="monospace" font-size="11" fill="#FFFFCC">POLYPHONIC SYNTHESIZER // ${hood.toUpperCase()}</text>
          </svg>`;
        }
        return `<svg viewBox="0 0 540 120" aria-hidden="true">
          <rect width="540" height="120" fill="#F9F9F9"/>
          <rect x="20" y="18" width="500" height="84" fill="#FFFFFF" stroke="#CCCCCC"/>
          <line x1="20" y1="60" x2="520" y2="60" stroke="#EFEFEF" stroke-width="5"/>
          <line x1="270" y1="18" x2="270" y2="102" stroke="#EFEFEF" stroke-width="5"/>
          <circle cx="270" cy="60" r="14" fill="#0000EE" fill-opacity="0.15" stroke="#0000EE" stroke-width="1.5"/>
          <text x="34" y="42" font-family="monospace" font-size="11" fill="#666666">CLASSIFIED LOCATION MAP</text>
          <text x="34" y="88" font-family="monospace" font-size="12" fill="#1A1A1A">neighborhood: ${hood}</text>
        </svg>`;
      }

      function renderListings() {
        const reg = REGIONS[currentRegion];
        regionTitle.textContent = reg.name;

        const q = currentQuery.trim().toLowerCase();
        const filtered = LISTINGS.filter(item => {
          const catOk = currentCat === 'ALL' || item.cat === currentCat;
          const hood = reg.hoods[item.hoodIdx % reg.hoods.length];
          const text = `${item.title} ${item.body} ${item.cat} ${hood} ${item.price}`.toLowerCase();
          const qOk = !q || text.includes(q);
          return catOk && qOk;
        });

        listingsHeading.textContent = `recent postings (${filtered.length})`;
        activeFilterLabel.textContent = (currentCat === 'ALL' ? 'all categories' : currentCat) + (q ? ` + "${q}"` : '');

        if (filtered.length === 0) {
          listingRows.innerHTML = `<li class="listing-item" style="color:var(--muted);">No postings match your search in ${reg.name}. Try clearing the filter.</li>`;
          return;
        }

        listingRows.innerHTML = filtered.map(item => {
          const hood = reg.hoods[item.hoodIdx % reg.hoods.length];
          const isVisited = visitedIds.has(item.id);
          return `
            <li class="listing-item">
              <span class="listing-date">${item.date}</span>
              <button type="button" class="listing-title-btn ${isVisited ? 'visited' : ''}" data-open="${item.id}">${item.title}</button>
              <span class="listing-price">${item.price}</span>
              <span class="listing-hood">(${hood})</span>
              <span class="listing-cat-tag">[${item.cat}]</span>
            </li>
          `;
        }).join('');
      }

      function openModal(id) {
        const item = LISTINGS.find(l => l.id === id);
        if (!item) return;
        activeModalItem = item;
        visitedIds.add(id);
        renderListings();

        const reg = REGIONS[currentRegion];
        const hood = reg.hoods[item.hoodIdx % reg.hoods.length];

        modalTitle.textContent = `${item.title} — ${item.price}`;
        modalMeta.innerHTML = `
          <span>post id: ${item.id}</span>
          <span>posted: ${item.date}</span>
          <span>category: ${item.cat}</span>
          <span>area: ${hood}, ${reg.name}</span>
        `;
        modalDiagram.innerHTML = makeDiagram(item.svgType, hood);
        modalBody.textContent = item.body;
        relayBox.textContent = item.relay;
        relayBox.classList.remove('visible');
        modalBackdrop.classList.add('open');
      }

      function closeModal() {
        modalBackdrop.classList.remove('open');
      }

      function setRegion(code) {
        if (!REGIONS[code]) return;
        currentRegion = code;
        regionSelect.value = code;
        document.querySelectorAll('#cityList button').forEach(btn => {
          btn.classList.toggle('active-city', btn.dataset.city === code);
        });
        renderListings();
      }

      function setCategory(cat) {
        currentCat = cat;
        document.querySelectorAll('.subcat-list button').forEach(btn => {
          btn.classList.toggle('active-sub', btn.dataset.cat === cat);
        });
        renderListings();
      }

      keywordInput.addEventListener('input', e => {
        currentQuery = e.target.value;
        renderListings();
      });

      regionSelect.addEventListener('change', e => setRegion(e.target.value));

      document.getElementById('cityList').addEventListener('click', e => {
        const btn = e.target.closest('[data-city]');
        if (btn) setRegion(btn.dataset.city);
      });

      document.querySelector('.cat-matrix').addEventListener('click', e => {
        const btn = e.target.closest('[data-cat]');
        if (btn) {
          setCategory(btn.dataset.cat);
          document.getElementById('listings').scrollIntoView({ behavior: 'smooth', block: 'start' });
        }
      });

      document.querySelectorAll('[data-quick-cat]').forEach(link => {
        link.addEventListener('click', () => setCategory(link.dataset.quickCat));
      });

      document.getElementById('showAllLink').addEventListener('click', () => {
        currentQuery = '';
        keywordInput.value = '';
        setCategory('ALL');
      });

      document.getElementById('clearFilterBtn').addEventListener('click', () => {
        currentQuery = '';
        keywordInput.value = '';
        setCategory('ALL');
      });

      document.getElementById('quickPostBtn').addEventListener('click', e => {
        e.preventDefault();
        openModal(104);
      });

      listingRows.addEventListener('click', e => {
        const btn = e.target.closest('[data-open]');
        if (btn) openModal(Number(btn.dataset.open));
      });

      revealReplyBtn.addEventListener('click', () => {
        relayBox.classList.add('visible');
      });

      document.getElementById('closeModalBtn').addEventListener('click', closeModal);
      modalBackdrop.addEventListener('click', e => {
        if (e.target === modalBackdrop) closeModal();
      });
      document.addEventListener('keydown', e => {
        if (e.key === 'Escape') closeModal();
      });

      // Collapse category accordions cleanly on narrow screens only if user clicks them
      if (window.innerWidth <= 640) {
        const blocks = document.querySelectorAll('.cat-block');
        blocks.forEach((el, idx) => {
          if (idx > 1) el.removeAttribute('open');
        });
      }

      renderListings();
    })();
  </script>
</body>
</html>