# #127 — Three-Pane Master-Detail-Inspector

> Four-column tag, list, live editor, and collapsible inspector workspace that flattens into a drill-down stack on mobile.

## Metadata

- **Index**: #127
- **Slug**: `three-pane-inspector`
- **Kind**: `ui`
- **Family**: Workspace & Editor
- **Theme**: `light`
- **Mobile Strength**: `native-first`
- **Tags**: `three-pane`, `master-detail`, `inspector`, `notes-workspace`, `drill-down`, `editorial`
- **Best For**: Knowledge bases and Markdown note apps, Technical documentation workspaces, Editorial CMS and manuscript tools, CRM or research libraries with metadata rails
- **Real-World Inspiration**: [Ulysses](https://ulysses.app/)
- **Detail Page**: https://templates.michaelpitts.net/t/three-pane-inspector
- **Live Demo**: https://templates.michaelpitts.net/demos/three-pane-inspector.html
- **JSON API**: https://templates.michaelpitts.net/api/templates/three-pane-inspector

## Why This Aesthetic Is Unique

Balances broad taxonomy browsing, sibling document scanning, distraction-free serif editing, and live outline/backlink inspection while promoting each pane cleanly to a full-bleed mobile screen.

## Color Palette

| Role | Name | Hex |
|------|------|-----|
| `canvas` | Warm Snow | `#FBFAF8` |
| `surface` | Pure Paper | `#FFFFFF` |
| `ink` | Charcoal Ink | `#23201D` |
| `accent` | Bear Crimson | `#D94141` |
| `muted` | Warm Taupe | `#766F66` |

## Typography

- **Display**: `Newsreader`
- **Body**: `Inter`
- **Mono**: `JetBrains Mono`
- **Scale Notes**: 26px serif document title, 16px/1.7 editorial prose measure, 13px sans navigation rails, 11px mono metadata counters.
- **Google Fonts**: https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Newsreader:wght@600;700&display=swap
  ```html
  <link rel="stylesheet" href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&family=Newsreader:wght@600;700&display=swap">
  ```

## Layout Architecture

CSS Grid 220px tag rail + 280px note list + fluid editor + toggleable 250px inspector on desktop; deterministic single-pane state machine on viewports <=960px.

## Interaction & Micro-Motion Rules

Editing prose updates word count, read time, paragraph count, and clickable #heading outline anchors in real time; backlinks jump directly between related notes.

## Mobile & Responsive Rules

Transforms the four horizontal panes into a native-feeling Tags -> Notes -> Editor -> Inspector drill-down stack with explicit >=44px Back buttons in the top bar.

## Agent Guardrails

### DO
- Collapse multi-pane layouts into a deterministic drill-down stack below 960px instead of squeezing columns.
- Keep the right inspector rail optional/toggleable so desktop editors can reclaim focus width.
- Update outline and word metrics synchronously as the user types.

### DON'T
- Never force horizontal scrolling across three panes on a 390px viewport.
- Avoid hiding the Back navigation button behind an ambiguous icon on mobile.

## Complete Standalone Starter Code

File: `demos/three-pane-inspector.html`

```html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>Three-Pane Master-Detail-Inspector — Bear-Inspired Pattern</title>
<style>
  :root {
    --canvas: #fbfaf8;
    --sidebar: #f3f1ec;
    --list: #f8f7f4;
    --surface: #ffffff;
    --border: #e5e1d8;
    --ink: #23201d;
    --muted: #766f66;
    --accent: #d94141;
    --accent-soft: rgba(217,65,65,0.1);
    --font: -apple-system, BlinkMacSystemFont, "Inter", "Segoe UI", sans-serif;
    --serif: Georgia, "Iowan Old Style", "Palatino Linotype", serif;
    --mono: ui-monospace, "SF Mono", Menlo, monospace;
  }
  * { box-sizing: border-box; margin: 0; padding: 0; }
  html, body { height: 100%; background: var(--canvas); color: var(--ink); font-family: var(--font); overflow-x: hidden; }
  .app {
    display: grid;
    grid-template-columns: 220px 280px 1fr 250px;
    height: 100vh;
    min-height: 580px;
  }
  .app.inspector-hidden { grid-template-columns: 220px 280px 1fr 0px; }
  .pane {
    display: flex;
    flex-direction: column;
    min-width: 0;
    border-right: 1px solid var(--border);
    overflow: hidden;
  }
  .pane:last-child { border-right: none; }
  .pane-tags { background: var(--sidebar); }
  .pane-list { background: var(--list); }
  .pane-editor { background: var(--surface); }
  .pane-inspector { background: var(--sidebar); transition: opacity .15s; }
  .app.inspector-hidden .pane-inspector { opacity: 0; pointer-events: none; border: none; }

  .pane-head {
    min-height: 52px;
    padding: 8px 14px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    flex-shrink: 0;
  }
  .pane-title { font-size: 13px; font-weight: 700; letter-spacing: 0.02em; color: var(--muted); text-transform: uppercase; }
  .icon-btn {
    min-height: 40px; min-width: 40px;
    padding: 0 10px;
    border-radius: 9px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font: 600 13px var(--font);
    cursor: pointer;
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  }
  .icon-btn:hover { border-color: var(--accent); color: var(--accent); }
  .icon-btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
  .mobile-back { display: none; }

  .scroll { flex: 1; overflow-y: auto; padding: 10px; }
  .tag-btn {
    width: 100%;
    min-height: 44px;
    padding: 8px 12px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--ink);
    font: 500 14px var(--font);
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    margin-bottom: 2px;
  }
  .tag-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }
  .tag-count { font: 600 11px var(--mono); color: var(--muted); }

  .search-box {
    width: 100%;
    min-height: 38px;
    padding: 6px 10px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--ink);
    font: 14px var(--font);
    margin-bottom: 10px;
  }
  .note-card {
    width: 100%;
    text-align: left;
    padding: 12px;
    border-radius: 10px;
    border: 1px solid transparent;
    background: transparent;
    cursor: pointer;
    margin-bottom: 6px;
    font-family: var(--font);
  }
  .note-card.active { background: var(--surface); border-color: var(--border); box-shadow: 0 2px 8px rgba(0,0,0,0.04); }
  .note-card-title { font-size: 14px; font-weight: 600; color: var(--ink); margin-bottom: 4px; }
  .note-card-excerpt { font-size: 12px; color: var(--muted); line-height: 1.45; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
  .note-card-meta { margin-top: 6px; font: 500 11px var(--mono); color: var(--muted); display: flex; justify-content: space-between; }

  .editor-wrap { flex: 1; overflow-y: auto; padding: 28px 34px; max-width: 720px; width: 100%; margin: 0 auto; }
  .editor-title {
    width: 100%;
    border: none;
    outline: none;
    background: transparent;
    font: 700 26px/1.25 var(--serif);
    color: var(--ink);
    margin-bottom: 14px;
  }
  .editor-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 18px; }
  .pill { font: 600 12px var(--mono); padding: 4px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent); }
  .editor-body {
    width: 100%;
    min-height: 360px;
    border: none;
    outline: none;
    resize: none;
    background: transparent;
    font: 16px/1.7 var(--serif);
    color: var(--ink);
  }

  .insp-section { margin-bottom: 18px; }
  .insp-label { font: 700 11px var(--mono); text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin-bottom: 8px; }
  .stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
  .stat { background: var(--surface); border: 1px solid var(--border); border-radius: 9px; padding: 10px; }
  .stat-n { font: 700 18px var(--mono); color: var(--ink); }
  .stat-l { font-size: 11px; color: var(--muted); margin-top: 2px; }
  .outline-item, .backlink-item {
    display: block; width: 100%; text-align: left;
    padding: 8px 10px; border-radius: 8px; border: none;
    background: var(--surface); color: var(--ink); font-size: 13px;
    margin-bottom: 6px; cursor: pointer; border: 1px solid var(--border);
  }
  .outline-item:hover, .backlink-item:hover { border-color: var(--accent); color: var(--accent); }

  @media (max-width: 960px) {
    .app, .app.inspector-hidden {
      display: block;
      position: relative;
      height: 100vh;
    }
    .pane {
      position: absolute;
      inset: 0;
      border-right: none;
      display: none;
    }
    .app[data-mobile-view="tags"] .pane-tags { display: flex; }
    .app[data-mobile-view="list"] .pane-list { display: flex; }
    .app[data-mobile-view="editor"] .pane-editor { display: flex; }
    .app[data-mobile-view="inspector"] .pane-inspector { display: flex; opacity: 1; pointer-events: auto; }
    .mobile-back { display: inline-flex; }
    .editor-wrap { padding: 18px 16px; }
  }
</style>
</head>
<body>
<div class="app" id="app" data-mobile-view="list">
  <aside class="pane pane-tags" aria-label="Notebooks and Tags">
    <div class="pane-head">
      <span class="pane-title">Library</span>
      <button class="icon-btn primary" id="newNoteBtn1" type="button" title="New Note">+ Note</button>
    </div>
    <div class="scroll" id="tagList"></div>
  </aside>

  <section class="pane pane-list" aria-label="Notes List">
    <div class="pane-head">
      <button class="icon-btn mobile-back" data-go="tags" type="button">← Tags</button>
      <span class="pane-title" id="listHeading">All Notes</span>
      <button class="icon-btn" id="newNoteBtn2" type="button">+</button>
    </div>
    <div class="scroll">
      <input class="search-box" id="noteSearch" type="search" placeholder="Filter notes...">
      <div id="noteList"></div>
    </div>
  </section>

  <main class="pane pane-editor" aria-label="Note Editor">
    <div class="pane-head">
      <button class="icon-btn mobile-back" data-go="list" type="button">← Notes</button>
      <span class="pane-title" id="saveStatus">Saved locally</span>
      <button class="icon-btn" id="toggleInspectorBtn" type="button">Inspector ⓘ</button>
    </div>
    <div class="editor-wrap">
      <input class="editor-title" id="edTitle" type="text" aria-label="Note title">
      <div class="editor-tags" id="edTags"></div>
      <textarea class="editor-body" id="edBody" aria-label="Note body"></textarea>
    </div>
  </main>

  <aside class="pane pane-inspector" aria-label="Document Inspector">
    <div class="pane-head">
      <button class="icon-btn mobile-back" data-go="editor" type="button">← Editor</button>
      <span class="pane-title">Inspector</span>
      <span style="width:24px;"></span>
    </div>
    <div class="scroll">
      <div class="insp-section">
        <div class="insp-label">Metrics</div>
        <div class="stat-grid">
          <div class="stat"><div class="stat-n" id="stWords">0</div><div class="stat-l">Words</div></div>
          <div class="stat"><div class="stat-n" id="stRead">1m</div><div class="stat-l">Read Time</div></div>
          <div class="stat"><div class="stat-n" id="stChars">0</div><div class="stat-l">Chars</div></div>
          <div class="stat"><div class="stat-n" id="stParas">0</div><div class="stat-l">Paragraphs</div></div>
        </div>
      </div>
      <div class="insp-section">
        <div class="insp-label">Document Outline</div>
        <div id="outlineList"></div>
      </div>
      <div class="insp-section">
        <div class="insp-label">Backlinks</div>
        <div id="backlinkList"></div>
      </div>
    </div>
  </aside>
</div>

<script>
const NOTES = [
  {
    id: 'n1',
    title: 'Field Guide to Responsive Three-Pane Layouts',
    tags: ['#architecture', '#design-systems'],
    updated: 'Today 09:40',
    backlinks: ['n2', 'n4'],
    body: `# Core Spatial Contract\nA three-pane workspace balances navigation breadth, scannable sibling context, and deep reading focus without modal interruptions.\n\n# Desktop Behavior\nAt 1280px, the tag rail stays fixed at 220px, the note list holds 280px, and the editor claims fluid center space. The inspector rail collapses cleanly on demand.\n\n# Mobile Drill-Down Stack\nBelow 960px, horizontal compression breaks legibility. Instead, each pane promotes to a full-bleed viewport layer with deterministic Back navigation and >=44px touch targets.`
  },
  {
    id: 'n2',
    title: 'Typography Scale for Long-Form Technical Notes',
    tags: ['#design-systems', '#writing'],
    updated: 'Yesterday',
    backlinks: ['n1'],
    body: `# Measure & Rhythm\nKeep prose between 60 and 72 characters per line. Pairing a humanist serif for body prose with a crisp geometric sans for chrome creates instant figure-ground separation.\n\n# Heading Anchors\nMarkdown-style # headings automatically populate the live Inspector outline so readers can scan structure in milliseconds.`
  },
  {
    id: 'n3',
    title: 'Q3 Sync Engine Latency Audit',
    tags: ['#engineering', '#architecture'],
    updated: 'Dec 02',
    backlinks: ['n4'],
    body: `# Observed Bottlenecks\nCRDT merge payloads spiked during bulk tag renames across 12,000 notes.\n\n# Mitigation Plan\nBatch tag index deltas into 250ms micro-frames and stream only dirty note headers to mobile clients.`
  },
  {
    id: 'n4',
    title: 'Offline-First Conflict Resolution Notes',
    tags: ['#engineering', '#writing'],
    updated: 'Nov 28',
    backlinks: ['n1', 'n3'],
    body: `# Local Truth\nEvery keystroke commits to IndexedDB before hitting the sync worker. The status badge reflects local durability rather than network round-trips.\n\n# Conflict Merging\nPrefer non-destructive side-by-side copies whenever two devices edit the same paragraph offline.`
  }
];

let activeTag = 'all';
let activeNoteId = 'n1';

const app = document.getElementById('app');
const tagList = document.getElementById('tagList');
const noteList = document.getElementById('noteList');
const noteSearch = document.getElementById('noteSearch');
const edTitle = document.getElementById('edTitle');
const edTags = document.getElementById('edTags');
const edBody = document.getElementById('edBody');
const listHeading = document.getElementById('listHeading');

function renderTags() {
  const counts = {};
  NOTES.forEach(n => n.tags.forEach(t => counts[t] = (counts[t] || 0) + 1));
  const items = [['all', 'All Notes', NOTES.length], ...Object.entries(counts).map(([t, c]) => [t, t, c])];
  tagList.innerHTML = items.map(([k, label, c]) => `
    <button type="button" class="tag-btn ${activeTag === k ? 'active' : ''}" data-tag="${k}">
      <span>${label}</span><span class="tag-count">${c}</span>
    </button>
  `).join('');
  tagList.querySelectorAll('.tag-btn').forEach(btn => {
    btn.addEventListener('click', () => {
      activeTag = btn.dataset.tag;
      listHeading.textContent = activeTag === 'all' ? 'All Notes' : activeTag;
      renderTags();
      renderNotes();
      if (window.innerWidth <= 960) app.dataset.mobileView = 'list';
    });
  });
}

function renderNotes() {
  const q = noteSearch.value.trim().toLowerCase();
  const visible = NOTES.filter(n =>
    (activeTag === 'all' || n.tags.includes(activeTag)) &&
    (!q || n.title.toLowerCase().includes(q) || n.body.toLowerCase().includes(q))
  );
  noteList.innerHTML = visible.map(n => `
    <button type="button" class="note-card ${n.id === activeNoteId ? 'active' : ''}" data-id="${n.id}">
      <div class="note-card-title">${n.title || 'Untitled Note'}</div>
      <div class="note-card-excerpt">${n.body.replace(/^#+\s*/gm, '')}</div>
      <div class="note-card-meta"><span>${n.tags[0] || '#inbox'}</span><span>${n.updated}</span></div>
    </button>
  `).join('') || `<div style="padding:20px;color:var(--muted);font-size:13px;">No matching notes.</div>`;

  noteList.querySelectorAll('.note-card').forEach(card => {
    card.addEventListener('click', () => {
      activeNoteId = card.dataset.id;
      renderNotes();
      loadEditor();
      if (window.innerWidth <= 960) app.dataset.mobileView = 'editor';
    });
  });
}

function loadEditor() {
  const note = NOTES.find(n => n.id === activeNoteId) || NOTES[0];
  if (!note) return;
  edTitle.value = note.title;
  edBody.value = note.body;
  edTags.innerHTML = note.tags.map(t => `<span class="pill">${t}</span>`).join('');
  updateInspector(note);
}

function updateInspector(note) {
  const text = `${note.title}\n${note.body}`.trim();
  const words = text ? text.split(/\s+/).length : 0;
  document.getElementById('stWords').textContent = words;
  document.getElementById('stChars').textContent = note.body.length;
  document.getElementById('stRead').textContent = `${Math.max(1, Math.ceil(words / 220))}m`;
  document.getElementById('stParas').textContent = note.body.split(/\n\s*\n/).filter(Boolean).length;

  const headings = note.body.split('\n').filter(l => /^#\s+/.test(l)).map(l => l.replace(/^#\s+/, ''));
  document.getElementById('outlineList').innerHTML = headings.length
    ? headings.map(h => `<button type="button" class="outline-item" data-h="${h}">§ ${h}</button>`).join('')
    : `<div style="font-size:12px;color:var(--muted);">Add a line starting with # to build an outline.</div>`;

  document.querySelectorAll('.outline-item').forEach(btn => {
    btn.addEventListener('click', () => {
      const pos = edBody.value.indexOf('# ' + btn.dataset.h);
      if (pos >= 0) {
        if (window.innerWidth <= 960) app.dataset.mobileView = 'editor';
        edBody.focus();
        edBody.setSelectionRange(pos, pos + btn.dataset.h.length + 2);
      }
    });
  });

  const links = (note.backlinks || []).map(id => NOTES.find(n => n.id === id)).filter(Boolean);
  document.getElementById('backlinkList').innerHTML = links.length
    ? links.map(l => `<button type="button" class="backlink-item" data-id="${l.id}">↗ ${l.title}</button>`).join('')
    : `<div style="font-size:12px;color:var(--muted);">No backlinks yet.</div>`;

  document.querySelectorAll('.backlink-item').forEach(btn => {
    btn.addEventListener('click', () => {
      activeNoteId = btn.dataset.id;
      renderNotes();
      loadEditor();
      if (window.innerWidth <= 960) app.dataset.mobileView = 'editor';
    });
  });
}

function saveEdits() {
  const note = NOTES.find(n => n.id === activeNoteId);
  if (!note) return;
  note.title = edTitle.value;
  note.body = edBody.value;
  note.updated = 'Just now';
  document.getElementById('saveStatus').textContent = 'Edited just now';
  renderNotes();
  updateInspector(note);
}

edTitle.addEventListener('input', saveEdits);
edBody.addEventListener('input', saveEdits);
noteSearch.addEventListener('input', renderNotes);

document.getElementById('toggleInspectorBtn').addEventListener('click', () => {
  if (window.innerWidth <= 960) {
    app.dataset.mobileView = 'inspector';
  } else {
    app.classList.toggle('inspector-hidden');
  }
});

document.querySelectorAll('.mobile-back').forEach(btn => {
  btn.addEventListener('click', () => { app.dataset.mobileView = btn.dataset.go; });
});

function createNote() {
  const id = 'n' + (NOTES.length + 1);
  const tag = activeTag === 'all' ? '#inbox' : activeTag;
  NOTES.unshift({
    id,
    title: 'Untitled Research Note',
    tags: [tag],
    updated: 'Just now',
    backlinks: ['n1'],
    body: '# Overview\nStart capturing thoughts here. Word counts and outline headings update live in the Inspector.'
  });
  activeNoteId = id;
  renderTags();
  renderNotes();
  loadEditor();
  if (window.innerWidth <= 960) app.dataset.mobileView = 'editor';
  edTitle.focus();
  edTitle.select();
}
document.getElementById('newNoteBtn1').addEventListener('click', createNote);
document.getElementById('newNoteBtn2').addEventListener('click', createNote);

renderTags();
renderNotes();
loadEditor();
</script>
</body>
</html>
```
