/* ============================================================
   Evolution Fine-Tuning — project page
   Direction: modern / clean / sophisticated.
   Cool neutral base + carbon dark + a single disciplined warm
   accent (the Finch orange). Technical-editorial typography:
   Space Grotesk (display) · Inter (body) · JetBrains Mono (data).
   ============================================================ */

:root {
  /* cool neutral base */
  --bg:        #FFFFFF;
  --bg-2:      #FAFBFC;
  --surface:   #F4F6F8;
  --surface-2: #EEF1F4;
  --ink:       #16181D;
  --ink-2:     #3C424B;
  --muted:     #767D88;
  --line:      #E7EAEE;
  --line-2:    #DCE0E6;

  /* one warm accent, used with restraint */
  --accent:      #E0501F;
  --accent-soft: #F08A4B;
  --accent-tint: #FBE7DA;
  --accent-deep: #B83F17;

  /* deep carbon for dark surfaces */
  --carbon:   #15171C;
  --carbon-2: #1C1F26;
  --carbon-ink: #C9CDD4;

  --maxw: 1120px;
  --r:    14px;
  --r-sm: 9px;

  --sh-1: 0 1px 2px rgba(20,22,28,.04);
  --sh-2: 0 4px 16px rgba(20,22,28,.06), 0 1px 3px rgba(20,22,28,.05);
  --sh-3: 0 18px 50px rgba(20,22,28,.14);

  --display: "Space Grotesk", -apple-system, BlinkMacSystemFont, sans-serif;
  --body:    "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  --mono:    "JetBrains Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; scroll-padding-top: 80px; -webkit-text-size-adjust: 100%; }

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

img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: var(--maxw); margin: 0 auto; padding: 0 28px; }

/* ---------- scroll progress ---------- */
#progress {
  position: fixed; top: 0; left: 0; height: 2px; width: 0;
  background: var(--accent); z-index: 200; transition: width .08s linear;
}

/* ---------- navbar ---------- */
.navbar {
  position: sticky; top: 0; z-index: 100;
  background: rgba(255,255,255,.78);
  backdrop-filter: saturate(160%) blur(12px);
  -webkit-backdrop-filter: saturate(160%) blur(12px);
  border-bottom: 1px solid var(--line);
}
.nav-inner {
  max-width: var(--maxw); margin: 0 auto; padding: 12px 28px;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
}
.nav-brand { display: flex; align-items: center; gap: 11px; color: var(--ink); }
.nav-brand img { height: 26px; width: auto; }
.nav-brand b {
  font-family: var(--display); font-weight: 600; font-size: 15.5px;
  letter-spacing: -.01em;
}
.nav-links { display: flex; align-items: center; gap: 2px; }
.nav-links a {
  font-family: var(--mono); color: var(--ink-2); font-size: 12.5px; font-weight: 500;
  letter-spacing: .02em; padding: 7px 11px; border-radius: 7px; text-decoration: none;
  transition: background .15s, color .15s;
}
.nav-links a:hover { background: var(--surface); color: var(--accent); text-decoration: none; }
.nav-toggle { display: none; background: none; border: none; cursor: pointer; color: var(--ink); padding: 4px; }

/* ---------- shared: eyebrow (the signature mono label) ---------- */
.eyebrow {
  display: inline-flex; align-items: center; gap: 9px;
  font-family: var(--mono); font-size: 12px; font-weight: 500; letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-2); margin-bottom: 16px;
}
.eyebrow::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); box-shadow: 0 0 0 4px var(--accent-tint);
}

/* ---------- News ---------- */
.news-list { list-style: none; margin: 0; padding: 0; max-width: 880px; }
.news-item {
  display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 14px;
  padding: 15px 0; border-bottom: 1px solid var(--line);
}
.news-item:first-child { padding-top: 2px; }
.news-item:last-child { border-bottom: none; padding-bottom: 0; }
.news-date {
  flex: 0 0 66px; font-family: var(--mono); font-size: 12.5px;
  color: var(--muted); letter-spacing: .02em;
}
.news-tag {
  flex: 0 0 auto; align-self: center;
  font-family: var(--mono); font-size: 10.5px; font-weight: 600;
  letter-spacing: .08em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-tint);
  border-radius: 999px; padding: 3px 11px;
}
.news-tag.hot { color: #fff; background: var(--accent); }
.news-body { flex: 1 1 340px; color: var(--ink-2); font-size: 16.5px; line-height: 1.55; }
.news-body b { color: var(--ink); font-weight: 600; }
.news-body a { border-bottom: 1px solid var(--accent-soft); }

/* ---------- hero ---------- */
.hero {
  position: relative; overflow: hidden;
  background:
    linear-gradient(180deg, var(--bg-2) 0%, var(--bg) 78%);
  border-bottom: 1px solid var(--line);
}
.hero::before { /* subtle precise grid, very faint */
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image:
    linear-gradient(to right, rgba(20,22,28,.025) 1px, transparent 1px),
    linear-gradient(to bottom, rgba(20,22,28,.025) 1px, transparent 1px);
  background-size: 44px 44px;
  -webkit-mask-image: radial-gradient(120% 80% at 50% 0%, #000 35%, transparent 75%);
          mask-image: radial-gradient(120% 80% at 50% 0%, #000 35%, transparent 75%);
}
.hero-inner { position: relative; max-width: none; margin: 0 auto; padding: 56px clamp(28px, 4vw, 60px) 56px; text-align: center; }


.hero h1 {
  font-family: var(--display); font-weight: 600;
  font-size: clamp(32px, 5.4vw, 58px); line-height: 1.04;
  letter-spacing: -.035em; color: var(--ink); margin: 28px 0 0;
}
.hero h1 .eft { color: var(--accent); }
.hero .subtitle {
  font-size: clamp(16px, 2vw, 19px); color: var(--ink-2);
  max-width: 900px; margin: 18px auto 0; font-weight: 400; line-height: 1.55;
}
.hero .subtitle em { color: var(--ink); font-style: normal; font-weight: 600; }

/* authors */
.authors { margin: 30px auto 6px; max-width: none; white-space: nowrap; font-size: 15.5px; line-height: 1.9; color: var(--ink); }
.authors .author { white-space: nowrap; font-weight: 500; }
.authors .author sup { color: var(--accent); font-weight: 600; font-size: .7em; }
.authors a { color: var(--ink); text-decoration: none; border-bottom: 1px solid var(--line-2); transition: color .15s, border-color .15s; }
.authors a:hover { color: var(--accent); border-bottom-color: var(--accent); text-decoration: none; }
.authors .sep { color: var(--line-2); padding: 0 1px; }
.affils { color: var(--muted); font-size: 13.5px; max-width: none; white-space: nowrap; margin: 8px auto 0; line-height: 1.7; }
.affils sup { color: var(--accent); font-weight: 600; }
.author-note { color: var(--muted); font-size: 12px; max-width: 620px; margin: 12px auto 0; line-height: 1.55; white-space: normal; }
.author-note sup { color: var(--accent); font-weight: 600; margin-right: 1px; }

/* ---------- resource buttons ---------- */
.links { display: flex; flex-wrap: wrap; gap: 10px; justify-content: center; margin: 32px auto 0; }
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--body); font-size: 14.5px; font-weight: 600;
  padding: 10px 18px; border-radius: 999px; cursor: pointer;
  border: 1px solid transparent; transition: transform .12s ease, box-shadow .15s, background .15s, border-color .15s;
  text-decoration: none;
}
.btn:hover { text-decoration: none; transform: translateY(-1px); }
.btn svg { width: 17px; height: 17px; }
.btn-primary { background: var(--ink); color: #fff; }
.btn-primary:hover { background: #000; box-shadow: var(--sh-2); }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-deep); box-shadow: 0 6px 18px rgba(224,80,31,.28); }
.btn-ghost { background: var(--bg); color: var(--ink); border-color: var(--line-2); box-shadow: var(--sh-1); }
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-hf { background: #FFD21E; color: #23221E; }
.btn-hf:hover { background: #FFC400; color: #23221E; box-shadow: 0 6px 16px rgba(255,193,30,.32); }
.btn[data-todo] { opacity: .92; }
.btn[data-todo]::after {
  content: "soon"; font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: .05em;
  background: rgba(255,255,255,.22); color: #fff; padding: 2px 6px; border-radius: 5px; text-transform: uppercase;
}

/* ---------- sections ---------- */
section { padding: 76px 0; }
.section-surface { background: var(--surface); border-top: 1px solid var(--line); border-bottom: 1px solid var(--line); }
.section-carbon { background: var(--carbon); border-top: 1px solid var(--carbon-2); }

.section-title {
  font-family: var(--display); font-weight: 500; letter-spacing: -.025em;
  font-size: clamp(25px, 3.4vw, 37px); color: var(--ink);
  margin: 0 0 14px; line-height: 1.12;
}
.section-lead { color: var(--ink-2); font-size: 17.5px; max-width: 720px; margin: 0 0 36px; line-height: 1.6; }
.center { text-align: center; }
.center .section-lead, .center .eyebrow { margin-left: auto; margin-right: auto; }
.center .eyebrow { justify-content: center; }

/* ---------- Acknowledgement ---------- */
.ack-text { color: var(--ink-2); font-size: 16px; max-width: 820px; margin: 0; line-height: 1.7; }
.ack-text + .ack-text { margin-top: 14px; }
.ack-text b { color: var(--ink); font-weight: 600; }

/* ---------- TL;DR ---------- */
.tldr {
  background: var(--bg); border: 1px solid var(--line);
  border-radius: var(--r); padding: 26px 30px; box-shadow: var(--sh-1);
  font-size: 18px; color: var(--ink-2); line-height: 1.62; position: relative;
}
.tldr::before {
  content: ""; position: absolute; left: 0; top: 16px; bottom: 16px; width: 3px;
  background: var(--accent); border-radius: 3px;
}
.tldr b { color: var(--ink); font-weight: 600; }

/* ---------- stat band ---------- */
.stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--r); overflow: hidden; }
.stat { background: var(--bg); padding: 28px 20px; text-align: center; transition: background .15s; }
.stat:hover { background: var(--bg-2); }
.stat .num {
  font-family: var(--display); font-weight: 500; font-size: 38px; line-height: 1;
  color: var(--ink); letter-spacing: -.03em;
}
.stat .num small { font-size: 19px; color: var(--accent); font-weight: 500; }
.stat .lbl { font-family: var(--mono); font-size: 11.5px; color: var(--muted); margin-top: 11px; letter-spacing: .03em; line-height: 1.5; text-transform: uppercase; }

/* ---------- cards ---------- */
.cards { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; }
.card {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 26px; transition: border-color .15s, transform .15s, box-shadow .15s;
}
.card:hover { transform: translateY(-2px); border-color: var(--line-2); box-shadow: var(--sh-2); }
.card .icon {
  width: 38px; height: 38px; border-radius: 10px; display: grid; place-items: center;
  background: var(--accent-tint); color: var(--accent); margin-bottom: 16px; font-size: 18px;
}
.card h3 { font-family: var(--display); font-weight: 600; font-size: 18px; color: var(--ink); margin: 0 0 8px; letter-spacing: -.01em; }
.card p { margin: 0; color: var(--ink-2); font-size: 15px; line-height: 1.58; }

/* ---------- figures ---------- */
.figure {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  box-shadow: var(--sh-1); overflow: hidden; margin: 0;
}
.figure .frame { padding: 22px; background: #fff; display: flex; align-items: center; justify-content: center; }
.figure img { max-width: 100%; height: auto; border-radius: 4px; cursor: zoom-in; }
.figure figcaption {
  padding: 17px 26px 19px; font-size: 15px; color: var(--ink-2); line-height: 1.6;
  border-top: 1px solid var(--line); background: var(--bg);
}
.figure figcaption b { color: var(--ink); font-weight: 600; }

/* standalone square-ish figure: constrain the whole card and center it */
.figure.compact { max-width: 680px; margin-left: auto; margin-right: auto; }
.figure.compact img { max-width: 520px; width: 100%; }

/* equal-height pair: both frames identical height, images contained & centered */
.fig-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: stretch; }
.fig-grid .figure { display: flex; flex-direction: column; }
.fig-grid .figure .frame { height: 340px; }
.fig-grid .figure img { max-width: 100%; max-height: 100%; width: auto; height: auto; object-fit: contain; }
.fig-grid .figure figcaption { flex: 1 0 auto; }

.fig-stack { display: grid; gap: 22px; }

/* ---------- prose / abstract ---------- */
.abstract-box {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 32px 36px; box-shadow: var(--sh-1); font-size: 16.5px; line-height: 1.72; color: var(--ink-2);
}
.abstract-box p { margin: 0; }
.abstract-box p + p { margin-top: 16px; }
.abstract-box b { color: var(--ink); font-weight: 600; }
.abstract-box .lead-q { color: var(--accent); font-weight: 600; }
.abstract-box em { color: var(--ink); font-style: italic; }

/* ---------- pipeline steps (numbering is real: a 3-step sequence) ---------- */
.steps { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-top: 30px; counter-reset: step; }
.step {
  background: var(--bg); border: 1px solid var(--line); border-radius: var(--r);
  padding: 24px; position: relative;
}
.step .n {
  font-family: var(--mono); font-weight: 500; font-size: 12px; color: var(--accent);
  letter-spacing: .1em; margin-bottom: 12px; display: block;
}
.step h4 { font-family: var(--display); margin: 0 0 7px; font-size: 16.5px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.step p { margin: 0; font-size: 14px; color: var(--ink-2); line-height: 1.55; }
.step code { font-family: var(--mono); font-size: .86em; background: var(--surface); padding: 1px 5px; border-radius: 4px; color: var(--accent-deep); }

/* ---------- domain chips ---------- */
.chips { display: flex; flex-wrap: wrap; gap: 9px; margin-top: 28px; }
.chip {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 13px; font-size: 13.5px; color: var(--ink); display: inline-flex; align-items: center; gap: 9px;
  transition: border-color .15s;
}
.chip:hover { border-color: var(--line-2); }
.chip .cnt { font-family: var(--mono); background: var(--surface); color: var(--accent); font-weight: 500; font-size: 12px; padding: 1px 7px; border-radius: 5px; }

/* ---------- result highlight cards ---------- */
.result-cards { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 36px; }
.rc { background: var(--bg); border: 1px solid var(--line); border-radius: var(--r); padding: 26px; transition: border-color .15s, box-shadow .15s; }
.rc:hover { border-color: var(--line-2); box-shadow: var(--sh-2); }
.rc .big { font-family: var(--display); font-weight: 500; font-size: 34px; color: var(--accent); letter-spacing: -.03em; line-height: 1; }
.rc h4 { font-family: var(--display); margin: 12px 0 7px; font-size: 16px; font-weight: 600; color: var(--ink); letter-spacing: -.01em; }
.rc p { margin: 0; font-size: 13.5px; color: var(--ink-2); line-height: 1.55; }

/* ---------- result subsection header ---------- */
.subhead { display: flex; align-items: baseline; gap: 14px; flex-wrap: wrap; margin: 50px 0 18px; padding-top: 18px; border-top: 1px solid var(--line); }
.subhead .tag { font-family: var(--mono); font-size: 11.5px; color: var(--accent); font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.subhead h3 { font-family: var(--display); font-size: 21px; font-weight: 600; color: var(--ink); margin: 0; letter-spacing: -.015em; }
.subhead .note { font-size: 13.5px; color: var(--muted); margin-left: auto; }

/* ---------- data tables ---------- */
.tbl-wrap { overflow-x: auto; border: 1px solid var(--line); border-radius: var(--r); background: var(--bg); box-shadow: var(--sh-1); -webkit-overflow-scrolling: touch; }
table.data { width: 100%; border-collapse: collapse; font-size: 12.5px; }
table.data th, table.data td { padding: 8px 12px; text-align: right; white-space: nowrap; border-bottom: 1px solid var(--line); }
table.data thead th { font-family: var(--mono); font-weight: 500; font-size: 11px; color: var(--ink-2); background: var(--surface); border-bottom: 1.5px solid var(--line-2); }
table.data thead tr.grouprow th { text-align: center; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-size: 10.5px; border-bottom: 1px solid var(--line); background: var(--bg); font-weight: 600; }
table.data tbody td { font-family: var(--mono); color: var(--ink); }
table.data th:first-child, table.data td:first-child { text-align: left; font-family: var(--body); font-weight: 500; color: var(--ink); }
table.data tbody tr:last-child td { border-bottom: 0; }
table.data td.best { color: var(--accent-deep); font-weight: 700; }
tr.row-section td { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); background: var(--surface); text-align: center; padding: 6px; }
tr.row-finch td { background: var(--accent-tint); }
tr.row-finch td:first-child { color: var(--accent-deep); font-weight: 600; }
tr.row-delta td { background: var(--surface-2); font-size: 11.5px; font-weight: 600; }
tr.row-delta td:first-child { color: var(--ink-2); font-style: italic; font-weight: 500; }
tr.row-sub td:first-child { color: var(--ink-2); font-weight: 500; }
.pos { color: #1B8A5A; }
.neg { color: #C24A24; }
.tbl-note { font-size: 15.5px; color: var(--ink-2); margin: 14px 0 0; line-height: 1.62; }
.tbl-note b { color: var(--ink); font-weight: 600; }

/* ---------- bibtex ---------- */
.bibtex-wrap { position: relative; }
.bibtex {
  background: var(--carbon); color: var(--carbon-ink); border: 1px solid var(--carbon-2); border-radius: var(--r);
  padding: 26px 24px; font-family: var(--mono); font-size: 13px; line-height: 1.75;
  overflow-x: auto; white-space: pre; margin: 0;
}
.copy-btn {
  position: absolute; top: 13px; right: 13px;
  background: rgba(255,255,255,.08); color: #fff; border: 1px solid rgba(255,255,255,.16);
  border-radius: 7px; padding: 6px 12px; font-family: var(--mono); font-size: 12px; font-weight: 500; cursor: pointer;
  display: inline-flex; align-items: center; gap: 7px; transition: background .15s;
}
.copy-btn:hover { background: rgba(255,255,255,.18); }

/* ---------- footer ---------- */
footer { background: var(--carbon); color: var(--carbon-ink); padding: 52px 0 44px; }
footer .container { display: flex; flex-direction: column; gap: 16px; }
footer a { color: var(--accent-soft); }
footer .foot-links { display: flex; gap: 8px; flex-wrap: wrap; }
footer .foot-links a {
  font-family: var(--mono); font-size: 12.5px; color: #fff; padding: 6px 12px; border-radius: 7px;
  border: 1px solid rgba(255,255,255,.14); transition: background .15s; text-decoration: none;
}
footer .foot-links a:hover { background: rgba(255,255,255,.10); }
footer .meta { font-family: var(--mono); font-size: 12px; color: #6E747D; }

/* ---------- lightbox ---------- */
.lb { position: fixed; inset: 0; background: rgba(16,18,22,.94); z-index: 300; display: none; align-items: center; justify-content: center; padding: 32px; cursor: zoom-out; }
.lb.open { display: flex; }
.lb img { max-width: 95vw; max-height: 92vh; border-radius: 8px; box-shadow: var(--sh-3); }

/* ---------- reveal ---------- */
.reveal { opacity: 0; transform: translateY(14px); transition: opacity .55s ease, transform .55s ease; }
.reveal.in { opacity: 1; transform: none; }

/* ---------- responsive ---------- */
/* authors/affils sit on one line on wide screens; wrap when too narrow */
@media (max-width: 1100px) {
  .authors, .affils { white-space: normal; }
}
@media (max-width: 900px) {
  .cards, .steps, .result-cards { grid-template-columns: 1fr; }
  .fig-grid { grid-template-columns: 1fr; }
  .fig-grid .figure .frame { height: auto; }
  .fig-grid .figure img { max-height: none; }
  .nav-links { display: none; }
  .nav-links.open {
    display: flex; position: absolute; top: 58px; right: 14px; flex-direction: column;
    background: var(--bg); border: 1px solid var(--line); border-radius: 12px;
    padding: 8px; box-shadow: var(--sh-2); gap: 2px;
  }
  .nav-toggle { display: inline-flex; }
}
@media (max-width: 560px) {
  body { font-size: 16px; }
  .stats { grid-template-columns: 1fr 1fr; }
  section { padding: 56px 0; }
  .hero-inner { padding: 44px 20px 40px; }
  .abstract-box, .tldr { padding: 24px; }
  .figure .frame { padding: 14px; }
}

@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .reveal { transition: none; opacity: 1; transform: none; }
}
