@keyframes spin-configurable {
  to {
    transform: rotate(360deg);
  }
}

:root { --font-sans: Newsreader, "Iowan Old Style", Georgia, serif; }   /* the theme's base font: the site is set in Newsreader throughout */

/* Accent color for links and interactive elements */
:root {
  --accent: #1f3fd0;
  --accent-hover: #2c53ea;
  --warm: #b4461f;   /* the site's orange, beside its blue (11-13: it lived only in home.css's .home tokens) */
}
.dark {
  --accent: #8fb0ff;
  --accent-hover: #b3caff;
  --warm: #e5875c;
}

/* the site's display face: headings and the header wordmark, as on the home page */
:is(h1, h2, h3, .prose h1, .prose h2, .prose h3),
header a[class*="text-2xl"] {
  font-family: Newsreader, "Iowan Old Style", Georgia, serif;
  font-weight: 500;
  letter-spacing: -0.01em;
}
header a[class*="text-2xl"] { font-size: 1.35rem; letter-spacing: -0.015em; }

/* Style links in prose content with accent color */
.prose a {
  color: var(--accent) !important;
  text-decoration: none;
  transition: color 0.15s;
}
.prose a:hover {
  color: var(--accent-hover) !important;
  text-decoration: underline;
}

/* Nav link accent on hover */
header a:hover {
  color: var(--accent-hover) !important;
}

/* Profile social icons accent on hover */
.dark nav a:hover {
  opacity: 0.7;
}

/* Smoother page transitions */
main {
  animation: fadeIn 0.3s ease-out;
}
@keyframes fadeIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Long-form pages read as a page of type: serif body at a comfortable measure, which also sits
   better beside KaTeX's own faces. Code, tables and the UI stay in the sans. */
.prose :is(p, li, blockquote, dd, figcaption) {
  font-family: Newsreader, "Iowan Old Style", Georgia, serif;
  font-size: 1.12rem;
  line-height: 1.68;
}
.prose blockquote { font-style: italic; }
.prose :is(code, pre, kbd, samp) { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 0.92rem; font-style: normal; }
.prose :is(h1, h2, h3, h4) { letter-spacing: -0.015em; }
.prose h2 { font-size: 1.75rem; margin-top: 2.2em; }
.prose h3 { font-size: 1.35rem; }

/* ---------------------------------------------------------------- header and footer
   The header is the page's own paper, frosted, with a hairline under it, rather than a grey band;
   it spans the same measure as the home page. */
header.blur-header { background-color: rgba(255, 255, 240, 0.82); border-bottom: 1px solid rgba(20, 20, 30, 0.07); }
.dark header.blur-header { background-color: rgba(31, 32, 34, 0.82); border-bottom-color: rgba(255, 255, 255, 0.07); }
.open header.blur-header { background-color: var(--ground, #fffff0); }
.dark.open header.blur-header { background-color: var(--ground, #1f2022); }   /* the open phone menu is solid, so the hero does not show through */
/* one left edge for the whole site: a 1040px column with a 20px gutter, the same as the home page, the listings and the footer */
header.blur-header > div { max-width: 1080px; padding-left: 20px; padding-right: 20px; }
@media (max-width: 808px) { main.prose { padding-left: 20px; padding-right: 20px; } }
header .primary-link { font-size: 0.98rem; font-weight: 500; }
@media (min-width: 1024px) { header .primary-link { padding-left: 0.7rem; padding-right: 0.7rem; } }

footer.site-foot { width: min(1040px, calc(100% - 40px)); margin: 72px auto 0; padding: 18px 0 40px; font-size: 0.84rem;
  display: flex; flex-wrap: wrap; gap: 6px 18px; align-items: baseline; color: rgba(20, 20, 30, 0.62);
  border-top: 1px solid rgba(20, 20, 30, 0.08); }
.dark footer.site-foot { color: rgba(255, 255, 255, 0.58); border-top-color: rgba(255, 255, 255, 0.08); }
footer.site-foot a { color: inherit; text-decoration: none; border-bottom: 1px solid rgba(128, 128, 136, 0.35); border-bottom-color: color-mix(in srgb, currentColor 35%, transparent); }
footer.site-foot a:hover { color: var(--accent); }
footer.site-foot .tally { margin-left: auto; font-variant-numeric: tabular-nums; }
footer.site-foot .tally b { font-weight: 600; color: var(--accent); }
footer.site-foot .tally:has(> #tally:empty):has(> #foldtally:empty) { display: none; }   /* nothing computed or unfolded yet: no line, no gap */
@media (max-width: 640px) { footer.site-foot .tally { margin-left: 0; flex-basis: 100%; } }
/* the CV's two downloads: plain serif links with the site's hand-drawn pencil underline (matching the homepage social links) */
.cv-download { position: relative; display: inline-block; padding: 0.25rem 1px 4px; margin: 0 1.8rem 0.4rem 0; color: inherit !important;
  text-decoration: none !important; font: 500 1.05rem/1.2 Newsreader, "Iowan Old Style", Georgia, serif; transition: color 0.15s; }
.cv-download::after { content: ""; position: absolute; left: -1px; right: -1px; bottom: -1px; height: 5px; pointer-events: none;
  background: currentColor; opacity: 0.42;
  -webkit-mask: url(../images/marks/underline.svg) 0 0 / 100% 100% no-repeat; mask: url(../images/marks/underline.svg) 0 0 / 100% 100% no-repeat;
  transition: opacity 0.15s, background-color 0.15s; }
.cv-download:is(:hover, :focus-visible) { color: var(--accent) !important; }
.cv-download:is(:hover, :focus-visible)::after { background: var(--accent); opacity: 1; }
@media (prefers-reduced-motion: reduce) { .cv-download, .cv-download::after { transition: none; } }

/* a display equation wider than the screen scrolls inside its own box instead of widening the page
   (on a phone, a long line in the writing pieces pushed the whole page, and the menu button, sideways) */
.prose .katex-display { position: relative; overflow-x: auto; overflow-y: hidden; padding-block: 0.2em; }   /* relative: KaTeX's hidden MathML copy is absolutely positioned and would still widen the page */

/* the closing figure of a writing piece (templates/page.html), as the dissertation's chapters end */
.fin { display: flex; justify-content: center; margin: 3rem 0 2rem; }
.fin svg { width: 180px; height: 28px; overflow: visible; }
.fin path { fill: none; stroke: #8a8a93; stroke-width: 1.3; stroke-linecap: round; stroke-linejoin: round; }
.fin circle { fill: var(--accent); }
@media (prefers-reduced-motion: no-preference) {
  .fin path { stroke-dasharray: 320; stroke-dashoffset: 320; }
  .fin circle { opacity: 0; }
  .fin.drawn path { transition: stroke-dashoffset 2.2s cubic-bezier(.3, .1, .3, 1); stroke-dashoffset: 0; }
  .fin.drawn circle { transition: opacity 0.4s 2s; opacity: 1; }
}
.dark .fin path { stroke: #7c7d86; }
/* a diagram drawn at a fixed width in a writing piece shrinks to the screen (KaTeX's own SVGs are not touched) */
.prose section > svg { max-width: 100%; height: auto; }

/* the eight schools, pooled as you drag tau (static/js/pooltoy.js, in the partial-pooling post) */
.pooltoy { margin: 1.6em 0; }
.pooltoy .pt-svg { width: 100%; height: auto; display: block; }
.pooltoy .pt-grid { stroke: currentColor; opacity: 0.1; }
.pooltoy .pt-tick, .pooltoy .pt-meanlab { font: 11px Newsreader, Georgia, serif; fill: currentColor; opacity: 0.6; }
.pooltoy .pt-bar { stroke: currentColor; opacity: 0.25; stroke-width: 1.5; }
.pooltoy .pt-raw { fill: none; stroke: currentColor; opacity: 0.55; stroke-width: 1.3; }
.pooltoy .pt-pull { stroke: #1f3fd0; opacity: 0.45; stroke-width: 1.5; }
.pooltoy .pt-dot { fill: #1f3fd0; }
.pooltoy .pt-mean { stroke: #a8431c; stroke-dasharray: 4 4; stroke-width: 1.3; }
.pooltoy .pt-meanlab { fill: #a8431c; opacity: 0.9; }
.dark .pooltoy .pt-pull, .dark .pooltoy .pt-dot { stroke: #8fb0ff; fill: #8fb0ff; }
.dark .pooltoy .pt-pull { fill: none; }
.dark .pooltoy .pt-mean { stroke: #f0a27a; } .dark .pooltoy .pt-meanlab { fill: #f0a27a; }
.pooltoy .pt-row { display: flex; flex-wrap: wrap; gap: 0.4rem 0.9rem; align-items: center; font: 0.85rem Newsreader, Georgia, serif; margin-top: 0.4rem; }
.pooltoy .pt-row input { flex: 1; min-width: 10rem; }
.pooltoy .pt-note { opacity: 0.6; font-size: 0.8rem; }

/* the colophon ends on a strip of the site's mesh: right triangles, a few bisected */
.colophon-mesh { height: 40px; margin-top: 2.5rem; opacity: 0.35; background: url("data:image/svg+xml,<svg xmlns='http://www.w3.org/2000/svg' width='80' height='40' viewBox='0 0 80 40'><g fill='none' stroke='%23888' stroke-width='0.8'><path d='M0,0 H80 M0,40 H80 M0,0 V40 M40,0 V40 M80,0 V40 M0,0 L40,40 M80,0 L40,40 M20,20 L40,0 M60,20 L40,0 M20,20 L0,40'/></g></svg>") repeat-x left center;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); mask-image: linear-gradient(90deg, transparent, #000 18%, #000 82%, transparent); }
.dark .colophon-mesh { opacity: 0.5; }
/* (Sam, 11-13) on a phone the colophon is the one page that gets the idle doodle games: empty paper under the strip,
   room for a game and its rules (whimsy.js) */
@media (max-width: 1099.98px) { .colophon-mesh { margin-bottom: 260px; } }

/* a quoted post from X, shown as a quote until someone asks for the embed (Partial-Pooling.md) */
/* (shapes, 11-09) a quotation with its bar, not a box; the button under it is an underlined line of text, not a pill */
blockquote.twitter-tweet { margin: 1.4em 0 0.15em; padding: 0.15rem 0 0.15rem 1.1rem; border: 0;
  border-left: 3px solid #1f3fd0; border-radius: 0; font-style: normal; }
blockquote.twitter-tweet p { margin: 0 0 0.5em; }
blockquote.twitter-tweet p:last-of-type { margin-bottom: 0; }
.tweet-load { font: 0.8rem Newsreader, Georgia, serif; background: none; border: 0;
  border-radius: 0; padding: 0.8em 0; cursor: pointer; color: inherit; opacity: 0.75; margin-bottom: 0.6em;
  text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px;
  text-decoration-color: color-mix(in srgb, currentColor 45%, transparent); }
.tweet-load:hover { opacity: 1; }
html button.tweet-load.tweet-load.tweet-load:is(:hover, :active):not(:disabled) { background-color: transparent !important; }

/* ---------------------------------------------------------------- the CV's downloads (static/js/cvpages.js) */
/* miniature see-through hand-drawn CV/Resume sheets standing in a hand-sketched desk printer beside the links */
.cv-download.cvp-on { padding-left: 3.35rem; margin-right: 2.1rem; }
.cv-download.cvp-on::after { left: 3.3rem; }
.cvp { position: absolute; left: -6px; top: 50%; transform: translateY(-50%); margin-top: -4px; overflow: visible; pointer-events: none; }
.cvp-ref { fill: none; stroke: none; }
.cvp-edge { fill: none; stroke: rgba(23, 23, 27, 0.65); stroke-width: 1.05; stroke-linecap: round; stroke-linejoin: round; }
.cvp-edge.cvp-soft { stroke-width: 0.58; opacity: 0.42; }
.cvp-fold { fill: none; stroke: rgba(23, 23, 27, 0.48); stroke-width: 0.8; stroke-linecap: round; stroke-linejoin: round; }
.cvp-line { fill: none; stroke: rgba(23, 23, 27, 0.36); stroke-width: 0.55; stroke-linecap: round; stroke-linejoin: round; }
.cvp-h { stroke: rgba(23, 23, 27, 0.64); stroke-width: 0.85; }
.cvp-t { stroke: rgba(23, 23, 27, 0.78); stroke-width: 1.25; }
.cvp-light { fill: rgba(23, 23, 27, 0.38); }
.cvp-flysheet { fill: none; stroke: rgba(23, 23, 27, 0.68); stroke-width: 1.05; stroke-linejoin: round; }
.dark .cvp-edge { stroke: rgba(237, 238, 241, 0.62); }
.dark .cvp-fold { stroke: rgba(237, 238, 241, 0.44); }
.dark .cvp-line { stroke: rgba(237, 238, 241, 0.34); }
.dark .cvp-h { stroke: rgba(237, 238, 241, 0.6); }
.dark .cvp-t { stroke: rgba(237, 238, 241, 0.74); }
.dark .cvp-light { fill: rgba(237, 238, 241, 0.38); }
.dark .cvp-flysheet { stroke: rgba(237, 238, 241, 0.65); }
/* stacked in the printer slot: page 2 sits up and right behind page 1; first hover finishes feeding them out */
.cvp-page { translate: calc(var(--i) * 3.5px) calc(var(--i) * -3px); }
.cvp-flyer, .cvp-trail { display: none; }
.cv-download:not(.printed) .cvp-page { transform: translateY(var(--H)); }
.cv-download:not(.printed) .cvp-top { transform: translateY(var(--rest)); }
.cv-download.printing .cvp-page { animation: cvp-feed 0.45s steps(8, end) both; animation-delay: calc(0.12s + (var(--i) - 1) * 0.45s + 0.3s); }
.cv-download.printing .cvp-top { animation: cvp-feed-rest 0.3s steps(5, end) 0.05s both; }
.cv-download.printing .cvp-printer { animation: cvp-hum 0.08s linear calc(var(--n) * 5 + 1) both; }
.cv-download.printing .cvp-light { animation: cvp-blink 0.24s steps(1) calc(var(--n) * 2 + 1) both; }
@keyframes cvp-feed { from { transform: translateY(var(--H)); } to { transform: none; } }
@keyframes cvp-feed-rest { from { transform: translateY(var(--rest)); } to { transform: none; } }
@keyframes cvp-hum { 50% { transform: translate(0.3px, 0.25px); } }
@keyframes cvp-blink { 50% { fill: var(--accent); } }
.cv-download:is(.printed, :not(.printing)) :is(.cvp-top, .cvp-cut) { transition: transform 0.2s ease-out; }
.cv-download.printed:hover :is(.cvp-top, .cvp-cut) { transform: rotate(-3.5deg) translateY(-1.5px); }

/* plane: clicking folds the top miniature sheet into a paper airplane that glides off, then the printer feeds a fresh copy */
.cv-download.flying .cvp-top, .cv-download.flying .cvp-cut { animation: cvp-reprint 1.9s linear both; }
@keyframes cvp-reprint {
  0%, 76.3% { opacity: 1; transform: translateY(var(--H)); animation-timing-function: steps(6, end); }
  92%, 100% { opacity: 1; transform: none; } }
.cvp-flyer { position: absolute; left: 0; top: 0; offset-rotate: auto; offset-anchor: 50% 50%; pointer-events: none; line-height: 0; }
.cvp-flyer svg { overflow: visible; }
.cvp-turn { transform: rotate(var(--a0, 0deg)); }
.cv-download.flying .cvp-flyer { display: block; animation: cvp-fly 1.9s linear both; }
.cv-download.flying .cvp-turn { animation: cvp-turn 1.9s linear both; }
.cv-download.flying .cvp-words { animation: cvp-words 1.9s linear both; }
/* fast off the hand, then a glide: the first quarter of the flight covers two fifths of the path */
@keyframes cvp-fly {
  0%, 28.9% { offset-distance: 0%; opacity: 1; animation-timing-function: cubic-bezier(.15,.6,.4,1); }
  40.8% { offset-distance: 40%; animation-timing-function: cubic-bezier(.4,.1,.6,1); }
  64% { opacity: 1; }
  76.3%, 100% { offset-distance: 100%; opacity: 0; } }
/* upright, tipped back for the wind-up, then the nose comes round onto the path (+90deg: the sheet's top to the box's +x) */
@keyframes cvp-turn {
  0% { transform: rotate(var(--a0)); animation-timing-function: ease-in; }
  5.3% { transform: rotate(calc(var(--a0) + 6deg)); animation-timing-function: ease-in-out; }
  16%, 28.9% { transform: rotate(var(--a0)); animation-timing-function: ease-out; }
  35.2% { transform: rotate(90deg); animation-timing-function: ease-out; }
  50%, 100% { transform: rotate(90deg) scale(0.8); } }
@keyframes cvp-words { 0%, 5.3% { opacity: 1; } 11%, 100% { opacity: 0; } }
.cvp-trail { position: absolute; left: 0; top: 0; overflow: visible; pointer-events: none; }
.cv-download.flying .cvp-trail { display: block; animation: cvp-trail-fade 1.9s linear both; }
.cvp-dash { fill: none; stroke: rgba(23, 23, 27, 0.4); stroke-width: 1; stroke-dasharray: 2.5 4; stroke-linecap: round; }
.dark .cvp-dash { stroke: rgba(237, 238, 241, 0.38); }
.cvp-reveal { fill: none; stroke: #fff; stroke-width: 6; stroke-dasharray: 100; stroke-dashoffset: 100; }
.cv-download.flying .cvp-reveal { animation: cvp-reveal 0.9s linear 0.55s both; }
@keyframes cvp-reveal {
  0% { stroke-dashoffset: 100; animation-timing-function: cubic-bezier(.15,.6,.4,1); }
  25% { stroke-dashoffset: 60; animation-timing-function: cubic-bezier(.4,.1,.6,1); }
  100% { stroke-dashoffset: 0; } }
@keyframes cvp-trail-fade { 0%, 55% { opacity: 1; } 85%, 100% { opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cv-download .cvp * { animation: none !important; transition: none !important; } }


/* ---------------------------------------------------------------- pencil rules */
/* The page's structural lines are the same pencil-grain stroke as the rule under the home page's section headings
   (images/rule-grain.svg, repeated, fading in at the start and out over the last third): the footer's, the CV's
   section breaks, the writing list's top, the end of a dissertation chapter and its breaks. Row separators, tables,
   the controls' edges and the lines inside the cards stay plain hairlines. */
:root { --grain-ink: rgba(112, 112, 122, 0.8); --grain-mask: url(/images/rule-grain.svg) 0 0 / 5.5rem 100% repeat-x, linear-gradient(to right, transparent, #000 1.5%, #000 70%, transparent); }
.dark { --grain-ink: rgba(142, 143, 152, 0.8); }
footer.site-foot, .home .entries, .pager { position: relative; border-top: 0; }
:is(footer.site-foot, .home .entries, .pager)::before { content: ""; position: absolute; left: -2px; right: 0; top: -2.6px; height: 5.3px; pointer-events: none; }
:is(footer.site-foot, .home .entries, .pager)::before, article hr, .body hr {
  background: var(--grain-ink); -webkit-mask: var(--grain-mask); -webkit-mask-composite: source-in; mask: var(--grain-mask); mask-composite: intersect; }
footer.site-foot::before { opacity: 0.6; }   /* the footer's line is the quietest */
article hr, .body hr { border: 0; height: 5.3px; }


/* ---------------------------------------------------------------- (interior audit 2, 11-06) the browser's own marks, in pencil
   A disclosure's triangle and a select's arrow were the browser's stock glyphs: each is now one small pencil stroke
   (images/marks/*.svg: tapered ends, a slight waver, the toggle's grain), in the ink's grey. The controls are the
   same elements, so they open, take focus and read out as before. */
details > summary { list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details > summary::before { content: ""; display: inline-block; width: 0.7em; height: 0.7em; margin-right: 0.4em; vertical-align: -0.02em;
  background: currentColor; opacity: 0.75; -webkit-mask: url(../images/marks/chevron.svg) center / contain no-repeat; mask: url(../images/marks/chevron.svg) center / contain no-repeat;
  transition: transform 0.15s; }
details[open] > summary::before { transform: rotate(90deg); }
@media (prefers-reduced-motion: reduce) { details > summary::before { transition: none; } }
html select:not([multiple]):not([size]) { -webkit-appearance: none; appearance: none; padding-right: 1.9em !important;
  background-image: url(../images/marks/chevron-down-light.svg) !important; background-repeat: no-repeat !important;
  background-position: right 0.6em center !important; background-size: 0.9em 0.9em !important; }
html.dark select:not([multiple]):not([size]) { background-image: url(../images/marks/chevron-down-dark.svg) !important; }

/* (interior audit 2, 11-06) the theme's flat tinted boxes (a post's contents and tags, the tags page) are clear: the
   paper runs through, and only what is a link or a card keeps a quiet pencil-weight edge */
.block-bg { background-color: transparent !important; }
/* (shapes, 11-09) and those lose the edge too: a tag is a link in the link colour, the tags page a heading and a list */
a.block-bg:hover { text-decoration: underline; text-decoration-thickness: 1px; text-underline-offset: 3px; }
/* the quoted post's bar in the dark page's accent (it stayed the light page's blue) */
html.dark blockquote.twitter-tweet { border-left-color: #8fb0ff; }
/* the writing pages' way back up (partials/crumb.html): the reading notes' crumb (study-note.css), with home.css's --ink-3,
   on the theme's prose pages */
main.prose .crumb { --ink-3: #62626c; font-size: 0.85rem; color: var(--ink-3); margin: 0 0 0.5rem; }
.dark main.prose .crumb { --ink-3: #8e8f98; }
main.prose .crumb a { color: var(--ink-3) !important; }
main.prose .crumb a:hover { color: var(--accent) !important; text-decoration: none; }
main.prose .crumb span { margin: 0 0.3rem; opacity: 0.6; }

/* (11-12) anything a link can point to in a post or page lands clear of the fixed header, not under it */
main.prose [id] { scroll-margin-top: 5rem; }
