/* Homepage. Preprint layout: title, author line, numbered figure, project index,
   hanging margin for captions and notes. Self-contained so the page loads one
   stylesheet. Dark mode follows the system setting; the only script is the shared menu. */

@font-face {
  font-family: "Libertinus Serif Display";
  src: url("../fonts/libertinus-serif-display-latin.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Source Serif 4";
  src: url("../fonts/source-serif-4-text.woff2") format("woff2");
  font-weight: 400 600;
  font-style: normal;
  font-display: swap;
}

@font-face {
  font-family: "Plex Mono";
  src: url("../fonts/plex-mono-400.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}

:root {
  --paper: #fdfdfc;
  --ink: #1b2a30;
  --sec: #4d5d63;
  --rule: #d9dfe0;
  --accent: #28566b;
  --accent-strong: #1e4759;
  --on-accent: #ffffff;
  --tint: #eef3f4;
  --bar-2: #7f9ea9;
  --bar-3: #b9ccd2;
  --font-display: "Libertinus Serif Display", Georgia, serif;
  --font-text: "Source Serif 4", Georgia, serif;
  --font-mono: "Plex Mono", ui-monospace, monospace;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root {
    --paper: #13191b;
    --ink: #e6ecee;
    --sec: #a6b4b9;
    --rule: #2b3539;
    --accent: #8cc1d6;
    --accent-strong: #a9d3e3;
    --on-accent: #10181b;
    --tint: #1a2326;
    --bar-2: #5b7f8c;
    --bar-3: #3c5660;
    color-scheme: dark;
  }
}

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

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

body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 400 18px/1.62 var(--font-text);
  font-variant-numeric: tabular-nums;
}

::selection { background: #cfe1e8; color: #1b2a30; }
img { display: block; max-width: 100%; height: auto; }
a { color: var(--accent); text-decoration-thickness: 1px; text-underline-offset: .18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
p, figure, dl, dd { margin: 0; }

h1,
h2,
h3 {
  margin: 0;
  font-family: var(--font-display);
  font-weight: 400;
  letter-spacing: -.012em;
  text-wrap: balance;
}

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

.skip-link { position: absolute; left: -9999px; top: 12px; z-index: 10; padding: 8px 12px; background: var(--paper); }
.skip-link:focus { left: 16px; }

/* Header: same markup and behavior as the subpages */
.site-header { border-bottom: 1px solid var(--rule); }
.nav-shell { max-width: 1120px; margin: 0 auto; padding: 0 40px; display: flex; align-items: center; gap: 28px; min-height: 76px; }
.brand { margin-right: auto; color: var(--ink); text-decoration: none; font-family: var(--font-display); font-size: 24px; }
.brand strong { font-weight: 400; }
.nav-menu { display: flex; gap: 28px; }
.nav-menu a { color: var(--ink); text-decoration: none; font-size: 16px; padding: 10px 0; }
.nav-menu a:hover { color: var(--accent); }
.nav-toggle { display: none; }
.header-email { display: none; }

/* Page grid: main column and hanging margin */
.paper { max-width: 1120px; margin: 0 auto; padding: 0 40px 40px; }
.row { display: grid; grid-template-columns: minmax(0, 660px) 300px; gap: 0 64px; }
.note { font-size: 15px; line-height: 1.5; color: var(--sec); }

/* Title block */
.title { padding: 56px 0 36px; align-items: end; }
.title h1 { font-size: clamp(40px, 4.6vw, 60px); line-height: 1.06; width: min(980px, calc(100vw - 80px)); }
.portrait { width: 180px; margin-left: auto; aspect-ratio: 1; object-fit: cover; }
.byline { margin-top: 24px; font-size: 19px; color: var(--sec); }
.byline .name { font-variant: small-caps; letter-spacing: .04em; color: var(--ink); font-size: 21px; }
.availability { margin-top: 10px; font-size: 17px; color: var(--ink); }
.actions { display: flex; flex-wrap: wrap; gap: 14px 28px; align-items: center; margin-top: 22px; font-size: 17px; }
.btn {
  display: inline-block; padding: 11px 22px; border-radius: 2px;
  background: var(--accent); color: var(--on-accent);
  font-weight: 600; text-decoration: none;
}
.btn:hover { background: var(--accent-strong); }
.btn:active { transform: translateY(1px); }

/* Figure 1 */
.figrow { padding-top: 0; align-items: end; }
.evaluation-figure { padding: 24px 28px 18px; background: var(--tint); animation: reveal 1.1s cubic-bezier(.16, 1, .3, 1) .1s both; }
@keyframes reveal { from { clip-path: inset(0 65% 0 0); } to { clip-path: inset(0 0 0 0); } }
.finding { font-family: var(--font-display); font-size: 21px; line-height: 1.3; margin-bottom: 14px; text-wrap: balance; }
.benchmark-table { width: 100%; border-collapse: collapse; }
.benchmark-table th, .benchmark-table td { padding: 6px 0; text-align: left; font-weight: 400; vertical-align: middle; }
.benchmark-table thead th { font-size: 14px; color: var(--sec); padding-bottom: 10px; }
.benchmark-table tbody th { font-family: var(--font-display); font-size: 19px; width: 82px; }
.plot-cell { padding-right: 16px; }
.benchmark-table meter {
  display: block; width: 100%; height: 22px; border: 0; border-radius: 0;
  background: transparent; border-left: 1px solid var(--sec);
  -webkit-appearance: none; appearance: none;
}
.benchmark-table meter::-webkit-meter-bar { background: transparent; border: 0; border-radius: 0; height: 22px; }
.benchmark-table meter::-webkit-meter-optimum-value,
.benchmark-table meter::-webkit-meter-suboptimum-value,
.benchmark-table meter::-webkit-meter-even-less-good-value { background: var(--accent); border-radius: 0; }
.benchmark-table meter::-moz-meter-bar { background: var(--accent); border-radius: 0; }
.benchmark-table tbody tr:nth-child(2) meter::-webkit-meter-optimum-value { background: var(--bar-2); }
.benchmark-table tbody tr:nth-child(2) meter::-moz-meter-bar { background: var(--bar-2); }
.benchmark-table tbody tr:nth-child(3) meter::-webkit-meter-optimum-value { background: var(--bar-3); }
.benchmark-table tbody tr:nth-child(3) meter::-moz-meter-bar { background: var(--bar-3); }
.score { font-family: var(--font-mono); font-size: 15px; width: 56px; }
.interval { font-family: var(--font-mono); font-size: 13px; color: var(--sec); width: 128px; padding-left: 12px !important; }
.chart-axis {
  display: flex; justify-content: space-between; padding-top: 6px; margin-right: 16px;
  border-top: 1px solid var(--sec); font-family: var(--font-mono); font-size: 12px; color: var(--sec);
}
.evaluation-source { margin-top: 12px; font-size: 14px; line-height: 1.5; color: var(--sec); }
.caption { font-size: 15px; line-height: 1.5; color: var(--sec); }
.fn { color: var(--accent); font-weight: 600; }

h2 { font-size: 34px; line-height: 1.15; margin-bottom: 18px; }

/* Project index: one line per project */
.index { padding-top: 64px; }
.project-index { list-style: none; margin: 0; padding: 0; }
.project-index li {
  display: grid; grid-template-columns: 380px minmax(0, 1fr); gap: 0 32px; align-items: baseline;
  padding: 6px 0;
}
.project-index a { font-family: var(--font-display); font-size: 20px; line-height: 1.3; color: var(--ink); text-decoration-color: var(--rule); }
.project-index a:hover { text-decoration-color: var(--accent); }
.project-index span { font-size: 16px; line-height: 1.45; color: var(--sec); }
.more { margin-top: 14px; font-size: 16px; }

/* Closing */
.closing { padding-top: 64px; }
.closing p { max-width: 62ch; }
.closing .actions a { display: inline-flex; align-items: center; min-height: 44px; }

/* Footer */
.portfolio-footer {
  max-width: 1120px; margin: 40px auto 0; padding: 24px 40px 48px;
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px;
  border-top: 1px solid var(--rule); font-size: 15px;
}
.portfolio-footer ul { display: flex; flex-wrap: wrap; gap: 8px 24px; list-style: none; margin: 0; padding: 0; }
.roles { flex-basis: 100%; color: var(--sec); }

html:not(.js) .nav-toggle {
  display: none;
}

html:not(.js) .nav-menu {
  display: flex;
  position: static;
  flex-direction: row;
  flex-wrap: wrap;
  gap: 16px;
  padding: 0;
  border: 0;
}

@media (prefers-reduced-motion: reduce) {
  .evaluation-figure { animation: none; }
  .btn:active { transform: none; }
}

@media (max-width: 900px) {
  .nav-shell { min-height: 64px; gap: 12px; padding: 0 20px; }
  .brand { font-size: 22px; }
  .header-email { display: inline-flex; align-items: center; min-height: 44px; padding: 0 6px; color: var(--ink); font-size: 17px; text-decoration: none; }
  .nav-menu a[href^="mailto:"] { display: none; }
  .nav-toggle {
    display: inline-grid; place-items: center; width: 44px; height: 44px; padding: 0;
    border: 1px solid var(--rule); border-radius: 2px; background: transparent; color: var(--ink); cursor: pointer;
  }
  .nav-toggle span,
  .nav-toggle span::before,
  .nav-toggle span::after { display: block; width: 18px; height: 1.5px; background: currentColor; position: relative; content: ""; }
  .nav-toggle span::before { position: absolute; top: -6px; }
  .nav-toggle span::after { position: absolute; top: 6px; }
  .nav-toggle[aria-expanded="true"] span { background: transparent; }
  .nav-toggle[aria-expanded="true"] span::before { top: 0; transform: rotate(45deg); }
  .nav-toggle[aria-expanded="true"] span::after { top: 0; transform: rotate(-45deg); }
  .nav-menu {
    display: none; position: absolute; left: 0; right: 0; top: 64px; z-index: 20;
    flex-direction: column; gap: 0; padding: 8px 20px 16px; background: var(--paper); border-bottom: 1px solid var(--rule);
  }
  .nav-menu[data-open] { display: flex; }
  .nav-menu a { padding: 12px 0; font-size: 18px; border-bottom: 1px solid var(--rule); }
  .site-header { position: relative; }
  .paper { padding: 0 20px 32px; }
  .row { grid-template-columns: 1fr; }
  .title { padding: 28px 0 20px; display: flex; flex-direction: column-reverse; align-items: start; }
  .portrait { width: 72px; margin: 0 0 18px; }
  .title h1 { font-size: 33px; width: auto; }
  .byline { font-size: 17px; margin-top: 16px; }
  .evaluation-figure { padding: 16px 14px 12px; margin: 0 -20px; }
  .figrow .note { margin-top: 10px; }
  h2 { font-size: 28px; }
  .index, .closing { padding-top: 48px; }
  .project-index li { grid-template-columns: 1fr; padding: 10px 0; }
  .project-index a { font-size: 19px; }
  .project-index span { font-size: 15px; }
  .portfolio-footer { flex-direction: column; padding: 24px 20px 40px; }
  .portfolio-footer ul { flex-direction: column; gap: 0; }
  .portfolio-footer a { display: inline-flex; align-items: center; min-height: 44px; }
}

@media (max-width: 700px) {
  .interval { display: none; }
  .benchmark-table thead .interval-label { display: none; }
  .benchmark-table tbody th { width: 70px; font-size: 17px; }
}
