{
  "id": 57,
  "slug": "warm-editorial-notes",
  "name": "Warm Editorial Notes",
  "kind": "style",
  "family": "Minimalist Utility & Craft Software",
  "sourceSite": {
    "name": "Bear",
    "url": "https://bear.app/",
    "verifiedStatus": 200
  },
  "tagline": "Warm snow-and-linen Markdown notes app with nested #tag sidebar, serif reading canvas, and crimson editorial accents.",
  "whyUnique": "Brings tactile bookish warmth to daily note-taking through linen-tinted sidebars, nested inline #tags, and a signature crimson highlight that feels like a red editor's pencil.",
  "theme": "light",
  "mobileStrength": "native-first",
  "tags": [
    "notes-app",
    "markdown",
    "warm-paper",
    "editorial",
    "nested-tags",
    "craft-software"
  ],
  "bestFor": [
    "Personal knowledge bases and Markdown note apps",
    "Long-form journaling and research notebooks",
    "Editorial drafting and wiki workspaces"
  ],
  "palette": [
    {
      "role": "canvas",
      "hex": "#FCFAF8",
      "name": "Warm Snow"
    },
    {
      "role": "surface",
      "hex": "#F4EFEA",
      "name": "Sidebar Linen"
    },
    {
      "role": "ink",
      "hex": "#231F1D",
      "name": "Espresso Ink"
    },
    {
      "role": "accent",
      "hex": "#D94136",
      "name": "Bear Crimson"
    },
    {
      "role": "muted",
      "hex": "#7C726B",
      "name": "Warm Stone"
    }
  ],
  "typography": {
    "display": "Lora",
    "body": "Plus Jakarta Sans",
    "mono": "IBM Plex Mono",
    "googleFontsUrl": "https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Lora:ital,wght@0,500;0,600;1,400&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap",
    "scaleNotes": "Warm Lora serif titles and rendered reading prose (17px/1.75) balanced by crisp 13-14px sans sidebar navigation and mono Markdown editing."
  },
  "layoutNotes": "Classic three-column craft notes layout (Nested #tag tree, searchable note excerpt list, focused Reading/Markdown editor) separated by soft warm-linen hairlines.",
  "interactionNotes": "Filter notes by root or nested #tags, search in real time, create new notes with one click, and switch seamlessly between rendered Reading view and live Markdown source.",
  "mobileNotes": "Transforms cleanly into a 3-tab mobile switcher (Tags / Notes / Editor) with 44px touch targets so writing feels native on 390px screens.",
  "agentGuardrails": {
    "do": [
      "Step background tones gently across columns (#F4EFEA -> #FAF6F2 -> #FCFAF8) for effortless spatial hierarchy",
      "Reserve crimson (#D94136) for active tags, blockquote rules, and inline code accents",
      "Keep the reading column capped around 700px for comfortable long-form legibility"
    ],
    "dont": [
      "Do not use cold blue-gray surfaces that fight the warm editorial palette",
      "Do not squeeze all three columns side-by-side on mobile viewports"
    ]
  },
  "demoFile": "demos/warm-editorial-notes.html",
  "thumbDesktop": "thumbs/warm-editorial-notes-desktop.webp",
  "thumbMobile": "thumbs/warm-editorial-notes-mobile.webp",
  "urls": {
    "page": "https://templates.michaelpitts.net/t/warm-editorial-notes",
    "markdown": "https://templates.michaelpitts.net/t/warm-editorial-notes.md",
    "api": "https://templates.michaelpitts.net/api/templates/warm-editorial-notes",
    "demo": "https://templates.michaelpitts.net/demos/warm-editorial-notes.html",
    "thumbDesktop": "https://templates.michaelpitts.net/thumbs/warm-editorial-notes-desktop.webp",
    "thumbMobile": "https://templates.michaelpitts.net/thumbs/warm-editorial-notes-mobile.webp"
  },
  "agentPrompt": "Design & build using template #057 \"Warm Editorial Notes\" (style / Minimalist Utility & Craft Software, light theme).\nFull AI blueprint & standalone starter code: https://templates.michaelpitts.net/t/warm-editorial-notes.md\nLive demo: https://templates.michaelpitts.net/demos/warm-editorial-notes.html\nReal-world inspiration: Bear (https://bear.app/)\n\nCore aesthetic: Brings tactile bookish warmth to daily note-taking through linen-tinted sidebars, nested inline #tags, and a signature crimson highlight that feels like a red editor's pencil.\nPalette: canvas: #FCFAF8 (Warm Snow), surface: #F4EFEA (Sidebar Linen), ink: #231F1D (Espresso Ink), accent: #D94136 (Bear Crimson), muted: #7C726B (Warm Stone)\nTypography: Display=\"Lora\", Body=\"Plus Jakarta Sans\", Mono=\"IBM Plex Mono\"\nLayout: Classic three-column craft notes layout (Nested #tag tree, searchable note excerpt list, focused Reading/Markdown editor) separated by soft warm-linen hairlines.\nInteractions: Filter notes by root or nested #tags, search in real time, create new notes with one click, and switch seamlessly between rendered Reading view and live Markdown source.\nMobile: Transforms cleanly into a 3-tab mobile switcher (Tags / Notes / Editor) with 44px touch targets so writing feels native on 390px screens.\n\nGuardrails:\n- DO: Step background tones gently across columns (#F4EFEA -> #FAF6F2 -> #FCFAF8) for effortless spatial hierarchy\n- DO: Reserve crimson (#D94136) for active tags, blockquote rules, and inline code accents\n- DO: Keep the reading column capped around 700px for comfortable long-form legibility\n- DON'T: Do not use cold blue-gray surfaces that fight the warm editorial palette\n- DON'T: Do not squeeze all three columns side-by-side on mobile viewports",
  "sourceCode": "<!DOCTYPE html>\n<html lang=\"en\">\n<head>\n  <meta charset=\"UTF-8\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1\">\n  <title>Kodiak — Warm Editorial Markdown Notes</title>\n  <link rel=\"preconnect\" href=\"https://fonts.googleapis.com\">\n  <link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin>\n  <link href=\"https://fonts.googleapis.com/css2?family=IBM+Plex+Mono:wght@400;500&family=Lora:ital,wght@0,500;0,600;1,400&family=Plus+Jakarta+Sans:wght@400;500;600&display=swap\" rel=\"stylesheet\">\n  <style>\n    :root {\n      --canvas: #FCFAF8;\n      --sidebar: #F4EFEA;\n      --list-bg: #FAF6F2;\n      --ink: #231F1D;\n      --accent: #D94136;\n      --accent-soft: #FCECEB;\n      --muted: #7C726B;\n      --border: #E8DFD7;\n      --font-serif: 'Lora', Georgia, serif;\n      --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;\n      --font-mono: 'IBM Plex Mono', ui-monospace, monospace;\n    }\n    *, *::before, *::after { box-sizing: border-box; }\n    html, body {\n      margin: 0;\n      padding: 0;\n      height: 100%;\n      background: var(--canvas);\n      color: var(--ink);\n      font-family: var(--font-sans);\n      overflow-x: hidden;\n    }\n    button, input, textarea { font-family: inherit; }\n\n    .app-shell {\n      display: grid;\n      grid-template-columns: 230px 290px 1fr;\n      min-height: 100vh;\n    }\n\n    /* Mobile top bar */\n    .mobile-bar {\n      display: none;\n      position: sticky;\n      top: 0;\n      z-index: 20;\n      background: var(--sidebar);\n      border-bottom: 1px solid var(--border);\n      padding: 8px 12px;\n      align-items: center;\n      justify-content: space-between;\n      gap: 8px;\n    }\n    .mobile-tabs {\n      display: flex;\n      gap: 6px;\n      width: 100%;\n    }\n    .mobile-tabs button {\n      flex: 1;\n      min-height: 44px;\n      border-radius: 8px;\n      border: 1px solid transparent;\n      background: transparent;\n      color: var(--muted);\n      font-size: 13px;\n      font-weight: 600;\n      cursor: pointer;\n    }\n    .mobile-tabs button.active {\n      background: var(--canvas);\n      color: var(--accent);\n      border-color: var(--border);\n    }\n\n    /* Column 1: Tag Sidebar */\n    .tag-col {\n      background: var(--sidebar);\n      border-right: 1px solid var(--border);\n      padding: 22px 14px;\n      display: flex;\n      flex-direction: column;\n      gap: 18px;\n    }\n    .logo-row {\n      display: flex;\n      align-items: center;\n      gap: 10px;\n      padding: 0 8px;\n    }\n    .logo-mark {\n      width: 30px;\n      height: 30px;\n      border-radius: 8px;\n      background: var(--accent);\n      display: grid;\n      place-items: center;\n      color: #fff;\n      flex-shrink: 0;\n    }\n    .logo-title {\n      font-family: var(--font-serif);\n      font-weight: 600;\n      font-size: 18px;\n      letter-spacing: -0.01em;\n    }\n    .nav-section-label {\n      font-size: 11px;\n      text-transform: uppercase;\n      letter-spacing: 0.08em;\n      color: var(--muted);\n      padding: 0 10px;\n      margin-bottom: 4px;\n    }\n    .tag-list {\n      display: flex;\n      flex-direction: column;\n      gap: 3px;\n    }\n    .tag-btn {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      width: 100%;\n      min-height: 44px;\n      padding: 8px 10px;\n      border: none;\n      border-radius: 8px;\n      background: transparent;\n      color: var(--ink);\n      font-size: 14px;\n      text-align: left;\n      cursor: pointer;\n      transition: background 0.14s;\n    }\n    .tag-btn:hover { background: rgba(217, 65, 54, 0.07); }\n    .tag-btn.active {\n      background: var(--accent-soft);\n      color: var(--accent);\n      font-weight: 600;\n    }\n    .tag-btn.nested { padding-left: 26px; font-size: 13px; }\n    .tag-count {\n      font-family: var(--font-mono);\n      font-size: 11px;\n      color: var(--muted);\n    }\n    .tag-btn.active .tag-count { color: var(--accent); }\n\n    /* Column 2: Note List */\n    .list-col {\n      background: var(--list-bg);\n      border-right: 1px solid var(--border);\n      display: flex;\n      flex-direction: column;\n    }\n    .list-header {\n      padding: 16px;\n      border-bottom: 1px solid var(--border);\n      display: flex;\n      gap: 8px;\n      align-items: center;\n    }\n    .search-input {\n      flex: 1;\n      min-height: 44px;\n      padding: 0 12px;\n      border-radius: 8px;\n      border: 1px solid var(--border);\n      background: var(--canvas);\n      color: var(--ink);\n      font-size: 14px;\n    }\n    .search-input:focus {\n      outline: 2px solid rgba(217, 65, 54, 0.25);\n      border-color: var(--accent);\n    }\n    .new-btn {\n      min-width: 44px;\n      min-height: 44px;\n      border-radius: 8px;\n      border: 1px solid var(--accent);\n      background: var(--accent);\n      color: #fff;\n      font-size: 20px;\n      line-height: 1;\n      cursor: pointer;\n    }\n    .note-cards {\n      overflow-y: auto;\n      padding: 10px;\n      display: flex;\n      flex-direction: column;\n      gap: 8px;\n    }\n    .note-card {\n      text-align: left;\n      width: 100%;\n      padding: 14px;\n      border-radius: 10px;\n      border: 1px solid transparent;\n      background: transparent;\n      cursor: pointer;\n      transition: background 0.14s, border-color 0.14s;\n    }\n    .note-card:hover { background: rgba(255,255,255,0.65); }\n    .note-card.active {\n      background: var(--canvas);\n      border-color: var(--border);\n      box-shadow: 0 2px 8px rgba(35, 31, 29, 0.05);\n    }\n    .note-card-title {\n      font-family: var(--font-serif);\n      font-weight: 600;\n      font-size: 15px;\n      color: var(--ink);\n      margin-bottom: 5px;\n    }\n    .note-card-excerpt {\n      font-size: 13px;\n      color: var(--muted);\n      line-height: 1.45;\n      display: -webkit-box;\n      -webkit-line-clamp: 2;\n      -webkit-box-orient: vertical;\n      overflow: hidden;\n      margin-bottom: 8px;\n    }\n    .note-card-meta {\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      font-size: 11px;\n      color: var(--muted);\n      font-family: var(--font-mono);\n    }\n    .inline-tag {\n      color: var(--accent);\n      background: var(--accent-soft);\n      padding: 2px 6px;\n      border-radius: 4px;\n    }\n\n    /* Column 3: Editorial Editor / Reader */\n    .editor-col {\n      display: flex;\n      flex-direction: column;\n      background: var(--canvas);\n    }\n    .editor-toolbar {\n      padding: 12px 28px;\n      border-bottom: 1px solid var(--border);\n      display: flex;\n      align-items: center;\n      justify-content: space-between;\n      gap: 12px;\n      flex-wrap: wrap;\n    }\n    .mode-switch {\n      display: inline-flex;\n      background: var(--sidebar);\n      padding: 3px;\n      border-radius: 8px;\n      border: 1px solid var(--border);\n    }\n    .mode-switch button {\n      min-height: 38px;\n      padding: 0 14px;\n      border: none;\n      border-radius: 6px;\n      background: transparent;\n      color: var(--muted);\n      font-size: 13px;\n      font-weight: 600;\n      cursor: pointer;\n    }\n    .mode-switch button.active {\n      background: var(--canvas);\n      color: var(--ink);\n      box-shadow: 0 1px 3px rgba(0,0,0,0.06);\n    }\n    .word-stats {\n      font-family: var(--font-mono);\n      font-size: 12px;\n      color: var(--muted);\n    }\n    .editor-canvas {\n      max-width: 700px;\n      width: 100%;\n      margin: 0 auto;\n      padding: 36px 28px 64px;\n      flex: 1;\n    }\n    .doc-title-input {\n      width: 100%;\n      border: none;\n      background: transparent;\n      font-family: var(--font-serif);\n      font-size: clamp(26px, 3.2vw, 34px);\n      font-weight: 600;\n      color: var(--ink);\n      margin-bottom: 14px;\n      padding: 0;\n    }\n    .doc-title-input:focus { outline: none; }\n    .doc-tags-row {\n      display: flex;\n      gap: 6px;\n      flex-wrap: wrap;\n      margin-bottom: 24px;\n    }\n    .doc-tag-pill {\n      font-family: var(--font-mono);\n      font-size: 12px;\n      color: var(--accent);\n      background: var(--accent-soft);\n      padding: 4px 10px;\n      border-radius: 999px;\n    }\n    .markdown-area {\n      width: 100%;\n      min-height: 380px;\n      border: none;\n      background: transparent;\n      color: var(--ink);\n      font-family: var(--font-mono);\n      font-size: 14px;\n      line-height: 1.75;\n      resize: vertical;\n      padding: 0;\n    }\n    .markdown-area:focus { outline: none; }\n    .rendered-doc {\n      font-family: var(--font-serif);\n      font-size: 17px;\n      line-height: 1.75;\n      color: var(--ink);\n    }\n    .rendered-doc h2 {\n      font-size: 21px;\n      margin: 26px 0 10px;\n      color: var(--ink);\n    }\n    .rendered-doc p { margin: 0 0 16px; }\n    .rendered-doc blockquote {\n      margin: 18px 0;\n      padding: 4px 0 4px 18px;\n      border-left: 3px solid var(--accent);\n      color: var(--muted);\n      font-style: italic;\n    }\n    .rendered-doc ul {\n      padding-left: 20px;\n      margin: 0 0 18px;\n    }\n    .rendered-doc li { margin-bottom: 6px; }\n    .rendered-doc code {\n      font-family: var(--font-mono);\n      font-size: 13px;\n      background: var(--sidebar);\n      padding: 2px 6px;\n      border-radius: 4px;\n      color: var(--accent);\n    }\n\n    @media (max-width: 900px) {\n      .app-shell {\n        grid-template-columns: 1fr;\n        min-height: auto;\n      }\n      .mobile-bar { display: flex; }\n      .tag-col, .list-col, .editor-col {\n        display: none;\n        border-right: none;\n        min-height: calc(100vh - 61px);\n      }\n      .tag-col.m-show, .list-col.m-show, .editor-col.m-show {\n        display: flex;\n      }\n      .editor-toolbar { padding: 12px 16px; }\n      .editor-canvas { padding: 24px 16px 48px; }\n    }\n  </style>\n</head>\n<body>\n  <div class=\"mobile-bar\">\n    <div class=\"mobile-tabs\" role=\"tablist\">\n      <button data-pane=\"tags\">Tags</button>\n      <button data-pane=\"list\">Notes</button>\n      <button class=\"active\" data-pane=\"editor\">Editor</button>\n    </div>\n  </div>\n\n  <div class=\"app-shell\">\n    <aside class=\"tag-col\" id=\"paneTags\">\n      <div class=\"logo-row\">\n        <div class=\"logo-mark\" aria-hidden=\"true\">\n          <svg width=\"18\" height=\"18\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\">\n            <path d=\"M5 17c0-4 3-9 7-9s7 5 7 9\"/>\n            <circle cx=\"8\" cy=\"7\" r=\"2.2\"/><circle cx=\"16\" cy=\"7\" r=\"2.2\"/>\n          </svg>\n        </div>\n        <span class=\"logo-title\">Kodiak Notes</span>\n      </div>\n\n      <div>\n        <div class=\"nav-section-label\">Library</div>\n        <div class=\"tag-list\" id=\"tagList\"></div>\n      </div>\n    </aside>\n\n    <section class=\"list-col\" id=\"paneList\">\n      <div class=\"list-header\">\n        <input type=\"search\" class=\"search-input\" id=\"searchInput\" placeholder=\"Search notes or #tags...\">\n        <button class=\"new-btn\" id=\"newNoteBtn\" aria-label=\"Create new note\">+</button>\n      </div>\n      <div class=\"note-cards\" id=\"noteCards\"></div>\n    </section>\n\n    <main class=\"editor-col m-show\" id=\"paneEditor\">\n      <div class=\"editor-toolbar\">\n        <div class=\"mode-switch\" role=\"tablist\">\n          <button class=\"active\" data-mode=\"preview\">Reading</button>\n          <button data-mode=\"edit\">Markdown</button>\n        </div>\n        <div class=\"word-stats\" id=\"wordStats\">142 words · 1 min read</div>\n      </div>\n      <article class=\"editor-canvas\">\n        <input class=\"doc-title-input\" id=\"docTitle\" aria-label=\"Note title\">\n        <div class=\"doc-tags-row\" id=\"docTags\"></div>\n        <div class=\"rendered-doc\" id=\"renderedDoc\"></div>\n        <textarea class=\"markdown-area\" id=\"markdownArea\" hidden aria-label=\"Markdown editor\"></textarea>\n      </article>\n    </main>\n  </div>\n\n  <script>\n    const NOTES = [\n      {\n        id: 'n1',\n        title: 'Notes on Warm Typography for Long-Form Software',\n        tags: ['#craft', '#craft/type'],\n        updated: 'Today, 09:42',\n        body: `Good writing software should feel like heavy cotton paper in morning light, never like a fluorescent spreadsheet.\\n\\n## Three Tactile Principles\\n- Keep line lengths between 60 and 68 characters so the eye glides effortlessly.\\n- Use a warm off-white canvas like \\`#FCFAF8\\` instead of harsh clinical white.\\n- Reserve crimson accents strictly for active tags, headings, and inline emphasis.\\n\\n> \"When the interface steps back by two shades, the writer steps forward.\"`\n      },\n      {\n        id: 'n2',\n        title: 'Autumn Reading List & Marginalia',\n        tags: ['#reading', '#craft'],\n        updated: 'Yesterday',\n        body: `Books worth annotating slowly with a soft pencil.\\n\\n## Current Shelf\\n- The Elements of Typographic Style — Robert Bringhurst\\n- A Pattern Language — Christopher Alexander\\n- How Buildings Learn — Stewart Brand\\n\\n> Every durable tool ages with grace when its structure remains legible.`\n      },\n      {\n        id: 'n3',\n        title: 'Nested Tag Taxonomy for Field Research',\n        tags: ['#craft/type', '#journal'],\n        updated: 'Nov 28',\n        body: `Folders force every thought into a single drawer. Nested tags like \\`#craft/type\\` let a single note belong to both design critique and personal essays.\\n\\n## Naming Rules\\n- Keep root tags singular and lowercase.\\n- Limit depth to two levels so navigation stays calm on mobile screens.`\n      },\n      {\n        id: 'n4',\n        title: 'Kyoto Coffee Roasters & Paper Shops',\n        tags: ['#journal'],\n        updated: 'Nov 21',\n        body: `Morning walk along the Kamo River before opening hours.\\n\\n## Stops to Remember\\n- Weekenders Coffee Tominokoji — washed Ethiopian pour-over.\\n- Kakimori & Takeo Paper — sample books of uncoated cream stock.`\n      }\n    ];\n\n    const TAG_TREE = [\n      { key: 'all', label: 'All Notes', nested: false },\n      { key: '#craft', label: '#craft', nested: false },\n      { key: '#craft/type', label: '#craft/type', nested: true },\n      { key: '#reading', label: '#reading', nested: false },\n      { key: '#journal', label: '#journal', nested: false }\n    ];\n\n    let activeTag = 'all';\n    let activeNoteId = 'n1';\n    let mode = 'preview';\n    let query = '';\n\n    const $ = id => document.getElementById(id);\n\n    function countForTag(tag) {\n      if (tag === 'all') return NOTES.length;\n      return NOTES.filter(n => n.tags.some(t => t === tag || t.startsWith(tag + '/'))).length;\n    }\n\n    function renderTags() {\n      $('tagList').innerHTML = TAG_TREE.map(t => `\n        <button class=\"tag-btn ${t.nested ? 'nested' : ''} ${activeTag === t.key ? 'active' : ''}\" data-tag=\"${t.key}\">\n          <span>${t.label}</span>\n          <span class=\"tag-count\">${countForTag(t.key)}</span>\n        </button>\n      `).join('');\n      $('tagList').querySelectorAll('.tag-btn').forEach(btn => {\n        btn.addEventListener('click', () => {\n          activeTag = btn.dataset.tag;\n          renderTags();\n          renderList();\n          showMobilePane('list');\n        });\n      });\n    }\n\n    function filteredNotes() {\n      return NOTES.filter(n => {\n        const matchTag = activeTag === 'all' || n.tags.some(t => t === activeTag || t.startsWith(activeTag + '/'));\n        const q = query.trim().toLowerCase();\n        const matchQ = !q || n.title.toLowerCase().includes(q) || n.body.toLowerCase().includes(q) || n.tags.join(' ').toLowerCase().includes(q);\n        return matchTag && matchQ;\n      });\n    }\n\n    function renderList() {\n      const list = filteredNotes();\n      if (list.length && !list.some(n => n.id === activeNoteId)) {\n        activeNoteId = list[0].id;\n        renderEditor();\n      }\n      $('noteCards').innerHTML = list.map(n => `\n        <button class=\"note-card ${n.id === activeNoteId ? 'active' : ''}\" data-id=\"${n.id}\">\n          <div class=\"note-card-title\">${n.title}</div>\n          <div class=\"note-card-excerpt\">${n.body.replace(/[#>*`]/g, '')}</div>\n          <div class=\"note-card-meta\">\n            <span class=\"inline-tag\">${n.tags[0] || '#note'}</span>\n            <span>${n.updated}</span>\n          </div>\n        </button>\n      `).join('') || `<div style=\"padding:20px;color:var(--muted);font-size:14px;\">No notes match this filter.</div>`;\n\n      $('noteCards').querySelectorAll('.note-card').forEach(card => {\n        card.addEventListener('click', () => {\n          activeNoteId = card.dataset.id;\n          renderList();\n          renderEditor();\n          showMobilePane('editor');\n        });\n      });\n    }\n\n    function mdToHtml(md) {\n      const esc = s => s.replace(/&/g, '&amp;').replace(/</g, '&lt;').replace(/>/g, '&gt;');\n      const inline = s => esc(s).replace(/`([^`]+)`/g, '<code>$1</code>');\n      const lines = md.split('\\n');\n      let out = '', inList = false;\n      for (const raw of lines) {\n        const line = raw.trim();\n        if (!line) {\n          if (inList) { out += '</ul>'; inList = false; }\n          continue;\n        }\n        if (line.startsWith('- ')) {\n          if (!inList) { out += '<ul>'; inList = true; }\n          out += `<li>${inline(line.slice(2))}</li>`;\n        } else {\n          if (inList) { out += '</ul>'; inList = false; }\n          if (line.startsWith('## ')) out += `<h2>${inline(line.slice(3))}</h2>`;\n          else if (line.startsWith('> ')) out += `<blockquote>${inline(line.slice(2))}</blockquote>`;\n          else out += `<p>${inline(line)}</p>`;\n        }\n      }\n      if (inList) out += '</ul>';\n      return out;\n    }\n\n    function updateStats(text) {\n      const words = text.trim() ? text.trim().split(/\\s+/).length : 0;\n      const mins = Math.max(1, Math.round(words / 200));\n      $('wordStats').textContent = `${words} words · ${mins} min read`;\n    }\n\n    function renderEditor() {\n      const note = NOTES.find(n => n.id === activeNoteId) || NOTES[0];\n      $('docTitle').value = note.title;\n      $('docTags').innerHTML = note.tags.map(t => `<span class=\"doc-tag-pill\">${t}</span>`).join('');\n      $('markdownArea').value = note.body;\n      $('renderedDoc').innerHTML = mdToHtml(note.body);\n      $('renderedDoc').hidden = mode !== 'preview';\n      $('markdownArea').hidden = mode !== 'edit';\n      updateStats(note.title + ' ' + note.body);\n    }\n\n    $('docTitle').addEventListener('input', e => {\n      const note = NOTES.find(n => n.id === activeNoteId);\n      if (note) { note.title = e.target.value; renderList(); updateStats(note.title + ' ' + note.body); }\n    });\n\n    $('markdownArea').addEventListener('input', e => {\n      const note = NOTES.find(n => n.id === activeNoteId);\n      if (note) {\n        note.body = e.target.value;\n        $('renderedDoc').innerHTML = mdToHtml(note.body);\n        renderList();\n        updateStats(note.title + ' ' + note.body);\n      }\n    });\n\n    $('searchInput').addEventListener('input', e => {\n      query = e.target.value;\n      renderList();\n    });\n\n    $('newNoteBtn').addEventListener('click', () => {\n      const id = 'n' + (NOTES.length + 1);\n      const tag = activeTag === 'all' ? '#journal' : activeTag;\n      NOTES.unshift({\n        id,\n        title: 'Untitled Field Note',\n        tags: [tag],\n        updated: 'Just now',\n        body: 'Begin writing in plain Markdown.\\n\\n- Capture an observation\\n- Link it with a nested tag'\n      });\n      activeNoteId = id;\n      mode = 'edit';\n      document.querySelectorAll('[data-mode]').forEach(b => b.classList.toggle('active', b.dataset.mode === 'edit'));\n      renderTags();\n      renderList();\n      renderEditor();\n      showMobilePane('editor');\n    });\n\n    document.querySelectorAll('[data-mode]').forEach(btn => {\n      btn.addEventListener('click', () => {\n        mode = btn.dataset.mode;\n        document.querySelectorAll('[data-mode]').forEach(b => b.classList.toggle('active', b === btn));\n        renderEditor();\n      });\n    });\n\n    function showMobilePane(pane) {\n      $('paneTags').classList.toggle('m-show', pane === 'tags');\n      $('paneList').classList.toggle('m-show', pane === 'list');\n      $('paneEditor').classList.toggle('m-show', pane === 'editor');\n      document.querySelectorAll('[data-pane]').forEach(b => b.classList.toggle('active', b.dataset.pane === pane));\n    }\n    document.querySelectorAll('[data-pane]').forEach(btn => {\n      btn.addEventListener('click', () => showMobilePane(btn.dataset.pane));\n    });\n\n    renderTags();\n    renderList();\n    renderEditor();\n  </script>\n</body>\n</html>\n"
}
