/* stack viewer — the public reading surface. Same design tokens as the editor,
   tuned for reading rather than editing. Light/dark via prefers-color-scheme. */

:root {
  --bg: #fbfbfc;
  --surface: #ffffff;
  --surface-2: #f0f2f5;
  --border: #e3e6ea;
  --text: #1c2024;
  --text-dim: #5b6470;
  --primary: #2f6feb;

  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 24px;
  --s-6: 32px;

  --radius: 8px;
  --radius-sm: 5px;
  --font: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --serif: ui-serif, Georgia, "Times New Roman", serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", Menlo, monospace;
  --shadow: 0 1px 2px rgba(0,0,0,.06), 0 4px 12px rgba(0,0,0,.04);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1216;
    --surface: #171b21;
    --surface-2: #1f242c;
    --border: #2a313b;
    --text: #e6e9ee;
    --text-dim: #9aa4b2;
    --primary: #5b8def;
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 6px 18px rgba(0,0,0,.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--mono); background: var(--surface-2); padding: 1px 5px; border-radius: var(--radius-sm); font-size: .9em; }

.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: var(--s-3) var(--s-5);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}
.brand { font-weight: 700; font-size: 1.1rem; color: var(--text); }
.brand span { color: var(--primary); }
.brand:hover { text-decoration: none; }

.page { max-width: 720px; margin: 0 auto; padding: var(--s-6) var(--s-5); }

h1 { font-size: 1.8rem; margin: 0 0 var(--s-4); line-height: 1.2; }

.crumbs { color: var(--text-dim); font-size: .9rem; margin-bottom: var(--s-5); }
.crumbs b { color: var(--text); }

.list-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-4); }
.feed-link { font-size: .85rem; }

/* content-type cards on the home page */
.cards { list-style: none; padding: 0; margin: var(--s-5) 0 0; display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: var(--s-4); }
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow); }
.card a { display: block; padding: var(--s-5); color: var(--text); }
.card a:hover { text-decoration: none; border-color: var(--primary); }
.card h2 { font-size: 1.1rem; margin: 0; }
.card p { margin: var(--s-1) 0 0; color: var(--text-dim); font-size: .9rem; }

/* the published-document index */
.articles { list-style: none; padding: 0; margin: var(--s-5) 0 0; display: flex; flex-direction: column; gap: var(--s-1); }
.articles li { border-bottom: 1px solid var(--border); }
.articles li:last-child { border-bottom: none; }
.articles a { display: block; padding: var(--s-3) 0; font-size: 1.1rem; }

.empty { color: var(--text-dim); padding: var(--s-5); background: var(--surface); border: 1px dashed var(--border); border-radius: var(--radius); margin-top: var(--s-5); }

/* the rendered article body — statichtml's fragment lands inside .content.
   Each canonical field becomes a <section>; rich text becomes paragraphs,
   headings, lists. Style generically since the field set is open. */
.content { font-family: var(--serif); font-size: 1.12rem; }
.content article { margin: 0; }
.content section { margin: 0 0 var(--s-5); }
.content section[data-field]::before {
  content: attr(data-field);
  display: block;
  font-family: var(--font);
  font-size: .72rem; text-transform: uppercase; letter-spacing: .05em;
  color: var(--text-dim); margin-bottom: var(--s-1);
}
.content p { margin: 0 0 var(--s-3); }
.content h1, .content h2, .content h3 { font-family: var(--font); line-height: 1.25; }
.content ul, .content dl { margin: 0 0 var(--s-3); }
