:root {
  color-scheme: light dark;
  --bg: #fcfcfb;
  --text: #15171a;
  --soft: #383c43;
  --muted: #5a606a;
  --rule: #dcdfe3;
  --accent: #1f4f9c;
  --meta-width: 11rem;
  --meta-gap: 2.5rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #121417;
    --text: #eceef1;
    --soft: #c6cad1;
    --muted: #a0a6b0;
    --rule: #2e3238;
    --accent: #93b6f5;
  }
}

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

html {
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 1rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

h1,
h2,
h3,
p,
ul {
  margin: 0;
  padding: 0;
}

ul {
  list-style: none;
}

/* Introduction column */

.intro,
main {
  padding: clamp(2.5rem, 6vw, 5.5rem) clamp(1.25rem, 4vw, 4rem);
}

.intro {
  border-bottom: 1px solid var(--rule);
  padding-bottom: 2rem;
}

main {
  padding-top: 2.5rem;
}

h1 {
  font-size: clamp(2.5rem, 1.5rem + 3vw, 4rem);
  font-weight: 700;
  letter-spacing: -0.035em;
  line-height: 1.02;
}

.lede {
  margin-top: 1rem;
  max-width: 24rem;
  color: var(--soft);
  font-size: 1.0625rem;
  line-height: 1.5;
}

nav {
  margin-top: 1.75rem;
}

nav ul {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.5rem;
}

nav a {
  display: inline-block;
  padding: 0.25rem 0;
  color: var(--muted);
  font-size: 0.9375rem;
  text-decoration: none;
}

nav a:hover {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-thickness: 1px;
  text-underline-offset: 0.25em;
}

a:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 3px;
  border-radius: 2px;
}

/* Sections */

section {
  scroll-margin-top: 1.5rem;
}

section + section {
  margin-top: clamp(3rem, 6vw, 5rem);
}

h2 {
  margin-bottom: 1.75rem;
  padding-bottom: 0.75rem;
  border-bottom: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.12em;
  line-height: 1.4;
  text-transform: uppercase;
}

section:target h2 {
  color: var(--accent);
}

h3 {
  font-size: 1.125rem;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.3;
}

/* Experience timeline: the rail runs beside each whole entry on small screens */

.entry {
  position: relative;
  padding: 0 0 2.5rem 1.5rem;
  border-left: 1px solid var(--rule);
}

.entry:last-child {
  padding-bottom: 0;
}

.entry::before {
  content: "";
  position: absolute;
  top: 0.5rem;
  left: -4px;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--accent);
}

.role {
  margin-top: 0.15rem;
  font-size: 0.9375rem;
  font-weight: 500;
  line-height: 1.4;
}

.period {
  margin-top: 0.1rem;
  color: var(--muted);
  font-size: 0.875rem;
  line-height: 1.4;
}

.details {
  margin-top: 0.85rem;
  color: var(--soft);
}

.details li + li {
  margin-top: 0.7rem;
}

/* Projects and awards */

.item + .item {
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--rule);
}

.item p {
  margin-top: 0.35rem;
  color: var(--soft);
}

.item .result {
  color: var(--muted);
  font-size: 0.9375rem;
}

.closing {
  color: var(--soft);
}

/* Metadata column beside the description */

@media (min-width: 44rem) {
  .entry {
    display: grid;
    grid-template-columns: var(--meta-width) minmax(0, 1fr);
    column-gap: var(--meta-gap);
    padding: 0;
    border-left: 0;
  }

  .entry::before {
    left: calc(var(--meta-width) + var(--meta-gap) - 3px);
  }

  .details {
    margin-top: 0;
    padding: 0 0 2.75rem 1.75rem;
    border-left: 1px solid var(--rule);
  }

  .entry:last-child .details {
    padding-bottom: 0;
  }
}

/* Two columns with a sticky introduction */

@media screen and (min-width: 60rem) {
  :root {
    --meta-width: 10rem;
    --meta-gap: 1.75rem;
  }

  body {
    display: grid;
    grid-template-columns: minmax(19rem, 5fr) minmax(0, 9fr);
    column-gap: clamp(1rem, 3vw, 4rem);
    margin-inline: auto;
    max-width: 92rem;
  }

  .intro {
    position: sticky;
    top: 0;
    align-self: start;
    max-height: 100vh;
    overflow-y: auto;
    border-bottom: 0;
    padding-right: 1rem;
    padding-bottom: 2.5rem;
  }

  main {
    padding-top: clamp(2.5rem, 6vw, 5.5rem);
    padding-left: 0;
  }

  nav {
    margin-top: 2.5rem;
  }

  nav ul {
    display: block;
  }

  nav li + li {
    margin-top: 0.25rem;
  }

  section {
    scroll-margin-top: clamp(2.5rem, 6vw, 5.5rem);
  }
}

@media screen and (min-width: 80rem) {
  :root {
    --meta-width: 12rem;
    --meta-gap: 2.5rem;
  }
}

@media (prefers-reduced-motion: no-preference) {
  html {
    scroll-behavior: smooth;
  }

  nav a {
    transition: color 120ms ease;
  }
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --text: #000;
    --soft: #222;
    --muted: #444;
    --rule: #aaa;
    --accent: #000;
    --meta-width: 8.5rem;
    --meta-gap: 1.25rem;
  }

  @page {
    margin: 1.25cm;
  }

  html {
    scroll-behavior: auto;
  }

  body {
    font-size: 10pt;
    line-height: 1.4;
  }

  nav {
    display: none;
  }

  .intro,
  main {
    padding: 0;
  }

  .intro {
    margin-bottom: 1rem;
    padding-bottom: 0.75rem;
  }

  h1 {
    font-size: 24pt;
  }

  .lede {
    max-width: none;
    margin-top: 0.3rem;
    font-size: 10.5pt;
  }

  h2 {
    margin-bottom: 0.6rem;
    padding-bottom: 0.25rem;
    break-after: avoid;
  }

  h3 {
    font-size: 10.5pt;
    break-after: avoid;
  }

  section + section {
    margin-top: 1.1rem;
  }

  .role,
  .period,
  .item .result {
    font-size: 9.5pt;
  }

  .details li + li {
    margin-top: 0.25rem;
  }

  .entry .details {
    padding-bottom: 0.9rem;
  }

  .entry:last-child .details {
    padding-bottom: 0;
  }

  .item + .item {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
  }

  .entry,
  .item {
    break-inside: avoid;
  }
}
