:root {
  color-scheme: light dark;
  --bg: #fdfdfc;
  --text: #1f2328;
  --muted: #59636e;
  --rule: #d8dee4;
  --accent: #0b5cad;
  --measure: 46rem;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #15181c;
    --text: #e6e8eb;
    --muted: #9aa4ae;
    --rule: #30363d;
    --accent: #7cb7f5;
  }
}

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

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

body {
  margin: 0;
  padding: 2.5rem 1rem 4rem;
  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;
}

.masthead,
main {
  max-width: var(--measure);
  margin-inline: auto;
}

a {
  color: var(--accent);
  text-underline-offset: 0.15em;
}

h1,
h2,
h3,
h4 {
  line-height: 1.25;
  margin: 0;
}

p {
  margin: 0 0 0.75rem;
}

ul {
  margin: 0;
  padding-left: 1.25rem;
}

li + li {
  margin-top: 0.5rem;
}

li ul {
  margin-top: 0.5rem;
}

.masthead {
  padding-bottom: 1.5rem;
  border-bottom: 2px solid var(--text);
}

.masthead h1 {
  font-size: clamp(2rem, 6vw, 2.75rem);
  letter-spacing: -0.02em;
}

.role {
  margin: 0.25rem 0 0;
  font-size: 1.2rem;
}

.location {
  margin: 0;
  color: var(--muted);
}

.contact {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem 1.25rem;
  margin-top: 0.75rem;
  padding: 0;
  list-style: none;
}

.contact li + li {
  margin-top: 0;
}

main > section {
  padding-top: 2rem;
}

h2 {
  margin-bottom: 1rem;
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-bottom: 1px solid var(--rule);
  padding-bottom: 0.35rem;
}

.job-header h3 {
  font-size: 1.15rem;
}

.meta {
  color: var(--muted);
}

.period {
  margin-top: 1.5rem;
}

.period h4 {
  margin-bottom: 0.5rem;
  font-size: 1rem;
}

.entries {
  padding-left: 0;
  list-style: none;
}

.skills {
  margin: 0;
}

.skills div {
  display: grid;
  grid-template-columns: 11rem 1fr;
  gap: 1rem;
}

.skills div + div {
  margin-top: 0.4rem;
}

.skills dt {
  font-weight: 700;
}

.skills dd {
  margin: 0;
}

@media (max-width: 40rem) {
  body {
    padding-top: 1.5rem;
  }

  .skills div {
    grid-template-columns: 1fr;
    gap: 0;
  }
}

@page {
  size: A4;
  margin: 15mm 15mm 18mm;
}

@media print {
  :root {
    color-scheme: light;
    --bg: #fff;
    --text: #000;
    --muted: #333;
    --rule: #999;
    --accent: #000;
  }

  body {
    padding: 0;
    font-size: 10.5pt;
    line-height: 1.45;
  }

  .masthead,
  main {
    max-width: none;
  }

  .masthead {
    padding-bottom: 0.75rem;
  }

  .masthead h1 {
    font-size: 22pt;
  }

  main > section {
    padding-top: 1rem;
  }

  .contact a[href^="http"]::after {
    content: " (" attr(href) ")";
  }

  h2,
  h3,
  h4,
  .job-header {
    break-after: avoid;
  }

  .period > ul > li,
  .entries > li,
  .skills div {
    break-inside: avoid;
  }

  p,
  li {
    orphans: 3;
    widows: 3;
  }
}
