:root {
  --bg: #FDFBF6;
  --ink: #15130F;
  --muted: #625D54;
  --rule: #E6E2D8;
  --link: #1D4E89;
  --tag: #8A5300;
  --head: "Helvetica Neue", Helvetica, "Inter Tight", Arial, sans-serif;
  --body: "EB Garamond", Garamond, "Times New Roman", serif;
  --news: "Old Standard TT", Georgia, "Times New Roman", serif;
  /* layout-layer colours, used only in the cell-row strip */
  --diff: #3E9E62; --poly: #D0453E; --m1: #3B78DE; --m2: #9157D0; --via: #D8A31E;
  box-sizing: border-box;
  padding-top: env(safe-area-inset-top, 0px);
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
*, *::before, *::after { box-sizing: inherit; }
html { scroll-padding-top: env(safe-area-inset-top, 0px); background: var(--bg); }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font-family: var(--body); font-size: 1.2rem; line-height: 1.55;
  font-variant-numeric: lining-nums;
  -webkit-font-smoothing: antialiased;
}
main { max-width: 50rem; margin: 0 auto; padding: 3.5rem 1.5rem 3rem; }
a { color: var(--link); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 0.16em; }
a:focus-visible, button:focus-visible, .stories:focus-visible { outline: 2px solid var(--link); outline-offset: 2px; border-radius: 3px; }

/* headings: Helvetica, bold */
h1, h2, h3, h4, .compact .name, .admin-link { font-family: var(--head); font-weight: 700; }
h1, h2 { font-weight: 800; }

/* ---------- intro ---------- */
.intro { display: flex; gap: 2.25rem; align-items: center; }
.photo { flex: 0 0 auto; width: 18rem; height: 18rem; object-fit: cover; border-radius: 50%; background: var(--rule); }
h1 { font-size: 2.6rem; line-height: 1.05; letter-spacing: -0.04em; margin: 0 0 0.5rem; }
.contact { margin: 0 0 1rem; color: var(--muted); }
.bio p { margin: 0 0 0.75rem; }

.cells { display: block; width: 100%; height: auto; margin: 2.25rem 0 0.75rem; }
nav.jump { color: var(--muted); font-size: 1.05rem; margin-bottom: 0.5rem; }

/* ---------- sections, separated by a faint ink stroke ---------- */
section { margin-top: 2.75rem; }
section::before, footer::before {
  content: ""; display: block; height: 7px; margin: 0 0 2.4rem;
  background: url("divider.svg") left center / 100% 100% no-repeat;
  opacity: 0.32;
}
h2 { font-size: 1.5rem; letter-spacing: -0.03em; margin: 0 0 1.2rem; }
h3 { font-size: 1.02rem; margin: 0; line-height: 1.35; }
h4 { font-size: 0.95rem; margin: 2.2rem 0 0.7rem; color: var(--muted); }
.section-note { margin: -0.6rem 0 1.3rem; color: var(--muted); font-size: 1.05rem; }
.when { color: var(--muted); font-variant-numeric: lining-nums tabular-nums; white-space: nowrap; font-size: 1.02rem; }

/* ---------- logos: one tile style ---------- */
.lg { display: block; width: 3rem; height: 3rem; object-fit: contain; background: #fff; border: 1px solid var(--rule); border-radius: 9px; padding: 4px; }
.lg.md { width: 2.4rem; height: 2.4rem; border-radius: 8px; padding: 3px; }
.lg.missing { visibility: hidden; }
.lc { display: flex; flex-direction: column; gap: 0.4rem; }

/* ---------- news: newspaper header, plain list inside ---------- */
.paper { border: 1px solid #1F1C17; background: #FAF8F1; padding: 0.7rem 1rem 0; }
.paper-top { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 0.75rem; }
.ear { justify-self: start; width: 2.3rem; height: 2.3rem; color: #1F1C17; opacity: 0.8; }
.ear.right { justify-self: end; }
.ear svg { display: block; width: 100%; height: 100%; }
.masthead { margin: 0; text-align: center; white-space: nowrap; font-family: "UnifrakturCook", "Old English Text MT", serif; font-weight: 700; font-size: 2rem; line-height: 1.1; color: #15130F; }
.paper-bar { height: 6px; margin-top: 0.5rem; border-top: 1px solid #1F1C17; border-bottom: 3px double #1F1C17; }
.stories { list-style: none; margin: 0; padding: 0 0.35rem 0 0; max-height: 22rem; overflow-y: auto; overscroll-behavior: contain; scrollbar-width: thin; scrollbar-color: #C2BCAE transparent; }
.stories li { display: grid; grid-template-columns: 4.6rem 3rem minmax(0, 1fr); gap: 0.9rem; align-items: center; padding: 0.7rem 0; border-bottom: 1px solid #E4DFD3; }
.stories li:last-child { border-bottom: 0; }
.paper-foot { margin: 0 -1rem; padding: 0.3rem 1rem; border-top: 1px solid #1F1C17; text-align: center; font-family: var(--news); font-style: italic; font-size: 0.75rem; color: #5A554C; }

/* ---------- entries: logo | body ---------- */
.entry { display: grid; grid-template-columns: 3rem minmax(0, 1fr); gap: 1.1rem; margin-bottom: 2rem; }
.entry .meta { margin: 0.1rem 0 0.4rem; color: var(--muted); font-size: 1.08rem; }
.entry p { margin: 0 0 0.45rem; }
.entry ul { margin: 0.2rem 0 0; padding-left: 1.15rem; }
.entry li { margin-bottom: 0.25rem; }
.role-line { display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.role-line .when { padding-top: 0.05rem; }
.links { margin: 0.3rem 0 0; font-size: 1.05rem; color: var(--muted); }

/* publications */
.pubs h3 a { color: var(--ink); }
.pubs h3 a:hover { color: var(--link); }
.pubs .authors { margin: 0.25rem 0 0; }
.pubs .venue { margin: 0 0 0.4rem; font-style: italic; color: var(--muted); }
.pubs .summary { margin: 0; color: #2A2620; }
.tag { display: inline-block; font-family: var(--head); font-size: 0.72rem; font-weight: 700; color: var(--tag); background: #F8EBD3; border-radius: 4px; padding: 0.05rem 0.45rem; margin-left: 0.3rem; vertical-align: 0.12em; }

/* compact lists: logo | text | date */
.compact { list-style: none; margin: 0; padding: 0; }
.compact li { display: grid; grid-template-columns: 2.4rem minmax(0, 1fr) auto; gap: 0.9rem; align-items: center; padding: 0.5rem 0; }
.compact .sub { display: block; color: var(--muted); font-size: 1.05rem; }
.compact .name { font-size: 0.98rem; }

/* ---------- photo grids + viewer ---------- */
.gallery { display: grid; grid-template-columns: repeat(auto-fill, minmax(8.75rem, 1fr)); gap: 0.75rem; margin: 0.9rem 0 0.2rem; }
.photoblock .gallery { grid-template-columns: repeat(5, minmax(0, 1fr)); }
.gallery figure { margin: 0; }
.gallery a { display: block; border-radius: 8px; overflow: hidden; }
.gallery img { display: block; width: 100%; aspect-ratio: 4 / 3; object-fit: cover; background: var(--rule); transition: transform 0.25s ease; }
.gallery a:hover img { transform: scale(1.04); }
.gallery figcaption { font-size: 0.92rem; line-height: 1.3; color: var(--muted); margin-top: 0.35rem; }

.lb { position: fixed; inset: 0; z-index: 50; background: rgba(14, 12, 10, 0.94); display: flex; align-items: center; justify-content: center; padding: 2.5rem 3.5rem; }
.lb[hidden] { display: none; }
.lb figure { margin: 0; max-width: 100%; text-align: center; }
.lb img { display: block; max-width: 100%; max-height: 78vh; margin: 0 auto; border-radius: 6px; }
.lb figcaption { color: #EEE9DF; font-size: 1.05rem; margin-top: 0.8rem; }
.lb button { position: absolute; background: rgba(255,255,255,0.1); color: #fff; border: 0; border-radius: 999px; width: 2.75rem; height: 2.75rem; font-size: 1.5rem; line-height: 1; cursor: pointer; }
.lb button:hover { background: rgba(255,255,255,0.22); }
.lb .lb-close { top: 1rem; right: 1rem; }
.lb .lb-prev { left: 0.75rem; top: 50%; transform: translateY(-50%); }
.lb .lb-next { right: 0.75rem; top: 50%; transform: translateY(-50%); }
.lb .lb-count { position: absolute; top: 1.4rem; left: 1.25rem; color: #B9B2A5; font-size: 0.95rem; }

/* ---------- footer ---------- */
footer { margin-top: 3.5rem; display: flex; flex-wrap: wrap; align-items: center; gap: 1.1rem; color: var(--muted); font-size: 1.02rem; }
footer::before { flex-basis: 100%; margin-bottom: 0.4rem; }
.badge { width: 88px; height: 88px; flex: 0 0 auto; }
.admin-link { color: var(--ink); font-size: 1rem; }
.sig { margin: 0 0 0 auto; display: flex; flex-direction: column; font-family: "Herr Von Muellerhoff", "Brush Script MT", cursive; font-size: 3.2rem; line-height: 0.8; color: #15130F; -webkit-text-stroke: 0.4px #15130F; transform: rotate(-5deg); user-select: none; }
.sig span:last-child { padding-left: 2.4rem; }

@media (max-width: 820px) { .photo { width: 13rem; height: 13rem; } }
@media (max-width: 560px) {
  body { font-size: 1.12rem; }
  main { padding-top: 2rem; }
  .intro { flex-direction: column; align-items: flex-start; gap: 1.25rem; }
  .photo { width: 10rem; height: 10rem; }
  h1 { font-size: 2.1rem; }
  .paper-top { grid-template-columns: 1fr; }
  .ear { display: none; }
  .masthead { font-size: 1.6rem; }
  .stories li { grid-template-columns: 2.4rem minmax(0, 1fr); align-items: start; }
  .stories li .when { grid-column: 2; grid-row: 1; }
  .stories li > span:last-child { grid-column: 2; }
  .stories li .lg { grid-row: 1 / span 2; width: 2.4rem; height: 2.4rem; }
  .entry { grid-template-columns: 2.4rem minmax(0, 1fr); gap: 0.85rem; }
  .entry .lg { width: 2.4rem; height: 2.4rem; }
  .compact li { grid-template-columns: 2.4rem minmax(0, 1fr); }
  .compact .when { grid-column: 2; }
  .gallery, .photoblock .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .sig { margin: 0.5rem 0 0; font-size: 2.7rem; }
  .lb { padding: 3.5rem 0.75rem; }
  .lb .lb-prev, .lb .lb-next { top: auto; bottom: 1rem; transform: none; }
}
@media (prefers-reduced-motion: reduce) { .gallery img { transition: none; } .gallery a:hover img { transform: none; } }

/* the footer logo's orange tick is a quiet way into the notes */
.badge .egg { cursor: default; }

/* ---------- notes app: sidebar | graph | reading pane ---------- */
body.nt-page { height: 100vh; overflow: hidden; }
.nt-app { height: 100vh; display: grid; grid-template-columns: 17rem minmax(0, 0.85fr) minmax(0, 1.25fr); grid-template-rows: auto minmax(0, 1fr); grid-template-areas: "top top top" "side graph main"; }
.nt-app.no-side { grid-template-columns: 0 minmax(0, 0.85fr) minmax(0, 1.25fr); }
.nt-app.no-graph { grid-template-columns: 17rem 0 minmax(0, 1fr); }
.nt-app.no-side.no-graph { grid-template-columns: 0 0 minmax(0, 1fr); }
.nt-app.no-side .nt-side, .nt-app.no-graph .nt-gpane { display: none; }
.nt-top { grid-area: top; display: flex; align-items: center; gap: 0.7rem; padding: 0.65rem 1.1rem; border-bottom: 1px solid var(--rule); background: var(--bg); }
.nt-home { font-family: var(--head); font-weight: 800; letter-spacing: -0.02em; color: var(--ink); }
.nt-sep { color: var(--muted); }
.nt-title { font-family: var(--head); font-weight: 700; color: var(--ink); }
.nt-home:hover, .nt-title:hover { text-decoration: none; color: var(--link); }
#nt-q { margin-left: auto; width: 15rem; font: inherit; font-size: 1rem; padding: 0.3rem 0.8rem; border: 1px solid var(--rule); border-radius: 999px; background: #fff; color: var(--ink); }
.nt-btn { font-family: var(--head); font-size: 0.8rem; font-weight: 700; padding: 0.35rem 0.8rem; border: 1px solid var(--ink); border-radius: 999px; background: transparent; color: var(--ink); cursor: pointer; }
.nt-btn[aria-pressed="true"] { background: var(--ink); color: var(--bg); }

.nt-side { grid-area: side; overflow-y: auto; padding: 1rem 0.7rem 2rem 0.9rem; border-right: 1px solid var(--rule); background: #FAF7F0; font-size: 1.02rem; }
.nt-side ul { list-style: none; margin: 0; padding: 0 0 0 0.85rem; }
.nt-tree > ul { padding-left: 0; }
.nt-dir > details > ul { margin-left: 0.4rem; border-left: 1px solid var(--rule); }
.nt-side summary { cursor: pointer; list-style: none; padding: 0.18rem 0.2rem; font-family: var(--head); font-weight: 700; font-size: 0.88rem; color: #2C2822; }
.nt-side summary::-webkit-details-marker { display: none; }
.nt-side summary::before { content: "\25B8"; display: inline-block; width: 1rem; color: var(--muted); }
.nt-side details[open] > summary::before { content: "\25BE"; }
.nt-side summary span { font-weight: 400; font-size: 0.78rem; color: var(--muted); }
.nt-side li a { display: block; padding: 0.12rem 0.5rem; border-radius: 5px; color: var(--ink); }
.nt-side li a:hover { background: #F0EBE0; text-decoration: none; }
.nt-side li a.on { background: #E8E1D2; font-weight: 600; }

.nt-gpane { grid-area: graph; position: relative; min-width: 0; border-right: 1px solid var(--rule); background: #FFFDF8; }
#nt-graph { display: block; width: 100%; height: 100%; cursor: grab; touch-action: none; }
.nt-hint { position: absolute; left: 0.9rem; bottom: 0.6rem; margin: 0; font-size: 0.82rem; color: var(--muted); pointer-events: none; }

main.nt-main { grid-area: main; overflow-y: auto; max-width: none; margin: 0; padding: 2.2rem 2.6rem 5rem; }
.nt-read { max-width: 42rem; margin: 0 auto; }
.nt-view h1 { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.035em; line-height: 1.1; margin: 0.15rem 0 0.4rem; }
.nt-path { margin: 0; font-family: var(--head); font-size: 0.75rem; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--muted); }
.nt-meta { margin: 0 0 1.5rem; color: var(--muted); font-size: 1.02rem; }
.nt-tag { display: inline-block; margin-right: 0.3rem; padding: 0.05rem 0.45rem; border-radius: 4px; background: #E7EDF5; color: var(--link); font-family: var(--head); font-size: 0.72rem; font-weight: 700; }
.nt-body h2 { font-size: 1.35rem; margin: 2rem 0 0.6rem; }
.nt-body h3 { font-size: 1.12rem; margin: 1.5rem 0 0.5rem; }
.nt-body h4 { font-size: 1rem; margin: 1.2rem 0 0.4rem; }
.nt-body p { margin: 0 0 0.9rem; }
.nt-body ul, .nt-body ol { margin: 0 0 1rem; padding-left: 1.3rem; }
.nt-body li { margin-bottom: 0.25rem; }
.nt-body code { font-family: "JetBrains Mono", Consolas, "Courier New", monospace; font-size: 0.82em; background: #F0EADD; padding: 0.08em 0.3em; border-radius: 4px; }
.nt-body pre { margin: 1rem 0; padding: 0.9rem 1.1rem; overflow-x: auto; border-radius: 8px; background: #1F1C17; color: #F3EEE3; font-size: 0.92rem; line-height: 1.45; }
.nt-body pre code { background: none; padding: 0; color: inherit; font-size: inherit; }
.nt-body blockquote { margin: 1rem 0; padding: 0.4rem 1rem; border-left: 3px solid #D8A31E; background: #FAF4E6; color: #3A352D; }
.nt-body blockquote p { margin: 0.3rem 0; }
.nt-body table { display: block; overflow-x: auto; margin: 1rem 0; border-collapse: collapse; font-size: 1.02rem; }
.nt-body th, .nt-body td { border: 1px solid var(--rule); padding: 0.35rem 0.7rem; text-align: left; vertical-align: top; }
.nt-body th { background: #F3EEE3; font-family: var(--head); font-size: 0.85rem; }
.nt-body img { max-width: 100%; border-radius: 6px; }
.nt-body hr { border: 0; border-top: 1px solid var(--rule); margin: 2rem 0; }
.nt-body .math { overflow-x: auto; }
.wl { border-bottom: 1px dashed currentColor; }
.wl:hover { text-decoration: none; border-bottom-style: solid; }
.wl.missing { color: var(--muted); border-bottom: 1px dotted var(--muted); cursor: help; }
.nt-back { margin-top: 2.5rem; padding-top: 1rem; border-top: 1px solid var(--rule); font-size: 1.05rem; }
.nt-back h4 { margin: 0 0 0.4rem; }
.nt-back ul { margin: 0; padding-left: 1.2rem; }
.nt-h { margin: 1.8rem 0 0.5rem; }
.nt-list { list-style: none; margin: 0; padding: 0; }
.nt-list li { display: flex; justify-content: space-between; gap: 1rem; padding: 0.35rem 0; border-bottom: 1px solid var(--rule); }
.nt-back-home { margin-top: 2.5rem; }

@media (max-width: 900px) {
  body.nt-page { height: auto; overflow: auto; }
  .nt-app, .nt-app.no-side, .nt-app.no-graph, .nt-app.no-side.no-graph { height: auto; min-height: 100vh; grid-template-columns: minmax(0, 1fr); grid-template-rows: auto auto; grid-template-areas: "top" "main"; }
  .nt-side, .nt-gpane, .nt-app.no-side .nt-side, .nt-app.no-graph .nt-gpane { display: none; }
  .nt-app.m-side .nt-side { display: block; grid-area: main; border-right: 0; }
  .nt-app.m-graph .nt-gpane { display: block; grid-area: main; height: 75vh; border-right: 0; }
  .nt-app.m-side .nt-main, .nt-app.m-graph .nt-main { display: none; }
  .nt-top { flex-wrap: wrap; position: sticky; top: 0; z-index: 5; }
  .nt-sep, .nt-title { display: none; }
  #nt-q { order: 5; width: 100%; margin-left: 0; }
  main.nt-main { padding: 1.4rem 1.2rem 4rem; }
}

/* ---------- notes: search results, graph mode chips, home list ---------- */
.nt-results { padding-top: 0.2rem; }
.nt-rcount { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--muted); }
.nt-hit { display: block; padding: 0.45rem 0.55rem; margin-bottom: 0.15rem; border-radius: 6px; color: var(--ink); line-height: 1.3; }
.nt-hit:hover, .nt-hit.first { background: #F0EBE0; text-decoration: none; }
.nt-hit b { display: block; font-family: var(--head); font-size: 0.9rem; }
.nt-hit span { display: block; font-size: 0.8rem; color: var(--muted); }
.nt-hit em { display: block; font-style: normal; font-size: 0.88rem; color: #3A352D; margin-top: 0.15rem; }
.nt-hit mark { background: #F8E3A8; color: inherit; border-radius: 2px; }
.nt-empty { color: var(--muted); font-size: 0.95rem; }
.nt-gbar { position: absolute; top: 0.7rem; right: 0.8rem; display: flex; gap: 0.35rem; }
.nt-chip { font-family: var(--head); font-size: 0.72rem; font-weight: 700; padding: 0.25rem 0.65rem; border: 1px solid var(--rule); border-radius: 999px; background: #fff; color: var(--muted); cursor: pointer; }
.nt-chip[aria-pressed="true"] { border-color: var(--ink); color: var(--ink); }
.nt-chip[hidden] { display: none; }
.nt-all ul { margin: 0.2rem 0 1rem; padding-left: 1.2rem; }
.nt-all .nt-path { margin-top: 0.8rem; }
kbd { font-family: var(--head); font-size: 0.75em; padding: 0.05em 0.35em; border: 1px solid var(--rule); border-bottom-width: 2px; border-radius: 4px; background: #fff; }
