/* All styles live in this file. The Content-Security-Policy blocks inline styles. */

:root {
  color-scheme: light dark;

  --bg: #fbfaf7;
  --text: #1c1c1c;
  --muted: #5c5b57;
  --rule: #d8d5ce;
  --accent: #1b5a82;

  --font-body: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-head: ui-serif, Georgia, serif;
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #151618;
    --text: #e7e5e0;
    --muted: #a6a49f;
    --rule: #393a3d;
    --accent: #8fc4ea;
  }
}

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

html {
  background: var(--bg);
  -webkit-text-size-adjust: 100%;
  text-size-adjust: 100%;
}

body {
  max-width: 42rem;
  margin: 0 auto;
  padding: 3rem 1.25rem 2.5rem;
  color: var(--text);
  font-family: var(--font-body);
  font-size: 1.0625rem;
  line-height: 1.6;
  overflow-wrap: break-word;
}

@media (min-width: 40rem) {
  body {
    padding-top: 5rem;
    font-size: 1.125rem;
  }
}

/* Type */

h1,
h2,
h3 {
  font-family: var(--font-head);
  line-height: 1.25;
  text-wrap: balance;
}

h1 {
  margin: 0;
  font-size: 2.25em;
  font-weight: 400;
  letter-spacing: -0.01em;
}

h2 {
  margin: 0 0 1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--rule);
  font-size: 1.25em;
  font-weight: 400;
}

h3 {
  margin: 0;
  font-size: 1em;
  font-weight: 700;
}

p {
  margin: 0 0 1rem;
  text-wrap: pretty;
}

p:last-child {
  margin-bottom: 0;
}

a {
  color: var(--accent);
  text-decoration-line: underline;
  text-decoration-thickness: 0.075em;
  text-underline-offset: 0.2em;
}

a:hover {
  text-decoration-thickness: 0.15em;
}

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

/* Keeps en-dash compounds such as "PRC–Taiwan" on one line. */
.nowrap {
  white-space: nowrap;
}

/* Header. Small portrait beside the name on phones; larger, to the right of
   the whole header block from 36rem up. */

header {
  display: grid;
  grid-template-columns: auto 1fr;
  align-items: center;
  column-gap: 1rem;
}

.headshot {
  display: block;
  width: 4.5rem;
  height: auto;
  border-radius: 50%;
}

.lede,
.links {
  grid-column: 1 / -1;
}

@media (min-width: 36rem) {
  header {
    grid-template-columns: 1fr auto;
    align-items: start;
    column-gap: 2rem;
  }

  .headshot {
    grid-column: 2;
    grid-row: 1 / span 3;
    width: 7.5rem;
  }

  .lede,
  .links {
    grid-column: 1;
  }
}

.lede {
  margin: 0.5rem 0 0;
  font-size: 1.125em;
  line-height: 1.45;
}

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

/* Sections */

main > section {
  margin-top: 3rem;
}

.work,
.cv,
.plain {
  margin: 0;
  padding: 0;
  list-style: none;
}

.work > li + li {
  margin-top: 1.75rem;
}

.work p {
  margin: 0;
}

.work .meta {
  margin: 0.125rem 0 0.375rem;
  color: var(--muted);
  font-size: 0.9em;
}

.cv > li + li,
.plain > li + li {
  margin-top: 0.625rem;
}

.when {
  display: block;
  color: var(--muted);
  font-size: 0.9em;
  font-variant-numeric: tabular-nums;
}

.role {
  font-weight: 600;
}

@media (min-width: 36rem) {
  .cv > li {
    display: grid;
    grid-template-columns: 7.5rem 1fr;
    column-gap: 1.25rem;
    align-items: baseline;
  }
}

/* Footer */

footer {
  margin-top: 4rem;
  padding-top: 1rem;
  border-top: 1px solid var(--rule);
  color: var(--muted);
  font-size: 0.9em;
}

footer p {
  margin: 0;
}