/* ulam: a live working paper. A white sheet on a grey desk, set in Computer Modern
   (KaTeX's fonts), with the one figure that moves and red only for refutations. */
:root {
  --desk: #e7e6e2;
  --sheet: #ffffff;
  --ink: #111111;
  --muted: #555555;
  --soft: #8a8a8a;
  --rule: #d4d4d0;
  --red: #b8261b;
  --grid: rgba(40, 70, 95, 0.09);
  --grid2: rgba(40, 70, 95, 0.18);

  --serif: 'KaTeX_Main', 'Latin Modern Roman', 'Computer Modern', Georgia, serif;
  --tt: 'KaTeX_Typewriter', 'Latin Modern Mono', ui-monospace, Menlo, monospace;
  --sans: 'KaTeX_SansSerif', 'Latin Modern Sans', system-ui, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 64px; scroll-behavior: smooth; }
body { margin: 0; background: var(--desk); color: var(--ink); font: 400 18px/1.55 var(--serif); -webkit-font-smoothing: antialiased; overflow-x: hidden; padding-inline: 16px; }
a { color: inherit; text-underline-offset: 3px; text-decoration-thickness: 1px; }
p { margin: 0 0 14px; }
.tt { font-family: var(--tt); }
::selection { background: var(--ink); color: var(--sheet); }
:focus-visible { outline: 2px solid var(--ink); outline-offset: 2px; }

/* the bar on the desk, outside the paper */
.bar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; gap: 20px; max-width: 900px; margin: 0 auto; padding: 12px 4px; background: var(--desk); }
.brand { display: flex; align-items: center; gap: 9px; text-decoration: none; font: 400 20px/1 var(--serif); }
.brand svg { display: block; }
.bar nav { margin-left: auto; display: flex; gap: 20px; font: 400 15px var(--serif); font-variant: small-caps; letter-spacing: 0.02em; }
.bar nav a { color: var(--muted); text-decoration: none; text-transform: lowercase; }
.bar nav a:hover { color: var(--ink); }

/* the sheet */
.sheet { max-width: 900px; margin: 8px auto 64px; background: var(--sheet); padding: 72px 84px 56px; box-shadow: 0 1px 2px rgba(0, 0, 0, 0.08), 0 8px 28px rgba(0, 0, 0, 0.07); }
.sheet > section > p, .abstract p, .notes p { text-align: justify; hyphens: auto; }

/* title block, as \maketitle sets it */
.title { text-align: center; margin-bottom: 30px; }
.kind { font: 400 14px var(--serif); font-variant: small-caps; letter-spacing: 0.04em; color: var(--muted); margin-bottom: 18px; }
h1 { font: 400 clamp(30px, 4.2vw, 40px)/1.15 var(--serif); margin: 0 0 18px; letter-spacing: -0.005em; }
.author { font-size: 20px; margin: 0 0 4px; }
.author .fn, sup { font-size: 0.7em; vertical-align: super; line-height: 0; text-decoration: none; }
.date { font-size: 16px; color: var(--muted); margin: 0; }

.abstract { max-width: 620px; margin: 0 auto 36px; font-size: 16.5px; }
.abstract h2 { font: 700 15px var(--serif); text-align: center; margin: 0 0 6px; }
.abstract b { font-weight: 700; }
.keywords { font-size: 15.5px; }

/* sections, numbered as in a paper */
section { margin-top: 30px; }
section h2 { font: 700 21px/1.3 var(--serif); margin: 0 0 12px; }
section h3 { font: 700 17.5px/1.3 var(--serif); margin: 20px 0 8px; }
.sn { display: inline-block; min-width: 1.8em; }
h3 .sn { min-width: 2.4em; }

/* displayed equations, numbered at the right */
.eq { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; margin: 10px 0 14px; overflow-x: auto; }
.eq .katex-display { margin: 0; }
.eq .no { font-size: 17px; padding-left: 16px; }

/* figures */
.fig { margin: 32px 0; }
.fig figcaption { font-size: 15.5px; line-height: 1.5; margin-top: 10px; text-align: justify; hyphens: auto; }
.fig figcaption b { font-weight: 700; }
.fig.side { float: right; width: 236px; margin: 4px 0 14px 28px; }
.fig.side svg { display: block; width: 100%; }
.fig.side figcaption { text-align: left; font-size: 14.5px; }

/* Figure 1: the one that moves */
.live { margin: 8px -28px 36px; }
.fig-body { border: 1px solid var(--ink); padding: 18px 20px 16px; }
.mini { font-size: 13px; color: var(--muted); margin: 0 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.fig-top { display: grid; grid-template-columns: minmax(0, 1fr) 272px; gap: 18px; align-items: start; }
#plot { display: block; width: 100%; height: 392px; min-width: 0; }
.sieve-box { min-width: 0; }
.sv-head { font-size: 12.5px; margin: 0 0 6px; min-height: 2.8em; line-height: 1.4; }
.sv-head b { font-weight: 400; color: var(--red); }
.sv-head b.ink { color: var(--ink); font-weight: 700; }
#sieve { display: block; width: 100%; height: 348px; }
.sv-key { font-size: 11px; color: var(--muted); margin: 6px 0 0; display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.sv-key .k { display: inline-block; width: 9px; height: 7px; margin-right: 4px; vertical-align: -1px; }
.k-fit { background: #bdbdb8; } .k-ok { background: var(--ink); } .k-bad { background: var(--red); }
.tape { font-size: 14.5px; margin: 10px 0 0; min-height: 1.6em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tape .cur { text-decoration: underline; text-underline-offset: 4px; }
.tape .bad { color: var(--red); }
.dim { color: var(--soft); }
/* the working: a difference table and the agent's scratch notes */
.working { display: grid; grid-template-columns: minmax(0, 0.95fr) minmax(0, 1.25fr); gap: 26px; border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 12px; }
.w-h { font: 400 14px var(--serif); font-variant: small-caps; letter-spacing: 0.04em; color: var(--muted); margin: 0 0 6px; }
.dt { border-collapse: collapse; font-size: 12px; }
.dt th { font-weight: 400; color: var(--muted); text-align: left; padding: 1px 10px 1px 0; white-space: nowrap; }
.dt td { text-align: right; padding: 1px 0 1px 9px; white-space: nowrap; color: var(--muted); }
.dt tr.const td, .dt tr.const th { color: var(--ink); font-weight: 700; }
.dt tr.top td { color: var(--ink); }
.dt td.new { text-decoration: underline; text-underline-offset: 3px; }
.dt .note-c { color: var(--ink); font-style: italic; font-family: var(--serif); font-size: 13px; padding-left: 12px; }
.wnotes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; justify-content: flex-end; gap: 7px; height: 15.5em; overflow: hidden; }
.wnotes li { font-size: 15px; line-height: 1.5; color: var(--soft); }
.wnotes li .lbl { display: block; font: 400 11px var(--tt); color: var(--soft); }
.wnotes li:last-child { color: var(--ink); }
.wnotes li:last-child .lbl { color: var(--muted); }
.wnotes li .katex { font-size: 1.02em; }
.wnotes li.bad:last-child .katex, .wnotes li.bad:last-child { color: var(--red); }

.fig-cols { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px; border-top: 1px solid var(--rule); margin-top: 12px; padding-top: 14px; }
.conj { font-size: 18px; line-height: 1.6; margin: 0 0 6px; min-height: 3.2em; }
.conj b { font-weight: 700; }
.conj .stmt-body { font-style: italic; }
.stmt { min-width: 0; }
.conj .tex { margin: 2px 0 4px; overflow-x: auto; overflow-y: hidden; }
.conj .tex .katex-display { margin: 6px 0; }
.conj .tex .katex { font-size: 1.15em; }
/* refuted: red, struck through (KaTeX's inline boxes ignore text-decoration, so draw the line) */
.conj.broke .tex, .conjs li.broke .gr, .booktabs tr.broke .f { color: var(--red); }
.conj.broke .tex .katex-html, .conjs li.broke .gr, .booktabs tr.broke .f { position: relative; display: inline-block; }
.conj.broke .tex .katex-html::after, .conjs li.broke .gr::after, .booktabs tr.broke .f::after { content: ''; position: absolute; left: -2px; right: -2px; top: 52%; border-top: 1.5px solid var(--red); }
.say { font-size: 14px; color: var(--muted); margin: 0; min-height: 1.5em; }
.this { min-width: 0; }
#seqHead .aid { font: 400 14px var(--tt); margin: 0 0 2px; }
#seqHead .aid a { text-decoration: underline; }
#seqHead .aid .by { color: var(--muted); }
#seqHead h3 { font: italic 400 16.5px/1.4 var(--serif); margin: 0 0 4px; overflow-wrap: anywhere; }
#seqHead .smeta { font: 400 12.5px var(--tt); color: var(--muted); margin: 0 0 12px; }
.conjs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.conjs li { font-size: 15px; line-height: 1.45; border-left: 2px solid var(--rule); padding-left: 10px; }
.conjs .gn { font-weight: 700; }
.conjs .gr { overflow-wrap: anywhere; }
.conjs .gv { display: block; font: 400 13px var(--tt); color: var(--muted); }
.conjs li.held { border-left-color: var(--ink); }
.conjs li.held .gv { color: var(--ink); }
.conjs li.broke { border-left-color: var(--red); }
.conjs li.broke .gv, .conjs li.broke .gr { color: var(--red); }
.conjs li.none { color: var(--muted); }

/* tables, booktabs style: three horizontal rules and nothing else */
.scroll { overflow-x: auto; }
.booktabs { width: 100%; border-collapse: collapse; font-size: 15.5px; border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.booktabs caption { caption-side: top; text-align: left; font-size: 15.5px; margin-bottom: 10px; line-height: 1.45; }
.booktabs caption b { font-weight: 700; }
.booktabs th { text-align: left; font-weight: 400; font-style: italic; padding: 7px 10px 6px; border-bottom: 0.8px solid var(--ink); white-space: nowrap; }
.booktabs td { padding: 6px 10px; vertical-align: baseline; }
.booktabs tr.first td { border-top: 0.5px solid var(--rule); }
.booktabs tbody tr:first-child td { border-top: 0; }
.booktabs .r { text-align: right; }
.booktabs .sid { font: 400 14px var(--tt); width: 34%; }
.booktabs .sid a { text-decoration: none; }
.booktabs .sid a:hover { text-decoration: underline; }
.booktabs .sname { display: block; font-size: 13.5px; color: var(--muted); max-width: 30ch; line-height: 1.35; overflow-wrap: anywhere; }
.booktabs .f { overflow-wrap: anywhere; }
.booktabs .out { font-size: 14.5px; white-space: nowrap; }
.booktabs .out.broke, .booktabs .bad { color: var(--red); }
.booktabs .muted { color: var(--muted); }
.booktabs .m { font: 400 13.5px var(--tt); white-space: nowrap; }
.booktabs tr.row { cursor: pointer; }
.booktabs tr.row:hover td { background: #f6f6f4; }
.booktabs .full td { padding: 4px 10px 12px; background: #f6f6f4; }
.booktabs .full dl { display: grid; grid-template-columns: 100px minmax(0, 1fr); gap: 2px 14px; margin: 0; font: 400 12.5px/1.6 var(--tt); }
.booktabs .full dt { color: var(--muted); }
.booktabs .full dd { margin: 0; overflow-wrap: anywhere; }
.rec td { font-size: 14.5px; }
.rec td:nth-child(3) { white-space: nowrap; }
.empty { color: var(--muted); font-style: italic; }

.tabs { display: flex; gap: 2px; margin: 4px 0 14px; font-variant: small-caps; }
.tabs button { font: 400 16px var(--serif); font-variant: small-caps; letter-spacing: 0.02em; background: none; border: 0; padding: 2px 10px 4px; color: var(--muted); cursor: pointer; border-bottom: 1.5px solid transparent; }
.tabs button[aria-selected="true"] { color: var(--ink); border-bottom-color: var(--ink); }
.tabs button:first-child { padding-left: 0; }

/* send */
.send { display: flex; gap: 14px; align-items: flex-end; flex-wrap: wrap; }
.send label { display: flex; flex-direction: column; gap: 4px; font-size: 14px; font-style: italic; color: var(--muted); }
.send input { font: 400 16px var(--tt); color: var(--ink); background: var(--sheet); border: 0; border-bottom: 1px solid var(--ink); padding: 6px 2px; width: 180px; border-radius: 0; }
.send input:focus { outline: none; border-bottom-width: 2px; }
.send button, .older { font: 400 16px var(--serif); font-variant: small-caps; letter-spacing: 0.03em; background: var(--sheet); color: var(--ink); border: 1px solid var(--ink); padding: 6px 16px 8px; cursor: pointer; border-radius: 0; }
.send button:hover, .older:hover { background: var(--ink); color: var(--sheet); }
.smsg { margin: 12px 0 0; min-height: 1.4em; font-size: 16px; }
.smsg.err { color: var(--red); }
.queue { font-size: 13.5px; color: var(--muted); }
.older { margin-top: 12px; font-size: 15px; }

sup.lib { font-size: 0.75em; margin-left: 3px; cursor: help; }
#fig3 svg { display: block; width: 100%; height: auto; }
.changes { list-style: none; margin: 0; padding: 0; font-size: 15.5px; }
.changes li { padding: 4px 0; border-top: 0.5px solid var(--rule); }
.changes li:first-child { border-top: 0; }
.changes .when { font: 400 13px var(--tt); color: var(--muted); margin-right: 6px; }

#libTable .f { white-space: nowrap; }

/* the notebook: a page of dated entries, the date in the margin */
.bar nav a[aria-current="page"] { color: var(--ink); }
.nb .title { margin-bottom: 24px; }
.nb-intro { max-width: 640px; margin: 0 auto 30px; font-size: 16.5px; text-align: justify; hyphens: auto; }
.nb-list { border-top: 1.5px solid var(--ink); border-bottom: 1.5px solid var(--ink); }
.nb-e { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 24px; padding: 18px 0 16px; }
.nb-e + .nb-e { border-top: 0.5px solid var(--rule); }
.nb-m { display: flex; flex-direction: column; font: 400 13px/1.55 var(--tt); color: var(--muted); }
.nb-m b { font: 700 16px/1.45 var(--serif); color: var(--ink); }
.nb-b p { margin: 0; font-size: 17px; line-height: 1.65; }
.nb-b .katex, .nb-quote .katex { font-size: 1.04em; white-space: nowrap; }
.nb-b .aid, .nb-quote .aid { font: 400 14.5px var(--tt); text-decoration: none; border-bottom: 1px solid var(--rule); }
.nb-b .aid:hover, .nb-quote .aid:hover { border-bottom-color: var(--ink); }
.nb-b p.nb-f { margin-top: 10px; font: 400 12.5px/1.5 var(--tt); color: var(--muted); }
.nb-f a { color: var(--muted); }
.nb-draft .nb-m span:nth-child(2) { color: var(--ink); }
.nb-wait { padding: 18px 0; margin: 0; }
/* the latest entry, quoted in the paper */
.nb-quote { margin: 4px 0 18px; padding: 2px 0 2px 18px; border-left: 2px solid var(--ink); font-size: 16.5px; line-height: 1.6; }
.nb-quote .q-h { font: 400 13px var(--tt); color: var(--muted); margin: 0 0 4px; }
.nb-quote p { margin: 0; }

.refs { padding-left: 2.2em; margin: 0; font-size: 16px; }
.refs li { margin-bottom: 6px; padding-left: 4px; }
.refs li::marker { content: '[' counter(list-item) ']  '; }

/* footnotes under a short rule, as LaTeX sets them */
.notes { margin-top: 44px; }
.notes::before { content: ''; display: block; width: 30%; border-top: 0.8px solid var(--ink); margin-bottom: 10px; }
.notes p { font-size: 14px; line-height: 1.5; }

@media (max-width: 760px) {
  body { padding-inline: 0; font-size: 17px; }
  .bar { padding: 10px 16px; }
  .bar nav a { display: none; }
  .bar nav a[href="#fig1"], .bar nav a[href="#results"], .bar nav a[href="notebook.html"], .bar nav a[href="/"] { display: inline; }
  .nb-e { grid-template-columns: 1fr; gap: 6px; padding: 16px 0 14px; }
  .nb-m { flex-direction: row; flex-wrap: wrap; gap: 0 10px; align-items: baseline; }
  .nb-intro { text-align: left; }
  .nb-b .katex, .nb-quote .katex { white-space: normal; }
  .sheet { padding: 40px 18px 40px; margin-top: 0; box-shadow: none; }
  .sheet > section > p, .abstract p, .notes p, .fig figcaption { text-align: left; }
  .live { margin: 8px -10px 28px; }
  .fig-body { padding: 12px; }
  #plot { height: 240px; }
  .fig-top { grid-template-columns: 1fr; }
  #sieve { height: 360px; }
  .fig-cols { grid-template-columns: 1fr; gap: 14px; }
  .working { grid-template-columns: 1fr; gap: 14px; }
  .fig.side { float: none; width: 220px; margin: 8px auto 18px; }
  .hide-s { display: none; }
  .send input { width: 150px; }
}
@media (prefers-reduced-motion: reduce) { html { scroll-behavior: auto; } }
