/* ============================================
   Pawel Pawlowski — "The Gentleman Logician"
   Pixel-art RPG windows meet classic menswear:
   navy chalk-stripe, oxblood, brass and cream.
   ============================================ */

/* --- Reset --- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { -webkit-text-size-adjust: 100%; scroll-behavior: smooth; }
[id] { scroll-margin-top: calc(var(--nav-h) + 2rem); }
img, picture, video, canvas, svg { display: block; max-width: 100%; }
input, button, textarea, select { font: inherit; color: inherit; }
ul, ol { list-style: none; }
button { background: none; border: none; }
fieldset { border: none; }
[hidden] { display: none !important; }

/* --- Tokens --- */
:root {
  --px: 3px;
  --ink: #0d0a12;
  --gold: #e9c56a;
  --gold-hi: #f6dd98;
  --gold-lo: #9a712c;
  --cream: #f3ead6;
  --oxblood: #7d1d2c;
  --silver: #c8ccd6;

  /* Window colour (Config menu). Default: the navy of the suit. */
  --win-top: #2d3f94;
  --win-bot: #0f173f;
  --win-text: #f3ead6;
  --win-dim: #dce1f4;
  --win-rule: rgba(233, 197, 106, 0.35);
  --win-well: rgba(5, 8, 25, 0.35);

  /* Page (night by default) */
  --bg: #0a0c18;
  --bg-glow: rgba(64, 52, 120, 0.35);
  --weave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 8 4' shape-rendering='crispEdges' fill='%23e9c56a' fill-opacity='.07'%3E%3Crect x='0' y='0' width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='7' y='0' width='1' height='1'/%3E%3Crect x='6' y='1' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='4' y='3' width='1' height='1'/%3E%3C/svg%3E");
  --page-text: #ece4cf;
  --page-dim: #a9a18c;
  --page-label: var(--gold);

  --font-pixel: 'Pixelify Sans', system-ui, sans-serif;
  --font-menu: 'Pixelify Sans', system-ui, sans-serif;
  --font-display: 'Cinzel', 'Trajan Pro', 'Times New Roman', serif;
  --font-body: 'EB Garamond', Garamond, Georgia, serif;

  --max: 1280px;
  --gutter: 1.5rem;
  --nav-h: 4.5rem;
  --cursor: url("../assets/pixel/hand-2x.png") 29 5, pointer;
  color-scheme: dark;
}

:root[data-theme="day"] {
  --bg: #e8dfc7;
  --bg-glow: rgba(255, 250, 230, 0.7);
  --weave: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='12' viewBox='0 0 8 4' shape-rendering='crispEdges' fill='%235a3c1e' fill-opacity='.09'%3E%3Crect x='0' y='0' width='1' height='1'/%3E%3Crect x='1' y='1' width='1' height='1'/%3E%3Crect x='2' y='2' width='1' height='1'/%3E%3Crect x='3' y='3' width='1' height='1'/%3E%3Crect x='7' y='0' width='1' height='1'/%3E%3Crect x='6' y='1' width='1' height='1'/%3E%3Crect x='5' y='2' width='1' height='1'/%3E%3Crect x='4' y='3' width='1' height='1'/%3E%3C/svg%3E");
  --page-text: #1d1a24;
  --page-dim: #5b5446;
  --page-label: var(--oxblood);
  color-scheme: light;
}

:root[data-window="oxblood"] { --win-top: #8a2a3c; --win-bot: #2c0910; --win-dim: #f5dde1; }
:root[data-window="tweed"]   { --win-top: #654f34; --win-bot: #221910; --win-dim: #f3ebdc; }
:root[data-window="bottle"]  { --win-top: #205e46; --win-bot: #071d14; --win-dim: #dcf0e6; }
:root[data-window="charcoal"]{ --win-top: #50505e; --win-bot: #121218; --win-dim: #e6e6ee; }

@media (max-width: 640px) {
  :root { --px: 2px; --gutter: 1rem; --nav-h: 3.75rem; }
}

/* --- Base --- */
body {
  font-family: var(--font-body);
  font-size: 1.25rem;
  line-height: 1.6;
  color: var(--page-text);
  background-color: var(--bg);
  background-image: var(--weave);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
/* The glow at the top of the window stays put while the page scrolls. It is a fixed layer of its own:
   a fixed background (background-attachment: fixed) would make the browser repaint the whole window
   on every step of scrolling. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background: radial-gradient(ellipse at 50% 0%, var(--bg-glow), transparent 60%);
}

a { color: var(--gold); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { color: var(--gold-hi); }
:root[data-theme="day"] main > .container > p a { color: var(--oxblood); }

a, button, [role="button"], label, summary { cursor: var(--cursor); }

p { margin-bottom: 1rem; }
p:last-child { margin-bottom: 0; }
em { font-style: italic; }
strong { font-weight: 600; }

:focus-visible {
  outline: var(--px) dashed var(--gold);
  outline-offset: calc(var(--px) * 1.5);
}

.visually-hidden {
  position: absolute !important;
  width: 1px; height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
}

.skip-link {
  position: absolute;
  top: -100px;
  left: 1rem;
  z-index: 1000;
  padding: 0.75rem 1rem;
  background: var(--gold);
  color: var(--ink);
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 1rem;
  text-decoration: none;
}
.skip-link:focus { top: 1rem; }

.container {
  width: 100%;
  max-width: var(--max);
  margin: 0 auto;
  padding-left: var(--gutter);
  padding-right: var(--gutter);
}

.pixel { image-rendering: pixelated; image-rendering: crisp-edges; }

/* --- The window: gold pixel frame on a gradient, as in a 16-bit RPG --- */
.window {
  position: relative;
  color: var(--win-text);
  background: linear-gradient(180deg, var(--win-top), var(--win-bot));
  background-clip: padding-box;
  border: calc(4 * var(--px)) solid transparent;
  border-image: url("../assets/pixel/frame.svg") 24 stretch;
  box-shadow:
    inset 0 0 0 var(--px) rgba(255, 255, 255, 0.16),
    calc(2 * var(--px)) calc(2 * var(--px)) 0 rgba(0, 0, 0, 0.35);
  padding: 1.25rem 1.5rem;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45);
}

.window--thin {
  border-width: calc(3 * var(--px));
  border-image: url("../assets/pixel/frame-thin.svg") 18 stretch;
  padding: 0.75rem 1rem;
}

.window a:not(.btn) { color: var(--gold); }
/* Text size "Large" (Settings): every size is in rem */
:root[data-text="large"] { font-size: 112.5%; }

/* Readability on the dark windows: text a touch heavier than on paper (the Garamond is variable),
   gold lettering a shade lighter; the drop shadow only on headings and labels, not on running text. */
.window { text-shadow: none; }
.window h1, .window h2, .window h3, .window .label, .window .chapter__title, .window .btn { text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45); }
.window--paper h1, .window--paper h2, .window--paper h3, .window--paper .label { text-shadow: none; }
/* lines of about 70 characters in lists and notes */
.item > div:last-child > *, .log__item > div > *, .news__item p { max-width: 70ch; }
/* the long lists sit on paper: dark ink, oxblood for years, links and labels */
.pub-list { margin-top: 1.25rem; }
.window--paper .talk-year__head { color: var(--oxblood); }
.window--paper .item-group h2 { color: var(--oxblood); }
.window--paper .item__no { color: #5b5446; }
.window:not(.window--paper) { font-weight: 450; }
.window:not(.window--paper) .label, .window:not(.window--paper) a:not(.btn) { color: #f2d586; }
.window a:not(.btn):hover { color: var(--gold-hi); }

/* --- Pixel labels and buttons --- */
.label {
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 1.22rem;
  line-height: 1.45;
  letter-spacing: 0.07em;
  font-variant-caps: all-small-caps;
  font-variant-numeric: lining-nums;
  color: var(--page-label);
}
.window .label { color: var(--gold); }

.btn {
  display: inline-flex;
  align-items: center;
  gap: 0.6rem;
  padding: 0.6rem 1rem 0.55rem;
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 1.05rem;
  line-height: 1.4;
  letter-spacing: 0.02em;
  text-decoration: none;
  color: var(--win-text);
  background: linear-gradient(180deg, var(--win-top), var(--win-bot));
  background-clip: padding-box;
  border: calc(3 * var(--px)) solid transparent;
  border-image: url("../assets/pixel/frame-thin.svg") 18 stretch;
  text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.5);
  transition: transform 0.08s steps(2), filter 0.12s;
  white-space: nowrap;
}
.btn:hover { color: var(--gold-hi); filter: brightness(1.2); }
.btn:active { transform: translate(var(--px), var(--px)); }
.btn--gold {
  background: linear-gradient(180deg, var(--gold-hi), var(--gold) 55%, #c9a24a);
  background-clip: padding-box;
  color: var(--ink);
  text-shadow: none;
}
.btn--gold:hover { color: var(--ink); }
.btn--small { padding: 0.4rem 0.7rem 0.35rem; font-size: 1rem; }
/* icon-only buttons (the footer's email and profiles): square, the name in aria-label and title */
.btn--icon { width: 2.75rem; height: 2.75rem; padding: 0; justify-content: center; gap: 0; }
.btn--icon img { width: 24px; height: auto; image-rendering: pixelated; }
@media (max-width: 480px) { .btn { white-space: normal; max-width: 100%; } }
.btn img { width: 24px; height: 16px; image-rendering: pixelated; }
.btn--next::after, .btn--prev::before {
  content: '';
  width: 6px;
  height: 10px;
  background: currentColor;
  clip-path: polygon(0 0, 100% 50%, 0 100%);
}
.btn--prev::before { transform: scaleX(-1); }

/* The pointing glove: shown beside the focused / hovered / current item */
.cursorable { position: relative; }
.cursorable::before {
  content: '';
  position: absolute;
  left: -34px;
  top: 50%;
  width: 30px;
  height: 20px;
  margin-top: -10px;
  background: url("../assets/pixel/hand-2x.png") no-repeat center / contain;
  image-rendering: pixelated;
  opacity: 0;
  pointer-events: none;
}
.cursorable:hover::before,
.cursorable:focus-visible::before { opacity: 1; animation: nudge 0.8s steps(2) infinite; }
@keyframes nudge { 50% { transform: translateX(-3px); } }

/* --- Navigation (a menu window pinned to the top) --- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  padding-top: 0.6rem;
}
.topbar::before {
  content: '';
  position: absolute;
  inset: 0 0 -0.6rem;
  background: linear-gradient(180deg, var(--bg) 55%, transparent);
  pointer-events: none;
}
.nav {
  position: relative;
  display: flex;
  align-items: center;
  gap: 1rem;
  min-height: var(--nav-h);
  padding: 0.4rem 0.8rem;
}
.nav__brand {
  display: flex;
  align-items: center;
  gap: 0.7rem;
  text-decoration: none;
  color: var(--win-text) !important;
  margin-right: auto;
  white-space: nowrap;
}
.nav__face {
  width: 40px;
  height: 40px;
  background: var(--oxblood);
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--gold-lo);
}
.nav__name {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.15rem;
  letter-spacing: 0.06em;
}
.nav__name small {
  display: block;
  font-family: var(--font-pixel);
  font-size: 0.8rem;
  letter-spacing: 0.08em;
  color: var(--gold);
  font-weight: 400;
}
.nav__menu {
  display: flex;
  align-items: center;
  gap: 0.25rem 1.45rem;   /* seven entries: 2.1rem with six */
  flex-wrap: wrap;
  justify-content: flex-end;
}
.nav__link {
  font-family: var(--font-menu);
  font-size: 1.05rem;
  font-weight: 500;
  color: var(--win-text) !important;
  text-decoration: none;
  padding: 0.3rem 0;
  white-space: nowrap;
}
.nav__link:hover,
.nav__link[aria-current="page"] { color: var(--gold) !important; }
.nav__link[aria-current="page"] { text-decoration: underline; text-decoration-thickness: 2px; text-underline-offset: 7px; }
.nav__link.cursorable::before { left: -30px; width: 24px; height: 16px; margin-top: -8px; }
.nav__tools { display: flex; align-items: center; gap: 0.4rem; }
html:not(.js) .nav__tools, html:not(.js) .tabs { display: none; }
.icon-btn {
  display: grid;
  place-items: center;
  width: 2.75rem;
  height: 2.75rem;
  border: var(--px) solid transparent;
}
.icon-btn:hover, .icon-btn[aria-expanded="true"] {
  border-color: var(--gold-lo);
  background: var(--win-well);
}
.icon-btn img { width: 24px; height: 24px; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="day"] .theme-toggle .icon-sun { display: block; }
:root[data-theme="day"] .theme-toggle .icon-moon { display: none; }

.nav__toggle {
  display: none;
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 1rem;
  padding: 0.45rem 0.7rem;
  color: var(--gold);
  border: var(--px) solid var(--gold-lo);
}

@media (max-width: 1300px) {
  .nav__menu { gap: 0.25rem 1.05rem; }
}
@media (max-width: 1240px) {   /* room for seven entries beside the Street button */
  .nav__name small { display: none; }
  .nav__back-text { display: none; }
}
@media (max-width: 1040px) {
  .nav__menu { gap: 0.25rem 0.8rem; }
  .nav__link { font-size: 1rem; }
  .nav__name { font-size: 1rem; }
}
@media (max-width: 1180px) {   /* (900 px with six entries in the menu, 1000 px with seven short ones) */
  /* Without JavaScript the menu stays visible as a wrapped row. */
  html:not(.js) .nav { flex-wrap: wrap; }
  html:not(.js) .nav__menu { width: 100%; justify-content: flex-start; gap: 0.25rem 1.5rem; }
  .js .nav__toggle { display: block; }
  .js .nav__menu {
    display: none;
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    min-width: 15rem;
    flex-direction: column;
    align-items: stretch;
    gap: 0.2rem;
    padding: 1rem 1.25rem 1rem 3rem;
    color: var(--win-text);
    background: linear-gradient(180deg, var(--win-top), var(--win-bot));
    background-clip: padding-box;
    border: calc(4 * var(--px)) solid transparent;
    border-image: url("../assets/pixel/frame.svg") 24 stretch;
    box-shadow: calc(2 * var(--px)) calc(2 * var(--px)) 0 rgba(0, 0, 0, 0.35);
  }
  .js .nav__menu.is-open { display: flex; }
  .js .nav__link { font-size: 1.25rem; padding: 0.35rem 0; }
}
@media (max-width: 480px) {
  .nav { gap: 0.5rem; padding: 0.3rem 0.5rem; }
  .nav__name small { display: none; }
  .nav__name { font-size: 0.95rem; }
  .nav__face { width: 32px; height: 32px; }
  .nav__tools { gap: 0.15rem; }
  .icon-btn { width: 2.5rem; height: 2.5rem; }
}
@media (max-width: 400px) {
  .nav__name { display: none; }
}
/* beside the button back to the street or the club the name needs more room: without it the Menu button stuck out
   of the bar on the right */
@media (max-width: 600px) {
  .nav__brand:has(+ .nav__back) .nav__name { display: none; }
}

/* Config menu */
.config {
  position: absolute;
  top: calc(100% + 0.5rem);
  right: 0;
  width: min(22rem, calc(100vw - 2 * var(--gutter)));
  z-index: 5;
}
.config[hidden] { display: none; }
.config__title { font-family: var(--font-pixel); font-weight: 500; font-size: 1.1rem; color: var(--gold); margin-bottom: 1rem; }
.config fieldset + fieldset { margin-top: 1rem; }
.config legend { margin-bottom: 0.5rem; font-family: var(--font-menu); font-size: 1rem; color: var(--win-dim); }
.swatches { display: flex; flex-wrap: wrap; gap: 0.6rem; }
.swatch { position: relative; }
.swatch input, .choice input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.swatch > span {
  display: block;
  width: 2.5rem;
  height: 2.5rem;
  background: linear-gradient(180deg, var(--sw-top), var(--sw-bot));
  box-shadow: 0 0 0 2px var(--ink), 0 0 0 4px var(--gold-lo);
}
.swatch input:checked + span { box-shadow: 0 0 0 2px var(--ink), 0 0 0 5px var(--gold-hi); }
.swatch input:focus-visible + span { outline: var(--px) dashed var(--gold); outline-offset: 6px; }
.choices { display: flex; gap: 0.5rem; }
.choice span {
  display: inline-block;
  padding: 0.4rem 0.8rem;
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 1rem;
  border: var(--px) solid var(--gold-lo);
}
.choice input:checked + span { background: var(--gold); color: var(--ink); text-shadow: none; }
.choice input:focus-visible + span { outline: var(--px) dashed var(--gold); outline-offset: 3px; }

/* --- Stage: a pixel scene with windows laid over it ---
   The height is reserved before the scene is drawn: --scene-h logical pixels
   of --scene-px each, with the same breakpoints as pixelSize() in scenes.js. */
.stage {
  --scene-px: 4px;
  height: calc(var(--scene-h, 96) * var(--scene-px) + 2 * var(--px));
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, #111739, #35295a);
  border-top: var(--px) solid var(--ink);
  border-bottom: var(--px) solid var(--ink);
  box-shadow: 0 var(--px) 0 var(--gold-lo), 0 calc(-1 * var(--px)) 0 var(--gold-lo);
}
:root[data-theme="day"] .stage { background: linear-gradient(180deg, #839fba, #d6d1c0); }
.stage canvas {
  image-rendering: pixelated;
  image-rendering: crisp-edges;
}
@media (max-width: 559.98px) { .stage { --scene-px: 3px; } }
@media (min-width: 1700px) { .stage { --scene-px: 5px; } }
/* One frame for the whole site: the menu bar, the picture window and the text windows below share
   one width (the container's, less its gutters); the scene is a framed picture within it. */
@media (min-width: 2200px) { :root { --max: 1600px; } }
@media (min-width: 560px) {
  .stage--scene { width: calc(min(100%, var(--max)) - 2 * var(--gutter)); margin-inline: auto; border-left: var(--px) solid var(--ink); border-right: var(--px) solid var(--ink); }
}

/* Inside a building: the way back out to the street, in the menu bar beside the name (Space, or a click):
   the menu's pointing glove turned to point back */
.nav__brand:has(+ .nav__back) { margin-right: 0; }
.nav__brand, .nav__back { flex-shrink: 0; }   /* the menu wraps rather than squeeze the name */
.nav__back {
  display: inline-flex;
  align-items: center;
  gap: 0.45rem;
  margin-right: auto;
  padding: 0.2rem 0.55rem 0.2rem 0.4rem;
  font-family: var(--font-menu);
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--win-text);
  text-decoration: none;
  white-space: nowrap;
  border: var(--px) solid var(--gold-lo);
  background: rgba(0, 0, 0, 0.18);
}
.nav__back img { width: 30px; height: 20px; image-rendering: pixelated; transform: scaleX(-1); }
.nav__back kbd { font-size: 0.78rem; }
.nav__back:hover, .nav__back:focus-visible { color: var(--gold-hi); border-color: var(--gold); }
.nav__back:hover img { animation: nav-back-nudge 0.5s steps(2, jump-none) infinite; }
@keyframes nav-back-nudge { from { transform: scaleX(-1) translateX(0); } to { transform: scaleX(-1) translateX(3px); } }
:root[data-theme="day"] .nav__back { background: rgba(120, 84, 40, 0.1); }
.nav__back kbd { display: none; }   /* the title still names the Space key */
@media (max-width: 640px) { .nav__back-text { display: none; } .nav__back { padding: 0.25rem 0.35rem; } }
@media (pointer: coarse) { .nav__back kbd { display: none; } }
@media (prefers-reduced-motion: reduce) { .nav__back:hover img { animation: none; } }

/* --- Home: title screen --- */
@keyframes blink { 50% { opacity: 0; } }
@keyframes bob { 50% { transform: translateY(3px); } }

.command { padding: 1rem 1rem 1rem 2.9rem; }
.command li + li { margin-top: 0.15rem; }
.command a {
  display: block;
  font-family: var(--font-menu);
  font-size: 1.2rem;
  font-weight: 500;
  color: var(--win-text) !important;
  text-decoration: none;
  padding: 0.18rem 0;
}
.command a:hover, .command a:focus-visible { color: var(--gold) !important; }
.command .cursorable::before { left: -2.4rem; }

@media (max-width: 860px) {

  .command { display: none; }
}

/* --- Chapters (section headings) --- */
.section { padding: 4.5rem 0; }
.chapter {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.35rem;
  margin-bottom: 1.75rem;
}
.chapter__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.6rem, 3.4vw, 2.3rem);
  line-height: 1.15;
  letter-spacing: 0.04em;
  color: var(--page-text);
}
.chapter__more { margin-top: 1.5rem; }

.still { padding-bottom: 4rem; }

/* --- Page header on inner pages --- */
.page-head {
  position: relative;
  z-index: 2;
  margin-top: -1.25rem;
  margin-bottom: 1.25rem;
  max-width: 60rem;
}
/* The page title and the window after it form one panel: the second window's top frame covers
   the title window's bottom frame (and its shadow). */
.page-head + .window { margin-top: calc(-1.25rem - 4 * var(--px)); z-index: 3; }
.page-head h1 {
  font-family: var(--font-display);
  font-weight: 900;
  font-size: clamp(2rem, 5vw, 3.2rem);
  line-height: 1.05;
  letter-spacing: 0.04em;
  color: var(--gold-hi);
  margin: 0.4rem 0 0.6rem;
}
.page-head__intro { font-size: 1.32rem; line-height: 1.5; color: var(--win-text); }
@media (max-width: 640px) {
  .page-head { margin-top: -0.75rem; }
}

/* --- Home: profile and news side by side on wide screens --- */
.duo { display: grid; gap: 2.5rem; }
.duo__col { display: flex; flex-direction: column; min-width: 0; }
.duo__col > .window { flex: 1; }
@media (min-width: 1100px) {
  .duo { grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 2rem; }
  .duo .news__item { grid-template-columns: minmax(0, 1fr); gap: 0.15rem; padding: 0.75rem 0; }
  .duo .news__item p { line-height: 1.5; }
}

/* --- Home: profile --- the portrait beside the description; the facts, the links and the figures below --- */
.profile { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0 1.6rem; align-items: start; }
.profile__portrait { grid-column: 1; grid-row: 1; }
.profile > .profile__intro { grid-column: 2; grid-row: 1; align-self: center; margin-top: 0; }
.profile > :not(.profile__portrait):not(.profile__intro) { grid-column: 1 / -1; }
.profile > .stat-list { margin-top: 1.3rem; padding-top: 1.1rem; border-top: var(--px) dotted var(--win-rule); }
.portrait {
  position: relative;
  display: block;
  width: 204px;
  height: 204px;
  padding: 0;
  background: radial-gradient(circle at 50% 35%, #a8303f, var(--oxblood) 55%, #3a0c14);
  border: calc(2 * var(--px)) solid transparent;
  border-image: url("../assets/pixel/frame-thin.svg") 18 stretch;
  overflow: hidden;
}
.portrait img { position: absolute; left: 0; top: 0; width: 192px; height: 192px; object-fit: cover; }
.portrait__pixel { image-rendering: pixelated; }
.portrait__photo { opacity: 0; transition: opacity 0.35s steps(5); }
.portrait[aria-pressed="true"] .portrait__photo { opacity: 1; }
.portrait__hint { display: block; margin-top: 0.6rem; text-align: center; color: var(--win-dim); }
.stat-list {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 0.45rem 1.1rem;
  align-items: baseline;
}
.stat-list dt { font-family: var(--font-body); font-weight: 600; font-size: 1.2rem; letter-spacing: 0.07em; font-variant-caps: all-small-caps; color: var(--gold); }
.stat-list dd { font-size: 1.1rem; line-height: 1.35; }
.figures { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; margin-top: 1.4rem; padding-top: 1rem; border-top: var(--px) solid var(--win-rule); }
.figures div { display: flex; flex-direction: column-reverse; justify-content: flex-end; }
.figures dd { font-family: var(--font-display); font-weight: 700; font-size: 2rem; line-height: 1; color: var(--gold-hi); }
.figures dt { margin-top: 0.3rem; font-family: var(--font-body); font-weight: 600; font-size: 1.16rem; letter-spacing: 0.06em; font-variant-caps: all-small-caps; line-height: 1.2; color: var(--win-dim); }

@media (max-width: 600px) {
  .profile { grid-template-columns: 1fr; }
  .profile__portrait { justify-self: center; }
  .profile > .profile__intro { grid-column: 1; grid-row: auto; margin-top: 1rem; }
}
@media (max-width: 480px) {
  /* each label above its value */
  .stat-list { grid-template-columns: minmax(0, 1fr); gap: 0 0; }
  .stat-list dd { margin-bottom: 0.6rem; }
}

/* --- Cards (abilities, research themes, courses, side quests) --- */
.grid-3 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(17.5rem, 100%), 1fr));
  gap: 1.25rem;
}
.card { display: flex; flex-direction: column; }
.card__icon { width: 36px; height: 36px; margin-bottom: 0.75rem; }
.card h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.2rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
  color: var(--gold-hi);
  margin-bottom: 0.6rem;
}
.card p { color: var(--win-text); }
.card .tags { margin-top: auto; padding-top: 1rem; }
.card__head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.7rem; }
.card__head h3 { margin-bottom: 0; }
.card--area .card__icon { flex: none; width: 48px; height: 48px; margin: 0; }
.card--area p, .card__head h3 { text-wrap: pretty; }   /* no single word left alone on the last line */
.card--area { position: relative; }
.card__link { color: inherit !important; text-decoration: none; }
.card__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.card--area:hover .card__link, .card__link:focus-visible { text-decoration: underline; text-underline-offset: 0.2em; }

.tags { display: flex; flex-wrap: wrap; gap: 0.45rem; }
.tag {
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 1rem;
  line-height: 1;
  padding: 0.4rem 0.55rem;
  color: var(--gold);
  background: var(--win-well);
  box-shadow: 0 0 0 var(--px) var(--gold-lo);
  text-shadow: none;
}

/* --- Inventory lists (publications) --- */
.items { display: grid; gap: 0; }
.item {
  display: grid;
  grid-template-columns: 2.75rem minmax(0, 1fr);
  gap: 1.25rem;
  padding: 1.35rem 0.25rem;
  border-top: var(--px) dotted var(--win-rule);
}
.item:first-child { border-top: 0; }
.item__no { display: block; margin-top: 0.4rem; text-align: center; color: var(--win-dim); font-family: var(--font-body); font-weight: 600; font-size: 1.12rem; font-variant-numeric: lining-nums; }
.item p, .log__item p { margin: 0; }
.item__title { font-weight: 600; font-size: 1.42rem; line-height: 1.3; color: var(--win-text); margin-bottom: 0.3rem; }
.item__authors, .item__venue { font-size: 1.15rem; color: var(--win-dim); line-height: 1.5; }
.item__authors strong { color: var(--win-text); font-weight: 600; }
.item__venue em { color: var(--win-text); }
.item__status {
  display: inline-block;
  margin-left: 0.35rem;
  padding: 0.25rem 0.45rem;
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 0.95rem;
  vertical-align: 0.15em;
  color: var(--ink);
  background: var(--gold);
  text-shadow: none;
}

.item-group + .item-group { margin-top: 2.75rem; }
.item-group__head {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.6rem;
  letter-spacing: 0.04em;
  color: var(--gold-hi);
  padding-bottom: 0.6rem;
  margin-bottom: 0.25rem;
  border-bottom: var(--px) solid var(--win-rule);
}
.item-group__head img { width: 28px; height: 28px; }

/* Filter tabs */
.tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.6rem;
  margin-bottom: 1.25rem;
  align-items: center;
}
.tab {
  padding: 0.5rem 0.9rem 0.45rem;
  font-family: var(--font-pixel);
  font-weight: 500;
  font-size: 1.05rem;
  color: var(--win-text);
  background: var(--win-well);
  box-shadow: 0 0 0 var(--px) var(--gold-lo);
}
.tab:hover { color: var(--gold-hi); }
.tab[aria-pressed="true"] { background: var(--gold); color: var(--ink); text-shadow: none; box-shadow: 0 0 0 var(--px) var(--ink), 0 0 0 calc(2 * var(--px)) var(--gold-hi); }
.tab__n { opacity: 0.8; margin-left: 0.45rem; font-family: var(--font-body); font-weight: 600; font-variant-numeric: lining-nums; }

/* --- Travel log (talks) --- */
.log { display: grid; }
.log__item {
  display: grid;
  grid-template-columns: 5.2rem minmax(0, 1fr);
  gap: 1.1rem;
  padding: 1.15rem 0;
  border-top: var(--px) dotted var(--win-rule);
}
.log__item:first-child { border-top: 0; }
.log__year {
  align-self: start;
  padding: 0.45rem 0.35rem;
  text-align: center;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.05rem;
  font-variant-numeric: lining-nums;
  color: #ffd35a;
  background: #0c0c10;
  box-shadow: 0 0 0 var(--px) #4a4a52, 0 0 0 calc(2 * var(--px)) var(--ink);
  text-shadow: 0 0 6px rgba(255, 211, 90, 0.45);
}
.log__title { font-weight: 600; font-size: 1.3rem; line-height: 1.32; }
.log__venue { color: var(--win-dim); font-size: 1.12rem; margin-top: 0.25rem; }
.log__note { color: var(--win-dim); font-size: 1.1rem; margin-top: 0.15rem; }
@media (max-width: 480px) {

  .log__item { grid-template-columns: 1fr; gap: 0.5rem; }
  .log__year { justify-self: start; }
}
.log__item--plain { grid-template-columns: minmax(0, 1fr); }
.talks { padding-top: 0.5rem; }
.talk-year { display: grid; grid-template-columns: 5.5rem minmax(0, 1fr); gap: 1.2rem; padding: 0.45rem 0; border-top: var(--px) solid var(--win-rule); }
.talk-year:first-child { border-top: 0; }
.talk-year__head { font-family: var(--font-display); font-weight: 700; font-size: 1.75rem; line-height: 1.1; color: var(--gold-hi); font-variant-numeric: lining-nums; padding-top: 0.55rem; }
.talk-year .log__item:first-child { border-top: 0; }
/* the talks set close: a smaller title, the venue (on wide screens) in a column of its own at the right */
.talks .log__item { padding: 0.6rem 0; }
.talks .log__title { font-size: 1.18rem; line-height: 1.3; }
.talks .log__venue { font-size: 1.05rem; line-height: 1.35; margin-top: 0.1rem; }
.talks .log__note { font-size: 0.98rem; line-height: 1.35; margin-top: 0.1rem; }
@media (min-width: 900px) {
  .talks .log__item--plain > div { display: grid; grid-template-columns: minmax(0, 1fr) minmax(12rem, 21rem); grid-template-areas: "title venue" "note venue"; column-gap: 2rem; align-items: baseline; }
  .talks .log__title { grid-area: title; }
  .talks .log__venue { grid-area: venue; margin-top: 0; text-align: right; }
  .talks .log__note { grid-area: note; }
}
/* invited or conference: a small pixel icon before the title (an invitation, a lectern), explained by the legend */
.talk-icon { display: inline-block; width: 32px; margin-right: 0.6rem; vertical-align: -0.28em; line-height: 0; }
.talk-icon img, .talk-legend img { image-rendering: pixelated; }
.talk-legend { display: flex; flex-wrap: wrap; gap: 0.4rem 1.5rem; margin: 0.7rem 0 0; padding: 0; list-style: none; font-size: 1rem; color: var(--win-dim, inherit); }
.talk-legend li { display: inline-flex; align-items: center; gap: 0.5rem; }
@media (max-width: 640px) {
  .talk-year { grid-template-columns: 1fr; gap: 0; }
  .talk-year__head { padding-top: 0.25rem; font-size: 1.6rem; }
}

/* --- Research themes --- */
.theme + .theme { margin-top: 1.5rem; }
.theme__head { display: flex; align-items: center; gap: 1rem; margin-bottom: 0.8rem; }
.theme__head img { width: 36px; height: 36px; flex: none; }
.theme h2 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: var(--gold-hi);
}
.theme h3 { margin: 1.4rem 0 0.7rem; }
/* The theme's text at a readable line length, its key papers beside it. */
.theme__body { display: grid; grid-template-columns: minmax(0, 1fr) minmax(16rem, 22rem); gap: 2.5rem; align-items: start; }
.theme__text > p:not(.theme__cta) { font-size: 1.3rem; line-height: 1.6; max-width: 54rem; }
.theme__papers { padding-left: 1.5rem; border-left: var(--px) solid var(--win-rule); }
.theme__papers .label { margin: 0 0 0.6rem; }
.key-papers li { padding: 0.55rem 0; border-top: var(--px) dotted var(--win-rule); line-height: 1.35; }
.key-papers li:first-child { border-top: 0; padding-top: 0; }
.key-papers a { font-weight: 600; font-size: 1.12rem; text-decoration: none; }
.key-papers a:hover { text-decoration: underline; }
.key-papers__meta { display: block; margin-top: 0.2rem; font-size: 1.08rem; color: var(--win-dim); font-variant-numeric: lining-nums; }
@media (max-width: 1000px) {
  .theme__body { grid-template-columns: minmax(0, 1fr); gap: 1.25rem; }
  .theme__papers { padding: 1rem 0 0; border-left: 0; border-top: var(--px) solid var(--win-rule); }
}
.theme__cta { margin-top: 1.3rem; }
/* a hobby's heading on the interests page leads into its room */
.quest__link { color: inherit !important; text-decoration: none; }
.quest__link:hover, .quest__link:focus-visible { text-decoration: underline; text-underline-offset: 0.2em; }

.bullets li {
  position: relative;
  padding-left: 1.6rem;
  margin-bottom: 0.45rem;
  line-height: 1.5;
}
.bullets li::before {
  content: '';
  position: absolute;
  left: 0;
  top: 0.45em;
  width: 14px;
  height: 14px;
  background: url("../assets/pixel/diamond.png") no-repeat center / contain;
  image-rendering: pixelated;
}

/* --- Teaching --- */
.course-groups { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(24rem, 100%), 1fr)); gap: 1.25rem; align-items: start; }
.course-group__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.5rem;
  letter-spacing: 0.03em;
  color: var(--gold-hi);
}
.course-group .label { margin: 0.2rem 0 0.9rem; }
.course-list li { font-size: 1.28rem; line-height: 1.4; margin-bottom: 0.6rem; }
/* the quest log: one table of courses, a scroll for each, where and when */
.quest-log { padding-top: 0.6rem; padding-bottom: 0.6rem; }
.quest-table { width: 100%; border-collapse: collapse; }
.quest-table thead th { padding: 0.35rem 0.8rem 0.55rem; font-family: var(--font-pixel); font-size: 0.85rem; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase; text-align: left; color: var(--gold); border-bottom: var(--px) solid var(--gold-lo); }
.quest-table td, .quest-table tbody th { padding: 0.55rem 0.8rem; vertical-align: middle; text-align: left; border-bottom: var(--px) dashed color-mix(in srgb, var(--gold-lo) 60%, transparent); }
.quest-table tbody tr:last-child > * { border-bottom: 0; }
:root[data-theme="day"] .quest-table thead th { color: var(--oxblood); }
.quest-table tbody th { font-weight: 600; font-size: 1.2rem; line-height: 1.3; }
.quest-table__course { display: flex; align-items: center; gap: 0.85rem; }
.quest-table__course img { flex: none; width: 32px; height: 34px; }
.quest-table__where { font-size: 1.1rem; }
.quest-table__when { font-size: 1.1rem; white-space: nowrap; font-variant-numeric: lining-nums tabular-nums; }
.quest-table tbody tr:hover > * { background: color-mix(in srgb, var(--gold) 8%, transparent); }
@media (max-width: 700px) {
  /* narrow screens: each course a small block, where and when under the title */
  .quest-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .quest-table, .quest-table tbody, .quest-table tr, .quest-table th, .quest-table td { display: block; }
  .quest-table tr { padding: 0.6rem 0.2rem; border-bottom: var(--px) dashed color-mix(in srgb, var(--gold-lo) 60%, transparent); }
  .quest-table tbody tr:last-child { border-bottom: 0; }
  .quest-table td, .quest-table tbody th { padding: 0; border: 0; }
  .quest-table td { display: inline; margin-left: calc(32px + 0.85rem); font-size: 1rem; }
  .quest-table td + td { margin-left: 0; }
  .quest-table td + td:not(:empty)::before { content: " \00b7\00a0"; }
}
.quest-table img { image-rendering: pixelated; }
.course { padding: 1rem 1.2rem; }
.course h4 { font-weight: 600; font-size: 1.32rem; line-height: 1.32; margin-bottom: 0.9rem; }

/* --- Interests --- */
.gallery {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
  margin-top: 1.25rem;
}
@media (max-width: 900px) { .gallery { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 480px) { .gallery { grid-template-columns: minmax(0, 1fr); } }
.gallery__item button {
  display: block;
  width: 100%;
  padding: 0;
  text-align: left;
  color: var(--win-text);
}
.gallery__frame {
  display: block;
  aspect-ratio: 4 / 3;
  overflow: hidden;
  border: calc(3 * var(--px)) solid transparent;
  border-image: url("../assets/pixel/frame-thin.svg") 18 stretch;
  background: var(--ink);
  background-clip: padding-box;
}
.gallery__frame img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s steps(3); }
.gallery__item button:hover img, .gallery__item button:focus-visible img { transform: scale(1.05); }
.gallery figcaption { margin-top: 0.5rem; font-size: 1.05rem; color: var(--win-dim); line-height: 1.35; }
.gallery figcaption em { color: var(--win-text); }
/* photographs of people: tall frames, heads kept in view; four across, two on phones */
.gallery--portrait { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 0.75rem; }
@media (max-width: 1100px) { .gallery--portrait { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
.gallery--portrait .gallery__frame { aspect-ratio: 3 / 5; }
.gallery--portrait .gallery__frame img { object-position: center 25%; }
.gallery--portrait figcaption { font-size: 0.95rem; }
@media (max-width: 480px) { .gallery--portrait { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
/* the ex libris: the print itself, on the paper it is stamped on */
.exlibris { flex: none; width: 10rem; margin: 0; text-align: center; }
/* the pens and the ex libris side by side (one under the other on phones) */
.desk { display: flex; align-items: center; gap: 1.5rem; margin-top: 1rem; }
.desk > p { font-size: 1.22rem; line-height: 1.6; max-width: 70ch; }
@media (max-width: 560px) { .desk { flex-direction: column; } }
.exlibris button { display: block; width: 100%; padding: 0; }
.exlibris__frame { display: block; padding: 0.6rem; background: #f4efe2; border: calc(3 * var(--px)) solid transparent; border-image: url("../assets/pixel/frame-thin.svg") 18 stretch; }
.exlibris__frame img { display: block; width: 100%; height: auto; mix-blend-mode: multiply; }
.exlibris figcaption { margin-top: 0.5rem; font-size: 1rem; color: var(--win-dim); }
/* the pens and the ex libris side by side, about the same height: the columns go as their pictures' widths */
.desk-pics { display: grid; grid-template-columns: minmax(0, 16fr) minmax(0, 5.6fr); gap: 1.25rem; align-items: start; margin-top: 1.1rem; }
.desk-pics .exlibris { width: auto; }
.pens { margin: 0; text-align: center; }
.pens .gallery__frame { aspect-ratio: 16 / 9; }
.pens figcaption { margin-top: 0.5rem; font-size: 1rem; color: var(--win-dim); }
@media (max-width: 560px) { .desk-pics { grid-template-columns: minmax(0, 1fr); } .desk-pics .exlibris { width: 12rem; margin-inline: auto; } }

.lightbox[open] {
  position: fixed;
  inset: 0;
  z-index: 500;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: rgba(5, 6, 14, 0.88);
  border: 0;
  width: 100%;
  height: 100%;
  max-width: none;
  max-height: none;
}
.lightbox::backdrop { background: rgba(5, 6, 14, 0.88); }
.lightbox__win { max-width: min(62rem, 100%); padding: 0.9rem; }
.lightbox__win img { width: auto; height: auto; max-width: 100%; max-height: 76vh; object-fit: contain; margin: 0 auto; }
.lightbox__bar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; margin-top: 0.75rem; }
@media (max-width: 560px) { .lightbox__cap { flex: 1 1 100%; } .lightbox__win img { max-height: 62vh; } }
.lightbox__cap { font-size: 1.05rem; }
.lightbox__nav { display: flex; gap: 0.5rem; }

/* --- Footer: the save point --- */
.footer { padding: 3rem 0 2.5rem; }
.footer__win {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 1.5rem 2rem;
  align-items: center;
}
.footer__name { font-family: var(--font-display); font-weight: 700; font-size: 1.2rem; letter-spacing: 0.04em; }
.footer__aff { color: var(--win-dim); font-size: 1rem; }
.footer__links { display: flex; flex-wrap: wrap; gap: 0.5rem; justify-content: flex-end; }
.footer__meta { grid-column: 1 / -1; display: flex; justify-content: space-between; flex-wrap: wrap; gap: 0.5rem; padding-top: 1rem; border-top: var(--px) dotted var(--win-rule); color: var(--win-dim); }
/* the footer without a window: a dotted gold rule, then the page's own colours */
.footer__win--bare { padding-top: 1.5rem; border-top: var(--px) dotted var(--gold-lo); }
.footer__win--bare .footer__name { color: var(--page-text); }
.footer__win--bare .footer__aff, .footer__win--bare .footer__meta { color: var(--page-dim); }
.footer__win--bare .footer__meta { border-top: none; padding-top: 0; }
@media (max-width: 820px) {
  .footer__win { grid-template-columns: 1fr; text-align: center; }
  .footer__links { justify-content: center; }
  .footer__meta { justify-content: center; }
}

/* --- Window opening animation --- */
.js .reveal { clip-path: inset(50% 0 50% 0); }
/* should main.js not run, the boxes open by themselves after 3 s */
html.js:not(.reveal-live) .reveal { animation: reveal-fallback 0s 3s forwards; }
@keyframes reveal-fallback { to { clip-path: inset(-2rem); } }
.js .reveal.is-open { clip-path: inset(-2rem); transition: clip-path 0.22s steps(5); }

/* View transitions between pages (supported browsers only) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: 0.18s steps(4) both fade-out; }
::view-transition-new(root) { animation: 0.22s steps(4) both fade-in; }
@keyframes fade-out { to { opacity: 0; } }
@keyframes fade-in { from { opacity: 0; } }

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  .js .reveal { clip-path: none; }
}

/* --- Additions: titles inside windows, quests, two-up grids --- */
.chapter__title--win { color: var(--win-text); }
.window > .chapter { margin-bottom: 0.75rem; }
.quest + .quest { margin-top: 1.5rem; }
.quest .theme__head .label { margin-bottom: 0.2rem; }
.grid-2 {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(22rem, 100%), 1fr));
  gap: 1rem;
  margin-top: 1.1rem;
}
/* two by two, whatever the width (one column on phones) */
.grid-2--pair { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0 2rem; }
@media (max-width: 700px) { .grid-2--pair { grid-template-columns: minmax(0, 1fr); } }
/* an entry inside a window: separated by a rule, not framed again */
.subcard { padding: 1rem 0 0.9rem; border-top: var(--px) dotted var(--win-rule); }
.quest__after { margin-top: 1.25rem; }
.card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.3rem;
  letter-spacing: 0.02em;
  color: var(--gold-hi);
  margin-bottom: 0.5rem;
}
.card p { font-size: 1.16rem; line-height: 1.55; }

/* ============================================
   Blog: The Logician's Gazette
   ============================================ */

/* Newsprint window: same gold frame, printed on cream paper */
.window--paper {
  --win-text: #1d1a24;
  --win-dim: #5b5446;
  --win-rule: rgba(29, 26, 36, 0.25);
  --win-well: rgba(125, 29, 44, 0.07);
  color: #1d1a24;
  background: linear-gradient(180deg, #f7f0dc, #ebdfc2);
  background-clip: padding-box;
  text-shadow: none;
}
.window--paper .label { color: var(--oxblood); }
.window--paper .btn:not(.btn--gold) { color: var(--cream); }
.window--paper .btn:not(.btn--gold):hover { color: var(--gold-hi); }
.window--paper a:not(.btn) { color: var(--oxblood); }
.window--paper a:not(.btn):hover { color: #a8303f; }
.window--paper .tag {
  color: var(--oxblood);
  background: rgba(125, 29, 44, 0.07);
  box-shadow: 0 0 0 var(--px) rgba(125, 29, 44, 0.45);
}

.page-head h1.masthead {
  font-family: 'UnifrakturMaguntia', var(--font-display);
  font-weight: 400;
  letter-spacing: 0.01em;
  font-size: clamp(2.3rem, 6vw, 4rem);
  line-height: 1.1;
}
.page-head .label a { color: inherit; text-decoration: none; }
.page-head .label a:hover { text-decoration: underline; }
.page-head__actions { margin-top: 1rem; }
.post-meta { margin-top: 0.7rem; font-size: 1rem; color: var(--win-dim); }
.post-head .tags { margin-top: 0.9rem; }
.tabs.window { margin-bottom: 1.25rem; }

/* The Gazette: masthead, dateline and stories on one sheet of newsprint */
.page-head.gazette { max-width: none; }
.gazette__head {
  text-align: center;
  padding-bottom: 0.3rem;
  border-bottom: calc(3 * var(--px)) double rgba(29, 26, 36, 0.7);   /* the rule under a newspaper's title */
}
.gazette__head h1.masthead { margin: 0.2rem 0 0.7rem; font-size: clamp(2.6rem, 8vw, 5rem); }
.page-head.gazette h1.masthead { color: var(--oxblood); }   /* printed in red ink by day and by night */
.gazette__tabs { margin-top: 1rem; }
.gazette .post-list { gap: 0; }
.gazette .post-card { padding: 1.4rem 0 1.5rem; }
.gazette .post-card + .post-card { border-top: var(--px) solid var(--win-rule); }
.gazette .empty-state { padding: 2rem 0 1rem; }

/* Post list */
.post-list {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  gap: 1.5rem;
}
.post-card { display: flex; flex-direction: column; }
.post-card__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  line-height: 1.25;
  letter-spacing: 0.02em;
  margin: 0.45rem 0 0.6rem;
}
.post-card__title a { color: #1d1a24 !important; text-decoration: none; }
.post-card__title a:hover { color: var(--oxblood) !important; text-decoration: underline; }
.post-card__summary { font-size: 1.2rem; line-height: 1.5; }
.post-card .tags { margin-top: 0.9rem; }
.post-card__more { margin-top: auto; padding-top: 1.1rem; }
.empty-state { text-align: center; padding: 2.5rem 1.5rem; font-size: 1.2rem; }
.empty-state .label { margin-bottom: 0.6rem; }

/* The article */
/* A post's windows are as wide as the Gazette's; the text keeps a book-page measure in the middle. */
.post .page-head { max-width: none; }
.post .page-head > *, .prose > * { max-width: 56rem; margin-inline: auto; }   /* about 90 characters a line (44rem, 65-75 characters, until 2026-11-29: he wanted the space used) */
/* on the widest frame the column and the type grow with it */
@media (min-width: 2200px) { .post .page-head > *, .prose > * { max-width: 62rem; } .prose { font-size: 1.5rem !important; } }
.post-head h1 { text-wrap: balance; }
@media (min-width: 700px) { .nobr { white-space: nowrap; } }
.post-nav {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 0.75rem;
  margin-top: 1.5rem;
}
.post-nav .btn { white-space: normal; max-width: 24rem; line-height: 1.7; }

.prose { padding: 2.25rem clamp(1.1rem, 4vw, 3.5rem) 2.5rem; font-size: 1.4rem; line-height: 1.7; }
.prose > * + * { margin-top: 1.1em; }
.prose p { margin-bottom: 0; }
.prose h2, .prose h3, .prose h4 { scroll-margin-top: 6rem; line-height: 1.25; }
.prose h2 {
  margin-top: 2.1em;
  padding-bottom: 0.35em;
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.55rem;
  letter-spacing: 0.03em;
  color: var(--win-top);   /* the colour of the windows (navy unless changed in the Config menu) */
  border-bottom: var(--px) solid color-mix(in srgb, var(--win-top) 25%, transparent);
}
.prose h3 { margin-top: 1.8em; font-weight: 600; font-size: 1.3rem; color: var(--win-top); }
.prose h4 { margin-top: 1.5em; font-weight: 600; font-size: 1.15rem; }
.prose ul, .prose ol { padding-left: 1.6rem; }
.prose ul { list-style: square; }
.prose ol { list-style: decimal; }
.prose li + li { margin-top: 0.35em; }
.prose li::marker { color: var(--oxblood); }
.prose blockquote {
  padding: 0.2rem 0 0.2rem 1.2rem;
  border-left: calc(2 * var(--px)) solid var(--oxblood);
  font-style: italic;
  color: #3f3a48;
}
.prose hr {
  height: 21px;
  margin: 2.2em 0;
  border: 0;
  background:
    url("../assets/pixel/diamond.png") center / 21px 21px no-repeat,
    linear-gradient(var(--gold-lo), var(--gold-lo)) center / 100% var(--px) no-repeat;
  image-rendering: pixelated;
}
.prose img {
  margin: 1.5em auto;
  border: calc(3 * var(--px)) solid transparent;
  border-image: url("../assets/pixel/frame-thin.svg") 18 stretch;
}
.prose a { text-decoration-thickness: 1px; }
.prose sup { line-height: 0; }
.prose :target { scroll-margin-top: 6rem; }

/* Inline code, code blocks and syntax colours */
.prose code {
  font-family: ui-monospace, 'SFMono-Regular', Menlo, Consolas, monospace;
  font-size: 0.85em;
  padding: 0.1em 0.35em;
  background: color-mix(in srgb, var(--win-top) 8%, transparent);
}
.prose pre {
  overflow-x: auto;
  padding: 1rem 1.2rem;
  font-size: 0.95rem;
  line-height: 1.55;
  color: #efe6d0;
  background: #121a3a;
  border: calc(3 * var(--px)) solid transparent;
  border-image: url("../assets/pixel/frame-thin.svg") 18 stretch;
  background-clip: padding-box;
}
.prose pre code { padding: 0; background: none; font-size: 1em; color: inherit; }
.codehilite .k, .codehilite .kn, .codehilite .kd, .codehilite .kc, .codehilite .kr, .codehilite .kt, .codehilite .ow { color: #e9c56a; }
.codehilite .s, .codehilite .s1, .codehilite .s2, .codehilite .sa, .codehilite .sb, .codehilite .sd, .codehilite .si, .codehilite .sx { color: #a6d99a; }
.codehilite .c, .codehilite .c1, .codehilite .cm, .codehilite .ch, .codehilite .cs { color: #8a92b8; font-style: italic; }
.codehilite .mi, .codehilite .mf, .codehilite .mh, .codehilite .il { color: #f0a070; }
.codehilite .nf, .codehilite .nc, .codehilite .fm { color: #9ecbf0; }
.codehilite .nb, .codehilite .bp { color: #d0a8f0; }
.codehilite .o { color: #e58aa0; }
.codehilite .err { color: inherit; border: 0; }

/* Truth tables and other tables */
.table-wrap { overflow-x: auto; }
.prose table { margin: 0 auto; border-collapse: collapse; font-variant-numeric: tabular-nums; border: 3px solid var(--win-top); }
/* in the colour of the windows: the head, the frame round the table, every second row's fill; the lines between
   the cells a light grey, so that they show on the dark head as on the paper */
.prose th, .prose td { padding: 0.45rem 1rem; border: 2px solid #b3b7c4; text-align: center; }
.prose th { color: var(--cream); background: var(--win-top); font-weight: 600; }
.prose tbody tr:nth-child(even) { background: color-mix(in srgb, var(--win-top) 7%, transparent); }

/* The picture of the four pairs of values of A and its negation, and which logics allow them (in the post on
   CLuN, CLaN and CLoN): nested outlines, each logic in a colour of the site */
.prose .negmap { margin-left: auto; margin-right: auto; max-width: 44rem; overflow-x: auto; }
.prose .negmap svg { display: block; width: 100%; min-width: 32rem; height: auto; font-family: var(--font-body); }
.negmap .region { fill-opacity: 0.07; stroke-width: 2.5; }
.negmap .clon { fill: #5b5446; stroke: #5b5446; }
.negmap .clan { fill: var(--gold-lo); stroke: var(--gold-lo); }
.negmap .clun { fill: var(--win-top); stroke: var(--win-top); }
.negmap .classical { fill: var(--oxblood); stroke: var(--oxblood); }
.negmap text { stroke: none; }
.negmap .name { font-weight: 700; font-size: 22px; fill-opacity: 1; }
.negmap .cell { fill: #fffaf0; stroke: #3a3440; stroke-width: 1.5; }
.negmap .val { font-size: 19px; fill: #1d1a24; }
.negmap .gloss { font-size: 18px; font-style: italic; fill: #5b5446; }
.prose .negmap figcaption { margin-top: 0.5rem; font-size: 1.1rem; line-height: 1.5; text-align: center; color: #3f3a48; }

/* LaTeX (MathJax) */
.math-block { overflow-x: auto; overflow-y: hidden; }
.math-display { display: block; }
.prose mjx-container[display="true"] { margin: 0.6em 0 !important; overflow-x: auto; overflow-y: hidden; padding: 0.15em 0; }
.page-head mjx-container, .post-card__title mjx-container { font-size: 0.92em !important; }

/* Theorem-style boxes: ::: theorem Title ... ::: (and !!! admonitions) */
.box, .prose .admonition {
  --box-c: #7a5520;
  padding: 1rem 1.25rem 1.1rem;
  background: rgba(255, 255, 255, 0.42);
  border-left: calc(2 * var(--px)) solid var(--box-c);
  box-shadow: inset 0 0 0 1px rgba(29, 26, 36, 0.1);
}
.box > * + *, .prose .admonition > * + * { margin-top: 0.8em; }
.box__title, .prose .admonition-title {
  font-family: var(--font-body);
  font-weight: 700;
  font-size: 1.12rem;
  line-height: 1.5;
  font-variant-caps: all-small-caps;
  letter-spacing: 0.06em;
  color: var(--box-c);
}
/* A definition: a green title strip with the title in the middle, written  +++--+++ Definition 1 +++--+++ ,
   and a dashed frame round the text (his choice of 2026-11-29, sample 13). */
.box--definition, .prose .admonition.definition {
  --box-c: #17422f;
  padding: 0 0 1.1rem;
  background: rgba(23, 66, 47, 0.07);
  border: 2px dashed var(--box-c);
  border-top: 0;
  box-shadow: none;
}
.box--definition > *, .prose .admonition.definition > * { margin-left: 1.25rem; margin-right: 1.25rem; }
.box--definition > .box__title, .prose .admonition.definition > .admonition-title {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  margin: 0 -2px;
  padding: 0.35rem 1rem;
  font-family: var(--font-pixel);
  font-weight: 400;
  font-variant-caps: normal;
  letter-spacing: 0.02em;
  text-align: center;
  color: var(--cream);
  background: var(--box-c);
}
.box--definition > .box__title::before, .box--definition > .box__title::after,
.prose .admonition.definition > .admonition-title::before, .prose .admonition.definition > .admonition-title::after {
  content: '+++--+++';
  flex: none;
}
.box--theorem, .box--lemma, .box--proposition, .box--corollary,
.prose .admonition.theorem, .prose .admonition.lemma, .prose .admonition.proposition, .prose .admonition.corollary {
  --box-c: var(--oxblood);
  background: rgba(125, 29, 44, 0.06);
}
.box--theorem > :not(.box__title), .box--lemma > :not(.box__title),
.box--proposition > :not(.box__title), .box--corollary > :not(.box__title) { font-style: italic; }
.box--example, .prose .admonition.example { --box-c: #1f6b45; }
.box--exercise, .prose .admonition.exercise { --box-c: #5a3a8a; }
.box--remark, .box--note, .prose .admonition.note, .prose .admonition.remark { --box-c: #7a5520; }
.box--proof, .prose .admonition.proof { --box-c: #5b5446; background: transparent; box-shadow: none; }
.box--proof::after, .prose .admonition.proof::after {
  content: '\220E';
  display: block;
  margin-top: 0.2em;
  text-align: right;
  line-height: 1;
}

/* Footnotes and table of contents */
.prose .footnote { margin-top: 2.5em; padding-top: 1em; border-top: var(--px) dotted rgba(29, 26, 36, 0.3); font-size: 1rem; color: #3f3a48; }
.prose .footnote hr { display: none; }
.prose .footnote ol { padding-left: 1.3rem; }
.prose .footnote-ref { font-weight: 600; text-decoration: none; }
.prose .toc { padding: 1rem 1.25rem; background: color-mix(in srgb, var(--win-top) 6%, transparent); box-shadow: inset 0 0 0 1px rgba(29, 26, 36, 0.12); }
.prose .toc ul { list-style: none; padding-left: 1rem; }
.prose .toc > ul { padding-left: 0; }

@media (max-width: 640px) {
  .prose { font-size: 1.1rem; padding: 1.1rem 0.6rem 1.4rem; }
  .post .page-head { padding: 1rem 0.9rem; }
  .box, .prose .admonition { padding: 0.75rem 0.6rem 0.85rem; }
  .box--definition, .prose .admonition.definition { padding: 0 0 0.85rem; }
  .box--definition > *, .prose .admonition.definition > * { margin-left: 0.6rem; margin-right: 0.6rem; }
  .box--definition > .box__title, .prose .admonition.definition > .admonition-title { gap: 0.4rem; padding: 0.3rem 0.5rem; }
  .box--definition > .box__title::before, .box--definition > .box__title::after,
  .prose .admonition.definition > .admonition-title::before, .prose .admonition.definition > .admonition-title::after { content: '+-+'; }   /* the short form, so that the title keeps its room */
  .prose th, .prose td { padding: 0.4rem 0.6rem; }
}

/* Keyboard keys (street help text, blog posts) */
kbd {
  display: inline-block;
  min-width: 1.4em;
  padding: 0 0.3em;
  margin: 0 0.1em;
  font-family: var(--font-menu);
  font-size: 0.9em;
  font-weight: 600;
  text-align: center;
  color: var(--ink);
  background: var(--cream);
  box-shadow: 0 2px 0 var(--gold-lo), 0 0 0 1px var(--ink);
  text-shadow: none;
}

/* Profile: intro text and links inside the profile window */
.profile__intro { margin-top: 1rem; font-size: 1.15rem; line-height: 1.6; }
.profile__links { display: flex; flex-wrap: wrap; gap: 0.5rem; margin-top: 1rem; }
.profile__cv { margin-top: 0.8rem; font-size: 1rem; font-style: italic; color: var(--win-dim); }

/* News */
.news { display: grid; gap: 0; }
.news__item { display: grid; grid-template-columns: 9.5rem minmax(0, 1fr); gap: 1.25rem; padding: 0.9rem 0; border-top: var(--px) dotted var(--win-rule); }
.news__item:first-child { border-top: 0; padding-top: 0.2rem; }
.news__date { font-family: var(--font-body); font-weight: 600; font-size: 1.12rem; font-variant-numeric: lining-nums; color: var(--gold); white-space: nowrap; }
.news__item p { margin: 0; line-height: 1.55; }
@media (max-width: 560px) { .news__item { grid-template-columns: 1fr; gap: 0.2rem; } }

/* Publications: legend, sections by type, numbered entries */
.tab { display: inline-flex; align-items: center; gap: 0.45rem; }
.item__icon--tome { display: block; width: 60px; height: 72px; image-rendering: pixelated; }
.item { grid-template-columns: 4.5rem minmax(0, 1fr); }
.item__side { display: flex; flex-direction: column; align-items: center; }
.item__no { font-size: 1.08rem; }
/* The book is the link to the publication. */
.item__open { position: relative; display: block; line-height: 0; }
.item__open:focus-visible { outline: calc(2 * var(--px)) solid var(--gold-hi); outline-offset: 4px; }
/* the book opens: a strip of eight 28x26 frames (the icon is 20x24, so the box grows by 4 px on each side and 2 px on top):
   the cover lifts and turns over to the left, two leaves fan after it, a glint on the initial; the spread is held */
.item__pages { position: absolute; top: calc(-100% / 12); right: -20%; bottom: 0; left: -20%; visibility: hidden; background: 0 0 / 800% 100% no-repeat; image-rendering: pixelated; filter: drop-shadow(0 3px 0 rgba(0, 0, 0, 0.35)); }
.item__pages--tome-logic { background-image: url("../assets/pixel/tome-logic-open.png?v=8f"); }
.item__pages--tome-math { background-image: url("../assets/pixel/tome-math-open.png?v=8f"); }
.item__pages--tome-ai { background-image: url("../assets/pixel/tome-ai-open.png?v=8f"); }
.item__open:hover .item__pages, .item__open:focus-visible .item__pages { visibility: visible; animation: book-open 0.44s steps(1, end) forwards; }
.item__open:hover .item__icon--tome, .item__open:focus-visible .item__icon--tome { visibility: hidden; }
@keyframes book-open {
  0% { background-position: 0 0; } 12.5% { background-position: calc(100% / 7) 0; } 25% { background-position: calc(200% / 7) 0; }
  37.5% { background-position: calc(300% / 7) 0; } 50% { background-position: calc(400% / 7) 0; } 62.5% { background-position: calc(500% / 7) 0; }
  75% { background-position: calc(600% / 7) 0; } 100% { background-position: 100% 0; }
}
@media (prefers-reduced-motion: reduce) { .item__open:hover .item__pages, .item__open:focus-visible .item__pages { animation: none; background-position: 100% 0; } }
.item__closed { display: block; line-height: 0; filter: saturate(0.35) brightness(0.85); cursor: default; }
@media (max-width: 560px) {
  /* on phones the book and its number sit in a row above the entry */
  .item { grid-template-columns: minmax(0, 1fr); gap: 0.5rem; }
  .item__side { flex-direction: row; gap: 0.6rem; align-items: center; }
  .item__no { margin-top: 0; }
  .item__icon--tome { width: 40px; height: 48px; }
  .item__title { font-size: 1.32rem; }
  .item__authors, .item__venue { font-size: 1.08rem; }
  .item-group__head { font-size: 1.3rem; }
}
.item__badges { display: inline-flex; gap: 0.35rem; margin-left: 0.4rem; vertical-align: 0.15em; }
.item__status--accepted { background: #a8d5b0; }
.item__status--preprint { background: #c8ccd6; }
.item-group__note { margin: 0.35rem 0 0.2rem; font-size: 1.1rem; font-style: italic; color: var(--win-dim); }
.supsub { display: inline-flex; flex-direction: column; vertical-align: -0.28em; line-height: 0.95; font-size: 0.62em; margin: 0 0.05em; }
.supsub sup, .supsub sub { position: static; font-size: 1em; line-height: 1; vertical-align: baseline; }
time { white-space: nowrap; }
.section--tight { padding-top: 1rem; padding-bottom: 2.5rem; }

/* --- Publications: abstract and BibTeX under each entry --- */
.item__more { display: flex; flex-wrap: wrap; align-items: baseline; gap: 0.35rem 1.1rem; margin-top: 0.5rem; }
.more > summary { cursor: pointer; font-weight: 600; font-size: 1.02rem; letter-spacing: 0.06em; font-variant-caps: all-small-caps; color: var(--oxblood); list-style: none; }
.more > summary::-webkit-details-marker { display: none; }
.more > summary::before { content: "\25B8\00a0"; }
.more[open] > summary::before { content: "\25BE\00a0"; }
.more[open] { flex-basis: 100%; }
.more__body { margin-top: 0.45rem; padding: 0.7rem 0.9rem; border-left: var(--px) solid var(--win-rule); background: var(--win-well); max-width: 70ch; }
.more__body p { margin: 0 0 0.6rem; font-size: 1.08rem; line-height: 1.55; }
.more__body p:last-child { margin-bottom: 0; }
.bibtex { margin: 0 0 0.6rem; white-space: pre-wrap; word-break: break-word; font-family: ui-monospace, "DejaVu Sans Mono", Menlo, Consolas, monospace; font-size: 0.86rem; line-height: 1.45; }
.more__copy { font-size: 0.9rem; padding: 0.25rem 0.7rem; }
.math .sf { font-family: "DejaVu Sans", Arial, sans-serif; font-size: 0.9em; }
.window:not(.window--paper) .more > summary { color: #f2d586; }
:root[data-theme="day"] .window:not(.nav):not(.config) .more > summary { color: var(--oxblood); }

/* --- The town: the list of the street's buildings --- */
.town-list h2 { font-family: var(--font-display); font-weight: 700; font-size: 1.5rem; color: var(--oxblood); margin: 0 0 0.6rem; }
.town-list > p { max-width: 70ch; font-size: 1.12rem; line-height: 1.55; }
.town-list ol { list-style: decimal; margin: 1rem 0 1.25rem; padding-left: 2.2rem; max-width: 75ch; }
/* a stage whose scene caps its pixel size (the town map) */
.stage[style*="--scene-max"] { height: calc(var(--scene-h) * min(var(--scene-px), var(--scene-max)) + 2 * var(--px)); }
.town-list li { margin: 0 0 0.7rem; padding-left: 0.3rem; font-size: 1.1rem; line-height: 1.5; }
.town-list li::marker { font-family: var(--font-display); font-weight: 700; color: var(--oxblood); }
.town-list small { color: var(--win-dim); }

/* --- Research: the current project --- */
.project { margin-bottom: 1.5rem; }
.project__title { font-family: var(--font-display); font-weight: 700; font-size: clamp(1.3rem, 2.4vw, 1.7rem); line-height: 1.25; margin: 0.3rem 0 0.5rem; color: var(--win-text); }
.project__meta { font-size: 1.08rem; color: var(--win-dim); max-width: 70ch; }

/* --- Day theme: the windows turn to paper (dark ink on cream), for reading in daylight.
   The menu bar and the settings window keep the chosen window colour; so do the buttons. --- */
:root[data-theme="day"] .window:not(.nav):not(.config) {
  --win-text: #1d1a24;
  --win-dim: #5b5446;
  --win-rule: rgba(29, 26, 36, 0.25);
  --win-well: rgba(125, 29, 44, 0.07);
  color: #1d1a24;
  background: linear-gradient(180deg, #f7f0dc, #ebdfc2);
  background-clip: padding-box;
  text-shadow: none;
}
:root[data-theme="day"] .window:not(.nav):not(.config) :is(h1, h2, h3, .label, .chapter__title) { text-shadow: none; }
:root[data-theme="day"] .window:not(.nav):not(.config) :is(.label, .stat-list dt, .news__date, .talk-year__head, .item-group__head, .card h3, .card__title, .theme h2, .course-group__title, .figures dd, .page-head h1) { color: var(--oxblood); }
:root[data-theme="day"] .window:not(.nav):not(.config) a:not(.btn) { color: var(--oxblood); }
:root[data-theme="day"] .window:not(.nav):not(.config) a:not(.btn):hover,
:root[data-theme="day"] .window:not(.nav):not(.config) .tab:hover { color: var(--oxblood); }
:root[data-theme="day"] .window:not(.nav):not(.config) .tag { color: var(--oxblood); background: rgba(125, 29, 44, 0.07); box-shadow: 0 0 0 var(--px) rgba(125, 29, 44, 0.45); }
:root[data-theme="day"] .window:not(.nav):not(.config) .figures dt { color: #5b5446; }
/* buttons keep their own navy face: cream lettering */
:root[data-theme="day"] .window:not(.nav):not(.config) .btn:not(.btn--gold) { color: var(--cream); text-shadow: 1px 1px 0 rgba(0, 0, 0, 0.45); }
:root[data-theme="day"] .window:not(.nav):not(.config) .btn:not(.btn--gold):hover { color: var(--gold-hi); }

/* --- Projects: plans pinned to the board in the workshop. The research projects are blueprints
   (white lines on blue, a fine grid), the side projects pencil sketches on cream; two red pins each. --- */
.plans + .plans { margin-top: 1.5rem; }
.plans__title {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: clamp(1.5rem, 3vw, 2rem);
  line-height: 1.2;
  letter-spacing: 0.03em;
  color: var(--gold-hi);
  margin-bottom: 1.1rem;
}
.plan-board { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(19rem, 100%), 1fr)); gap: 1.4rem; }
.plan {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 1.1rem 1.2rem 1.2rem;
  font-weight: 400;
  text-shadow: none;
  --sheet: #1f4f8f;
  --sheet-edge: #9cc2ec;
  --sheet-grid: rgba(156, 194, 236, 0.17);
  background-color: var(--sheet);
  background-image:
    linear-gradient(var(--sheet-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--sheet-grid) 1px, transparent 1px);
  background-size: 12px 12px;
  background-position: -1px -1px;
  box-shadow:
    inset 0 0 0 var(--px) var(--sheet-edge),
    inset 0 0 0 calc(2 * var(--px)) var(--sheet),
    inset 0 0 0 calc(3 * var(--px)) color-mix(in srgb, var(--sheet-edge) 45%, transparent),
    calc(2 * var(--px)) calc(2 * var(--px)) 0 rgba(0, 0, 0, 0.38);
}
/* the pins in the top corners */
.plan::before, .plan::after {
  content: "";
  position: absolute;
  top: calc(3 * var(--px));
  width: calc(2 * var(--px));
  height: calc(2 * var(--px));
  background: #c02828;
  box-shadow: 0 calc(-1 * var(--px)) 0 #f07070, var(--px) var(--px) 0 rgba(0, 0, 0, 0.35);
}
.plan::before { left: calc(4 * var(--px)); }
.plan::after { right: calc(4 * var(--px)); }
.plan__head { display: flex; align-items: center; gap: 0.8rem; margin-bottom: 0.6rem; }
.plan__head img { flex: none; }
.window .plan h3 {
  font-family: var(--font-display);
  font-weight: 700;
  font-size: 1.18rem;
  line-height: 1.3;
  letter-spacing: 0.02em;
  text-wrap: pretty;
  color: #ffffff;
  text-shadow: none;
}
.plan p { font-size: 1.14rem; line-height: 1.5; color: #dce8f6; text-wrap: pretty; }
.plan .plan__stage {
  align-self: flex-end;
  margin-top: auto;
  padding: 0.15rem 0.45rem 0.1rem;
  font-family: var(--font-pixel);
  font-size: 0.85rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: #e8483c;
  box-shadow: 0 0 0 var(--px) #e8483c;
}
.plan p + .plan__stage { margin-top: 0.9rem; }
.plan--sketch {
  --sheet: #ece2c6;
  --sheet-edge: #b8a77e;
  --sheet-grid: rgba(90, 90, 106, 0.08);
}
.window .plan--sketch h3 { color: #1d1a24; }
.plan--sketch p { color: #3a3644; }
:root[data-theme="day"] .window:not(.nav):not(.config) .plans__title { color: var(--oxblood); }

/* --- Printing (last, so that it overrides the screen rules) --- */
/* Print: plain and legible, dark ink on white */
@media print {
  :root, :root[data-theme], :root[data-window] {
    --win-text: #000; --win-dim: #333; --page-text: #000; --page-dim: #333;
    --gold: #000; --gold-hi: #000; --gold-lo: #666; --page-label: #333; --win-rule: #999;
  }
  .topbar, .footer__links, .command, .stage canvas, .tabs, .post-nav, .chapter__more, .theme__cta, .portrait__hint, .skip-link { display: none !important; }
  body { background: #fff; color: #000; font-size: 11pt; }
  body::before { display: none; }
  .js .reveal { clip-path: none !important; }
  .stage { height: auto; min-height: 0; background: none !important; border: 0; box-shadow: none; overflow: visible; }
  .window, .window--paper, .btn, .tag, .tab {
    color: #000; background: none !important; border: 0 !important; border-image: none !important;
    box-shadow: none !important; text-shadow: none !important;
  }
  .window { padding: 0.5rem 0; }
  .page-head { margin-top: 0; }
  a { color: #000 !important; }
  .prose pre { color: #000; background: #f4f4f4 !important; }
  .prose th { color: #000; background: #eee; }
  .item, .log__item { break-inside: avoid; }
  .codehilite span { color: #000 !important; }
  .prose pre { color: #000 !important; background: none !important; border: 1px solid #999; }
  .prose th { color: #000 !important; background: none !important; }
  .item__status, .log__year { background: none !important; color: #000 !important; border: 1px solid #000 !important; }
  .stage--street, .town__head + .stage { display: none !important; }
  .town__name { text-shadow: none !important; color: #000 !important; }
  .chapter { break-after: avoid; }
}

/* --- Readability: proper names, numbers and small labels in the text face ---
   (the pixel face stays for single-word controls, where its letters cannot be misread) */
.btn, .tag, .item__status, .nav__name small {
  font-family: var(--font-body);
  font-variant-caps: all-small-caps;
  font-weight: 600;
  letter-spacing: 0.07em;
}
.btn { font-size: 1.15rem; }
.tag { font-size: 1.05rem; }
.item__status { font-size: 1.1rem; white-space: nowrap; }
.nav__name small { font-size: 0.95rem; letter-spacing: 0.08em; }
.item__badges { white-space: nowrap; }

/* Focus rings that show on light and dark surfaces alike */
:root { --focus: var(--gold); }
:root[data-theme="day"], .window--paper { --focus: var(--oxblood); }
:root[data-theme="day"] .window:not(.window--paper) { --focus: var(--gold); }
:focus-visible { outline-color: var(--focus); }

/* Π⁰₁: the stacked indices sit up, not down */
.supsub { vertical-align: 0.33em; }

.page-head { max-width: none; }

/* Scenes keep whole pixels: the stage clips, the canvas is never squeezed */
.stage canvas { max-width: none; }
html:not(.js) .stage { display: none; }

/* Three research cards side by side, or one under another */
@media (min-width: 900px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }
@media (max-width: 899.98px) { .grid-3 { grid-template-columns: minmax(0, 1fr); } }

/* The blog on phones reads at least as large as the other pages */
@media (max-width: 640px) { .prose { font-size: 1.2rem; } }

/* Talks: the kind of talk sits at the end of the venue line */
/* Profile: the scholarly identifiers as one line of links */
.profile__ids { margin-top: 0.9rem; font-size: 1.05rem; display: flex; flex-wrap: wrap; gap: 0.4rem 1.2rem; }
.profile__ids a { color: var(--gold-hi); display: inline-flex; align-items: center; gap: 0.4rem; }
.profile__ids img, .btn img.btn__id { width: 24px; height: 24px; image-rendering: pixelated; flex: none; }

/* --- Research and Interests: a title window with jump links, then the sections, each in its own window --- */
.page-head--apart + .window { margin-top: 0; }
.jump-links { display: flex; flex-wrap: wrap; gap: 0.5rem 0.7rem; margin: 1.1rem 0 0.2rem; padding: 0; list-style: none; }
.jump-links a {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  padding: 0.3rem 0.75rem 0.3rem 0.5rem;
  font-family: var(--font-menu);
  font-size: 1rem;
  color: var(--win-text);
  text-decoration: none;
  border: var(--px) solid var(--gold-lo);
  background: rgba(0, 0, 0, 0.18);
}
.jump-links a:hover, .jump-links a:focus-visible { color: var(--gold-hi); border-color: var(--gold); }
.jump-links img { width: 24px; height: auto; image-rendering: pixelated; }
:root[data-theme="day"] .jump-links a { background: rgba(120, 84, 40, 0.08); }
.theme, .quest, .project { scroll-margin-top: calc(var(--nav-h) + 2.75rem); }
#main-content:focus { outline: none; }

/* Research: the current project as a row of facts; each line of research a lead paragraph,
   then its contributions and its key papers side by side */
.project .project__title { margin: 0.35rem 0 1rem; }
.project__facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(13rem, 100%), 1fr)); gap: 0.8rem 1.5rem; margin: 0; }
.project__facts div { padding-left: 0.8rem; border-left: var(--px) solid var(--win-rule); }
.project__facts dt { font-family: var(--font-pixel); font-size: 0.8rem; letter-spacing: 0.08em; text-transform: uppercase; color: var(--gold); }
.project__facts dd { margin: 0.15rem 0 0; font-size: 1.12rem; line-height: 1.35; }
.project__link { margin-top: 1.1rem; }
.theme__head .label { margin: 0 0 0.1rem; }
.theme__head h2 { margin: 0; }
.theme__lead { font-size: 1.28rem; line-height: 1.62; max-width: 74ch; }
.theme__cols { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr); gap: 1.2rem 2.5rem; margin-top: 1.4rem; padding-top: 1.1rem; border-top: var(--px) dotted var(--win-rule); }
.theme__cols .label { margin: 0 0 0.7rem; }
.theme__cols .theme__papers { padding-left: 2rem; }
/* a line of research told as a story, its key papers beside it */
.theme__cols--story { margin-top: 1rem; padding-top: 0; border-top: 0; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr); }
.theme__story p { font-size: 1.24rem; line-height: 1.62; text-align: justify; -webkit-hyphens: auto; hyphens: auto; }   /* justified, with hyphenation against wide gaps */
@media (min-width: 2200px) { .theme__story p { font-size: 1.36rem; } }   /* the text fills its column on wide screens too */
.theme__story p + p { margin-top: 0.85rem; }
.theme__cols--story .theme__papers { border-left: var(--px) dotted var(--win-rule); }
@media (max-width: 900px) { .theme__cols--story { grid-template-columns: minmax(0, 1fr); } .theme__cols--story .theme__papers { border-left: 0; padding-left: 0; } }
.contribs li { margin-bottom: 0.65rem; line-height: 1.4; }
.contrib__with { display: block; margin-top: 0.1rem; font-size: 0.92em; font-style: italic; color: var(--win-dim); }
@media (max-width: 860px) {
  .theme__cols { grid-template-columns: minmax(0, 1fr); }
  .theme__cols .theme__papers { padding-left: 0; padding-top: 1rem; border-left: 0; border-top: var(--px) dotted var(--win-rule); }
}

/* Interests: the two short ones side by side, then games and plants at full width */
.interest-pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.5rem; align-items: stretch; }
.interest-pair > .quest { margin-top: 0; }
.interest-pair + .quest { margin-top: 1.5rem; }
/* the six hobby cards: three across, two on tablets, one on phones; equal heights,
   the button into the room at the foot of each */
.interest-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1.5rem; align-items: stretch; }
@media (max-width: 1100px) { .interest-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.interest-grid > .quest { margin-top: 0; display: flex; flex-direction: column; }
.interest-grid > .quest > .theme__cta { margin-top: auto; padding-top: 1.3rem; }
/* the whole card is the way into its room (the heading's link covers it); the button stays on top */
.interest-grid > .quest { position: relative; }
.interest-grid .quest__link::after { content: ""; position: absolute; inset: 0; z-index: 1; }
.interest-grid .theme__cta { position: relative; z-index: 2; }
.interest-grid > .quest:hover { filter: brightness(1.04); }
@media (max-width: 700px) { .interest-grid { grid-template-columns: minmax(0, 1fr); } }
.interest-grid { margin-top: 1.5rem; }
.interest-grid .quest__title { font-size: clamp(1.35rem, 2.2vw, 1.7rem); line-height: 1.15; margin: 0 0 0.7rem; }
/* the self-development reading list: a fold-out in two columns */
.booklist { margin-top: 1rem; }
.booklist__list { columns: 2 18rem; column-gap: 2rem; list-style: square; padding-left: 1.4rem; font-size: 1.05rem; line-height: 1.5; }
.booklist__list li { break-inside: avoid; }
/* a hobby room: title, text, pictures and the way back in one window */
.page-head.room { max-width: none; }
/* the text runs the full width of the window; beside a picture (the ex libris) it fills what is left */
.quest.room > p, .room .desk > p { font-size: 1.22rem; line-height: 1.6; max-width: none; }
.room .desk > p { flex: 1 1 0; }
.room .more__body { max-width: none; }
.room .gallery + p { margin-top: 1rem; }
.room > p + p { margin-top: 0.8rem; }
.room__back { margin-top: 1.4rem; }
/* a screenshot on a room page: the whole picture, in a thin pixel frame; a click enlarges it */
.screenshot { margin-top: 1.1rem; max-width: 52rem; }
.screenshot button { display: block; width: 100%; padding: 0; }
.screenshot__frame { display: block; border: calc(3 * var(--px)) solid transparent; border-image: url("../assets/pixel/frame-thin.svg") 18 stretch; background: var(--ink); background-clip: padding-box; }
.screenshot__frame img { display: block; width: 100%; height: auto; }
.screenshot figcaption { margin-top: 0.5rem; font-size: 1.05rem; color: var(--win-dim); }
/* books about the town: a numbered list, each with a line on its contents and its catalogue record */
.town .books { margin-top: 0; }
.books h3 { margin: 1.4rem 0 0.6rem; font-family: var(--font-display); font-size: 1.25rem; color: var(--page-label); }
.books__list { padding-left: 0; }   /* newest first, no numbers */
.books__list li { margin-bottom: 0.75rem; line-height: 1.5; font-size: 1.08rem; }
.books__note { color: var(--win-dim); }
.books__tag { font-size: 0.8em; letter-spacing: 0.05em; text-transform: uppercase; padding: 0 0.35em; color: var(--page-label); box-shadow: 0 0 0 var(--px) currentColor; }
.town + .town { margin-top: 1.5rem; }
/* teaching: the title and the courses in one window */
.page-head.teaching { max-width: none; }
.teaching .quest-log { margin-top: 0.6rem; padding: 0; }
/* two screenshots side by side (one under the other on phones) */
.screenshots { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.2rem; margin-top: 1.1rem; }
.screenshots .screenshot { margin-top: 0; max-width: none; }
.screenshots .screenshot figcaption { font-size: 0.98rem; }
@media (max-width: 700px) { .screenshots { grid-template-columns: minmax(0, 1fr); } }
/* a pixel icon in front of a button's words */
.btn--lead-icon .pixel { width: 24px; height: 24px; vertical-align: -0.35em; margin-right: 0.5em; }
@media (max-width: 860px) { .interest-pair { grid-template-columns: minmax(0, 1fr); } }
.quest > p, .quest__after { font-size: 1.22rem; line-height: 1.6; max-width: 70ch; }
.quest > p + p { margin-top: 0.8rem; }
.systems { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(15rem, 100%), 1fr)); gap: 0.9rem; margin: 1.1rem 0 0.2rem; }
.system { padding: 0.8rem 1rem 0.9rem; border: var(--px) solid var(--gold-lo); background: rgba(0, 0, 0, 0.14); }
.system__name { margin: 0 0 0.35rem; font-family: var(--font-display); font-weight: 700; font-size: 1.12rem; letter-spacing: 0.03em; color: var(--gold-hi); }
.system p { font-size: 1.08rem; line-height: 1.45; }
:root[data-theme="day"] .system { background: rgba(120, 84, 40, 0.07); }
:root[data-theme="day"] .system__name, :root[data-theme="day"] .project__facts dt { color: var(--oxblood); }

/* --- Design review (audit3): rhythm, one heading colour, readable controls, tidy phone layouts --- */
/* home: one gap between all sections */
main > .section { padding: 0 0 4rem; }
main > .town + .section { padding-top: 4rem; }
main > .section:last-child { padding-bottom: 0; }
@media (max-width: 640px) { main > .section { padding-bottom: 3rem; } main > .town + .section { padding-top: 3rem; } }
/* home: Profile and News as equal columns, so Profile has no hole above its figures */
@media (min-width: 1100px) { .duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 2rem; } }
.profile__links .btn { flex: 1 1 0; justify-content: center; }
/* headings in windows: gold by night, oxblood by day, like every other window heading */
.chapter__title--win { color: var(--gold-hi); }
:root[data-theme="day"] .window:not(.nav):not(.config) .chapter__title--win { color: var(--oxblood); }
/* publications: the entry controls and tags at a readable size; the status badges with an edge */
.more > summary { font-size: 1.14rem; }
.tag { font-size: 1.12rem; }
.item__status { box-shadow: 0 0 0 2px rgba(29, 26, 36, 0.6); }
@media (max-width: 560px) { .item__badges { display: flex; width: fit-content; margin: 0.4rem 0 0.1rem; } }
/* talks: the icon hangs in the margin, so every line of an entry starts at one edge */
.log__item--plain > div { padding-left: calc(32px + 0.6rem); }
.log__item--plain .talk-icon { margin-left: calc(-32px - 0.6rem); }
/* phones: section icons above their headings, so the headings keep whole lines */
@media (max-width: 560px) {
  .theme__head { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
  .theme h2, .chapter__title--win { font-size: 1.45rem; }
}
/* labels in the book face's small capitals, as elsewhere (the pixel face is for short controls) */
.project__facts dt, .quest-table thead th {
  font-family: var(--font-body); font-weight: 600; font-size: 1.1rem;
  letter-spacing: 0.07em; text-transform: none; font-variant-caps: all-small-caps;
}
/* town: the numbered list in two columns on wide screens */
@media (min-width: 1000px) {
  .town-list ol { columns: 2; column-gap: 3rem; max-width: none; }
  .town-list li { break-inside: avoid; }
}
/* interests: the five photos in one row on wide screens */
@media (min-width: 1100px) { .gallery:not(.gallery--portrait) { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.9rem; } }
/* page intros keep a reading measure; the hero's role line breaks between its parts on phones */
.page-head__intro { max-width: 68ch; }
.town__role { text-wrap: balance; }
@media (max-width: 640px) { .town__role > span { display: block; } .town__sep { display: none; } }

/* --- Publications: the topic buttons in the title window, each with its topic's book (all three on "All") --- */
.tabs--books { margin: 0.9rem 0 0.2rem; }
.tab__book { width: 20px; height: 24px; image-rendering: pixelated; flex: none; margin: -0.2rem 0; }
.tab__books { display: inline-flex; flex: none; }
.tab__books .tab__book + .tab__book { margin-left: -9px; }

/* --- Talks: the tally set on a pixel-art scroll (assets/pixel/talk-scroll.png, drawn at 3x) at the right of
   the title; the writing area is the image's (15, 12, 37 x 16) --- */
.page-head--tally { display: grid; grid-template-columns: minmax(0, 1fr) auto; column-gap: 2rem; align-items: center; }
.page-head--tally > :not(.tally) { grid-column: 1; }
.page-head--tally > .tally { grid-column: 2; grid-row: 1 / span 2; }
.tally { position: relative; width: 198px; height: 153px; justify-self: end; margin-bottom: -0.6rem; }
.tally__art { display: block; width: 198px; height: 153px; image-rendering: pixelated; }
/* On opening the page the scroll unrolls: the lower roll (with the seal) starts against the upper one and comes
   down twenty image pixels, a pixel a step, and the sheet with the tally shows above it as it goes. The roll is
   the lower part of the same image (from row 29), laid over the sheet. */
.tally__sheet { position: absolute; inset: 0; clip-path: inset(0 0 54px 0); animation: tally-sheet 0.9s steps(20, end) 0.35s both; }
.tally__roll { position: absolute; left: 0; top: 87px; width: 198px; height: 66px; overflow: hidden; animation: tally-roll 0.9s steps(20, end) 0.35s both; }
.tally__roll .tally__art { position: absolute; left: 0; top: -87px; }
@keyframes tally-sheet { from { clip-path: inset(0 0 114px 0); } to { clip-path: inset(0 0 54px 0); } }
@keyframes tally-roll { from { transform: translateY(-60px); } to { transform: none; } }
@media (prefers-reduced-motion: reduce) { .tally__sheet, .tally__roll { animation: none; } }
.tally__text { position: absolute; left: 45px; top: 37px; width: 111px; margin: 0; color: #2a1a10; text-shadow: none; }
.tally__text div { display: flex; align-items: baseline; height: 23px; }
.tally__text div::after { content: ''; order: 1; flex: 1; margin: 0 0.3rem; border-bottom: 2px dotted rgba(90, 64, 36, 0.45); }
.tally__text dt { font-family: var(--font-body); font-style: italic; font-size: 1.08rem; line-height: 1; }
.tally__text dd { order: 2; margin: 0; font-family: 'UnifrakturMaguntia', var(--font-display); font-size: 1.4rem; line-height: 1; color: var(--oxblood); }
@media (max-width: 720px) {
  .page-head--tally { grid-template-columns: minmax(0, 1fr); }
  .page-head--tally > .tally { grid-column: 1; grid-row: auto; justify-self: start; margin: 0.4rem 0 0.2rem; }
}

.tabs--books .tab { text-align: left; }   /* a long topic that wraps on a phone stays by its book */
