/* mokshshah.dev
   Type: Computer Modern for headings (the face of every paper in this field),
   Fira Sans for text and data. Colour: ink navy on white paper, one blue,
   highlighter yellow reserved for the key result of each study. */

@font-face { font-family: "CMU Serif"; src: url("../fonts/cmunrm.woff") format("woff"); font-weight: 400; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmunti.woff") format("woff"); font-weight: 400; font-style: italic; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmunbx.woff") format("woff"); font-weight: 700; font-style: normal; font-display: swap; }
@font-face { font-family: "CMU Serif"; src: url("../fonts/cmunbi.woff") format("woff"); font-weight: 700; font-style: italic; font-display: swap; }

:root {
  color-scheme: light;
  --paper: #fcfcfb;
  --tint: #f1f4f8;
  --ink: #0f1b33;
  --ink-2: #454c5e;
  --muted: #6c7180;
  --rule: #e1e0d9;
  --rule-strong: #c3c2b7;
  --blue: #1c5cab;
  --blue-series: #2a78d6;
  --orange-series: #eb6834;
  --aqua-series: #1baf7a;
  --highlight: #ffe566;

  --serif: "CMU Serif", "Latin Modern Roman", "Computer Modern", Georgia, serif;
  --sans: "Fira Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: "Fira Code", ui-monospace, Consolas, "SF Mono", monospace;

  --wrap: 1120px;
  --measure: 680px;
  --gutter: 24px;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }

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

img, svg, canvas { max-width: 100%; display: block; }
h1, h2, h3, p, ul, ol, dl, dd, figure, table { margin: 0; }
ul, ol { padding: 0; }

a { color: var(--blue); text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 2px; }
:focus-visible { outline: 2px solid var(--blue-series); outline-offset: 3px; border-radius: 2px; }
::selection { background: var(--highlight); color: var(--ink); }

mark {
  background: linear-gradient(transparent 12%, var(--highlight) 12%, var(--highlight) 92%, transparent 92%);
  color: inherit;
  padding: 0 0.18em;
  margin: 0 -0.06em;
  border-radius: 2px;
  -webkit-box-decoration-break: clone;
  box-decoration-break: clone;
}

.wrap { max-width: var(--wrap); margin-inline: auto; padding-inline: var(--gutter); }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- header ---------- */
.site-header { border-bottom: 1px solid var(--rule); }
.site-header .wrap {
  display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between;
  gap: 4px 32px; padding-block: 18px;
}
.site-name { font-family: var(--serif); font-size: 22px; color: var(--ink); text-decoration: none; letter-spacing: 0.005em; }
.site-nav { display: flex; flex-wrap: wrap; gap: 4px 26px; font-size: 15.5px; }
.site-nav a { color: var(--ink-2); text-decoration: none; padding-block: 4px; border-bottom: 1.5px solid transparent; }
.site-nav a:hover { color: var(--ink); border-bottom-color: var(--rule-strong); }
.site-nav a[aria-current="page"] { color: var(--ink); border-bottom-color: var(--ink); }

/* ---------- footer ---------- */
.site-footer { border-top: 1px solid var(--rule); margin-top: 96px; }
.site-footer .wrap {
  display: flex; flex-wrap: wrap; justify-content: space-between; gap: 8px 32px;
  padding-block: 28px 40px; font-size: 14.5px; color: var(--muted);
}
.site-footer a { color: var(--ink-2); }
.site-footer nav { display: flex; flex-wrap: wrap; gap: 4px 22px; }

/* ---------- shared type ---------- */
.display { font-family: var(--serif); font-weight: 400; font-size: clamp(44px, 6.4vw, 76px); line-height: 1.02; letter-spacing: -0.012em; }
.page-title { font-family: var(--serif); font-weight: 400; font-size: clamp(36px, 4.6vw, 54px); line-height: 1.08; letter-spacing: -0.01em; }
.section-title { font-family: var(--serif); font-weight: 700; font-size: 28px; line-height: 1.2; }
.section-title, .study h3, .cv-row h3, .toolkit h3, .paper-body h2, .paper-body h3, .widget-title { word-spacing: -0.1em; }
.lead { font-size: clamp(18px, 1.5vw, 20px); line-height: 1.55; color: var(--ink-2); max-width: 60ch; }
.small { font-size: 14.5px; color: var(--muted); }
.prose { max-width: var(--measure); }
.prose p + p { margin-top: 1em; }

.button-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 22px; }
.button {
  display: inline-block; font: 500 16px/1 var(--sans); text-decoration: none;
  padding: 13px 20px; border-radius: 3px; border: 1.5px solid var(--ink);
  background: var(--ink); color: var(--paper);
}
.button:hover { background: #1b2c52; border-color: #1b2c52; }
.button.quiet { background: transparent; color: var(--ink); }
.button.quiet:hover { background: var(--tint); border-color: var(--ink); }

.page-head { padding-block: 64px 40px; }
.page-head .lead { margin-top: 18px; }
.section { padding-block: 56px 0; }
.section > .wrap > .section-title { margin-bottom: 8px; }
.section-intro { color: var(--ink-2); max-width: 62ch; margin-bottom: 28px; }

/* ---------- home hero ---------- */
.hero { padding-block: 56px 28px; }
.hero .wrap { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 7fr); gap: 56px; align-items: center; }
.hero-text .lead { margin-top: 22px; }
.hero-text .button-row { margin-top: 30px; }
.hero-text .seeking { margin-top: 26px; font-size: 15px; color: var(--muted); max-width: 46ch; }

.live-figure canvas { width: 100%; height: auto; aspect-ratio: 640 / 400; touch-action: pan-y; }
.live-figure figcaption { margin-top: 10px; }
.figure-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 22px; margin-top: 12px; font-size: 14.5px; color: var(--ink-2); }
.figure-controls label { display: inline-flex; align-items: center; gap: 8px; }
.figure-controls output { font-variant-numeric: tabular-nums; min-width: 3.2ch; display: inline-block; color: var(--ink); }
.text-button { font: 500 14.5px var(--sans); color: var(--blue); background: none; border: 0; padding: 4px 0; cursor: pointer; text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 0.18em; }
.text-button:hover { text-decoration-thickness: 2px; }

input[type="range"] { accent-color: var(--blue-series); width: 132px; margin: 0; }

figcaption { font-family: var(--serif); font-size: 16.5px; line-height: 1.45; color: var(--ink-2); }
figcaption b { font-weight: 700; color: var(--ink); }
figcaption .readout { font-family: var(--sans); font-size: 14.5px; font-variant-numeric: tabular-nums; display: block; margin-top: 6px; color: var(--ink-2); }

/* ---------- research list ---------- */
.studies { list-style: none; border-top: 1.5px solid var(--ink); }
.study { display: grid; grid-template-columns: 232px minmax(0, 1fr); gap: 36px; padding-block: 30px; border-bottom: 1px solid var(--rule); align-items: start; }
.studies > .study:last-child { border-bottom: 1.5px solid var(--ink); }
.study-thumb { display: block; background: var(--paper); text-decoration: none; }
.study-thumb svg, .study-thumb img { width: 100%; height: auto; }
.study-thumb-caption { font-size: 12.5px; color: var(--muted); margin-top: 6px; line-height: 1.35; }
.study h3 { font-family: var(--serif); font-weight: 700; font-size: 23px; line-height: 1.22; }
.study h3 a { color: var(--ink); text-decoration: none; }
.study h3 a:hover { text-decoration: underline; text-decoration-thickness: 1.5px; }
.study p { margin-top: 10px; max-width: 66ch; color: var(--ink-2); }
.study p strong { color: var(--ink); font-weight: 600; }
.study .methods { font-size: 14.5px; color: var(--muted); margin-top: 12px; }
.study .links { margin-top: 12px; font-size: 15.5px; display: flex; flex-wrap: wrap; gap: 4px 20px; }

/* ---------- cv rows ---------- */
.cv { border-top: 1.5px solid var(--ink); }
.cv-row { display: grid; grid-template-columns: 176px minmax(0, 1fr); gap: 36px; padding-block: 26px; border-bottom: 1px solid var(--rule); }
.cv > .cv-row:last-child { border-bottom: 1.5px solid var(--ink); }
.cv-when { font-size: 15px; color: var(--muted); font-variant-numeric: tabular-nums; padding-top: 4px; }
.cv-row h3 { font-family: var(--serif); font-weight: 700; font-size: 21px; line-height: 1.25; }
.cv-where { color: var(--ink-2); margin-top: 2px; }
.cv-row .cv-body { margin-top: 10px; max-width: 68ch; color: var(--ink-2); }
.cv-row .cv-body p + p { margin-top: 0.8em; }
.cv-row ul { margin-top: 10px; padding-left: 1.1em; max-width: 68ch; color: var(--ink-2); }
.cv-row li + li { margin-top: 6px; }
.cv-row li::marker { color: var(--rule-strong); }
.cv-row .carry { margin-top: 12px; font-size: 15.5px; color: var(--ink); max-width: 68ch; }

.two-col { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 40px 56px; }
.three-col { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 32px 48px; }
.toolkit h3 { font-family: var(--serif); font-weight: 700; font-size: 19px; margin-bottom: 6px; }
.toolkit p { color: var(--ink-2); font-size: 16px; }

/* ---------- booktabs tables ---------- */
.table-scroll { overflow-x: auto; }
table.booktabs { border-collapse: collapse; width: 100%; font-size: 15.5px; font-variant-numeric: tabular-nums; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.booktabs caption { caption-side: top; text-align: left; font-family: var(--serif); font-size: 16.5px; color: var(--ink-2); padding-bottom: 10px; }
.booktabs caption b { color: var(--ink); }
.booktabs th, .booktabs td { padding: 7px 14px 7px 0; text-align: right; white-space: nowrap; }
.booktabs th:first-child, .booktabs td:first-child { text-align: left; white-space: normal; }
.booktabs th:last-child, .booktabs td:last-child { padding-right: 0; }
.booktabs thead th { font-weight: 500; color: var(--ink-2); border-bottom: 0.75px solid var(--ink); vertical-align: bottom; }
.booktabs tbody tr.rule-above td { border-top: 0.75px solid var(--rule-strong); }
.booktabs td.note, .booktabs th.note { text-align: left; white-space: normal; }

/* ---------- research note (article) ---------- */
.paper { padding-block: 56px 0; }
.paper .wrap { max-width: 1000px; }
.crumbs { font-size: 14.5px; color: var(--muted); margin-bottom: 18px; }
.crumbs a { color: var(--muted); }
.paper-title { font-family: var(--serif); font-weight: 400; font-size: clamp(34px, 4.4vw, 50px); line-height: 1.1; letter-spacing: -0.01em; max-width: 21ch; }
.byline { margin-top: 16px; color: var(--ink-2); font-size: 16px; }
.abstract { margin-top: 30px; max-width: var(--measure); font-size: 17.5px; line-height: 1.62; }
.abstract b:first-child { font-family: var(--serif); font-size: 19px; }
.facts { margin-top: 28px; max-width: var(--measure); display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 7px 22px; font-size: 15.5px; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule); padding-block: 14px; }
.facts dt { color: var(--muted); }
.facts dd { color: var(--ink); }

.paper-body { counter-reset: sec fig; margin-top: 12px; }
.paper-body > * { max-width: var(--measure); }
.paper-body h2 { font-family: var(--serif); font-weight: 700; font-size: 27px; line-height: 1.2; margin-top: 56px; margin-bottom: 14px; counter-increment: sec; }
.paper-body h2::before { content: counter(sec) "\2002"; }
.paper-body h2.unnumbered { counter-increment: none; }
.paper-body h2.unnumbered::before { content: none; }
.paper-body h3 { font-family: var(--serif); font-weight: 700; font-size: 20px; margin-top: 30px; margin-bottom: 8px; }
.paper-body p { margin-top: 0.95em; }
.paper-body h2 + p, .paper-body h3 + p { margin-top: 0; }
.paper-body ul, .paper-body ol { margin-top: 0.8em; padding-left: 1.3em; }
.paper-body li + li { margin-top: 0.4em; }
.paper-body li::marker { color: var(--muted); }
.paper-body .katex-display { margin: 1.1em 0; overflow-x: auto; overflow-y: hidden; padding-block: 2px; }
.paper-body .katex { font-size: 1.06em; }
.paper-body code { font-family: var(--mono); font-size: 0.86em; background: var(--tint); padding: 1px 5px; border-radius: 3px; }
.paper-body pre { background: var(--tint); padding: 14px 16px; border-radius: 4px; overflow-x: auto; font-size: 14px; line-height: 1.5; margin-top: 1em; }
.paper-body pre code { background: none; padding: 0; font-size: inherit; }

.paper-body figure { margin-top: 30px; margin-bottom: 30px; counter-increment: fig; }
.paper-body figure.wide { max-width: 900px; }
.paper-body figure img { width: 100%; height: auto; border: 1px solid var(--rule); border-radius: 2px; }
.paper-body figure figcaption { margin-top: 10px; max-width: var(--measure); }
.paper-body figure figcaption::before { content: "Figure " counter(fig) ". "; font-weight: 700; color: var(--ink); }
.paper-body .table-scroll { margin-top: 26px; margin-bottom: 26px; max-width: 900px; }

.aside { border-left: 3px solid var(--highlight); padding: 2px 0 2px 16px; margin-top: 1.2em; color: var(--ink-2); font-size: 16px; }
.aside b { color: var(--ink); font-weight: 600; }

.refs { font-size: 15.5px; color: var(--ink-2); padding-left: 1.4em; }
.refs li + li { margin-top: 0.5em; }

.next-prev { margin-top: 64px; padding-top: 22px; border-top: 1.5px solid var(--ink); display: flex; flex-wrap: wrap; justify-content: space-between; gap: 12px 32px; max-width: none; font-size: 16px; }
.next-prev a { color: var(--ink); }
.next-prev span { display: block; font-size: 14px; color: var(--muted); }

/* ---------- interactive widgets ---------- */
.widget { background: var(--tint); border-radius: 4px; padding: 22px 24px 20px; margin-top: 30px; margin-bottom: 30px; max-width: 900px; }
.paper-body .widget { max-width: 900px; }
.widget-title { font-family: var(--serif); font-weight: 700; font-size: 19px; }
.widget-sub { font-size: 15px; color: var(--ink-2); margin-top: 2px; max-width: 70ch; }
.widget-grid { display: grid; grid-template-columns: 250px minmax(0, 1fr); gap: 28px; margin-top: 18px; align-items: start; }
.controls { display: grid; gap: 13px; font-size: 14.5px; }
.control label { display: flex; justify-content: space-between; gap: 12px; color: var(--ink-2); margin-bottom: 3px; }
.control output { color: var(--ink); font-variant-numeric: tabular-nums; font-weight: 500; }
.control input[type="range"] { width: 100%; }
.segmented { display: inline-flex; border: 1px solid var(--rule-strong); border-radius: 3px; overflow: hidden; background: var(--paper); }
.segmented button { font: 500 14px var(--sans); padding: 7px 13px; border: 0; background: transparent; color: var(--ink-2); cursor: pointer; }
.segmented button + button { border-left: 1px solid var(--rule-strong); }
.segmented button[aria-pressed="true"] { background: var(--ink); color: var(--paper); }
.widget canvas, .widget svg.plot { width: 100%; height: auto; background: var(--paper); border-radius: 3px; }
.readouts { display: grid; grid-template-columns: repeat(auto-fit, minmax(104px, 1fr)); gap: 10px 18px; margin-top: 16px; }
.readout-item { font-size: 13.5px; color: var(--muted); }
.readout-item b { display: block; font-size: 19px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; line-height: 1.25; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 4px 18px; font-size: 13.5px; color: var(--ink-2); margin-top: 8px; }
.chart-legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.chart-legend i.dot { width: 8px; height: 8px; border-radius: 50%; }
.widget-note { font-size: 13.5px; color: var(--muted); margin-top: 12px; max-width: 78ch; }

/* ---------- contact ---------- */
.contact-list { border-top: 1.5px solid var(--ink); max-width: 760px; }
.contact-list a { display: grid; grid-template-columns: 150px minmax(0, 1fr); gap: 24px; padding-block: 18px; border-bottom: 1px solid var(--rule); text-decoration: none; color: var(--ink); align-items: baseline; }
.contact-list a:last-child { border-bottom: 1.5px solid var(--ink); }
.contact-list a span:first-child { color: var(--muted); font-size: 15px; }
.contact-list a span:last-child { font-size: 19px; text-decoration: underline; text-decoration-color: var(--rule-strong); text-decoration-thickness: 1px; text-underline-offset: 0.2em; overflow-wrap: anywhere; }
.contact-list a:hover span:last-child { text-decoration-color: var(--ink); }

/* ---------- responsive ---------- */
@media (max-width: 920px) {
  .hero .wrap { grid-template-columns: minmax(0, 1fr); gap: 40px; }
  .three-col { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .widget-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 720px) {
  body { font-size: 16.5px; }
  :root { --gutter: 20px; }
  .hero { padding-block: 36px 12px; }
  .page-head { padding-block: 40px 28px; }
  .study { grid-template-columns: minmax(0, 1fr); gap: 16px; padding-block: 26px; }
  .study-thumb { max-width: 300px; }
  .cv-row { grid-template-columns: minmax(0, 1fr); gap: 4px; }
  .two-col, .three-col { grid-template-columns: minmax(0, 1fr); gap: 28px; }
  .widget { padding: 18px 16px; margin-inline: -8px; }
  .contact-list a { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .site-footer { margin-top: 64px; }
}

@media print {
  .site-header, .site-footer, .widget, .next-prev { display: none; }
  body { font-size: 11pt; }
}

/* ---------- chart tooltip ---------- */
.plot-wrap { position: relative; }
.plot-tip { position: absolute; display: none; pointer-events: none; z-index: 5; background: var(--paper); border: 1px solid var(--rule-strong); border-radius: 3px; padding: 7px 10px; font-size: 13px; line-height: 1.45; color: var(--ink-2); box-shadow: 0 2px 10px rgba(15, 27, 51, 0.08); white-space: nowrap; }
.plot-tip-title { color: var(--ink); font-weight: 500; margin-bottom: 2px; }
.plot-tip-row { display: flex; align-items: center; gap: 7px; }
.plot-tip-row i { width: 10px; height: 3px; border-radius: 2px; flex: none; }
.plot-tip-row b { margin-left: auto; padding-left: 14px; font-weight: 500; color: var(--ink); font-variant-numeric: tabular-nums; }
.widget-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 18px; margin-top: 4px; }
.widget .button { padding: 10px 16px; font-size: 14.5px; cursor: pointer; }
.widget table.booktabs { margin-top: 16px; font-size: 14.5px; }
.segmented.wrap-ok { display: flex; flex-wrap: wrap; border: 0; background: transparent; gap: 6px; overflow: visible; }
.segmented.wrap-ok button { border: 1px solid var(--rule-strong); border-radius: 3px; background: var(--paper); }
.segmented.wrap-ok button + button { border-left: 1px solid var(--rule-strong); }
.segmented.wrap-ok button[aria-pressed="true"] { background: var(--ink); border-color: var(--ink); color: var(--paper); }
.cv-body code { font-family: var(--mono); font-size: 0.86em; background: var(--tint); padding: 1px 5px; border-radius: 3px; }
