:root {
  --paper: #edf0eb;
  --panel: #f8f9f6;
  --ink: #1c2a23;
  --muted: #4d5c54;
  --wire: #8fa096;
  --leaf: #2c6a4c;
  --signal: #e6b000;
  --signal-ink: #3a2c00;
  --display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --body: "Atkinson Hyperlegible", "Segoe UI", system-ui, sans-serif;
  --measure: 66ch;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 5rem; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font: 1.0625rem/1.6 var(--body);
}
img { max-width: 100%; height: auto; }
a { color: var(--leaf); text-underline-offset: 0.18em; }
a:hover { color: var(--ink); }
:focus-visible { outline: 3px solid var(--signal); outline-offset: 3px; border-radius: 2px; }

.skip { position: absolute; left: -9999px; }
.skip:focus { left: 1rem; top: 1rem; background: var(--ink); color: var(--paper); padding: .5rem 1rem; z-index: 10; }

.wrap { width: min(72rem, 100% - 2rem); margin-inline: auto; }

/* Header */
.site-header {
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  backdrop-filter: blur(6px);
  border-bottom: 1px solid color-mix(in srgb, var(--wire) 45%, transparent);
}
.site-header .wrap { display: flex; align-items: center; gap: 1rem; min-height: 4rem; }
.brand { font: 700 1.15rem/1 var(--display); color: var(--ink); text-decoration: none; margin-right: auto; }
.nav-toggle { display: none; }
.nav ul { display: flex; gap: .25rem; list-style: none; margin: 0; padding: 0; flex-wrap: wrap; }
.nav a { display: block; padding: .45rem .7rem; border-radius: 6px; color: var(--ink); text-decoration: none; }
.nav a:hover { background: var(--panel); }
.nav a[aria-current="page"] { background: var(--ink); color: var(--paper); }

@media (max-width: 760px) {
  .nav-toggle {
    display: inline-flex; align-items: center; gap: .4rem;
    font: 600 1rem var(--body); color: var(--ink);
    background: var(--panel); border: 1px solid var(--wire); border-radius: 6px; padding: .45rem .8rem;
  }
  .nav { display: none; position: absolute; left: 0; right: 0; top: 100%; background: var(--paper); border-bottom: 1px solid var(--wire); }
  .nav.open { display: block; }
  .nav ul { flex-direction: column; padding: .5rem 1rem 1rem; }
  .nav a { padding: .75rem .7rem; }
}

/* Type */
h1, h2, h3 { font-family: var(--display); line-height: 1.12; letter-spacing: -0.01em; margin: 0 0 .6em; }
h1 { font-size: clamp(2.2rem, 5.5vw, 3.6rem); font-weight: 800; }
h2 { font-size: clamp(1.6rem, 3.2vw, 2.15rem); font-weight: 700; }
h3 { font-size: 1.25rem; font-weight: 700; }
p, li { max-width: var(--measure); }
p { margin: 0 0 1em; }
.lede { font-size: 1.2rem; color: var(--muted); }

main { padding-bottom: 4rem; }
section { padding-block: clamp(2.5rem, 6vw, 4.5rem); }
section + section { border-top: 1px solid color-mix(in srgb, var(--wire) 40%, transparent); }
.page-head { padding-block: clamp(2.5rem, 6vw, 4rem) 1rem; }

/* Hero */
.hero { display: grid; grid-template-columns: 1.5fr 1fr; gap: 2rem; align-items: end; padding-top: clamp(2rem, 5vw, 4rem); }
.hero .name { font: 700 1.1rem var(--display); color: var(--muted); margin-bottom: .75rem; }
.hero h1 { font-size: clamp(2.5rem, 6.4vw, 4.6rem); max-width: 14ch; }
.hero .role { font-size: 1.15rem; color: var(--muted); }
.hero figure { margin: 0; justify-self: center; }
.hero img { width: min(300px, 70vw); display: block; }
@media (max-width: 1100px) {
  .hero { grid-template-columns: 1fr; }
  .hero figure { order: -1; justify-self: start; }
  .hero img { width: 150px; }
}

.actions { display: flex; flex-wrap: wrap; gap: .75rem; margin-top: 1.5rem; }
.btn {
  display: inline-block; padding: .7rem 1.15rem; border-radius: 8px;
  font-weight: 700; text-decoration: none; border: 2px solid var(--ink);
}
.btn-primary { background: var(--ink); color: var(--paper); }
.btn-primary:hover { background: var(--leaf); border-color: var(--leaf); color: var(--paper); }
.btn-plain { color: var(--ink); }
.btn-plain:hover { background: var(--panel); }

/* Circuit diagram: steps joined by a wire; .gate = human/automated check */
.circuit { list-style: none; padding: 0; margin: 1.5rem 0; display: grid; gap: 0; counter-reset: step; max-width: 44rem; }
.circuit li {
  position: relative; max-width: none;
  padding: .85rem 1rem .85rem 3.25rem;
  margin-left: .25rem;
}
.circuit li::before {
  content: ""; position: absolute; left: 1.05rem; top: 0; bottom: 0;
  border-left: 3px solid var(--wire);
}
.circuit li:first-child::before { top: 50%; }
.circuit li:last-child::before { bottom: 50%; }
.circuit li::after {
  content: ""; position: absolute; left: .55rem; top: 50%; transform: translateY(-50%);
  width: 1.1rem; height: 1.1rem; border-radius: 50%;
  background: var(--paper); border: 3px solid var(--ink);
}
.circuit li strong { display: block; font-family: var(--display); font-size: 1.1rem; }
.circuit li span { color: var(--muted); }
.circuit li.gate { background: var(--signal); color: var(--signal-ink); border-radius: 8px; }
.circuit li.gate span { color: var(--signal-ink); }
.circuit li.gate::after {
  /* a switch: open contact drawn as a tilted bar */
  border-radius: 0; width: 1.3rem; height: 3px; border: 0; background: var(--ink);
  transform: translateY(-50%) rotate(-30deg); left: .55rem;
}
.circuit li.loop { font-style: italic; color: var(--muted); }
.circuit li.loop::after { border-style: dashed; }

/* Horizontal circuit for the hero */
.wire-row { list-style: none; padding: 0; margin: 2rem 0 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0; }
.wire-row li { display: flex; align-items: center; font-weight: 700; max-width: none; }
.wire-row li + li::before { content: ""; width: 2rem; border-top: 3px solid var(--wire); margin-inline: .35rem; }
.wire-row .node { padding: .4rem .75rem; border: 2px solid var(--ink); border-radius: 999px; background: var(--panel); }
.wire-row .gate .node { background: var(--signal); border-color: var(--signal); color: var(--signal-ink); }
@media (max-width: 560px) {
  .wire-row { flex-direction: column; align-items: flex-start; }
  .wire-row li + li::before { width: 0; height: 1.25rem; border-top: 0; border-left: 3px solid var(--wire); margin: 0 0 0 1.25rem; }
  .wire-row li { flex-direction: column; align-items: flex-start; }
}

/* Lists of facts */
.facts { display: grid; grid-template-columns: repeat(auto-fit, minmax(15rem, 1fr)); gap: 1.5rem 2.5rem; margin: 1.5rem 0 0; }
.facts div { border-top: 3px solid var(--ink); padding-top: .75rem; }
.facts dt { font: 700 1.6rem/1.1 var(--display); }
.facts dd { margin: .35rem 0 0; color: var(--muted); }

.focus { display: grid; grid-template-columns: repeat(auto-fit, minmax(17rem, 1fr)); gap: 2rem; margin-top: 1.5rem; }
.focus h3 a { color: inherit; }

/* Timeline (Work) */
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline > li { display: grid; grid-template-columns: 11rem 1fr; gap: 1.5rem; padding-block: 1.75rem; border-top: 1px solid color-mix(in srgb, var(--wire) 50%, transparent); max-width: none; }
.timeline .when { color: var(--muted); font-weight: 700; }
.timeline ul { padding-left: 1.2rem; }
.timeline li li { margin-bottom: .4rem; }
.stack { color: var(--muted); font-size: .95rem; }
@media (max-width: 680px) { .timeline > li { grid-template-columns: 1fr; gap: .25rem; } }

/* Projects */
.project { padding-block: 1.5rem; border-top: 1px solid color-mix(in srgb, var(--wire) 50%, transparent); }
.project:first-of-type { border-top: 0; }
.tag { display: inline-block; font-size: .85rem; font-weight: 700; padding: .1rem .55rem; border-radius: 999px; background: var(--panel); border: 1px solid var(--wire); margin-bottom: .6rem; }

/* FAQ */
details { border-top: 1px solid color-mix(in srgb, var(--wire) 50%, transparent); padding-block: 1rem; max-width: var(--measure); }
details:last-of-type { border-bottom: 1px solid color-mix(in srgb, var(--wire) 50%, transparent); }
summary { cursor: pointer; font: 700 1.1rem var(--display); }
details p { margin-top: .75rem; }

.note { background: var(--panel); border-left: 4px solid var(--leaf); padding: 1rem 1.25rem; border-radius: 0 8px 8px 0; max-width: var(--measure); }

/* Footer */
.site-footer { background: var(--ink); color: var(--paper); padding-block: 3rem 2rem; }
.site-footer a { color: var(--paper); }
.site-footer h2 { color: var(--paper); }
.contact { list-style: none; padding: 0; display: flex; flex-wrap: wrap; gap: .75rem 1.75rem; margin: 0 0 2rem; }
.contact a { font-weight: 700; }
.fine { font-size: .9rem; opacity: .8; display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; }
.fine a { opacity: .9; }

@media (prefers-reduced-motion: no-preference) {
  .wire-row li { animation: on .5s ease-out both; }
  .wire-row li:nth-child(2) { animation-delay: .15s; }
  .wire-row li:nth-child(3) { animation-delay: .3s; }
  .wire-row li:nth-child(4) { animation-delay: .45s; }
  @keyframes on { from { opacity: 0; transform: translateX(-6px); } }
}
