/* nontemporal.com. Values come from the design handoff doc.

   Garamond uses font-display: optional with every weight preloaded, so text
   never re-renders in a second font: on a first visit over a slow link the
   page keeps the fallback serif, and the next page has Garamond from cache.
   The math font only loads on pages with inline math, so it swaps in. */

@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 400; font-display: optional; src: url("/fonts/eb-garamond-400.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 500; font-display: optional; src: url("/fonts/eb-garamond-500.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: normal; font-weight: 600; font-display: optional; src: url("/fonts/eb-garamond-600.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 400; font-display: optional; src: url("/fonts/eb-garamond-400-italic.woff2") format("woff2"); }
@font-face { font-family: "EB Garamond"; font-style: italic; font-weight: 500; font-display: optional; src: url("/fonts/eb-garamond-500-italic.woff2") format("woff2"); }
@font-face { font-family: "New Computer Modern Math Book"; font-style: normal; font-weight: 400; font-display: swap; src: url("/fonts/newcm-math-book.woff2") format("woff2"); }

:root {
  --ink: #1A1A1A;
  --paper: #FCFCFB;
  --accent: #2F5DB8;
  --text-2: #333333;
  --text-3: #55555C;
  --index-blurb: #4A4A50;
  --index-muted: #6A6A70;
  --leader: #B5B5B5;
  --code-bg: #F6F6F3;
  --code-rule: #E2E2DC;
  --inline-code-bg: #EFEFEA;
  --note-bg: #F2F4F9;
  --grid: #C9C9C4;

  --serif: "EB Garamond", Garamond, serif;
  --sans: Verdana, Geneva, "DejaVu Sans", sans-serif;
  --mono: Menlo, Consolas, "DejaVu Sans Mono", monospace;
  --math: "New Computer Modern Math Book", math;

  color-scheme: light;
}

/* ------------------------------------------------------------ base */

/* Every size below is in rem, so this one number scales the whole site.
   The design was drawn at 100% (1rem = 16px); 90% sets it at 14.4px. It is a
   percentage so a reader's own browser text size still applies. All running
   Verdana text (body, abstract, notes, captions, footnotes) uses line-height 1.6. */
html { font-size: 90%; -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0;
  min-height: 100vh;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--sans);
}
.page { max-width: 45rem; margin: 0 auto; padding: 2.5rem 1.25rem 4rem; box-sizing: border-box; }
.home .page { padding-top: 4rem; font-family: var(--serif); }

a { color: var(--ink); text-decoration: none; }
a:hover { color: var(--accent); text-decoration: underline; text-underline-offset: 3px; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 2px; }

.double-rule { height: 3px; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }

nav { display: flex; flex-wrap: wrap; font-style: italic; }
nav [aria-current="page"] { color: var(--accent); }

/* ------------------------------------------------------------ home */

.masthead { display: flex; flex-direction: column; align-items: center; text-align: center; }
.lockup { display: flex; flex-direction: column; align-items: center; }
.lockup:hover { text-decoration: none; }
.lockup .mark { display: block; width: 2.21875rem; height: 4.3125rem; margin-left: -0.1562rem; margin-bottom: 0.375rem; color: var(--accent); }
.lockup .name { font-size: 2.75rem; font-weight: 500; letter-spacing: -0.01em; line-height: 1.1; }
.lockup:hover .name { text-decoration: underline; text-underline-offset: 3px; }
.masthead .tagline { margin-top: 0.75rem; }
.tagline { font-family: var(--serif); font-size: 1.0625rem; font-variant: small-caps; letter-spacing: 0.08em; color: var(--text-3); }
.masthead nav { margin-top: 1.125rem; justify-content: center; gap: 1.375rem; font-size: 1.125rem; }
.home .double-rule { margin: 2.5rem 0 2.75rem; }

.contents-heading { margin: 0 0 1.75rem; text-align: center; font-size: 1.25rem; font-weight: 500; font-variant: small-caps; letter-spacing: 0.12em; }
.contents { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1.375rem; }
.contents li { display: flex; gap: 1rem; }
.contents .n { flex: 0 0 1.5rem; font-size: 1.3125rem; font-weight: 500; line-height: 1.3; color: var(--accent); }
.contents .entry { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 0.1875rem; }
.contents .line { display: flex; align-items: baseline; gap: 0.5rem; }
.contents .line a { font-size: 1.3125rem; font-weight: 500; line-height: 1.3; }
.contents .leader { flex: 1 1 1.5rem; min-width: 1.5rem; border-bottom: 2px dotted var(--leader); transform: translateY(-0.3125rem); }
.contents time { font-size: 1.0625rem; color: var(--text-3); white-space: nowrap; }
.contents .summary { margin: 0; font-size: 1.125rem; font-style: italic; line-height: 1.45; color: var(--index-blurb); }

.home-footer { margin-top: 4rem; text-align: center; font-size: 1rem; color: var(--index-muted); }
.home-footer .signoff { font-size: 1.25rem; font-style: italic; color: var(--index-blurb); }
.home-footer .copyright { margin-top: 0.375rem; font-variant: small-caps; letter-spacing: 0.06em; }

/* ------------------------------------------------------------ post shell */

.site-header {
  display: flex; flex-wrap: wrap; justify-content: space-between; align-items: baseline;
  gap: 0.625rem 1.5rem; font-family: var(--serif);
}
.wordmark { font-size: 1.75rem; font-weight: 500; line-height: 1; }
.wordmark .d { font-style: italic; color: var(--accent); margin-right: 0.05em; }
.site-header nav { gap: 1.25rem; font-size: 1.1875rem; }
.site-header + .double-rule { margin-top: 1.125rem; }

article { margin-top: 3.5rem; }
.title-block { text-align: center; font-family: var(--serif); }
.title-block h1 { margin: 0; font-size: 2.5rem; font-weight: 500; line-height: 1.12; letter-spacing: -0.005em; }
.title-block .date { display: block; margin-top: 1.125rem; font-size: 1.1875rem; font-style: italic; color: var(--text-3); }
.title-block .tagline { margin-top: 0.75rem; }

.abstract { max-width: 36.25rem; margin: 2.25rem auto 0; font-size: 0.9062rem; line-height: 1.6; color: var(--text-2); }
.abstract-label { margin-bottom: 0.5rem; text-align: center; font-family: var(--serif); font-size: 1.125rem; font-weight: 600; font-variant: small-caps; letter-spacing: 0.1em; color: var(--ink); }
.abstract p { margin: 0; }
.abstract p + p { margin-top: 0.5rem; }

.site-footer {
  margin-top: 3.5rem; display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0.5rem;
  font-family: var(--serif); font-size: 1.125rem; font-style: italic; color: var(--text-3);
}

/* ------------------------------------------------------------ post body */

.body { margin-top: 2.5rem; font-size: 1rem; line-height: 1.6; }
.body > :first-child { margin-top: 0; }
.body p { margin: 1rem 0 0; }

.body h2 { margin: 2.5rem 0 0; font-size: 1.375rem; font-weight: 700; line-height: 1.3; letter-spacing: -0.015em; }
.body h2 .secnum { color: var(--accent); margin-right: 0.75rem; }
.body h3 { margin: 1.875rem 0 0; font-size: 1.0312rem; font-weight: 700; line-height: 1.4; }
.body h4 { margin: 1.5rem 0 0; font-size: 1rem; font-weight: 700; line-height: 1.5; }
.body h2 + p { margin-top: 0.875rem; }
.body h3 + p, .body h3 + ul, .body h3 + ol, .body h4 + p { margin-top: 0.625rem; }

.body ul, .body ol { margin: 0.75rem 0 0; padding-left: 1.5rem; }
.body ol { padding-left: 1.625rem; }
.body li + li { margin-top: 0.375rem; }
.body li > p:first-child { margin-top: 0; }

.formula { font-family: var(--serif); font-style: italic; font-size: 1.2em; }
.colophon { font-size: 0.9062rem; line-height: 1.6; color: var(--text-2); }
.body h2 + .colophon { margin-top: 0.875rem; }

/* Inline code */
code { font-family: var(--mono); font-size: 0.86em; background: var(--inline-code-bg); padding: 0.125rem 0.3125rem; border-radius: 3px; }

/* ------------------------------------------------------------ block elements */

.body figure, .equation, .note { margin: 1.625rem 0 0; }
.body figure + p, .equation + p, .note + p { margin-top: 1.5rem; }

figcaption { margin-top: 0.625rem; text-align: center; font-size: 0.8438rem; line-height: 1.6; color: var(--text-2); }
figcaption strong { color: var(--ink); }
figure.fig-table figcaption { margin: 0 0 0.625rem; }

/* Figures, images, charts, diagrams */
figure .frame { padding: 1.25rem 0 0.875rem; border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); }
figure .frame img, figure .frame svg { display: block; width: 100%; height: auto; }

/* Code listings */
.listing { border-top: 1px solid var(--ink); border-bottom: 1px solid var(--ink); background: var(--code-bg); }
.listing-head {
  display: flex; justify-content: space-between; gap: 0.75rem; padding: 0.5rem 1rem;
  border-bottom: 1px solid var(--code-rule); font-size: 0.75rem; color: var(--text-3);
}
.listing-head .file { font-family: var(--mono); }
.listing-head .lang { margin-left: auto; font-weight: 700; letter-spacing: 0.08em; }
.listing pre { margin: 0; padding: 0.875rem 1rem; overflow-x: auto; }
.listing code { display: block; background: none; padding: 0; border-radius: 0; font-size: 0.8438rem; line-height: 1.7; color: var(--ink); white-space: pre; }
.listing .l { display: block; }
.listing .ln { display: inline-block; width: 1.6em; margin-right: 1.4em; text-align: right; color: #75757B; user-select: none; -webkit-user-select: none; }
.listing strong { font-weight: 700; }

/* Tables */
.table-wrap { overflow-x: auto; }
.table-wrap table { width: 100%; min-width: 32.5rem; border-collapse: collapse; font-size: 0.875rem; line-height: 1.5; }
.table-wrap thead tr { border-top: 1.5px solid var(--ink); border-bottom: 1px solid var(--ink); }
.table-wrap tbody tr:last-child { border-bottom: 1.5px solid var(--ink); }
.table-wrap th { padding: 0.5625rem 0.75rem; font-size: 0.7812rem; font-weight: 700; text-align: left; }
.table-wrap td { padding: 0.5rem 0.75rem; text-align: left; vertical-align: top; }
.table-wrap th:first-child, .table-wrap td:first-child { padding-left: 0; }
.table-wrap th:last-child, .table-wrap td:last-child { padding-right: 0; }
.table-wrap .right { text-align: right; }
.table-wrap .center { text-align: center; }
.table-wrap td code { background: none; padding: 0; font-size: 0.8125rem; }
.table-wrap thead + tbody tr:first-child { border-top: 0; }

/* Note callout */
.note { padding: 0.875rem 1.125rem; background: var(--note-bg); border-left: 3px solid var(--accent); font-size: 0.9375rem; line-height: 1.6; }
.note p:first-child { margin-top: 0; }

/* Math. Display equations are Typst-drawn SVG sized in em, so the font size
   here sets the size of display math. Inline math is MathML in the math font. */
.equation { display: flex; align-items: center; gap: 0.75rem; }
.eq-body { flex: 1 1 auto; min-width: 0; display: flex; overflow-x: auto; overflow-y: hidden; padding: 0.4em 0; font-size: 1.5625rem; }
.eq-body svg { flex: 0 0 auto; margin: 0 auto; }
.eq-num { flex: 0 0 auto; font-size: 0.9375rem; color: var(--text-2); }
math { font-family: var(--math); font-size: 1.2em; }
math[display="block"] { font-size: 1.5625rem; }

/* Footnotes */
sup.fnref { font-size: 0.6875rem; line-height: 0; }
sup.fnref a, .fnnum { color: var(--accent); }
figcaption sup.fnref { font-size: 0.625rem; }
.footnotes { margin-top: 3rem; font-size: 0.8438rem; line-height: 1.6; color: var(--text-2); }
.fn-rule { width: 33%; min-width: 8.75rem; height: 1px; background: var(--ink); margin-bottom: 0.625rem; }
.fn + .fn { margin-top: 0.375rem; }
.fnnum { font-size: 0.75em; vertical-align: super; line-height: 0; margin-right: 0.25rem; }
.fn code { font-size: 0.92em; background: none; padding: 0; }
