/* process-hub reader styles — clean, calm typography (visual polish is owned
 * by UX in Phase 3; this is the structural baseline). System fonts only, no
 * external resources — the site must work offline from file://. */

:root {
  --background: #fdfdfc;
  --surface: #f6f6f4;
  --border: #e3e3df;
  --text: #2b2f33;
  --muted: #6e747b;
  --accent: #3d5a6c;
  --accent-soft: #edf2f4;
  --code-bg: #f3f3f0;
}

* {
  box-sizing: border-box;
}

html {
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--background);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.7;
}

.layout {
  display: flex;
  min-height: 100vh;
}

/* Sidebar */

.sidebar {
  flex: 0 0 260px;
  border-right: 1px solid var(--border);
  background: var(--surface);
  padding: 2rem 1.25rem;
}

.site-title {
  display: block;
  font-size: 1.05rem;
  font-weight: 650;
  letter-spacing: 0.01em;
  color: var(--text);
  text-decoration: none;
  margin-bottom: 1.5rem;
}

#nav a {
  display: block;
  padding: 0.35rem 0.6rem;
  margin: 0.1rem 0;
  border-radius: 6px;
  color: var(--muted);
  text-decoration: none;
  font-size: 0.95rem;
}

#nav a:hover {
  color: var(--text);
  background: var(--accent-soft);
}

#nav a.active {
  color: var(--accent);
  background: var(--accent-soft);
  font-weight: 600;
}

/* Content */

.content {
  flex: 1;
  padding: 2.5rem 1.5rem;
  min-width: 0;
}

#article {
  max-width: 46rem;
  margin: 0 auto;
}

.page-header h1 {
  font-size: 1.9rem;
  line-height: 1.25;
  font-weight: 650;
  margin: 0 0 1.75rem;
  letter-spacing: -0.01em;
}

/* Prose (rendered markdown) */

.prose-body h1,
.prose-body h2,
.prose-body h3,
.prose-body h4,
.prose-body h5,
.prose-body h6 {
  font-weight: 650;
  line-height: 1.3;
  margin: 2em 0 0.6em;
  letter-spacing: -0.01em;
}

.prose-body h1 {
  font-size: 1.45rem;
}

.prose-body h2 {
  font-size: 1.25rem;
}

.prose-body h3 {
  font-size: 1.1rem;
}

.prose-body p,
.prose-body ul,
.prose-body ol,
.prose-body blockquote,
.prose-body pre,
.prose-body table {
  margin: 0 0 1.1em;
}

.prose-body ul,
.prose-body ol {
  padding-left: 1.5rem;
}

.prose-body li {
  margin: 0.25rem 0;
}

.prose-body li > ul,
.prose-body li > ol {
  margin: 0.25rem 0 0.35rem;
}

.prose-body a {
  color: var(--accent);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.prose-body blockquote {
  border-left: 3px solid var(--border);
  padding: 0.15rem 0 0.15rem 1rem;
  color: var(--muted);
}

.prose-body code {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 4px;
  padding: 0.1em 0.35em;
  font-size: 0.875em;
  font-family: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas, monospace;
}

.prose-body pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.9rem 1rem;
  overflow-x: auto;
}

.prose-body pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: 0.85rem;
  line-height: 1.55;
}

.prose-body table {
  border-collapse: collapse;
  width: 100%;
  font-size: 0.95rem;
}

.prose-body th,
.prose-body td {
  border: 1px solid var(--border);
  padding: 0.45rem 0.7rem;
  text-align: left;
}

.prose-body th {
  background: var(--surface);
  font-weight: 600;
}

.prose-body img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}

.prose-body hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 2rem 0;
}

.prose-body input[type="checkbox"] {
  margin-right: 0.35rem;
}

/* Attachments */

.attachments {
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.attachments h2 {
  font-size: 0.85rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  margin: 0 0 0.5rem;
}

.attachments ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.attachments a {
  color: var(--accent);
  font-size: 0.95rem;
}

/* Pager (prev/next) */

.pager {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  margin-top: 2.5rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}

.pager-link {
  display: flex;
  flex-direction: column;
  max-width: 48%;
  padding: 0.6rem 0.8rem;
  border: 1px solid var(--border);
  border-radius: 8px;
  text-decoration: none;
}

.pager-link:hover {
  border-color: var(--accent);
}

.pager-link.next {
  margin-left: auto;
  text-align: right;
}

.pager-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.pager-title {
  color: var(--accent);
  font-weight: 600;
  font-size: 0.95rem;
}

/* Errors and empty states */

.error {
  background: #fdf3f2;
  border: 1px solid #f0cfc7;
  border-radius: 8px;
  padding: 0.9rem 1.1rem;
  color: #8a3b2e;
}

/* Small screens: stack the sidebar above the content */

@media (max-width: 800px) {
  .layout {
    flex-direction: column;
  }

  .sidebar {
    flex: none;
    border-right: none;
    border-bottom: 1px solid var(--border);
    padding: 1.25rem;
  }

  .content {
    padding: 1.5rem 1rem;
  }
}

/* Print: content only */

@media print {
  .sidebar,
  .pager {
    display: none;
  }

  .content {
    padding: 0;
  }
}