/* Metaculus-inspired styling for the API docs.
   Palette: deep blue-slate surfaces, Metaculus blue accents, olive highlight. */

:root {
  --metac-ink: #242f3d;          /* body text */
  --metac-navy: #2c3947;         /* headings */
  --metac-blue: #4667a5;         /* links / accents */
  --metac-blue-dark: #35507f;
  --metac-olive: #a99e4c;        /* Metaculus olive highlight */
  --metac-border: #e2e6ea;
  --metac-code-bg: #f4f6f8;
  --metac-surface: #ffffff;
  --metac-muted: #6b7785;
  --metac-page-bg: #f7f9fb;
}

* { box-sizing: border-box; }

/* Page background spans the full viewport; the body is the centered column. */
html { background: var(--metac-page-bg); }

/* Constrain and center the body itself as the content column. Centering the
   body (rather than each child) keeps every element aligned to the same column,
   even those with their own `margin: X 0` rules (tables, pandoc's code blocks). */
body {
  font-family: "Inter", "Helvetica Neue", system-ui, -apple-system, sans-serif;
  line-height: 1.65;
  color: var(--metac-ink);
  max-width: 52rem;
  margin: 0 auto;
  padding: 3rem 1.25rem;
}

h1, h2, h3, h4 {
  color: var(--metac-navy);
  line-height: 1.25;
  font-weight: 700;
}

h1 {
  font-size: 2.25rem;
  border-bottom: 3px solid var(--metac-olive);
  padding-bottom: 0.5rem;
  margin-top: 0;
}

h2 {
  font-size: 1.6rem;
  margin-top: 3rem;
  border-bottom: 1px solid var(--metac-border);
  padding-bottom: 0.35rem;
}

h3 { font-size: 1.25rem; margin-top: 2rem; }
h4 { font-size: 1.05rem; color: var(--metac-blue-dark); }

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

/* Horizontal rules become subtle section breaks. */
hr {
  border: none;
  border-top: 1px solid var(--metac-border);
  margin: 3rem 0;
}

/* Inline + block code. */
code {
  font-family: "SF Mono", "JetBrains Mono", ui-monospace, Menlo, monospace;
  font-size: 0.88em;
  background: var(--metac-code-bg);
  padding: 0.15em 0.4em;
  border-radius: 4px;
  color: var(--metac-blue-dark);
}

pre {
  background: var(--metac-navy);
  color: #e8edf2;
  padding: 1.1rem 1.25rem;
  border-radius: 8px;
  overflow-x: auto;
  line-height: 1.5;
}

pre code {
  background: transparent;
  color: inherit;
  padding: 0;
  font-size: 0.85rem;
}

/* Pandoc's highlighting colors are for a light background, and unreadable on
   this one. */
pre code span[class] { color: inherit; }

/* Tables — clean rows, Metaculus navy header. */
table {
  border-collapse: collapse;
  width: 100%;
  margin: 1.5rem 0;
  background: var(--metac-surface);
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 1px 3px rgba(36, 47, 61, 0.06);
}

th, td {
  text-align: left;
  padding: 0.6rem 0.9rem;
  border-bottom: 1px solid var(--metac-border);
}

th {
  background: var(--metac-navy);
  color: #fff;
  font-weight: 600;
}

tr:last-child td { border-bottom: none; }
tbody tr:nth-child(even) { background: #fafbfc; }

blockquote {
  border-left: 4px solid var(--metac-olive);
  margin: 1.5rem 0;
  padding: 0.25rem 1rem;
  color: var(--metac-muted);
}

/* Tabs, from radio buttons: no script needed. A browser without :has() shows
   every panel in turn, which still reads fine. */
.tabs { margin: 1.5rem 0; }

.tab-bar {
  position: relative;
  border-bottom: 1px solid var(--metac-border);
}

.tab-bar p {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin: 0;
}

.tab-bar input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  margin: 0;
}

.tab-bar label {
  padding: 0.5rem 0.9rem;
  border-bottom: 3px solid transparent;
  color: var(--metac-muted);
  font-weight: 600;
  cursor: pointer;
}

.tab-bar label:hover { color: var(--metac-navy); }

.tab-bar input:checked + label {
  color: var(--metac-blue-dark);
  border-bottom-color: var(--metac-olive);
}

.tab-bar input:focus-visible + label {
  outline: 2px solid var(--metac-blue);
  outline-offset: -2px;
}

.tabs:has(.tab-bar input:checked) .tab-panel { display: none; }

.tabs:has(#example-binary:checked) .tab-binary,
.tabs:has(#example-multiple-choice:checked) .tab-multiple-choice,
.tabs:has(#example-numeric:checked) .tab-numeric,
.tabs:has(#example-date:checked) .tab-date,
.tabs:has(#example-discrete:checked) .tab-discrete { display: block; }

/* Responsive tweaks. */
@media (max-width: 640px) {
  body { padding: 1.5rem 1rem; }
  h1 { font-size: 1.8rem; }
}
