/* Methodology page: long-form documentation styled as a plain scientific
   paper. It reuses the palette tokens from public.css but deliberately drops
   the public page's ornament -- the ink hero, the orange accents, the shaded
   boxes and coloured rules -- for a sober, monochrome, print-like reading
   surface. Colour is not used to decorate here; structure comes from
   typography, whitespace and hairline rules.

   The running prose is set in the serif face (var(--serif)) for a journal feel;
   headings share it, while dense data (tables, source list) stay in the UI sans
   for legibility. */

/* --- Language toggle: show one tree, hide the other --- */
html.lang-en .only-fr { display: none; }
html.lang-fr .only-en { display: none; }

/* --- Masthead: a plain title block on paper, not the dark public hero --- */
.hero-doc {
  background: var(--bg);
  background-image: none;
  color: var(--text);
  border-bottom: 1px solid var(--border-strong);
  overflow: visible;
}

.hero-doc .hero-inner { padding: 22px 20px 30px; }

.hero-doc .brand { color: var(--muted); }
.hero-doc .btc-mark { color: var(--muted); }

.hero-doc .kicker {
  color: var(--muted);
  margin-top: 30px;
}

.hero-doc h1 {
  font-size: clamp(27px, 4.4vw, 41px);
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.01em;
  max-width: 780px;
}

.hero-doc .tagline {
  max-width: 640px;
  color: var(--muted);
  font-size: 15.5px;
}

/* Language switch, restyled for the light masthead (public.css assumes the
   dark hero). The SSR replaces the buttons with <a> links. */
.hero-doc .lang-toggle a {
  color: var(--muted);
  border-color: var(--border-strong);
}

.hero-doc .lang-toggle a[aria-current="true"] {
  background: var(--text);
  color: var(--bg);
  border-color: var(--text);
}

.hero-nav {
  margin: 26px 0 0;
  font-size: 13.5px;
}

.hero-doc .hero-nav a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
  border-bottom: none;
  padding-bottom: 0;
}

.hero-doc .hero-nav a:hover { text-decoration-color: var(--text); }
.hero-nav .sep, footer .sep { color: var(--border-strong); margin: 0 10px; }

/* --- Document body: same width as the masthead, so the two align --- */
.doc { max-width: 960px; counter-reset: eqn; }

.doc article { margin-top: 12px; }

.doc section { margin-top: 42px; }
.doc section:first-of-type { margin-top: 10px; }

.doc h2 {
  font-family: var(--serif);
  font-size: 22px;
  font-weight: 700;
  margin: 0 0 16px;
  padding-bottom: 8px;
  border-bottom: 1px solid var(--border-strong);
}

/* Drop the public page's orange accent bar above each section heading; the
   bottom hairline alone carries the structure here. */
.doc section > h2::before { display: none; }

.doc h3 {
  font-family: var(--serif);
  font-size: 17px;
  font-weight: 700;
  margin: 26px 0 6px;
}

/* Running prose set in serif, at a comfortable reading measure. */
.doc p,
.doc li,
.doc dt,
.doc dd {
  font-family: var(--serif);
}

.doc p {
  margin: 0 0 14px;
  font-size: 16px;
  line-height: 1.66;
  color: var(--text);
}

.doc p em { font-style: italic; }
.doc strong { color: var(--text); }

/* Monochrome links: dark text, a hairline underline that darkens on hover. */
.doc a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.doc a:hover { text-decoration-color: var(--text); }

.doc code {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 0.85em;
  background: #f1f1ea;
  border-radius: 2px;
  padding: 1px 4px;
}

/* --- Table of contents: a plain single-column list, no box, no top rule --- */
.toc {
  background: none;
  border: none;
  border-bottom: 1px solid var(--border);
  padding: 0 0 14px;
  margin-bottom: 8px;
}

.toc h2 {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  border: none;
  margin: 0 0 8px;
  padding: 0;
}

.toc ol {
  margin: 0;
  padding-left: 20px;
  font-size: 14px;
}

.toc li { margin-bottom: 4px; font-family: var(--serif); }
.toc a { color: var(--text); text-decoration: none; }
.toc a:hover { text-decoration: underline; }

/* --- Display equations: centred, unshaded, hairline-separated --- */
.formula {
  font-family: "SF Mono", ui-monospace, Menlo, Consolas, monospace;
  font-size: 14px;
  line-height: 1.95;
  background: none;
  border: none;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  padding: 12px 4px;
  margin: 14px 0 18px;
  text-align: center;
  overflow-x: auto;
}

.formula .unit {
  color: var(--muted);
  font-style: normal;
  margin-left: 10px;
}

.formula sub { font-size: 0.8em; }

/* --- Documentation tables (kept in the sans UI face for tabular density) --- */
.doc-table {
  width: 100%;
  border-collapse: collapse;
  margin: 8px 0 8px;
  font-size: 13.5px;
}

.doc-table th,
.doc-table td {
  text-align: left;
  padding: 7px 12px 7px 0;
  border-bottom: 1px solid var(--border);
  vertical-align: top;
}

.doc-table thead th {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--border-strong);
}

.doc-table td { font-variant-numeric: tabular-nums; }
.doc-table tbody tr:last-child td { border-bottom: 1px solid var(--border-strong); }

.unit-note {
  font-size: 12.5px !important;
  color: var(--muted) !important;
  font-style: italic;
  margin-top: 4px !important;
}

/* --- Definition list for data sources --- */
.sources-list {
  margin: 4px 0 0;
  display: grid;
  grid-template-columns: minmax(160px, 34%) 1fr;
  gap: 0;
}

.sources-list dt {
  font-weight: 700;
  font-size: 14px;
  color: var(--text);
  padding: 9px 16px 9px 0;
  border-top: 1px solid var(--border);
}

.sources-list dd {
  margin: 0;
  font-size: 14px;
  color: var(--muted);
  padding: 9px 0;
  border-top: 1px solid var(--border);
}

/* --- References --- */
.refs {
  margin: 0;
  padding: 0;
  list-style: none;
}

.refs li {
  font-size: 13.5px;
  color: var(--muted);
  padding: 7px 0;
  border-bottom: 1px solid var(--border);
}

.provenance {
  font-size: 12.5px !important;
  color: var(--muted) !important;
  font-style: italic;
  margin-top: 14px !important;
}

/* --- Footer nav on this page: monochrome, matching the body links --- */
.doc + footer a, .page.doc footer a {
  color: var(--text);
  text-decoration: underline;
  text-decoration-color: var(--border-strong);
  text-underline-offset: 2px;
}
.page.doc footer a:hover { text-decoration-color: var(--text); }

@media (max-width: 760px) {
  .sources-list { grid-template-columns: 1fr; }
  .sources-list dt { border-top: 1px solid var(--border); padding-bottom: 2px; }
  .sources-list dd { border-top: none; padding-top: 2px; }
}
