/* Binh Ho — personal site. One serif family, one ink-blue accent. */

:root {
  --paper: #fbfcfd;
  --ink: #1a2233;
  --muted: #5b6476;
  --faint: #8a93a4;
  --rule: #dde2ea;
  --accent: #2b4c9b;
  --accent-soft: #e8edf8;
  --prior: #a3adbf;
  --code-bg: #f1f4f8;
  --fig-bg: #ffffff;
  --measure: 40rem;
  --serif: "Spectral", "Iowan Old Style", "Palatino Linotype", Palatino, Georgia, serif;
  --mono: ui-monospace, "SFMono-Regular", "Cascadia Mono", Menlo, Consolas, monospace;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --paper: #10141c;
    --ink: #e3e7ee;
    --muted: #a0a9b8;
    --faint: #737d8e;
    --rule: #283142;
    --accent: #9db4f0;
    --accent-soft: #1b2438;
    --prior: #56617a;
    --code-bg: #171d29;
    --fig-bg: #f7f8fa;
  }
}
:root[data-theme="dark"] {
  --paper: #10141c; --ink: #e3e7ee; --muted: #a0a9b8; --faint: #737d8e;
  --rule: #283142; --accent: #9db4f0; --accent-soft: #1b2438; --prior: #56617a;
  --code-bg: #171d29; --fig-bg: #f7f8fa;
}

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

html { font-size: 112.5%; -webkit-text-size-adjust: 100%; }
@media (max-width: 40rem) { html { font-size: 106.25%; } }

body {
  margin: 0 auto;
  max-width: calc(var(--measure) + 2.5rem);
  padding: 0 1.25rem;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--serif);
  font-weight: 400;
  line-height: 1.68;
  font-kerning: normal;
  font-variant-numeric: oldstyle-nums proportional-nums;
  text-rendering: optimizeLegibility;
}

a { color: var(--accent); text-decoration-thickness: 0.06em; text-underline-offset: 0.18em; }
a:hover { text-decoration-thickness: 0.12em; }
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--paper); padding: .4rem .7rem; z-index: 10; }

/* Header ------------------------------------------------------------- */
.site-header {
  display: flex; align-items: baseline; justify-content: space-between;
  flex-wrap: wrap; gap: .5rem 1.5rem;
  padding: 1.6rem 0 1.2rem;
}
.wordmark {
  font-family: "Spectral SC", var(--serif);
  font-weight: 500; font-size: 1.05rem; letter-spacing: .04em;
  color: var(--ink); text-decoration: none;
}
.is-home .wordmark { visibility: hidden; }
.site-header nav { display: flex; gap: 1.2rem; }
.site-header nav a { color: var(--muted); text-decoration: none; }
.site-header nav a:hover, .site-header nav a[aria-current="page"] { color: var(--ink); }
.site-header nav a[aria-current="page"] { text-decoration: underline; text-decoration-color: var(--accent); text-decoration-thickness: .09em; text-underline-offset: .35em; }

/* Home hero ---------------------------------------------------------- */
.hero { margin: 1.5rem 0 2.2rem; }
.hero-name {
  font-weight: 300;
  font-size: clamp(2.8rem, 9vw, 4.4rem);
  line-height: 1;
  letter-spacing: -0.015em;
  margin: 0;
}
.hero-role { margin: .7rem 0 0; color: var(--muted); font-size: 1.02rem; }
.hero-curve { display: block; width: 100%; height: auto; margin-top: 1.4rem; overflow: visible; }
.hero-curve path, .hero-curve line { fill: none; }
.hero-curve .axis { stroke: var(--rule); stroke-width: 1; }
.hero-curve .prior { stroke: var(--prior); stroke-width: 1.25; stroke-dasharray: 3 4; }
.hero-curve .posterior { stroke: var(--accent); stroke-width: 1.8; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 0; animation: draw 2.4s cubic-bezier(.45,.05,.2,1) .25s both; }
.hero-curve .obs line { stroke: var(--ink); stroke-width: 1.1; opacity: .55; }
@keyframes draw { from { stroke-dashoffset: 1; } to { stroke-dashoffset: 0; } }
@media (prefers-reduced-motion: reduce) { .hero-curve .posterior { animation: none; } }

/* Intro -------------------------------------------------------------- */
.intro { display: grid; grid-template-columns: minmax(0, 1fr) 10.5rem; gap: 0 2rem; align-items: start; }
.intro .prose { grid-column: 1; grid-row: 1; }
.portrait { grid-column: 2; grid-row: 1; margin: .35rem 0 0; }
.portrait img { display: block; width: 100%; height: auto; border-radius: 3px; filter: saturate(.92); }
@media (max-width: 40rem) {
  .intro { grid-template-columns: 1fr; }
  .portrait { grid-row: auto; grid-column: 1; width: 9.5rem; margin: 0 0 1.2rem; }
  .intro .prose { grid-row: auto; }
}

.epigraph { margin: 1.6rem 0; padding: 0 0 0 1.1rem; border-left: 2px solid var(--accent); }
.epigraph p { margin: 0; font-style: italic; font-size: 1.06rem; }
.epigraph footer { margin-top: .3rem; color: var(--muted); font-size: .92rem; }

.block { margin-top: 3rem; }
.block h2, .year h2 { font-size: 1.15rem; font-weight: 600; margin: 0 0 1rem; }
.more { margin-top: .6rem; }

/* Papers ------------------------------------------------------------- */
.papers { list-style: none; padding: 0; margin: 0; }
.paper { padding: 0 0 1.25rem; }
.paper + .paper { padding-top: 1.25rem; border-top: 1px solid var(--rule); }
.paper p { margin: 0; }
.paper-title { font-weight: 500; line-height: 1.4; }
.paper-authors { color: var(--muted); font-size: .95rem; margin-top: .2rem !important; }
.paper-authors strong { color: var(--ink); font-weight: 600; }
.paper-venue { font-size: .95rem; margin-top: .15rem !important; }
.paper-venue a { margin-left: .55rem; }

/* Note lists --------------------------------------------------------- */
.lede { color: var(--muted); }
.year { margin-top: 2.2rem; }
.note-list { list-style: none; margin: 0; padding: 0; }
.note-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 1.2rem; padding: .45rem 0; }
.note-list li > a { text-decoration: none; color: var(--ink); }
.note-list li > a:hover { color: var(--accent); text-decoration: underline; }
.note-list time { color: var(--faint); font-size: .9rem; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.note-summary { grid-column: 1 / -1; margin: .15rem 0 .2rem; color: var(--muted); font-size: .93rem; line-height: 1.55; }
.note-list.compact li { padding: .3rem 0; }

/* Article ------------------------------------------------------------ */
.page h1, .note-head h1 { font-weight: 500; font-size: clamp(1.75rem, 5vw, 2.3rem); line-height: 1.18; letter-spacing: -0.01em; margin: 1.2rem 0 .5rem; }
.note-meta { color: var(--faint); font-size: .93rem; margin: 0 0 2rem; }
.note-meta .topic::before { content: ""; display: inline-block; width: 1.4em; height: 1px; background: var(--rule); vertical-align: middle; margin: 0 .6em; }

.prose { hyphens: auto; -webkit-hyphens: auto; overflow-wrap: break-word; }
.prose p, .prose ul, .prose ol { margin: 0 0 1.05rem; }
.prose li { margin-bottom: .3rem; }
.prose h2 { font-size: 1.32rem; font-weight: 600; line-height: 1.3; margin: 2.4rem 0 .8rem; }
.prose h3 { font-size: 1.08rem; font-weight: 600; margin: 1.8rem 0 .6rem; }
.prose hr { border: 0; border-top: 1px solid var(--rule); margin: 2.4rem 0; }
.prose blockquote:not(.epigraph) { margin: 1.2rem 0; padding-left: 1rem; border-left: 2px solid var(--rule); color: var(--muted); }
.prose strong { font-weight: 600; }
.prose table { border-collapse: collapse; margin: 1.2rem 0; font-size: .95rem; display: block; overflow-x: auto; }
.prose th, .prose td { padding: .35rem .8rem; border-bottom: 1px solid var(--rule); text-align: left; }
.prose th { font-weight: 600; }

/* Math */
mjx-container[display="true"] { overflow-x: auto; overflow-y: hidden; padding: .15rem 0; margin: 1rem 0 !important; min-width: 0 !important; max-width: 100%; }
mjx-container { font-size: 100% !important; }

/* Theorem-like statements and proofs */
.result {
  margin: 1.5rem 0; padding: .8rem 1.1rem .1rem;
  background: var(--accent-soft); border-left: 2px solid var(--accent); border-radius: 0 3px 3px 0;
}
.result > p:first-child strong:first-child, .proof > p:first-child em:first-child { font-variant-caps: normal; }
.proof { margin: 0 0 1.4rem; }
.proof > :last-child::after { content: "\220E"; float: right; color: var(--muted); margin-left: .6rem; }
.remark { color: var(--ink); }

/* Code */
code, pre { font-family: var(--mono); font-size: .84em; }
:not(pre) > code { background: var(--code-bg); padding: .08em .3em; border-radius: 3px; }
pre { background: var(--code-bg); padding: .9rem 1rem; overflow-x: auto; border-radius: 4px; line-height: 1.5; margin: 0 0 1.2rem; }
pre code { font-size: .84rem; }

/* Figures */
.prose figure { margin: 1.8rem 0; }
.prose figure img, .prose > p > img { display: block; max-width: 100%; height: auto; margin: 0 auto; background: var(--fig-bg); border-radius: 3px; }
.prose figcaption { margin-top: .6rem; color: var(--muted); font-size: .9rem; line-height: 1.5; }
.prose figcaption a { color: inherit; }

/* Prev / next */
.note-nav { display: grid; grid-template-columns: 1fr 1fr; gap: 1.5rem; margin: 3rem 0 0; padding-top: 1.4rem; border-top: 1px solid var(--rule); }
.note-nav a { text-decoration: none; color: var(--ink); font-size: .95rem; line-height: 1.4; }
.note-nav a span { display: block; color: var(--faint); font-size: .85rem; margin-bottom: .15rem; }
.note-nav .next { grid-column: 2; text-align: right; }
.note-nav a:hover { color: var(--accent); }

/* Footer */
.site-footer { margin: 4rem 0 2.5rem; padding-top: 1.2rem; border-top: 1px solid var(--rule); color: var(--muted); font-size: .92rem; }
.site-footer p { margin: 0 0 .4rem; display: flex; flex-wrap: wrap; gap: .3rem 1.2rem; }
.site-footer .fine { display: block; color: var(--faint); font-size: .85rem; }
.site-footer a { color: var(--muted); }

/* Syntax highlighting (rouge), restrained */
.highlight .c, .highlight .c1, .highlight .cm { color: var(--faint); font-style: italic; }
.highlight .k, .highlight .kd, .highlight .kn, .highlight .kr { color: var(--accent); }
.highlight .s, .highlight .s1, .highlight .s2 { color: #3f7d5a; }
.highlight .mi, .highlight .mf { color: #9a5b2e; }
@media (prefers-color-scheme: dark) { .highlight .s, .highlight .s1, .highlight .s2 { color: #8fc6a2; } .highlight .mi, .highlight .mf { color: #d9a77c; } }

@media print {
  .site-header nav, .note-nav, .site-footer { display: none; }
  body { max-width: none; }
}

/* Topic index on the Notes page */
.topic-index { display: flex; flex-wrap: wrap; gap: .35rem 1.1rem; margin: 1.2rem 0 0; font-size: .95rem; }
.topic-index a { color: var(--muted); text-decoration: none; border-bottom: 1px solid var(--rule); }
.topic-index a:hover { color: var(--accent); border-color: var(--accent); }
.year h2 { scroll-margin-top: 1rem; }

/* MathJax 3 does not break long inline formulas; let the paragraph scroll instead of the page. */
.prose p, .prose li, .prose figcaption, .result, .proof { overflow-x: auto; overflow-y: hidden; }
