/* ── multiRF Package Documentation ── */
/* Academic style: serif body, clean tables, subdued palette */

:root {
  --bg: #fcfcfb;
  --surface: #ffffff;
  --ink: #1e293b;
  --body: #334155;
  --muted: #64748b;
  --accent: #1e40af;
  --accent-light: #dbeafe;
  --accent-bg: #eff6ff;
  --line: #e2e8f0;
  --code-bg: #f8fafc;
  --code-border: #e2e8f0;
  --radius: 4px;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Palatino Linotype', 'Book Antiqua', Palatino, 'Georgia', 'Times New Roman', serif;
  color: var(--body);
  background: var(--bg);
  line-height: 1.72;
  font-size: 15.5px;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, Arial, sans-serif;
  color: var(--ink);
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

code, pre {
  font-family: 'SFMono-Regular', 'Fira Code', Menlo, Consolas, 'Liberation Mono', monospace;
  font-size: 13px;
}

pre {
  padding: 14px 18px;
  overflow-x: auto;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
  line-height: 1.55;
  margin: 12px 0;
}

code {
  background: #f1f5f9;
  padding: 1px 5px;
  border-radius: 3px;
  font-size: 0.88em;
}

pre code {
  background: none;
  padding: 0;
  border-radius: 0;
  font-size: 13px;
}

/* ── Header ── */
.site-header {
  border-bottom: 3px solid var(--ink);
  padding: 18px 0 14px;
  margin-bottom: 0;
  background: var(--surface);
}

.site-header-inner {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px;
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}

.site-title {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.site-title span {
  font-weight: 400;
  color: var(--muted);
  font-size: 14px;
  margin-left: 10px;
}

.site-nav {
  display: flex;
  gap: 20px;
  list-style: none;
}

.site-nav a {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.site-nav a:hover { color: var(--ink); text-decoration: none; }

/* ── Page Container ── */
.page {
  max-width: 960px;
  margin: 0 auto;
  padding: 0 28px 60px;
}

/* ── Title Block (like a paper header) ── */
.title-block {
  padding: 36px 0 28px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 32px;
}

.title-block h1 {
  font-size: 28px;
  font-weight: 700;
  line-height: 1.25;
  letter-spacing: -0.02em;
  margin-bottom: 10px;
}

.title-block .subtitle {
  font-size: 16px;
  color: var(--muted);
  line-height: 1.6;
  max-width: 680px;
}

.title-block .meta-row {
  display: flex;
  gap: 28px;
  margin-top: 16px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 13px;
  color: var(--muted);
}

.title-block .meta-row strong {
  color: var(--ink);
  font-weight: 600;
}

/* ── Layout: sidebar + content ── */
.layout {
  display: grid;
  grid-template-columns: 180px minmax(0, 1fr);
  gap: 40px;
  align-items: start;
}

/* ── Sidebar TOC ── */
.toc {
  position: sticky;
  top: 24px;
  padding-top: 4px;
}

.toc-label {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--muted);
  margin-bottom: 10px;
}

.toc ul { list-style: none; }

.toc li { margin: 1px 0; }

.toc a {
  display: block;
  padding: 4px 10px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 13px;
  color: var(--muted);
  border-left: 2px solid transparent;
  transition: all 0.12s;
}
.toc a:hover {
  color: var(--ink);
  border-left-color: var(--accent);
  background: #f8fafc;
  text-decoration: none;
}

/* ── Main Content ── */
.content { display: grid; gap: 0; }

.section {
  padding: 28px 0;
  border-bottom: 1px solid var(--line);
}

.section:last-of-type {
  border-bottom: none;
}

.section h2 {
  font-size: 20px;
  font-weight: 700;
  margin-bottom: 14px;
  letter-spacing: -0.01em;
}

.section h3 {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 14px;
  font-weight: 650;
  margin: 22px 0 8px;
  color: var(--ink);
}

.section p {
  margin-bottom: 12px;
}

.section ul, .section ol {
  padding-left: 22px;
  margin-bottom: 12px;
}

.section li {
  margin: 4px 0;
  line-height: 1.7;
}

/* ── Tables ── */
.ref-table {
  width: 100%;
  border-collapse: collapse;
  margin: 12px 0;
  font-size: 14px;
  line-height: 1.5;
}

.ref-table thead {
  border-bottom: 2px solid var(--ink);
}

.ref-table th {
  text-align: left;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 12px;
  font-weight: 650;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--ink);
  padding: 8px 10px;
}

.ref-table td {
  padding: 8px 10px;
  border-bottom: 1px solid #f1f5f9;
  vertical-align: top;
}

.ref-table tbody tr:hover {
  background: #fafbfc;
}

.ref-table code { font-size: 12.5px; }

/* ── Two-column grid ── */
.grid-2 {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  margin: 12px 0;
}

.grid-2 > div {
  padding: 14px;
  background: var(--code-bg);
  border: 1px solid var(--code-border);
  border-radius: var(--radius);
}

.grid-2 > div > strong {
  display: block;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--accent);
  margin-bottom: 8px;
}

.grid-2 pre {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
}

/* ── Callout / Note ── */
.note {
  padding: 12px 16px;
  border-left: 3px solid var(--accent);
  background: var(--accent-bg);
  font-size: 14px;
  margin: 14px 0;
  border-radius: 0 var(--radius) var(--radius) 0;
}

.note strong {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
}

/* ── Install block ── */
.install-cmd {
  background: #1e293b;
  color: #e2e8f0;
  padding: 14px 18px;
  border-radius: var(--radius);
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 14px;
  margin: 10px 0;
}

.install-cmd .prompt { color: #60a5fa; user-select: none; }

/* ── Chip / Tag ── */
.chip-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 10px 0;
}

.chip {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 3px;
  font-family: 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 12px;
  background: #f1f5f9;
  color: var(--body);
  border: 1px solid var(--line);
}

/* ── R Output Block ── */
pre.r-output {
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-left: 3px solid #94a3b8;
  border-radius: 0 var(--radius) var(--radius) 0;
  color: #475569;
  font-size: 12.5px;
  padding: 12px 16px;
  margin: -4px 0 12px;
  line-height: 1.5;
  white-space: pre-wrap;
  word-break: break-word;
}

pre.r-output .comment { color: #94a3b8; }

/* ── Plot figures ── */
.plot-figure {
  margin: 16px 0;
  text-align: center;
}

.plot-figure img {
  max-width: 100%;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
}

.plot-figure figcaption {
  margin-top: 8px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 12px;
  color: var(--muted);
  font-style: italic;
}

/* ── Footer ── */
.site-footer {
  text-align: center;
  padding: 28px 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Inter, Helvetica, sans-serif;
  font-size: 13px;
  color: var(--muted);
  border-top: 1px solid var(--line);
  margin-top: 20px;
}

/* ── Responsive ── */
@media (max-width: 768px) {
  .layout { grid-template-columns: 1fr; }
  .toc { display: none; }
  .grid-2 { grid-template-columns: 1fr; }
  .site-header-inner { flex-direction: column; gap: 8px; }
  .title-block .meta-row { flex-direction: column; gap: 6px; }
}
