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

:root {
  --ink: #1d1d1d;
  --soft: #666666;
  --muted: #767676;
  --rule: #d8d8d8;
  --bg: #fafafa;
  --accent: #146573;
  --amber: #b9893f;
  --serif: "Charter", "Iowan Old Style", "Palatino Linotype", "Book Antiqua", Georgia, serif;
}

body {
  font-family: var(--serif);
  font-size: 17px;
  line-height: 1.65;
  color: var(--ink);
  background: var(--bg);
  margin: 0;
}

#page {
  max-width: 680px;
  margin: 0 auto;
  padding: 4em 2em 5em;
}

header.letterhead {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid var(--ink);
  padding-bottom: 1em;
  margin-bottom: 2em;
  flex-wrap: wrap;
  gap: 0.8em;
}

header.letterhead.consulting-page {
  border-bottom-color: var(--accent);
}

.letterhead-id h1 {
  font-size: 1.65em;
  font-weight: 600;
  letter-spacing: -0.015em;
  line-height: 1.2;
  text-wrap: balance;
  margin: 0 0 0.2em;
}

.letterhead-id .firm-line {
  font-size: 0.78em;
  color: var(--soft);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

nav.letterhead {
  display: flex;
  gap: 1.4em;
  font-size: 0.92em;
}

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

nav.letterhead a.active {
  color: var(--ink);
  font-weight: 600;
}

h2 {
  font-size: 1.4em;
  font-weight: 600;
  margin: 0 0 1em;
}

h3 {
  font-size: 1.12em;
  line-height: 1.35;
  font-weight: 600;
  margin: 1.6em 0 0.55em;
}

p { margin: 0 0 1.1em; }
ul { margin: 0.3em 0 1.2em 1.3em; padding: 0; }
li { margin-bottom: 0.4em; }

a {
  color: var(--accent);
  border-bottom: 1px solid var(--link-rule);
  text-decoration: none;
}

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

/* Fieldwork banner on the Research page — wide crop through the centre of the photo */
.banner {
  margin: 1.6em 0 2em;
}
.banner img {
  width: 100%;
  height: 240px;
  object-fit: cover;
  object-position: center;
  display: block;
}
.banner figcaption {
  font-size: 0.85em;
  color: var(--soft);
  margin-top: 0.5em;
}

.intro-wrap {
  display: grid;
  grid-template-columns: 90px minmax(0, 1fr);
  gap: 1.3em;
  align-items: start;
  margin-bottom: 1.5em;
}
.intro-wrap p { margin: 0; font-size: 1.08em; line-height: 1.55; }

.intro-wrap img {
  width: 90px;
  height: auto;
  margin: 0.2em 0 0;
}

.pillars {
  display: flex;
  gap: 2em;
  margin: 2.2em 0 1em;
  padding-top: 0;
}
.pillars > div { flex: 1; border-top: 2px solid var(--ink); padding-top: 0.9em; }
.pillars > div.practice { border-top-color: var(--accent); }
.pillars > div.writing { border-top-color: var(--amber); }
.pillars h3 { margin-top: 0; }
.pillars h3 a { color: inherit; border-bottom: none; }
.pillars p { font-size: 0.94em; color: var(--detail); margin-bottom: 0; }

.status { color: var(--muted); font-size: 0.9em; }

.project-meta {
  font-size: 0.88em;
  color: var(--soft);
  margin-bottom: 1.2em;
}

.project-links a {
  margin-right: 1.2em;
}

.back-link {
  font-size: 0.9em;
}

.now-list {
  margin: 0.3em 0 1.2em 1.3em;
}

footer.letterhead {
  margin-top: 4em;
  padding-top: 1.2em;
  border-top: 1px solid var(--ink);
  font-size: 0.85em;
  color: var(--soft);
  display: flex;
  flex-wrap: wrap;
  justify-content: flex-start;
  gap: 0.5em 1.3em;
  line-height: 1.5;
}

@media (max-width: 600px) {
  header.letterhead { flex-direction: column; align-items: flex-start; }
  nav.letterhead { flex-wrap: wrap; gap: 0.4em 1em; }
  .pillars { flex-direction: column; gap: 1.6em; }

}

/* Reading hierarchy without another font family or decorative motion. */
a:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }
nav.letterhead a { border-bottom-color: transparent; }
nav.letterhead a.active, nav.letterhead a:hover { border-bottom-color: var(--accent); }
.research-topic { margin: 0 0 1.7em; }
.research-topic h3 { margin-top: 0; }
.research-topic p:last-child, .research-topic ul:last-child { margin-bottom: 0; }
.publications-heading { margin-top: 2em; }
footer.letterhead a { color: var(--soft); border-bottom-color: transparent; }
footer.letterhead a:hover { color: var(--accent); border-bottom-color: var(--accent); }
@media (max-width: 420px) {
  #page { padding: 2.5em 1.3em 3em; }
  .letterhead-id h1 { font-size: 1.5em; }
  .intro-wrap { grid-template-columns: 1fr; gap: 0.8em; margin-bottom: 1.3em; }
  .intro-wrap img { width: 76px; margin: 0; }
  .intro-wrap p { font-size: 1.05em; }
}

/* Source figures remain unaltered and readable at phone sizes. */
.research-figure { margin: 2em 0; }
.research-figure img { display: block; width: 100%; height: auto; }
.figure-scroll { overflow-x: auto; }
.figure-scroll img { min-width: 650px; }
.workflow-scroll img { min-width: 640px; }
.comparison-scroll img { min-width: 1000px; }
.research-figure figcaption { margin-top: 0.8em; font-size: 0.85em; line-height: 1.55; color: var(--soft); }
.project-detail { margin: 1.7em 0; }
.project-detail summary { color: var(--accent); cursor: pointer; }
.project-detail .research-figure { margin-top: 1.2em; }
.cv-records li { margin-bottom: 0.85em; }
@media print { .figure-scroll img { min-width: 0; } }

@media (min-width: 761px) { .figure-scroll:not(.comparison-scroll) img { min-width: 0; } }

/* Project marks are visual identifiers; the adjoining headings name the work. */
.research-topic-marked { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 1.3em; align-items: start; margin-bottom: 2.2em; }
.project-mark { display: block; width: 112px; height: 112px; object-fit: contain; mix-blend-mode: multiply; margin-top: 0.1em; }
.topic-copy { min-width: 0; }
.project-heading { display: grid; grid-template-columns: minmax(0, 1fr) 88px; gap: 1.1em; align-items: start; margin: 1.5em 0 1.3em; }
.project-heading h1 { margin: 0; line-height: 1.2; }
.project-page-mark { display: block; width: 88px; height: 88px; object-fit: contain; mix-blend-mode: multiply; }
@media (max-width: 600px) {
 .research-topic-marked { display: flow-root; }
 .project-mark { float: right; width: 68px; height: 68px; margin: 0 0 0.6em 1em; }
 .project-heading { grid-template-columns: minmax(0, 1fr) 64px; gap: 0.8em; }
 .project-heading h1 { font-size: 1.6em; }
 .project-page-mark { width: 64px; height: 64px; }
}

/* Light grey is the chosen light theme. Follow the visitor's operating-system preference. */
:root { color-scheme: light; --link-rule: #b9d4d8; --detail: #333333; }
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --bg: #181a1c;
    --ink: #e5e5e5;
    --soft: #b1b3b6;
    --muted: #a5a8ac;
    --rule: #3d4145;
    --accent: #86bfc8;
    --amber: #d4b073;
    --link-rule: #476268;
    --detail: #c6c8ca;
  }
  /* Preserve original marks and scientific figure colours. */
  .project-mark, .project-page-mark { mix-blend-mode: normal; background: #ffffff; }
}
@media print {
  :root { color-scheme: light; --bg: #ffffff; --ink: #1d1d1d; --soft: #666666; --muted: #767676; --rule: #d8d8d8; --accent: #146573; --link-rule: #b9d4d8; --detail: #333333; }
}
