/* ============================================================
   Imputation Benchmarking — paper site
   Type: Spectral (serif prose) · IBM Plex Mono (labels/code)
         · IBM Plex Sans (UI / table data)
   ============================================================ */

:root {
  /* paper & ink — warm-cool near-white, near-black */
  --paper:      oklch(0.992 0.003 250);
  --paper-2:    oklch(0.975 0.004 250);
  --paper-3:    oklch(0.962 0.005 252);
  --ink:        oklch(0.245 0.013 262);
  --ink-soft:   oklch(0.445 0.013 262);
  --ink-faint:  oklch(0.605 0.011 262);
  --rule:       oklch(0.895 0.006 260);
  --rule-soft:  oklch(0.935 0.005 258);

  /* single accent — deep academic blue */
  --accent:     oklch(0.430 0.110 256);
  --accent-ink: oklch(0.360 0.115 256);
  --accent-bg:  oklch(0.430 0.110 256 / 0.072);
  --accent-bg2: oklch(0.430 0.110 256 / 0.135);

  /* code palette — restrained */
  --c-comment:  oklch(0.605 0.012 262);
  --c-keyword:  oklch(0.430 0.110 256);
  --c-string:   oklch(0.470 0.072 152);
  --c-number:   oklch(0.520 0.110 42);
  --c-func:     oklch(0.430 0.075 300);
  --c-deco:     oklch(0.520 0.110 42);

  --serif: "Spectral", Georgia, "Times New Roman", serif;
  --mono:  "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --sans:  "IBM Plex Sans", system-ui, -apple-system, sans-serif;

  --maxw: 1180px;
  --maxw-wide: 1320px;
  --nav-h: 60px;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-size: 18px;
  line-height: 1.62;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

::selection { background: var(--accent-bg2); }

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

/* ---- shared layout ---- */
.wrap { max-width: var(--maxw); margin: 0 auto; padding: 0 40px; }
.wrap-wide { max-width: var(--maxw-wide); margin: 0 auto; padding: 0 40px; }

section[id] { scroll-margin-top: calc(var(--nav-h) + 24px); }

.eyebrow {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-weight: 500;
}

.section-head {
  display: flex;
  align-items: baseline;
  gap: 18px;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 14px;
  margin-bottom: 38px;
}
.section-head .num {
  font-family: var(--mono);
  font-size: 13px;
  color: var(--accent);
  font-weight: 500;
  letter-spacing: 0.04em;
}
.section-head h2 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 30px;
  letter-spacing: -0.01em;
  margin: 0;
  flex: 1;
}
.section-head .meta {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink-faint);
}

/* ============================================================
   NAV
   ============================================================ */
.nav {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  background: oklch(0.992 0.003 250 / 0.86);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--rule);
}
.nav-inner {
  max-width: var(--maxw-wide);
  margin: 0 auto;
  height: 100%;
  padding: 0 40px;
  display: flex;
  align-items: center;
  gap: 28px;
}
.nav-brand {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--ink);
  white-space: nowrap;
}
.nav-brand .dot { color: var(--accent); }
.nav-links {
  display: flex;
  gap: 4px;
  margin-left: auto;
  align-items: center;
}
.nav-links a {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 7px 11px;
  border-radius: 5px;
  transition: color .15s, background .15s;
}
.nav-links a:hover { color: var(--ink); background: var(--paper-3); text-decoration: none; }
.nav-links a.active { color: var(--accent); }
.nav-gh {
  font-family: var(--mono);
  font-size: 12.5px;
  color: var(--ink) !important;
  border: 1px solid var(--rule);
  padding: 7px 13px !important;
  border-radius: 5px;
}
.nav-gh:hover { border-color: var(--ink-faint); background: var(--paper) !important; }
@media (max-width: 880px) {
  .nav-links a:not(.nav-gh) { display: none; }
}

/* ============================================================
   HERO
   ============================================================ */
.hero { padding: 78px 0 64px; border-bottom: 1px solid var(--rule); }
.hero-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 22px;
  margin-bottom: 30px;
}
.hero-meta span {
  font-family: var(--mono);
  font-size: 12.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.hero-meta span b { color: var(--accent); font-weight: 500; }

.hero h1 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: clamp(36px, 4.7vw, 56px);
  line-height: 1.1;
  letter-spacing: -0.02em;
  margin: 0;
  color: var(--accent-ink);
}
.hero .subtitle {
  font-family: var(--serif);
  font-style: italic;
  font-size: clamp(19px, 2.2vw, 23px);
  color: var(--ink-soft);
  margin: 26px 0 0;
  line-height: 1.42;
}

.authors {
  margin: 38px 0 0;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 26px;
  align-items: baseline;
}
.authors .author {
  font-family: var(--sans);
  font-size: 19px;
  font-weight: 500;
  color: var(--ink);
}
.authors .author sup { color: var(--accent); font-size: 11px; font-weight: 600; margin-left: 1px; }
.affils {
  margin: 14px 0 0;
  list-style: none;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.affils li {
  font-family: var(--sans);
  font-size: 14px;
  color: var(--ink-soft);
}
.affils li sup { color: var(--accent); font-weight: 600; margin-right: 5px; }

.hero-actions { margin-top: 36px; display: flex; flex-wrap: wrap; gap: 12px; }
.btn {
  font-family: var(--mono);
  font-size: 13px;
  letter-spacing: 0.02em;
  padding: 11px 18px;
  border-radius: 6px;
  border: 1px solid var(--rule);
  background: var(--paper);
  color: var(--ink);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  transition: border-color .15s, background .15s, color .15s;
}
.btn:hover { border-color: var(--ink-faint); text-decoration: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: oklch(0.99 0.003 250); }
.btn.primary:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn .arrow { font-size: 14px; }

/* ---- abstract ---- */
.abstract { padding: 56px 0; }
.abstract-grid {
  display: grid;
  grid-template-columns: 200px 1fr;
  gap: 48px;
}
.abstract-grid .label { padding-top: 6px; }
.abstract-grid .label .eyebrow { display: block; margin-bottom: 14px; }
.kw { display: flex; flex-direction: column; gap: 7px; }
.kw span {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  letter-spacing: 0.01em;
}
.kw span::before { content: "— "; color: var(--accent); }
.abstract p {
  margin: 0 0 18px;
  font-size: 19.5px;
  line-height: 1.66;
  color: var(--ink);
}
.abstract p:first-child { margin-top: 0; }
.abstract p .hl { color: var(--accent-ink); font-weight: 500; font-style: italic; }
@media (max-width: 780px) {
  .abstract-grid { grid-template-columns: 1fr; gap: 22px; }
}

/* ============================================================
   FINDINGS
   ============================================================ */
.findings { padding: 60px 0; background: var(--paper-2); border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); }
.findings-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
}
.finding {
  background: var(--paper-2);
  padding: 34px 34px 32px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.finding .fnum {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-faint);
  letter-spacing: 0.06em;
}
.finding .fbig {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 44px;
  line-height: 1;
  letter-spacing: -0.02em;
  color: var(--accent-ink);
}
.finding .fbig small { font-size: 22px; color: var(--ink-faint); font-weight: 400; }
.finding .ftext {
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  color: var(--ink-soft);
}
.finding .ftext b { color: var(--ink); font-weight: 600; }
@media (max-width: 720px) { .findings-grid { grid-template-columns: 1fr; } }

/* ============================================================
   FIGURES
   ============================================================ */
.figures { padding: 64px 0; }
.figure { margin-bottom: 58px; }
.figure:last-child { margin-bottom: 0; }
.figure-bar {
  display: flex;
  align-items: baseline;
  gap: 16px;
  margin-bottom: 16px;
}
.figure-bar .fid {
  font-family: var(--mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--accent);
  letter-spacing: 0.03em;
  white-space: nowrap;
}
.figure-bar h3 {
  font-family: var(--serif);
  font-weight: 500;
  font-size: 21px;
  margin: 0;
  flex: 1;
  letter-spacing: -0.01em;
}
.figure-frame {
  border: 1px solid var(--rule);
  background: #fff;
  padding: 22px;
  border-radius: 4px;
}
.figure-frame img {
  display: block;
  width: 100%;
  height: auto;
}
.figure-foot {
  display: flex;
  gap: 24px;
  align-items: flex-start;
  margin-top: 16px;
}
.figure-foot p {
  font-family: var(--sans);
  font-size: 14.5px;
  line-height: 1.55;
  color: var(--ink-soft);
  margin: 0;
  flex: 1;
}
.figure-dl {
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink-soft);
  border: 1px solid var(--rule);
  padding: 7px 12px;
  border-radius: 5px;
  white-space: nowrap;
  display: inline-flex;
  gap: 7px;
  align-items: center;
}
.figure-dl:hover { border-color: var(--ink-faint); color: var(--ink); text-decoration: none; }
@media (max-width: 680px) {
  .figure-foot { flex-direction: column-reverse; gap: 14px; }
}

/* ============================================================
   TABLES
   ============================================================ */
.tables { padding: 64px 0; background: var(--paper-2); border-top: 1px solid var(--rule); }
.tables-layout {
  display: grid;
  grid-template-columns: 268px 1fr;
  gap: 38px;
  align-items: start;
}
.table-list {
  position: sticky;
  top: calc(var(--nav-h) + 24px);
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.table-list button {
  font-family: var(--sans);
  text-align: left;
  background: none;
  border: none;
  border-left: 2px solid transparent;
  padding: 9px 14px;
  cursor: pointer;
  color: var(--ink-soft);
  display: flex;
  flex-direction: column;
  gap: 2px;
  transition: background .12s, border-color .12s, color .12s;
}
.table-list button:hover { background: var(--paper-3); color: var(--ink); }
.table-list button.active { border-left-color: var(--accent); background: var(--paper-3); color: var(--ink); }
.table-list button .tl-id {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.04em;
  color: var(--accent);
}
.table-list button .tl-name { font-size: 14px; font-weight: 500; line-height: 1.25; }
.table-list button.active .tl-name { font-weight: 600; }

.table-panel { min-width: 0; }
.table-panel h3 {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 22px;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
}
.table-panel .caption {
  font-family: var(--sans);
  font-size: 14.5px;
  color: var(--ink-soft);
  line-height: 1.5;
  margin: 0 0 20px;
  max-width: 78ch;
}
.table-controls {
  display: flex;
  gap: 12px;
  align-items: center;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.search-box {
  flex: 1;
  min-width: 200px;
  position: relative;
}
.search-box input {
  width: 100%;
  font-family: var(--sans);
  font-size: 14px;
  padding: 9px 12px 9px 34px;
  border: 1px solid var(--rule);
  border-radius: 6px;
  background: var(--paper);
  color: var(--ink);
}
.search-box input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-bg); }
.search-box .icon {
  position: absolute;
  left: 12px; top: 50%; transform: translateY(-50%);
  color: var(--ink-faint); font-size: 13px; pointer-events: none;
  font-family: var(--mono);
}
.row-count { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); white-space: nowrap; }

.table-scroll {
  border: 1px solid var(--rule);
  border-radius: 4px;
  overflow: auto;
  max-height: 620px;
  background: var(--paper);
}
table.data {
  border-collapse: collapse;
  width: 100%;
  font-family: var(--sans);
  font-size: 13.5px;
}
table.data thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: var(--paper-3);
  text-align: left;
  font-weight: 600;
  font-size: 11.5px;
  font-family: var(--mono);
  letter-spacing: 0.02em;
  color: var(--ink-soft);
  padding: 11px 14px;
  border-bottom: 1px solid var(--rule);
  white-space: nowrap;
}
table.data tbody td {
  padding: 8px 14px;
  border-bottom: 1px solid var(--rule-soft);
  color: var(--ink);
  white-space: nowrap;
}
table.data tbody td.num { font-family: var(--mono); font-size: 12.5px; font-variant-numeric: tabular-nums; }
table.data tbody td:first-child { font-weight: 500; }
table.data tbody tr:hover td { background: var(--accent-bg); }
table.data tbody tr:last-child td { border-bottom: none; }
table.data mark { background: var(--accent-bg2); color: var(--accent-ink); padding: 0 1px; border-radius: 2px; }
.table-empty { padding: 40px; text-align: center; font-family: var(--mono); font-size: 13px; color: var(--ink-faint); }

@media (max-width: 860px) {
  .tables-layout { grid-template-columns: 1fr; gap: 22px; }
  .table-list { position: static; flex-direction: row; overflow-x: auto; gap: 0; border-bottom: 1px solid var(--rule); padding-bottom: 2px; }
  .table-list button { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; }
  .table-list button.active { border-left: none; border-bottom-color: var(--accent); }
  .table-list button .tl-name { display: none; }
  .table-list button .tl-id { font-size: 12px; padding: 4px 4px; }
}

/* ============================================================
   CODE
   ============================================================ */
.code { padding: 64px 0; }
.repro {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 1px;
  background: var(--rule);
  border: 1px solid var(--rule);
  margin-bottom: 44px;
}
.repro .step { background: var(--paper); padding: 24px 26px; }
.repro .step .sn { font-family: var(--mono); font-size: 12px; color: var(--accent); letter-spacing: 0.05em; }
.repro .step h4 { font-family: var(--serif); font-weight: 600; font-size: 18px; margin: 8px 0 6px; }
.repro .step code { font-family: var(--mono); font-size: 13px; background: var(--paper-3); padding: 2px 7px; border-radius: 4px; color: var(--accent-ink); }
.repro .step p { font-family: var(--sans); font-size: 13.5px; color: var(--ink-soft); margin: 6px 0 0; line-height: 1.5; }
@media (max-width: 760px) { .repro { grid-template-columns: 1fr; } }

.code-layout { display: grid; grid-template-columns: 268px 1fr; gap: 38px; align-items: start; }
.file-list { position: sticky; top: calc(var(--nav-h) + 24px); display: flex; flex-direction: column; gap: 2px; }
.file-list button {
  font-family: var(--sans);
  text-align: left;
  background: none; border: none;
  border-left: 2px solid transparent;
  padding: 10px 14px; cursor: pointer; color: var(--ink-soft);
  display: flex; flex-direction: column; gap: 3px;
  transition: background .12s, border-color .12s, color .12s;
}
.file-list button:hover { background: var(--paper-3); color: var(--ink); }
.file-list button.active { border-left-color: var(--accent); background: var(--paper-3); color: var(--ink); }
.file-list button .fl-name { font-family: var(--mono); font-size: 13px; font-weight: 500; }
.file-list button .fl-desc { font-size: 12px; line-height: 1.35; color: var(--ink-faint); }

.code-panel { min-width: 0; }
.code-bar {
  display: flex; align-items: center; gap: 12px;
  padding: 11px 14px;
  border: 1px solid var(--rule);
  border-bottom: none;
  border-radius: 6px 6px 0 0;
  background: var(--paper-3);
}
.code-bar .cb-name { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink); }
.code-bar .cb-lang { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); border: 1px solid var(--rule); padding: 2px 7px; border-radius: 4px; }
.code-bar .cb-actions { margin-left: auto; display: flex; gap: 8px; }
.code-bar button {
  font-family: var(--mono); font-size: 12px;
  background: var(--paper); border: 1px solid var(--rule);
  color: var(--ink-soft); padding: 6px 11px; border-radius: 5px; cursor: pointer;
  display: inline-flex; gap: 6px; align-items: center;
  transition: border-color .12s, color .12s;
}
.code-bar button:hover { border-color: var(--ink-faint); color: var(--ink); }
.code-view {
  display: flex;
  border: 1px solid var(--rule);
  border-radius: 0 0 6px 6px;
  overflow: hidden;
  background: oklch(0.985 0.004 250);
  max-height: 640px;
}
.code-gutter {
  flex: none;
  padding: 18px 0;
  text-align: right;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--ink-faint);
  background: var(--paper-3);
  border-right: 1px solid var(--rule);
  user-select: none;
  overflow: hidden;
}
.code-gutter span { display: block; padding: 0 14px; }
.code-scroll { overflow: auto; flex: 1; }
.code-view pre {
  margin: 0;
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.62;
  color: var(--ink);
  white-space: pre;
  tab-size: 4;
}
.tok-comment { color: var(--c-comment); font-style: italic; }
.tok-keyword { color: var(--c-keyword); font-weight: 500; }
.tok-string  { color: var(--c-string); }
.tok-number  { color: var(--c-number); }
.tok-func    { color: var(--c-func); font-weight: 500; }
.tok-deco    { color: var(--c-deco); }
.tok-md-h    { color: var(--accent-ink); font-weight: 600; }
.tok-md-code { color: var(--c-string); }
.tok-md-rule { color: var(--ink-faint); }

@media (max-width: 860px) {
  .code-layout { grid-template-columns: 1fr; gap: 22px; }
  .file-list { position: static; flex-direction: row; overflow-x: auto; border-bottom: 1px solid var(--rule); }
  .file-list button { border-left: none; border-bottom: 2px solid transparent; white-space: nowrap; }
  .file-list button.active { border-left: none; border-bottom-color: var(--accent); }
  .file-list button .fl-desc { display: none; }
}

/* ============================================================
   FOOTER / CITE
   ============================================================ */
.footer { padding: 64px 0 80px; border-top: 1px solid var(--ink); background: var(--paper-2); }
.cite-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 48px; }
.cite-block h3 { font-family: var(--serif); font-weight: 600; font-size: 18px; margin: 0 0 14px; }
.foot-logo { display: block; margin: 0 0 20px; }
.foot-logo img { display: block; width: 100%; max-width: 380px; height: auto; }
.bibtex {
  position: relative;
  background: var(--paper);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 18px 20px;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
  color: var(--ink-soft);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
}
.bibtex .bk { color: var(--accent); }
.cite-copy {
  position: absolute; top: 12px; right: 12px;
  font-family: var(--mono); font-size: 11px;
  background: var(--paper-3); border: 1px solid var(--rule);
  color: var(--ink-soft); padding: 5px 10px; border-radius: 5px; cursor: pointer;
}
.cite-copy:hover { border-color: var(--ink-faint); color: var(--ink); }
.foot-meta { font-family: var(--sans); font-size: 14px; color: var(--ink-soft); line-height: 1.6; }
.foot-meta a { font-weight: 500; }
.foot-meta .eyebrow { display: block; margin-bottom: 12px; }
.foot-rule { height: 1px; background: var(--rule); margin: 44px 0 28px; }
.foot-base {
  display: flex; justify-content: space-between; flex-wrap: wrap; gap: 12px;
  font-family: var(--mono); font-size: 12px; color: var(--ink-faint);
}
@media (max-width: 760px) { .cite-grid { grid-template-columns: 1fr; gap: 32px; } }
