/* ============================================================================
   "How Private is Private?" — project page
   Academic paper-page idiom, modelled after https://weihui1308.github.io/
   Palette: warm paper #faf8f8 · text #333 · accent #5183f5
   Type:    Inter (body + headings) · JetBrains Mono (data, dates)
   ============================================================================ */

:root {
  /* palette */
  --paper:        #faf8f8;
  --paper-card:   #fdfcfc;
  --ink:          #111111;
  --text:         #333333;
  --text-mid:     #555555;
  --text-dim:     #777777;
  --rule:         #eaecef;
  --rule-soft:    #f0f0f2;
  --rule-strong:  #dddddd;
  --code-bg:      #f6f7f9;
  --accent:       #5183f5;
  --accent-soft:  #f1f5fe;
  --accent-dark:  #3a6cdd;
  --top-tint:     #f4f7ff;
  --warn:         #c8463c;
  --gold:         #b58a1f;
  --violet:       #7e57c2;

  /* type */
  --font-body: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Helvetica, Arial, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* spacing */
  --s-1: .25rem; --s-2: .5rem; --s-3: .75rem; --s-4: 1rem; --s-5: 1.5rem;
  --s-6: 2rem;   --s-7: 2.5rem; --s-8: 3.5rem; --s-9: 5rem;

  --col: 880px;
}

/* ─── Reset + base ───────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html {
  counter-reset: section;
  background-color: var(--paper);
  overflow-y: scroll;          /* prevent layout jump */
  scroll-behavior: smooth;
  -webkit-text-size-adjust: 100%;
}
body {
  margin: 0 auto;
  padding: 1.5em;
  max-width: var(--col);
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.6;
  color: var(--text);
  background-color: var(--paper);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
img { max-width: 100%; height: auto; display: block; }
a {
  color: var(--accent);
  text-decoration: none;
  border-bottom: 1px solid transparent;
  transition: border-color .2s ease, color .2s ease;
}
a:hover { border-bottom-color: var(--accent); }
/* selection: use browser default (system blue + white) for clear visibility */

p { margin: .75em 0; }
strong { font-weight: 600; color: var(--ink); }
em     { font-style: italic; }
code   {
  font-family: var(--font-mono);
  font-size: .88em;
  background: var(--code-bg);
  border: 1px solid var(--rule);
  border-radius: 3px;
  padding: .08em .35em;
  color: var(--ink);
}
hr { border: 0; border-top: 1px solid var(--rule); margin: var(--s-6) 0; }

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-body);
  color: var(--ink);
  line-height: 1.25;
  margin: 1.2em 0 .4em;
  font-weight: 600;
}
h2 {
  font-size: 1.6em;
  border-bottom: 1px solid var(--rule);
  padding-bottom: .2em;
  margin-top: 1.8em;
  counter-increment: section;  /* increment on the element itself, not ::before, for reliability */
}
h2::before {
  content: counter(section, decimal-leading-zero) ". ";
  color: var(--text-dim);
  font-weight: 500;
}
h3 { font-size: 1.2em; margin-top: 1em; }

/* ─── Top nav ────────────────────────────────────────────────── */
.nav {
  width: 100%;
  margin: 0 0 1.5em;
  border-bottom: 1px solid var(--rule-strong);
  padding-bottom: .7em;
}
.nav__inner {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1em;
  font-size: 1em;
  font-weight: 500;
}
.nav__brand {
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -.01em;
  margin-right: auto;
  border-bottom: 0;
}
.nav__brand:hover { color: var(--accent); border-bottom: 0; }
.nav__links { display: flex; flex-wrap: wrap; gap: 1em; }
.nav__links a {
  color: var(--text-mid);
  font-weight: 500;
  padding: .1em 0;
  border-bottom: 2px solid transparent;
}
.nav__links a:hover,
.nav__links a.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

/* ─── Hero ───────────────────────────────────────────────────── */
.hero { margin: 1.2em 0 2em; }
.hero__title {
  font-size: clamp(1.8em, 4.5vw, 2.4em);
  font-weight: 700;
  line-height: 1.15;
  letter-spacing: -.015em;
  margin: 0 0 .35em;
  color: var(--ink);
}
.hero__sub {
  font-size: 1.05em;
  color: var(--text-mid);
  margin: 0 0 .9em;
  font-weight: 400;
  max-width: 50em;
}
.hero__byline {
  font-size: .98em;
  color: var(--ink);
  margin: 0 0 .35em;
}
.hero__byline a { color: var(--ink); border-bottom: 0; }
.hero__byline a:hover { color: var(--accent); }
.hero__byline sup {
  color: var(--accent-dark);
  font-weight: 600;
  font-size: .72em;
  margin-left: .1em;
}
.hero__byline .sep { color: var(--rule-strong); margin: 0 .3em; }

.hero__affil {
  font-size: .87em;
  color: var(--text-mid);
  margin: 0 0 1em;
  line-height: 1.55;
}
.hero__affil sup {
  color: var(--accent-dark);
  font-weight: 600;
  margin-right: .1em;
}
.hero__affil .sep { color: var(--rule-strong); margin: 0 .55em; }

.hero__venue {
  font-family: var(--font-mono);
  font-size: .78em;
  font-weight: 500;
  color: var(--accent-dark);
  background: var(--accent-soft);
  padding: .15em .55em;
  border-radius: 3px;
  border: 0;
  display: inline-block;
}

.hero__buttons {
  display: flex;
  flex-wrap: wrap;
  gap: .4em;
  margin: 0 0 1em;
}

/* Styled link button — exact look from the reference */
.btn {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  font-weight: 500;
  padding: .35em .85em;
  background-color: var(--accent-soft);
  border-radius: 4px;
  border: 0;
  cursor: pointer;
  font-family: inherit;
  transition: all .2s ease;
  display: inline-block;
}
.btn:hover {
  background-color: var(--accent);
  color: #fff;
  border-bottom: 0;
  transform: translateY(-1px);
}

/* ─── Sections ───────────────────────────────────────────────── */
section { margin: 1.5em 0; }
section p { color: var(--text); }

.callout {
  background: var(--accent-soft);
  border-left: 3px solid var(--accent);
  padding: .9em 1.1em;
  margin: 1em 0;
  border-radius: 0 4px 4px 0;
  color: var(--ink);
  font-size: 1em;
}
.callout strong { color: var(--accent-dark); }

/* Fact list (validation section) */
.facts { padding-left: 1.2em; margin: .8em 0; }
.facts li { margin: .45em 0; }
.facts li strong { color: var(--accent-dark); }

/* Pipeline table (benchmark) */
.pipeline {
  width: 100%;
  border-collapse: collapse;
  margin: 1.2em 0;
  font-size: .92em;
}
.pipeline th, .pipeline td {
  padding: .55em .65em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
}
.pipeline thead th {
  font-weight: 600;
  color: var(--ink);
  border-bottom: 1.5px solid var(--rule-strong);
  font-size: .88em;
}
.pipeline tbody td.num,
.pipeline thead th.num {
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .88em;
}
.pipeline tbody td.label { color: var(--text-mid); font-family: var(--font-mono); font-size: .85em; }
.pipeline tbody tr:last-child td { border-bottom: 0; }
.pipeline tbody tr:last-child td strong { color: var(--accent-dark); }

/* Equation block */
.equation {
  padding: 1em 0;
  overflow-x: auto;
  text-align: center;
}
.equation .katex { font-size: 1.05em; color: var(--ink); }
.equation .katex-display { margin: 0; }

/* Figures (captions only — figures themselves are inline imgs) */
.figure--hero { margin: 0 0 1.5em; }
.figure { margin: 1.3em 0 .5em; }
.figure img {
  border: 1px solid var(--rule);
  border-radius: 4px;
  background: #fff;
  margin: 0 auto;
}
.figure a:hover { border-bottom: 0; }
.figure a:hover img {
  box-shadow: 0 4px 14px rgba(81, 131, 245, .12);
  border-color: var(--accent);
}
.figure-caption {
  font-size: .9em;
  color: var(--text-mid);
  margin: .6em 0 0;
  line-height: 1.5;
  text-align: center;
}
.figure-caption strong {
  color: var(--ink);
  font-weight: 600;
  margin-right: .25em;
}

/* ─── Leaderboard ────────────────────────────────────────────── */
.lb-wrap {
  margin: 1em 0;
  background: var(--paper-card);
  border: 1px solid var(--rule);
  border-radius: 6px;
  overflow: hidden;
}
.lb-strip {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1em;
  padding: .55em .9em;
  background: var(--code-bg);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: .76em;
  color: var(--text-mid);
}
.lb-strip .pip { display: inline-flex; align-items: center; gap: .35em; }
.lb-strip .live::before {
  content: "";
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  display: inline-block;
}
.lb-strip .count { color: var(--ink); font-weight: 500; }

.lb-controls {
  display: flex;
  flex-wrap: wrap;
  gap: .8em 1.6em;
  align-items: center;
  padding: .75em .9em;
  border-bottom: 1px solid var(--rule);
  font-size: .88em;
}
.lb-controls fieldset {
  border: 0; padding: 0; margin: 0;
  display: flex; flex-wrap: wrap; align-items: center; gap: .6em;
}
.lb-controls legend {
  float: left;
  padding: 0;
  margin-right: .5em;
  font-size: .82em;
  font-weight: 600;
  color: var(--text-mid);
  text-transform: uppercase;
  letter-spacing: .06em;
}
.lb-controls label {
  display: inline-flex; align-items: center; gap: .3em;
  color: var(--text);
  cursor: pointer;
  user-select: none;
}
.lb-controls input[type="radio"],
.lb-controls input[type="checkbox"] {
  appearance: none;
  -webkit-appearance: none;
  width: 14px; height: 14px;
  margin: 0;
  border: 1.5px solid var(--rule-strong);
  background: #fff;
  cursor: pointer;
  display: inline-grid; place-content: center;
  transition: border-color .15s, background .15s;
}
.lb-controls input[type="radio"] { border-radius: 50%; }
.lb-controls input[type="checkbox"] { border-radius: 3px; }
.lb-controls input:hover { border-color: var(--accent); }
.lb-controls input[type="radio"]:checked {
  border-color: var(--accent);
}
.lb-controls input[type="radio"]:checked::after {
  content: "";
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--accent);
}
.lb-controls input[type="checkbox"]:checked {
  background: var(--accent);
  border-color: var(--accent);
}
.lb-controls input[type="checkbox"]:checked::after {
  content: "";
  width: 8px; height: 4px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg) translate(1px, -1px);
}
.lb-controls label:has(input:checked) { color: var(--ink); }

.lb-table-wrap { overflow-x: auto; }
table.lb {
  width: 100%;
  border-collapse: collapse;
  font-size: .9em;
}
table.lb thead th {
  background: var(--paper);
  font-weight: 600;
  color: var(--text-mid);
  font-size: .78em;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: .65em .55em;
  border-bottom: 1.5px solid var(--rule-strong);
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  text-align: right;
}
table.lb thead th:nth-child(1),
table.lb thead th:nth-child(2),
table.lb thead th:nth-child(3) { text-align: left; }
table.lb thead th:hover { color: var(--accent); }
table.lb thead th.sorted { color: var(--accent); }
table.lb thead th.sorted::after  { content: " ▾"; font-size: .85em; }
table.lb thead th.sorted.asc::after { content: " ▴"; }

table.lb tbody td {
  padding: .6em .55em;
  border-bottom: 1px solid var(--rule);
  color: var(--text);
  text-align: right;
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  font-size: .92em;
  white-space: nowrap;
}
table.lb tbody td:nth-child(1) {
  color: var(--text-dim);
  text-align: left;
  width: 2.4em;
  font-size: .88em;
}
table.lb tbody td:nth-child(2) {                /* method name */
  text-align: left;
  color: var(--ink);
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1em;
}
table.lb tbody td:nth-child(3) { text-align: left; }
table.lb tbody td:nth-child(9) {                /* HiFD column */
  color: var(--ink);
  font-weight: 700;
}
table.lb tbody td:nth-child(10) { text-align: center; width: 2em; }
table.lb tbody tr {
  cursor: pointer;
  transition: background .12s;
}
table.lb tbody tr:hover { background: var(--rule-soft); }
table.lb tbody tr:last-child td { border-bottom: 0; }

/* Top-ranked row */
table.lb tbody tr.top { background: var(--top-tint); }
table.lb tbody tr.top:hover { background: var(--accent-soft); }
table.lb tbody tr.top td:nth-child(1) {
  color: var(--accent-dark);
  font-weight: 700;
}
table.lb tbody tr.top td:nth-child(9) { color: var(--accent-dark); }

/* Paradigm tags — match the .styled-link aesthetic */
.paradigm-tag {
  display: inline-block;
  padding: .12em .55em;
  font-family: var(--font-mono);
  font-size: .72em;
  font-weight: 500;
  letter-spacing: .04em;
  text-transform: uppercase;
  border-radius: 3px;
  white-space: nowrap;
}
.paradigm-tag.adversarial { background: var(--accent-soft); color: var(--accent-dark); }
.paradigm-tag.gan         { background: #fdf6e3; color: var(--gold); }
.paradigm-tag.diffusion   { background: #f1edfa; color: var(--violet); }
.paradigm-tag.other       { background: var(--code-bg); color: var(--text-mid); }

.verified { color: var(--accent); font-weight: 700; }

/* Expanded row */
.lb-expand-row td.lb-expand {
  background: var(--paper);
  padding: 1em 1.1em;
  border-bottom: 1px solid var(--rule);
  text-align: left;
  white-space: normal;
}
.lb-expand .bars {
  display: grid;
  grid-template-columns: 110px 1fr 56px;
  gap: .3em .8em;
  align-items: center;
  font-family: var(--font-mono);
  font-size: .8em;
  color: var(--text-mid);
}
.lb-expand .bars > div:nth-child(3n+1) {
  font-weight: 500;
  font-size: .9em;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.lb-expand .bars > div:nth-child(3n+3) {
  text-align: right;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.lb-expand .bar-track {
  height: 6px;
  background: var(--rule);
  border-radius: 3px;
  overflow: hidden;
}
.lb-expand .bar-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 3px;
}
.lb-expand p {
  margin: .8em 0 0;
  font-family: var(--font-mono);
  font-size: .82em;
  color: var(--text-mid);
}
.lb-expand p a { color: var(--accent); }

/* Loading / error states (used by JS) */
.lb-status {
  text-align: center !important;
  color: var(--text-dim);
  font-family: var(--font-mono);
  font-size: .85em;
  padding: 1.8em 1em !important;
}
.lb-error {
  text-align: center !important;
  color: var(--warn);
  font-family: var(--font-mono);
  padding: 1.8em 1em !important;
}

.submit-cta {
  margin-top: .9em;
  display: flex;
  justify-content: flex-end;
}

/* ─── Submit dialog ──────────────────────────────────────────── */
dialog#submit-dialog {
  background: var(--paper-card);
  color: var(--text);
  border: 1px solid var(--rule);
  border-top: 3px solid var(--accent);
  border-radius: 6px;
  padding: 0;
  max-width: 720px;
  width: calc(100% - 2rem);
  box-shadow: 0 18px 50px rgba(17, 17, 17, .15);
}
dialog#submit-dialog::backdrop {
  background: rgba(17, 17, 17, .4);
  backdrop-filter: blur(2px);
}
dialog#submit-dialog form { padding: 1.5em; }
dialog#submit-dialog h3 {
  margin: 0 0 .5em;
  color: var(--ink);
  font-size: 1.2em;
}
dialog#submit-dialog p { font-size: .92em; color: var(--text); }
#template-json {
  font-family: var(--font-mono);
  font-size: .78em;
  background: var(--code-bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 4px;
  padding: .9em;
  max-height: 320px;
  overflow: auto;
  margin: .8em 0;
  white-space: pre;
  line-height: 1.55;
}
dialog#submit-dialog menu {
  margin: 0;
  padding: 0;
  display: flex;
  justify-content: flex-end;
  gap: .5em;
}

/* ─── Citation / BibTeX ──────────────────────────────────────── */
.bibtex {
  position: relative;
  background: var(--code-bg);
  color: var(--ink);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 1.1em 1.2em;
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: .82em;
  line-height: 1.65;
  margin: 1em 0;
}
.bibtex code {
  color: var(--ink);
  background: none;
  border: 0;
  padding: 0;
  font-size: inherit;
}
.copy-btn {
  position: absolute;
  top: .55em;
  right: .55em;
  background: #fff;
  color: var(--accent);
  border: 1px solid var(--rule);
  padding: .25em .6em;
  border-radius: 3px;
  font-family: var(--font-body);
  font-size: .78em;
  font-weight: 500;
  cursor: pointer;
  transition: color .15s, border-color .15s, background .15s;
}
.copy-btn:hover {
  color: #fff;
  background: var(--accent);
  border-color: var(--accent);
}

/* ─── Footer ─────────────────────────────────────────────────── */
footer {
  margin-top: 3em;
  padding-top: 1.2em;
  border-top: 1px solid var(--rule-strong);
  font-size: .85em;
  color: var(--text-dim);
}
footer .container,
footer > * {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: .8em;
  padding: 0;
  max-width: none;
}
footer a { color: var(--text-mid); }
footer a:hover { color: var(--accent); }
footer .meta { font-family: var(--font-mono); font-size: .82em; }

/* Static snapshot (leaderboard.html) tweaks */
.container--wide > h3 {
  font-size: 1.1em;
  color: var(--accent-dark);
  margin: 1.5em 0 .5em;
  font-weight: 600;
}

/* ─── Mobile ─────────────────────────────────────────────────── */
@media (max-width: 760px) {
  body { padding: 1.1em; font-size: 14.5px; }
  .hero__title { font-size: 1.7em; }
  .lb-controls { padding: .6em .7em; gap: .5em .9em; }
  table.lb { font-size: .82em; }
  table.lb tbody td:nth-child(2) { font-size: .95em; }
  .lb-expand .bars { grid-template-columns: 88px 1fr 48px; }
  footer > * { flex-direction: column; align-items: flex-start; }
}
