:root {
  --bg: #fdfdfc;
  --text: #17150f;
  --muted: #6b6862;
  --accent: #8a5a2b;
  --rule: #14120d;
  --code-bg: #f2f0ec;
  --accent-visited: #5c3a17;
  --link-body: #4f4b45;

  /* ruling interval; line-height and paragraph spacing lock to it */
  --pad-pitch: 22px;
  --pad-bg: #fbf5c4;
  --pad-rule: rgba(58, 92, 160, 0.19);
  --pad-margin: rgba(196, 66, 62, 0.34);
  --pad-stain: rgba(140, 104, 40, 0.055);
  --pad-vignette: rgba(90, 70, 25, 0.13);
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #161513;
    --text: #e8e5df;
    --muted: #9a958c;
    --accent: #d9a066;
    --rule: #b5aea1;
    --code-bg: #211f1c;
    --accent-visited: #a97b45;
    --link-body: #b8b2a8;

    --pad-bg: #201c12;
    --pad-rule: rgba(126, 156, 214, 0.11);
    --pad-margin: rgba(198, 92, 88, 0.26);
    --pad-stain: rgba(212, 176, 96, 0.045);
    --pad-vignette: rgba(0, 0, 0, 0.30);
  }
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  /* whole number of rules, so the ruling aligns with text */
  padding: calc(var(--pad-pitch) * 4) 1.5rem 6rem;
  color: var(--text);
  font-family: 'Computer Modern Serif', ui-serif, Georgia, serif;
  font-size: 0.8rem;
  line-height: var(--pad-pitch);
  -webkit-font-smoothing: subpixel-antialiased;

  background-color: var(--pad-bg);
  background-repeat: no-repeat, no-repeat, no-repeat, no-repeat, no-repeat,
                     no-repeat, no-repeat, repeat;
  background-image:
    /* stains */
    radial-gradient(58% 34% at 12% 8%,  var(--pad-stain) 0%, transparent 70%),
    radial-gradient(42% 26% at 88% 26%, var(--pad-stain) 0%, transparent 72%),
    radial-gradient(36% 30% at 74% 68%, var(--pad-stain) 0%, transparent 68%),
    radial-gradient(50% 22% at 22% 84%, var(--pad-stain) 0%, transparent 70%),
    radial-gradient(30% 18% at 46% 44%, var(--pad-stain) 0%, transparent 66%),

    /* edge darkening */
    radial-gradient(130% 96% at 50% 46%,
      transparent 58%, var(--pad-vignette) 100%),

    /* red margin rules */
    linear-gradient(to right,
      transparent calc(50% - 19.4rem),
      var(--pad-margin) calc(50% - 19.4rem),
      var(--pad-margin) calc(50% - 19.4rem + 1px),
      transparent calc(50% - 19.4rem + 1px),
      transparent calc(50% - 19.1rem),
      var(--pad-margin) calc(50% - 19.1rem),
      var(--pad-margin) calc(50% - 19.1rem + 1px),
      transparent calc(50% - 19.1rem + 1px)),

    /* blue ruling */
    repeating-linear-gradient(to bottom,
      transparent 0,
      transparent calc(var(--pad-pitch) - 0.6px),
      var(--pad-rule) calc(var(--pad-pitch) - 0.6px),
      var(--pad-rule) var(--pad-pitch));
}

.site-header,
main,
body > footer {
  max-width: 34rem;
  margin-inline: auto;
}

h1 {
  margin: 0 0 var(--pad-pitch);
  font-size: 2rem;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: calc(var(--pad-pitch) * 2);
}

h2 {
  margin: 2.5rem 0 0.75rem;
  font-size: 1.35rem;
  font-weight: 600;
}

h3 {
  margin: 2rem 0 0.5rem;
  font-size: 1.15rem;
  font-weight: 600;
}

p {
  margin: 0 0 var(--pad-pitch);
}

.tagline {
  margin: 0.4rem 0 2rem;
  color: var(--muted);
  font-style: italic;
}

a {
  color: var(--link-body);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.2em;
}

a:visited {
  color: var(--link-body);
}

a:hover {
  text-decoration-thickness: 2px;
}

/* --- Post list ------------------------------------------------------- */

.writing h2 {
  padding-top: 1.5rem;
  border-top: 2px solid var(--rule);
}

ul.posts {
  margin: 0;
  padding: 0;
  list-style: none;
}

ul.posts li {
  display: flex;
  flex-wrap: wrap;
  gap: 0 0.75rem;
  align-items: baseline;
  margin-bottom: 0.5rem;
}

ul.posts time {
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.8rem;
}



/* --- Portrait --------------------------------------------------------- */

.intro {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1.75rem;
  margin-bottom: 2.5rem;
}

.portrait {
  flex: 0 0 auto;
  width: 150px;
  height: 150px;
  border-radius: 50%;
}

.identity {
  flex: 1 1 15rem;
  /* the rule frames just this column, not the full width under the photo */
  padding-bottom: 0.9rem;
  border-bottom: 2px solid var(--rule);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
  line-height: 1.5;
}

.identity .tagline {
  margin: 0 0 0.5rem;
  color: var(--text);
  font-family: 'Computer Modern Serif', ui-serif, Georgia, serif;
  font-size: 1.125rem;
  font-style: normal;
  line-height: 1.5;
}

.identity .location {
  margin: 0 0 0.5rem;
  color: var(--muted);
  font-size: 1.15rem;
  letter-spacing: 0.15em;
}


/* --- Logo blending on paper ------------------------------------------- */
/* multiply drops baked-in white backgrounds into the paper; in dark mode it
   crushes to black, so the marks get a light chip instead */

.lineage .logo,
.post .era-logo {
  mix-blend-mode: multiply;
}

@media (prefers-color-scheme: dark) {
  .lineage .logo,
  .post .era-logo {
    mix-blend-mode: normal;
    background: #efeadb;
    padding: 1px 2px;
    border-radius: 2px;
  }
}

/* --- Affiliation lineage ---------------------------------------------- */

.lineage {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  margin-top: 0.6rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.72rem;
  line-height: 1.35;
  color: var(--muted);
}

.lineage .node {
  white-space: nowrap;
}

.lineage .now {
  color: var(--text);
  font-weight: 700;
}

.lineage .arrow {
  color: var(--muted);
  opacity: 0.6;
}

.lineage .branch {
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  padding-left: 0.35rem;
  border-left: 1px solid var(--rule);
}

.lineage-block {
  margin: 0 0 2rem;
  padding-bottom: 1.1rem;
  border-bottom: 2px solid var(--rule);
}

.lineage-logos {
  gap: 0.55rem;
  margin: 0 0 2rem;
  font-size: 0.8rem;
}

.lineage-logos .branch {
  gap: 0.35rem;
}

/* both dimensions capped: mixed aspect ratios, and some of these SVGs carry
   only a viewBox, collapsing to zero under height:auto */
.lineage .logo {
  display: block;
  height: 15px;
  width: auto;
  max-width: 46px;
  object-fit: contain;
  border-radius: 0;
}

.lineage-logos {
  gap: 0.4rem;
}

.lineage-logos .node {
  display: inline-flex;
  align-items: center;
}

.identity-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.55rem;
  margin: 0;
  padding: 0;
  list-style: none;
}

/* separator before every item but the first */
.identity-links li + li::before {
  content: "|";
  margin-right: 0.55rem;
  color: var(--muted);
  opacity: 0.5;
}

/* --- Site header + nav ------------------------------------------------ */

.site-header {
  margin-bottom: calc(var(--pad-pitch) * 2);
}

.sitename {
  display: inline-block;
  margin: 0 0 0.65rem;
  /* extra right padding offsets the trailing letter-spacing */
  padding: 0.35rem 0.6rem 0.35rem 0.72rem;
  border: 1px solid var(--text);
  font-family: 'Cinzel', ui-serif, Georgia, serif;
  font-size: 1.45rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  line-height: 1.2;
}

p.sitename a {
  color: var(--text);
  text-decoration: none;
}

p.sitename a:hover {
  color: var(--accent);
}

.nav {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 1.25rem;
  margin-top: 0.9rem;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

.nav a {
  color: var(--muted);
  text-decoration: none;
}

.nav a:hover {
  color: var(--accent);
}

.nav a[aria-current="page"] {
  color: var(--text);
  font-size: 1.25rem;
  text-decoration: underline;
  text-underline-offset: 0.25em;
  text-decoration-thickness: 1px;
}

.empty {
  color: var(--muted);
  font-style: italic;
}

/* --- Bio era headings ------------------------------------------------- */

.post h2 {
  margin: calc(var(--pad-pitch) * 2) 0 var(--pad-pitch);
  font-size: 0.72rem;
  font-weight: 400;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.era {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.era-dates::before { content: "("; }
.era-dates::after  { content: ")"; }

/* overrides height:auto from .post img */
.post .era-logo {
  height: 1.35em;
  width: auto;
  max-width: 44px;
  object-fit: contain;
}

.post h2:first-of-type {
  margin-top: 1.8rem;
}

/* --- Single post ----------------------------------------------------- */


.meta {
  margin: 0.5rem 0 2.5rem;
  color: var(--muted);
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.85rem;
}

.post ul,
.post ol {
  margin: 0 0 var(--pad-pitch);
  padding-left: 1.25rem;
}

.post li {
  margin-bottom: 0.35rem;
}

.post img {
  max-width: 100%;
  height: auto;
}

blockquote {
  margin: 0 0 1.5rem;
  padding-left: 1.25rem;
  border-left: 2px solid var(--rule);
  color: var(--muted);
  font-style: italic;
}

hr {
  margin: 2.5rem 0;
  border: 0;
  border-top: 2px solid var(--rule);
}

code {
  padding: 0.15em 0.35em;
  border-radius: 3px;
  background: var(--code-bg);
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.85em;
}

pre {
  margin: 0 0 1.5rem;
  padding: 1rem 1.15rem;
  overflow-x: auto;
  border-radius: 4px;
  background: var(--code-bg);
  font-size: 0.85rem;
  line-height: 1.5;
}

pre code {
  padding: 0;
  background: none;
  font-size: inherit;
}

/* --- Footer links ---------------------------------------------------- */

.links a {
  color: var(--accent);
}

.links a:visited {
  color: var(--accent-visited);
}

.links {
  display: flex;
  flex-wrap: wrap;
  gap: 1.5rem;
  margin: 3rem 0 0;
  padding: 1.5rem 0 0;
  border-top: 1px solid var(--rule);
  list-style: none;
  font-family: ui-sans-serif, system-ui, sans-serif;
  font-size: 0.9rem;
}

