/* FFGaussType project page. No external fonts or frameworks. */

:root {
  --bg: #ffffff;
  --surface: #f5f6fa;
  --ink: #1b1f27;
  --ink-soft: #3a414d;
  --muted: #5d6573;
  --rule: #e2e5ec;
  --accent: #3b48fe;        /* paper palette: blue */
  --accent-ink: #2b36d9;
  --accent-tint: rgba(59, 72, 254, 0.07);
  --best: #f9d0cc;          /* table marks follow the paper: red / orange */
  --second: #fde3c4;
  --plate: #ffffff;         /* figures keep a white page */
  --plate-rule: #e2e5ec;
  --plate-ink: #5d6573;
  --plate-strong: #1b1f27;
  --button-bg: #1b1f27;
  --button-ink: #ffffff;
  --code-bg: #f5f6fa;
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.05), 0 4px 16px rgba(16, 24, 40, 0.05);

  --font-sans: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --font-mono: ui-monospace, SFMono-Regular, Menlo, Consolas, "Liberation Mono", monospace;

  --wide: 1080px;
  --narrow: 760px;
  --gutter: 16px;
  --radius: 12px;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #0f1116;
    --surface: #171a21;
    --ink: #e9ebf1;
    --ink-soft: #c9ced8;
    --muted: #a2a9b6;
    --rule: #2a2f3a;
    --accent: #8e96ff;
    --accent-ink: #a9afff;
    --accent-tint: rgba(142, 150, 255, 0.10);
    --best: rgba(239, 98, 84, 0.30);
    --second: rgba(245, 166, 70, 0.24);
    --plate-rule: #2a2f3a;
    --button-bg: #e9ebf1;
    --button-ink: #0f1116;
    --code-bg: #171a21;
    --shadow: none;
  }
}

*,
*::before,
*::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 17px;
  line-height: 1.65;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
}

img { display: block; max-width: 100%; height: auto; }

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

:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: -1px; padding: 0; overflow: hidden;
  clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}

/* Longhand margins so section spacing below is not reset by this class. */
.container {
  width: 100%;
  max-width: calc(var(--wide) + 2 * var(--gutter));
  margin-left: auto;
  margin-right: auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}
.container.narrow { max-width: calc(var(--narrow) + 2 * var(--gutter)); }
.narrow-text { max-width: var(--narrow); margin-left: auto; margin-right: auto; }

main > section { margin-top: 88px; }
main > section:first-child { margin-top: 8px; }

h2 {
  font-size: 1.75rem;
  line-height: 1.25;
  letter-spacing: -0.01em;
  margin: 0 0 20px;
  text-align: center;
}
h3 { font-size: 1.15rem; line-height: 1.35; }
p { margin: 0 0 14px; }

/* ---------- Hero ---------- */

.hero { padding: 64px 0 36px; text-align: center; }

.title { margin: 0 auto 28px; max-width: 900px; }
.title-name {
  display: block;
  font-family: var(--font-serif);
  font-size: clamp(2.6rem, 7vw, 4.2rem);
  line-height: 1.05;
  letter-spacing: -0.015em;
  font-weight: 700;
  color: var(--accent-ink);
}
.title-sub {
  display: block;
  margin-top: 14px;
  font-size: clamp(1.15rem, 2.8vw, 1.6rem);
  line-height: 1.3;
  font-weight: 600;
  color: var(--ink);
  text-wrap: balance;
}

.authors,
.affiliations {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
}
.authors { gap: 4px 22px; font-size: 1.1rem; font-weight: 500; }
.affiliations { gap: 2px 22px; margin-top: 8px; color: var(--ink-soft); }
.authors sup,
.author-note sup { font-size: 0.68em; margin-left: 1px; }
.affiliations sup { font-size: 0.68em; margin-right: 3px; }
.author-note { margin: 8px 0 0; font-size: 0.875rem; color: var(--muted); }

.links {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 10px;
  margin-top: 26px;
}
.button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 8px 18px 8px 14px;
  border-radius: 999px;
  background: var(--button-bg);
  color: var(--button-ink);
  font-weight: 600;
  font-size: 0.95rem;
  text-decoration: none;
  line-height: 1.15;
  border: 1px solid transparent;
}
.button:hover { text-decoration: none; opacity: 0.9; }
.button svg { width: 20px; height: 20px; flex: none; }
.button span { display: flex; flex-direction: column; align-items: flex-start; }
.button small { font-size: 0.7rem; font-weight: 500; opacity: 0.75; }
.button.is-pending {
  background: transparent;
  color: var(--muted);
  border: 1px dashed var(--rule);
  cursor: default;
}
.button.is-pending:hover { opacity: 1; }

/* ---------- Figures ---------- */

figure { margin: 0; }

.plate {
  background: var(--plate);
  border: 1px solid var(--plate-rule);
  border-radius: var(--radius);
  padding: 14px;
  box-shadow: var(--shadow);
}
.plate .zoom { display: block; cursor: zoom-in; }
.plate img { width: 100%; border-radius: 4px; }
.plate.wide { margin: 0 auto; }

figcaption {
  margin-top: 12px;
  font-size: 0.875rem;
  line-height: 1.55;
  color: var(--muted);
}
figcaption strong { color: var(--ink); }
.plate figcaption { color: var(--plate-ink); padding: 0 4px; }
.plate figcaption strong { color: var(--plate-strong); }

.lead {
  max-width: var(--narrow);
  margin: 32px auto 0;
  font-size: 1.12rem;
  line-height: 1.65;
  color: var(--ink-soft);
  text-align: center;
}

.section-intro { text-align: center; color: var(--ink-soft); margin-bottom: 24px; text-wrap: balance; }
.results-figure { margin-top: 32px; }

/* ---------- Key numbers ---------- */

.stats {
  list-style: none;
  padding: 0;
  margin: 32px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px;
}
.stats li {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.stat-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1.1;
  letter-spacing: -0.02em;
  color: var(--accent-ink);
  font-variant-numeric: tabular-nums;
}
.stat-value .unit { font-size: 0.55em; font-weight: 600; margin-left: 3px; letter-spacing: 0; }
.stat-label { font-size: 0.875rem; line-height: 1.45; color: var(--muted); }

/* ---------- Abstract ---------- */

.abstract { text-align: left; hyphens: manual; text-wrap: pretty; }

/* ---------- Method steps ---------- */

.steps {
  list-style: none;
  padding: 0;
  margin: 24px 0 0;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: 12px;
}
.steps li {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 18px 20px;
}
.steps h3 {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 6px;
  font-size: 1.02rem;
}
.steps p { margin: 0; font-size: 0.93rem; color: var(--ink-soft); }
.step-index {
  display: inline-grid;
  place-items: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  background: var(--accent);
  color: #fff;
  font-size: 0.85rem;
  font-weight: 700;
  flex: none;
}

.figure-medium { max-width: 760px; margin-left: auto; margin-right: auto; }

/* ---------- Videos ---------- */
.video-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 14px;
}
.video-grid figure { margin: 0; }
.video-grid video {
  display: block;
  width: 100%;
  height: auto;
  aspect-ratio: 16 / 9;
  border-radius: 8px;
  background: #000;
}
.video-grid figcaption { margin-top: 8px; text-align: center; }
@media (max-width: 720px) {
  .video-grid { grid-template-columns: 1fr; }
}

/* ---------- Tables ---------- */

.table-figure { margin: 28px auto 0; }
.table-figure > figcaption { margin: 0 0 10px; }
.table-wrap {
  overflow-x: auto;
  border: 1px solid var(--rule);
  border-radius: var(--radius);
}
table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
th, td { padding: 8px 14px; text-align: left; border-bottom: 1px solid var(--rule); }
thead th {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--surface);
}
tbody th { font-weight: 500; }
tbody:last-child tr:last-child > * { border-bottom: 0; }
.num { text-align: right; }
tr.group th {
  font-style: italic;
  font-weight: 500;
  color: var(--muted);
  background: var(--bg);
  padding-top: 12px;
}
tr.ours > * { background: var(--accent-tint); }
tr.ours th { font-weight: 700; color: var(--accent-ink); }
table td.best { background: var(--best); font-weight: 700; }
table td.second { background: var(--second); }
.mark { padding: 0 5px; border-radius: 4px; color: var(--ink); }
.mark.best { background: var(--best); }
.mark.second { background: var(--second); }

/* ---------- BibTeX ---------- */

.bibtex-head {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-bottom: 14px;
}
.bibtex-head h2 { margin: 0; }
.copy-button {
  appearance: none;
  font: inherit;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 12px;
  min-height: 30px;
  border-radius: 999px;
  border: 1px solid var(--rule);
  background: var(--bg);
  color: var(--ink-soft);
  cursor: pointer;
}
.copy-button:hover { border-color: var(--accent); color: var(--accent-ink); }

.code {
  margin: 0;
  padding: 16px 18px;
  background: var(--code-bg);
  border-radius: var(--radius);
  overflow-x: auto;
  font-family: var(--font-mono);
  font-size: 0.82rem;
  line-height: 1.6;
  color: var(--ink);
}

.footer {
  margin-top: 72px;
  padding: 32px 0 48px;
  border-top: 1px solid var(--rule);
  font-size: 0.82rem;
  color: var(--muted);
}
.footer .refs-heading {
  font-size: 0.8rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  text-align: left;
  color: var(--ink-soft);
  margin: 0 0 12px;
}
.refs { list-style: none; margin: 0; padding: 0; counter-reset: ref; line-height: 1.5; }
.refs li {
  counter-increment: ref;
  position: relative;
  padding-left: 2.4em;
  margin-bottom: 6px;
  scroll-margin-top: 24px;
}
.refs li::before {
  content: "[" counter(ref) "]";
  position: absolute;
  left: 0;
  color: var(--ink-soft);
  font-variant-numeric: tabular-nums;
}
.refs li:target { color: var(--ink); }
.refs a { word-break: break-word; }
.cite { font-size: 0.7em; margin-left: 1px; line-height: 0; }
.cite a { text-decoration: none; }

/* ---------- Responsive ---------- */

@media (max-width: 600px) {
  body { font-size: 16px; }
  .hero { padding-top: 40px; }
  main > section { margin-top: 64px; }
  h2 { font-size: 1.45rem; }
  .plate { padding: 8px; border-radius: 10px; }
  .abstract { text-align: left; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px; }
  .stats li { padding: 14px; }
  .stat-value { font-size: 1.55rem; }
  .stat-label { font-size: 0.8rem; }
  th, td { padding: 7px 10px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
}

@media print {
  .links, .copy-button { display: none !important; }
  .plate { box-shadow: none; }
}
