@font-face {
  font-family: Fraunces;
  src: url("assets/fonts/fraunces.woff2") format("woff2");
  font-display: swap;
  font-weight: 400;
}
@font-face {
  font-family: "DM Sans";
  src: url("assets/fonts/dm-sans.woff2") format("woff2");
  font-display: swap;
  font-weight: 400 600;
}
:root {
  --paper: #f6f2e9;
  --surface: #eee8dc;
  --ink: #292824;
  --muted: #656057;
  --accent: #712e3d;
  --accent-hover: #4e1e29;
  --line: #cdc4b5;
  --white: #fffcf5;
  --display: Fraunces, Georgia, serif;
  --body: "DM Sans", system-ui, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Consolas, monospace;
  --s1: 8px;
  --s2: 16px;
  --s3: 24px;
  --s4: 32px;
  --s6: 48px;
  --s8: 64px;
  --s12: 96px;
}
* {
  box-sizing: border-box;
}
html {
  scroll-behavior: smooth;
  scroll-padding-top: 32px;
}
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 17px/1.7 var(--body);
  -webkit-font-smoothing: antialiased;
}
a {
  color: var(--accent);
  text-underline-offset: 5px;
  text-decoration-thickness: 1px;
}
a:hover {
  color: var(--accent-hover);
}
a,
button {
  touch-action: manipulation;
}
button,
input {
  font: inherit;
}
button {
  cursor: pointer;
}
img {
  display: block;
  max-width: 100%;
  height: auto;
}
svg {
  max-width: 100%;
}
h1,
h2,
h3,
h4,
p {
  margin: 0;
}
h1,
h2,
h3,
h4 {
  font-family: var(--display);
  font-weight: 400;
  line-height: 1.14;
  color: var(--accent);
}
h1 {
  font-size: clamp(2.75rem, 5.7vw, 5.4rem);
  letter-spacing: -0.04em;
  max-width: 1000px;
}
h2 {
  font-size: clamp(2rem, 3vw, 3rem);
  letter-spacing: -0.025em;
}
h3 {
  font-size: 1.7rem;
  letter-spacing: -0.02em;
}
p + p {
  margin-top: 16px;
}
::selection {
  background: var(--accent);
  color: var(--paper);
}
:focus-visible {
  outline: 3px solid var(--accent);
  outline-offset: 5px;
}
.wrap {
  width: 100%;
}
.skip {
  position: absolute;
  left: 24px;
  top: -100px;
  background: var(--white);
  padding: 12px;
  z-index: 20;
}
.skip:focus {
  top: 16px;
}
.statusbar {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  padding: 15px 0 12px;
  border-bottom: 1px solid var(--line);
  font: 11px/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.statusbar a {
  text-decoration: none;
}
.eyebrow {
  font: 12px/1.5 var(--mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  margin-bottom: 24px;
}
.lead {
  font-size: 20px;
  line-height: 1.65;
  max-width: 660px;
  margin-top: 24px;
  color: var(--muted);
}
.intro {
  padding: 72px 0 64px;
}
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 280px;
  gap: 50px;
  align-items: center;
}
.hero h1 {
  font-size: clamp(2.9rem, 5.6vw, 5.25rem);
}
.hero h1 em {
  font-style: normal;
  color: var(--ink);
}
.hero .lead {
  font-size: 18px;
}
.hero img {
  mix-blend-mode: multiply;
  aspect-ratio: 1;
  object-fit: contain;
}
.caption {
  font: 11px/1.6 var(--mono);
  color: var(--muted);
  margin-top: 16px;
}
.tags {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}
.tag {
  font: 11px/1.5 var(--mono);
  padding: 5px 9px;
  border: 1px solid var(--line);
  color: var(--muted);
}
.actions {
  display: flex;
  align-items: center;
  gap: 24px;
  flex-wrap: wrap;
  margin-top: 32px;
}
.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  min-height: 48px;
  padding: 10px 20px;
  background: var(--accent);
  color: var(--paper);
  border: 1px solid var(--accent);
  text-decoration: none;
  font-size: 14px;
  transition:
    background 0.18s,
    transform 0.18s;
}
.button:hover {
  background: var(--accent-hover);
  color: var(--paper);
}
.button.secondary {
  background: transparent;
  color: var(--accent);
}
.text-link {
  display: inline-flex;
  align-items: center;
  gap: 12px;
  min-height: 44px;
  font-size: 14px;
}
.arrow {
  display: inline-block;
  transition: transform 0.18s;
}
a:hover .arrow,
a:focus-visible .arrow {
  transform: translate(3px, -2px);
}
.section {
  padding: 48px 0 64px;
}
.section-top {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 24px;
  margin-bottom: 32px;
}
.section-top .eyebrow {
  margin: 0;
}
.investigation {
  display: grid;
  grid-template-columns: 48px minmax(0, 1.35fr) minmax(0, 1fr);
  gap: 24px;
  padding: 32px 0;
  border-top: 1px solid var(--line);
}
.investigation:first-child {
  border-top: 0;
  padding-top: 0;
}
.number {
  font: 13px var(--mono);
  color: var(--accent);
  padding-top: 8px;
}
.investigation h3 a {
  text-decoration: none;
  color: var(--accent);
}
.investigation .eyebrow {
  margin: 16px 0 0;
  font-size: 11px;
}
.investigation p {
  font-size: 15px;
  color: var(--muted);
}
.investigation .text-link {
  margin-top: 12px;
}
.project-description {
  align-self: center;
}
.mini-chart {
  padding: 16px 20px;
  background: var(--surface);
  /* the browser default figure margin is 1em 40px: that was the gap on the left */
  margin: 20px 0 0;
}
.mini-chart h4 {
  font: 12px var(--mono);
  margin-bottom: 16px;
  color: var(--ink);
}
.bar-row {
  display: grid;
  grid-template-columns: 68px minmax(0, 1fr) 68px;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  font: 12px var(--mono);
}
.bar-track {
  background: var(--line);
  height: 14px;
}
.bar {
  height: 100%;
  background: var(--accent);
}
.bar.before {
  background: #9a7377;
}
.mini-chart .caption {
  font-size: 10px;
}
.three-col {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 40px;
}
.three-col h3 {
  font-size: 1.5rem;
  margin-bottom: 12px;
}
.three-col p {
  font-size: 15px;
  color: var(--muted);
}
.small-label {
  font: 12px var(--mono);
  color: var(--accent);
  margin-bottom: 16px;
}
.experience-line {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 32px;
  margin-top: 32px;
}
.experience-line strong {
  display: block;
  font-weight: 500;
}
.experience-line span {
  font-size: 14px;
  color: var(--muted);
}
.callout {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 24px;
  align-items: center;
  padding: 40px;
  background: var(--surface);
}
.callout p {
  margin-top: 12px;
  color: var(--muted);
  font-size: 15px;
}
.callout h2 {
  font-size: 2.5rem;
}
.site-footer {
  border-top: 1px solid var(--line);
  padding: 48px 0 108px;
  margin-top: 32px;
}
.footer-grid {
  display: grid;
  grid-template-columns: 1.4fr 1fr 1fr;
  gap: 32px;
}
.footer-grid h3 {
  font-size: 1.9rem;
}
.footer-grid p {
  font-size: 13px;
  color: var(--muted);
  margin-top: 16px;
  max-width: 360px;
}
.footer-links {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}
.footer-links a {
  font-size: 14px;
  min-height: 44px;
  display: flex;
  align-items: center;
}
.footer-bottom {
  margin-top: 40px;
  display: flex;
  justify-content: space-between;
  gap: 24px;
  font: 11px/1.6 var(--mono);
  color: var(--muted);
}
.breadcrumb {
  font-size: 13px;
  margin-bottom: 24px;
}
.breadcrumb a {
  display: inline-block;
  padding-block: 8px;
}
.filters {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 24px;
}
.filter {
  min-height: 44px;
  padding: 8px 16px;
  background: transparent;
  border: 1px solid var(--line);
  font-size: 14px;
  color: var(--accent);
  transition: background 0.18s;
}
.filter[aria-pressed="true"] {
  background: var(--accent);
  color: var(--paper);
  border-color: var(--accent);
}
.search-box {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  flex-wrap: wrap;
}
.search-box label {
  font: 12px var(--mono);
  color: var(--muted);
}
input[type="search"] {
  width: min(100%, 350px);
  min-height: 48px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  background: var(--white);
  color: var(--ink);
  border-radius: 0;
}
.result-count {
  font: 12px var(--mono);
  color: var(--muted);
  margin: 24px 0;
}
.empty {
  padding: 48px;
  background: var(--surface);
}
.empty h2 {
  font-size: 2rem;
}
.empty p {
  margin-top: 16px;
}
.empty .button {
  margin-top: 24px;
}
[hidden] {
  display: none !important;
}
.article-head {
  padding: 56px 0 48px;
}
.article-head h1 {
  font-size: clamp(2.6rem, 4.7vw, 4.6rem);
  max-width: 980px;
}
.article-layout {
  display: grid;
  grid-template-columns: 210px minmax(0, 720px);
  justify-content: space-between;
  gap: 48px;
  border-top: 1px solid var(--line);
  padding-top: 40px;
}
.toc {
  align-self: start;
  position: sticky;
  top: 28px;
}
.toc h2 {
  font: 11px var(--mono);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-bottom: 12px;
}
.toc a {
  display: block;
  font-size: 13px;
  min-height: 44px;
  padding: 10px 0;
  text-decoration: none;
  border-bottom: 1px solid var(--line);
}
.prose section {
  margin-bottom: 48px;
  scroll-margin-top: 32px;
}
.prose h2 {
  font-size: 2.15rem;
  margin-bottom: 20px;
}
.prose h3 {
  font-size: 1.5rem;
  margin: 24px 0 12px;
}
.prose p,
.prose li {
  color: var(--muted);
}
.prose ul {
  padding-left: 24px;
}
.prose li + li {
  margin-top: 12px;
}
.note-box {
  padding: 20px 24px;
  background: var(--surface);
  border-left: 2px solid var(--accent);
  margin: 24px 0;
  font-size: 14px;
}
.note-box strong {
  color: var(--accent);
}
.diagram {
  padding: 24px;
  background: var(--surface);
  margin: 24px 0;
}
.diagram svg {
  display: block;
  width: 100%;
  height: auto;
}
.diagram figcaption {
  font: 11px/1.6 var(--mono);
  color: var(--muted);
  margin-top: 12px;
}
.pipeline {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  font: 13px var(--mono);
}
.pipeline span {
  border: 1px solid var(--accent);
  padding: 14px;
  color: var(--accent);
  background: var(--paper);
}
table {
  border-collapse: collapse;
  width: 100%;
  font-size: 14px;
  margin-top: 24px;
}
caption {
  text-align: left;
  font: 12px var(--mono);
  margin-bottom: 12px;
  color: var(--accent);
}
th,
td {
  padding: 12px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}
th {
  font-weight: 500;
}
.metric {
  font: clamp(2rem, 5vw, 3rem)/1.2 var(--display);
  color: var(--accent);
}
.metric-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 24px 0;
}
.metric-grid p {
  font-size: 13px;
  margin-top: 8px;
}
.next-project {
  display: block;
  border-top: 1px solid var(--line);
  padding: 32px 0;
  text-decoration: none;
}
.next-project span {
  display: block;
  font: 11px var(--mono);
  margin-bottom: 12px;
}
.next-project strong {
  font: 2rem var(--display);
  font-weight: 400;
}
.draft-pill {
  display: inline-block;
  border: 1px solid var(--accent);
  padding: 5px 10px;
  font: 11px var(--mono);
  color: var(--accent);
  margin-bottom: 20px;
}
.note-list article {
  padding: 32px 0;
  border-top: 1px solid var(--line);
  display: grid;
  grid-template-columns: 120px 1fr;
  gap: 32px;
}
.note-list article h2 {
  font-size: 1.9rem;
}
.note-list p {
  margin-top: 12px;
  font-size: 15px;
  color: var(--muted);
}
.note-list .text-link {
  margin-top: 12px;
}
.note-list .eyebrow {
  margin-top: 8px;
}
.bio {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 64px;
}
.bio h2 {
  margin-bottom: 24px;
}
.timeline {
  margin-top: 32px;
}
.timeline article {
  border-top: 1px solid var(--line);
  padding: 28px 0;
}
.timeline h3 {
  font-size: 1.15rem;
  margin: 12px 0;
}
.timeline p {
  font-size: 15px;
  color: var(--muted);
}
.timeline .caption {
  margin: 0;
}
.contact-links {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 32px;
}
.contact-links a {
  min-height: 48px;
  padding: 10px 20px;
  border: 1px solid var(--accent);
  text-decoration: none;
}
.swatches {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.swatch {
  border: 1px solid var(--line);
  padding: 16px;
  font: 12px var(--mono);
}
.swatch i {
  display: block;
  height: 72px;
  margin-bottom: 12px;
}
.sitemap {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 24px;
}
.sitemap a {
  padding: 16px;
  border: 1px solid var(--line);
  font-size: 14px;
}
code {
  font: 13px var(--mono);
  overflow-wrap: anywhere;
}
#copy-status {
  font-size: 13px;
  color: var(--muted);
  min-height: 24px;
  margin-top: 12px;
}
#session-user {
  display: none;
  position: fixed;
  bottom: 18px;
  right: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
  padding: 8px 12px;
  z-index: 30;
  gap: 16px;
  align-items: center;
  font-size: 12px;
}
#session-user button {
  min-height: 44px;
  background: none;
  color: var(--accent);
  border: 0;
}
#session-error {
  font-size: 12px;
}
.fade-in {
  animation: enter 0.24s ease-out both;
}
.intro .lead {
  animation-delay: 0.05s;
}
.js .reveal {
  transition:
    opacity 0.24s ease-out,
    transform 0.24s ease-out;
}
.js .reveal.waiting {
  opacity: 0;
  transform: translateY(8px);
}
@keyframes enter {
  from {
    opacity: 0;
    transform: translateY(8px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}
@media (max-width: 1100px) {
  .hero {
    grid-template-columns: minmax(0, 1fr) 220px;
    gap: 24px;
  }
  .investigation {
    grid-template-columns: 36px 1fr 1fr;
  }
  .article-layout {
    grid-template-columns: 170px minmax(0, 1fr);
    gap: 32px;
  }
}
@media (max-width: 767px) {
  .statusbar {
    font-size: 10px;
  }
  .statusbar span:last-child {
    display: none;
  }
  .intro {
    padding: 48px 0;
  }
  .hero {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .hero h1 {
    font-size: clamp(2.65rem, 10vw, 4.2rem);
  }
  .lead {
    font-size: 18px;
  }
  .eyebrow {
    font-size: 11px;
  }
  .section {
    padding: 32px 0 48px;
  }
  .section-top {
    align-items: flex-start;
    gap: 16px;
  }
  .section-top h2 {
    font-size: 1.8rem;
  }
  .section-top .text-link {
    font-size: 12px;
    white-space: nowrap;
  }
  .investigation {
    grid-template-columns: 28px 1fr;
    gap: 12px;
    padding: 28px 0;
  }
  .project-description {
    grid-column: 2;
  }
  .investigation h3 {
    font-size: 1.65rem;
  }
  .three-col,
  .experience-line,
  .bio {
    grid-template-columns: 1fr;
    gap: 28px;
  }
  .callout {
    grid-template-columns: 1fr;
    padding: 24px;
  }
  .callout h2 {
    font-size: 2rem;
  }
  .callout .button {
    justify-self: start;
  }
  .footer-grid {
    grid-template-columns: 1fr 1fr;
    gap: 24px;
  }
  .footer-grid > div:first-child {
    grid-column: 1/-1;
  }
  .footer-bottom {
    flex-direction: column;
    gap: 12px;
  }
  .article-head {
    padding: 40px 0 32px;
  }
  .article-layout {
    grid-template-columns: 1fr;
    gap: 32px;
    padding-top: 24px;
  }
  .toc {
    position: static;
  }
  .toc nav {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
  }
  .toc a {
    font-size: 12px;
    border: 0;
  }
  .prose h2 {
    font-size: 1.8rem;
  }
  .prose {
    min-width: 0;
  }
  .note-list article {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  .note-list article .eyebrow {
    margin-bottom: 8px;
  }
  .note-list h2 {
    font-size: 1.7rem;
  }
  .note-list .draft-pill {
    margin-bottom: 8px;
  }
  .swatches,
  .sitemap {
    grid-template-columns: 1fr 1fr;
  }
  .metric-grid {
    gap: 16px;
  }
  .bar-row {
    grid-template-columns: 60px minmax(0, 1fr) 65px;
    font-size: 11px;
  }
  .diagram {
    padding: 16px;
  }
  .empty {
    padding: 24px;
  }
  .search-box {
    gap: 10px;
  }
  .filters {
    gap: 8px;
  }
  .filter {
    padding: 8px 12px;
  }
  .actions {
    gap: 16px;
  }
  .statusbar a {
    min-height: 28px;
  }
  .site-footer {
    padding-bottom: 108px;
  }
  .prose table {
    font-size: 12px;
  }
  th,
  td {
    padding: 10px 5px;
  }
}
@media (prefers-reduced-motion: reduce) {
  html {
    scroll-behavior: auto;
  }
  *,
  *::before,
  *::after {
    animation: none !important;
    transition: none !important;
  }
  .js .reveal.waiting {
    opacity: 1;
    transform: none;
  }
}
@media print {
  .statusbar,
  .sidenav,
  .site-footer,
  #session-user,
  .actions {
    display: none;
  }
  body {
    background: white;
  }
  .wrap {
    width: 100%;
  }
  .article-layout {
    display: block;
  }
  .toc {
    display: none;
  }
  a {
    color: inherit;
  }
  .prose section {
    break-inside: avoid;
  }
}

/* ---------- Additions for this site ---------- */

/* Plain-English / technical swap. Default is technical. */
.plain {
  display: none;
}
body.plain-mode .plain {
  display: block;
}
body.plain-mode .tech {
  display: none;
}
#mode-toggle {
  white-space: nowrap;
}

/* Bullet lists inside the experience timeline */
.prose-list {
  margin: 16px 0 0;
  padding-left: 20px;
  font-size: 15px;
  color: var(--muted);
}
.prose-list li + li {
  margin-top: 12px;
}

/* "Also built" cards */
.sitemap a {
  display: block;
  text-decoration: none;
  color: var(--muted);
  line-height: 1.6;
  transition: background 0.18s;
}
.sitemap a:hover {
  background: var(--surface);
}
.sitemap strong {
  display: inline-block;
  margin-bottom: 8px;
  font: 1.2rem/1.3 var(--display);
  font-weight: 400;
  color: var(--accent);
}

/* Right-hand column of the About block */
.bio .small-label {
  margin-bottom: 8px;
}
.bio .tags {
  margin-top: 12px;
}

@media (max-width: 767px) {
  .sitemap {
    grid-template-columns: 1fr;
  }
}

.arch {
  display: block;
  width: 100%;
  height: auto;
}
.arch rect {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
}
.arch rect.fill {
  fill: var(--surface);
}
.arch line {
  stroke: var(--accent);
  stroke-width: 1.2;
}
.arch circle {
  fill: var(--paper);
  stroke: var(--accent);
  stroke-width: 1.2;
}
.arch circle.tap {
  fill: var(--accent);
  stroke: none;
}
.arch path.resid {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1;
  stroke-dasharray: 3 3;
}
.arch path.bracket {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}
.arch marker path {
  fill: var(--accent);
  stroke: none;
}
.arch text {
  font: 9px var(--mono);
  fill: var(--muted);
  text-anchor: middle;
}
.arch text.count {
  fill: var(--accent);
  font-size: 8.5px;
}
/* input / output modality glyphs */
.arch .io {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.arch path.io-link {
  fill: none;
  stroke: var(--line);
  stroke-width: 1;
}
.arch text.io-text {
  font-size: 8.5px;
  fill: var(--accent);
}
/* Skills, grouped by category */
.skill-group + .skill-group {
  margin-top: 18px;
}
.skill-cat {
  font: 11px var(--mono);
  color: var(--muted);
  letter-spacing: 0.04em;
  margin-bottom: 8px;
}
.skill-group .tags {
  margin-top: 0;
}

/* ---------- Type scale, two notches down overall ---------- */
body {
  font-size: 15px;
}
h1 {
  font-size: clamp(2rem, 3.7vw, 3.4rem);
}
.hero h1 {
  font-size: clamp(2.05rem, 3.6vw, 3.3rem);
}
h2 {
  font-size: clamp(1.4rem, 1.9vw, 1.85rem);
}
h3 {
  font-size: 1.4rem;
}
.callout h2 {
  font-size: 1.7rem;
}
.footer-grid h3 {
  font-size: 1.55rem;
}
.lead {
  font-size: 17px;
}
.hero .lead {
  font-size: 16px;
}
.investigation p,
.timeline p,
.callout p,
.prose-list {
  font-size: 13px;
}
.text-link,
.button,
.filter,
.footer-links a,
.sitemap a {
  font-size: 12px;
}
.number,
.footer-grid p,
.mini-chart h4,
.bar-row {
  font-size: 11px;
}
.eyebrow,
.small-label {
  font-size: 10.5px;
}
.tag,
.caption,
.skill-cat,
.footer-bottom {
  font-size: 9.5px;
}

/* Skills read a step darker than muted, still lighter than the About prose */
.skill-cat,
.skill-group .tag {
  color: #47443d;
}

/* ---------- Floating dock (replaces the footer) ---------- */
main {
  padding-bottom: 72px;
}
/* ---------- Collapsible roles ---------- */
.role > summary {
  list-style: none;
  cursor: pointer;
  position: relative;
  padding: 2px 34px 2px 0;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
.role > summary::-webkit-details-marker {
  display: none;
}
.role > summary::after {
  content: "";
  position: absolute;
  right: 6px;
  top: 50%;
  width: 9px;
  height: 9px;
  margin-top: -8px;
  border-right: 1.5px solid var(--accent);
  border-bottom: 1.5px solid var(--accent);
  transform: rotate(45deg);
  transition: transform 0.18s;
}
.role[open] > summary::after {
  margin-top: -3px;
  transform: rotate(-135deg);
}
.role > summary .caption {
  display: block;
  margin: 0;
  font-size: 12px;
}
.role > summary h3 {
  margin: 0 0 4px;
  transition: color 0.18s;
}
.role > summary .period {
  flex: none;
}
.role > summary:hover h3 {
  color: var(--accent-hover);
}
.role[open] > summary {
  margin-bottom: 4px;
}
/* Smooth expand. Browsers with ::details-content animate the height;
   everywhere else the content just fades in on open. */
@supports (interpolate-size: allow-keywords) {
  :root {
    interpolate-size: allow-keywords;
  }
  .role::details-content {
    block-size: 0;
    overflow: hidden;
    transition:
      block-size 0.3s ease,
      content-visibility 0.3s allow-discrete;
  }
  .role[open]::details-content {
    block-size: auto;
  }
}
.role[open] > :not(summary) {
  animation: enter 0.28s ease-out both;
}
/* the track clips its fill, and ignores the whitespace text node beside it */
.bar-track {
  overflow: hidden;
  line-height: 0;
}
/* Clustered bar plot (project 02) */
.chart-svg {
  display: block;
  width: 100%;
  height: auto;
}
.chart-svg .axis {
  stroke: var(--ink);
  stroke-width: 0.8;
}
.chart-svg .grid {
  stroke: var(--line);
  stroke-width: 0.8;
  stroke-dasharray: 2 3;
}
.chart-svg .b1 {
  fill: #9a7377;
}
.chart-svg .b2 {
  fill: var(--accent);
}
.chart-svg text {
  font: 6.5px var(--mono);
  fill: var(--muted);
}
.chart-svg text.ax {
  text-anchor: end;
}
.chart-svg .b1 + text.ax,
.chart-svg .b2 + text.ax {
  text-anchor: start;
}
.chart-svg text.val {
  font-size: 6.5px;
  fill: var(--ink);
  text-anchor: middle;
}
.chart-svg text.cat {
  font-size: 7.5px;
  fill: var(--ink);
  text-anchor: middle;
}
.chart-svg text.cat {
  font-size: 7px;
}
/* dumbbell plot (project 03) */
.chart-svg.wide text {
  font-size: 7.2px;
}
.chart-svg.wide text.v,
.chart-svg.wide text.axn {
  font-size: 6.4px;
}
.chart-svg .lolli {
  stroke: var(--line);
  stroke-width: 1.3;
}
.chart-svg .dot-hi {
  fill: var(--ink);
}
.chart-svg .dot-lo {
  fill: var(--paper);
  stroke: var(--muted);
  stroke-width: 1;
}
.chart-svg .mk-sq {
  fill: #9a7377;
}
.chart-svg .mk-x {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.4;
}
.chart-svg text.mdl {
  text-anchor: end;
  fill: var(--ink);
}
.chart-svg text.v {
  font-size: 5.8px;
  text-anchor: start;
}
.chart-svg text.axn {
  font-size: 5.8px;
  text-anchor: middle;
}

/* "what's in it" figure (project 04), reusing the hero diagram's styling */
.arch .faint {
  stroke: var(--line);
}
.arch rect.faint {
  fill: none;
}
.arch rect.on {
  fill: var(--accent);
  stroke: var(--accent);
}
.arch path.tri {
  fill: #e2d2d3;
  stroke: none;
}
.arch path.curve {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.3;
}
.arch circle.dot {
  fill: var(--accent);
  stroke: none;
}
.arch path.tick-ok {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.6;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.arch path.tick-no {
  fill: none;
  stroke: var(--muted);
  stroke-width: 1.4;
  stroke-linecap: round;
}
.arch path.shape {
  fill: none;
  stroke: var(--accent);
  stroke-width: 1.2;
}
.arch circle.ring {
  fill: none;
  stroke: var(--accent);
  stroke-dasharray: 2.5 2.5;
}

/* ---------- Collapsible project cards ---------- */
#work .investigation {
  grid-template-columns: 48px minmax(0, 1fr);
}
#work .role > summary h3 {
  color: var(--accent);
}
#work .role[open] > summary .caption {
  display: none;
}
.work-body {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 1fr);
  gap: 22px;
}
.work-body .project-description {
  align-self: start;
}
@media (max-width: 1100px) {
  #work .investigation {
    grid-template-columns: 36px minmax(0, 1fr);
  }
}
@media (max-width: 767px) {
  #work .investigation {
    grid-template-columns: 28px minmax(0, 1fr);
  }
  .work-body {
    grid-template-columns: 1fr;
  }
  .work-body .project-description {
    grid-column: auto;
  }
}

/* ---------- Left sidebar nav ---------- */
.wrap {
  display: grid;
  grid-template-columns: 186px minmax(0, 1fr);
  gap: 64px;
  align-items: start;
  padding-left: 32px;
  padding-right: 48px;
}
main {
  max-width: 980px;
}
.sidenav {
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  padding: 52px 0 28px;
}
.sidenav-name {
  font: 1.5rem/1.2 var(--display);
  letter-spacing: -0.03em;
  color: var(--ink);
  text-decoration: none;
  display: block;
}
.sidenav-role {
  margin: 6px 0 0;
  font: 12px/1.5 var(--mono);
  color: var(--muted);
}
.sidenav-links {
  display: flex;
  flex-direction: column;
  gap: 2px;
  margin-top: 36px;
}
.sidenav-links a {
  position: relative;
  font-size: 14px;
  text-decoration: none;
  color: var(--muted);
  padding: 7px 0;
  transition: color 0.18s;
}
.sidenav-links a:hover {
  color: var(--ink);
}
.sidenav-links a.active {
  color: var(--ink);
}
.sidenav-links a.active::before {
  content: "";
  position: absolute;
  left: -16px;
  top: 50%;
  width: 5px;
  height: 5px;
  margin-top: -2.5px;
  border-radius: 50%;
  background: var(--accent);
}
.sidenav-foot {
  margin-top: auto;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  font: 13px/2 var(--mono);
  color: var(--muted);
}
.sidenav-foot p {
  margin: 0;
}
.sidenav-foot a {
  color: var(--muted);
  text-decoration: none;
  margin-right: 12px;
}
.sidenav-foot a:hover {
  color: var(--accent);
}
.sidenav-copy {
  margin-top: 12px !important;
  font-size: 12px;
}
main {
  padding-bottom: 48px;
}

@media (max-width: 900px) {
  .wrap {
    display: block;
    padding-left: 24px;
    padding-right: 24px;
  }
  main {
    max-width: none;
  }
  .sidenav {
    position: static;
    min-height: 0;
    padding: 28px 0 20px;
    border-bottom: 1px solid var(--line);
  }
  .sidenav-links {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 0 24px;
    margin-top: 20px;
  }
  /* no room for the marker dot once the nav is a dropdown */
  .sidenav-links a.active::before {
    display: none;
  }
  .sidenav-foot {
    margin-top: 20px;
    padding-top: 14px;
  }
}

/* ---------- Writing ---------- */
.sitemap.two-up {
  grid-template-columns: repeat(2, 1fr);
}
.sitemap .caption {
  margin: 0;
  display: inline-block;
  padding-bottom: 6px;
}
.sitemap strong {
  display: inline-block;
  padding-bottom: 2px;
}
@media (max-width: 767px) {
  .sitemap.two-up {
    grid-template-columns: 1fr;
  }
}

/* ---------- Tighter vertical rhythm ---------- */
.intro {
  padding: 56px 0 56px;
}
.section {
  padding: 48px 0 52px;
}
.section-top {
  margin-bottom: 22px;
}
.timeline {
  margin-top: 20px;
}
.timeline article {
  padding: 20px 0;
}
.investigation {
  padding: 24px 0;
  gap: 18px;
}
.bio {
  gap: 44px;
}
.callout {
  padding: 30px 32px;
}
.sitemap {
  margin-top: 18px;
  gap: 14px;
}
.work-body {
  margin-top: 4px;
}

/* ---------- Narrower content column, no hero figure ---------- */
main {
  /* a fixed measure, not a viewport fraction: mid-size laptops were
     being squeezed to under 500px while space sat unused */
  max-width: 720px;
}
.hero {
  grid-template-columns: 1fr;
  gap: 0;
}
#about .bio {
  grid-template-columns: 1fr;
  gap: 32px;
}
@media (max-width: 900px) {
  main {
    max-width: none;
  }
}

/* ---------- Dark mode ---------- */
:root {
  color-scheme: light;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --paper: #141310;
  --surface: #1d1b16;
  --white: #1a1813;
  --ink: #ece6da;
  --muted: #9b9488;
  --line: #34312a;
  --accent: #d7929f;
  --accent-hover: #edb6c0;
}
/* the two colours that are not tokens */
:root[data-theme="dark"] .skill-cat,
:root[data-theme="dark"] .skill-group .tag {
  color: #b8b0a3;
}
:root[data-theme="dark"] .arch path.tri {
  fill: #4a3338;
}
.theme-toggle {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin-bottom: 10px;
  padding: 0;
  border: 0;
  background: none;
  cursor: pointer;
  color: var(--muted);
  font: 13px var(--mono);
}
.theme-toggle:hover {
  color: var(--accent);
}
.theme-toggle svg {
  width: 13px;
  height: 13px;
  display: block;
}

/* ---------- Experiments page ---------- */
.exp-body > p {
  font-size: 13px;
  color: var(--muted);
  margin: 14px 0 0;
}
.exp-body .prose-list {
  margin-top: 12px;
}
.exp-body .text-link {
  display: inline-block;
  margin-top: 18px;
}
.exp-scroll {
  overflow-x: auto;
  margin-top: 14px;
}
.exp-table {
  width: 100%;
  border-collapse: collapse;
  font: 11px/1.7 var(--mono);
  white-space: nowrap;
}
.exp-table th,
.exp-table td {
  text-align: left;
  padding: 7px 18px 7px 0;
  border-bottom: 1px solid var(--line);
}
.exp-table th {
  color: var(--ink);
  font-weight: 400;
}
.exp-table td {
  color: var(--muted);
}
.exp-fig {
  margin: 18px 0 0;
}
.exp-fig img {
  display: block;
  width: 100%;
  height: auto;
  /* the plots are drawn on white, so give every figure the same plate */
  background: #fff;
  border: 1px solid var(--line);
}
.exp-fig figcaption {
  margin-top: 8px;
  font: 11px/1.6 var(--mono);
  color: var(--muted);
}
.exp-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
@media (max-width: 767px) {
  .exp-pair {
    grid-template-columns: 1fr;
  }
}

/* ---------- Two-row index (Experiments) ---------- */
.stack-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  align-items: center;
  gap: 20px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line);
  text-decoration: none;
}
.stack-links .stack-row:first-child {
  border-top: 1px solid var(--line);
}
.stack-row strong {
  display: block;
  font-size: 15px;
  font-weight: 500;
  color: var(--accent);
}
.stack-row .stack-note {
  display: block;
  margin-top: 4px;
  font-size: 13px;
  color: var(--muted);
}
.stack-row .arrow {
  color: var(--accent);
  transition: transform 0.18s;
}
a.stack-row:hover strong {
  color: var(--accent-hover);
}
a.stack-row:hover .arrow {
  transform: translateX(4px);
}

/* ---------- Experiments index cards ---------- */
#experiments .investigation {
  grid-template-columns: 48px minmax(0, 1fr);
  padding: 26px 0;
  border-top: 1px solid var(--line);
}
#experiments .investigation:first-of-type {
  border-top: 0;
  padding-top: 0;
}
.exp-card {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 190px;
  gap: 24px;
  align-items: start;
}
.exp-card h3 {
  font-size: 1.25rem;
  margin: 0;
}
.exp-card h3 a {
  color: var(--accent);
  text-decoration: none;
}
.exp-card h3 a:hover {
  color: var(--accent-hover);
}
.exp-card .tags {
  margin-top: 10px;
}
.exp-card .stack-note {
  margin: 12px 0 0;
  font-size: 13px;
  color: var(--muted);
}
.exp-card .text-link {
  display: inline-block;
  margin-top: 14px;
}
.exp-thumb img {
  display: block;
  width: 100%;
  height: auto;
  background: #fff;
  border: 1px solid var(--line);
}
/* an entry without a figure keeps the full measure */
.exp-card:not(:has(.exp-thumb)) {
  grid-template-columns: minmax(0, 1fr);
}

/* ---------- Experiment detail pages ---------- */
.article-head {
  padding: 48px 0 32px;
}
.article-head h1 {
  font-size: clamp(1.7rem, 2.6vw, 2.3rem);
  max-width: 100%;
}
.article-head .lead {
  margin-top: 14px;
}
.article-head .tags {
  margin-top: 16px;
}
.article-layout {
  grid-template-columns: 170px minmax(0, 1fr);
  gap: 40px;
  padding-top: 32px;
}
.toc h2 {
  font-size: 10px;
}
.toc a {
  font-size: 12px;
  min-height: 0;
  padding: 9px 0;
  color: var(--muted);
}
.toc a:hover {
  color: var(--accent);
}
.prose section {
  margin-bottom: 36px;
}
.prose h2 {
  font-size: 1.3rem;
  margin-bottom: 14px;
}
.prose p,
.prose li {
  font-size: 13px;
}
.prose p + p {
  margin-top: 12px;
}
.prose ol {
  padding-left: 22px;
}
@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
    gap: 24px;
  }
  .toc {
    position: static;
  }
}
@media (max-width: 767px) {
  .exp-card {
    grid-template-columns: minmax(0, 1fr);
  }
}

/* ---------- Education and Skills ---------- */
.timeline .entry {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 4px 16px;
}
.timeline .entry h3 {
  margin: 0 0 4px;
}
.timeline .entry .caption {
  display: block;
  margin: 0;
  font-size: 12px;
}
.timeline .entry .period {
  flex: none;
}

/* ---------- Responsive pass ---------- */
@media (max-width: 900px) {
  .sidenav-links a {
    padding: 10px 0;
  }
  .sidenav-foot a {
    display: inline-block;
    padding: 4px 0;
  }
  .toc a {
    display: flex;
    align-items: center;
    min-height: 40px;
  }
}
@media (max-width: 767px) {
  .wrap {
    padding-left: 20px;
    padding-right: 20px;
  }
  /* the prototype's mobile type was set for a much larger scale than
     the site now uses, so headings came out bigger than on desktop */
  .hero h1 {
    font-size: clamp(1.9rem, 7.5vw, 2.4rem);
  }
  .lead,
  .hero .lead {
    font-size: 15px;
  }
  .section-top h2 {
    font-size: 1.45rem;
  }
  .investigation h3 {
    font-size: 1.2rem;
  }
  .exp-card h3 {
    font-size: 1.15rem;
  }
  .timeline h3 {
    font-size: 1.1rem;
  }
  .prose h2 {
    font-size: 1.25rem;
  }
  .exp-table {
    font-size: 10.5px;
  }
  .toc nav {
    gap: 0 14px;
  }
  .toc a {
    min-height: 36px;
  }
}
@media (max-width: 480px) {
  .wrap {
    padding-left: 16px;
    padding-right: 16px;
  }
  .section {
    padding: 28px 0 32px;
  }
  .article-head {
    padding: 28px 0 24px;
  }
  .investigation,
  #work .investigation,
  #experiments .investigation {
    grid-template-columns: 22px minmax(0, 1fr);
    gap: 10px;
  }
  .role > summary {
    padding-right: 26px;
  }
  .sidenav-links {
    gap: 0 18px;
  }
}

/* ---------- Hamburger menu on narrow screens ---------- */
.nav-toggle {
  display: none;
}
@media (max-width: 900px) {
  .sidenav {
    position: relative;
  }
  .sidenav-name,
  .sidenav-role {
    padding-right: 56px;
  }
  .nav-toggle {
    display: block;
    position: absolute;
    right: 0;
    top: 22px;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 1px solid var(--line);
    background: none;
    color: var(--accent);
    cursor: pointer;
  }
  .nav-toggle svg {
    display: block;
    width: 22px;
    height: 22px;
    margin: 0 auto;
    fill: none;
    stroke: currentColor;
    stroke-width: 1.6;
    stroke-linecap: round;
  }
  .nav-toggle .ex {
    display: none;
  }
  .nav-toggle[aria-expanded="true"] .bars {
    display: none;
  }
  .nav-toggle[aria-expanded="true"] .ex {
    display: block;
  }
  /* collapsed only when the toggle can actually open it again */
  .js .sidenav-links,
  .js .sidenav-foot {
    display: none;
  }
  .js .sidenav.open .sidenav-links {
    display: flex;
    flex-direction: column;
    gap: 0;
    margin-top: 18px;
  }
  .js .sidenav.open .sidenav-foot {
    display: block;
  }
}

@media (max-width: 900px) {
  /* the name and role belong to the sidebar, not to a menu bar */
  .sidenav-name,
  .sidenav-role {
    display: none;
  }
  .sidenav {
    padding: 14px 0 12px;
  }
  /* with nothing to sit beside, the toggle holds the bar open itself */
  .nav-toggle {
    position: static;
    align-self: flex-end;
    top: auto;
    right: auto;
  }
  .js .sidenav.open .sidenav-links {
    margin-top: 14px;
  }
}
