/*
 * public-inbox-override.css
 * Requires: public-inbox-reflow.js
 * License: CC0-1.0
 */

:root {
  --bg:          #fafaf8;
  --bg-surface:  #ffffff;
  --bg-header:   #f5f4f1;
  --text:        #2c2c2c;
  --text-muted:  #6b6b6b;
  --text-faint:  #9a9a9a;
  --accent:      #c45d2c;
  --accent-soft: #f0e0d4;
  --link:        #2563a0;
  --link-visited:#6b4f8a;
  --border:      #e2e0db;
  --border-light:#eeedea;
  --quote:       #557a95;
  --radius:      6px;
  --shadow:      0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
  --max-width:   52rem;
  --font-sans:   -apple-system, BlinkMacSystemFont, 'Segoe UI', Helvetica, Arial, sans-serif;
  --font-mono:   ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg:          #1a1a1d;
    --bg-surface:  #232327;
    --bg-header:   #2a2a2e;
    --text:        #dcdcdc;
    --text-muted:  #9a9a9a;
    --text-faint:  #666;
    --accent:      #e07a4a;
    --accent-soft: #3d2a1e;
    --link:        #6dade0;
    --link-visited:#b89ad4;
    --border:      #3a3a3e;
    --border-light:#2e2e32;
    --quote:       #7ab0cc;
    --shadow:      0 1px 3px rgba(0,0,0,0.3);
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 2rem 1.25rem 4rem;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  line-height: 1.7;
}

body > pre, body > hr {
  max-width: var(--max-width);
  margin-left: auto;
  margin-right: auto;
}

pre {
  font-family: inherit;
  font-size: 0.875rem;
  line-height: 1.7;
  white-space: pre-wrap;
  word-wrap: break-word;
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem 1.75rem;
  margin: 0.75rem auto;
  max-width: var(--max-width);
  box-shadow: var(--shadow);
}

/* Nav bar — class applied by JS, not by :first-of-type */
pre.pi-nav {
  border-bottom: 2px solid var(--accent);
  border-radius: var(--radius) var(--radius) 0 0;
  padding: 1rem 1.75rem;
  font-size: 0.8125rem;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 0;
}
pre.pi-nav b {
  display: block;
  font-size: 1.25rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  text-transform: none;
  color: var(--text);
  margin-bottom: 0.25rem;
}

/* Footer */
pre.pi-footer {
  background: var(--bg);
  border-color: var(--border-light);
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Message separators */
body > pre + hr + pre { border-top: 3px solid var(--accent-soft); }
hr { border: none; border-top: 1px solid var(--border-light); margin: 0.25rem auto; }

/* Links */
a:link { color: var(--link); text-decoration: none; }
a:visited { color: var(--link-visited); }
a:hover { text-decoration: underline; }

/* Quoted text, diffs */
.q { color: var(--quote); font-style: italic; opacity: 0.85; }
.add { color: #2d6a2e; background: #e6f4e2; }
.del { color: #a03030; background: #fbe8e8; }
.hunk { color: #8b6914; font-weight: 500; }
pre b { font-weight: 600; }

/* ── JS-generated: thread view ───────────────────────── */

.pi-title {
  white-space: normal;
  font-size: 1.15rem;
  font-weight: 700;
  line-height: 1.35;
  margin: 0 0 0.75rem;
  letter-spacing: -0.01em;
}

.pi-header-block {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  line-height: 1.65;
  white-space: pre-wrap;
  background: var(--bg-header);
  border: 1px solid var(--border-light);
  border-radius: 4px;
  padding: 0.75rem 1rem;
  margin: 0 0 1rem;
  color: var(--text-muted);
}
.pi-header-block .pi-author { font-weight: 600; color: var(--text); }

.pi-paragraph { display: block; white-space: normal; margin: 0.4em 0; }

.pi-meta {
  display: block;
  white-space: pre-wrap;
  font-family: var(--font-mono);
  font-size: 0.8125rem;
  line-height: 1.75;
}

.pi-paragraph.pi-quoted {
  color: var(--quote);
  font-style: italic;
  opacity: 0.85;
  padding-left: 0.75em;
  border-left: 2px solid var(--accent-soft);
}

/* ── JS-generated: index view ────────────────────────── */

.pi-index-entry {
  padding: 0.6rem 0;
  border-bottom: 1px solid var(--border-light);
}
.pi-index-entry:last-child { border-bottom: none; }

.pi-index-title {
  font-weight: 600;
  font-size: 0.875rem;
  line-height: 1.4;
  white-space: normal;
}

.pi-index-meta {
  font-size: 0.75rem;
  color: var(--text-faint);
  margin-top: 0.15rem;
}

.pi-index-replies {
  font-size: 0.6875rem;
  color: var(--text-faint);
  margin-left: 0.5rem;
}

.pi-index-reply-link {
  display: block;
  font-size: 0.75rem;
  color: var(--text-faint);
  padding-left: 1rem;
  margin-top: 0.1rem;
}

/* ── Responsive ──────────────────────────────────────── */

@media (max-width: 640px) {
  body { padding: 1rem 0.75rem 3rem; }
  pre { padding: 1rem; border-radius: 4px; }
  .pi-title { font-size: 1rem; }
  .pi-header-block { font-size: 0.6875rem; padding: 0.5rem 0.75rem; }
}
